/* * TriggerScan * Author Nagni * Modified by G. De Rosa * Version 1.2 * Date 27 Apr 2006 * Version 1.4 * Date 26 Jun 2006: Inserted dependences on OrbitalTime and modified histogram ranges. * * Description: * Describe the performance of the Trigger. * * Parameters: * TString base - the path to the root directory for the specific Pamela unpack session * TString outDirectory - the path where to save the output image (Default = base) * TString format - the format which will be used for save the produced images (Default = "ps") */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; char bit(int decimal, char pos) { return( (decimal>>pos)%2 ); } void TriggerScan(TString base, TString outDirectory = "", TString format = ""){ std::stringstream sst; if (outDirectory == "") outDirectory = base.Data(); TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); TFile *file =new TFile(base.Data()) ; if (!file){ printf("file not Found \n"); return; } TTree *PhysicsTr = (TTree*)file->Get("Physics"); TBranch *TrigBr = PhysicsTr->GetBranch("Trigger"); TBranch *HeadBr = PhysicsTr->GetBranch("Header"); pamela::EventHeader *eh = 0; pamela::PscuHeader *ph = 0; pamela::trigger::TriggerEvent *triggerEvent = 0; PhysicsTr->SetBranchAddress("Trigger", &triggerEvent); PhysicsTr->SetBranchAddress("Header", &eh); Long64_t nevents = TrigBr->GetEntries(); if (nevents <= 0) { printf("nevents = %llu \n", nevents); file->Close(); return; } /* Histo DEF */ /* * S4 and Calorimeter Counters histograms */ TCanvas *S4CalCanvas = new TCanvas("S4CalCanvas","S4CalCanvas", 1280, 1024); S4CalCanvas->Divide(1,2); //---------- sst.str(""); sst << "S4 Counters based on " << base.Data(); TH1S *S4Cal1Histo = new TH1S("S4Cal1Histo", sst.str().c_str(), 20, 0, 100); //---------- sst.str(""); sst << "Calorimeter Counters based on " << base.Data(); TH1S *S4Cal2Histo = new TH1S("S4Cal2Histo", sst.str().c_str(), 20, 0, 20); /* * Pattern Trigger Rate histograms */ TCanvas *PatternTrig0 = new TCanvas("PatternTrig0","PatternTrig0", 1280, 1024); //---------- sst.str(""); sst << "Histogram of Calo pattern trigger " << base.Data(); TH1S *PatternTrig0Histo = new TH1S("PatternTrig0Histo", sst.str().c_str(), 4, 0, 4); TCanvas *PatternTrig1 = new TCanvas("PatternTrig1","PatternTrig1", 1280, 1024); //---------- sst.str(""); sst << "Histogram of S4 pattern trigger " << base.Data(); TH1S *PatternTrig1Histo = new TH1S("PatternTrig1Histo", sst.str().c_str(), 3, 0, 3); TCanvas *PatternTrig2 = new TCanvas("PatternTrig2","PatternTrig2", 1280, 1024); //---------- sst.str(""); sst << "Histogram of S3 pattern trigger " << base.Data(); TH1S *PatternTrig2Histo = new TH1S("PatternTrig2Histo", sst.str().c_str(), 12, 0, 12); TCanvas *PatternTrig3 = new TCanvas("PatternTrig3","PatternTrig3", 1280, 1024); //---------- sst.str(""); sst << "Histogram of S2 pattern trigger " << base.Data(); TH1S *PatternTrig3Histo = new TH1S("PatternTrig3Histo", sst.str().c_str(), 8, 0, 8); TCanvas *PatternTrig4 = new TCanvas("PatternTrig4","PatternTrig4", 1280, 1024); //---------- sst.str(""); sst << "Histogram of S12 pattern trigger " << base.Data(); TH1S *PatternTrig4Histo = new TH1S("PatternTrig4Histo", sst.str().c_str(), 12, 0, 12); TCanvas *PatternTrig5 = new TCanvas("PatternTrig5","PatternTrig5", 1280, 1024); //---------- sst.str(""); sst << "Histogram of S11 pattern trigger " << base.Data(); TH1S *PatternTrig5Histo = new TH1S("PatternTrig5Histo", sst.str().c_str(), 16, 0, 16); int i = 0; Int_t size = nevents; Double_t *time = new Double_t[size]; Double_t *evCounter = new Double_t[size]; Double_t *deadTime = new Double_t[size]; Double_t *liveTime = new Double_t[size]; // Double_t *trigrate0 = new Double_t[size]; Double_t *trigrate1 = new Double_t[size]; Double_t *trigrate2 = new Double_t[size]; Double_t *trigrate3 = new Double_t[size]; Double_t *trigrate4 = new Double_t[size]; Double_t *trigrate5 = new Double_t[size]; // Double_t *pmt1 = new Double_t[size]; Double_t *pmt2 = new Double_t[size]; Double_t *pmt3 = new Double_t[size]; // while(i < nevents){ HeadBr->GetEntry(i); TrigBr->GetEntry(i); /* time vector fill*/ ph = eh->GetPscuHeader(); time[i] = ph->GetOrbitalTime(); /* eventCounter vector fill*/ evCounter[i] = triggerEvent->evcount; if( evCounter[i] > 1 ){ /* live time vector fill*/ liveTime[i] = 0.16 * triggerEvent->dltime[0]; /* dead time vector fill*/ deadTime[i] = 0.01 * triggerEvent->dltime[1]; } gStyle->SetStatY(0.85); /////////////////////// /* PMT Plane Counters */ pmt1[i] = 1.*triggerEvent->pmtpl[0]; pmt2[i] = 1.*triggerEvent->pmtpl[1]; pmt3[i] = 1.*triggerEvent->pmtpl[2]; /* Trigger Rate Counters*/ trigrate0[i] = (1/4.)*triggerEvent->trigrate[0]; trigrate1[i] = (1/4.)*triggerEvent->trigrate[1]; trigrate2[i] = (1/4.)*triggerEvent->trigrate[2]; trigrate3[i] = (1/4.)*triggerEvent->trigrate[3]; trigrate4[i] = (1/4.)*triggerEvent->trigrate[4]; trigrate5[i] = (1/4.)*triggerEvent->trigrate[5]; /* S4 and Calorimeter Counters fill*/ S4Cal1Histo->Fill(triggerEvent->s4calcount[0]); S4Cal2Histo->Fill(triggerEvent->s4calcount[1]); int trte0=(int)triggerEvent->patterntrig[0]; PatternTrig0Histo->AddBinContent(1,bit(trte0,0)); PatternTrig0Histo->AddBinContent(2,bit(trte0,1)); PatternTrig0Histo->AddBinContent(3,bit(trte0,2)); PatternTrig0Histo->AddBinContent(4,bit(trte0,3)); int trte1=(int)triggerEvent->patterntrig[1]; PatternTrig1Histo->AddBinContent(1,bit(trte1,0)); int trte2=(int)triggerEvent->patterntrig[2]; PatternTrig2Histo->AddBinContent(1,bit(trte2,0)); PatternTrig2Histo->AddBinContent(2,bit(trte2,1)); PatternTrig2Histo->AddBinContent(3,bit(trte2,2)); PatternTrig2Histo->AddBinContent(4,bit(trte2,3)); PatternTrig2Histo->AddBinContent(5,bit(trte2,4)); PatternTrig2Histo->AddBinContent(6,bit(trte2,5)); PatternTrig2Histo->AddBinContent(7,bit(trte2,6)); PatternTrig2Histo->AddBinContent(8,bit(trte2,7)); PatternTrig2Histo->AddBinContent(9,bit(trte2,8)); PatternTrig2Histo->AddBinContent(10,bit(trte2,9)); PatternTrig2Histo->AddBinContent(11,bit(trte2,10)); PatternTrig2Histo->AddBinContent(12,bit(trte2,11)); PatternTrig2Histo->AddBinContent(13,bit(trte2,12)); PatternTrig2Histo->AddBinContent(14,bit(trte2,13)); PatternTrig2Histo->AddBinContent(15,bit(trte2,14)); PatternTrig2Histo->AddBinContent(16,bit(trte2,15)); int trte3=(int)triggerEvent->patterntrig[3]; PatternTrig3Histo->AddBinContent(1,bit(trte3,0)); PatternTrig3Histo->AddBinContent(2,bit(trte3,1)); PatternTrig3Histo->AddBinContent(3,bit(trte3,2)); PatternTrig3Histo->AddBinContent(4,bit(trte3,3)); PatternTrig3Histo->AddBinContent(5,bit(trte3,4)); PatternTrig3Histo->AddBinContent(6,bit(trte3,5)); PatternTrig3Histo->AddBinContent(7,bit(trte3,6)); PatternTrig3Histo->AddBinContent(8,bit(trte3,7)); PatternTrig3Histo->AddBinContent(9,bit(trte3,8)); PatternTrig3Histo->AddBinContent(10,bit(trte3,9)); PatternTrig3Histo->AddBinContent(11,bit(trte3,10)); PatternTrig3Histo->AddBinContent(12,bit(trte3,11)); PatternTrig3Histo->AddBinContent(13,bit(trte3,12)); PatternTrig3Histo->AddBinContent(14,bit(trte3,13)); PatternTrig3Histo->AddBinContent(15,bit(trte3,14)); PatternTrig3Histo->AddBinContent(16,bit(trte3,15)); int trte4=(int)triggerEvent->patterntrig[4]; PatternTrig4Histo->AddBinContent(1,bit(trte4,0)); PatternTrig4Histo->AddBinContent(2,bit(trte4,1)); PatternTrig4Histo->AddBinContent(3,bit(trte4,2)); PatternTrig4Histo->AddBinContent(4,bit(trte4,3)); PatternTrig4Histo->AddBinContent(5,bit(trte4,4)); PatternTrig4Histo->AddBinContent(6,bit(trte4,5)); PatternTrig4Histo->AddBinContent(7,bit(trte4,6)); PatternTrig4Histo->AddBinContent(8,bit(trte4,7)); PatternTrig4Histo->AddBinContent(9,bit(trte4,8)); PatternTrig4Histo->AddBinContent(10,bit(trte4,9)); PatternTrig4Histo->AddBinContent(11,bit(trte4,10)); PatternTrig4Histo->AddBinContent(12,bit(trte4,11)); PatternTrig4Histo->AddBinContent(13,bit(trte4,12)); PatternTrig4Histo->AddBinContent(14,bit(trte4,13)); PatternTrig4Histo->AddBinContent(15,bit(trte4,14)); PatternTrig4Histo->AddBinContent(16,bit(trte4,15)); int trte5=(int)triggerEvent->patterntrig[5]; PatternTrig5Histo->AddBinContent(1,bit(trte5,0)); PatternTrig5Histo->AddBinContent(2,bit(trte5,1)); PatternTrig5Histo->AddBinContent(3,bit(trte5,2)); PatternTrig5Histo->AddBinContent(4,bit(trte5,3)); PatternTrig5Histo->AddBinContent(5,bit(trte5,4)); PatternTrig5Histo->AddBinContent(6,bit(trte5,5)); PatternTrig5Histo->AddBinContent(7,bit(trte5,6)); PatternTrig5Histo->AddBinContent(8,bit(trte5,7)); PatternTrig5Histo->AddBinContent(9,bit(trte5,8)); PatternTrig5Histo->AddBinContent(10,bit(trte5,9)); PatternTrig5Histo->AddBinContent(11,bit(trte5,10)); PatternTrig5Histo->AddBinContent(12,bit(trte5,11)); PatternTrig5Histo->AddBinContent(13,bit(trte5,12)); PatternTrig5Histo->AddBinContent(14,bit(trte5,13)); PatternTrig5Histo->AddBinContent(15,bit(trte5,14)); PatternTrig5Histo->AddBinContent(16,bit(trte5,15)); i++; } gStyle->SetOptStat(111111); gStyle->SetStatH(0.15); gStyle->SetStatW(0.15); /* * Event Counter graph */ TCanvas *EvCounterCanvas = new TCanvas("EvCounterCanvas","EvCounterCanvas", 1280, 1024); //---------- sst.str(""); sst << "Event Counter"; TGraph *evCounterGraph = new TGraph(nevents, time, evCounter); evCounterGraph->SetTitle(sst.str().c_str()); evCounterGraph->GetXaxis()->SetTitle("OrbitalTime"); evCounterGraph->GetXaxis()->CenterTitle(); evCounterGraph->Draw("APL"); /* * Dead and Live time graphs */ TCanvas *DeadLiveCanvas = new TCanvas("DeadLiveCanvas","DeadLiveCanvas", 1280, 1024); DeadLiveCanvas->Divide(1,2); //---------- sst.str(""); sst << "Graph of Dead Time vs OBT based on " << base.Data(); TGraph *DeadTimeGraph = new TGraph(nevents, time, deadTime); DeadLiveCanvas->cd(1); sst.str(""); sst << "Dead Time"; DeadTimeGraph->SetTitle(sst.str().c_str()); DeadTimeGraph->SetFillColor(2); DeadTimeGraph->GetXaxis()->SetTitle("OrbitalTime"); DeadTimeGraph->GetXaxis()->CenterTitle(); DeadTimeGraph->GetYaxis()->SetTitle("DeadTime(ms)"); DeadTimeGraph->GetYaxis()->CenterTitle(); DeadTimeGraph->SetMaximum(100); DeadTimeGraph->Draw("AP"); //---------- sst.str(""); sst << "Graph of Live Time vs OBT based on " << base.Data(); TGraph *LiveTimeGraph = new TGraph(nevents, (const Double_t*)time, (const Double_t*)liveTime); DeadLiveCanvas->cd(2); sst.str(""); sst << "Live Time"; LiveTimeGraph->SetTitle(sst.str().c_str()); LiveTimeGraph->SetFillColor(2); LiveTimeGraph->GetXaxis()->SetTitle("OrbitalTime"); LiveTimeGraph->GetXaxis()->CenterTitle(); LiveTimeGraph->GetYaxis()->SetTitle("LiveTime(ms)"); LiveTimeGraph->GetYaxis()->CenterTitle(); LiveTimeGraph->Draw("AP"); /* * PMT Plane Counters Graph */ TCanvas *PMTCanvas = new TCanvas("PMTCanvas","PMTCanvas", 1280, 1024); PMTCanvas->Divide(1,3); //---------- sst.str(""); sst << "Graph of PMT Plane Counters (S11 AND S12) vs OBT based on " << base.Data(); TGraph *PMT1Graph = new TGraph(nevents, time, pmt1); PMTCanvas->cd(1); sst.str(""); sst << "PMT Plane Counters (S11 AND S12)"; PMT1Graph->SetTitle(sst.str().c_str()); PMT1Graph->SetFillColor(2); PMT1Graph->GetXaxis()->SetTitle("OrbitalTime"); PMT1Graph->GetXaxis()->CenterTitle(); PMT1Graph->GetYaxis()->SetTitle("PMT Plane Counters"); PMT1Graph->GetYaxis()->CenterTitle(); PMT1Graph->Draw("AP"); //---------- sst.str(""); sst << "Graph PMT Plane Counters (S21 AND S22) vs OBT based on " << base.Data(); TGraph *PMT2Graph = new TGraph(nevents, time, pmt2); PMTCanvas->cd(2); sst.str(""); sst << "PMT Plane Counters (S21 AND S22)"; PMT2Graph->SetTitle(sst.str().c_str()); PMT2Graph->SetFillColor(2); PMT2Graph->GetXaxis()->SetTitle("OrbitalTime"); PMT2Graph->GetXaxis()->CenterTitle(); PMT2Graph->GetYaxis()->SetTitle("PMT Plane Counters"); PMT2Graph->GetYaxis()->CenterTitle(); PMT2Graph->Draw("AP"); //---------- sst.str(""); sst << "Graph PMT Plane Counters (S31 AND S32) vs OBT based on " << base.Data(); TGraph *PMT3Graph = new TGraph(nevents, time, pmt3); PMTCanvas->cd(3); sst.str(""); sst << "PMT Plane Counters (S31 AND S32)"; PMT3Graph->SetTitle(sst.str().c_str()); PMT3Graph->SetFillColor(2); PMT3Graph->GetXaxis()->SetTitle("OrbitalTime"); PMT3Graph->GetXaxis()->CenterTitle(); PMT3Graph->GetYaxis()->SetTitle("PMT Plane Rate Counters"); PMT3Graph->GetYaxis()->CenterTitle(); PMT3Graph->Draw("AP"); // //---------- /* * Trigger Rate Counters draw */ TCanvas *TrigRate1Canvas = new TCanvas("TrigRate1Canvas","TrigRate1Canvas", 1280, 1024); TrigRate1Canvas->Divide(1,3); //---------- sst.str(""); sst << "Graph of Trigger Rate Counters (S11 OR S12) AND (S21 OR S22) AND (S31 OR S32) vs OBT based on " << base.Data(); TGraph *TrigRate0Graph = new TGraph(nevents, time, trigrate0); TrigRate1Canvas->cd(1); sst.str(""); sst << "Trigger Rate Counters (S11 OR S12) AND (S21 OR S22) AND (S31 OR S32)"; TrigRate0Graph->SetTitle(sst.str().c_str()); TrigRate0Graph->SetFillColor(2); TrigRate0Graph->GetXaxis()->SetTitle("OrbitalTime"); TrigRate0Graph->GetXaxis()->CenterTitle(); TrigRate0Graph->GetYaxis()->SetTitle("Trigger Rate Counters"); TrigRate0Graph->GetYaxis()->CenterTitle(); TrigRate0Graph->Draw("AP"); //---------- sst.str(""); sst << "Graph Trigger Rate Counters (S11 AND S12) AND (S21 AND S22) AND (S31 AND S32) vs OBT based on " << base.Data(); TGraph *TrigRate1Graph = new TGraph(nevents, time, trigrate1); TrigRate1Canvas->cd(2); sst.str(""); sst << "Trigger Rate Counters (S11 AND S12) AND (S21 AND S22) AND (S31 AND S32)"; TrigRate1Graph->SetTitle(sst.str().c_str()); TrigRate1Graph->SetFillColor(2); TrigRate1Graph->GetXaxis()->SetTitle("OrbitalTime"); TrigRate1Graph->GetXaxis()->CenterTitle(); TrigRate1Graph->GetYaxis()->SetTitle("Trigger Rate Counters"); TrigRate1Graph->GetYaxis()->CenterTitle(); TrigRate1Graph->Draw("AP"); //---------- sst.str(""); sst << "Graph Trigger Rate Counters (S21 OR S22) AND (S31 OR S32) vs OBT based on " << base.Data(); TGraph *TrigRate2Graph = new TGraph(nevents, time, trigrate2); TrigRate1Canvas->cd(3); sst.str(""); sst << "Trigger Rate Counters (S21 OR S22) AND (S31 OR S32) "; TrigRate2Graph->SetTitle(sst.str().c_str()); TrigRate2Graph->SetFillColor(2); TrigRate2Graph->GetXaxis()->SetTitle("OrbitalTime"); TrigRate2Graph->GetXaxis()->CenterTitle(); TrigRate2Graph->GetYaxis()->SetTitle("Trigger Rate Counters"); TrigRate2Graph->GetYaxis()->CenterTitle(); TrigRate2Graph->Draw("AP"); // //---------- // TCanvas *TrigRate2Canvas = new TCanvas("TrigRate2Canvas","TrigRate2Canvas", 1280, 1024); TrigRate2Canvas->Divide(1,3); //---------- sst.str(""); sst << "Graph of Trigger Rate Counters (S21 AND S22) AND (S31 AND S32) vs OBT based on " << base.Data(); TGraph *TrigRate3Graph = new TGraph(nevents, time, trigrate3); TrigRate2Canvas->cd(1); sst.str(""); sst << "Trigger Rate Counters (S21 AND S22) AND (S31 AND S32)"; TrigRate3Graph->SetTitle(sst.str().c_str()); TrigRate3Graph->SetFillColor(2); TrigRate3Graph->GetXaxis()->SetTitle("OrbitalTime"); TrigRate3Graph->GetXaxis()->CenterTitle(); TrigRate3Graph->GetYaxis()->SetTitle("Trigger Rate Counters"); TrigRate3Graph->GetYaxis()->CenterTitle(); TrigRate3Graph->Draw("AP"); //---------- sst.str(""); sst << "Graph Trigger Rate Counters S12 AND (S21 AND S22) vs OBT based on " << base.Data(); TGraph *TrigRate4Graph = new TGraph(nevents, time, trigrate4); TrigRate2Canvas->cd(2); sst.str(""); sst << "Trigger Rate Counters S12 AND (S21 AND S22)"; TrigRate4Graph->SetTitle(sst.str().c_str()); TrigRate4Graph->SetFillColor(2); TrigRate4Graph->GetXaxis()->SetTitle("OrbitalTime"); TrigRate4Graph->GetXaxis()->CenterTitle(); TrigRate4Graph->GetYaxis()->SetTitle("Trigger Rate Counters"); TrigRate4Graph->GetYaxis()->CenterTitle(); TrigRate4Graph->Draw("AP"); //---------- sst.str(""); sst << "Graph Trigger Rate Counters (S11 OR S12) AND (S31 OR S32) vs OBT based on " << base.Data(); TGraph *TrigRate5Graph = new TGraph(nevents, time, trigrate5); TrigRate2Canvas->cd(3); sst.str(""); sst << "Trigger Rate Counters (S11 OR S12) AND (S31 OR S32)"; TrigRate5Graph->SetTitle(sst.str().c_str()); TrigRate5Graph->SetFillColor(2); TrigRate5Graph->GetXaxis()->SetTitle("OrbitalTime"); TrigRate5Graph->GetXaxis()->CenterTitle(); TrigRate5Graph->GetYaxis()->SetTitle("Trigger Rate Counters"); TrigRate5Graph->GetYaxis()->CenterTitle(); TrigRate5Graph->Draw("AP"); //---------- gStyle->SetOptStat("mr"); /* S4 and Calorimeter Counters draw*/ S4CalCanvas->cd(1); S4Cal1Histo->GetXaxis()->SetTitle("Hz"); S4Cal1Histo->Draw(); S4CalCanvas->cd(2); S4Cal2Histo->GetXaxis()->SetTitle("Hz"); S4Cal2Histo->Draw(); /* Pattern Trigger draw*/ // gStyle->SetOptStat(1101); gStyle->SetOptStat("mr"); PatternTrig5->cd(); PatternTrig5Histo->SetMinimum(0.); PatternTrig5Histo->Draw(""); PatternTrig4->cd(); PatternTrig4Histo->SetMinimum(0.); PatternTrig4Histo->Draw(""); PatternTrig3->cd(); PatternTrig3Histo->SetMinimum(0.); PatternTrig3Histo->Draw(""); PatternTrig2->cd(); PatternTrig2Histo->SetMinimum(0.); PatternTrig2Histo->Draw(""); PatternTrig0->cd(); PatternTrig0Histo->SetMinimum(0.); PatternTrig0Histo->Draw(""); PatternTrig1->cd(); PatternTrig1Histo->SetMinimum(0.); PatternTrig1Histo->Draw(""); gStyle->SetOptStat("mr"); gStyle->SetStatH(0.3); gStyle->SetStatW(0.3); TH1 *htemp; TCanvas *RatePMT1 = new TCanvas("RatePMT1", "Rate PMT S11A", 1); RatePMT1->Divide (3,3); //---------- RatePMT1->cd(1); PhysicsTr->Draw("pmtcount1[0]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S111A"); //---------- RatePMT1->cd (2); PhysicsTr->Draw("pmtcount1[1]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S112A"); //---------- RatePMT1->cd (3); PhysicsTr->Draw("pmtcount1[2]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S113A"); //---------- RatePMT1->cd(4); PhysicsTr->Draw("pmtcount1[3]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S114A"); //---------- RatePMT1->cd(5); PhysicsTr->Draw("pmtcount1[4]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S115A"); //---------- RatePMT1->cd(6); PhysicsTr->Draw("pmtcount1[5]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S116A"); //---------- RatePMT1->cd(7); PhysicsTr->Draw("pmtcount1[6]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S117A"); //---------- RatePMT1->cd(8); PhysicsTr->Draw("pmtcount1[7]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S118A"); TCanvas *RatePMT2 = new TCanvas("RatePMT2", "Rate PMT S11B", 1); RatePMT2->Divide (3,3); //---------- RatePMT2->cd(1); PhysicsTr-> Draw("pmtcount1[8]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S111B"); //---------- RatePMT2->cd(2); PhysicsTr->Draw("pmtcount1[9]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S112B"); //---------- RatePMT2->cd(3); PhysicsTr->Draw("pmtcount1[10]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S113B"); //---------- RatePMT2->cd(4); PhysicsTr->Draw("pmtcount1[11]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S114B"); //---------- RatePMT2->cd(5); PhysicsTr-> Draw("pmtcount1[12]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S115B"); //---------- RatePMT2->cd(6); PhysicsTr-> Draw("pmtcount1[13]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S116B"); //---------- RatePMT2->cd(7); PhysicsTr-> Draw("pmtcount1[14]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S117B"); //---------- RatePMT2->cd(8); PhysicsTr->Draw("pmtcount1[15]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S118B"); TCanvas *RatePMT3 = new TCanvas("RatePMT3", "Rate PMT S12", 1); RatePMT3->Divide (3,4); //---------- RatePMT3->cd(1); PhysicsTr-> Draw("pmtcount1[16]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S121A"); //---------- RatePMT3->cd(2); PhysicsTr-> Draw("pmtcount1[17]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S122A"); //---------- RatePMT3->cd (3); PhysicsTr-> Draw("pmtcount1[18]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S123A"); //---------- RatePMT3->cd(4); PhysicsTr->Draw("pmtcount1[19]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S124A"); //---------- RatePMT3->cd(5); PhysicsTr-> Draw("pmtcount1[20]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S125A"); //---------- RatePMT3->cd(6); PhysicsTr-> Draw("pmtcount1[21]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S126A"); //---------- RatePMT3->cd(7); PhysicsTr->Draw("pmtcount1[22]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S121B"); //---------- RatePMT3->cd(8); PhysicsTr-> Draw("pmtcount1[23]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S122B"); //---------- RatePMT3->cd (9); PhysicsTr->Draw("pmtcount2[0]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S123B"); //---------- RatePMT3->cd (10); PhysicsTr->Draw("pmtcount2[1]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S124B"); //---------- RatePMT3->cd (11); PhysicsTr->Draw("pmtcount2[2]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S125B"); //---------- RatePMT3->cd (12); PhysicsTr->Draw("pmtcount2[3]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S126B"); TCanvas *RatePMT4 = new TCanvas("RatePMT4", "Rate PMT S2", 1); RatePMT4->Divide (3,3); //---------- RatePMT4->cd (1); PhysicsTr-> Draw("pmtcount2[4]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S211A"); //---------- RatePMT4->cd (2); PhysicsTr-> Draw("pmtcount2[5]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S212A"); //---------- RatePMT4->cd (3); PhysicsTr-> Draw("pmtcount2[6]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S211B"); //---------- RatePMT4->cd (4); PhysicsTr-> Draw("pmtcount2[7]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S212B"); //---------- RatePMT4->cd (5); PhysicsTr-> Draw("pmtcount2[8]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S221A"); //---------- RatePMT4->cd (6); PhysicsTr-> Draw("pmtcount2[9]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S222A"); //---------- RatePMT4->cd (7); PhysicsTr-> Draw("pmtcount2[10]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S221B"); //---------- RatePMT4->cd (8); PhysicsTr->Draw("pmtcount2[11]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S222B"); TCanvas *RatePMT5 = new TCanvas("RatePMT5", "Rate PMT S3", 1); RatePMT5->Divide (3,4); //---------- RatePMT5->cd (1); PhysicsTr-> Draw("pmtcount2[12]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S311A"); //---------- RatePMT5->cd (2); PhysicsTr-> Draw("pmtcount2[13]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S312A"); //---------- RatePMT5->cd (3); PhysicsTr-> Draw("pmtcount2[14]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S313A"); //---------- RatePMT5->cd (4); PhysicsTr-> Draw("pmtcount2[15]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S311B"); //---------- RatePMT5->cd (5); PhysicsTr-> Draw("pmtcount2[16]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S312B"); //---------- RatePMT5->cd (6); PhysicsTr-> Draw("pmtcount2[17]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S313B"); //---------- RatePMT5->cd (7); PhysicsTr-> Draw("pmtcount2[18]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S321A"); //---------- RatePMT5->cd (8); PhysicsTr-> Draw("pmtcount2[19]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S322A"); //---------- RatePMT5->cd (9); PhysicsTr-> Draw("pmtcount2[20]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S323A"); //---------- RatePMT5->cd (10); PhysicsTr-> Draw("pmtcount2[21]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S321B"); //---------- RatePMT5->cd (11); PhysicsTr-> Draw("pmtcount2[22]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S322B"); //---------- gStyle->SetOptStat("mr"); gStyle->SetStatH(0.3); gStyle->SetStatW(0.3); RatePMT5->cd (12); PhysicsTr-> Draw("pmtcount2[23]"); htemp = (TH1*)gPad->GetPrimitive("htemp"); htemp->SetTitle("S323B"); // print the output const char *saveas = format; if ( !strcmp(saveas,"ps") ) { // ------print the ps gStyle->SetOptStat(111111); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan." << saveas << "("; EvCounterCanvas->Print(sst.str().c_str()); DeadLiveCanvas->Print(sst.str().c_str()); PMTCanvas->Print(sst.str().c_str()); TrigRate1Canvas->Print(sst.str().c_str()); TrigRate2Canvas->Print(sst.str().c_str()); gStyle->SetOptStat("mr"); S4CalCanvas->Print(sst.str().c_str()); // gStyle->SetOptStat(1101); gStyle->SetOptStat("mr"); PatternTrig5->Print(sst.str().c_str()); PatternTrig4->Print(sst.str().c_str()); PatternTrig3->Print(sst.str().c_str()); PatternTrig2->Print(sst.str().c_str()); PatternTrig0->Print(sst.str().c_str()); PatternTrig1->Print(sst.str().c_str()); gStyle->SetOptStat("mr"); RatePMT1->Print(sst.str().c_str()); RatePMT2->Print(sst.str().c_str()); RatePMT3->Print(sst.str().c_str()); RatePMT4->Print(sst.str().c_str()); // sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan." << saveas << ")"; RatePMT5->Print(sst.str().c_str()); } else { gStyle->SetOptStat(111111); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan1." << saveas; EvCounterCanvas->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan2." << saveas; DeadLiveCanvas->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan3." << saveas; PMTCanvas->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan4." << saveas; TrigRate1Canvas->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan5." << saveas; TrigRate2Canvas->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan6." << saveas; S4CalCanvas->SaveAs(sst.str().c_str()); // gStyle->SetOptStat(1101); gStyle->SetOptStat("mr"); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan7." << saveas; PatternTrig5->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan8." << saveas; PatternTrig4->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan9." << saveas; PatternTrig3->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan10." << saveas; PatternTrig2->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan11." << saveas; PatternTrig0->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan12." << saveas; PatternTrig1->SaveAs(sst.str().c_str()); gStyle->SetOptStat("mr"); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan13." << saveas; RatePMT1->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan14." << saveas; RatePMT2->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan15." << saveas; RatePMT3->SaveAs(sst.str().c_str()); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan16." << saveas; RatePMT4->SaveAs(sst.str().c_str()); // gStyle->SetOptStat(1111); gStyle->SetOptStat("mr"); sst.str(""); sst << outDirectory.Data() << filename.Data() << "TriggerScan17." << saveas; RatePMT5->SaveAs(sst.str().c_str()); } } int main(int argc, char* argv[]){ TString path; TString outDir ="./"; TString format ="ps"; if (argc < 2){ printf("You have to insert at least the file to analyze \n"); printf("Try '--help' for more information. \n"); exit(1); } if (!strcmp(argv[1], "--help")){ printf( "Usage: TriggerScan FILE [OPTION] \n"); printf( "\t --help Print this help and exit \n"); printf( "\t -outDir[path] Path where to put the output [default ./] \n"); printf( "\t -format[ps] Format for output files [default 'ps'] \n"); exit(1); } path=argv[1]; for (int i = 2; i < argc; i++){ if (!strcmp(argv[i], "-outDir")){ if (++i >= argc){ printf( "-outDir needs arguments. \n"); printf( "Try '--help' for more information. \n"); exit(1); } else{ outDir = argv[i]; continue; } } if (!strcmp(argv[i], "-format")){ if (++i >= argc){ printf( "-format needs arguments. \n"); printf( "Try '--help' for more information. \n"); exit(1); } else{ format = argv[i]; continue; } } } TriggerScan(argv[1], outDir, format); }