#include <new>#include <limits.h>#include <string.h>#include <stdio.h>#include <unistd.h>#include <iostream>#include "Rerootjob/RecoControl.h"#include "REROOT_Classes/REROOT_UserVisitor.h"#include "REROOT_Classes/REROOT_Geom.h"#include "TROOT.h"#include "TFile.h"#include "TTree.h"#include "TBranch.h"#include "TSystem.h"Go to the source code of this file.
Functions | |
| int | atoi (const char *) throw () |
| size_t | strlen (const char *) throw () |
| void | processArgs (int argc, char **argv) |
| void | processSingleFile (RecoControl &app, TTree *&tgeo, TTree *&tevt, REROOT_Geom *&rgeo, REROOT_Event *&revt, Int_t &idcurgeom, Int_t &nb) |
| int | main (int argc, char **argv) |
Variables | |
| int | nevtot = 10 |
| char | inlist [FILENAME_MAX] |
| char | infile [FILENAME_MAX] |
| char | outfile [FILENAME_MAX] |
| char | optfile [FILENAME_MAX] |
| char | option [FILENAME_MAX] |
| const char * | listFileFlag = "to-be-determined-from-inlist" |
| const char * | optfileDefault = "reco_options" |
| const char * | optfilePath |
| bool | quiet = false |
|
|
||||||||||||
|
COMMAND LINE CALIB CONSTANTS BEAM RUN KEY Cerenkov ADC cuts: ATTENUATION PARAMS FILE + TREE Definition at line 163 of file rerootjob.cc. References gSystem(), infile, inlist, listFileFlag, nevtot, optfile, optfileDefault, optfilePath, option, outfile, REROOT_Geom::Print(), processArgs(), processSingleFile(), REROOT_Geom::set_AvailNuclei_isWanted(), REROOT_Geom::set_BeamSystem_isWanted(), REROOT_Geom::set_CellPos_isWanted(), REROOT_Geom::set_CoilTube_isWanted(), REROOT_Event::set_DigitPln_isWanted(), REROOT_Event::set_EmuDigit_isWanted(), REROOT_Event::set_EmuHit_isWanted(), REROOT_Event::set_EventHistory_isWanted(), REROOT_Event::set_FLSDigiCell_isWanted(), REROOT_Event::set_FLSDigiPln_isWanted(), REROOT_Event::set_FLSDigit_isWanted(), REROOT_Event::set_FLSDigiView_isWanted(), REROOT_Event::set_FLSHit_isWanted(), REROOT_Geom::set_FLSParam_isWanted(), REROOT_Event::set_FluxInfo_isWanted(), REROOT_Event::set_FluxWgt_isWanted(), REROOT_Geom::set_GAFKey_isWanted(), REROOT_Event::set_GAFKey_isWanted(), REROOT_Geom::set_GeomMisc_isWanted(), REROOT_Event::set_HitPln_isWanted(), REROOT_Event::set_LSTHit_isWanted(), REROOT_Event::set_LSTProto_isWanted(), REROOT_Event::set_LSTStrip_isWanted(), REROOT_Event::set_LSTWire_isWanted(), REROOT_Geom::set_MassDistrib_isWanted(), REROOT_Geom::set_Material_isWanted(), REROOT_Geom::set_MdlOrg_isWanted(), REROOT_Geom::set_Mixture_isWanted(), REROOT_Event::set_MuonTrkHeader_isWanted(), REROOT_Event::set_MuonTrkPoint_isWanted(), REROOT_Event::set_NeuKin_isWanted(), REROOT_Event::set_NeuVtx_isWanted(), REROOT_Event::set_PEArrival_isWanted(), REROOT_Geom::set_PlanePos_isWanted(), REROOT_Geom::set_PlaneSpec_isWanted(), REROOT_Geom::set_PlexusAdd_isWanted(), REROOT_Geom::set_Pln2MUX_isWanted(), REROOT_Event::set_RecoMuon_isWanted(), REROOT_Event::set_RecoShwDir_isWanted(), REROOT_Event::set_RecoShwEnergy_isWanted(), REROOT_Event::set_RecoVtx_isWanted(), REROOT_Geom::set_Rotm_isWanted(), REROOT_Event::set_RPCHit_isWanted(), REROOT_Event::set_StdHep_isWanted(), REROOT_Event::set_StdHepHead_isWanted(), REROOT_Geom::set_SubVolPos_isWanted(), REROOT_Geom::set_SubVolSpec_isWanted(), REROOT_Geom::set_SuperModule_isWanted(), REROOT_Geom::set_TMedium_isWanted(), REROOT_Geom::set_TPar_isWanted(), REROOT_Event::set_TstHit_isWanted(), REROOT_Geom::set_TubePixelInfo_isWanted(), and REROOT_Geom::set_TubePixelMap_isWanted(). 00164 {
00165 processArgs(argc,argv);
00166
00167 // Instantiate ROOT engine.
00168 TROOT rerootjob("rerootjob","ROOT interface to reco_MINOS");
00169
00170 cout << endl << "Instantiate ROOT engine for reco_MINOS." << endl
00171 << endl;
00172
00173 // Create and initialize ROOT output file for this JOB.
00174 TFile *hfile;
00175 hfile = new TFile(outfile,"RECREATE","ROOT file reroot");
00176
00177 // Create ROOT Tree.
00178 TTree *tgeo = new TTree("GEOM","REROOT Geometry Tree");
00179 TTree *tevt = new TTree("GEVT","REROOT Event Tree");
00180
00181 REROOT_Geom *rgeo = 0; // Pointer to latest REROOT_Geom.
00182 REROOT_Event *revt = 0; // Pointer to latest REROOT_Event.
00183
00184 // Declare branches.
00185 TBranch *bGeom = 0;
00186 TBranch *bEvent = 0;
00187
00188 // Splitting for REROOT_Geom and REROOT_Event branches.
00189 Int_t gsplit = 1; // No automatic ROOT splitting for REROOT_Geom.
00190 Int_t esplit = 1; // Automatic ROOT splitting for REROOT_Event.
00191 Int_t bgsize = 4000;
00192 Int_t besize = 4000;
00193
00194 // Create REROOT_Geom and REROOT_Event branches.
00195 bGeom = tgeo->Branch("REROOT_Geom",
00196 "REROOT_Geom", &rgeo, bgsize, gsplit);
00197 bEvent = tevt->Branch("REROOT_Event",
00198 "REROOT_Event", &revt, besize, esplit);
00199
00200 // Specify which ADAMO Class objects to create from GAF buffer.
00201 char* optfilepath = gSystem->ExpandPathName(optfilePath);
00202 //cout << " optfilepath is '" << optfilepath << "'" << endl;
00203 char* realoptfile = gSystem->Which(optfilepath,optfile,kReadPermission);
00204 if ( ! realoptfile ) {
00205 // revert to the default if what was given came up empty
00206 realoptfile = optfile; // the original buffer
00207 strcpy(optfile,optfileDefault);
00208 }
00209
00210 cout << "\nRead options from file: " << realoptfile << endl << endl;
00211
00212 ifstream olist(realoptfile); // Read from option list file.
00213 while (olist>>option) {
00214 if (!strcmp(option,"REROOT_Event::DigitPln"))
00215 REROOT_Event::set_DigitPln_isWanted(kTRUE);
00216 else if (!strcmp(option,"REROOT_Event::EmuDigit"))
00217 REROOT_Event::set_EmuDigit_isWanted(kTRUE);
00218 else if (!strcmp(option,"REROOT_Event::EmuHit"))
00219 REROOT_Event::set_EmuHit_isWanted(kTRUE);
00220 else if (!strcmp(option,"REROOT_Event::EventHistory"))
00221 REROOT_Event::set_EventHistory_isWanted(kTRUE);
00222 else if (!strcmp(option,"REROOT_Event::FLSDigiCell"))
00223 REROOT_Event::set_FLSDigiCell_isWanted(kTRUE);
00224 else if (!strcmp(option,"REROOT_Event::FLSDigiPln"))
00225 REROOT_Event::set_FLSDigiPln_isWanted(kTRUE);
00226 else if (!strcmp(option,"REROOT_Event::FLSDigit"))
00227 REROOT_Event::set_FLSDigit_isWanted(kTRUE);
00228 else if (!strcmp(option,"REROOT_Event::FLSDigiView"))
00229 REROOT_Event::set_FLSDigiView_isWanted(kTRUE);
00230 else if (!strcmp(option,"REROOT_Event::FLSHit"))
00231 REROOT_Event::set_FLSHit_isWanted(kTRUE);
00232 else if (!strcmp(option,"REROOT_Event::FluxWgt"))
00233 REROOT_Event::set_FluxWgt_isWanted(kTRUE);
00234 else if (!strcmp(option,"REROOT_Event::FluxInfo"))
00235 REROOT_Event::set_FluxInfo_isWanted(kTRUE);
00236 else if (!strcmp(option,"REROOT_Event::GAFKey"))
00237 REROOT_Event::set_GAFKey_isWanted(kTRUE);
00238 else if (!strcmp(option,"REROOT_Event::HitPln"))
00239 REROOT_Event::set_HitPln_isWanted(kTRUE);
00240 else if (!strcmp(option,"REROOT_Event::LSTHit"))
00241 REROOT_Event::set_LSTHit_isWanted(kTRUE);
00242 else if (!strcmp(option,"REROOT_Event::LSTProto"))
00243 REROOT_Event::set_LSTProto_isWanted(kTRUE);
00244 else if (!strcmp(option,"REROOT_Event::LSTStrip"))
00245 REROOT_Event::set_LSTStrip_isWanted(kTRUE);
00246 else if (!strcmp(option,"REROOT_Event::LSTWire"))
00247 REROOT_Event::set_LSTWire_isWanted(kTRUE);
00248 else if (!strcmp(option,"REROOT_Event::MuonTrkHeader"))
00249 REROOT_Event::set_MuonTrkHeader_isWanted(kTRUE);
00250 else if (!strcmp(option,"REROOT_Event::MuonTrkPoint"))
00251 REROOT_Event::set_MuonTrkPoint_isWanted(kTRUE);
00252 else if (!strcmp(option,"REROOT_Event::NeuKin"))
00253 REROOT_Event::set_NeuKin_isWanted(kTRUE);
00254 else if (!strcmp(option,"REROOT_Event::NeuVtx"))
00255 REROOT_Event::set_NeuVtx_isWanted(kTRUE);
00256 else if (!strcmp(option,"REROOT_Event::PEArrival"))
00257 REROOT_Event::set_PEArrival_isWanted(kTRUE);
00258 else if (!strcmp(option,"REROOT_Event::RecoMuon"))
00259 REROOT_Event::set_RecoMuon_isWanted(kTRUE);
00260 else if (!strcmp(option,"REROOT_Event::RecoShwDir"))
00261 REROOT_Event::set_RecoShwDir_isWanted(kTRUE);
00262 else if (!strcmp(option,"REROOT_Event::RecoShwEnergy"))
00263 REROOT_Event::set_RecoShwEnergy_isWanted(kTRUE);
00264 else if (!strcmp(option,"REROOT_Event::RecoVtx"))
00265 REROOT_Event::set_RecoVtx_isWanted(kTRUE);
00266 else if (!strcmp(option,"REROOT_Event::RPCHit"))
00267 REROOT_Event::set_RPCHit_isWanted(kTRUE);
00268 else if (!strcmp(option,"REROOT_Event::StdHep"))
00269 REROOT_Event::set_StdHep_isWanted(kTRUE);
00270 else if (!strcmp(option,"REROOT_Event::StdHepHead"))
00271 REROOT_Event::set_StdHepHead_isWanted(kTRUE);
00272 else if (!strcmp(option,"REROOT_Event::TstHit"))
00273 REROOT_Event::set_TstHit_isWanted(kTRUE);
00274
00275 else if (!strcmp(option,"REROOT_Geom::AvailNuclei"))
00276 REROOT_Geom::set_AvailNuclei_isWanted(kTRUE);
00277 else if (!strcmp(option,"REROOT_Geom::BeamSystem"))
00278 REROOT_Geom::set_BeamSystem_isWanted(kTRUE);
00279 else if (!strcmp(option,"REROOT_Geom::CellPos"))
00280 REROOT_Geom::set_CellPos_isWanted(kTRUE);
00281 else if (!strcmp(option,"REROOT_Geom::CoilTube"))
00282 REROOT_Geom::set_CoilTube_isWanted(kTRUE);
00283 else if (!strcmp(option,"REROOT_Geom::FLSParam"))
00284 REROOT_Geom::set_FLSParam_isWanted(kTRUE);
00285 else if (!strcmp(option,"REROOT_Geom::GAFKey"))
00286 REROOT_Geom::set_GAFKey_isWanted(kTRUE);
00287 else if (!strcmp(option,"REROOT_Geom::GeomMisc"))
00288 REROOT_Geom::set_GeomMisc_isWanted(kTRUE);
00289 else if (!strcmp(option,"REROOT_Geom::MassDistrib"))
00290 REROOT_Geom::set_MassDistrib_isWanted(kTRUE);
00291 else if (!strcmp(option,"REROOT_Geom::Material"))
00292 REROOT_Geom::set_Material_isWanted(kTRUE);
00293 else if (!strcmp(option,"REROOT_Geom::MdlOrg"))
00294 REROOT_Geom::set_MdlOrg_isWanted(kTRUE);
00295 else if (!strcmp(option,"REROOT_Geom::Mixture"))
00296 REROOT_Geom::set_Mixture_isWanted(kTRUE);
00297 else if (!strcmp(option,"REROOT_Geom::PlanePos"))
00298 REROOT_Geom::set_PlanePos_isWanted(kTRUE);
00299 else if (!strcmp(option,"REROOT_Geom::PlaneSpec"))
00300 REROOT_Geom::set_PlaneSpec_isWanted(kTRUE);
00301 else if (!strcmp(option,"REROOT_Geom::PlexusAdd"))
00302 REROOT_Geom::set_PlexusAdd_isWanted(kTRUE);
00303 else if (!strcmp(option,"REROOT_Geom::Pln2MUX"))
00304 REROOT_Geom::set_Pln2MUX_isWanted(kTRUE);
00305 else if (!strcmp(option,"REROOT_Geom::Rotm"))
00306 REROOT_Geom::set_Rotm_isWanted(kTRUE);
00307 else if (!strcmp(option,"REROOT_Geom::SubVolPos"))
00308 REROOT_Geom::set_SubVolPos_isWanted(kTRUE);
00309 else if (!strcmp(option,"REROOT_Geom::SubVolSpec"))
00310 REROOT_Geom::set_SubVolSpec_isWanted(kTRUE);
00311 else if (!strcmp(option,"REROOT_Geom::SuperModule"))
00312 REROOT_Geom::set_SuperModule_isWanted(kTRUE);
00313 else if (!strcmp(option,"REROOT_Geom::TMedium"))
00314 REROOT_Geom::set_TMedium_isWanted(kTRUE);
00315 else if (!strcmp(option,"REROOT_Geom::TPar"))
00316 REROOT_Geom::set_TPar_isWanted(kTRUE);
00317 else if (!strcmp(option,"REROOT_Geom::TubePixelInfo"))
00318 REROOT_Geom::set_TubePixelInfo_isWanted(kTRUE);
00319 else if (!strcmp(option,"REROOT_Geom::TubePixelMap"))
00320 REROOT_Geom::set_TubePixelMap_isWanted(kTRUE);
00321 else
00322 cout << "Bad option ignored: " << option << endl;
00323 }
00324
00325 RecoControl app;
00326 Int_t idcurgeom = -1; // Incremented for each REROOT_Geom record.
00327 Int_t nb = 0;
00328
00329 if ( ! strcmp(infile,listFileFlag) ) {
00330 // user wants to get file names file a list in another file
00331 cout << "\nRun Recoop on list " << inlist
00332 << " for " << nevtot << " events each file.\n";
00333
00334 ifstream clist(inlist);
00335 while (clist>>infile) {
00336 char firstChar = infile[0];
00337 if (firstChar != '#' && firstChar != '!' ) {
00338 cout << "\nRun Recoop on file " << infile
00339 << " for " << nevtot << " events in file." << endl;
00340 processSingleFile(app,tgeo,tevt,rgeo,revt,idcurgeom,nb);
00341 }
00342 else {
00343 cout << "\nSkip processing for entry: " << infile << endl;
00344 }
00345 }
00346 cout << "\nFinish list of event files: " << inlist << endl;
00347 }
00348 else {
00349 cout << "\nRun Recoop on file " << infile
00350 << " for " << nevtot << " events in file." << endl;
00351 processSingleFile(app,tgeo,tevt,rgeo,revt,idcurgeom,nb);
00352 }
00353
00354 // Close ROOT output file for this job.
00355 cout << "Close ROOT file: " << outfile << endl;
00356 hfile->Write();
00357 if (!quiet) { tgeo->Print(); tevt->Print(); }
00358 hfile->Close();
00359 cout << "ROOT file " << outfile << " closed." << endl;
00360
00361 return 0;
00362 }
|
|
||||||||||||
|
Definition at line 51 of file rerootjob.cc. References atoi(), infile, inlist, listFileFlag, nevtot, optfile, optfileDefault, option, outfile, and quiet. Referenced by main(). 00052 {
00053 strcpy(inlist,"reco_minos.gaf_list");
00054 strcpy(infile,listFileFlag);
00055 strcpy(outfile,"reroot.root");
00056 strcpy(optfile,optfileDefault);
00057 strcpy(option,"");
00058
00059 int copt;
00060 const char* optlist = "n:l:f:o:qO:h";
00061 while (( copt = getopt(argc,argv,optlist)) != EOF) {
00062 switch (copt) {
00063 case 'n':
00064 nevtot = atoi(optarg);
00065 break;
00066 case 'l':
00067 strcpy(inlist,optarg);
00068 break;
00069 case 'f':
00070 strcpy(infile,optarg);
00071 break;
00072 case 'o':
00073 strcpy(outfile,optarg);
00074 break;
00075 case 'q':
00076 quiet = true;
00077 break;
00078 case 'O':
00079 strcpy(optfile,optarg);
00080 break;
00081 case 'h':
00082 // help ...
00083 printf("%s: usage\n",argv[0]);
00084 printf(" -l inlist-filename (reco_minos.gaf_list)\n");
00085 printf(" -f gaf-filename (no-default, overrides -l flag)\n");
00086 printf(" -o output-filename (reroot.root)\n");
00087 printf(" -O option-filename (reco_options)\n");
00088 printf(" uses a path of .:$SRT_PUBLIC_CONTEXT:$SRT_PRIVATE_CONTEXT, full path okay\n");
00089 printf(" -n nevt-per-file (10)\n");
00090 printf(" -q quiet, no TTree->Print(), no visitor output\n");
00091 printf(" -h this miserable help\n");
00092 exit(1);
00093 break;
00094 default:
00095 printf("%s: unrecognized option '%c'\n",argv[0],(char)optopt);
00096 exit(1);
00097 break;
00098 }
00099 }
00100
00101 return;
00102 }
|
|
||||||||||||||||||||||||||||||||
|
Definition at line 105 of file rerootjob.cc. References RecoControl::curevent(), RecoControl::curgeom(), RecoControl::giveEventTo(), RecoControl::giveGeomTo(), infile, RecoControl::init(), nevtot, RecoControl::nextRecord(), quiet, RecoControl::reconstruction(), and REROOT_Event::Setidcurgeom(). Referenced by main(). 00109 {
00110
00111 app.init(infile,nevtot+1);
00112
00113 REROOT_UserVisitor auv;
00114
00115 Int_t numread = 0;
00116 //rwh: for (Int_t eventCount=nevtot+1; eventCount>0; eventCount--) {
00117 while (numread<nevtot) {
00118 RecoControl::rectype rectype = app.nextRecord();
00119 if (rectype==RecoControl::NONE) break; numread++;
00120
00121 // GEVT record encountered.
00122 if (rectype==RecoControl::GEVT) {
00123 // cout << "Rerootjob: Accept GEVT record" << endl;
00124 app.reconstruction();
00125 if (!quiet && numread<5) app.giveEventTo(auv);
00126
00127 // Get current REROOT_Event object.
00128 revt = app.curevent();
00129
00130 // Mark REROOT_Event with ID in JOB of corresponding REROOT_Geom object.
00131 revt->Setidcurgeom(idcurgeom);
00132
00133 // Fill REROOT_Event branch.
00134 nb += tevt->Fill();
00135 cout << "ROOT GEVT " << numread
00136 << " written. nb = " << nb
00137 << "\r";
00138 //<< endl;
00139 }
00140
00141 // GEOM record encountered.
00142 else if (rectype==RecoControl::GEOM) {
00143 numread--; // don't count geometry against evt count
00144 cout << "Rerootjob: Accept GEOM record" << endl;
00145 if (!quiet && numread<5) app.giveGeomTo(auv);
00146
00147 // Get current REROOT_Geom object.
00148 rgeo = app.curgeom();
00149
00150 // Increment idcurgeom..
00151 idcurgeom++;
00152
00153 // Fill REROOT_Geom branch.
00154 nb += tgeo->Fill();
00155 cout << "ROOT GEOM written. nb = " << nb << endl;
00156 }
00157 }
00158
00159 cout << "\nLeave Event Loop for file " << infile
00160 << " after " << numread << " records." << endl;
00161 }
|
|
|
|
|
Definition at line 38 of file rerootjob.cc. Referenced by RawQieErrorStatsBlock::FillAllMaps(), main(), and processArgs(). |
|
|
Definition at line 44 of file rerootjob.cc. Referenced by main(), and processArgs(). |
|
|
Definition at line 37 of file rerootjob.cc. Referenced by main(), processArgs(), and processSingleFile(). |
|
|
Definition at line 41 of file rerootjob.cc. Referenced by main(), and processArgs(). |
|
|
Definition at line 45 of file rerootjob.cc. Referenced by main(), and processArgs(). |
|
|
Initial value:
".:$SRT_PRIVATE_CONTEXT/Rerootjob:$SRT_PUBLIC_CONTEXT/Rerootjob"
Definition at line 46 of file rerootjob.cc. Referenced by main(). |
|
|
|
|
Definition at line 49 of file rerootjob.cc. Referenced by processArgs(), and processSingleFile(). |
1.3.9.1