HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoConfig.cxx
Go to the documentation of this file.
1 //
2 // File HarpoConfig.cxx
3 //
78 #include <climits>
79 #include <cassert>
80 #include <cstdlib>
81 #include <cstdio>
82 #include <iostream>
83 #include <getopt.h>
84 //
85 #include <libgen.h>
86 
87 #include "TROOT.h"
88 #include "HarpoConfig.h"
89 //#include "HarpoReader.h"
90 #include "TSystem.h"
91 #include "TError.h"
92 #include "TPRegexp.h"
93 #include "TObjArray.h"
94 #include "TObjString.h"
95 #include "TIterator.h"
96 
97 #include "HarpoPedMgr.h"
98 #include "HarpoPedestal.h"
99 
100 
101 HarpoConfig * gHConfig = 0; // Global Pointer
102 hReaderType HarpoConfig::gHReaderType = hRawReader; // raw reader as default
103 
104 // Reader types
105 // 0: one detector, 1: HarpoReaderRaw, 2: HarpoReaderSim, 3: HarpoReaderRoot
106 static int type; // copy of gHReaderType
107 
108 static const char* const short_options = "hvDs:S:d:c:n:f:t:e:r:o:b:T:X:Y:P:W:a:p:";
109 
110 static const struct option long_options[] = {
111  { "help", 0, NULL, 'h' },
112  { "verbose", 0, NULL, 'v' },
113  { "debug", 0, NULL, 'D' },
114  { "skip", 1, NULL, 's' },
115  { "split", 1, NULL, 'S' },
116  { "dets", 1, NULL, 'd' },
117  { "config", 1, NULL, 'c' },
118  { "nevents", 1, NULL, 'n' },
119  { "from", 1, NULL, 'f' },
120  { "to", 1, NULL, 't' },
121  { "event", 1, NULL, 'e' },
122  { "run", 1, NULL, 'r' },
123  { "output", 1, NULL, 'o' },
124  { "hbook", 1, NULL, 'b' },
125  { "type", 1, NULL, 'T' },
126  { "xdcc", 1, NULL, 'X' },
127  { "ydcc", 1, NULL, 'Y' },
128  { "pmm2", 1, NULL, 'P' },
129  { "det", 0, &type, hDummyReader },
130  { "raw", 0, &type, hRawReader },
131  { "sim", 0, &type, hSimReader },
132  { "root",0, &type, hRootReader },
133  { "writer",1,NULL,'W' },
134  { "analyses", 1, NULL, 'a' },
135  { "rawpedfile", 1, NULL, 'p' },
136  { NULL, 0, NULL, 0 }
137 };
138 
139 
142 {
143  printf("Usage: %s -c cfgfile OPTIONS [x_rawfile] [y_rawfile] ...\n",ProgramName->Data());
144  printf(" Where options :\n\n"
145  " -h, --help\t print this text and exit\n"
146  " -v, --verbose\t increase verbosity level, can be repeated several times\n"
147  " -D, --debug\t increase debug level can repeat several times\n"
148  " -s NNN , --skip\t skip NNN events out of NNN+1\n"
149  " -S NNN , --split\t split output file every NNN events\n"
150  " -n NNN , --nevents\t number events to process\n"
151  " -f NNN , --from\t special processing for events starting from this number\n"
152  " -t NNN , --to\t special processing for events end at this event number\n"
153  " -r NNN , --run\t run number , do not guess from file name\n"
154  " -e NNN , --event\t number to show\n"
155  " -c FILE, --config\t config file name\n"
156  " -o FILE, --output\t output root file name\n\n"
157  " -b FILE, --hbook\t output root histograms file name\n\n"
158  " -d mask, --dets\t (default 0x3) active detectors mask\n"
159  " -d det, --dets\t detector id for reader type 'det'\n"
160  "\n"
161  " -T type, --type\t (default) 1: read real data, 2: generate simulated data, 3: read ROOT file\n"
162  "or --det , --raw, --sim, --root for one detector, raw, sim and ROOT\n"
163  "\n"
164  " -X type, --xdcc\t x dcc reader type 0: T3k , 1: MINOS\n"
165  " -Y type, --ydcc\t y dcc reader type 0: T3k , 1: MINOS\n"
166  " -P type, --pmm2\t pmm2 reader type 0:TEXT, 1:WIN, 2:Linux, 3:WIN(LLR)\n"
167  " -W 0|1 --writer\t Disble(0)/Enable(1) Out Tree writing (default:enabled).\n"
168  " -a LIST, --analyses\t list of HarpoAnalyses, separated by spaces\n"
169  " -p FILE, --rawpedfile root file with femion pedistals and sigmas\t \n"
170  "\n");
171  exit(1);
172 }
173 
174 
177 {
178  ULong64_t i;
179 
180  gHarpoDebug = 0; // Do not knnow how do this better
181  /* TROOT *root = */ ROOT::GetROOT();
182  DetNo = -1; // NODET
183  Verbose = 0;
184  MaxEvents = LONG_MAX;
185  FromEvent = 0;
186  ToEvent = LONG_MAX;
187  nEvent = LONG_MAX;
188  fSkipEvents = 0;
189  RunNo = 0;
190  fSplit = 0;
191  fWriterEnabled = true;
192 
193  fInFile = new TString *[gkNDetectors];
194  for (i=0;i<gkNDetectors;i++){
195  fInFile[i] = (TString *) NULL;
196  tDetRdr[i] = 1;
197  }
198  tDetRdr[PMM2] = 2; // default: Linux Reader
199  fOutFile = (TString *) NULL;
200  fHistFile = (TString *) NULL;
201 
202  ProgramName = new TString("N/A");
203  WorkDir = new TString("N/A");
204  DataDir = new TString("N/A");
205  fPedFile = NULL;
206  fDbUrl = NULL;
207  // fDbTables = NULL; /// Db tables for read, separated by comma
208  fPedMgr = NULL;
209 
210  // Harpo Analyse GLOBALS
212  gHDetSet->SetMask(0l); //empty
213  gHConfig = this;
214  infiles = false;
215 }
216 
217 HarpoConfig::HarpoConfig(int argc, char **argv,ULong64_t ndetmask)
218 {
219 
220  // g++ on SL6 not aloow call HarpoConfig();;
221  ULong64_t i;
222 
223  gHarpoDebug = 0; // Do not nknow how do this better
224  /* TROOT *root = */ ROOT::GetROOT();
225  DetNo = -1; // NODET
226  Verbose = 0;
227  MaxEvents = LONG_MAX;
228  FromEvent = 0;
229  ToEvent = LONG_MAX;
230  nEvent = LONG_MAX;
231  fSkipEvents = 0;
232  RunNo = 0;
233  fSplit = 0;
234  fWriterEnabled = true;
235 
236  fInFile = new TString *[gkNDetectors];
237  for (i=0;i<gkNDetectors;i++){
238  fInFile[i] = (TString *) NULL;
239  tDetRdr[i] = 1;
240  }
241  tDetRdr[PMM2] = 2; // default: Linux Reader
242  fOutFile = (TString *) NULL;
243  fHistFile = (TString *) NULL;
244 
245  ProgramName = new TString("N/A");
246  WorkDir = new TString("N/A");
247  DataDir = new TString("N/A");
248  fPedFile = NULL;
249  fDbUrl = NULL;
250  // fDbTables = NULL; /// Db tables for read, separated by comma
251  fPedMgr = NULL;
252 
253  // Harpo Analyse GLOBALS
255  gHDetSet->SetMask(0l); //empty
256  gHConfig = this;
257  infiles = false;
258 
259  fAnalyses = new TString("");
260 
261  DataDir = new TString(gSystem->Getenv("HARPO_DATA_DIR"));
262 
263  fPedMgr = new HarpoPedMgr() ;
264 
266  {
267  gHDetSet->SetMask(0l); // no mask single detector ????
268  DetNo = ndetmask; // use mask as detector number
269  }
270  else
271  {
272  gHDetSet->SetMask(ndetmask); // 0x3 default
273  }
274  ParseArgs(argc,argv,ndetmask);
275 
276 }
277 
279 {
280  return HarpoDetSet::Instance();
281 }
282 
283 void HarpoConfig::ParseArgs(int argc, char **argv,ULong64_t ndetmask)
284 {
285 
286  int c;
287 
288  // int digit_optind = 0;
289 
290  delete ProgramName;
291  ProgramName = new TString(basename(argv[0]));
292  delete WorkDir;
293  WorkDir = new TString(dirname(argv[0]));
294 
295  type = (int) gHReaderType; // from global reader type
296 
297  while (1) {
298  // int this_option_optind = optind ? optind : 1;
299  int option_index = 0;
300 
301  c = getopt_long(argc, argv, short_options,
302  long_options, &option_index);
303 
304  if (c == -1) break;
305 
306  switch (c) {
307  case 0:
308  printf("option %s", long_options[option_index].name);
309  if (optarg)
310  printf(" with arg %s", optarg);
311  printf("\n");
312  break;
313 
314  case 'h':
315  help();
316  break;
317 
318  case 'v':
319  // printf("option v\n");
320  Verbose++;
321  break;
322 
323  case 's':
324  //printf("option s\n");
325  fSkipEvents = strtol(optarg,NULL,0);
326  break;
327 
328  case 'S':
329  //printf("option s\n");
330  fSplit = strtol(optarg,NULL,0);
331  break;
332 
333  case 'D':
334  // printf("option v\n");
335  gHarpoDebug++;
336  break;
337 
338  case 'r':
339  RunNo = strtol(optarg,NULL,0);
340  break;
341 
342  case 'e':
343  nEvent = strtol(optarg,NULL,0);
344  break;
345 
346  case 'n':
347  MaxEvents = strtol(optarg,NULL,0);
348  break;
349 
350  case 'f':
351  FromEvent = strtol(optarg,NULL,0);
352  break;
353 
354  case 't':
355  ToEvent = strtol(optarg,NULL,0);
356  break;
357 
358  case 'c':
359  // std::cout << " c opt ==============================" << std::endl;
360  if (SetCfgFile(optarg) ) {
361  if (ReadCfgFile()) {
362  if(Verbose) std::cout << "Config Ok" << std::endl;
363  } else {
364  std::cout << "Error in Config File Parsing " << std::endl;
365  assert(0);
366  }
367  } else {
368  std::cout << "Config File Read Error" << std::endl;
369  }
370  break;
371 
372  case 'o':
373  if (fOutFile != NULL) delete fOutFile;
374  fOutFile = new TString(optarg);
375  break;
376 
377  case 'b':
378  if (fHistFile != NULL) delete fHistFile;
379  fHistFile = new TString(optarg);
380  break;
381 
382  case 'p':
383  if (fPedFile != NULL) delete fPedFile;
384  fPedFile = new TString(optarg);
385  break;
386 
387  case 'a':
388  // fAnalyses = new TString(optarg);
389  fAnalyses->Append(" ");
390  fAnalyses->Append(optarg);
391  break;
392 
393  case 'd':
394  ndetmask = strtol(optarg,NULL,0);
395  break;
396 
397  case 'T':
398  type = strtol(optarg,NULL,0);
399  break;
400 
401  case 'X':
402  tDetRdr[XDCC] = strtol(optarg,NULL,0);
403  break;
404 
405  case 'Y':
406  tDetRdr[YDCC] = strtol(optarg,NULL,0);
407  break;
408 
409  case 'P':
410  tDetRdr[PMM2] = strtol(optarg,NULL,0);
411  break;
412 
413  case 'W':
414  fWriterEnabled = (strtol(optarg,NULL,0) != 0);
415  break;
416 
417  case '?':
418  printf("UNKNOWN option\n");
419  help();
420  break;
421 
422  default:
423  printf("?? getopt returned character code 0%o ??\n", c);
424  }
425  }
426  //printf ("optind %d argc %d\n ",optind,argc);
427 
428  if (ndetmask==0) Warning (__FUNCTION__,"Zero Detector Set.\n");
429  gHDetSet->SetMask(ndetmask);
430 
432 
433  switch(gHReaderType){
434  case hRawReader:
435  Info(__FUNCTION__,"+++RAW Reader selected.\n");
436  break;
437  case hSimReader:
438  Info(__FUNCTION__,"+++SIM Reader selected.\n");
439  break;
440  case hRootReader:
441  Info(__FUNCTION__,"+++ROOT Reader selected.\n");
442  break;
443  case hDummyReader:
444  Info(__FUNCTION__,"+++DUMMY Reader selected.\n");
445  break;
446  }
447 
448  if ( ! infiles ) {
449  int i = 0;
450  // Data reader, one file per detector
451  if (gHReaderType==hRawReader && (argc - optind) == gHDetSet->countDets()) {
452  while (optind < argc) {
453  while (! gHDetSet->isExist(i)) { // Skip if nor in mask
454  i++;
455  }
456  if( gSystem->AccessPathName(argv[optind])){
457  printf("Cannot access file %s\n",argv[optind]);
458  exit(1);
459  }else{
460  // std::cout << "Infile "<< i <<" " << argv[optind] << std::endl;
461  fInFile[i] = new TString(argv[optind]);
462  i++;
463  optind++;
464  }
465  }
466  }
467  // SIM reader takes no input
468  else if (gHReaderType==hSimReader && (argc - optind) == 0)
469  {
470  fInFile[0] = NULL;
471  }
472  // ROOT reader needs 1 input
473  else if (gHReaderType==hRootReader && (argc - optind) == 1)
474  {
475  if( gSystem->AccessPathName(argv[optind])){
476  printf("Cannot access file %s\n",argv[optind]);
477  exit(1);
478  }else{
479  fInFile[0] = new TString(argv[optind]);
480  optind++;
481  }
482  }
483  // Dummy Reader needs 1 input
484  else if (gHReaderType==hDummyReader && (argc - optind) == 1)
485  {
486  if( gSystem->AccessPathName(argv[optind])){
487  printf("Cannot access file %s\n",argv[optind]);
488  exit(1);
489  }else{
490  fInFile[0] = new TString(argv[optind]);
491  optind++;
492  }
493  }
494  else
495  {
496  printf("Wrong number of input files (%d)\n",argc-optind);
497  help();
498  }
499  }
500 
501  // Guess run number from file name
502  if ( RunNo == 0 && fInFile[0] != NULL) {
503  Int_t nmatched = 0;
504  // char * fn = strdup(fInFile[0]->Data());
505  //char * bn = basename(fn);
506  //int nmatched = sscanf(bn,"x_run%lld.dat",&run);
507  //free(fn);
508  TPRegexp runre("run(\\d+)");
509  TString file(*fInFile[0]);
510 
511  TObjArray *subStrL = runre.MatchS(file);
512  if(subStrL->GetEntries()<1){
513  Info(__FUNCTION__," Could not Guess Run Number");
514  }else{
515  const TString srun = ((TObjString *)subStrL->At(1))->GetString();
516  nmatched = subStrL->GetLast();
517  //std::cout << "my run guess "<< srun <<" " << nmatched << std::endl;
518  if (nmatched == 1) {
519  RunNo = std::atol(srun);
520  Info(__FUNCTION__," Guessed Run Num %lld",RunNo);
521  }
522  }
523  }
524 
525  //TODO place and verification
526  if (fPedFile == NULL){
527  if (gHReaderType == hRawReader)
528  fPedFile = new TString("${HARPO_DATA_DIR}/harpopedsraw.root");
529  else
530  fPedFile = new TString("");
531  }
532  gSystem->ExpandPathName(*fPedFile);
533 
534  if ( (fPedMgr != NULL) && (fPedFile != NULL ) &&
537  }
538 
539  // printf("Verbose %d\n",Verbose);
540 
541  return;
542 }
543 //
544 // Config File
545 //
546 
547 Bool_t HarpoConfig::ReadCfgFile() // Read config file in libconfig format
548 {
549  ULong64_t ndetmask;
550  ndetmask = gHDetSet->GetMask();
551  Long64_t verbose,verplus, dbgplus, runNo, Split;
552  Long64_t skip, maxevents, nevent,fromevent, toevent;
553  Bool_t WriterEnabled;
554  TString *histfile, *outfile, *pedfile, *dburl, *infile;
555  std::cout << "Reading Config --> " << *fCfgFile << std::endl;
556  try {
557  // Globals
558  if (Lookup("verbose",verplus)) {
559  verbose = gHConfig->GetVerbose();
560  verbose += verplus; // command line and cfg verbse
561  gHConfig->SetVerbose(verbose);
562  std::cout << "cfg Verbose " << verbose << std::endl;
563  }
564  if (Lookup("debug",dbgplus)) {
565  gHarpoDebug += dbgplus; // command line and cfg verbse
566  std::cout << "cfg Debug " << gHarpoDebug << std::endl;
567  }
568  // config
569  if (Lookup("config.run",runNo)) {
570  gHConfig->SetRunNo(runNo);
571  if ( Verbose > 1 ) std::cout << "cfg Run No " << runNo << std::endl;
572  }
573 
574  if (Lookup("config.split",Split)) {
575  gHConfig->SetSplit(Split);
576  if ( Verbose > 1 ) std::cout << "Split output file every " << fSplit << " events" << std::endl;
577  }
578 
579  if (Lookup("config.skip",skip)) {
580  gHConfig->SetSkipEvents(skip);
581  if ( Verbose > 1 )
582  std::cout << "Skip " << skip << " events between two analyses" << std::endl;
583  }
584 
585  if (Lookup("config.writer_enable",WriterEnabled)) {
586  gHConfig->SetWriterEnable(WriterEnabled);
587  if ( Verbose > 1 ) std::cout << "Tree Putput Writer Enabled "
588  << std::boolalpha << WriterEnabled
589  << std::noboolalpha << std::endl;
590  }
591 
592  if (Lookup("config.dets",ndetmask)) {
593  gHDetSet->SetMask(ndetmask);
594  if ( Verbose > 1 ) std::cout << "cfg detmask " << std::endl;
595  }
596 
597  if (Lookup("config.maxevents",maxevents)) {
598  gHConfig->SetMaxEvents(maxevents);
599  if ( Verbose > 1 )
600  std::cout << "cfg Max Events " << maxevents << std::endl;
601  }
602 
603  if (Lookup("config.event",nevent)) {
604  gHConfig->SetNEvent(nevent);
605  if ( Verbose > 1 ) std::cout << "cfg Event No " << nevent << std::endl;
606  }
607 
608  if (Lookup("config.from",fromevent)) {
609  gHConfig->SetFromEvent(fromevent);
610  if ( Verbose > 1 )
611  std::cout << "cfg From Event No " << fromevent << std::endl;
612  }
613 
614  if (Lookup("config.to",toevent)) {
615  gHConfig->SetToEvent(toevent);
616  if ( Verbose > 1 )
617  std::cout << "cfg To Event No " << toevent << std::endl;
618  }
619 
620  if (Lookup("config.hfile",histfile)) {
621  gHConfig->SetHistFile((char *)histfile->Data());
622  if ( Verbose > 1 )
623  std::cout << "cfg Hist File " << *histfile << std::endl;
624  }
625 
626  TString* analysesTmp;
627  if (Lookup("config.analyses",analysesTmp)){
628  fAnalyses->Append(" ");
629  fAnalyses->Append(*analysesTmp);
630  if ( Verbose > 1 ) std::cout << "cfg Analyses list " << fAnalyses << std::endl;
631  }
632 
633  if (Lookup("config.ofile",outfile)) {
634  gHConfig->SetOutFile((char *)outfile);
635  if ( Verbose > 1 ) std::cout << "cfg Out File " << *outfile << std::endl;
636  }
637 
638  if (Exist("config.infiles")) {
639  infiles = true;
640  Int_t slen = getSettingLength("config.infiles");
641  //std::cout << " slen " << slen << " ndet " << gHDetSet->countDets() << std::endl;
642  if ( slen != gHDetSet->countDets()) help();
643  UInt_t i = 0;
644  Int_t j = 0;
645  while (j < slen) {
646  while (! gHDetSet->isExist(i)) { // Skip if nor in mask
647  i++;
648  }
649 
650  if (LookupElem("config.infiles",j++,infile)) {
651  gHConfig->SetInFile((char *)infile,i);
652  if ( Verbose > 1 ) { std::cout << "cfg inFile " << i << std::endl;
653  std::cout << "New fInFile["<< i << "] " << *infile << std::endl;
654  }
655  i++;
656  }
657  }
658  }
659  // rundb section
660  if (Lookup("rundb.rawpedfile", pedfile)) {
661  gHConfig->SetPedFile((char *)pedfile->Data());
662  if ( Verbose > 1 )
663  std::cout << "rundb raw peds File " << *pedfile << std::endl;
664  }
665 
666  if (Lookup("rundb.dburl",dburl)) {
667  gHConfig->SetDbUrl((char *)dburl->Data());
668  if ( Verbose > 1 ) std::cout << "rundb db url " << *dburl
669  << " " << dburl->IsNull() << std::endl;
670  }
671  return true;
672  }
673  catch (...)
674  {
675  std::cout << "config file failed" << std::endl;
676  }
677 
678  return false;
679 }
680 
681 
684 {
685  if (nDet>=0 && (unsigned)nDet<gkNDetectors){
686  return tDetRdr[nDet];
687  }
688  return 0;
689 }
690 
692 void HarpoConfig::SetDetRdrType(HarpoDetType nDet,Long64_t rtype)
693 {
694  if (nDet>=0 && (unsigned)nDet<gkNDetectors){
695  tDetRdr[nDet] = rtype;
696  }
697 }
698 
701 {
702 
703  // Delete All TStrings
704  delete ProgramName;
705  delete WorkDir;
706  delete DataDir;
707  if (fPedFile != NULL) delete fPedFile;
708  if (fOutFile != NULL) delete fOutFile;
709  if (fHistFile != NULL) delete fHistFile;
710  delete [] fInFile;
711  // if ( fRunConfig != NULL ) delete fRunConfig;
712  if ( fPedMgr != NULL ) delete fPedMgr;
713  // delete gHDetSet;
714 }
715 
716 
717 void HarpoConfig::SetInFile(char *fin,Int_t plane)
718 {
719  if ((plane < 0) || (plane >= (Int_t )gkNDetectors)) return; // rise bad detector
720  gHDetSet->Set(plane);
721  fInFile[plane] = new TString(fin);
722 }
723 
724 void HarpoConfig::SetOutFile(char *fout)
725 {
726  if (fOutFile != NULL) delete fOutFile;
727  fOutFile = new TString(fout);
728 }
729 
730 void HarpoConfig::SetHistFile(char *fout)
731 {
732  if (fHistFile != NULL) delete fHistFile;
733  fHistFile = new TString(fout);
734 }
735 
736 void HarpoConfig::SetAnalyses(char *fout)
737 {
738  fAnalyses = new TString(fout);
739 }
740 
741 // Set Pedestal File
742 void HarpoConfig::SetPedFile(char * pfile)
743 {
744  if (fPedFile != NULL) delete fPedFile;
745  fPedFile = new TString(pfile);
746 }
747 
748 // Set harpo database server URL
749 void HarpoConfig::SetDbUrl(char * url)
750 {
751  if (fDbUrl != NULL) delete fDbUrl;
752  fDbUrl = new TString(url);
753 }
754 
755 // // Set list of tables for reading
756 // void HarpoConfig::SetDbTables(TObjArray *tables)
757 // {
758 // fDbTables = *tables;
759 // }
760 
762 void HarpoConfig::SetDataDir(char *datadir)
763 {
764 if (DataDir != NULL) delete DataDir;
765 DataDir = new TString(datadir);
766 }
767 
769 void HarpoConfig::print() const{
770  std::cout << "--- HarpoConfig" << std::endl
771  << "ProgramName : " << *ProgramName << std::endl
772  << "WorkDir : " << *WorkDir << std::endl
773  << "RunNo : " << RunNo << std::endl
774  << "MaxEvents : " << MaxEvents << std::endl
775  << "FromEvent : " << FromEvent << std::endl
776  << "ToEvent : " << ToEvent << std::endl
777  << "N Event : " << nEvent << std::endl;
778 
779 
780  std::cout << "+++ Harpo Reader Type " << gHReaderType << std::endl;
781 
782  if (fCfgFile != NULL) std::cout << "fCfgFile : " << *fCfgFile << std::endl;
783 
784  if(gHReaderType == hRawReader){
785  ULong64_t ndet;
786  for(ndet=0;ndet<gkNDetectors;ndet++) {
787  if (gHDetSet->isExist(ndet)) {
788  std::cout << "fInFile[" << ndet << "] : " << *fInFile[ndet] << std::endl;
789  std::cout << "ReaderType[" << ndet << "] : " << tDetRdr[ndet] << std::endl;
790  }
791  }
792  }
794  std::cout << "fInFile[0] : " << *fInFile[0] << std::endl;
795  if (fHistFile != NULL) std::cout << "fHistFile : " << *fHistFile << std::endl;
796  if (fOutFile != NULL) std::cout << "fOutFile : " << *fOutFile << std::endl;
797  if (fAnalyses != NULL) std::cout << "fAnalyses : " << *fAnalyses << std::endl;
798 }
799 
static const char *const short_options
void SetNEvent(Long64_t nevt)
Set Event number with we looking for.
Definition: HarpoConfig.h:85
Dcc Plane Y.
Definition: HarpoDet.h:20
static HarpoDetSet * Instance()
Definition: HarpoDetSet.cxx:20
Bool_t Exist(const char *path)
void SetToEvent(Long64_t nevt)
Set Last Event number to process.
Definition: HarpoConfig.h:83
void SetRunNo(Long64_t nrun)
Set Run Number.
Definition: HarpoConfig.h:87
TString * ProgramName
db serevr url
Definition: HarpoConfig.h:208
void SetDbUrl(char *url)
Set harpo database server URL.
void SetMaxEvents(Long64_t nevt)
Set Max Event for prosess.
Definition: HarpoConfig.h:79
void SetInFile(char *fin, Int_t plane=0)
Set Input file name for detector.
void SetAnalyses(char *fcfg)
Set List of HarpoAnalyses to run.
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Definition: HarpoDetSet.h:33
void SetFromEvent(Long64_t nevt)
Set First Event to process.
Definition: HarpoConfig.h:81
TString * DataDir
Definition: HarpoConfig.h:210
void SetFile(TString *file)
Set Femimos Pedistal File Name.
Definition: HarpoPedMgr.cxx:30
TString * fDbUrl
root file with feminos pedstals
Definition: HarpoConfig.h:205
TString * fOutFile
Array of input row files.
Definition: HarpoConfig.h:200
void SetSplit(Long64_t split)
Definition: HarpoConfig.h:92
Bool_t LookupElem(const char *path, UInt_t index, Bool_t &val)
Dcc Plane X.
Definition: HarpoDet.h:19
Long64_t fSplit
Events to skeep.
Definition: HarpoConfig.h:186
static const struct option long_options[]
Long_t countDets() const
Real Detectors number.
Definition: HarpoDetSet.h:49
void SetPedFile(char *pfile)
Set Pedestal File.
TString ** fInFile
Definition: HarpoConfig.h:199
HarpoConfig()
Constructor which does basically nothing.
Int_t getSettingLength(const char *path)
Function to deal with arrays or lists.
TString * fHistFile
Output file for root tries.
Definition: HarpoConfig.h:201
void SetDetRdrType(HarpoDetType nDet, Long64_t rtype)
Set type of reader impementation for given Harpo Detector.
A generic class for HARPO datectors The class is ....
Definition: HarpoDetSet.h:21
Long64_t ToEvent
Fist event for analyse.
Definition: HarpoConfig.h:191
TString * fAnalyses
Output file for histograms.
Definition: HarpoConfig.h:202
void SetWriterEnable(Bool_t enable=true)
Set Writer Enabled Flag.
Definition: HarpoConfig.h:170
Bool_t ReadCfgFile()
TString * WorkDir
Definition: HarpoConfig.h:209
void SetSkipEvents(Long64_t skip)
Definition: HarpoConfig.h:89
static int type
TString * fPedFile
List of HarpoAnalyses to run.
Definition: HarpoConfig.h:204
Long64_t RunNo
Event number to show/print etc.
Definition: HarpoConfig.h:193
Long64_t MaxEvents
Verbose level.
Definition: HarpoConfig.h:189
Long64_t nEvent
Last event for analyse.
Definition: HarpoConfig.h:192
Long64_t DetNo
Detector mask (default 0x3)
Definition: HarpoConfig.h:196
void SetDataDir(char *datadir)
Get Top Data directory.
void SetMask(ULong_t detmask)
Redefine active detector set.
Definition: HarpoDetSet.cxx:29
Long64_t fSkipEvents
Enabke/Disble Output Tree writer.
Definition: HarpoConfig.h:185
Bool_t infiles
Config file name.
void SetVerbose(Long64_t v=1)
Set program verbosity level.
Definition: HarpoConfig.h:76
ULong_t GetMask()
Definition: HarpoDetSet.h:55
HarpoPedMgr * fPedMgr
Definition: HarpoConfig.h:212
TString * fCfgFile
Long64_t gHarpoDebug
Definition: HarpoDebug.cxx:9
Long64_t GetDetRdrType(HarpoDetType nDet)
Return type of reader impementation for given Harpo Detector.
Unknown Detector.
Definition: HarpoDet.h:18
virtual ~HarpoConfig()
Destructor:
void ParseArgs(int argc, char **argv, ULong64_t detmask=0x3)
Init Config data.
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
Harpo Event Simulation.
Definition: HarpoConfig.h:32
Harpo Raw Files.
Definition: HarpoConfig.h:31
Bool_t fWriterEnabled
Definition: HarpoConfig.h:183
void print() const
Read config file in libconfig format.
void SetHistFile(char *fcfg)
Set Name of Histogram output file.
HarpoDetType
Definition: HarpoDet.h:16
Long64_t tDetRdr[gkNDetectors]
Detector id (for dummy reader)
Definition: HarpoConfig.h:197
HarpoDetSet * GetDetSet()
Get set of active detectors.
dummy reader, for one detector test
Definition: HarpoConfig.h:30
Long64_t FromEvent
Max number events to process.
Definition: HarpoConfig.h:190
const ULong_t gkNDetectors
Definition: HarpoDet.h:14
Long64_t Verbose
Definition: HarpoConfig.h:188
void Set(ULong_t det)
Definition: HarpoDetSet.h:30
HarpoConfig * gHConfig
void SetOutFile(char *fout)
Set Output root file name.
static hReaderType gHReaderType
Reader Type.
Definition: HarpoConfig.h:179
enum hReaderType_ hReaderType
Harpo Reader Type.
A class which keeps track of the entire configuration of the analysis.
Definition: HarpoConfig.h:50
R__EXTERN HarpoDetSet * gHDetSet
Definition: HarpoDetSet.h:71
void help()
help
Long64_t GetVerbose()
Get program verbosity level.
Definition: HarpoConfig.h:115
Bool_t SetCfgFile(const char *fcfg)
Set Name of libconfig configuration file.