/[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.2 - (hide annotations) (download)
Mon Jun 26 13:28:11 2006 UTC (18 years, 5 months ago) by campana
Branch: MAIN
CVS Tags: v1r04
Changes since 1.1: +326 -409 lines
new release with Trigger Rate vs. OBT

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

  ViewVC Help
Powered by ViewVC 1.1.23