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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed Jun 28 16:43:38 2006 UTC (18 years, 5 months ago) by campana
Branch: MAIN
CVS Tags: v1r05
new release of Trigger QLook

1 campana 1.1 /*
2     * TriggerScanBasic
3     * Author Nagni
4     * Modified by G. De Rosa
5     * Version 1.2
6     * Date 27 Apr 2006
7     * Version 1.4
8     * Date 26 Jun 2006: Inserted dependences on OrbitalTime and modified histogram ranges.
9     *
10     * Description:
11     * Describe the performance of the Trigger.
12     *
13     * Parameters:
14     * TString base - the path to the root directory for the specific Pamela unpack session
15     * TString outDirectory - the path where to save the output image (Default = base)
16     * TString format - the format which will be used for save the produced images (Default = "ps")
17     */
18    
19     #include <TString.h>
20     #include <TObjString.h>
21     #include <TTree.h>
22     #include <TBranch.h>
23     #include <TGraph.h>
24     #include <TStyle.h>
25     #include <TH2S.h>
26     #include <TPaveText.h>
27     #include <TCanvas.h>
28     #include <TLatex.h>
29     #include <TGraph.h>
30     #include <physics/trigger/TriggerEvent.h>
31     #include <EventHeader.h>
32     #include <PscuHeader.h>
33     #include <iostream>
34    
35     using namespace std;
36    
37     char bit(int decimal, char pos)
38     {
39     return( (decimal>>pos)%2 );
40     }
41    
42     void TriggerScanBasic(TString base, TString outDirectory = "", TString format = ""){
43    
44     std::stringstream sst;
45     if (outDirectory == "") outDirectory = base.Data();
46     TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
47    
48     TFile *file =new TFile(base.Data()) ;
49     if (!file){
50     printf("file not Found \n");
51     return;
52     }
53    
54     TTree *PhysicsTr = (TTree*)file->Get("Physics");
55     TBranch *TrigBr = PhysicsTr->GetBranch("Trigger");
56     TBranch *HeadBr = PhysicsTr->GetBranch("Header");
57    
58     pamela::EventHeader *eh = 0;
59     pamela::PscuHeader *ph = 0;
60    
61     pamela::trigger::TriggerEvent *triggerEvent = 0;
62    
63     PhysicsTr->SetBranchAddress("Trigger", &triggerEvent);
64     PhysicsTr->SetBranchAddress("Header", &eh);
65    
66     Long64_t nevents = TrigBr->GetEntries();
67     if (nevents <= 0) {
68     printf("nevents = %llu \n", nevents);
69     file->Close();
70     return;
71     }
72    
73     /* Histo DEF */
74    
75     /*
76     * S4 and Calorimeter Counters histograms
77     */
78     TCanvas *S4CalCanvas = new TCanvas("S4CalCanvas","S4CalCanvas", 1280, 1024);
79     S4CalCanvas->Divide(1,2);
80     //----------
81     sst.str("");
82     sst << "S4 Counters based on " << base.Data();
83     //----------
84     sst.str("");
85     sst << "Calorimeter Counters based on " << base.Data();
86     TH1S *S4Cal2Histo = new TH1S("S4Cal2Histo", sst.str().c_str(), 20, 0, 20);
87    
88     int i = 0;
89     Int_t size = nevents;
90    
91     Double_t *time = new Double_t[size];
92     Double_t *evCounter = new Double_t[size];
93     Double_t *deadTime = new Double_t[size];
94     Double_t *liveTime = new Double_t[size];
95     //
96     Double_t *trigrate0 = new Double_t[size];
97     Double_t *trigrate1 = new Double_t[size];
98     Double_t *trigrate2 = new Double_t[size];
99     Double_t *trigrate3 = new Double_t[size];
100     Double_t *trigrate4 = new Double_t[size];
101     Double_t *trigrate5 = new Double_t[size];
102     //
103     Double_t *pmt1 = new Double_t[size];
104     Double_t *pmt2 = new Double_t[size];
105     Double_t *pmt3 = new Double_t[size];
106     //
107     Double_t *s4rate = new Double_t[size];
108     //
109     while(i < nevents){
110     HeadBr->GetEntry(i);
111     TrigBr->GetEntry(i);
112    
113     /* time vector fill*/
114     ph = eh->GetPscuHeader();
115     time[i] = ph->GetOrbitalTime();
116    
117     /* eventCounter vector fill*/
118     evCounter[i] = triggerEvent->evcount;
119    
120     if( evCounter[i] > 1 ){
121    
122     /* live time vector fill*/
123     liveTime[i] = 0.16 * triggerEvent->dltime[0];
124    
125     /* dead time vector fill*/
126     deadTime[i] = 0.01 * triggerEvent->dltime[1];
127    
128     }
129    
130     gStyle->SetStatY(0.85);
131    
132    
133     /* PMT Plane Counters */
134    
135     pmt1[i] = 1.*triggerEvent->pmtpl[0];
136     pmt2[i] = 1.*triggerEvent->pmtpl[1];
137     pmt3[i] = 1.*triggerEvent->pmtpl[2];
138    
139     /* Trigger Rate Counters*/
140    
141     trigrate0[i] = (1/4.)*triggerEvent->trigrate[0];
142     trigrate1[i] = (1/4.)*triggerEvent->trigrate[1];
143     trigrate2[i] = (1/4.)*triggerEvent->trigrate[2];
144     trigrate3[i] = (1/4.)*triggerEvent->trigrate[3];
145     trigrate4[i] = (1/4.)*triggerEvent->trigrate[4];
146     trigrate5[i] = (1/4.)*triggerEvent->trigrate[5];
147    
148     /* S4 and Calorimeter Counters fill*/
149    
150     s4rate[i] = triggerEvent->s4calcount[0];
151     S4Cal2Histo->Fill(triggerEvent->s4calcount[1]);
152    
153     i++;
154     }
155    
156     gStyle->SetOptStat(111111);
157     gStyle->SetStatH(0.15);
158     gStyle->SetStatW(0.15);
159    
160     /*
161     * Event Counter graph
162     */
163     TCanvas *EvCounterCanvas = new TCanvas("EvCounterCanvas","EvCounterCanvas", 1280, 1024);
164     //----------
165     sst.str("");
166     sst << "Event Counter";
167     TGraph *evCounterGraph = new TGraph(nevents, time, evCounter);
168     evCounterGraph->SetTitle(sst.str().c_str());
169     evCounterGraph->GetXaxis()->SetTitle("OrbitalTime");
170     evCounterGraph->GetXaxis()->CenterTitle();
171     evCounterGraph->Draw("APL");
172    
173     /*
174     * Dead and Live time graphs
175     */
176     TCanvas *DeadLiveCanvas = new TCanvas("DeadLiveCanvas","DeadLiveCanvas", 1280, 1024);
177     DeadLiveCanvas->Divide(1,2);
178     //----------
179     sst.str("");
180     sst << "Graph of Dead Time vs OBT based on " << base.Data();
181     TGraph *DeadTimeGraph = new TGraph(nevents, time, deadTime);
182     DeadLiveCanvas->cd(1);
183     sst.str("");
184     sst << "Dead Time";
185     DeadTimeGraph->SetTitle(sst.str().c_str());
186     DeadTimeGraph->SetFillColor(2);
187     DeadTimeGraph->GetXaxis()->SetTitle("OrbitalTime");
188     DeadTimeGraph->GetXaxis()->CenterTitle();
189     DeadTimeGraph->GetYaxis()->SetTitle("DeadTime(ms)");
190     DeadTimeGraph->GetYaxis()->CenterTitle();
191     DeadTimeGraph->SetMaximum(100);
192     DeadTimeGraph->Draw("AP");
193     //----------
194     sst.str("");
195     sst << "Graph of Live Time vs OBT based on " << base.Data();
196     TGraph *LiveTimeGraph = new TGraph(nevents, (const Double_t*)time, (const Double_t*)liveTime);
197     DeadLiveCanvas->cd(2);
198     sst.str("");
199     sst << "Live Time";
200     LiveTimeGraph->SetTitle(sst.str().c_str());
201     LiveTimeGraph->SetFillColor(2);
202     LiveTimeGraph->GetXaxis()->SetTitle("OrbitalTime");
203     LiveTimeGraph->GetXaxis()->CenterTitle();
204     LiveTimeGraph->GetYaxis()->SetTitle("LiveTime(ms)");
205     LiveTimeGraph->GetYaxis()->CenterTitle();
206     LiveTimeGraph->Draw("AP");
207    
208     /*
209     * PMT Plane Counters Graph
210     */
211    
212     TCanvas *PMTCanvas = new TCanvas("PMTCanvas","PMTCanvas", 1280, 1024);
213     PMTCanvas->Divide(1,3);
214     //----------
215     sst.str("");
216     sst << "Graph of PMT Plane Counters (S11 AND S12) vs OBT based on " << base.Data();
217     TGraph *PMT1Graph = new TGraph(nevents, time, pmt1);
218     PMTCanvas->cd(1);
219     sst.str("");
220     sst << "PMT Plane Counters (S11 AND S12)";
221     PMT1Graph->SetTitle(sst.str().c_str());
222     PMT1Graph->SetFillColor(2);
223     PMT1Graph->GetXaxis()->SetTitle("OrbitalTime");
224     PMT1Graph->GetXaxis()->CenterTitle();
225     PMT1Graph->GetYaxis()->SetTitle("PMT Plane Counters");
226     PMT1Graph->GetYaxis()->CenterTitle();
227     PMT1Graph->Draw("AP");
228     //----------
229     sst.str("");
230     sst << "Graph PMT Plane Counters (S21 AND S22) vs OBT based on " << base.Data();
231     TGraph *PMT2Graph = new TGraph(nevents, time, pmt2);
232     PMTCanvas->cd(2);
233     sst.str("");
234     sst << "PMT Plane Counters (S21 AND S22)";
235     PMT2Graph->SetTitle(sst.str().c_str());
236     PMT2Graph->SetFillColor(2);
237     PMT2Graph->GetXaxis()->SetTitle("OrbitalTime");
238     PMT2Graph->GetXaxis()->CenterTitle();
239     PMT2Graph->GetYaxis()->SetTitle("PMT Plane Counters");
240     PMT2Graph->GetYaxis()->CenterTitle();
241     PMT2Graph->Draw("AP");
242     //----------
243     sst.str("");
244     sst << "Graph PMT Plane Counters (S31 AND S32) vs OBT based on " << base.Data();
245     TGraph *PMT3Graph = new TGraph(nevents, time, pmt3);
246     PMTCanvas->cd(3);
247     sst.str("");
248     sst << "PMT Plane Counters (S31 AND S32)";
249     PMT3Graph->SetTitle(sst.str().c_str());
250     PMT3Graph->SetFillColor(2);
251     PMT3Graph->GetXaxis()->SetTitle("OrbitalTime");
252     PMT3Graph->GetXaxis()->CenterTitle();
253     PMT3Graph->GetYaxis()->SetTitle("PMT Plane Rate Counters");
254     PMT3Graph->GetYaxis()->CenterTitle();
255     PMT3Graph->Draw("AP");
256     //
257     //----------
258    
259     /*
260     * Trigger Rate Counters draw
261     */
262    
263     TCanvas *TrigRate1Canvas = new TCanvas("TrigRate1Canvas","TrigRate1Canvas", 1280, 1024);
264     TrigRate1Canvas->Divide(1,3);
265     //----------
266     sst.str("");
267     sst << "Graph of Trigger Rate Counters (S11 OR S12) AND (S21 OR S22) AND (S31 OR S32) vs OBT based on " << base.Data();
268    
269     TGraph *TrigRate0Graph = new TGraph(nevents, time, trigrate0);
270     TrigRate1Canvas->cd(1);
271     sst.str("");
272     sst << "Trigger Rate Counters (S11 OR S12) AND (S21 OR S22) AND (S31 OR S32)";
273     TrigRate0Graph->SetTitle(sst.str().c_str());
274     TrigRate0Graph->SetFillColor(2);
275     TrigRate0Graph->GetXaxis()->SetTitle("OrbitalTime");
276     TrigRate0Graph->GetXaxis()->CenterTitle();
277     TrigRate0Graph->GetYaxis()->SetTitle("Trigger Rate Counters");
278     TrigRate0Graph->GetYaxis()->CenterTitle();
279     TrigRate0Graph->Draw("AP");
280     //----------
281     sst.str("");
282     sst << "Graph Trigger Rate Counters (S11 AND S12) AND (S21 AND S22) AND (S31 AND S32) vs OBT based on " << base.Data();
283     TGraph *TrigRate1Graph = new TGraph(nevents, time, trigrate1);
284     TrigRate1Canvas->cd(2);
285     sst.str("");
286     sst << "Trigger Rate Counters (S11 AND S12) AND (S21 AND S22) AND (S31 AND S32)";
287     TrigRate1Graph->SetTitle(sst.str().c_str());
288     TrigRate1Graph->SetFillColor(2);
289     TrigRate1Graph->GetXaxis()->SetTitle("OrbitalTime");
290     TrigRate1Graph->GetXaxis()->CenterTitle();
291     TrigRate1Graph->GetYaxis()->SetTitle("Trigger Rate Counters");
292     TrigRate1Graph->GetYaxis()->CenterTitle();
293     TrigRate1Graph->Draw("AP");
294     //----------
295     sst.str("");
296     sst << "Graph Trigger Rate Counters (S21 OR S22) AND (S31 OR S32) vs OBT based on " << base.Data();
297     TGraph *TrigRate2Graph = new TGraph(nevents, time, trigrate2);
298     TrigRate1Canvas->cd(3);
299     sst.str("");
300     sst << "Trigger Rate Counters (S21 OR S22) AND (S31 OR S32) ";
301     TrigRate2Graph->SetTitle(sst.str().c_str());
302     TrigRate2Graph->SetFillColor(2);
303     TrigRate2Graph->GetXaxis()->SetTitle("OrbitalTime");
304     TrigRate2Graph->GetXaxis()->CenterTitle();
305     TrigRate2Graph->GetYaxis()->SetTitle("Trigger Rate Counters");
306     TrigRate2Graph->GetYaxis()->CenterTitle();
307     TrigRate2Graph->Draw("AP");
308     //
309     //----------
310     //
311     TCanvas *TrigRate2Canvas = new TCanvas("TrigRate2Canvas","TrigRate2Canvas", 1280, 1024);
312     TrigRate2Canvas->Divide(1,3);
313     //----------
314     sst.str("");
315     sst << "Graph of Trigger Rate Counters (S21 AND S22) AND (S31 AND S32) vs OBT based on " << base.Data();
316    
317     TGraph *TrigRate3Graph = new TGraph(nevents, time, trigrate3);
318     TrigRate2Canvas->cd(1);
319     sst.str("");
320     sst << "Trigger Rate Counters (S21 AND S22) AND (S31 AND S32)";
321     TrigRate3Graph->SetTitle(sst.str().c_str());
322     TrigRate3Graph->SetFillColor(2);
323     TrigRate3Graph->GetXaxis()->SetTitle("OrbitalTime");
324     TrigRate3Graph->GetXaxis()->CenterTitle();
325     TrigRate3Graph->GetYaxis()->SetTitle("Trigger Rate Counters");
326     TrigRate3Graph->GetYaxis()->CenterTitle();
327     TrigRate3Graph->Draw("AP");
328     //----------
329     sst.str("");
330     sst << "Graph Trigger Rate Counters S12 AND (S21 AND S22) vs OBT based on " << base.Data();
331     TGraph *TrigRate4Graph = new TGraph(nevents, time, trigrate4);
332     TrigRate2Canvas->cd(2);
333     sst.str("");
334     sst << "Trigger Rate Counters S12 AND (S21 AND S22)";
335     TrigRate4Graph->SetTitle(sst.str().c_str());
336     TrigRate4Graph->SetFillColor(2);
337     TrigRate4Graph->GetXaxis()->SetTitle("OrbitalTime");
338     TrigRate4Graph->GetXaxis()->CenterTitle();
339     TrigRate4Graph->GetYaxis()->SetTitle("Trigger Rate Counters");
340     TrigRate4Graph->GetYaxis()->CenterTitle();
341     TrigRate4Graph->Draw("AP");
342     //----------
343     sst.str("");
344     sst << "Graph Trigger Rate Counters (S11 OR S12) AND (S31 OR S32) vs OBT based on " << base.Data();
345     TGraph *TrigRate5Graph = new TGraph(nevents, time, trigrate5);
346     TrigRate2Canvas->cd(3);
347     sst.str("");
348     sst << "Trigger Rate Counters (S11 OR S12) AND (S31 OR S32)";
349     TrigRate5Graph->SetTitle(sst.str().c_str());
350     TrigRate5Graph->SetFillColor(2);
351     TrigRate5Graph->GetXaxis()->SetTitle("OrbitalTime");
352     TrigRate5Graph->GetXaxis()->CenterTitle();
353     TrigRate5Graph->GetYaxis()->SetTitle("Trigger Rate Counters");
354     TrigRate5Graph->GetYaxis()->CenterTitle();
355     TrigRate5Graph->Draw("AP");
356     //----------
357    
358     gStyle->SetOptStat("mr");
359    
360     /* S4 and Calorimeter Counters draw*/
361     TGraph *s4RateGraph = new TGraph(nevents, time, s4rate);
362     S4CalCanvas->cd(1);
363     sst.str("");
364     sst << "S4 Trigger Rate Counters";
365     s4RateGraph->SetTitle(sst.str().c_str());
366     s4RateGraph->SetFillColor(2);
367     s4RateGraph->GetXaxis()->SetTitle("OrbitalTime");
368     s4RateGraph->GetXaxis()->CenterTitle();
369     s4RateGraph->GetYaxis()->SetTitle("Trigger Rate Counters");
370     s4RateGraph->GetYaxis()->CenterTitle();
371     s4RateGraph->Draw("AP");
372     //----------
373     S4CalCanvas->cd(2);
374     S4Cal2Histo->GetXaxis()->SetTitle("Hz");
375     S4Cal2Histo->Draw();
376     //
377     //
378     //
379     gStyle->SetOptStat("mr");
380     gStyle->SetStatH(0.3);
381     gStyle->SetStatW(0.3);
382    
383     TH1 *htemp;
384    
385     TCanvas *RatePMT1 = new TCanvas("RatePMT1", "Rate PMT S11A", 1);
386     RatePMT1->Divide (3,3);
387     //----------
388     RatePMT1->cd(1);
389     PhysicsTr->Draw("pmtcount1[0]");
390     htemp = (TH1*)gPad->GetPrimitive("htemp");
391     htemp->SetTitle("S111A");
392     //----------
393     RatePMT1->cd (2);
394     PhysicsTr->Draw("pmtcount1[1]");
395     htemp = (TH1*)gPad->GetPrimitive("htemp");
396     htemp->SetTitle("S112A");
397     //----------
398     RatePMT1->cd (3);
399     PhysicsTr->Draw("pmtcount1[2]");
400     htemp = (TH1*)gPad->GetPrimitive("htemp");
401     htemp->SetTitle("S113A");
402     //----------
403     RatePMT1->cd(4);
404     PhysicsTr->Draw("pmtcount1[3]");
405     htemp = (TH1*)gPad->GetPrimitive("htemp");
406     htemp->SetTitle("S114A");
407     //----------
408     RatePMT1->cd(5);
409     PhysicsTr->Draw("pmtcount1[4]");
410     htemp = (TH1*)gPad->GetPrimitive("htemp");
411     htemp->SetTitle("S115A");
412     //----------
413     RatePMT1->cd(6);
414     PhysicsTr->Draw("pmtcount1[5]");
415     htemp = (TH1*)gPad->GetPrimitive("htemp");
416     htemp->SetTitle("S116A");
417     //----------
418     RatePMT1->cd(7);
419     PhysicsTr->Draw("pmtcount1[6]");
420     htemp = (TH1*)gPad->GetPrimitive("htemp");
421     htemp->SetTitle("S117A");
422     //----------
423     RatePMT1->cd(8);
424     PhysicsTr->Draw("pmtcount1[7]");
425     htemp = (TH1*)gPad->GetPrimitive("htemp");
426     htemp->SetTitle("S118A");
427    
428     TCanvas *RatePMT2 = new TCanvas("RatePMT2", "Rate PMT S11B", 1);
429     RatePMT2->Divide (3,3);
430     //----------
431     RatePMT2->cd(1);
432     PhysicsTr-> Draw("pmtcount1[8]");
433     htemp = (TH1*)gPad->GetPrimitive("htemp");
434     htemp->SetTitle("S111B");
435     //----------
436     RatePMT2->cd(2);
437     PhysicsTr->Draw("pmtcount1[9]");
438     htemp = (TH1*)gPad->GetPrimitive("htemp");
439     htemp->SetTitle("S112B");
440     //----------
441     RatePMT2->cd(3);
442     PhysicsTr->Draw("pmtcount1[10]");
443     htemp = (TH1*)gPad->GetPrimitive("htemp");
444     htemp->SetTitle("S113B");
445     //----------
446     RatePMT2->cd(4);
447     PhysicsTr->Draw("pmtcount1[11]");
448     htemp = (TH1*)gPad->GetPrimitive("htemp");
449     htemp->SetTitle("S114B");
450     //----------
451     RatePMT2->cd(5);
452     PhysicsTr-> Draw("pmtcount1[12]");
453     htemp = (TH1*)gPad->GetPrimitive("htemp");
454     htemp->SetTitle("S115B");
455     //----------
456     RatePMT2->cd(6);
457     PhysicsTr-> Draw("pmtcount1[13]");
458     htemp = (TH1*)gPad->GetPrimitive("htemp");
459     htemp->SetTitle("S116B");
460     //----------
461     RatePMT2->cd(7);
462     PhysicsTr-> Draw("pmtcount1[14]");
463     htemp = (TH1*)gPad->GetPrimitive("htemp");
464     htemp->SetTitle("S117B");
465     //----------
466     RatePMT2->cd(8);
467     PhysicsTr->Draw("pmtcount1[15]");
468     htemp = (TH1*)gPad->GetPrimitive("htemp");
469     htemp->SetTitle("S118B");
470    
471     TCanvas *RatePMT3 = new TCanvas("RatePMT3", "Rate PMT S12", 1);
472     RatePMT3->Divide (3,4);
473     //----------
474     RatePMT3->cd(1);
475     PhysicsTr-> Draw("pmtcount1[16]");
476     htemp = (TH1*)gPad->GetPrimitive("htemp");
477     htemp->SetTitle("S121A");
478     //----------
479     RatePMT3->cd(2);
480     PhysicsTr-> Draw("pmtcount1[17]");
481     htemp = (TH1*)gPad->GetPrimitive("htemp");
482     htemp->SetTitle("S122A");
483     //----------
484     RatePMT3->cd (3);
485     PhysicsTr-> Draw("pmtcount1[18]");
486     htemp = (TH1*)gPad->GetPrimitive("htemp");
487     htemp->SetTitle("S123A");
488     //----------
489     RatePMT3->cd(4);
490     PhysicsTr->Draw("pmtcount1[19]");
491     htemp = (TH1*)gPad->GetPrimitive("htemp");
492     htemp->SetTitle("S124A");
493     //----------
494     RatePMT3->cd(5);
495     PhysicsTr-> Draw("pmtcount1[20]");
496     htemp = (TH1*)gPad->GetPrimitive("htemp");
497     htemp->SetTitle("S125A");
498     //----------
499     RatePMT3->cd(6);
500     PhysicsTr-> Draw("pmtcount1[21]");
501     htemp = (TH1*)gPad->GetPrimitive("htemp");
502     htemp->SetTitle("S126A");
503     //----------
504     RatePMT3->cd(7);
505     PhysicsTr->Draw("pmtcount1[22]");
506     htemp = (TH1*)gPad->GetPrimitive("htemp");
507     htemp->SetTitle("S121B");
508     //----------
509     RatePMT3->cd(8);
510     PhysicsTr-> Draw("pmtcount1[23]");
511     htemp = (TH1*)gPad->GetPrimitive("htemp");
512     htemp->SetTitle("S122B");
513     //----------
514     RatePMT3->cd (9);
515     PhysicsTr->Draw("pmtcount2[0]");
516     htemp = (TH1*)gPad->GetPrimitive("htemp");
517     htemp->SetTitle("S123B");
518     //----------
519     RatePMT3->cd (10);
520     PhysicsTr->Draw("pmtcount2[1]");
521     htemp = (TH1*)gPad->GetPrimitive("htemp");
522     htemp->SetTitle("S124B");
523     //----------
524     RatePMT3->cd (11);
525     PhysicsTr->Draw("pmtcount2[2]");
526     htemp = (TH1*)gPad->GetPrimitive("htemp");
527     htemp->SetTitle("S125B");
528     //----------
529     RatePMT3->cd (12);
530     PhysicsTr->Draw("pmtcount2[3]");
531     htemp = (TH1*)gPad->GetPrimitive("htemp");
532     htemp->SetTitle("S126B");
533    
534     TCanvas *RatePMT4 = new TCanvas("RatePMT4", "Rate PMT S2", 1);
535     RatePMT4->Divide (3,3);
536     //----------
537     RatePMT4->cd (1);
538     PhysicsTr-> Draw("pmtcount2[4]");
539     htemp = (TH1*)gPad->GetPrimitive("htemp");
540     htemp->SetTitle("S211A");
541     //----------
542     RatePMT4->cd (2);
543     PhysicsTr-> Draw("pmtcount2[5]");
544     htemp = (TH1*)gPad->GetPrimitive("htemp");
545     htemp->SetTitle("S212A");
546     //----------
547     RatePMT4->cd (3);
548     PhysicsTr-> Draw("pmtcount2[6]");
549     htemp = (TH1*)gPad->GetPrimitive("htemp");
550     htemp->SetTitle("S211B");
551     //----------
552     RatePMT4->cd (4);
553     PhysicsTr-> Draw("pmtcount2[7]");
554     htemp = (TH1*)gPad->GetPrimitive("htemp");
555     htemp->SetTitle("S212B");
556     //----------
557     RatePMT4->cd (5);
558     PhysicsTr-> Draw("pmtcount2[8]");
559     htemp = (TH1*)gPad->GetPrimitive("htemp");
560     htemp->SetTitle("S221A");
561     //----------
562     RatePMT4->cd (6);
563     PhysicsTr-> Draw("pmtcount2[9]");
564     htemp = (TH1*)gPad->GetPrimitive("htemp");
565     htemp->SetTitle("S222A");
566     //----------
567     RatePMT4->cd (7);
568     PhysicsTr-> Draw("pmtcount2[10]");
569     htemp = (TH1*)gPad->GetPrimitive("htemp");
570     htemp->SetTitle("S221B");
571     //----------
572     RatePMT4->cd (8);
573     PhysicsTr->Draw("pmtcount2[11]");
574     htemp = (TH1*)gPad->GetPrimitive("htemp");
575     htemp->SetTitle("S222B");
576    
577     TCanvas *RatePMT5 = new TCanvas("RatePMT5", "Rate PMT S3", 1);
578     RatePMT5->Divide (3,4);
579     //----------
580     RatePMT5->cd (1);
581     PhysicsTr-> Draw("pmtcount2[12]");
582     htemp = (TH1*)gPad->GetPrimitive("htemp");
583     htemp->SetTitle("S311A");
584     //----------
585     RatePMT5->cd (2);
586     PhysicsTr-> Draw("pmtcount2[13]");
587     htemp = (TH1*)gPad->GetPrimitive("htemp");
588     htemp->SetTitle("S312A");
589     //----------
590     RatePMT5->cd (3);
591     PhysicsTr-> Draw("pmtcount2[14]");
592     htemp = (TH1*)gPad->GetPrimitive("htemp");
593     htemp->SetTitle("S313A");
594     //----------
595     RatePMT5->cd (4);
596     PhysicsTr-> Draw("pmtcount2[15]");
597     htemp = (TH1*)gPad->GetPrimitive("htemp");
598     htemp->SetTitle("S311B");
599     //----------
600     RatePMT5->cd (5);
601     PhysicsTr-> Draw("pmtcount2[16]");
602     htemp = (TH1*)gPad->GetPrimitive("htemp");
603     htemp->SetTitle("S312B");
604     //----------
605     RatePMT5->cd (6);
606     PhysicsTr-> Draw("pmtcount2[17]");
607     htemp = (TH1*)gPad->GetPrimitive("htemp");
608     htemp->SetTitle("S313B");
609     //----------
610     RatePMT5->cd (7);
611     PhysicsTr-> Draw("pmtcount2[18]");
612     htemp = (TH1*)gPad->GetPrimitive("htemp");
613     htemp->SetTitle("S321A");
614     //----------
615     RatePMT5->cd (8);
616     PhysicsTr-> Draw("pmtcount2[19]");
617     htemp = (TH1*)gPad->GetPrimitive("htemp");
618     htemp->SetTitle("S322A");
619     //----------
620     RatePMT5->cd (9);
621     PhysicsTr-> Draw("pmtcount2[20]");
622     htemp = (TH1*)gPad->GetPrimitive("htemp");
623     htemp->SetTitle("S323A");
624     //----------
625     RatePMT5->cd (10);
626     PhysicsTr-> Draw("pmtcount2[21]");
627     htemp = (TH1*)gPad->GetPrimitive("htemp");
628     htemp->SetTitle("S321B");
629     //----------
630     RatePMT5->cd (11);
631     PhysicsTr-> Draw("pmtcount2[22]");
632     htemp = (TH1*)gPad->GetPrimitive("htemp");
633     htemp->SetTitle("S322B");
634     //----------
635     gStyle->SetOptStat("mr");
636     gStyle->SetStatH(0.3);
637     gStyle->SetStatW(0.3);
638     RatePMT5->cd (12);
639     PhysicsTr-> Draw("pmtcount2[23]");
640     htemp = (TH1*)gPad->GetPrimitive("htemp");
641     htemp->SetTitle("S323B");
642    
643     // print the output
644     const char *saveas = format;
645     if ( !strcmp(saveas,"ps") ) {
646     // ------print the ps
647    
648     gStyle->SetOptStat(111111);
649    
650     sst.str("");
651     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic." << saveas << "(";
652     EvCounterCanvas->Print(sst.str().c_str());
653     DeadLiveCanvas->Print(sst.str().c_str());
654     PMTCanvas->Print(sst.str().c_str());
655     TrigRate1Canvas->Print(sst.str().c_str());
656     TrigRate2Canvas->Print(sst.str().c_str());
657    
658     gStyle->SetOptStat("mr");
659     S4CalCanvas->Print(sst.str().c_str());
660    
661     gStyle->SetOptStat("mr");
662     RatePMT1->Print(sst.str().c_str());
663     RatePMT2->Print(sst.str().c_str());
664     RatePMT3->Print(sst.str().c_str());
665     RatePMT4->Print(sst.str().c_str());
666     //
667     sst.str("");
668     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic." << saveas << ")";
669     RatePMT5->Print(sst.str().c_str());
670    
671     } else {
672    
673     gStyle->SetOptStat(111111);
674    
675     sst.str("");
676     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic1." << saveas;
677     EvCounterCanvas->SaveAs(sst.str().c_str());
678    
679     sst.str("");
680     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic2." << saveas;
681     DeadLiveCanvas->SaveAs(sst.str().c_str());
682    
683     sst.str("");
684     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic3." << saveas;
685     PMTCanvas->SaveAs(sst.str().c_str());
686    
687     sst.str("");
688     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic4." << saveas;
689     TrigRate1Canvas->SaveAs(sst.str().c_str());
690    
691     sst.str("");
692     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic5." << saveas;
693     TrigRate2Canvas->SaveAs(sst.str().c_str());
694    
695     sst.str("");
696     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic6." << saveas;
697     S4CalCanvas->SaveAs(sst.str().c_str());
698    
699     gStyle->SetOptStat("mr");
700    
701     sst.str("");
702     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic13." << saveas;
703     RatePMT1->SaveAs(sst.str().c_str());
704    
705     sst.str("");
706     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic14." << saveas;
707     RatePMT2->SaveAs(sst.str().c_str());
708    
709     sst.str("");
710     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic15." << saveas;
711     RatePMT3->SaveAs(sst.str().c_str());
712    
713     sst.str("");
714     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic16." << saveas;
715     RatePMT4->SaveAs(sst.str().c_str());
716    
717     gStyle->SetOptStat("mr");
718    
719     sst.str("");
720     sst << outDirectory.Data() << filename.Data() << "TriggerScanBasic17." << saveas;
721     RatePMT5->SaveAs(sst.str().c_str());
722    
723     }
724    
725     }
726    
727    
728     int main(int argc, char* argv[]){
729     TString path;
730     TString outDir ="./";
731     TString format ="ps";
732    
733     if (argc < 2){
734     printf("You have to insert at least the file to analyze \n");
735     printf("Try '--help' for more information. \n");
736     exit(1);
737     }
738    
739     if (!strcmp(argv[1], "--help")){
740     printf( "Usage: TriggerScanBasic FILE [OPTION] \n");
741     printf( "\t --help Print this help and exit \n");
742     printf( "\t -outDir[path] Path where to put the output [default ./] \n");
743     printf( "\t -format[ps] Format for output files [default 'ps'] \n");
744     exit(1);
745     }
746    
747    
748     path=argv[1];
749    
750     for (int i = 2; i < argc; i++){
751    
752     if (!strcmp(argv[i], "-outDir")){
753     if (++i >= argc){
754     printf( "-outDir needs arguments. \n");
755     printf( "Try '--help' for more information. \n");
756     exit(1);
757     }
758     else{
759     outDir = argv[i];
760     continue;
761     }
762     }
763    
764    
765    
766     if (!strcmp(argv[i], "-format")){
767     if (++i >= argc){
768     printf( "-format needs arguments. \n");
769     printf( "Try '--help' for more information. \n");
770     exit(1);
771     }
772     else{
773     format = argv[i];
774     continue;
775     }
776     }
777     }
778    
779     TriggerScanBasic(argv[1], outDir, format);
780    
781     }

  ViewVC Help
Powered by ViewVC 1.1.23