Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:15:44

0001 #include <iostream>
0002 #include <fstream>
0003 #include <vector>
0004 #include <map>
0005 #include <utility>
0006 //#include <unistd.h> // Add for use on Mac OS -> Same goes for Analyses.cc
0007 #include "TString.h"
0008 #include "TFile.h"
0009 #include "TTree.h"
0010 #include "TCanvas.h"
0011 #include "TF1.h"
0012 #include "TH1D.h"
0013 #include "TObjArray.h"
0014 #include "TObjString.h"
0015 
0016 #include "Setup.h"
0017 #include "Calib.h"
0018 #include "Event.h"
0019 #include "Tile.h"
0020 #include "HGCROC.h"
0021 #include "Caen.h"
0022 #include "DataAnalysis.h"
0023 
0024 Setup* Setup::instancePtr=nullptr; // Remove for use on Mac OS -> Add to Setup.cc instead
0025 //Calib* Calib::instancePtr=nullptr;
0026 
0027 void PrintHelp(char* exe){
0028   std::cout<<"Usage:"<<std::endl;
0029   std::cout<<exe<<" [-option (arguments)]"<<std::endl;
0030   std::cout<<"Options:"<<std::endl;
0031   std::cout<<"I am in the right routine:"<<std::endl;
0032   
0033 }
0034   
0035 
0036 int main(int argc, char* argv[]){
0037   if(argc<4) {
0038     PrintHelp(argv[0]);
0039     return 0;
0040   }
0041   DataAnalysis AnAnalysis;
0042   int c;
0043   while((c=getopt(argc,argv,"afP:o:O:e:r:d:i:y:hQ"))!=-1){
0044     switch(c){
0045     case 'a':
0046       std::cout<<"printing calib object to file"<<std::endl;
0047       AnAnalysis.IsCalibSaveToFile(true);
0048       break;
0049     case 'f':
0050       std::cout<<"If output already exists it will be overwritten"<<std::endl;
0051       AnAnalysis.CanOverWrite(true);
0052       break;
0053     case 'O':
0054       std::cout<<"Output  Histsto be saved in: "<<optarg<<std::endl;
0055       AnAnalysis.SetRootOutputHists(Form("%s",optarg));
0056       break;
0057     case 'o':
0058       std::cout<<"Output to be saved in: "<<optarg<<std::endl;
0059       AnAnalysis.SetRootOutput(Form("%s",optarg));
0060       break;
0061     case 'P':
0062       std::cout<<"Outputdir plots to be saved in: "<<optarg<<std::endl;
0063       AnAnalysis.SetPlotOutputDir(Form("%s",optarg));
0064       break;
0065     case 'e':
0066       std::cout<<"enabling extended plotting: "<< optarg<<std::endl;
0067       AnAnalysis.SetExtPlotting(atoi(optarg));
0068       break;
0069     case 'Q':
0070       std::cout<<"running QA"<<std::endl;
0071       AnAnalysis.IsToRunQA(true);
0072       break;
0073     case 'r':
0074       std::cout<<"run list file from: "<<optarg<<std::endl;
0075       AnAnalysis.SetRunListInput(Form("%s",optarg));
0076       break;
0077     case 'i':
0078       std::cout<<"Root input file is: "<<optarg<<std::endl;
0079       AnAnalysis.SetRootInput(Form("%s",optarg));
0080       break;
0081     case 'y':
0082       std::cout<<"Setting year externally: "<<optarg<<std::endl;
0083       AnAnalysis.SetYear(atoi(optarg));
0084       break;
0085     case 'd':
0086       std::cout<<"enable debug " << optarg <<std::endl;
0087       AnAnalysis.EnableDebug(atoi(optarg));
0088       break;
0089     case '?':
0090       std::cout<<"Option "<<optarg <<" not supported, will be ignored "<<std::endl;
0091       break;
0092     case 'h':
0093       PrintHelp(argv[0]);
0094       return 0;
0095     }
0096   }
0097   if(!AnAnalysis.CheckAndOpenIO()){
0098     std::cout<<"Check input and configurations, inconsistency or error with I/O detected"<<std::endl;
0099     PrintHelp(argv[0]);
0100     return -1;
0101   }
0102 
0103   AnAnalysis.Process();
0104   std::cout<<"Exiting"<<std::endl;
0105   return 0;
0106 }