/[PAMELA software]/quicklook/trigger/src/TriggerScan.cpp
ViewVC logotype

Annotation of /quicklook/trigger/src/TriggerScan.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Thu May 11 10:07:39 2006 UTC (18 years, 6 months ago) by campana
Branch: ToF
CVS Tags: v1r02, v1r03, v1r00, start
Changes since 1.1: +0 -0 lines
ToF QuickLook script

1 campana 1.1 /**
2     * TriggerScan
3     * Author Nagni
4     * Modified by G. De Rosa
5     * Version 1.2
6     * Date 27 Apr 2006
7     *
8     * Description:
9     * Describe the performance of the Trigger.
10     *
11     * Parameters:
12     * TString base - the path to the root directory for the specific Pamela unpack session
13     * TString outDirectory - the path where to save the output image (Default = base)
14     * TString format - the format which will be used for save the produced images (Default = "ps")
15     */
16    
17     #include <TString.h>
18     #include <TObjString.h>
19     #include <TTree.h>
20     #include <TBranch.h>
21     #include <TGraph.h>
22     #include <TStyle.h>
23     #include <TH2S.h>
24     #include <TPaveText.h>
25     #include <TCanvas.h>
26     #include <TLatex.h>
27     #include <TGraph.h>
28     #include <physics/trigger/TriggerEvent.h>
29     #include <EventHeader.h>
30     #include <PscuHeader.h>
31     #include <iostream>
32    
33     using namespace std;
34    
35     char bit(int decimal, char pos)
36     {
37     return( (decimal>>pos)%2 );
38     }
39    
40     void TriggerScan(TString base, TString outDirectory = "", TString format = ""){
41     TLatex *t=new TLatex();
42    
43     std::stringstream sst;
44     if (outDirectory == "") outDirectory = base.Data();
45     TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
46    
47     TFile *file =new TFile(base.Data()) ;
48     if (!file){
49     printf("file not Found \n");
50     return;
51     }
52    
53     TTree *PhysicsTr = (TTree*)file->Get("Physics");
54     TBranch *TrigBr = PhysicsTr->GetBranch("Trigger");
55     TBranch *HeadBr = PhysicsTr->GetBranch("Header");
56    
57     pamela::EventHeader *eh = 0;
58     pamela::PscuHeader *ph = 0;
59    
60     pamela::trigger::TriggerEvent *triggerEvent = 0;
61    
62     PhysicsTr->SetBranchAddress("Trigger", &triggerEvent);
63     PhysicsTr->SetBranchAddress("Header", &eh);
64    
65     Long64_t nevents = TrigBr->GetEntries();
66     if (nevents <= 0) {
67     printf("nevents = %llu \n", nevents);
68     file->Close();
69     return;
70     }
71    
72     /* Histo DEF */
73    
74     /*
75     * PTM Plane Counters histograms
76     */
77     TCanvas *PMTCanvas = new TCanvas("PMTCanvas","PMTCanvas", 1280, 1024);
78     PMTCanvas->Divide(1,3);
79     //----------
80     sst.str("");
81     sst << "Histogram of PMT Plane Counters (S11 AND S12) based on " << base.Data();
82     TH1S *pmt1Histo = new TH1S("PMT1Histo", sst.str().c_str(), 20, 0., 300.);
83     //----------
84     sst.str("");
85     sst << "Histogram of PMT Plane Counters (S21 AND S22) based on " << base.Data();
86     TH1S *pmt2Histo = new TH1S("PMT2Histo", sst.str().c_str(), 20, 0., 300.);
87     //----------
88     sst.str("");
89     sst << "Histogram of PMT Plane Counters (S31 AND S32) based on " << base.Data();
90     TH1S *pmt3Histo = new TH1S("PMT3Histo", sst.str().c_str(), 20, 0., 300.);
91    
92     /*
93     * Trigger Rate Counters histograms
94     */
95     TCanvas *TrigRate1Canvas = new TCanvas("TrigRate1Canvas","TrigRate1Canvas", 1280, 1024);
96     TrigRate1Canvas->Divide(1,3);
97    
98     TCanvas *TrigRate2Canvas = new TCanvas("TrigRate2Canvas","TrigRate2Canvas", 1280, 1024);
99     TrigRate2Canvas->Divide(1,3);
100     //----------
101     sst.str("");
102     sst << "Histogram of Trigger Rate Counters (S11 OR S12) AND (S21 OR S22) AND (S31 OR S32) based on " << base.Data();
103     TH1S *trRate1Histo = new TH1S("trRate1Histo", sst.str().c_str(), 20, 0., 5.);
104     //----------
105     sst.str("");
106     sst << "Histogram of Trigger Rate Counters (S11 AND S12) AND (S21 AND S22) AND (S31 AND S32) based on " << base.Data();
107     TH1S *trRate2Histo = new TH1S("trRate2Histo", sst.str().c_str(), 20, 0., 5.);
108     //---------
109     sst.str("");
110     sst << "Histogram of Trigger Rate Counters (S21 OR S22) AND (S31 OR S32) based on " << base.Data();
111     TH1S *trRate3Histo = new TH1S("trRate3Histo", sst.str().c_str(), 20, 0., 5.);
112     //---------
113     sst.str("");
114     sst << "Histogram of Trigger Rate Counters (S21 AND S22) AND (S31 AND S32) based on " << base.Data();
115     TH1S *trRate4Histo = new TH1S("trRate4Histo", sst.str().c_str(), 20, 0., 5.);
116     //---------
117     sst.str("");
118     sst << "Histogram of Trigger Rate Counters S12 AND (S21 OR S22) based on " << base.Data();
119     TH1S *trRate5Histo = new TH1S("trRate5Histo", sst.str().c_str(), 20, 0., 5.);
120     //---------
121     sst.str("");
122     sst << "Histogram of Trigger Rate Counters (S11 OR S12) AND (S31 OR S32) based on " << base.Data();
123     TH1S *trRate6Histo = new TH1S("trRate6Histo", sst.str().c_str(), 20, 0., 5.);
124    
125    
126     /*
127     * S4 and Calorimeter Counters histograms
128     */
129     TCanvas *S4CalCanvas = new TCanvas("S4CalCanvas","S4CalCanvas", 1280, 1024);
130     S4CalCanvas->Divide(1,2);
131     //----------
132     sst.str("");
133     sst << "S4 Counters based on " << base.Data();
134     TH1S *S4Cal1Histo = new TH1S("S4Cal1Histo", sst.str().c_str(), 20, 0, 20);
135     //----------
136     sst.str("");
137     sst << "Calorimeter Counters based on " << base.Data();
138     TH1S *S4Cal2Histo = new TH1S("S4Cal2Histo", sst.str().c_str(), 20, 0, 20);
139    
140     /*
141     * Pattern Trigger Rate histograms
142     */
143    
144     TCanvas *PatternTrig0 = new TCanvas("PatternTrig0","PatternTrig0", 1280, 1024);
145     //----------
146     sst.str("");
147     sst << "Histogram of Calo pattern trigger " << base.Data();
148     TH1S *PatternTrig0Histo = new TH1S("PatternTrig0Histo", sst.str().c_str(), 4, 0, 4);
149    
150     TCanvas *PatternTrig1 = new TCanvas("PatternTrig1","PatternTrig1", 1280, 1024);
151     //----------
152     sst.str("");
153     sst << "Histogram of S4 pattern trigger " << base.Data();
154     TH1S *PatternTrig1Histo = new TH1S("PatternTrig1Histo", sst.str().c_str(), 3, 0, 3);
155    
156    
157     TCanvas *PatternTrig2 = new TCanvas("PatternTrig2","PatternTrig2", 1280, 1024);
158     //----------
159     sst.str("");
160     sst << "Histogram of S3 pattern trigger " << base.Data();
161     TH1S *PatternTrig2Histo = new TH1S("PatternTrig2Histo", sst.str().c_str(), 16, 0, 16);
162    
163    
164     TCanvas *PatternTrig3 = new TCanvas("PatternTrig3","PatternTrig3", 1280, 1024);
165     //----------
166     sst.str("");
167     sst << "Histogram of S2 pattern trigger " << base.Data();
168     TH1S *PatternTrig3Histo = new TH1S("PatternTrig3Histo", sst.str().c_str(), 16, 0, 16);
169    
170    
171     TCanvas *PatternTrig4 = new TCanvas("PatternTrig4","PatternTrig4", 1280, 1024);
172     //----------
173     sst.str("");
174     sst << "Histogram of S12 pattern trigger " << base.Data();
175     TH1S *PatternTrig4Histo = new TH1S("PatternTrig4Histo", sst.str().c_str(), 16, 0, 16);
176    
177    
178     TCanvas *PatternTrig5 = new TCanvas("PatternTrig5","PatternTrig5", 1280, 1024);
179     //----------
180     sst.str("");
181     sst << "Histogram of S11 pattern trigger " << base.Data();
182     TH1S *PatternTrig5Histo = new TH1S("PatternTrig5Histo", sst.str().c_str(), 16, 0, 16);
183    
184    
185    
186     int i = 0;
187     Int_t size = nevents;
188    
189     Double_t *time = new Double_t[size];
190     Double_t *evCounter = new Double_t[size];
191     Double_t *deadTime = new Double_t[size];
192     Double_t *liveTime = new Double_t[size];
193    
194     while(i < nevents){
195     HeadBr->GetEntry(i);
196     TrigBr->GetEntry(i);
197    
198     /* time vector fill*/
199     ph = eh->GetPscuHeader();
200     time[i] = ph->GetOrbitalTime();
201    
202     /* eventCounter vector fill*/
203     evCounter[i] = triggerEvent->evcount;
204    
205     /* live time vector fill*/
206     liveTime[i] = 0.16 * triggerEvent->dltime[0];
207    
208     /* dead time vector fill*/
209     deadTime[i] = 0.01 * triggerEvent->dltime[1];
210    
211     gStyle->SetStatY(0.85);
212    
213     /* PMT Plane Counters fill*/
214    
215     pmt1Histo->Fill((1/0.06)*triggerEvent->pmtpl[0]);
216     pmt2Histo->Fill((1/0.06)*triggerEvent->pmtpl[1]);
217     pmt3Histo->Fill((1/0.06)*triggerEvent->pmtpl[2]);
218    
219     /* Trigger Rate Counters fill*/
220     trRate1Histo->Fill((1/4.)*triggerEvent->trigrate[0]);
221     trRate2Histo->Fill((1/4.)*triggerEvent->trigrate[1]);
222     trRate3Histo->Fill((1/4.)*triggerEvent->trigrate[2]);
223     trRate4Histo->Fill((1/4.)*triggerEvent->trigrate[3]);
224     trRate5Histo->Fill((1/4.)*triggerEvent->trigrate[4]);
225     trRate6Histo->Fill((1/4.)*triggerEvent->trigrate[5]);
226    
227     /* S4 and Calorimeter Counters fill*/
228     S4Cal1Histo->Fill(triggerEvent->s4calcount[0]);
229     S4Cal2Histo->Fill(triggerEvent->s4calcount[1]);
230    
231     int trte0=(int)triggerEvent->patterntrig[0];
232    
233     PatternTrig0Histo->AddBinContent(1,bit(trte0,0));
234     PatternTrig0Histo->AddBinContent(2,bit(trte0,1));
235     PatternTrig0Histo->AddBinContent(3,bit(trte0,2));
236     PatternTrig0Histo->AddBinContent(4,bit(trte0,3));
237    
238     int trte1=(int)triggerEvent->patterntrig[1];
239    
240     PatternTrig1Histo->AddBinContent(1,bit(trte1,0));
241     PatternTrig1Histo->AddBinContent(2,bit(trte1,1));
242     PatternTrig1Histo->AddBinContent(3,bit(trte1,2));
243    
244    
245     int trte2=(int)triggerEvent->patterntrig[2];
246    
247     PatternTrig2Histo->AddBinContent(1,bit(trte2,0));
248     PatternTrig2Histo->AddBinContent(2,bit(trte2,1));
249     PatternTrig2Histo->AddBinContent(3,bit(trte2,2));
250     PatternTrig2Histo->AddBinContent(4,bit(trte2,3));
251     PatternTrig2Histo->AddBinContent(5,bit(trte2,4));
252     PatternTrig2Histo->AddBinContent(6,bit(trte2,5));
253     PatternTrig2Histo->AddBinContent(7,bit(trte2,6));
254     PatternTrig2Histo->AddBinContent(8,bit(trte2,7));
255     PatternTrig2Histo->AddBinContent(9,bit(trte2,8));
256     PatternTrig2Histo->AddBinContent(10,bit(trte2,9));
257     PatternTrig2Histo->AddBinContent(11,bit(trte2,10));
258     PatternTrig2Histo->AddBinContent(12,bit(trte2,11));
259     PatternTrig2Histo->AddBinContent(13,bit(trte2,12));
260     PatternTrig2Histo->AddBinContent(14,bit(trte2,13));
261     PatternTrig2Histo->AddBinContent(15,bit(trte2,14));
262     PatternTrig2Histo->AddBinContent(16,bit(trte2,15));
263    
264     int trte3=(int)triggerEvent->patterntrig[3];
265    
266    
267     PatternTrig3Histo->AddBinContent(1,bit(trte3,0));
268     PatternTrig3Histo->AddBinContent(2,bit(trte3,1));
269     PatternTrig3Histo->AddBinContent(3,bit(trte3,2));
270     PatternTrig3Histo->AddBinContent(4,bit(trte3,3));
271     PatternTrig3Histo->AddBinContent(5,bit(trte3,4));
272     PatternTrig3Histo->AddBinContent(6,bit(trte3,5));
273     PatternTrig3Histo->AddBinContent(7,bit(trte3,6));
274     PatternTrig3Histo->AddBinContent(8,bit(trte3,7));
275     PatternTrig3Histo->AddBinContent(9,bit(trte3,8));
276     PatternTrig3Histo->AddBinContent(10,bit(trte3,9));
277     PatternTrig3Histo->AddBinContent(11,bit(trte3,10));
278     PatternTrig3Histo->AddBinContent(12,bit(trte3,11));
279     PatternTrig3Histo->AddBinContent(13,bit(trte3,12));
280     PatternTrig3Histo->AddBinContent(14,bit(trte3,13));
281     PatternTrig3Histo->AddBinContent(15,bit(trte3,14));
282     PatternTrig3Histo->AddBinContent(16,bit(trte3,15));
283    
284     int trte4=(int)triggerEvent->patterntrig[4];
285    
286    
287     PatternTrig4Histo->AddBinContent(1,bit(trte4,0));
288     PatternTrig4Histo->AddBinContent(2,bit(trte4,1));
289     PatternTrig4Histo->AddBinContent(3,bit(trte4,2));
290     PatternTrig4Histo->AddBinContent(4,bit(trte4,3));
291     PatternTrig4Histo->AddBinContent(5,bit(trte4,4));
292     PatternTrig4Histo->AddBinContent(6,bit(trte4,5));
293     PatternTrig4Histo->AddBinContent(7,bit(trte4,6));
294     PatternTrig4Histo->AddBinContent(8,bit(trte4,7));
295     PatternTrig4Histo->AddBinContent(9,bit(trte4,8));
296     PatternTrig4Histo->AddBinContent(10,bit(trte4,9));
297     PatternTrig4Histo->AddBinContent(11,bit(trte4,10));
298     PatternTrig4Histo->AddBinContent(12,bit(trte4,11));
299     PatternTrig4Histo->AddBinContent(13,bit(trte4,12));
300     PatternTrig4Histo->AddBinContent(14,bit(trte4,13));
301     PatternTrig4Histo->AddBinContent(15,bit(trte4,14));
302     PatternTrig4Histo->AddBinContent(16,bit(trte4,15));
303    
304     int trte5=(int)triggerEvent->patterntrig[5];
305    
306    
307     PatternTrig5Histo->AddBinContent(1,bit(trte5,0));
308     PatternTrig5Histo->AddBinContent(2,bit(trte5,1));
309     PatternTrig5Histo->AddBinContent(3,bit(trte5,2));
310     PatternTrig5Histo->AddBinContent(4,bit(trte5,3));
311     PatternTrig5Histo->AddBinContent(5,bit(trte5,4));
312     PatternTrig5Histo->AddBinContent(6,bit(trte5,5));
313     PatternTrig5Histo->AddBinContent(7,bit(trte5,6));
314     PatternTrig5Histo->AddBinContent(8,bit(trte5,7));
315     PatternTrig5Histo->AddBinContent(9,bit(trte5,8));
316     PatternTrig5Histo->AddBinContent(10,bit(trte5,9));
317     PatternTrig5Histo->AddBinContent(11,bit(trte5,10));
318     PatternTrig5Histo->AddBinContent(12,bit(trte5,11));
319     PatternTrig5Histo->AddBinContent(13,bit(trte5,12));
320     PatternTrig5Histo->AddBinContent(14,bit(trte5,13));
321     PatternTrig5Histo->AddBinContent(15,bit(trte5,14));
322     PatternTrig5Histo->AddBinContent(16,bit(trte5,15));
323    
324     i++;
325     }
326    
327    
328     gStyle->SetOptStat(111111);
329     gStyle->SetStatH(0.15);
330     gStyle->SetStatW(0.15);
331    
332    
333     /*
334     * Event Counter graph
335     */
336     TCanvas *EvCounterCanvas = new TCanvas("EvCounterCanvas","EvCounterCanvas", 1280, 1024);
337     //----------
338     sst.str("");
339     sst << "Event Counter";
340     TGraph *evCounterGraph = new TGraph(nevents, time, evCounter);
341     evCounterGraph->SetTitle(sst.str().c_str());
342     evCounterGraph->Draw("APL");
343    
344     /*
345     * Dead and Live time graphs
346     */
347     TCanvas *DeadLiveCanvas = new TCanvas("DeadLiveCanvas","DeadLiveCanvas", 1280, 1024);
348     DeadLiveCanvas->Divide(1,2);
349     //----------
350     sst.str("");
351     sst << "Graph of Dead Time vs OBT based on " << base.Data();
352     TGraph *DeadTimeGraph = new TGraph(nevents, time, deadTime);
353     DeadLiveCanvas->cd(1);
354     sst.str("");
355     sst << "Dead Time";
356     DeadTimeGraph->SetTitle(sst.str().c_str());
357     DeadTimeGraph->SetFillColor(2);
358     DeadTimeGraph->GetXaxis()->SetTitle("OnBoardTime");
359     DeadTimeGraph->GetXaxis()->CenterTitle();
360     DeadTimeGraph->GetYaxis()->SetTitle("DeadTime(ms)");
361     DeadTimeGraph->GetYaxis()->CenterTitle();
362     DeadTimeGraph->SetMaximum(100);
363     DeadTimeGraph->Draw("APL");
364     //----------
365     sst.str("");
366     sst << "Graph of Live Time vs OBT based on " << base.Data();
367     TGraph *LiveTimeGraph = new TGraph(nevents, (const Double_t*)time, (const Double_t*)liveTime);
368     DeadLiveCanvas->cd(2);
369     sst.str("");
370     sst << "Live Time";
371     LiveTimeGraph->SetTitle(sst.str().c_str());
372     LiveTimeGraph->SetFillColor(2);
373     LiveTimeGraph->GetXaxis()->SetTitle("OnBoardTime");
374     LiveTimeGraph->GetXaxis()->CenterTitle();
375     LiveTimeGraph->GetYaxis()->SetTitle("LiveTime(ms)");
376     LiveTimeGraph->GetYaxis()->CenterTitle();
377     LiveTimeGraph->Draw("APL");
378    
379     /* PMT Plane Counters draw*/
380    
381     PMTCanvas->cd(1);
382     pmt1Histo->GetXaxis()->SetTitle("Hz");
383     pmt1Histo->Draw();
384     PMTCanvas->cd(2);
385     pmt2Histo->GetXaxis()->SetTitle("Hz");
386     pmt2Histo->Draw();
387     PMTCanvas->cd(3);
388     pmt3Histo->GetXaxis()->SetTitle("Hz");
389     pmt3Histo->Draw();
390    
391     /* Trigger Rate Counters draw*/
392     TrigRate1Canvas->cd(1);
393     trRate1Histo->GetXaxis()->SetTitle("Hz");
394     trRate1Histo->Draw();
395     TrigRate1Canvas->cd(2);
396     trRate2Histo->GetXaxis()->SetTitle("Hz");
397     trRate2Histo->Draw();
398     TrigRate1Canvas->cd(3);
399     trRate3Histo->GetXaxis()->SetTitle("Hz");
400     trRate3Histo->Draw();
401     TrigRate2Canvas->cd(1);
402     trRate4Histo->GetXaxis()->SetTitle("Hz");
403     trRate4Histo->Draw();
404     TrigRate2Canvas->cd(2);
405     trRate5Histo->GetXaxis()->SetTitle("Hz");
406     trRate5Histo->Draw();
407     TrigRate2Canvas->cd(3);
408     trRate6Histo->GetXaxis()->SetTitle("Hz");
409     trRate6Histo->Draw();
410    
411     /* S4 and Calorimeter Counters draw*/
412     S4CalCanvas->cd(1);
413     S4Cal1Histo->GetXaxis()->SetTitle("Hz");
414     S4Cal1Histo->Draw();
415     S4CalCanvas->cd(2);
416     S4Cal2Histo->GetXaxis()->SetTitle("Hz");
417     S4Cal2Histo->Draw();
418    
419     /* Pattern Trigger draw*/
420    
421     gStyle->SetOptStat(1101);
422    
423     PatternTrig5->cd();
424     PatternTrig5Histo->Draw("");
425    
426     PatternTrig4->cd();
427     PatternTrig4Histo->Draw("");
428    
429     PatternTrig3->cd();
430     PatternTrig3Histo->Draw("");
431    
432     PatternTrig2->cd();
433     PatternTrig2Histo->Draw("");
434    
435     PatternTrig0->cd();
436     PatternTrig0Histo->Draw("");
437    
438     PatternTrig1->cd();
439     PatternTrig1Histo->Draw("");
440    
441     gStyle->SetOptStat(1111);
442     gStyle->SetStatH(0.3);
443     gStyle->SetStatW(0.3);
444    
445     TCanvas *RatePMT1 = new TCanvas("RatePMT1", "Rate PMT S11A", 1);
446     RatePMT1->Divide (3,3);
447     //----------
448     RatePMT1->cd(1);
449     PhysicsTr->Draw("pmtcount1[0]");
450     t=new TLatex();
451     t->SetTextFont(32);
452     t->SetTextColor(1);
453     t->SetTextAlign(12);
454     t->SetTextSize(0.12);
455     t->DrawLatex(5.,20.,"S111A");
456     //----------
457     RatePMT1->cd (2);
458     PhysicsTr->Draw("pmtcount1[1]");
459     t=new TLatex();
460     t->SetTextFont(32);
461     t->SetTextColor(1);
462     t->SetTextAlign(12);
463     t->SetTextSize(0.12);
464     t->DrawLatex(5.,20.,"S112A");
465     //----------
466     RatePMT1->cd (3);
467     PhysicsTr->Draw("pmtcount1[2]");
468     t=new TLatex();
469     t->SetTextFont(32);
470     t->SetTextColor(1);
471     t->SetTextAlign(12);
472     t->SetTextSize(0.12);
473     t->DrawLatex(5.,20.,"S113A");
474     //----------
475     RatePMT1->cd(4);
476     PhysicsTr->Draw("pmtcount1[3]");
477     t=new TLatex();
478     t->SetTextFont(32);
479     t->SetTextColor(1);
480     t->SetTextAlign(12);
481     t->SetTextSize(0.12);
482     t->DrawLatex(5.,20.,"S114A");
483     //----------
484     RatePMT1->cd(5);
485     PhysicsTr->Draw("pmtcount1[4]");
486     t=new TLatex();
487     t->SetTextFont(32);
488     t->SetTextColor(1);
489     t->SetTextAlign(12);
490     t->SetTextSize(0.12);
491     t->DrawLatex(5.,20.,"S115A");
492     //----------
493     RatePMT1->cd(6);
494     PhysicsTr->Draw("pmtcount1[5]");
495     t=new TLatex();
496     t->SetTextFont(32);
497     t->SetTextColor(1);
498     t->SetTextAlign(12);
499     t->SetTextSize(0.12);
500     t->DrawLatex(5.,20.,"S116A");
501     //----------
502     RatePMT1->cd(7);
503     PhysicsTr->Draw("pmtcount1[6]");
504     t=new TLatex();
505     t->SetTextFont(32);
506     t->SetTextColor(1);
507     t->SetTextAlign(12);
508     t->SetTextSize(0.12);
509     t->DrawLatex(5.,20.,"S117A");
510     //----------
511     RatePMT1->cd(8);
512     PhysicsTr->Draw("pmtcount1[7]");
513     t=new TLatex();
514     t->SetTextFont(32);
515     t->SetTextColor(1);
516     t->SetTextAlign(12);
517     t->SetTextSize(0.12);
518     t->DrawLatex(5.,20.,"S118A");
519    
520     TCanvas *RatePMT2 = new TCanvas("RatePMT2", "Rate PMT S11B", 1);
521     RatePMT2->Divide (3,3);
522     //----------
523     RatePMT2->cd(1);
524     PhysicsTr-> Draw("pmtcount1[8]");
525     t=new TLatex();
526     t->SetTextFont(32);
527     t->SetTextColor(1);
528     t->SetTextAlign(12);
529     t->SetTextSize(0.12);
530     t->DrawLatex(5.,20.,"S111B");
531     //----------
532     RatePMT2->cd(2);
533     PhysicsTr->Draw("pmtcount1[9]");
534     t=new TLatex();
535     t->SetTextFont(32);
536     t->SetTextColor(1);
537     t->SetTextAlign(12);
538     t->SetTextSize(0.12);
539     t->DrawLatex(5.,20.,"S112B");
540     //----------
541     RatePMT2->cd(3);
542     PhysicsTr->Draw("pmtcount1[10]");
543     t=new TLatex();
544     t->SetTextFont(32);
545     t->SetTextColor(1);
546     t->SetTextAlign(12);
547     t->SetTextSize(0.12);
548     t->DrawLatex(5.,20.,"S113B");
549     //----------
550     RatePMT2->cd(4);
551     PhysicsTr->Draw("pmtcount1[11]");
552     t=new TLatex();
553     t->SetTextFont(32);
554     t->SetTextColor(1);
555     t->SetTextAlign(12);
556     t->SetTextSize(0.12);
557     t->DrawLatex(5.,20.,"S114B");
558     //----------
559     RatePMT2->cd(5);
560     PhysicsTr-> Draw("pmtcount1[12]");
561     t=new TLatex();
562     t->SetTextFont(32);
563     t->SetTextColor(1);
564     t->SetTextAlign(12);
565     t->SetTextSize(0.12);
566     t->DrawLatex(5.,20.,"S115B");
567     //----------
568     RatePMT2->cd(6);
569     PhysicsTr-> Draw("pmtcount1[13]");
570     t=new TLatex();
571     t->SetTextFont(32);
572     t->SetTextColor(1);
573     t->SetTextAlign(12);
574     t->SetTextSize(0.12);
575     t->DrawLatex(5.,20.,"S116B");
576     //----------
577     RatePMT2->cd(7);
578     PhysicsTr-> Draw("pmtcount1[14]");
579     t=new TLatex();
580     t->SetTextFont(32);
581     t->SetTextColor(1);
582     t->SetTextAlign(12);
583     t->SetTextSize(0.12);
584     t->DrawLatex(5.,20.,"S117B");
585     //----------
586     RatePMT2->cd(8);
587     PhysicsTr->Draw("pmtcount1[15]");
588     t=new TLatex();
589     t->SetTextFont(32);
590     t->SetTextColor(1);
591     t->SetTextAlign(12);
592     t->SetTextSize(0.12);
593     t->DrawLatex(5.,20.,"S118B");
594    
595     TCanvas *RatePMT3 = new TCanvas("RatePMT3", "Rate PMT S12", 1);
596     RatePMT3->Divide (3,4);
597     //----------
598     RatePMT3->cd(1);
599     PhysicsTr-> Draw("pmtcount1[16]");
600     t=new TLatex();
601     t->SetTextFont(32);
602     t->SetTextColor(1);
603     t->SetTextAlign(12);
604     t->SetTextSize(0.12);
605     t->DrawLatex(5.,20.,"S121A");
606     //----------
607     RatePMT3->cd(2);
608     PhysicsTr-> Draw("pmtcount1[17]");
609     t=new TLatex();
610     t->SetTextFont(32);
611     t->SetTextColor(1);
612     t->SetTextAlign(12);
613     t->SetTextSize(0.12);
614     t->DrawLatex(5.,20.,"S122A");
615     //----------
616     RatePMT3->cd (3);
617     PhysicsTr-> Draw("pmtcount1[18]");
618     t=new TLatex();
619     t->SetTextFont(32);
620     t->SetTextColor(1);
621     t->SetTextAlign(12);
622     t->SetTextSize(0.12);
623     t->DrawLatex(5.,20.,"S123A");
624     //----------
625     RatePMT3->cd(4);
626     PhysicsTr->Draw("pmtcount1[19]");
627     t=new TLatex();
628     t->SetTextFont(32);
629     t->SetTextColor(1);
630     t->SetTextAlign(12);
631     t->SetTextSize(0.12);
632     t->DrawLatex(5.,20.,"S124A");
633     //----------
634     RatePMT3->cd(5);
635     PhysicsTr-> Draw("pmtcount1[20]");
636     t=new TLatex();
637     t->SetTextFont(32);
638     t->SetTextColor(1);
639     t->SetTextAlign(12);
640     t->SetTextSize(0.12);
641     t->DrawLatex(5.,20.,"S125A");
642     //----------
643     RatePMT3->cd(6);
644     PhysicsTr-> Draw("pmtcount1[21]");
645     t=new TLatex();
646     t->SetTextFont(32);
647     t->SetTextColor(1);
648     t->SetTextAlign(12);
649     t->SetTextSize(0.12);
650     t->DrawLatex(5.,20.,"S126A");
651     //----------
652     RatePMT3->cd(7);
653     PhysicsTr->Draw("pmtcount1[22]");
654     t=new TLatex();
655     t->SetTextFont(32);
656     t->SetTextColor(1);
657     t->SetTextAlign(12);
658     t->SetTextSize(0.12);
659     t->DrawLatex(5.,20.,"S121B");
660     //----------
661     RatePMT3->cd(8);
662     PhysicsTr-> Draw("pmtcount1[23]");
663     t=new TLatex();
664     t->SetTextFont(32);
665     t->SetTextColor(1);
666     t->SetTextAlign(12);
667     t->SetTextSize(0.12);
668     t->DrawLatex(5.,20.,"S122B");
669     //----------
670     RatePMT3->cd (9);
671     PhysicsTr->Draw("pmtcount2[0]");
672     t=new TLatex();
673     t->SetTextFont(32);
674     t->SetTextColor(1);
675     t->SetTextAlign(12);
676     t->SetTextSize(0.12);
677     t->DrawLatex(5.,20.,"S123B");
678     //----------
679     RatePMT3->cd (10);
680     PhysicsTr->Draw("pmtcount2[1]");
681     t=new TLatex();
682     t->SetTextFont(32);
683     t->SetTextColor(1);
684     t->SetTextAlign(12);
685     t->SetTextSize(0.12);
686     t->DrawLatex(5.,20.,"S124B");
687     //----------
688     RatePMT3->cd (11);
689     PhysicsTr->Draw("pmtcount2[2]");
690     t=new TLatex();
691     t->SetTextFont(32);
692     t->SetTextColor(1);
693     t->SetTextAlign(12);
694     t->SetTextSize(0.12);
695     t->DrawLatex(5.,20.,"S125B");
696     //----------
697     RatePMT3->cd (12);
698     PhysicsTr->Draw("pmtcount2[3]");
699     t=new TLatex();
700     t->SetTextFont(32);
701     t->SetTextColor(1);
702     t->SetTextAlign(12);
703     t->SetTextSize(0.12);
704     t->DrawLatex(5.,20.,"S126B");
705    
706     TCanvas *RatePMT4 = new TCanvas("RatePMT4", "Rate PMT S2", 1);
707     RatePMT4->Divide (3,3);
708     //----------
709     RatePMT4->cd (1);
710     PhysicsTr-> Draw("pmtcount2[4]");
711     t=new TLatex();
712     t->SetTextFont(32);
713     t->SetTextColor(1);
714     t->SetTextAlign(12);
715     t->SetTextSize(0.12);
716     t->DrawLatex(5.,20.,"S211A");
717     //----------
718     RatePMT4->cd (2);
719     PhysicsTr-> Draw("pmtcount2[5]");
720     t=new TLatex();
721     t->SetTextFont(32);
722     t->SetTextColor(1);
723     t->SetTextAlign(12);
724     t->SetTextSize(0.12);
725     t->DrawLatex(5.,20.,"S212A");
726     //----------
727     RatePMT4->cd (3);
728     PhysicsTr-> Draw("pmtcount2[6]");
729     t=new TLatex();
730     t->SetTextFont(32);
731     t->SetTextColor(1);
732     t->SetTextAlign(12);
733     t->SetTextSize(0.12);
734     t->DrawLatex(5.,20.,"S211B");
735     //----------
736     RatePMT4->cd (4);
737     PhysicsTr-> Draw("pmtcount2[7]");
738     t=new TLatex();
739     t->SetTextFont(32);
740     t->SetTextColor(1);
741     t->SetTextAlign(12);
742     t->SetTextSize(0.12);
743     t->DrawLatex(5.,20.,"S212B");
744     //----------
745     RatePMT4->cd (5);
746     PhysicsTr-> Draw("pmtcount2[8]");
747     t=new TLatex();
748     t->SetTextFont(32);
749     t->SetTextColor(1);
750     t->SetTextAlign(12);
751     t->SetTextSize(0.12);
752     t->DrawLatex(5.,20.,"S221A");
753     //----------
754     RatePMT4->cd (6);
755     PhysicsTr-> Draw("pmtcount2[9]");
756     t=new TLatex();
757     t->SetTextFont(32);
758     t->SetTextColor(1);
759     t->SetTextAlign(12);
760     t->SetTextSize(0.12);
761     t->DrawLatex(5.,20.,"S222A");
762     //----------
763     RatePMT4->cd (7);
764     PhysicsTr-> Draw("pmtcount2[10]");
765     t=new TLatex();
766     t->SetTextFont(32);
767     t->SetTextColor(1);
768     t->SetTextAlign(12);
769     t->SetTextSize(0.12);
770     t->DrawLatex(5.,20.,"S221B");
771     //----------
772     RatePMT4->cd (8);
773     PhysicsTr->Draw("pmtcount2[11]");
774     t=new TLatex();
775     t->SetTextFont(32);
776     t->SetTextColor(1);
777     t->SetTextAlign(12);
778     t->SetTextSize(0.12);
779     t->DrawLatex(5.,20.,"S222B");
780    
781     TCanvas *RatePMT5 = new TCanvas("RatePMT5", "Rate PMT S3", 1);
782     RatePMT5->Divide (3,4);
783     //----------
784     RatePMT5->cd (1);
785     PhysicsTr-> Draw("pmtcount2[12]");
786     t=new TLatex();
787     t->SetTextFont(32);
788     t->SetTextColor(1);
789     t->SetTextAlign(12);
790     t->SetTextSize(0.12);
791     t->DrawLatex(5.,20.,"S311A");
792     //----------
793     RatePMT5->cd (2);
794     PhysicsTr-> Draw("pmtcount2[13]");
795     t=new TLatex();
796     t->SetTextFont(32);
797     t->SetTextColor(1);
798     t->SetTextAlign(12);
799     t->SetTextSize(0.12);
800     t->DrawLatex(5.,20.,"S312A");
801     //----------
802     RatePMT5->cd (3);
803     PhysicsTr-> Draw("pmtcount2[14]");
804     t=new TLatex();
805     t->SetTextFont(32);
806     t->SetTextColor(1);
807     t->SetTextAlign(12);
808     t->SetTextSize(0.12);
809     t->DrawLatex(5.,20.,"S313A");
810     //----------
811     RatePMT5->cd (4);
812     PhysicsTr-> Draw("pmtcount2[15]");
813     t=new TLatex();
814     t->SetTextFont(32);
815     t->SetTextColor(1);
816     t->SetTextAlign(12);
817     t->SetTextSize(0.12);
818     t->DrawLatex(5.,20.,"S311B");
819     //----------
820     RatePMT5->cd (5);
821     PhysicsTr-> Draw("pmtcount2[16]");
822     t=new TLatex();
823     t->SetTextFont(32);
824     t->SetTextColor(1);
825     t->SetTextAlign(12);
826     t->SetTextSize(0.12);
827     t->DrawLatex(5.,20.,"S312B");
828     //----------
829     RatePMT5->cd (6);
830     PhysicsTr-> Draw("pmtcount2[17]");
831     t=new TLatex();
832     t->SetTextFont(32);
833     t->SetTextColor(1);
834     t->SetTextAlign(12);
835     t->SetTextSize(0.12);
836     t->DrawLatex(5.,20.,"S313B");
837     //----------
838     RatePMT5->cd (7);
839     PhysicsTr-> Draw("pmtcount2[18]");
840     t=new TLatex();
841     t->SetTextFont(32);
842     t->SetTextColor(1);
843     t->SetTextAlign(12);
844     t->SetTextSize(0.12);
845     t->DrawLatex(5.,20.,"S321A");
846     //----------
847     RatePMT5->cd (8);
848     PhysicsTr-> Draw("pmtcount2[19]");
849     t=new TLatex();
850     t->SetTextFont(32);
851     t->SetTextColor(1);
852     t->SetTextAlign(12);
853     t->SetTextSize(0.12);
854     t->DrawLatex(5.,20.,"S322A");
855     //----------
856     RatePMT5->cd (9);
857     PhysicsTr-> Draw("pmtcount2[20]");
858     t=new TLatex();
859     t->SetTextFont(32);
860     t->SetTextColor(1);
861     t->SetTextAlign(12);
862     t->SetTextSize(0.12);
863     t->DrawLatex(5.,20.,"S323A");
864     //----------
865     RatePMT5->cd (10);
866     PhysicsTr-> Draw("pmtcount2[21]");
867     t=new TLatex();
868     t->SetTextFont(32);
869     t->SetTextColor(1);
870     t->SetTextAlign(12);
871     t->SetTextSize(0.12);
872     t->DrawLatex(5.,20.,"S321B");
873     //----------
874     RatePMT5->cd (11);
875     PhysicsTr-> Draw("pmtcount2[22]");
876     t=new TLatex();
877     t->SetTextFont(32);
878     t->SetTextColor(1);
879     t->SetTextAlign(12);
880     t->SetTextSize(0.12);
881     t->DrawLatex(5.,20.,"S322B");
882     //----------
883     RatePMT5->cd (12);
884     PhysicsTr-> Draw("pmtcount2[23]");
885     t=new TLatex();
886     t->SetTextFont(32);
887     t->SetTextColor(1);
888     t->SetTextAlign(12);
889     t->SetTextSize(0.12);
890     t->DrawLatex(5.,20.,"S323B");
891    
892     // print the output
893     const char *saveas = format;
894     if ( !strcmp(saveas,"ps") ) {
895     // ------print the ps
896    
897     gStyle->SetOptStat(111111);
898    
899     sst.str("");
900     sst << outDirectory.Data() << filename.Data() << "TriggerScan." << saveas << "(";
901     EvCounterCanvas->Print(sst.str().c_str());
902     DeadLiveCanvas->Print(sst.str().c_str());
903     PMTCanvas->Print(sst.str().c_str());
904     TrigRate1Canvas->Print(sst.str().c_str());
905     TrigRate2Canvas->Print(sst.str().c_str());
906     S4CalCanvas->Print(sst.str().c_str());
907    
908     gStyle->SetOptStat(1101);
909    
910     PatternTrig5->Print(sst.str().c_str());
911     PatternTrig4->Print(sst.str().c_str());
912     PatternTrig3->Print(sst.str().c_str());
913     PatternTrig2->Print(sst.str().c_str());
914     PatternTrig0->Print(sst.str().c_str());
915     PatternTrig1->Print(sst.str().c_str());
916     RatePMT1->Print(sst.str().c_str());
917     RatePMT2->Print(sst.str().c_str());
918     RatePMT3->Print(sst.str().c_str());
919     RatePMT4->Print(sst.str().c_str());
920     sst.str("");
921     sst << outDirectory.Data() << filename.Data() << "TriggerScan." << saveas << ")";
922     RatePMT5->Print(sst.str().c_str());
923    
924     } else {
925    
926     gStyle->SetOptStat(111111);
927    
928     sst.str("");
929     sst << outDirectory.Data() << filename.Data() << "TriggerScan1." << saveas;
930     EvCounterCanvas->SaveAs(sst.str().c_str());
931    
932     sst.str("");
933     sst << outDirectory.Data() << filename.Data() << "TriggerScan2." << saveas;
934     DeadLiveCanvas->SaveAs(sst.str().c_str());
935    
936     sst.str("");
937     sst << outDirectory.Data() << filename.Data() << "TriggerScan3." << saveas;
938     PMTCanvas->SaveAs(sst.str().c_str());
939    
940     sst.str("");
941     sst << outDirectory.Data() << filename.Data() << "TriggerScan4." << saveas;
942     TrigRate1Canvas->SaveAs(sst.str().c_str());
943    
944     sst.str("");
945     sst << outDirectory.Data() << filename.Data() << "TriggerScan5." << saveas;
946     TrigRate2Canvas->SaveAs(sst.str().c_str());
947    
948     sst.str("");
949     sst << outDirectory.Data() << filename.Data() << "TriggerScan6." << saveas;
950     S4CalCanvas->SaveAs(sst.str().c_str());
951    
952     gStyle->SetOptStat(1101);
953    
954     sst.str("");
955     sst << outDirectory.Data() << filename.Data() << "TriggerScan7." << saveas;
956     PatternTrig5->SaveAs(sst.str().c_str());
957    
958     sst.str("");
959     sst << outDirectory.Data() << filename.Data() << "TriggerScan8." << saveas;
960     PatternTrig4->SaveAs(sst.str().c_str());
961    
962     sst.str("");
963     sst << outDirectory.Data() << filename.Data() << "TriggerScan9." << saveas;
964     PatternTrig3->SaveAs(sst.str().c_str());
965    
966     sst.str("");
967     sst << outDirectory.Data() << filename.Data() << "TriggerScan10." << saveas;
968     PatternTrig2->SaveAs(sst.str().c_str());
969    
970     sst.str("");
971     sst << outDirectory.Data() << filename.Data() << "TriggerScan11." << saveas;
972     PatternTrig0->SaveAs(sst.str().c_str());
973    
974     sst.str("");
975     sst << outDirectory.Data() << filename.Data() << "TriggerScan12." << saveas;
976     PatternTrig1->SaveAs(sst.str().c_str());
977    
978     sst.str("");
979     sst << outDirectory.Data() << filename.Data() << "TriggerScan13." << saveas;
980     RatePMT1->SaveAs(sst.str().c_str());
981    
982     sst.str("");
983     sst << outDirectory.Data() << filename.Data() << "TriggerScan14." << saveas;
984     RatePMT2->SaveAs(sst.str().c_str());
985    
986     sst.str("");
987     sst << outDirectory.Data() << filename.Data() << "TriggerScan15." << saveas;
988     RatePMT3->SaveAs(sst.str().c_str());
989    
990     sst.str("");
991     sst << outDirectory.Data() << filename.Data() << "TriggerScan16." << saveas;
992     RatePMT4->SaveAs(sst.str().c_str());
993    
994     sst.str("");
995     sst << outDirectory.Data() << filename.Data() << "TriggerScan17." << saveas;
996     RatePMT5->SaveAs(sst.str().c_str());
997    
998     }
999    
1000     }
1001    
1002    
1003     int main(int argc, char* argv[]){
1004     TString path;
1005     TString outDir ="./";
1006     TString format ="ps";
1007    
1008     if (argc < 2){
1009     printf("You have to insert at least the file to analyze \n");
1010     printf("Try '--help' for more information. \n");
1011     exit(1);
1012     }
1013    
1014     if (!strcmp(argv[1], "--help")){
1015     printf( "Usage: TriggerScan FILE [OPTION] \n");
1016     printf( "\t --help Print this help and exit \n");
1017     printf( "\t -outDir[path] Path where to put the output [default ./] \n");
1018     printf( "\t -format[ps] Format for output files [default 'ps'] \n");
1019     exit(1);
1020     }
1021    
1022    
1023     path=argv[1];
1024    
1025     for (int i = 2; i < argc; i++){
1026    
1027     if (!strcmp(argv[i], "-outDir")){
1028     if (++i >= argc){
1029     printf( "-outDir needs arguments. \n");
1030     printf( "Try '--help' for more information. \n");
1031     exit(1);
1032     }
1033     else{
1034     outDir = argv[i];
1035     continue;
1036     }
1037     }
1038    
1039    
1040    
1041     if (!strcmp(argv[i], "-format")){
1042     if (++i >= argc){
1043     printf( "-format needs arguments. \n");
1044     printf( "Try '--help' for more information. \n");
1045     exit(1);
1046     }
1047     else{
1048     format = argv[i];
1049     continue;
1050     }
1051     }
1052     }
1053    
1054     TriggerScan(argv[1], outDir, format);
1055    
1056     }

  ViewVC Help
Powered by ViewVC 1.1.23