FEDRA emulsion software from the OPERA Collaboration
recset.cpp File Reference
#include <iostream>
#include "EdbLog.h"
#include "EdbDataSet.h"
Include dependency graph for recset.cpp:

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
13 {
14  if (argc < 3)
15  {
16  cout<< "usage: \n \trecset { -l | -a | -t | -f | ... } input_data_set_file \n\n";
17  cout<< "\t\t -ccd - to remove ccd defects (update par/xxx.par file)\n";
18  cout<< "\t\t -l - link up/down\n";
19  cout<< "\t\t -ang - correct up/down angles offset and rotations\n";
20  cout<< "\t\t -a[n] - plate to plate alignment (if n=2: rigid patterns) \n";
21  cout<< "\t\t -f[n] - fine alignment based on passed-through tracks (if n=2: rigid patterns)\n";
22  cout<< "\t\t -z[n] - z-position ajustment, n is the tracks length in segs (minimum 2 is a default)\n";
23  cout<< "\t\t -t[n] - tracking (if n>1, holes insertion started - historical option - NOT recommended!)\n";
24  cout<< "\t\t -t -p[p] - tracking&propagation (p is the momentum of the particle in [GeV])\n";
25  cout<< "\t\t -nu - suppress the update of par files\n";
26  cout<< "\t\t -w - write the EdbPVRec object into a root file (useful for batch processing)\n";
27  cout<< "\t\t -s - do shower-reconstruction (To Be Implemented)\n";
28  cout<< "\t\t -D[n] - Set FEDRA DebugLevel (0..4)\n";
29  cout<<endl;
30  return 0;
31  };
32 
33  int doCCD=0, doLink=0, doAlign=0, doTrack=0, doTrackCarbonium=0,
34  doFine=0, doZ=0, doAngles=0, doRaw=0, noUpdate=0, doWritePVR=0;
35  int doDEBUGLEVEL=-1;
36 
37  float doPropagation=-1;
38 
39  char *name = argv[argc-1];
40 
41  for(int i=1; i<argc-1; i++ ) {
42  char *key = argv[i];
43 
44  if (!strcmp(key,"-ccd")) doCCD =1;
45  else if(!strcmp(key,"-ang")) doAngles =1;
46  else if(!strcmp(key,"-rt")) doRaw =1;
47  else if(!strcmp(key,"-nu")) noUpdate =1;
48  else if(!strcmp(key,"-l")) doLink =1;
49  else if(!strncmp(key,"-a",2) && strcmp(key,"-ang") ) {
50  if(strlen(key)>2)
51  sscanf(key+2,"%d",&doAlign);
52  if(doAlign==0) doAlign=1;
53  }
54  else if(!strncmp(key,"-f",2)) {
55  if(strlen(key)>2)
56  sscanf(key+2,"%d",&doFine);
57  if(doFine==0) doFine=1;
58  }
59  else if(!strncmp(key,"-z",2)) {
60  if(strlen(key)>2)
61  sscanf(key+2,"%d",&doZ);
62  if(doZ<2) doZ=2;
63  }
64  else if(!strncmp(key,"-tc",3)) {
65  if(strlen(key)>3)
66  sscanf(key+2,"%d",&doTrackCarbonium);
67  if(doTrack==0) doTrackCarbonium=1;
68  }
69  else if(!strncmp(key,"-t",2)) {
70  if(strlen(key)>2)
71  sscanf(key+2,"%d",&doTrack);
72  if(doTrack==0) doTrack=1;
73  }
74  else if(!strncmp(key,"-p",2)) {
75  if(strlen(key)>2)
76  sscanf(key+2,"%f",&doPropagation);
77  }
78  else if(!strncmp(key,"-D",2)) {
79  if(strlen(key)>2)
80  sscanf(key+2,"%d",&doDEBUGLEVEL);
81  }
82 
83  else if(!strcmp(key,"-w")) doWritePVR=1;
84  }
85 
86  printf("recset options: doCCD=%d doLink=%d doAlign=%d doTrack=%d doFine=%d doZ=%d doAngles=%d doRaw=%d doPropagation=%f noUpdate=%d doWritePVR=%d name=%s\n",
87  doCCD, doLink, doAlign, doTrack, doFine, doZ, doAngles, doRaw, doPropagation, noUpdate, doWritePVR, name);
88 
90  proc.SetNoUpdate(noUpdate);
91 
92  if(doDEBUGLEVEL>=0&&doDEBUGLEVEL<=4) {
93  gEDBDEBUGLEVEL=doDEBUGLEVEL;
94  cout << "gEDBDEBUGLEVEL = " << gEDBDEBUGLEVEL<< endl;
95  }
96  if(doCCD) {
97  proc.CheckCCD();
98  doCCD=0;
99  }
100  if(doLink) {
101  proc.Link();
102  doLink=0;
103  }
104  if(doTrack&&doAlign) {
105  proc.AlignLinkTracks(doTrack,doAlign);
106  doTrack=0;
107  doAlign=0;
108  }
109  if(doAlign) {
110  proc.Align(doAlign);
111  doAlign=0;
112  }
113  if(doAngles) {
115  doAngles=0;
116  }
117  if(doTrack) {
118  proc.LinkTracks(doTrack, doPropagation);
119  doTrack=0;
120  doPropagation=-1;
121  }
122  if(doTrackCarbonium) {
123  proc.LinkTracksC(doTrackCarbonium, doPropagation);
124  doTrackCarbonium=0;
125  doPropagation=-1;
126  }
127  if(doFine) {
128  proc.FineAlignment(doFine);
129  doFine=0;
130  }
131  if(doZ) {
132  proc.AjustZ(doZ);
133  doZ=0;
134  }
135  if(doRaw) {
136  proc.LinkRawTracks(doRaw);
137  doRaw=0;
138  }
139 
140  if(doWritePVR) {
141  cout << "recset: Create the EdbPVRec object from the EdbDataProc object" << endl;
142  EdbPVRec *ali = proc.GetPVR();
143  if (NULL==ali) {
144  ali = new EdbPVRec();
146  proc.SetPVR(ali);
147  }
148  else {
149  ali->Print();
150  }
151  cout << "recset: Create the EdbPVRec object from the EdbDataProc object. Done." << endl;
152  ali->Print();
153 
154  cout << "recset: Write EdbPVRec object into file: ScanVolume_Ali.root." << endl;
155  TFile* file = new TFile("ScanVolume_Ali.root","RECREATE");
156  ali->Write();
157  file->Close();
158  cout << "recset: Write EdbPVRec object into file: ScanVolume_Ali.root. Done." << endl;
159 
160  doWritePVR=0;
161  }
162 
163  return 0;
164 }
EdbPVRec * ali
Definition: align.C:1
Definition: EdbDataSet.h:180
void SetNoUpdate(int nu)
Definition: EdbDataSet.h:225
void AjustZ(int doZ)
Definition: EdbDataSet.cxx:2247
void AlignLinkTracks(int alg=0, int alignFlag=0)
Definition: EdbDataSet.cxx:2479
void Align(int alignFlag)
Definition: EdbDataSet.cxx:2231
void CorrectAngles()
Definition: EdbDataSet.cxx:1867
EdbPVRec * GetPVR() const
Definition: EdbDataSet.h:198
int InitVolume(int datatype=0, const char *rcut="1")
Definition: EdbDataSet.cxx:2071
int Link()
Definition: EdbDataSet.cxx:1654
void LinkRawTracks(int alg=0)
Definition: EdbDataSet.cxx:2377
void LinkTracks(int alg=0, float p=-1.)
Definition: EdbDataSet.cxx:2314
void FineAlignment(int doFine)
Definition: EdbDataSet.cxx:2400
int CheckCCD()
Definition: EdbDataSet.cxx:1636
void SetPVR(EdbPVRec *pvr)
Definition: EdbDataSet.h:199
void LinkTracksC(int alg=0, float p=-1.)
Definition: EdbDataSet.cxx:2349
Definition: EdbPVRec.h:148
void Print() const
Definition: EdbPattern.cxx:1853
gEDBDEBUGLEVEL
Definition: energy.C:7
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24
#define NULL
Definition: nidaqmx.h:84
EdbDataProc * proc
Definition: read_pvr.C:3
TFile * file
Definition: write_pvr.C:3