14 gStyle->SetOptStat(1);
19 std::cout <<
"Please provide filename in option" << std::endl;
20 std::cout <<
"Will load auto wcsim.root in WCSIMDIR ..." << std::endl;
21 char* name =
"wcsim.root";
22 strncpy(fTest, wcsimdirenv,
sizeof(fTest));
23 strncat(fTest,
"/", (
sizeof(fTest) - strlen(fTest)) );
24 strncat(fTest, name, (
sizeof(fTest) - strlen(fTest)) );
30 cout <<
"Error, could not open input file: " <<
filename << endl;
33 if (
filename==NULL) cout <<
"File open bro: " << fTest << endl;
34 else cout <<
"File open bro: " <<
filename << endl;
37 char *dirc, *basec, *bname, *dname;
42 bname = basename(basec);
43 printf(
"dirname=%s, basename=%s\n", dname, bname);
48 TTree *wcsimT = (TTree*)f->Get(
"wcsimT");
51 wcsimT->SetBranchAddress(
"wcsimrootevent_OD",&wcsimrootsuperevent);
58 const long unsigned int nbEntries = wcsimT->GetEntries();
59 cout <<
"Nb of entries " << wcsimT->GetEntries() << endl;
65 const int nbThresh = 100;
66 int trigThresh[nbThresh];
68 for(
int iThresh=0;iThresh<nbThresh;iThresh++){
69 trigThresh[iThresh]=iThresh;
72 TGraph *grEffVSThres =
new TGraph();
73 grEffVSThres->SetName(
"grEffVSThres");
74 grEffVSThres->SetTitle(
"Trigger veto efficiency VS Trigger threshold; Threshold (PE) ; Eff (%)");
75 grEffVSThres->SetLineColor(kGreen+1);
76 grEffVSThres->SetLineWidth(1.);
77 grEffVSThres->SetMarkerColor(kGreen+1);
78 grEffVSThres->SetMarkerSize(1.);
79 grEffVSThres->SetMarkerStyle(kOpenThreeTriangles);
81 TGraph *grMultVSThres =
new TGraph();
82 grMultVSThres->SetName(
"grMultVSThres");
83 grMultVSThres->SetTitle(
"Multiplicity VS Trigger threshold; Threshold (PE) ; Multiplicity");
84 grMultVSThres->SetLineColor(kBlue-4);
85 grMultVSThres->SetLineWidth(1.);
86 grMultVSThres->SetMarkerColor(kBlue-4);
87 grMultVSThres->SetMarkerSize(1.);
88 grMultVSThres->SetMarkerStyle(kDiamond);
90 TH1D *hMultByThresh[nbThresh];
91 const int nbBins = 10000;
92 const int nbODPMTs = 10000;
94 int nbEffByThresh[nbThresh];
95 int nbMultByThresh[nbEntries][nbThresh];
96 for(
int iThresh=0;iThresh<nbThresh;iThresh++){
97 nbEffByThresh[iThresh] = 0;
98 hMultByThresh[iThresh] =
new TH1D(Form(
"hMultByThresh%d",iThresh),
99 Form(
"Multiplicity for thresh %d PE",iThresh),
103 for(
long unsigned int iEntry = 0; iEntry < nbEntries; iEntry++){
104 nbMultByThresh[iEntry][iThresh] = 0;
112 for(
long unsigned int iEntry = 0; iEntry < nbEntries; iEntry++){
114 wcsimT->GetEvent(iEntry);
124 for(
long unsigned int iTrig = 0; iTrig < nbTriggers; iTrig++){
131 for (
int i = 0;
i < digiMax;
i++){
136 for(
int iThresh=0;iThresh<nbThresh;iThresh++){
137 if(cDigiHit->
GetQ() > trigThresh[iThresh]) nbMultByThresh[iEntry][iThresh]++;
144 for(
int iThresh=0;iThresh<nbThresh;iThresh++){
145 hMultByThresh[iThresh]->Fill(nbMultByThresh[iEntry][iThresh]);
154 for(
int iThresh=0;iThresh<nbThresh;iThresh++){
156 for(
long unsigned int iEntry = 0; iEntry < nbEntries; iEntry++){
157 if(nbMultByThresh[iEntry][iThresh] > 0){
158 nbEffByThresh[iThresh]++;
163 grEffVSThres->SetPoint(iThresh,
165 (
double)(nbEffByThresh[iThresh])/(
double)(nbEntries));
166 grMultVSThres->SetPoint(iThresh,
168 hMultByThresh[iThresh]->GetMean());
177 c1 =
new TCanvas(
"cEff",
"cEff",800,600);
179 grEffVSThres->Draw(
"APL");
181 c1 =
new TCanvas(
"cMult",
"cMult",800,600);
183 grMultVSThres->Draw(
"APL");
187 char outputName[1000];
188 sprintf(outputName,
"TRIGGER_%s",bname);
189 output =
new TFile(outputName,
"recreate");
190 grEffVSThres->Write();
191 grMultVSThres->Write();
Int_t GetNumberOfSubEvents() const
Class holding digitised hit (aka digit or digi) information (after PMT & electronics simulation + tri...
Int_t GetNcherenkovdigihits() const
Class storing trigger information.
WCSimRootTrigger * GetTrigger(int number)
Int_t GetNumberOfEvents() const
Class containing event information.
TClonesArray * GetCherenkovDigiHits() const
void trigger_OD(char *filename=NULL)