/[PAMELA software]/flight/src/AcQLOOK.cpp
ViewVC logotype

Annotation of /flight/src/AcQLOOK.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed May 17 16:09:42 2006 UTC (18 years, 6 months ago) by pam-se
Branch point for: MAIN, v1r2
Initial revision

1 pam-se 1.1 #include <physics/anticounter/AnticounterEvent.h>
2     #include <PscuHeader.h>
3     #include <EventHeader.h>
4    
5     #include <fstream>
6    
7     #include <TCanvas.h>
8     #include <TLatex.h>
9     #include <TLegend.h>
10     #include <TLine.h>
11     #include <TTree.h>
12     #include <TStyle.h>
13     #include <TObjString.h>
14    
15     #include <utils/yodaUtility.h>
16    
17     #define DEBUG 0
18     #define VERSION 1.2
19     /*
20     * Anticounter physics quicklook
21     * Plots a brief status report of the anticounter detectors
22     * see document "Anticounter Quicklook Software" on www.particle.kth.se/~pearce/flight_ac_docs
23     * for more details
24     *
25     * author Petter Hofverberg
26     * version 1.0
27     *
28     * author Maurizio Nagni
29     * version 1.1
30     * Adapted for compilation and unique file YODA upacking
31     *
32     *
33     * author Petter Hofverberg
34     * version 1.2
35     * added a dummy version of the quicklook (-mode 0, default mode)
36     */
37     using namespace std;
38    
39     int AcQLOOK(TString base,int fromevent=0, int toevent=0, TString outDir = "./", TString format = "jpg", int fullversion=0){
40    
41     //Int_t tmpSize;
42     ofstream outputFile;
43     stringstream oss;
44    
45     pamela::anticounter::AnticounterEvent *ace = 0;
46     pamela::EventHeader *eh = 0;
47     pamela::PscuHeader *ph = 0;
48     TFile *rootFile = new TFile(base);
49    
50     if (rootFile->IsZombie())
51     exit(-1);
52     TString fileName = ((TObjString*)base.Tokenize("\/")->Last())->GetString();
53     TString filePath = base;
54     filePath.ReplaceAll(fileName, "");
55     fileName.ReplaceAll(".root", "");
56    
57     //Takes the tree of the header file
58     TTree *tr = (TTree*)rootFile->Get("Physics");
59    
60     tr->SetBranchAddress("Anticounter", &ace);
61     tr->SetBranchAddress("Header", &eh);
62    
63    
64     TString *mtitel = new TString[16];
65     mtitel[0]="CARD 4";
66     mtitel[1]="CAT 2";
67     mtitel[2]="CAS 1";
68     mtitel[3]="NC";
69     mtitel[4]="CARD 2";
70     mtitel[5]="CAT 4";
71     mtitel[6]="CAS 4";
72     mtitel[7]="NC";
73     mtitel[8]="CARD 3";
74     mtitel[9]="CAT 3";
75     mtitel[10]="CAS 3";
76     mtitel[11]="NC";
77     mtitel[12]="CARD 1";
78     mtitel[13]="CAT 1";
79     mtitel[14]="CAS 2";
80     mtitel[15]="NC";
81    
82     TString *etitel = new TString[16];
83     etitel[0]="CARD 4";
84     etitel[1]="CAT 2";
85     etitel[2]="CAS 1";
86     etitel[3]="NC";
87     etitel[4]="CARD 2";
88     etitel[5]="CAT 4";
89     etitel[6]="CAS 4";
90     etitel[7]="NC";
91     etitel[8]="CARD 3";
92     etitel[9]="CAT 3";
93     etitel[10]="CAS 3";
94     etitel[11]="NC";
95     etitel[12]="CARD 1";
96     etitel[13]="CAT 1";
97     etitel[14]="CAS 2";
98     etitel[15]="NC";
99    
100     //Long64_t
101     int nevents = tr->GetEntries();
102    
103     //tr->Scan("Pscu.Counter");
104     if(DEBUG)
105     printf("Number of events: %d\n",nevents);
106    
107     int antal=nevents;
108    
109     /******************Book histograms**********************************************/
110     if(DEBUG)
111     printf("Book histograms\n");
112    
113     TH1D *nmbhitpmtCAS = new TH1D("nmbhitpmtCAS","Hit PMTs CAS",8,0.5,8.5);
114     nmbhitpmtCAS->GetXaxis()->SetTitle("Number of hits");
115     //nmbhitpmtCAS->GetYaxis()->SetTitle("")
116     TH1D *nmbhitpmtCAT = new TH1D("nmbhitpmtCAT","Hit PMTs CAT",8,0.5,8.5);
117     TH1D *nmbhitpmtCARD = new TH1D("nmbhitpmtCARD","Hit PMTs CARD",8,0.5,8.5);
118    
119     //MAIN
120     TH1D *counter1_m = new TH1D("counter1_m","Counter register CARD 4",75,1.,150.);
121     counter1_m->GetXaxis()->SetTitle("rate [Hz]");
122     counter1_m->GetYaxis()->SetTitle("Events");
123     //counter1_m->SetBit(TH1D::kCanRebin);
124     TH1D *counter2_m = new TH1D("counter2_m","Counter register CAT 2",75,1.,150.);
125     counter2_m->GetXaxis()->SetTitle("rate [Hz]");
126     counter2_m->GetYaxis()->SetTitle("Events");
127     TH1D *counter3_m = new TH1D("counter3_m","Counter register CAS 1",75,1.,150.);
128     TH1D *counter4_m = new TH1D("counter4_m","Counter register NC",75,1.,150.);
129     TH1D *counter5_m = new TH1D("counter5_m","Counter register CARD 2",75,1.,150.);
130     //counter5_m->SetBit(TH1D::kCanRebin);
131     TH1D *counter6_m = new TH1D("counter6_m","Counter register CAT 4",75,1.,150.);
132     TH1D *counter7_m = new TH1D("counter7_m","Counter register CAS 4",75,1.,150.);
133     TH1D *counter8_m = new TH1D("counter8_m","Counter register NC",75,1.,150.);
134     TH1D *counter9_m = new TH1D("counter9_m","Counter register CARD 3",75,1.,150.);
135     TH1D *counter10_m = new TH1D("counter10_m","Counter register CAT 3",75,1.,150.);
136     TH1D *counter11_m = new TH1D("counter11_m","Counter register CAS 3",75,1.,150.);
137     TH1D *counter12_m = new TH1D("counter12_m","Counter register NC",75,1.,150.);
138     TH1D *counter13_m = new TH1D("counter13_m","Counter register CARD 1",75,1.,150.);
139     TH1D *counter14_m = new TH1D("counter14_m","Counter register CAT 1",75,1.,150.);
140     TH1D *counter15_m = new TH1D("counter15_m","Counter register CAS 2",75,1.,150.);
141     TH1D *counter16_m = new TH1D("counter16_m","Counter register NC",75,1.,150.);
142    
143     //EXTRA
144     TH1D *counter1_e = new TH1D("counter1_e","Counter register CARD 4",75,1.,150.);
145     TH1D *counter2_e = new TH1D("counter2_e","Counter register CAT 2",75,1.,150.);
146     TH1D *counter3_e = new TH1D("counter3_e","Counter register CAS 1",75,1.,150.);
147     TH1D *counter4_e = new TH1D("counter4_e","Counter register NC",75,1.,150.);
148     TH1D *counter5_e = new TH1D("counter5_e","Counter register CARD 2",75,1.,150.);
149     TH1D *counter6_e = new TH1D("counter6_e","Counter register CAT 4",75,1.,150.);
150     TH1D *counter7_e = new TH1D("counter7_e","Counter register CAS 4",75,1.,150.);
151     TH1D *counter8_e = new TH1D("counter8_e","Counter register NC",75,1.,150.);
152     TH1D *counter9_e = new TH1D("counter9_e","Counter register CARD 3",75,1.,150.);
153     TH1D *counter10_e = new TH1D("counter10_e","Counter register CAT 3",75,1.,150.);
154     TH1D *counter11_e = new TH1D("counter11_e","Counter register CAS 3",75,1.,150.);
155     TH1D *counter12_e = new TH1D("counter12_e","Counter register NC",75,1.,150.);
156     TH1D *counter13_e = new TH1D("counter13_e","Counter register CARD 1",75,1.,150.);
157     TH1D *counter14_e = new TH1D("counter14_e","Counter register CAT 1",75,1.,150.);
158     TH1D *counter15_e = new TH1D("counter15_e","Counter register CAS 2",75,1.,150.);
159     TH1D *counter16_e = new TH1D("counter16_e","Counter register NC",75,1.,150.);
160    
161     //MAIN
162     TH1D *shift1_m = new TH1D("shift1_m","Shift register CARD 4",16,0.,16.);
163     shift1_m->GetXaxis()->SetTitle("Bin");
164     shift1_m->GetYaxis()->SetTitle("Content");
165     TH1D *shift2_m = new TH1D("shift2_m","Shift register CAT 2",16,0.,16.);
166     shift2_m->GetXaxis()->SetTitle("Bin");
167     shift2_m->GetYaxis()->SetTitle("Content");
168     TH1D *shift3_m = new TH1D("shift3_m","Shift register CAS 1",16,0.,16.);
169     shift3_m->GetXaxis()->SetTitle("Bin");
170     shift3_m->GetYaxis()->SetTitle("Content");
171     TH1D *shift4_m = new TH1D("shift4_m","Shift register NC",16,0.,16.);
172     shift4_m->GetXaxis()->SetTitle("Bin");
173     shift4_m->GetYaxis()->SetTitle("Content");
174     TH1D *shift5_m = new TH1D("shift5_m","Shift register CARD 2",16,0.,16.);
175     shift5_m->GetXaxis()->SetTitle("Bin");
176     shift5_m->GetYaxis()->SetTitle("Content");
177     TH1D *shift6_m = new TH1D("shift6_m","Shift register CAT 4",16,0.,16.);
178     shift6_m->GetXaxis()->SetTitle("Bin");
179     shift6_m->GetYaxis()->SetTitle("Content");
180     TH1D *shift7_m = new TH1D("shift7_m","Shift register CAS 4",16,0.,16.);
181     shift7_m->GetXaxis()->SetTitle("Bin");
182     shift7_m->GetYaxis()->SetTitle("Content");
183     TH1D *shift8_m = new TH1D("shift8_m","Shift register NC",16,0.,16.);
184     shift8_m->GetXaxis()->SetTitle("Bin");
185     shift8_m->GetYaxis()->SetTitle("Content");
186     TH1D *shift9_m = new TH1D("shift9_m","Shift register CARD 3",16,0.,16.);
187     shift9_m->GetXaxis()->SetTitle("Bin");
188     shift9_m->GetYaxis()->SetTitle("Content");
189     TH1D *shift10_m = new TH1D("shift10_m","Shift register CAT 3",16,0.,16.);
190     shift10_m->GetXaxis()->SetTitle("Bin");
191     shift10_m->GetYaxis()->SetTitle("Content");
192     TH1D *shift11_m = new TH1D("shift11_m","Shift register CAS 3",16,0.,16.);
193     shift11_m->GetXaxis()->SetTitle("Bin");
194     shift11_m->GetYaxis()->SetTitle("Content");
195     TH1D *shift12_m = new TH1D("shift12_m","Shift register NC",16,0.,16.);
196     shift12_m->GetXaxis()->SetTitle("Bin");
197     shift12_m->GetYaxis()->SetTitle("Content");
198     TH1D *shift13_m = new TH1D("shift13_m","Shift register CARD 1",16,0.,16.);
199     shift13_m->GetXaxis()->SetTitle("Bin");
200     shift13_m->GetYaxis()->SetTitle("Content");
201     TH1D *shift14_m = new TH1D("shift14_m","Shift register CAT 1",16,0.,16.);
202     shift14_m->GetXaxis()->SetTitle("Bin");
203     shift14_m->GetYaxis()->SetTitle("Content");
204     TH1D *shift15_m = new TH1D("shift15_m","Shift register CAS 2",16,0.,16.);
205     shift15_m->GetXaxis()->SetTitle("Bin");
206     shift15_m->GetYaxis()->SetTitle("Content");
207     TH1D *shift16_m = new TH1D("shift16_m","Shift register NC",16,0.,16.);
208     shift16_m->GetXaxis()->SetTitle("Bin");
209     shift16_m->GetYaxis()->SetTitle("Content");
210    
211     //EXTRA
212     TH1D *shift1_e = new TH1D("shift1_e","Shift register 1",16,0.,16.);
213     shift1_e->GetXaxis()->SetTitle("Bin");
214     shift1_e->GetYaxis()->SetTitle("Content");
215     TH1D *shift2_e = new TH1D("shift2_e","Shift register 2",16,0.,16.);
216     shift2_e->GetXaxis()->SetTitle("Bin");
217     shift2_e->GetYaxis()->SetTitle("Content");
218     TH1D *shift3_e = new TH1D("shift3_e","Shift register 3",16,0.,16.);
219     shift3_e->GetXaxis()->SetTitle("Bin");
220     shift3_e->GetYaxis()->SetTitle("Content");
221     TH1D *shift4_e = new TH1D("shift4_e","Shift register 4",16,0.,16.);
222     shift4_e->GetXaxis()->SetTitle("Bin");
223     shift4_e->GetYaxis()->SetTitle("Content");
224     TH1D *shift5_e = new TH1D("shift5_e","Shift register 5",16,0.,16.);
225     shift5_e->GetXaxis()->SetTitle("Bin");
226     shift5_e->GetYaxis()->SetTitle("Content");
227     TH1D *shift6_e = new TH1D("shift6_e","Shift register 6",16,0.,16.);
228     shift6_e->GetXaxis()->SetTitle("Bin");
229     shift6_e->GetYaxis()->SetTitle("Content");
230     TH1D *shift7_e = new TH1D("shift7_e","Shift register 7",16,0.,16.);
231     shift7_e->GetXaxis()->SetTitle("Bin");
232     shift7_e->GetYaxis()->SetTitle("Content");
233     TH1D *shift8_e = new TH1D("shift8_e","Shift register 8",16,0.,16.);
234     shift8_e->GetXaxis()->SetTitle("Bin");
235     shift8_e->GetYaxis()->SetTitle("Content");
236     TH1D *shift9_e = new TH1D("shift9_e","Shift register 9",16,0.,16.);
237     shift9_e->GetXaxis()->SetTitle("Bin");
238     shift9_e->GetYaxis()->SetTitle("Content");
239     TH1D *shift10_e = new TH1D("shift10_e","Shift register 10",16,0.,16.);
240     shift10_e->GetXaxis()->SetTitle("Bin");
241     shift10_e->GetYaxis()->SetTitle("Content");
242     TH1D *shift11_e = new TH1D("shift11_e","Shift register 11",16,0.,16.);
243     shift11_e->GetXaxis()->SetTitle("Bin");
244     shift11_e->GetYaxis()->SetTitle("Content");
245     TH1D *shift12_e = new TH1D("shift12_e","Shift register 12",16,0.,16.);
246     shift12_e->GetXaxis()->SetTitle("Bin");
247     shift12_e->GetYaxis()->SetTitle("Content");
248     TH1D *shift13_e = new TH1D("shift13_e","Shift register 13",16,0.,16.);
249     shift13_e->GetXaxis()->SetTitle("Bin");
250     shift13_e->GetYaxis()->SetTitle("Content");
251     TH1D *shift14_e = new TH1D("shift14_e","Shift register 14",16,0.,16.);
252     shift14_e->GetXaxis()->SetTitle("Bin");
253     shift14_e->GetYaxis()->SetTitle("Content");
254     TH1D *shift15_e = new TH1D("shift15_e","Shift register 15",16,0.,16.);
255     shift15_e->GetXaxis()->SetTitle("Bin");
256     shift15_e->GetYaxis()->SetTitle("Content");
257     TH1D *shift16_e = new TH1D("shift16_e","Shift register 16",16,0.,16.);
258     shift16_e->GetXaxis()->SetTitle("Bin");
259     shift16_e->GetYaxis()->SetTitle("Content");
260    
261    
262    
263     //MAIN
264     TH1D *head_m = new TH1D("head_m","Status and Headers",10,0.,10.);
265     head_m->GetXaxis()->SetBinLabel(1,"Event CRC M");
266     head_m->GetXaxis()->SetBinLabel(2,"Headers M");
267     head_m->GetXaxis()->SetBinLabel(3,"CRC M");
268     head_m->GetXaxis()->SetBinLabel(4,"Dsp M");
269     head_m->GetXaxis()->SetBinLabel(5,"Reg M");
270     head_m->GetXaxis()->SetBinLabel(6,"Event CRC E");
271     head_m->GetXaxis()->SetBinLabel(7,"Headers E");
272     head_m->GetXaxis()->SetBinLabel(8,"CRC E");
273     head_m->GetXaxis()->SetBinLabel(9,"Dsp E");
274     head_m->GetXaxis()->SetBinLabel(10,"Reg E");
275     head_m->GetYaxis()->SetTitle("Errors");
276     head_m->SetMinimum(0);
277    
278     TH1D *hitmap_m = new TH1D("hitmap_m","Hitmap",16,0.,16.);
279     hitmap_m->GetXaxis()->SetBinLabel(1,mtitel[0]);
280     hitmap_m->GetXaxis()->SetBinLabel(2,mtitel[1]);
281     hitmap_m->GetXaxis()->SetBinLabel(3,mtitel[2]);
282     hitmap_m->GetXaxis()->SetBinLabel(4,mtitel[3]);
283     hitmap_m->GetXaxis()->SetBinLabel(5,mtitel[4]);
284     hitmap_m->GetXaxis()->SetBinLabel(6,mtitel[5]);
285     hitmap_m->GetXaxis()->SetBinLabel(7,mtitel[6]);
286     hitmap_m->GetXaxis()->SetBinLabel(8,mtitel[7]);
287     hitmap_m->GetXaxis()->SetBinLabel(9,mtitel[8]);
288     hitmap_m->GetXaxis()->SetBinLabel(10,mtitel[9]);
289     hitmap_m->GetXaxis()->SetBinLabel(11,mtitel[10]);
290     hitmap_m->GetXaxis()->SetBinLabel(12,mtitel[11]);
291     hitmap_m->GetXaxis()->SetBinLabel(13,mtitel[12]);
292     hitmap_m->GetXaxis()->SetBinLabel(14,mtitel[13]);
293     hitmap_m->GetXaxis()->SetBinLabel(15,mtitel[14]);
294     hitmap_m->GetXaxis()->SetBinLabel(16,mtitel[15]);
295     hitmap_m->GetYaxis()->SetTitle("Hits");
296    
297     TH1D *pmtstatus_m = new TH1D("pmtstatus_m","Coincidence errors MAIN",16,0.,16.);
298     pmtstatus_m->GetXaxis()->SetBinLabel(1,mtitel[0]);
299     pmtstatus_m->GetXaxis()->SetBinLabel(2,mtitel[1]);
300     pmtstatus_m->GetXaxis()->SetBinLabel(3,mtitel[2]);
301     pmtstatus_m->GetXaxis()->SetBinLabel(4,mtitel[3]);
302     pmtstatus_m->GetXaxis()->SetBinLabel(5,mtitel[4]);
303     pmtstatus_m->GetXaxis()->SetBinLabel(6,mtitel[5]);
304     pmtstatus_m->GetXaxis()->SetBinLabel(7,mtitel[6]);
305     pmtstatus_m->GetXaxis()->SetBinLabel(8,mtitel[7]);
306     pmtstatus_m->GetXaxis()->SetBinLabel(9,mtitel[8]);
307     pmtstatus_m->GetXaxis()->SetBinLabel(10,mtitel[9]);
308     pmtstatus_m->GetXaxis()->SetBinLabel(11,mtitel[10]);
309     pmtstatus_m->GetXaxis()->SetBinLabel(12,mtitel[11]);
310     pmtstatus_m->GetXaxis()->SetBinLabel(13,mtitel[12]);
311     pmtstatus_m->GetXaxis()->SetBinLabel(14,mtitel[13]);
312     pmtstatus_m->GetXaxis()->SetBinLabel(15,mtitel[14]);
313     pmtstatus_m->GetXaxis()->SetBinLabel(16,mtitel[15]);
314     pmtstatus_m->GetYaxis()->SetTitle("Errors");
315    
316     //if(fromevent==0 && toevent==0)
317     TH1D *trigg_m = new TH1D("trigg_m","Trigger dev",antal,0.,antal);
318     /*if(toevent>0 && fromevent>0)
319     TH1D *trigg_m = new TH1D("trigg_m","Trigger dev",toevent-fromevent,fromevent,toevent);
320     if(toevent==0 && fromevent>0)
321     TH1D *trigg_m = new TH1D("trigg_m","Trigger dev",1,fromevent,fromevent+1);*/
322     //trigg_m->SetMinimum(0);
323     trigg_m->GetYaxis()->SetTitle("Triggers");
324     trigg_m->GetXaxis()->SetTitle("Event number");
325    
326     TH1D *timebtrigg_m = new TH1D("timebtrigg_m","Time between triggers",100,0.,5.);
327     //timebtrigg_m->SetBit(TH1D::kCanRebin);
328     timebtrigg_m->GetYaxis()->SetTitle("Events");
329     timebtrigg_m->GetXaxis()->SetTitle("Time [s]");
330    
331     //if(fromevent==0 && toevent==0){
332     TH1D *crc_m = new TH1D("crc_m","crc MAIN",antal,0.,antal);
333     TH1D *headerr_m = new TH1D("headerr_m","headerr_m",antal,0.,antal);
334     TH1D *crcerr_m = new TH1D("crcerr_m","crcerr_m",antal,0.,antal);
335     TH1D *dsperr_m = new TH1D("dsperr_m","dsperr_m",antal,0.,antal);
336     TH1D *regerr_m = new TH1D("regerr_m","regerr_m",antal,0.,antal);
337     //}
338     /*
339     if(toevent>0 && fromevent>0){
340     TH1D *crc_m = new TH1D("crc_m","crc MAIN",toevent-fromevent,fromevent,toevent);
341     TH1D *headerr_m = new TH1D("headerr_m","headerr_m",toevent-fromevent,fromevent,toevent);
342     TH1D *crcerr_m = new TH1D("crcerr_m","crcerr_m",toevent-fromevent,fromevent,toevent);
343     TH1D *dsperr_m = new TH1D("dsperr_m","dsperr_m",toevent-fromevent,fromevent,toevent);
344     TH1D *regerr_m = new TH1D("regerr_m","regerr_m",toevent-fromevent,fromevent,toevent);
345     }
346     if(toevent==0 && fromevent>0){
347     TH1D *crc_m = new TH1D("crc_m","crc MAIN",1,fromevent,fromevent+1);
348     TH1D *headerr_m = new TH1D("headerr_m","headerr_m",1,fromevent,fromevent+1);
349     TH1D *crcerr_m = new TH1D("crcerr_m","crcerr_m",1,fromevent,fromevent+1);
350     TH1D *dsperr_m = new TH1D("dsperr_m","dsperr_m",1,fromevent,fromevent+1);
351     TH1D *regerr_m = new TH1D("regerr_m","regerr_m",1,fromevent,fromevent+1);
352     }*/
353    
354     TH1D *dtrigg_m = new TH1D("dtrigg_m","Trigger increment",10,0.,10.);
355     dtrigg_m->GetYaxis()->SetTitle("Events");
356     dtrigg_m->GetXaxis()->SetTitle("Trigger increment");
357    
358     TH1D *timebtrigg_e = new TH1D("timebtrigg_e","Time between triggers EXTRA",100,0.,5.);
359     //timebtrigg_e->SetBit(TH1D::kCanRebin);
360     timebtrigg_e->GetYaxis()->SetTitle("Events");
361     timebtrigg_e->GetXaxis()->SetTitle("Time [s]");
362    
363    
364     // if(fromevent==0 && toevent==0){
365     TH1D *crc_e = new TH1D("crc_e","crc EXTRA",antal,0.,antal);
366     TH1D *headerr_e = new TH1D("headerr_e","headerr_e",antal,0.,antal);
367     TH1D *crcerr_e = new TH1D("crcerr_e","crcerr_e",antal,0.,antal);
368     TH1D *dsperr_e = new TH1D("dsperr_e","dsperr_e",antal,0.,antal);
369     TH1D *regerr_e = new TH1D("regerr_e","regerr_e",antal,0.,antal);
370     //}
371     /*
372     if(toevent>0 && fromevent>0){
373     TH1D *crc_e = new TH1D("crc_e","crc EXTRA",toevent-fromevent,fromevent,toevent);
374     TH1D *headerr_e = new TH1D("headerr_e","headerr_e",toevent-fromevent,fromevent,toevent);
375     TH1D *crcerr_e = new TH1D("crcerr_e","crcerr_e",toevent-fromevent,fromevent,toevent);
376     TH1D *dsperr_e = new TH1D("dsperr_e","dsperr_e",toevent-fromevent,fromevent,toevent);
377     TH1D *regerr_e = new TH1D("regerr_e","regerr_e",toevent-fromevent,fromevent,toevent);
378     }
379     if(toevent==0 && fromevent>0){
380     TH1D *crc_e = new TH1D("crc_e","crc EXTRA",1,fromevent,fromevent+1);
381     TH1D *headerr_e = new TH1D("headerr_e","headerr_e",1,fromevent,fromevent+1);
382     TH1D *crcerr_e = new TH1D("crcerr_e","crcerr_e",1,fromevent,fromevent+1);
383     TH1D *dsperr_e = new TH1D("dsperr_e","dsperr_e",1,fromevent,fromevent+1);
384     TH1D *regerr_e = new TH1D("regerr_e","regerr_e",1,fromevent,fromevent+1);
385     }*/
386     //if(fromevent==0 && toevent==0){
387     TH1D *T_right_m = new TH1D("T_right_m","Temperature MAIN",antal,0.,antal);
388     TH1D *T_actel_m = new TH1D("T_actel_m","Temperature MAIN",antal,0.,antal);
389     TH1D *T_dsp_m = new TH1D("T_dsp_m","Temperature MAIN",antal,0.,antal);
390     TH1D *T_left_m = new TH1D("T_left_m","Temperature MAIN",antal,0.,antal);
391     //}
392     /*
393     if(fromevent>0 && toevent>0){
394     TH1D *T_right_m = new TH1D("T_right_m","Temperature MAIN",toevent-fromevent,fromevent,toevent);
395     TH1D *T_actel_m = new TH1D("T_actel_m","Temperature MAIN",toevent-fromevent,fromevent,toevent);
396     TH1D *T_dsp_m = new TH1D("T_dsp_m","Temperature MAIN",toevent-fromevent,fromevent,toevent);
397     TH1D *T_left_m = new TH1D("T_left_m","Temperature MAIN",toevent-fromevent,fromevent,toevent);
398     }
399     if(fromevent>0 && toevent==0){
400     TH1D *T_right_m = new TH1D("T_right_m","Temperature MAIN",1,fromevent,fromevent+1);
401     TH1D *T_actel_m = new TH1D("T_actel_m","Temperature MAIN",1,fromevent,fromevent+1);
402     TH1D *T_dsp_m = new TH1D("T_dsp_m","Temperature MAIN",1,fromevent,fromevent+1);
403     TH1D *T_left_m = new TH1D("T_left_m","Temperature MAIN",1,fromevent,fromevent+1);
404     }
405     */
406     T_right_m->GetXaxis()->SetTitle("Event number");
407     T_right_m->GetYaxis()->SetTitle("Temp [C]");
408     T_right_m->SetMinimum(10);
409     T_right_m->SetMaximum(50);
410     //T_actel_m->SetMinimum(0);
411     //T_actel_m->SetMaximum(700);
412     //T_dsp_m->SetMinimum(0);
413     //T_dsp_m->SetMaximum(700);
414     //T_left_m->SetMinimum(0);
415     //T_left_m->SetMaximum(700);
416    
417     //if(fromevent==0 && toevent==0){
418     TH1D *T_right_e = new TH1D("T_right_e","Temperature EXTRA",antal,0.,antal);
419     TH1D *T_actel_e = new TH1D("T_actel_e","Temperature EXTRA",antal,0.,antal);
420     TH1D *T_dsp_e = new TH1D("T_dsp_e","Temperature EXTRA",antal,0.,antal);
421     TH1D *T_left_e = new TH1D("T_left_e","Temperature EXTRA",antal,0.,antal);
422     //}
423     /*
424     if(fromevent>0 && toevent>0){
425     TH1D *T_right_e = new TH1D("T_right_e","Temperature EXTRA",toevent-fromevent,fromevent,toevent);
426     TH1D *T_actel_e = new TH1D("T_actel_e","Temperature EXTRA",toevent-fromevent,fromevent,toevent);
427     TH1D *T_dsp_e = new TH1D("T_dsp_e","Temperature EXTRA",toevent-fromevent,fromevent,toevent);
428     TH1D *T_left_e = new TH1D("T_left_e","Temperature EXTRA",toevent-fromevent,fromevent,toevent);
429     }
430     if(fromevent>0 && toevent==0){
431     TH1D *T_right_e = new TH1D("T_right_e","Temperature EXTRA",1,fromevent,fromevent+1);
432     TH1D *T_actel_e = new TH1D("T_actel_e","Temperature EXTRA",1,fromevent,fromevent+1);
433     TH1D *T_dsp_e = new TH1D("T_dsp_e","Temperature EXTRA",1,fromevent,fromevent+1);
434     TH1D *T_left_e = new TH1D("T_left_e","Temperature EXTRA",1,fromevent,fromevent+1);
435     }
436     */
437     T_right_e->GetXaxis()->SetTitle("Event number");
438     T_right_e->GetYaxis()->SetTitle("Temp [C]");
439     T_right_e->SetMinimum(10);
440     T_right_e->SetMaximum(50);
441    
442     //EXTRA
443     TH1D *head_e = new TH1D("head_e","Status and Headers",10,0.,10.);
444     head_e->GetXaxis()->SetBinLabel(1,"CRC event M");
445     head_e->GetXaxis()->SetBinLabel(2,"Headers M");
446     head_e->GetXaxis()->SetBinLabel(3,"CRC M");
447     head_e->GetXaxis()->SetBinLabel(4,"Dsp M");
448     head_e->GetXaxis()->SetBinLabel(5,"Reg M");
449     head_e->GetXaxis()->SetBinLabel(6,"CRC event E");
450     head_e->GetXaxis()->SetBinLabel(7,"Headers E");
451     head_e->GetXaxis()->SetBinLabel(8,"CRC E");
452     head_e->GetXaxis()->SetBinLabel(9,"Dsp E");
453     head_e->GetXaxis()->SetBinLabel(10,"Reg E");
454     head_e->GetYaxis()->SetTitle("Errors");
455     head_e->SetMinimum(0);
456    
457     /* INTE
458     TH1D *head_e = new TH1D("head_e","Status and Headers",9,0.,9.);
459     head_e->GetXaxis()->SetBinLabel(1,"Status");
460     head_e->GetXaxis()->SetBinLabel(2,"Reg 0");
461     head_e->GetXaxis()->SetBinLabel(3,"Reg 1");
462     head_e->GetXaxis()->SetBinLabel(4,"Reg 2");
463     head_e->GetXaxis()->SetBinLabel(5,"Reg 3");
464     head_e->GetXaxis()->SetBinLabel(6,"Reg 4");
465     head_e->GetXaxis()->SetBinLabel(7,"Reg 5");
466     head_e->GetXaxis()->SetBinLabel(8,"Head 1");
467     head_e->GetXaxis()->SetBinLabel(9,"Head 2");
468     head_e->GetYaxis()->SetTitle("Errors");
469     */
470    
471     TH1D *hitmap_e = new TH1D("hitmap_e","Hitmap EXTRA",16,0.,16.);
472     hitmap_e->GetXaxis()->SetBinLabel(1,etitel[0]);
473     hitmap_e->GetXaxis()->SetBinLabel(2,etitel[1]);
474     hitmap_e->GetXaxis()->SetBinLabel(3,etitel[2]);
475     hitmap_e->GetXaxis()->SetBinLabel(4,etitel[3]);
476     hitmap_e->GetXaxis()->SetBinLabel(5,etitel[4]);
477     hitmap_e->GetXaxis()->SetBinLabel(6,etitel[5]);
478     hitmap_e->GetXaxis()->SetBinLabel(7,etitel[6]);
479     hitmap_e->GetXaxis()->SetBinLabel(8,etitel[7]);
480     hitmap_e->GetXaxis()->SetBinLabel(9,etitel[8]);
481     hitmap_e->GetXaxis()->SetBinLabel(10,etitel[9]);
482     hitmap_e->GetXaxis()->SetBinLabel(11,etitel[10]);
483     hitmap_e->GetXaxis()->SetBinLabel(12,etitel[11]);
484     hitmap_e->GetXaxis()->SetBinLabel(13,etitel[12]);
485     hitmap_e->GetXaxis()->SetBinLabel(14,etitel[13]);
486     hitmap_e->GetXaxis()->SetBinLabel(15,etitel[14]);
487     hitmap_e->GetXaxis()->SetBinLabel(16,etitel[15]);
488     hitmap_e->GetYaxis()->SetTitle("Hits");
489    
490     TH1D *pmtstatus_e = new TH1D("pmtstatus_e","Coincidence errors EXTRA",16,0.,16.);
491     pmtstatus_e->GetXaxis()->SetBinLabel(1,mtitel[0]);
492     pmtstatus_e->GetXaxis()->SetBinLabel(2,mtitel[1]);
493     pmtstatus_e->GetXaxis()->SetBinLabel(3,mtitel[2]);
494     pmtstatus_e->GetXaxis()->SetBinLabel(4,mtitel[3]);
495     pmtstatus_e->GetXaxis()->SetBinLabel(5,mtitel[4]);
496     pmtstatus_e->GetXaxis()->SetBinLabel(6,mtitel[5]);
497     pmtstatus_e->GetXaxis()->SetBinLabel(7,mtitel[6]);
498     pmtstatus_e->GetXaxis()->SetBinLabel(8,mtitel[7]);
499     pmtstatus_e->GetXaxis()->SetBinLabel(9,mtitel[8]);
500     pmtstatus_e->GetXaxis()->SetBinLabel(10,mtitel[9]);
501     pmtstatus_e->GetXaxis()->SetBinLabel(11,mtitel[10]);
502     pmtstatus_e->GetXaxis()->SetBinLabel(12,mtitel[11]);
503     pmtstatus_e->GetXaxis()->SetBinLabel(13,mtitel[12]);
504     pmtstatus_e->GetXaxis()->SetBinLabel(14,mtitel[13]);
505     pmtstatus_e->GetXaxis()->SetBinLabel(15,mtitel[14]);
506     pmtstatus_e->GetXaxis()->SetBinLabel(16,mtitel[15]);
507     pmtstatus_e->GetYaxis()->SetTitle("Errors");
508    
509     //if(fromevent==0 && toevent==0)
510     TH1D *trigg_e = new TH1D("trigg_e","Triggers EXTRA",antal,0.,antal);
511     //if(fromevent>0 && toevent>0)
512     //TH1D *trigg_e = new TH1D("trigg_e","Triggers EXTRA",toevent-fromevent,fromevent,toevent);
513     // if(fromevent>0 && toevent==0)
514     //TH1D *trigg_e = new TH1D("trigg_e","Triggers EXTRA",1,fromevent,fromevent+1);
515     trigg_e->GetYaxis()->SetTitle("Triggers");
516     trigg_e->GetXaxis()->SetTitle("Event number");
517     TH1D *dtrigg_e = new TH1D("dtrigg_e","Trigger increment EXTRA",10,0.,10.);
518     dtrigg_e->GetYaxis()->SetTitle("Events");
519     dtrigg_e->GetXaxis()->SetTitle("Trigger increment");
520    
521    
522    
523     /********************************************************************************/
524    
525     //Long64_t nevents = tr->GetEntries();
526     //Int_t mintime = tr->GetMinimum("Pscu.OrbitalTime");
527     //Int_t maxtime = tr->GetMaximum("Pscu.OrbitalTime");
528     //Int_t nbintime = (maxtime-mintime)/1000;
529     char *error;
530     error=" this is a very long line of characters as workaround ";
531    
532     /*******************Declarations*****************/
533     if(DEBUG)
534     printf("Declarate variables\n");
535     //cout << "Events: " << nevents << endl;
536     //const Int_t size = nevents;
537     //cout << "entries: " << size << endl;
538     //printf("nentries %d\n",size);
539     Double_t cputime;
540     UShort_t cnt = 1;
541     //unsigned int CRCcheck[2];
542     //unsigned int wordbuf[2][63];
543    
544     int totevents=0;
545     int crcevents[2];
546     crcevents[0]=0;
547     crcevents[1]=0;
548    
549     UShort_t CRCcheck[2];
550     UShort_t Status[2];
551     UShort_t Reg[2][6];
552     UShort_t Header[2][2];
553     UShort_t Hitmap[2];
554     UShort_t Trigger[2];
555     Short_t Trigg_old[2]={-1,-1};
556     UShort_t Temp[2][4];
557    
558     UShort_t timeLSB[2];
559     UShort_t timeMSB[2];
560     Double_t time[2];
561     Double_t tid1[2];
562     Double_t tid2[2];
563     Double_t tid3[2];
564    
565     Int_t Counter[2][16];
566     Int_t Counter1[2][16];
567     Int_t Counter2[2][16];
568     Int_t Counter3[2][16];
569     Double_t rate[2][16];
570     Double_t rate10[2][16];
571     Int_t rate10cnt[2][16];
572     Int_t cntmltp=10;
573    
574     UShort_t Shift[2][16];
575     int tmp;
576     int vec[2][16][16];
577     //UShort_t pack[2][16];
578     int hitsCAS,hitsCAT,hitsCARD;
579    
580    
581     //UShort_t timeLSB[2];
582     //UShort_t timeMSB[2];
583     //Double_t time[2];
584     //Double_t tid1[2];
585     //Double_t tid2[2];
586     //Double_t tid3[2];
587    
588     //Double_t hits_x[size],hits_y_m[size],hits_y_e[size];
589    
590     /*************************************************/
591    
592    
593     //
594     // run over each event and take out some variables
595     //
596     if ( fromevent > toevent && toevent ){
597     printf("It must be fromevent < toevent \n");
598     return -1;
599     };
600    
601    
602     if ( fromevent > nevents || fromevent < 0 ) {
603     //printf("You can choose fromevent between 0 (all) and %d \n",nevents);
604     return -1;
605     };
606    
607     if ( toevent > nevents || toevent < 0 ) {
608     //printf("You can choose toevent between 0 (all) and %d \n",nevents);
609     return -1;
610     };
611     int minevent,maxevent;
612     if ( fromevent == 0 ) {
613     minevent = 0;
614     maxevent = nevents;
615     } else {
616     minevent = fromevent - 1;
617     if ( toevent > 0 ){
618     maxevent = toevent;
619     } else {
620     maxevent = fromevent;
621     };
622     };
623    
624     //strange bug, this line have to be here...
625     //CRC=crc(CRC,0x0);
626    
627     //int what=0;
628    
629     if(DEBUG)
630     printf("Zero variables\n");
631    
632     for(Int_t b=0;b<2;b++){
633     for(Int_t a=0;a<16;a++){
634     rate10[b][a]=0;
635     rate10cnt[b][a]=0;
636     }
637     }
638     //Go through all events and update histograms and plots
639     //for (Int_t i = 0; i < nevents; i++){
640     if(fullversion)
641     {
642     if(DEBUG)
643     printf("Start looping over events (FULL VERSION)\n");
644     for (Int_t i = minevent; i < maxevent; i++){
645     //printf("1");
646     //printf("%d%c",100*(i-minevent)/(maxevent-minevent),37);
647     //printf("2");
648     //fflush(stdout);
649     ph = eh->GetPscuHeader();
650     cputime = ph->GetOrbitalTime();
651     if(DEBUG)
652     printf("Processing event %d\n",i);
653     tr->GetEntry(i);
654    
655     totevents=totevents+1;
656    
657     //CRC check
658     CRCcheck[0]=ace->CRCcheck[0];
659     CRCcheck[1]=ace->CRCcheck[1];
660     if(CRCcheck[0]==0)
661     {
662     head_m->Fill(0.0);
663     crcevents[0]++;
664     }
665     if(CRCcheck[1]==0)
666     {
667     head_e->Fill(5.0);
668     crcevents[1]++;
669     }
670    
671     if(DEBUG)
672     printf("Fetch parameters\n");
673     //fetch parameters
674     for(Int_t b = 0; b<2; b++){
675     for(Int_t j = 0; j < 16; j++){
676     Shift[b][j] = ace->shift[b][j];
677     }
678     }
679    
680     cnt=1;
681     for(Int_t b = 0; b < 2; b++){ //card
682     for(Int_t k = 0; k < 16; k++){ //shift register
683     for(Int_t l = 0; l < 16; l++){ //bin
684     tmp = ((Shift[b][k] & cnt) > 0 ? 1 : 0);
685     vec[b][k][l]=tmp;
686     cnt=cnt<<1;
687     }
688     cnt=1;
689     }
690     }
691    
692    
693     //fetch parameters
694     for(int b = 0; b<2; b++){
695     //cout << ace->status << endl;
696     timeLSB[b] = ace->clock[b][0];
697     timeMSB[b] = ace->clock[b][1];
698    
699     Status[b] = ace->status[b];
700     for(Int_t j = 0; j < 6; j++)
701     Reg[b][j] = ace->regist[b][j];
702     Header[b][0] = ace->header[b][0];
703     Header[b][1] = ace->header[b][1];
704     Hitmap[b] = ace->hitmap[b];
705    
706     Trigger[b] = ace->trigg[b];
707     Temp[b][0] = ((ace->temp[b][0]) & 0x00FF);
708     Temp[b][1] = ((ace->temp[b][0]) & 0xFF00)/256;
709     Temp[b][2] = ((ace->temp[b][1]) & 0x00FF);
710     Temp[b][3] = ((ace->temp[b][1]) & 0xFF00)/256;
711     for(Int_t j = 0; j < 16; j++)
712     Counter[b][j] = ace->counters[b][j];
713    
714    
715     }
716    
717     hitsCAS=hitsCAT=hitsCARD=0;
718     for(int b=0;b<2;b++)
719     {
720     if((Hitmap[b] & 0x0001) > 0) hitsCARD++;
721     if((Hitmap[b] & 0x0002) > 0) hitsCAT++;
722     if((Hitmap[b] & 0x0004) > 0) hitsCAS++;
723     if((Hitmap[b] & 0x0010) > 0) hitsCARD++;
724     if((Hitmap[b] & 0x0020) > 0) hitsCAT++;
725     if((Hitmap[b] & 0x0040) > 0) hitsCAS++;
726     if((Hitmap[b] & 0x0100) > 0) hitsCARD++;
727     if((Hitmap[b] & 0x0200) > 0) hitsCAT++;
728     if((Hitmap[b] & 0x0400) > 0) hitsCAS++;
729     if((Hitmap[b] & 0x1000) > 0) hitsCARD++;
730     if((Hitmap[b] & 0x2000) > 0) hitsCAT++;
731     if((Hitmap[b] & 0x4000) > 0) hitsCAS++;
732     }
733     cnt=1;
734     //check that both PMTs have seen events, and if not, increment histogram with 1.
735     /*
736     if((ace->CRCcheck[0])==1 && (ace->CRCcheck[1])==1){
737    
738     //hits_x[i-minevent] = cputime;
739     //hits_y_m[i-minevent] = ace->trigg[0];
740     //hits_y_e[i-minevent] = ace->trigg[1];
741    
742     for(int j=0;j<16;j++){
743     if((Hitmap[0] & cnt) > 0){
744     //cout << "E" << endl;
745     if((Hitmap[1] & cnt) == 0){
746     pmtstatus_e->Fill(j,1.);
747     //cout << "E filled" << endl;
748     }
749     }
750     if((Hitmap[1] & cnt) > 0){
751     //cout << "M" << endl;
752     if((Hitmap[0] & cnt) == 0){
753     pmtstatus_m->Fill(j,1.);
754     //cout << "M filled" << endl;
755     }
756     }
757     cnt=cnt<<1;
758     }
759     }
760     */
761     cnt=1;
762    
763    
764     //tempL=hex>>8;
765     //tempR=hex-(tempL<<8);
766     if(DEBUG)
767     printf("Calc time b events\n");
768     //time between events (tid3[b])
769     for(Int_t b = 0; b<2; b++){
770     time[b]=(timeMSB[b]*(pow(2,16))+timeLSB[b]);
771    
772     if(i==minevent)
773     tid1[b]=time[b];
774     else{
775     tid2[b]=tid1[b];
776     tid1[b]=time[b];
777     }
778     if(tid1[b]<tid2[b])
779     tid2[b]=tid2[b]-4294967294;
780    
781     tid3[b]=(tid1[b]-tid2[b])/(25*1000000);
782     //printf("%f\n",tid3[b]);
783     }
784    
785    
786     //number of counts between events Counter3[b][j] -> rate[b][j]
787     for(Int_t b=0;b<2;b++){
788     for(Int_t j = 0; j < 16; j++){
789     if(i==minevent)
790     Counter1[b][j]=Counter[b][j];
791     else{
792     Counter2[b][j]=Counter1[b][j];
793     Counter1[b][j]=Counter[b][j];
794     }
795     Counter3[b][j]=Counter1[b][j]-Counter2[b][j];
796     if(Counter3[b][j]<0)
797     Counter3[b][j]=Counter3[b][j]+65535;
798     if(tid3[b]>0){
799     rate[b][j]=Counter3[b][j]/tid3[b];
800     rate10[b][j]=rate10[b][j]+rate[b][j];
801     rate10cnt[b][j]=rate10cnt[b][j]+1;
802     }
803     }
804     }
805    
806    
807     //fill histograms MAIN
808     if(DEBUG)
809     printf("Fill histogram MAIN\n");
810    
811     if(CRCcheck[0]==CRCcheck[1]==1)
812     {
813     nmbhitpmtCAS->Fill(hitsCAS,1);
814     nmbhitpmtCAT->Fill(hitsCAT,1);
815     nmbhitpmtCARD->Fill(hitsCARD,1);
816     }
817     if(CRCcheck[0]==1)
818     {
819     for(Int_t j = 0; j < 16; j++){
820     shift1_m->Fill(j,vec[0][j][0]);
821     shift2_m->Fill(j,vec[0][j][1]);
822     shift3_m->Fill(j,vec[0][j][2]);
823     shift4_m->Fill(j,vec[0][j][3]);
824     shift5_m->Fill(j,vec[0][j][4]);
825     shift6_m->Fill(j,vec[0][j][5]);
826     shift7_m->Fill(j,vec[0][j][6]);
827     shift8_m->Fill(j,vec[0][j][7]);
828     shift9_m->Fill(j,vec[0][j][8]);
829     shift10_m->Fill(j,vec[0][j][9]);
830     shift11_m->Fill(j,vec[0][j][10]);
831     shift12_m->Fill(j,vec[0][j][11]);
832     shift13_m->Fill(j,vec[0][j][12]);
833     shift14_m->Fill(j,vec[0][j][13]);
834     shift15_m->Fill(j,vec[0][j][14]);
835     shift16_m->Fill(j,vec[0][j][15]);
836     }
837     }
838    
839     //fill histograms EXTRA
840     if(DEBUG)
841     printf("Fill histogram EXTRA\n");
842     if(CRCcheck[1]==1)
843     {
844     for(Int_t j = 0; j < 16; j++){
845     shift1_e->Fill(j,vec[1][j][0]);
846     shift2_e->Fill(j,vec[1][j][1]);
847     shift3_e->Fill(j,vec[1][j][2]);
848     shift4_e->Fill(j,vec[1][j][3]);
849     shift5_e->Fill(j,vec[1][j][4]);
850     shift6_e->Fill(j,vec[1][j][5]);
851     shift7_e->Fill(j,vec[1][j][6]);
852     shift8_e->Fill(j,vec[1][j][7]);
853     shift9_e->Fill(j,vec[1][j][8]);
854     shift10_e->Fill(j,vec[1][j][9]);
855     shift11_e->Fill(j,vec[1][j][10]);
856     shift12_e->Fill(j,vec[1][j][11]);
857     shift13_e->Fill(j,vec[1][j][12]);
858     shift14_e->Fill(j,vec[1][j][13]);
859     shift15_e->Fill(j,vec[1][j][14]);
860     shift16_e->Fill(j,vec[1][j][15]);
861     }
862     }
863    
864    
865    
866    
867     if(((ace->CRCcheck[0])==1) && (ace->CRC[0]!=0)){
868     if((Header[0][0] != 0xACAC) || (Header[0][1] != 0xAC11)){
869     head_m->Fill(1.,1);
870     headerr_m->Fill(i,Trigger[0]);}
871     if((Status[0] & 0x8000) < 0x8000){
872     head_m->Fill(2.,1);
873     crcerr_m->Fill(i,Trigger[0]);}
874     if((Status[0] & 0x4000) < 0x4000){
875     head_m->Fill(3.,1);
876     dsperr_m->Fill(i,Trigger[0]);}
877     if((Status[0] & 0x01FF) < 0x01FF){
878     head_m->Fill(4.,1);
879     regerr_m->Fill(i,Trigger[0]);}
880     T_right_m->Fill(i,Temp[0][0]*2.8-273.);
881     T_actel_m->Fill(i,Temp[0][1]*2.8-273.);
882     T_dsp_m->Fill(i,Temp[0][2]*2.8-273.);
883     T_left_m->Fill(i,Temp[0][3]*2.8-273.);
884     trigg_m->Fill(i,Trigger[0]);
885     dtrigg_m->Fill(Trigger[0]-Trigg_old[0],Trigg_old[0] == -1 ? 0 : 1);
886     Trigg_old[0]=Trigger[0];
887     timebtrigg_m->Fill(tid3[0],1.);
888    
889    
890     if(DEBUG)
891     printf("Calculate rates\n");
892     if(i!=minevent){
893     //fill histograms MAIN
894     if(rate10cnt[0][0]==cntmltp){
895     counter1_m->Fill(rate10[0][0]/10.,1);
896     //printf("rate :%d\n",rate10[0][0]);
897     rate10cnt[0][0]=0;
898     rate10[0][0]=0;
899     }
900     if(rate10cnt[0][1]==cntmltp){
901     counter2_m->Fill(rate10[0][1]/10.,1);
902     rate10cnt[0][1]=0;
903     rate10[0][1]=0;
904     }
905     if(rate10cnt[0][2]==cntmltp){
906     counter3_m->Fill(rate10[0][2]/10.,1);
907     rate10cnt[0][2]=0;
908     rate10[0][2]=0;
909     }
910     if(rate10cnt[0][3]==cntmltp){
911     counter4_m->Fill(rate10[0][3]/10.,1);
912     rate10cnt[0][3]=0;
913     rate10[0][3]=0;
914     }
915     if(rate10cnt[0][4]==cntmltp){
916     counter5_m->Fill(rate10[0][4]/10.,1);
917     rate10cnt[0][4]=0;
918     rate10[0][4]=0;
919     }
920     if(rate10cnt[0][5]==cntmltp){
921     counter6_m->Fill(rate10[0][5]/10.,1);
922     rate10cnt[0][5]=0;
923     rate10[0][5]=0;
924     }
925     if(rate10cnt[0][6]==cntmltp){
926     counter7_m->Fill(rate10[0][6]/10.,1);
927     rate10cnt[0][6]=0;
928     rate10[0][6]=0;
929     }
930     if(rate10cnt[0][7]==cntmltp){
931     counter8_m->Fill(rate10[0][7]/10.,1);
932     rate10cnt[0][7]=0;
933     rate10[0][7]=0;
934     }
935     if(rate10cnt[0][8]==cntmltp){
936     counter9_m->Fill(rate10[0][8]/10.,1);
937     rate10cnt[0][8]=0;
938     rate10[0][8]=0;
939     }
940     if(rate10cnt[0][9]==cntmltp){
941     counter10_m->Fill(rate10[0][9]/10.,1);
942     rate10cnt[0][9]=0;
943     rate10[0][9]=0;
944     }
945     if(rate10cnt[0][10]==cntmltp){
946     counter11_m->Fill(rate10[0][10]/10.,1);
947     rate10cnt[0][10]=0;
948     rate10[0][10]=0;
949     }
950     if(rate10cnt[0][11]==cntmltp){
951     counter12_m->Fill(rate10[0][11]/10.,1);
952     rate10cnt[0][11]=0;
953     rate10[0][11]=0;
954     }
955     if(rate10cnt[0][12]==cntmltp){
956     counter13_m->Fill(rate10[0][12]/10.,1);
957     rate10cnt[0][12]=0;
958     rate10[0][12]=0;
959     }
960     if(rate10cnt[0][13]==cntmltp){
961     counter14_m->Fill(rate10[0][13]/10.,1);
962     rate10cnt[0][13]=0;
963     rate10[0][13]=0;
964     }
965     if(rate10cnt[0][14]==cntmltp){
966     counter15_m->Fill(rate10[0][14]/10.,1);
967     rate10cnt[0][14]=0;
968     rate10[0][14]=0;
969     }
970     if(rate10cnt[0][15]==cntmltp){
971     counter16_m->Fill(rate10[0][15]/10,1);
972     rate10cnt[0][15]=0;
973     rate10[0][15]=0;
974     }
975    
976     }
977     }
978     //fill histograms EXTRA
979     if(((ace->CRCcheck[1])==1) && (ace->CRC[1]!=0)){
980     if((Header[1][0] != 0xACAC) || (Header[1][1] != 0xAC22)){
981     head_e->Fill(6.,1);
982     headerr_e->Fill(i,Trigger[1]);
983     //headerr_e->Fill(i,testtrigg);
984     //cout << "i: " << i << " Trigger: " << Trigger[1] << endl;
985     }
986     if((Status[1] & 0x8000) < 0x8000){
987     head_e->Fill(7.,1);
988     crcerr_e->Fill(i,Trigger[1]);}
989     if((Status[1] & 0x4000) < 0x4000){
990     head_e->Fill(8.,1);
991     dsperr_e->Fill(i,Trigger[1]);}
992     if((Status[1] & 0x01FF) < 0x01FF){
993     head_e->Fill(9.,1);
994     regerr_e->Fill(i,Trigger[1]);}
995     T_right_e->Fill(i,Temp[1][0]*2.8-273.);
996     T_actel_e->Fill(i,Temp[1][1]*2.8-273.);
997     T_dsp_e->Fill(i,Temp[1][2]*2.8-273.);
998     T_left_e->Fill(i,Temp[1][3]*2.8-273.);
999     trigg_e->Fill(i,Trigger[1]);
1000     dtrigg_e->Fill(Trigger[1]-Trigg_old[1],Trigg_old[1] == -1 ? 0 : 1);
1001     Trigg_old[1]=Trigger[1];
1002     timebtrigg_e->Fill(tid3[1],1.);
1003    
1004     if(i!=minevent){
1005     //fill histograms EXTRA
1006     if(rate10cnt[1][0]==cntmltp){
1007     counter1_e->Fill(rate10[1][0]/10.,1);
1008     //printf("rate :%d\n",rate10[1][0]);
1009     rate10cnt[1][0]=0;
1010     rate10[1][0]=0;
1011     }
1012     if(rate10cnt[1][1]==cntmltp){
1013     counter2_e->Fill(rate10[1][1]/10.,1);
1014     rate10cnt[1][1]=0;
1015     rate10[1][1]=0;
1016     }
1017     if(rate10cnt[1][2]==cntmltp){
1018     counter3_e->Fill(rate10[1][2]/10.,1);
1019     rate10cnt[1][2]=0;
1020     rate10[1][2]=0;
1021     }
1022     if(rate10cnt[1][3]==cntmltp){
1023     counter4_e->Fill(rate10[1][3]/10.,1);
1024     rate10cnt[1][3]=0;
1025     rate10[1][3]=0;
1026     }
1027     if(rate10cnt[1][4]==cntmltp){
1028     counter5_e->Fill(rate10[1][4]/10.,1);
1029     rate10cnt[1][4]=0;
1030     rate10[1][4]=0;
1031     }
1032     if(rate10cnt[1][5]==cntmltp){
1033     counter6_e->Fill(rate10[1][5]/10.,1);
1034     rate10cnt[1][5]=0;
1035     rate10[1][5]=0;
1036     }
1037     if(rate10cnt[1][6]==cntmltp){
1038     counter7_e->Fill(rate10[1][6]/10.,1);
1039     rate10cnt[1][6]=0;
1040     rate10[1][6]=0;
1041     }
1042     if(rate10cnt[1][7]==cntmltp){
1043     counter8_e->Fill(rate10[1][7]/10.,1);
1044     rate10cnt[1][7]=0;
1045     rate10[1][7]=0;
1046     }
1047     if(rate10cnt[1][8]==cntmltp){
1048     counter9_e->Fill(rate10[1][8]/10.,1);
1049     rate10cnt[1][8]=0;
1050     rate10[1][8]=0;
1051     }
1052     if(rate10cnt[1][9]==cntmltp){
1053     counter10_e->Fill(rate10[1][9]/10.,1);
1054     rate10cnt[1][9]=0;
1055     rate10[1][9]=0;
1056     }
1057     if(rate10cnt[1][10]==cntmltp){
1058     counter11_e->Fill(rate10[1][10]/10.,1);
1059     rate10cnt[1][10]=0;
1060     rate10[1][10]=0;
1061     }
1062     if(rate10cnt[1][11]==cntmltp){
1063     counter12_e->Fill(rate10[1][11]/10.,1);
1064     rate10cnt[1][11]=0;
1065     rate10[1][11]=0;
1066     }
1067     if(rate10cnt[1][12]==cntmltp){
1068     counter13_e->Fill(rate10[1][12]/10.,1);
1069     rate10cnt[1][12]=0;
1070     rate10[1][12]=0;
1071     }
1072     if(rate10cnt[1][13]==cntmltp){
1073     counter14_e->Fill(rate10[1][13]/10.,1);
1074     rate10cnt[1][13]=0;
1075     rate10[1][13]=0;
1076     }
1077     if(rate10cnt[1][14]==cntmltp){
1078     counter15_e->Fill(rate10[1][14]/10.,1);
1079     rate10cnt[1][14]=0;
1080     rate10[1][14]=0;
1081     }
1082     if(rate10cnt[1][15]==cntmltp){
1083     counter16_e->Fill(rate10[1][15]/10,1);
1084     rate10cnt[1][15]=0;
1085     rate10[1][15]=0;
1086     }
1087     }
1088     }
1089     cnt=1;
1090     for(Int_t j = 0; j < 16; j++){
1091     if((ace->CRCcheck[0])==1)
1092     hitmap_m->Fill(j,(Hitmap[0] & cnt)>0 ? 1 : 0);
1093     if((ace->CRCcheck[1])==1)
1094     hitmap_e->Fill(j,(Hitmap[1] & cnt)>0 ? 1 : 0);
1095     cnt=cnt<<1;
1096     }
1097    
1098     cnt=1;
1099     /*
1100     if((100*(i-minevent)/(maxevent-minevent))<10.)
1101     printf("%c%c",8,8);
1102     else
1103     printf("%c%c%c",8,8,8);
1104     */
1105     }
1106     }
1107    
1108     if(!fullversion)
1109     {
1110     if(DEBUG)
1111     printf("Start looping over events (DUMMY VERSION)\n");
1112     for (Int_t i = minevent; i < maxevent; i++){
1113     //printf("1");
1114     //printf("%d%c",100*(i-minevent)/(maxevent-minevent),37);
1115     //printf("2");
1116     //fflush(stdout);
1117     ph = eh->GetPscuHeader();
1118     cputime = ph->GetOrbitalTime();
1119     if(DEBUG)
1120     printf("Processing event %d\n",i);
1121     tr->GetEntry(i);
1122    
1123     totevents=totevents+1;
1124    
1125     //CRC check
1126     CRCcheck[0]=ace->CRCcheck[0];
1127     CRCcheck[1]=ace->CRCcheck[1];
1128     if(CRCcheck[0]==0)
1129     {
1130     head_m->Fill(0.0);
1131     crcevents[0]++;
1132     }
1133     if(CRCcheck[1]==0)
1134     {
1135     head_e->Fill(5.0);
1136     crcevents[1]++;
1137     }
1138    
1139     //fetch parameters
1140     for(int b = 0; b<2; b++){
1141     Status[b] = ace->status[b];
1142     for(Int_t j = 0; j < 6; j++)
1143     Reg[b][j] = ace->regist[b][j];
1144     Header[b][0] = ace->header[b][0];
1145     Header[b][1] = ace->header[b][1];
1146     Hitmap[b] = ace->hitmap[b];
1147     }
1148    
1149     hitsCAS=hitsCAT=hitsCARD=0;
1150     for(int b=0;b<2;b++)
1151     {
1152     if((Hitmap[b] & 0x0001) > 0) hitsCARD++;
1153     if((Hitmap[b] & 0x0002) > 0) hitsCAT++;
1154     if((Hitmap[b] & 0x0004) > 0) hitsCAS++;
1155     if((Hitmap[b] & 0x0010) > 0) hitsCARD++;
1156     if((Hitmap[b] & 0x0020) > 0) hitsCAT++;
1157     if((Hitmap[b] & 0x0040) > 0) hitsCAS++;
1158     if((Hitmap[b] & 0x0100) > 0) hitsCARD++;
1159     if((Hitmap[b] & 0x0200) > 0) hitsCAT++;
1160     if((Hitmap[b] & 0x0400) > 0) hitsCAS++;
1161     if((Hitmap[b] & 0x1000) > 0) hitsCARD++;
1162     if((Hitmap[b] & 0x2000) > 0) hitsCAT++;
1163     if((Hitmap[b] & 0x4000) > 0) hitsCAS++;
1164     }
1165    
1166     if(((ace->CRCcheck[0])==1) && (ace->CRC[0]!=0)){
1167     if((Header[0][0] != 0xACAC) || (Header[0][1] != 0xAC11)){
1168     head_m->Fill(1.,1);
1169     headerr_m->Fill(i,Trigger[0]);}
1170     if((Status[0] & 0x8000) < 0x8000){
1171     head_m->Fill(2.,1);
1172     crcerr_m->Fill(i,Trigger[0]);}
1173     if((Status[0] & 0x4000) < 0x4000){
1174     head_m->Fill(3.,1);
1175     dsperr_m->Fill(i,Trigger[0]);}
1176     if((Status[0] & 0x01FF) < 0x01FF){
1177     head_m->Fill(4.,1);
1178     regerr_m->Fill(i,Trigger[0]);}
1179     }
1180    
1181     //fill histograms EXTRA
1182     if(((ace->CRCcheck[1])==1) && (ace->CRC[1]!=0)){
1183     if((Header[1][0] != 0xACAC) || (Header[1][1] != 0xAC22)){
1184     head_e->Fill(6.,1);
1185     headerr_e->Fill(i,Trigger[1]);
1186     //headerr_e->Fill(i,testtrigg);
1187     //cout << "i: " << i << " Trigger: " << Trigger[1] << endl;
1188     }
1189     if((Status[1] & 0x8000) < 0x8000){
1190     head_e->Fill(7.,1);
1191     crcerr_e->Fill(i,Trigger[1]);}
1192     if((Status[1] & 0x4000) < 0x4000){
1193     head_e->Fill(8.,1);
1194     dsperr_e->Fill(i,Trigger[1]);}
1195     if((Status[1] & 0x01FF) < 0x01FF){
1196     head_e->Fill(9.,1);
1197     regerr_e->Fill(i,Trigger[1]);}
1198    
1199     cnt=1;
1200     for(Int_t j = 0; j < 16; j++){
1201     if((ace->CRCcheck[0])==1)
1202     hitmap_m->Fill(j,(Hitmap[0] & cnt)>0 ? 1 : 0);
1203     if((ace->CRCcheck[1])==1)
1204     hitmap_e->Fill(j,(Hitmap[1] & cnt)>0 ? 1 : 0);
1205     cnt=cnt<<1;
1206     }
1207    
1208     cnt=1;
1209     }
1210     }
1211     }
1212    
1213     //printf("%d%c\n",100,37);
1214     //fflush(stdout);
1215     //printf("\n********* QLOOK SHORT INFO **********\n\n");
1216     //printf("Events: %d\nCrc Main %d\nCrc Extra: %d\n",totevents,crcevents[0],crcevents[1]);
1217     //printf("Calibrations: %d\n",nCalibs);
1218     //printf("\n**************************************\n");
1219     //printf("\nOpening canvases...\n");
1220     //cout << "hits: " << what << endl;
1221     //Draw histograms
1222     //gStyle->SetPalette(1);
1223    
1224     if(DEBUG)
1225     printf("Start plotting\n");
1226    
1227     /***************************************** PLOTTING *****************************************/
1228    
1229     //Variables
1230     TCanvas *Canv_report1,*Canv_report2,*Canv_report3,*Canv_report4;
1231     TLatex *t;
1232     TPad *pd1,*pd2,*pd3,*pd4,*pd5,*pd6,*pd7,*pd8,*pd9,*pd10,*pd11,*pd12;
1233     TLine *linje;
1234     TLegend *leg_m,*leg_e,*leg1_m;
1235     Int_t i;
1236     Double_t max1,max2;
1237     char *namn = "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK";
1238     int mposition = 80;
1239     int eposition = 80;
1240     char *figsave = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
1241     char *mystring = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD";
1242     //char *tmpchar = "JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ";
1243     TBox *b1,*b2,*b3,*b4,*b5;
1244     gStyle->SetOptDate(0);
1245     TString *merr = new TString[5];
1246     merr[0]="Event CRC";
1247     merr[1]="Headers";
1248     merr[2]="CRC";
1249     merr[3]="Dsp";
1250     merr[4]="Reg";
1251    
1252     if(!fullversion)
1253     {
1254     Canv_report1 = new TCanvas("QL Report Sheet 1","QL Report Sheet 1", 1280, 1024); //base
1255     Canv_report1->Range(0,0,100,100);
1256     //Canv_report1->Divide(2,2);
1257     Canv_report1->Draw();
1258     b1 = new TBox(10,84.5,90,85.5);
1259     b2 = new TBox(49.5,95,50.5,5);
1260     b1->SetFillColor(1);
1261     b2->SetFillColor(1);
1262     b1->Draw();
1263     b2->Draw();
1264    
1265    
1266     t=new TLatex();
1267     t->SetTextFont(40);
1268     t->SetTextColor(1);
1269     t->SetTextAlign(12);
1270     t->SetTextSize(0.04);
1271     namn = "AntiCounter MAIN card";
1272     t->DrawLatex(10,90,namn);
1273     t->SetTextColor(1);
1274     namn = "AntiCounter EXTRA card";
1275     t->DrawLatex(58,90,namn);
1276     t->SetTextSize(0.025);
1277     //Canv_report1->cd(1);
1278     for(i=1;i<17;i++)
1279     {
1280     if(i!=4 && i!=8 && i!=12 && i!=16 && hitmap_m->GetBinContent(i)==0){
1281     mystring = Form("%s channel empty",mtitel[i-1].Data());
1282     t->SetTextColor(2);
1283     t->DrawLatex(15,mposition,mystring);
1284     mposition -= 4;
1285     }
1286     if(i!=4 && i!=8 && i!=12 && i!=16 && hitmap_e->GetBinContent(i)==0){
1287     mystring = Form("%s channel empty",etitel[i-1].Data());
1288     t->SetTextColor(2);
1289     t->DrawLatex(65,eposition,mystring);
1290     eposition -= 4;
1291     }
1292     }
1293     for(i=0;i<5;i++)
1294     {
1295     if(head_m->GetBinContent(i+1)>0){
1296     mposition -= 4;
1297     mystring = Form("%d %s errors",(int)head_m->GetBinContent(i+1),merr[i].Data());
1298     t->SetTextColor(2);
1299     t->DrawLatex(15,mposition,mystring);
1300     }
1301     if(head_e->GetBinContent(i+5+1)>0){
1302     eposition -= 4;
1303     mystring = Form("%d %s errors",(int)head_e->GetBinContent(i+5+1),merr[i].Data());
1304     t->SetTextColor(2);
1305     t->DrawLatex(65,eposition,mystring);
1306     }
1307     }
1308     //if no errors
1309     if(mposition==80)
1310     {
1311     namn = "AC main working";
1312     t->SetTextSize(0.035);
1313     t->SetTextColor(1);
1314     t->DrawLatex(15,50,namn);
1315     }
1316     if(eposition==80)
1317     {
1318     namn = "AC extra working";
1319     t->SetTextSize(0.035);
1320     t->SetTextColor(1);
1321     t->DrawLatex(65,50,namn);
1322     }
1323     if(mposition!=80 || eposition!=80)
1324     {
1325     namn = "AC malfunction";
1326     t->SetTextSize(0.035);
1327     t->SetTextColor(1);
1328     t->DrawLatex(41.5,97.3,namn);
1329     b3 = new TBox(10,96,40,98.5);
1330     b4 = new TBox(10,1.5,90,4);
1331     b5 = new TBox(60,96,90,98.5);
1332     b3->SetFillColor(2);
1333     b4->SetFillColor(2);
1334     b5->SetFillColor(2);
1335     b3->Draw();
1336     b4->Draw();
1337     b5->Draw();
1338     }
1339     //head_m->Draw();
1340     //head_e->Draw("SAME");
1341     //Canv_report1->cd(3);
1342     //hitmap_m->SetStats(kFALSE);
1343     //hitmap_m->Draw();
1344     //Canv_report1->cd(4);
1345     //hitmap_e->SetStats(kFALSE);
1346     //hitmap_e->Draw();
1347    
1348     }
1349     if(fullversion)
1350     {
1351     //Anticounter report sheet 1
1352     Canv_report1 = new TCanvas("QL Report Sheet 1","QL Report Sheet 1", 1280, 1024); //base
1353     Canv_report1->Range(0,0,100,100);
1354     //tsf = (TSystemFile*)AcList->First();
1355    
1356     //sprintf(error,"File: %s ",tsf->GetName());
1357     //printf("A3\n");
1358     t=new TLatex();
1359     t->SetTextFont(32);
1360     t->SetTextColor(1);
1361     t->SetTextAlign(12);
1362     t->SetTextSize(0.015);
1363     //t->DrawLatex(2.,99.,error);
1364     t->SetTextSize(0.02);
1365     namn = "MAIN";
1366     t->DrawLatex(82,99,namn);
1367     t->SetTextColor(2);
1368     namn="EXTRA";
1369     t->DrawLatex(89,99,namn);
1370     t->SetTextColor(1);
1371     pd1 = new TPad("pd1","This is pad1",0.02,0.02,0.49,0.49,17); //lower left
1372     pd2 = new TPad("pd2","This is pad2",0.51,0.02,0.98,0.49,17); //lower right
1373     //pd3 = new TPad("pd3","This is pad3",0.51,0.51,0.98,0.74,17); //upper-lower right
1374     pd4 = new TPad("pd4","This is pad4",0.02,0.51,0.49,0.98,17); //upper left
1375     //pd5 = new TPad("pd5","This is pad5",0.51,0.25,0.98,0.49,17); //lower-upper right
1376     pd3 = new TPad("pd3","This is pad3",0.51,0.51,0.98,0.98,17); //upper right
1377    
1378     Canv_report1->cd();
1379     //pd1->Range(0,0,100,100);
1380     //pd2->Range(0,0,100,100);
1381     //pd3->Range(0,0,100,100);
1382     //pd4->Range(0,0,100,100);
1383     //pd5->Range(0,0,100,100);
1384     //pd6->Range(0,0,100,100);
1385     pd1->Draw();
1386     pd2->Draw();
1387     pd3->Draw();
1388     pd4->Draw();
1389     //pd5->Draw();
1390     //pd6->Draw();
1391    
1392     pd3->cd(); //upper right
1393     if(head_m->GetMaximum()>head_e->GetMaximum())
1394     head_m->SetMaximum(1.1*head_m->GetMaximum());
1395     else
1396     head_m->SetMaximum(1.1*head_e->GetMaximum());
1397     head_m->SetLineColor(1);
1398     head_m->SetStats(kFALSE);
1399     head_m->Draw();
1400     head_e->SetLineColor(2);
1401     head_e->Draw("SAME");
1402     linje = new TLine(50,0,0,100);
1403     linje->SetLineColor(1);
1404     linje->Draw("SAME");
1405    
1406    
1407     //pmtstatus_m->SetLineColor(1);
1408     //pmtstatus_m->Draw();
1409     //hitmap_e->SetLineColor(2);
1410     //hitmap_e->Draw("SAME");
1411    
1412     pd4->cd(); //lower right
1413     hitmap_m->SetLineColor(1);
1414     hitmap_m->SetStats(kFALSE);
1415     hitmap_m->Draw();
1416    
1417     //pd5->cd(); //lower-upper right
1418     hitmap_e->SetLineColor(2);
1419     hitmap_e->SetStats(kFALSE);
1420     hitmap_e->Draw("SAME");
1421    
1422     pd1->cd();
1423     T_right_m->SetLineColor(1);
1424     T_right_m->SetStats(kFALSE);
1425     T_right_m->Draw();
1426     T_actel_m->SetLineColor(2);
1427     T_actel_m->Draw("SAME");
1428     T_dsp_m->SetLineColor(3);
1429     T_dsp_m->Draw("SAME");
1430     T_left_m->SetLineColor(4);
1431     T_left_m->Draw("SAME");
1432    
1433     leg_m = new TLegend(0.78,0.63,0.9,0.8);
1434     leg_m->AddEntry(T_right_m,"Right","l");
1435     leg_m->AddEntry(T_actel_m,"Actel","l");
1436     leg_m->AddEntry(T_dsp_m,"Dsp","l");
1437     leg_m->AddEntry(T_left_m,"Left","l");
1438     leg_m->Draw();
1439    
1440    
1441     //pd2->cd();
1442     //pmtstatus_e->SetLineColor(1);
1443     //pmtstatus_e->Draw();
1444     //TGraph *gr1 = new TGraph(antal,hits_x,hits_y_m);
1445     //gr1->Draw("AC*");
1446    
1447     pd2->cd();
1448     T_right_e->SetLineColor(1);
1449     T_right_e->SetStats(kFALSE);
1450     T_right_e->Draw();
1451     T_actel_e->SetLineColor(2);
1452     T_actel_e->Draw("SAME");
1453     T_dsp_e->SetLineColor(3);
1454     T_dsp_e->Draw("SAME");
1455     T_left_e->SetLineColor(4);
1456     T_left_e->Draw("SAME");
1457    
1458     leg_e = new TLegend(0.78,0.63,0.9,0.8);
1459     leg_e->AddEntry(T_right_e,"Right","l");
1460     leg_e->AddEntry(T_actel_e,"Actel","l");
1461     leg_e->AddEntry(T_dsp_e,"Dsp","l");
1462     leg_e->AddEntry(T_left_e,"Left","l");
1463     leg_e->Draw();
1464    
1465     //pd6->cd(); //upper-upper right
1466     //hitmap_m->SetLineColor(1);
1467     //hitmap_m->Draw();
1468    
1469     /*
1470     TA INTE MED
1471     pd4->cd();
1472     T_right_m->SetLineColor(1);
1473     T_right_m->Draw();
1474     T_actel_m->SetLineColor(1);
1475     T_actel_m->Draw("SAME");
1476     //T_dsp_m->SetLineColor(1);
1477     //T_dsp_m->Draw("SAME");
1478     T_left_m->SetLineColor(1);
1479     T_left_m->Draw("SAME");
1480     T_right_e->SetLineColor(2);
1481     T_right_e->Draw("SAME");
1482     T_actel_e->SetLineColor(2);
1483     T_actel_e->Draw("SAME");
1484     //T_dsp_e->SetLineColor(2);
1485     //T_dsp_e->Draw("SAME");
1486     T_left_e->SetLineColor(2);
1487     T_left_e->Draw("SAME");
1488     */
1489     //Canv_report1->Update();
1490    
1491     //report sheet 2
1492     //ps->NewPage();
1493     Canv_report2 = new TCanvas("QL Report Sheet 2","QL Report Sheet 2", 1280, 1024);
1494     Canv_report2->Range(0,0,100,100);
1495     //tsf = (TSystemFile*)AcList->First();
1496     //sprintf(error,"File: %s ",tsf->GetName());
1497     //TLatex *t=new TLatex();
1498     t->SetTextFont(32);
1499     t->SetTextColor(1);
1500     t->SetTextAlign(12);
1501     t->SetTextSize(0.015);
1502     //t->DrawLatex(2.,99.,error);
1503     t->SetTextSize(0.02);
1504     namn="MAIN";
1505     t->DrawLatex(82,99,namn);
1506     t->SetTextColor(2);
1507     namn="EXTRA";
1508     t->DrawLatex(89,99,namn);
1509     t->SetTextColor(1);
1510     //TPad *pd1,*pd2,*pd3,*pd4,*pd5,*pd6,*pd7;
1511     pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.98,17);
1512     pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.98,17);
1513     pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.49,17);
1514     pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.74,0.24,17); //down-left
1515     pd5 = new TPad("pd5","This is pad5",0.76,0.02,0.98,0.24,17); //down-right
1516     pd6 = new TPad("pd6","This is pad6",0.51,0.24,0.74,0.49,17); //up-left
1517     pd7 = new TPad("pd7","This is pad7",0.76,0.24,0.98,0.49,17); //up-right
1518     Canv_report2->cd();
1519     //pd1->Range(0,0,100,100);
1520     //pd2->Range(0,0,100,100);
1521     //pd3->Range(0,0,100,100);
1522     //pd4->Range(0,0,100,100);
1523     //pd5->Range(0,0,100,100);
1524     //pd6->Range(0,0,100,100);
1525     //pd7->Range(0,0,100,100);
1526     pd1->Draw();
1527     pd2->Draw();
1528     pd3->Draw();
1529     pd4->Draw();
1530     pd5->Draw();
1531     pd6->Draw();
1532     pd7->Draw();
1533    
1534     max1 = trigg_m->GetMaximum();
1535     max2 = trigg_e->GetMaximum();
1536     if(max1>max2)
1537     trigg_m->SetMaximum(1.03*max1);
1538     else
1539     trigg_m->SetMaximum(1.03*max2);
1540    
1541     pd1->cd(); //lower left
1542     trigg_m->SetLineColor(1);
1543     trigg_m->SetStats(kFALSE);
1544     trigg_m->Draw();
1545    
1546     crc_m->SetMarkerStyle(22);
1547     crc_m->SetMarkerSize(1.);
1548     crc_m->SetMarkerColor(9);
1549     crc_m->Draw("SAMEP");
1550    
1551     headerr_m->SetMarkerStyle(5);
1552     headerr_m->SetMarkerSize(1.);
1553     headerr_m->SetMarkerColor(9);
1554     headerr_m->Draw("SAMEP");
1555    
1556     crcerr_m->SetMarkerStyle(2);
1557     crcerr_m->SetMarkerSize(1.);
1558     crcerr_m->SetMarkerColor(9);
1559     crcerr_m->Draw("SAMEP");
1560    
1561     dsperr_m->SetMarkerStyle(7);
1562     dsperr_m->SetMarkerSize(1.);
1563     dsperr_m->SetMarkerColor(9);
1564     dsperr_m->Draw("SAMEP");
1565    
1566     regerr_m->SetMarkerStyle(4);
1567     regerr_m->SetMarkerSize(1.);
1568     regerr_m->SetMarkerColor(9);
1569     regerr_m->Draw("SAMEP");
1570    
1571     leg1_m = new TLegend(0.7,0.5,0.87,0.7);
1572     leg1_m->AddEntry(crc_m,"CRC","p");
1573     leg1_m->AddEntry(headerr_m,"Headers","p");
1574     leg1_m->AddEntry(crcerr_m,"Cmd CRC","p");
1575     leg1_m->AddEntry(dsperr_m,"Dsp","p");
1576     leg1_m->AddEntry(regerr_m,"Reg","p");
1577     leg1_m->SetHeader("ERRORS");
1578     leg1_m->Draw();
1579    
1580     //Canv_report1->Update();
1581    
1582     trigg_e->SetLineColor(2);
1583     //trigg_e->SetMaximum(1.03*trigg_e->GetMaximum());
1584     trigg_e->SetStats(kFALSE);
1585     trigg_e->Draw("SAME");
1586    
1587     //TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(),gPad->GetUymax(),0,rightmax,510,"+L");
1588     //axis->SetLineColor(2);
1589     //axis->Draw();
1590    
1591     crc_e->SetMarkerStyle(22);
1592     crc_e->SetMarkerSize(1.);
1593     crc_e->SetMarkerColor(9);
1594     crc_e->Draw("SAMEP");
1595    
1596     headerr_e->SetMarkerStyle(5);
1597     headerr_e->SetMarkerSize(1.);
1598     headerr_e->SetMarkerColor(9);
1599     headerr_e->Draw("SAMEP");
1600    
1601     crcerr_e->SetMarkerStyle(2);
1602     crcerr_e->SetMarkerSize(1.);
1603     crcerr_e->SetMarkerColor(9);
1604     crcerr_e->Draw("SAMEP");
1605    
1606     dsperr_e->SetMarkerStyle(7);
1607     dsperr_e->SetMarkerSize(1.);
1608     dsperr_e->SetMarkerColor(9);
1609     dsperr_e->Draw("SAMEP");
1610    
1611     regerr_e->SetMarkerStyle(4);
1612     regerr_e->SetMarkerSize(1.);
1613     regerr_e->SetMarkerColor(9);
1614     regerr_e->Draw("SAMEP");
1615     /*
1616     TLegend *leg1_e = new TLegend(0.7,0.5,0.87,0.7);
1617     leg1_e->AddEntry(crc_e,"CRC","p");
1618     leg1_e->AddEntry(headerr_e,"Headers","p");
1619     leg1_e->AddEntry(crcerr_e,"Cmd CRC","p");
1620     leg1_e->AddEntry(dsperr_e,"Dsp","p");
1621     leg1_e->AddEntry(regerr_e,"Reg","p");
1622     leg1_e->SetHeader("Errors EXTRA");
1623     leg1_e->Draw();
1624     */
1625     /*
1626     pd4->cd(); //upper left
1627     int max1 = head_m->GetMaximum();
1628     int max2 = head_e->GetMaximum();
1629     if(max1>max2)
1630     head_m->SetMaximum(1.1*max1);
1631     else
1632     head_m->SetMaximum(1.1*max2);
1633    
1634     head_m->SetLineColor(1);
1635     head_m->Draw();
1636     head_e->SetLineColor(2);
1637     head_e->Draw("SAME");
1638     */
1639     /*
1640     pd3->cd(); //upper right
1641     if(head_m->GetMaximum()>head_e->GetMaximum())
1642     head_m->SetMaximum(1.1*head_m->GetMaximum());
1643     else
1644     head_m->SetMaximum(1.1*head_e->GetMaximum());
1645     head_m->SetLineColor(1);
1646     head_m->SetStats(kFALSE);
1647     head_m->Draw();
1648     head_e->SetLineColor(2);
1649     head_e->Draw("SAME");
1650     TLine *linje = new TLine(50,0,0,100);
1651     linje->SetLineColor(1);
1652     linje->Draw("SAME");
1653     */
1654    
1655     pd2->cd();
1656     pd2->SetLogy(1);
1657     dtrigg_m->SetLineColor(1);
1658     dtrigg_m->SetStats(kFALSE);
1659     dtrigg_m->Draw();
1660     dtrigg_e->SetLineColor(2);
1661     dtrigg_e->SetStats(kFALSE);
1662     dtrigg_e->Draw("SAME");
1663    
1664     pd3->cd();
1665     pd3->SetLogy(1);
1666     timebtrigg_m->SetLineColor(1);
1667     //timebtrigg_m->SetStats(kFALSE);
1668     timebtrigg_m->Draw();
1669     timebtrigg_e->SetLineColor(2);
1670     timebtrigg_e->SetMarkerStyle(2);
1671     timebtrigg_e->SetMarkerSize(1.);
1672     timebtrigg_e->SetMarkerColor(2);
1673     //timebtrigg_e->SetPolyMarker(2)
1674     timebtrigg_e->SetStats(kFALSE);
1675     timebtrigg_e->Draw("PSAME");
1676    
1677     pd4->cd();
1678     pd4->SetLogy(1);
1679     nmbhitpmtCAS->SetLineColor(1);
1680     nmbhitpmtCAS->SetStats(kFALSE);
1681     nmbhitpmtCAS->Draw();
1682    
1683     pd7->cd();
1684     pd5->SetLogy(1);
1685     nmbhitpmtCAT->SetLineColor(1);
1686     nmbhitpmtCAT->SetStats(kFALSE);
1687     nmbhitpmtCAT->Draw();
1688    
1689     pd6->cd();
1690     pd6->SetLogy(1);
1691     nmbhitpmtCARD->SetLineColor(1);
1692     nmbhitpmtCARD->SetStats(kFALSE);
1693     nmbhitpmtCARD->Draw();
1694    
1695    
1696     /*
1697     TLegend *hitpmt = new TLegend(0.7,0.5,0.87,0.7);
1698     hitpmt->AddEntry(nmbhitpmtCAS,"CAS","L");
1699     hitpmt->AddEntry(nmbhitpmtCAT,"CAT","L");
1700     hitpmt->AddEntry(nmbhitpmtCARD,"CARD","L");
1701     hitpmt->SetHeader("Detector");
1702     hitpmt->Draw();
1703     */
1704     //pd4->SetLogy(1);
1705     //timebtrigg_e->SetLineColor(2);
1706     //timebtrigg_e->SetStats(kFALSE);
1707     //timebtrigg_e->Draw();
1708    
1709    
1710     //report sheet 3
1711     //report sheet 1
1712     Canv_report3 = new TCanvas("QL Report Sheet 3","QL Report Sheet 3", 1280, 1024);
1713     //TCanvas *Counter_report1 = new TCanvas("COUNTER Report sheet", "COUNTER Report sheet", 1280, 1024);
1714     Canv_report3->Range(0,0,100,100);
1715     //tsf = (TSystemFile*) AcList->First();
1716     //sprintf(error,"File: %s ",tsf->GetName());
1717     //TLatex *t=new TLatex();
1718     t->SetTextFont(32);
1719     t->SetTextColor(1);
1720     t->SetTextAlign(12);
1721     t->SetTextSize(0.015);
1722     //t->DrawLatex(2.,99.,error);
1723     //char *namn;
1724     //TLatex *t2 = new TLatex();
1725     t->SetTextFont(32);
1726     t->SetTextColor(1);
1727     t->SetTextAlign(12);
1728     t->SetTextSize(0.035);
1729    
1730     namn="Singles Counters";
1731     t->DrawLatex(40.,95,namn);
1732     namn="CAS";
1733     t->DrawLatex(4.,95.,namn);
1734     namn="CAT";
1735     t->DrawLatex(4.,65.,namn);
1736     namn="CARD";
1737     t->DrawLatex(4.,34.,namn);
1738    
1739     t->SetTextFont(32);
1740     t->SetTextColor(1);
1741     t->SetTextAlign(12);
1742     t->SetTextSize(0.02);
1743     namn="MAIN";
1744     t->DrawLatex(85,98,namn);
1745     t->SetTextColor(2);
1746     namn="EXTRA";
1747     t->DrawLatex(85,95,namn);
1748     //TPad *pd1,*pd2,*pd3,*pd4,*pd5,*pd6,*pd7,*pd8,*pd9,*pd10,*pd11,*pd12;
1749     pd1 = new TPad("pd1","This is pad1",0.,0.68,0.25,.92);
1750     pd2 = new TPad("pd2","This is pad2",0.25,0.68,0.5,.92);
1751     pd3 = new TPad("pd3","This is pad3",0.5,0.68,0.75,.92);
1752     pd4 = new TPad("pd4","This is pad4",0.75,0.68,1.0,.92);
1753     pd5 = new TPad("pd5","This is pad5",0.,0.37,0.25,0.62);
1754     pd6 = new TPad("pd6","This is pad6",0.25,0.37,.5,0.62);
1755     pd7 = new TPad("pd7","This is pad7",0.5,0.37,0.75,0.62);
1756     pd8 = new TPad("pd8","This is pad8",0.75,0.37,1.0,0.62);
1757     pd9 = new TPad("pd9","This is pad9",0.0,0.06,0.25,0.31);
1758     pd10 = new TPad("pd10","This is pad10",0.25,0.06,.5,0.31);
1759     pd11 = new TPad("pd11","This is pad11",0.5,0.06,0.75,0.31);
1760     pd12 = new TPad("pd12","This is pad12",0.75,0.06,1.,0.31);
1761     //pd13 = new TPad("pd13","This is pad13",0.,0.0,0.25,0.25);
1762     //pd14 = new TPad("pd14","This is pad14",0.25,0.0,.5,0.25);
1763     //pd15 = new TPad("pd15","This is pad15",0.5,0.0,0.75,0.25);
1764     //pd16 = new TPad("pd16","This is pad16",0.75,0.0,1.0,0.25);
1765     Canv_report3->cd();
1766     //pd1->Range(0,0,100,100);
1767     //pd2->Range(0,0,100,100);
1768     //pd3->Range(0,0,100,100);
1769     //pd4->Range(0,0,100,100);
1770     //pd5->Range(0,0,100,100);
1771     //pd6->Range(0,0,100,100);
1772     //pd7->Range(0,0,100,100);
1773     //pd8->Range(0,0,100,100);
1774     //pd9->Range(0,0,100,100);
1775     //pd10->Range(0,0,100,100);
1776     //pd11->Range(0,0,100,100);
1777     //pd12->Range(0,0,100,100);
1778     //pd13->Range(0,0,100,100);
1779     //pd14->Range(0,0,100,100);
1780     //pd15->Range(0,0,100,100);
1781     //pd16->Range(0,0,100,100);
1782     pd1->Draw();
1783     pd2->Draw();
1784     pd3->Draw();
1785     pd4->Draw();
1786     pd5->Draw();
1787     pd6->Draw();
1788     pd7->Draw();
1789     pd8->Draw();
1790     pd9->Draw();
1791     pd10->Draw();
1792     pd11->Draw();
1793     pd12->Draw();
1794     //pd13->Draw();
1795     //pd14->Draw();
1796     //pd15->Draw();
1797     //pd16->Draw();
1798     pd1->cd();
1799     counter3_m->SetLineColor(1);
1800     counter3_m->Draw();
1801     counter3_e->SetLineColor(2);
1802     counter3_e->Draw("SAME");
1803     pd2->cd();
1804     counter15_m->SetLineColor(1);
1805     counter15_m->Draw();
1806     counter15_e->SetLineColor(2);
1807     counter15_e->Draw("SAME");
1808     pd3->cd();
1809     counter11_m->SetLineColor(1);
1810     counter11_m->Draw();
1811     counter11_e->SetLineColor(2);
1812     counter11_e->Draw("SAME");
1813     pd4->cd();
1814     counter7_m->SetLineColor(1);
1815     counter7_m->Draw();
1816     counter7_e->SetLineColor(2);
1817     counter7_e->Draw("SAME");
1818     pd5->cd();
1819     counter14_m->SetLineColor(1);
1820     counter14_m->Draw();
1821     counter14_e->SetLineColor(2);
1822     counter14_e->Draw("SAME");
1823     pd6->cd();
1824     counter2_m->SetLineColor(1);
1825     counter2_m->Draw();
1826     counter2_e->SetLineColor(2);
1827     counter2_e->Draw("SAME");
1828     pd7->cd();
1829     counter3_m->SetLineColor(1);
1830     counter10_m->Draw();
1831     counter10_e->SetLineColor(2);
1832     counter10_e->Draw("SAME");
1833     pd8->cd();
1834     counter6_m->SetLineColor(1);
1835     counter6_m->Draw();
1836     counter6_e->SetLineColor(2);
1837     counter6_e->Draw("SAME");
1838     pd9->cd();
1839     counter13_m->SetLineColor(1);
1840     counter13_m->Draw();
1841     counter13_e->SetLineColor(2);
1842     counter13_e->Draw("SAME");
1843     pd10->cd();
1844     counter5_m->SetLineColor(1);
1845     counter5_m->Draw();
1846     counter5_e->SetLineColor(2);
1847     counter5_e->Draw("SAME");
1848     pd11->cd();
1849     counter9_m->SetLineColor(1);
1850     counter9_m->Draw();
1851     counter9_e->SetLineColor(2);
1852     counter9_e->Draw("SAME");
1853     pd12->cd();
1854     counter1_m->SetLineColor(1);
1855     counter1_m->Draw();
1856     counter1_e->SetLineColor(2);
1857     counter1_e->Draw("SAME");
1858    
1859     //report sheet 4
1860     Canv_report4 = new TCanvas("QL Report sheet 4", "QL Report sheet 4", 1280, 1024);
1861     Canv_report4->Range(0,0,100,100);
1862     //tsf = (TSystemFile*)AcList->First();
1863     //sprintf(error,"File: %s ",tsf->GetName());
1864     //TLatex *t=new TLatex();
1865     t->SetTextFont(32);
1866     t->SetTextColor(1);
1867     t->SetTextAlign(12);
1868     t->SetTextSize(0.015);
1869     //t->DrawLatex(2.,99.,error);
1870     //char *namn;
1871     //TLatex *t2 = new TLatex();
1872     t->SetTextFont(32);
1873     t->SetTextColor(1);
1874     t->SetTextAlign(12);
1875     t->SetTextSize(0.035);
1876    
1877     namn="CAS";
1878     t->DrawLatex(4.,94.,namn);
1879     namn="CAT";
1880     t->DrawLatex(4.,65.,namn);
1881     namn="CARD";
1882     t->DrawLatex(4.,34.,namn);
1883     namn="Shift register content";
1884     t->DrawLatex(39.,95,namn);
1885     t->SetTextFont(32);
1886     t->SetTextColor(1);
1887     t->SetTextAlign(12);
1888     t->SetTextSize(0.02);
1889     namn="MAIN";
1890     t->DrawLatex(85,98,namn);
1891     t->SetTextColor(2);
1892     namn="EXTRA";
1893     t->DrawLatex(85,95,namn);
1894    
1895     //TPad *pd1,*pd2,*pd3,*pd4,*pd5,*pd6,*pd7,*pd8,*pd9,*pd10,*pd11,*pd12;
1896     pd1 = new TPad("pd1","This is pad1",0.,0.68,0.25,.92);
1897     pd2 = new TPad("pd2","This is pad2",0.25,0.68,0.5,.92);
1898     pd3 = new TPad("pd3","This is pad3",0.5,0.68,0.75,.92);
1899     pd4 = new TPad("pd4","This is pad4",0.75,0.68,1.0,.92);
1900     pd5 = new TPad("pd5","This is pad5",0.,0.37,0.25,0.62);
1901     pd6 = new TPad("pd6","This is pad6",0.25,0.37,.5,0.62);
1902     pd7 = new TPad("pd7","This is pad7",0.5,0.37,0.75,0.62);
1903     pd8 = new TPad("pd8","This is pad8",0.75,0.37,1.0,0.62);
1904     pd9 = new TPad("pd9","This is pad9",0.0,0.06,0.25,0.31);
1905     pd10 = new TPad("pd10","This is pad10",0.25,0.06,.5,0.31);
1906     pd11 = new TPad("pd11","This is pad11",0.5,0.06,0.75,0.31);
1907     pd12 = new TPad("pd12","This is pad12",0.75,0.06,1.,0.31);
1908     //pd13 = new TPad("pd13","This is pad13",0.,0.0,0.25,0.25);
1909     //pd14 = new TPad("pd14","This is pad14",0.25,0.0,.5,0.25);
1910     //pd15 = new TPad("pd15","This is pad15",0.5,0.0,0.75,0.25);
1911     //pd16 = new TPad("pd16","This is pad16",0.75,0.0,1.0,0.25);
1912     Canv_report4->cd();
1913     //pd1->Range(0,0,100,100);
1914     pd1->SetLogy(1);
1915     //pd2->Range(0,0,100,100);
1916     pd2->SetLogy(1);
1917     //pd3->Range(0,0,100,100);
1918     pd3->SetLogy(1);
1919     // pd4->Range(0,0,100,100);
1920     pd4->SetLogy(1);
1921     //pd5->Range(0,0,100,100);
1922     pd5->SetLogy(1);
1923     //pd6->Range(0,0,100,100);
1924     pd6->SetLogy(1);
1925     //pd7->Range(0,0,100,100);
1926     pd7->SetLogy(1);
1927     //pd8->Range(0,0,100,100);
1928     pd8->SetLogy(1);
1929     //pd9->Range(0,0,100,100);
1930     pd9->SetLogy(1);
1931     //pd10->Range(0,0,100,100);
1932     pd10->SetLogy(1);
1933     //pd11->Range(0,0,100,100);
1934     pd11->SetLogy(1);
1935     //pd12->Range(0,0,100,100);
1936     pd12->SetLogy(1);
1937     //pd13->Range(0,0,100,100);
1938     //pd14->Range(0,0,100,100);
1939     //pd15->Range(0,0,100,100);
1940     //pd16->Range(0,0,100,100);
1941     pd1->Draw();
1942     pd2->Draw();
1943     pd3->Draw();
1944     pd4->Draw();
1945     pd5->Draw();
1946     pd6->Draw();
1947     pd7->Draw();
1948     pd8->Draw();
1949     pd9->Draw();
1950     pd10->Draw();
1951     pd11->Draw();
1952     pd12->Draw();
1953     //pd13->Draw();
1954     //pd14->Draw();
1955     //pd15->Draw();
1956     //pd16->Draw();
1957     pd1->cd();
1958     shift3_m->SetLineColor(1);
1959     shift3_m->Draw();
1960     shift3_e->SetLineColor(2);
1961     shift3_e->Draw("SAME");
1962     pd2->cd();
1963     shift15_m->SetLineColor(1);
1964     shift15_m->Draw();
1965     shift15_e->SetLineColor(2);
1966     shift15_e->Draw("SAME");
1967     pd3->cd();
1968     shift11_m->SetLineColor(1);
1969     shift11_m->Draw();
1970     shift11_e->SetLineColor(2);
1971     shift11_e->Draw("SAME");
1972     pd4->cd();
1973     shift7_m->SetLineColor(1);
1974     shift7_m->Draw();
1975     shift7_e->SetLineColor(2);
1976     shift7_e->Draw("SAME");
1977     pd5->cd();
1978     shift14_m->SetLineColor(1);
1979     shift14_m->Draw();
1980     shift14_e->SetLineColor(2);
1981     shift14_e->Draw("SAME");
1982     pd6->cd();
1983     shift2_m->SetLineColor(1);
1984     shift2_m->Draw();
1985     shift2_e->SetLineColor(2);
1986     shift2_e->Draw("SAME");
1987     pd7->cd();
1988     shift3_m->SetLineColor(1);
1989     shift10_m->Draw();
1990     shift10_e->SetLineColor(2);
1991     shift10_e->Draw("SAME");
1992     pd8->cd();
1993     shift6_m->SetLineColor(1);
1994     shift6_m->Draw();
1995     shift6_e->SetLineColor(2);
1996     shift6_e->Draw("SAME");
1997     pd9->cd();
1998     shift13_m->SetLineColor(1);
1999     shift13_m->Draw();
2000     shift13_e->SetLineColor(2);
2001     shift13_e->Draw("SAME");
2002     pd10->cd();
2003     shift5_m->SetLineColor(1);
2004     shift5_m->Draw();
2005     shift5_e->SetLineColor(2);
2006     shift5_e->Draw("SAME");
2007     pd11->cd();
2008     shift9_m->SetLineColor(1);
2009     shift9_m->Draw();
2010     shift9_e->SetLineColor(2);
2011     shift9_e->Draw("SAME");
2012     pd12->cd();
2013     shift1_m->SetLineColor(1);
2014     shift1_m->Draw();
2015     shift1_e->SetLineColor(2);
2016     shift1_e->Draw("SAME");
2017     }//if(fullversion)
2018    
2019    
2020     //Name the file
2021     //const string fil = (const char*)fileName;
2022    
2023     //Int_t posiz = fil.find("dw_");
2024     //if ( posiz == -1 ) posiz = fil.find("DW_");
2025     //Int_t posiz2 = posiz+13;
2026     //TString file2;
2027     //stringcopy(file2,base,posiz,posiz2);
2028     //
2029     //const char *figrec = file2;
2030    
2031     //string *outdir = new string(outDir);
2032     //string *Format = new string(format);
2033     //char *figsave = 0;
2034     if(fullversion)
2035     {
2036     figsave = Form("%s/AcQLOOK1_%s.%s",outDir.Data(),fileName.Data(),format.Data());
2037     Canv_report1->SaveAs(figsave);
2038     figsave = Form("%s/AcQLOOK2_%s.%s",outDir.Data(),fileName.Data(),format.Data());
2039     Canv_report2->SaveAs(figsave);
2040     figsave = Form("%s/AcQLOOK3_%s.%s",outDir.Data(),fileName.Data(),format.Data());
2041     Canv_report3->SaveAs(figsave);
2042     figsave = Form("%s/AcQLOOK4_%s.%s",outDir.Data(),fileName.Data(),format.Data());
2043     Canv_report4->SaveAs(figsave);
2044     }
2045     if(!fullversion)
2046     {
2047     figsave = Form("%s/AcQLOOK_%s.%s",outDir.Data(),fileName.Data(),format.Data());
2048     Canv_report1->SaveAs(figsave);
2049     }
2050    
2051     //Delete variables
2052     //delete Canv_report1,Canv_report2,Canv_report3,Canv_report4;
2053     //delete t;
2054     //delete pd1,pd2,pd3,pd4,pd5,pd6,pd7,pd8,pd9,pd10,pd11,pd12;
2055     //delete linje;
2056     //delete leg_m,leg_e,leg1_m;
2057    
2058     //delete nmbhitpmtCAS,nmbhitpmtCAT,nmbhitpmtCARD;
2059     //delete counter1_m,counter2_m,counter3_m,counter4_m,counter5_m,counter6_m,counter7_m,counter8_m,counter9_m,counter10_m,counter11_m,counter12_m,counter13_m,counter14_m,counter15_m,counter16_m;
2060     //delete counter1_e,counter2_e,counter3_e,counter4_e,counter5_e,counter6_e,counter7_e,counter8_e,counter9_e,counter10_e,counter11_e,counter12_e,counter13_e,counter14_e,counter15_e,counter16_e;
2061     //delete shift1_m,shift2_m,shift3_m,shift4_m,shift5_m,shift6_m,shift7_m,shift8_m,shift9_m,shift10_m,shift11_m,shift12_m,shift13_m,shift14_m,shift15_m,shift16_m;
2062     //delete shift1_e,shift2_e,shift3_e,shift4_e,shift5_e,shift6_e,shift7_e,shift8_e,shift9_e,shift10_e,shift11_e,shift12_e,shift13_e,shift14_e,shift15_e,shift16_e;
2063     //delete head_m,head_e,hitmap_m,hitmap_e;
2064     //delete pmtstatus_m,pmtstatus_e;
2065     //delete trigg_m,trigg_e,timebtrigg_m,timebtrigg_e,dtrigg_m,dtrigg_e;
2066     //delete crc_m,headerr_m,crcerr_m,dsperr_m,regerr_m;
2067     //delete crc_e,headerr_e,crcerr_e,dsperr_e,regerr_e;
2068     //delete T_right_m,T_actel_m,T_dsp_m,T_left_m;
2069     //delete T_right_e,T_actel_e,T_dsp_e,T_left_e;
2070     //delete rootFile;
2071     //delete mtitel,etitel;
2072    
2073     return 0;
2074    
2075     }
2076    
2077     int main(int argc, char* argv[]){
2078     TString outDir = ".";
2079     TString format = "jpg";
2080     int from = 0;
2081     int to = 0;
2082     int mode = 0;
2083    
2084     if (argc < 2){
2085     printf("You have to insert at least the file to analyze \n");
2086     printf("Try '--help' for more information. \n");
2087     exit(1);
2088     }
2089    
2090     if (!strcmp(argv[1], "--help")){
2091     printf( "Usage: AcQLOOK FILE [OPTION] \n");
2092     printf( "\t --help Print this help and exit \n");
2093     printf( "\t -outDir[path] Path where to put the output [default ./] \n");
2094     printf( "\t -format[path] Set the format for the output file [default 'jpg']\n");
2095     printf( "\t -from # Set the starting event [default 0]\n");
2096     printf( "\t -to # Set the last event [default 0]\n");
2097     printf( "\t -mode # advanced (1) or dummy (0) mode [default 0]\n");
2098     exit(1);
2099     }
2100    
2101     if (!strcmp(argv[1], "-v")){
2102     printf("Version %.2f\n",VERSION);
2103     exit(1);
2104     }
2105    
2106     for (int i = 2; i < argc; i++){
2107     if (!strcmp(argv[i], "-outDir")){
2108     if (++i >= argc){
2109     printf( "-outDir needs arguments. \n");
2110     printf( "Try '--help' for more information. \n");
2111     exit(1);
2112     } else {
2113     outDir = argv[i];
2114     }
2115     }
2116    
2117     if (!strcmp(argv[i], "-format")) {
2118     if (++i >= argc){
2119     printf( "-format needs arguments. \n");
2120     printf( "Try '--help' for more information. \n");
2121     exit(1);
2122     } else {
2123     format = argv[i];
2124     continue;
2125     }
2126     }
2127    
2128     if (!strcmp(argv[i], "-mode")) {
2129     if (++i >= argc){
2130     printf( "-mode needs arguments. \n");
2131     printf( "Try '--help' for more information. \n");
2132     exit(1);
2133     } else {
2134     mode = atoi(argv[i]);
2135     continue;
2136     }
2137     }
2138    
2139    
2140     if (!strcmp(argv[i], "-to")) {
2141     if (++i >= argc){
2142     printf( "-to needs arguments. \n");
2143     printf( "Try '--help' for more information. \n");
2144     exit(1);
2145     }
2146     if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) {
2147     to = atoi(argv[i]);
2148     } else {
2149     cerr << "-to needs a integer value. \n";
2150     cout << "Try '--help' for more information. \n";
2151     exit(1);
2152     }
2153     }
2154    
2155     if (!strcmp(argv[i], "-from")) {
2156     if (++i >= argc){
2157     printf( "-from needs arguments. \n");
2158     printf( "Try '--help' for more information. \n");
2159     exit(1);
2160     }
2161     if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) {
2162     to = atoi(argv[i]);
2163     } else {
2164     cerr << "-from needs a integer value. \n";
2165     cout << "Try '--help' for more information. \n";
2166     exit(1);
2167     }
2168     }
2169    
2170     }
2171     AcQLOOK(argv[1], from, to, outDir, format,mode);
2172     }

  ViewVC Help
Powered by ViewVC 1.1.23