FEDRA emulsion software from the OPERA Collaboration
emtra.cpp File Reference
#include <string.h>
#include <iostream>
#include <TEnv.h>
#include "EdbLog.h"
#include "EdbScanProc.h"
#include "EdbScanTracking.h"
Include dependency graph for emtra.cpp:

Functions

int main (int argc, char *argv[])
 
void MakeEraseFiles (EdbID id, TEnv &env)
 
void print_help_message ()
 
void set_default (TEnv &cenv)
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
76 {
77  if (argc < 2) { print_help_message(); return 0; }
78 
79  TEnv cenv("trackenv");
81  gEDBDEBUGLEVEL = cenv.GetValue("emtra.EdbDebugLevel" , 1);
82  const char *env = cenv.GetValue("emtra.env" , "track.rootrc");
83  const char *outdir = cenv.GetValue("emtra.outdir" , "..");
84 
85  bool do_set = false;
86  bool do_new = false;
87  bool do_pred = false;
88  bool do_make_erase_file = false;
89  bool do_VSB = false;
90  Int_t pred_plate = 0, to_plate=0;
91  Int_t brick=0, plate=0, major=0, minor=0;
92  Int_t ix = -1, iy = -1; //cell numbers
93 
94  for(int i=1; i<argc; i++ ) {
95  char *key = argv[i];
96 
97  if(!strncmp(key,"-set=",5))
98  {
99  if(strlen(key)>5) sscanf(key+5,"%d.%d.%d.%d",&brick,&plate,&major,&minor);
100  do_set=true;
101  }
102  else if(!strncmp(key,"-o=",3))
103  {
104  if(strlen(key)>3) outdir=key+3;
105  }
106  else if(!strncmp(key,"-new",4))
107  {
108  do_new=true;
109  }
110  else if(!strncmp(key,"-pred=",6))
111  {
112  if(strlen(key)>6) {
113  pred_plate = atoi(key+6);
114  do_pred=true;
115  }
116  }
117  else if(!strncmp(key,"-makeerasefile",14))
118  {
119  do_make_erase_file=true;
120  }
121  else if(!strncmp(key,"-VSB=",5))
122  {
123  if(strlen(key)>5) {
124  do_VSB=true;
125  to_plate = atoi(key+5);
126  }
127  }
128  else if(!strncmp(key,"-v=",3))
129  {
130  if(strlen(key)>3) gEDBDEBUGLEVEL = atoi(key+3);
131  }
132  else if(!strncmp(key,"-ix=",4))
133  {
134  if(strlen(key)>4) ix = atoi(key+4);
135  }
136  else if(!strncmp(key,"-iy=",4))
137  {
138  if(strlen(key)>4) iy = atoi(key+4);
139  }
140  }
141 
142  if(!do_set) { print_help_message(); return 0; }
143 
144  cenv.SetValue("emtra.env" , env);
145  cenv.ReadFile( cenv.GetValue("emtra.env" , "track.rootrc") ,kEnvLocal);
146  cenv.SetValue("emtra.outdir" , outdir);
147  cenv.WriteFile("track.save.rootrc");
148 
149  if(do_set&&(!do_VSB)) {
152  printf("\n----------------------------------------------------------------------------\n");
153  printf("tracking set %d.%d.%d.%d\n", brick,plate, major,minor);
154  printf("----------------------------------------------------------------------------\n\n");
155 
156  EdbID id(brick,plate,major,minor);
158  ss->Brick().SetID(brick);
159  if(do_new)
160  {
161  EdbScanTracking est;
162  est.eSproc=&sproc;
163  est.TrackSetBT(id,cenv,ix,iy);
164  }
165  else if(do_make_erase_file){
166  MakeEraseFiles(id, cenv);
167  }
168  else {
169  //ss->MakePIDList();
170  //sproc.AssembleScanSet(*ss);
171 
172 // TCut c = gEnv->GetValue("emtra.cpcut" ,"s.eW>13&&eCHI2P<2.5&&s1.eFlag>=0&&s2.eFlag>=0&&eN1==1&&eN2==1");
173 // EdbScanCond cond;
174 // cond.Print();
175 // sproc.TrackSetBT(*ss,cond,c);
176 
178  }
179  }
180  if(do_VSB) {
183  printf("\n----------------------------------------------------------------------------\n");
184  printf("do virtual scanback in %d.%d.%d.%d for the plate %d\n", brick,plate, major,minor, pred_plate);
185  printf("----------------------------------------------------------------------------\n\n");
186 
187  EdbID id(brick,plate,major,minor);
189  //ss->Brick().SetID(brick);
190  //sproc.AssembleScanSet(*ss);
191 
192 
193  EdbID predid(id);
194  predid.ePlate = pred_plate;
195 
196  //sproc.FindPredictionsRaw(predid,predid);
197 
198  sproc.FindPredictionsRawSet(predid, *ss, to_plate);
199  EdbPVRec ali;
201  sproc.WriteSBTracks(*(ali.eTracks), id);
202 
203 
204  /*
205  TCut c = gEnv->GetValue("emtra.trcut" ,"nseg>2");
206 
207 
208  EdbLayer *layer = ss->GetPlate(pred_plate);
209 
210  EdbPattern pred, fnd;
211  sproc.ReadPred(pred, predid);
212  EdbRunAccess ra;
213  sproc.InitRunAccess(ra, predid);
214 
215  EdbScanCond condBT, condMT;
216  sproc.FindPredictionsRaw( pred, fnd, ra, condBT, condMT );
217 
218  */
219 
220  }
221  cenv.WriteFile("track.save.rootrc");
222 
223  return 1;
224 }
BRICK brick
Definition: RecDispMC.C:103
EdbPVRec * ali
Definition: align.C:1
Definition: EdbID.h:7
Definition: EdbPVRec.h:148
TObjArray * eTracks
Definition: EdbPVRec.h:161
Definition: EdbScanProc.h:12
int TrackSetBT(EdbScanSet &sc, TEnv &cenv)
Definition: EdbScanProc.cxx:601
int ReadFoundTracks(EdbScanSet &ss, EdbPVRec &ali, int flag=-1)
Definition: EdbScanProc.cxx:220
int WriteSBTracks(TObjArray &tracks, EdbID id)
Definition: EdbScanProc.cxx:1438
int FindPredictionsRawSet(EdbID idp, EdbScanSet &ss, int npl)
Definition: EdbScanProc.cxx:2098
TString eProcDirClient
Definition: EdbScanProc.h:14
EdbScanSet * ReadScanSet(EdbID id)
Definition: EdbScanProc.cxx:1521
Definition: EdbScanSet.h:11
Definition: EdbScanTracking.h:97
EdbScanProc * eSproc
Definition: EdbScanTracking.h:102
void TrackSetBT(EdbID id, TEnv &env, Int_t ix=-1, Int_t iy=-1)
Definition: EdbScanTracking.cxx:588
EdbScanProc * sproc
Definition: comptonmap.cpp:29
TEnv cenv("emrec")
bool do_set
Definition: emrec.cpp:36
const char * outdir
Definition: emrec.cpp:37
void set_default(TEnv &cenv)
Definition: emtra.cpp:31
void print_help_message()
Definition: emtra.cpp:14
void MakeEraseFiles(EdbID id, TEnv &env)
Definition: emtra.cpp:227
gEDBDEBUGLEVEL
Definition: energy.C:7
ss
Definition: energy.C:62
Int_t plate
Definition: merge_Energy_SytematicSources_Electron.C:1
UInt_t id
Definition: tlg2pattern.C:118

◆ MakeEraseFiles()

void MakeEraseFiles ( EdbID  id,
TEnv &  env 
)
228 {
230  sproc.eProcDirClient = cenv.GetValue("emtra.outdir" , "..");
231  EdbPVRec ali;
232  sproc.ReadTracksTree(id, ali, "1");
233 
234  for(int i=0; i<60; i++)
235  if( ali.GetPattern(i) ) {
236  EdbPattern *pat = ali.GetPattern(i);
237  //pat->SetPID( pat->GetSegment(0)->Vid(0));
238  pat->SetPID( pat->GetSegment(0)->Plate() );
239  printf(" %d PID=%d ID=%d nseg=%d\n", i, pat->PID(), pat->ID(), pat->N() );
240 
241  EdbID idp(id); idp.ePlate=pat->PID();
242  sproc.MakeEraseFile(idp, *pat);
243  }
244 
245 }
Definition: EdbPattern.h:280
void SetPID(int pid)
Definition: EdbPattern.h:319
int PID() const
Definition: EdbPattern.h:329
int ID() const
Definition: EdbPattern.h:328
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
int ReadTracksTree(EdbID id, EdbPVRec &ali, TCut cut="1")
Definition: EdbScanProc.cxx:644
void MakeEraseFile(EdbID id, EdbPattern &pat)
Definition: EdbScanProc.cxx:311
Int_t Plate() const
Definition: EdbSegP.h:156
Int_t N() const
Definition: EdbPattern.h:89
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66

◆ print_help_message()

void print_help_message ( )
15 {
16  cout<< "\nUsage: \n\t emtra -set=ID [ -o=DATA_DIRECTORY -v=DEBUG] \n\n";
17  cout<< "\t\t ID - id of the dataset formed as BRICK.PLATE.MAJOR.MINOR \n";
18  cout<< "\t\t DEBUG - verbosity level: 0-print nothing, 1-errors only, 2-normal, 3-print all messages\n";
19  cout<< "\t\t -m - make the affine files starting from EdbScanSet\n";
20  cout<< "\t\t -new - apply new tracking algorithm\n";
21  cout<< "\t\t -VSB=plate - \n";
22  cout<< "\t\t -makeerasefile - to create files *.er.root with the list of basetracks from the trk.root to be excluded from the next tracking\n";
23  cout<< "\t\t -o - the data directory\n";
24  cout<< "\nExample: \n";
25  cout<< "\t emtra -id=4554.10.1.0 -o=/scratch/BRICKS \n";
26  cout<< "\n If the data location directory if not explicitly defined\n";
27  cout<< " the current directory will be assumed to be the brick directory \n";
28  cout<<endl;
29 }

◆ set_default()

void set_default ( TEnv &  cenv)
32 {
33  // default parameters for tracking
34  cenv.SetValue("fedra.readCPcut" , "eCHI2P<2.5&&s.eW>13&&eN1==1&&eN2==1&&s1.eFlag>=0&&s2.eFlag>=0");
35  cenv.SetValue("fedra.track.TrZmap", "2400 0 120000 2000 0 100000 30" );
36  cenv.SetValue("fedra.track.npass" , 1 );
37  cenv.SetValue("fedra.track.minPlate" ,-999 );
38  cenv.SetValue("fedra.track.maxPlate" , 999 );
39  cenv.SetValue("fedra.track.refPlate" , 999 );
40  cenv.SetValue("fedra.track.nsegmin" , 2 );
41  cenv.SetValue("fedra.track.ngapmax" , 4 );
42  cenv.SetValue("fedra.track.DZGapMax" , 5000. );
43  cenv.SetValue("fedra.track.DRmax" , 45. );
44  cenv.SetValue("fedra.track.DTmax" , 0.07 );
45 
46  cenv.SetValue("fedra.track.PredictionCutXY" , "0 0. 0. 0. 0."); // doit x0 y0 dx dy
47  cenv.SetValue("fedra.track.PredictionCutZ" , "0 0. 0. 0."); // doit z0 zmin zmax
48  cenv.SetValue("fedra.track.PredictionCutAng" , "0 0. 0. 0. 0."); // doit tx ty dtx dty
49  cenv.SetValue("fedra.track.Sigma0" , "3 3 0.005 0.005");
50  cenv.SetValue("fedra.track.PulsRamp0" , "15 20");
51  cenv.SetValue("fedra.track.PulsRamp04" , "15 20");
52  cenv.SetValue("fedra.track.Degrad" , 4 );
53 
54  cenv.SetValue("fedra.track.probmin" , 0.001 );
55  cenv.SetValue("fedra.track.momentum" , 2 );
56  cenv.SetValue("fedra.track.mass" , 0.14 );
57  cenv.SetValue("fedra.track.do_use_mcs", 0 );
58  cenv.SetValue("fedra.track.RadX0" , 5810.);
59 
60  cenv.SetValue("fedra.track.do_track" , true );
61  cenv.SetValue("fedra.track.do_shtag" , false );
62  cenv.SetValue("fedra.track.erase" , false );
63  cenv.SetValue("fedra.track.do_realign" , 0 );
64  cenv.SetValue("fedra.track.do_misalign" , false );
65  cenv.SetValue("fedra.track.do_misalign" , false );
66  cenv.SetValue("fedra.track.misalign_offset", 500.);
67  cenv.SetValue("fedra.track.do_local_corr" , 1 );
68  cenv.SetValue("fedra.track.do_comb" , 0 );
69  cenv.SetValue("fedra.track.NsegMin" , 2 );
70  cenv.SetValue("emtra.outdir" , "..");
71  cenv.SetValue("emtra.env" , "track.rootrc");
72  cenv.SetValue("emtra.EdbDebugLevel" , 1);
73 }