File indexing completed on 2025-02-22 09:39:21
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 "EventDisplay.h"
0023
0024
0025
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<<"-d [0-n] switch on debug info with debug level 0 to n"<<std::endl;
0032 std::cout<<"-F fff set plot extension explicitly, default is pdf "<<std::endl;
0033 std::cout<<"-i uuu Input file in root format"<<std::endl;
0034 std::cout<<"-P zzz Plots directory path"<<std::endl;
0035 std::cout<<"-r rrr Name of run list file 2024 PS TB [../configs/DataTakingDB_202409_CAEN.csv] "<<std::endl;
0036 std::cout<<"-y yyyy setting year externally to narrow parameters"<<std::endl;
0037 std::cout<<"-e setting event number to plot, default: 0" <<std::endl;
0038 std::cout<<"-N setting number of events to plot, default:1"<<std::endl;
0039 std::cout<<"-M plot only muon triggered events"<<std::endl;
0040 std::cout<<"Examples:"<<std::endl;
0041 std::cout<<exe<<" -Q (-f) -P plotDir/ -i input.root"<<std::endl;
0042 }
0043
0044
0045 int main(int argc, char* argv[]){
0046 if(argc<4) {
0047 PrintHelp(argv[0]);
0048 return 0;
0049 }
0050 EventDisplay EvtDisplay;
0051 int c;
0052 while((c=getopt(argc,argv,"F:P:r:d:i:y:e:N:hM"))!=-1){
0053 switch(c){
0054 case 'd':
0055 std::cout<<"enable debug " << optarg <<std::endl;
0056 EvtDisplay.EnableDebug(atoi(optarg));
0057 break;
0058 case 'F':
0059 std::cout<<"DataPrep: Set Plot extension to: "<< optarg<<std::endl;
0060 EvtDisplay.SetPlotExtension(optarg);
0061 break;
0062 case 'i':
0063 std::cout<<"Root input file is: "<<optarg<<std::endl;
0064 EvtDisplay.SetRootInput(Form("%s",optarg));
0065 break;
0066 case 'P':
0067 std::cout<<"Outputdir plots to be saved in: "<<optarg<<std::endl;
0068 EvtDisplay.SetPlotOutputDir(Form("%s",optarg));
0069 break;
0070 case 'r':
0071 std::cout<<"run list file from: "<<optarg<<std::endl;
0072 EvtDisplay.SetRunListInput(Form("%s",optarg));
0073 break;
0074 case 'y':
0075 std::cout<<"Setting year externally: "<<optarg<<std::endl;
0076 EvtDisplay.SetYear(atoi(optarg));
0077 break;
0078 case 'e':
0079 std::cout<<"Setting event to plot: " << optarg << std::endl;
0080 EvtDisplay.SetEventToPlot(atoi(optarg));
0081 break;
0082 case 'N':
0083 std::cout<<"Setting how many events to plot: "<<optarg<<std::endl;
0084 EvtDisplay.SetNumberOfEventsToPlot(atoi(optarg));
0085 break;
0086 case 'M':
0087 std::cout<<"Plot only muon-triggered events in the range"<<std::endl;
0088 EvtDisplay.PlotMuonTriggeredEvents(true);
0089 break;
0090 case '?':
0091 std::cout<<"Option "<<optarg <<" not supported, will be ignored "<<std::endl;
0092 break;
0093 case 'h':
0094 PrintHelp(argv[0]);
0095 return 0;
0096 }
0097 }
0098 if(!EvtDisplay.CheckAndOpenIO()){
0099 std::cout<<"Check input and configurations, inconsistency or error with I/O detected"<<std::endl;
0100 PrintHelp(argv[0]);
0101 return -1;
0102 }
0103
0104 EvtDisplay.Process();
0105 std::cout<<"Exiting"<<std::endl;
0106 return 0;
0107 }