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

Contents of /flight/src/AcCALIB.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Wed May 17 16:09:42 2006 UTC (18 years, 6 months ago) by pam-se
Branch: MAIN, v1r2
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
First release of the anticounter flight quicklook

1 #include <Calib1_Ac1Event.h>
2 #include <Calib1_Ac2Event.h>
3 #include <Calib2_Ac1Event.h>
4 #include <Calib2_Ac2Event.h>
5 #include <PscuHeader.h>
6 #include <EventHeader.h>
7
8 #include <fstream>
9
10 #include <TCanvas.h>
11 #include <TLatex.h>
12 #include <TLegend.h>
13 #include <TLine.h>
14 #include <TTree.h>
15 #include <TStyle.h>
16 #include <TObjString.h>
17
18 #include <yodaUtility.h>
19 #define DEBUG 0
20
21
22 using namespace std;
23
24 /*
25 * Anticounter calibration quicklook
26 * Plots calibration curves done with LEDs and the extra calibration with random triggers
27 *
28 * author Petter Hofverberg
29 * version 1.0
30 *
31 */
32
33
34 void AcCALIB(TString base, Int_t nCal1 = 0, TString outDir = "./", TString format = "ps"){
35 Int_t tmpSize;
36 ofstream outputFile;
37 stringstream oss;
38
39 pamela::Calib2_Ac1Event *ace1 = 0;
40 pamela::Calib2_Ac2Event *ace2 = 0;
41 pamela::EventHeader *eh = 0;
42 pamela::PscuHeader *ph = 0;
43 TFile *rootFile = new TFile(base);
44
45 if (rootFile->IsZombie()) printf("The %s file does not exist", base.Data());
46 TString fileName = ((TObjString*)base.Tokenize('\/')->Last())->GetString();
47 TString filePath = base;
48 filePath.ReplaceAll(fileName, "");
49 fileName.ReplaceAll(".root", "");
50
51 //Takes the tree of the header file
52 TTree *tr = (TTree*)rootFile->Get("Calib2_Ac1");
53 tr->AddFriend("Calib2_Ac2");
54
55 tr->SetBranchAddress("Calib2_Ac1", &ace1);
56 tr->SetBranchAddress("Calib2_Ac2", &ace2);
57 tr->SetBranchAddress("Header", &eh);
58 Long64_t nevents = tr->GetEntries();
59
60 //cout << "Events: " << nevents << endl;
61 /******************Book histograms**********************************************/
62
63 TString *mtitel = new TString[16];
64 mtitel[0]="CARD 4";
65 mtitel[1]="CAT 2";
66 mtitel[2]="CAS 1";
67 mtitel[3]="NC";
68 mtitel[4]="CARD 2";
69 mtitel[5]="CAT 4";
70 mtitel[6]="CAS 4";
71 mtitel[7]="NC";
72 mtitel[8]="CARD 3";
73 mtitel[9]="CAT 3";
74 mtitel[10]="CAS 3";
75 mtitel[11]="NC";
76 mtitel[12]="CARD 1";
77 mtitel[13]="CAT 1";
78 mtitel[14]="CAS 2";
79 mtitel[15]="NC";
80
81 TString *etitel = new TString[16];
82 etitel[0]="CARD 4";
83 etitel[1]="CAT 2";
84 etitel[2]="CAS 1";
85 etitel[3]="NC";
86 etitel[4]="CARD 2";
87 etitel[5]="CAT 4";
88 etitel[6]="CAS 4";
89 etitel[7]="NC";
90 etitel[8]="CARD 3";
91 etitel[9]="CAT 3";
92 etitel[10]="CAS 3";
93 etitel[11]="NC";
94 etitel[12]="CARD 1";
95 etitel[13]="CAT 1";
96 etitel[14]="CAS 2";
97 etitel[15]="NC";
98
99 TH1D *DAC1_m = new TH1D("DAC values after curve 1 MAIN","DAC values after curve 1 MAIN",16,0,16);
100 DAC1_m->GetXaxis()->SetBinLabel(1,mtitel[0]);
101 DAC1_m->GetXaxis()->SetBinLabel(2,mtitel[1]);
102 DAC1_m->GetXaxis()->SetBinLabel(3,mtitel[2]);
103 DAC1_m->GetXaxis()->SetBinLabel(4,mtitel[3]);
104 DAC1_m->GetXaxis()->SetBinLabel(5,mtitel[4]);
105 DAC1_m->GetXaxis()->SetBinLabel(6,mtitel[5]);
106 DAC1_m->GetXaxis()->SetBinLabel(7,mtitel[6]);
107 DAC1_m->GetXaxis()->SetBinLabel(8,mtitel[7]);
108 DAC1_m->GetXaxis()->SetBinLabel(9,mtitel[8]);
109 DAC1_m->GetXaxis()->SetBinLabel(10,mtitel[9]);
110 DAC1_m->GetXaxis()->SetBinLabel(11,mtitel[10]);
111 DAC1_m->GetXaxis()->SetBinLabel(12,mtitel[11]);
112 DAC1_m->GetXaxis()->SetBinLabel(13,mtitel[12]);
113 DAC1_m->GetXaxis()->SetBinLabel(14,mtitel[13]);
114 DAC1_m->GetXaxis()->SetBinLabel(15,mtitel[14]);
115 DAC1_m->GetXaxis()->SetBinLabel(16,mtitel[15]);
116 DAC1_m->GetYaxis()->SetTitle("Steps");
117
118 TH1D *DAC2_m = new TH1D("DAC values after curve 2 MAIN","DAC values after curve 2 MAIN",16,0,16);
119 DAC2_m->GetXaxis()->SetBinLabel(1,mtitel[0]);
120 DAC2_m->GetXaxis()->SetBinLabel(2,mtitel[1]);
121 DAC2_m->GetXaxis()->SetBinLabel(3,mtitel[2]);
122 DAC2_m->GetXaxis()->SetBinLabel(4,mtitel[3]);
123 DAC2_m->GetXaxis()->SetBinLabel(5,mtitel[4]);
124 DAC2_m->GetXaxis()->SetBinLabel(6,mtitel[5]);
125 DAC2_m->GetXaxis()->SetBinLabel(7,mtitel[6]);
126 DAC2_m->GetXaxis()->SetBinLabel(8,mtitel[7]);
127 DAC2_m->GetXaxis()->SetBinLabel(9,mtitel[8]);
128 DAC2_m->GetXaxis()->SetBinLabel(10,mtitel[9]);
129 DAC2_m->GetXaxis()->SetBinLabel(11,mtitel[10]);
130 DAC2_m->GetXaxis()->SetBinLabel(12,mtitel[11]);
131 DAC2_m->GetXaxis()->SetBinLabel(13,mtitel[12]);
132 DAC2_m->GetXaxis()->SetBinLabel(14,mtitel[13]);
133 DAC2_m->GetXaxis()->SetBinLabel(15,mtitel[14]);
134 DAC2_m->GetXaxis()->SetBinLabel(16,mtitel[15]);
135 DAC2_m->GetYaxis()->SetTitle("Steps");
136
137 TH1D *DAC1_e = new TH1D("DAC values after curve 1 EXTRA","DAC values after curve 1 EXTRA",16,0,16);
138 DAC1_e->GetXaxis()->SetBinLabel(1,mtitel[0]);
139 DAC1_e->GetXaxis()->SetBinLabel(2,mtitel[1]);
140 DAC1_e->GetXaxis()->SetBinLabel(3,mtitel[2]);
141 DAC1_e->GetXaxis()->SetBinLabel(4,mtitel[3]);
142 DAC1_e->GetXaxis()->SetBinLabel(5,mtitel[4]);
143 DAC1_e->GetXaxis()->SetBinLabel(6,mtitel[5]);
144 DAC1_e->GetXaxis()->SetBinLabel(7,mtitel[6]);
145 DAC1_e->GetXaxis()->SetBinLabel(8,mtitel[7]);
146 DAC1_e->GetXaxis()->SetBinLabel(9,mtitel[8]);
147 DAC1_e->GetXaxis()->SetBinLabel(10,mtitel[9]);
148 DAC1_e->GetXaxis()->SetBinLabel(11,mtitel[10]);
149 DAC1_e->GetXaxis()->SetBinLabel(12,mtitel[11]);
150 DAC1_e->GetXaxis()->SetBinLabel(13,mtitel[12]);
151 DAC1_e->GetXaxis()->SetBinLabel(14,mtitel[13]);
152 DAC1_e->GetXaxis()->SetBinLabel(15,mtitel[14]);
153 DAC1_e->GetXaxis()->SetBinLabel(16,mtitel[15]);
154 DAC1_e->GetYaxis()->SetTitle("Steps");
155
156 TH1D *DAC2_e = new TH1D("DAC values after curve 2 EXTRA","DAC values after curve 2 EXTRA",16,0,16);
157 DAC2_e->GetXaxis()->SetBinLabel(1,mtitel[0]);
158 DAC2_e->GetXaxis()->SetBinLabel(2,mtitel[1]);
159 DAC2_e->GetXaxis()->SetBinLabel(3,mtitel[2]);
160 DAC2_e->GetXaxis()->SetBinLabel(4,mtitel[3]);
161 DAC2_e->GetXaxis()->SetBinLabel(5,mtitel[4]);
162 DAC2_e->GetXaxis()->SetBinLabel(6,mtitel[5]);
163 DAC2_e->GetXaxis()->SetBinLabel(7,mtitel[6]);
164 DAC2_e->GetXaxis()->SetBinLabel(8,mtitel[7]);
165 DAC2_e->GetXaxis()->SetBinLabel(9,mtitel[8]);
166 DAC2_e->GetXaxis()->SetBinLabel(10,mtitel[9]);
167 DAC2_e->GetXaxis()->SetBinLabel(11,mtitel[10]);
168 DAC2_e->GetXaxis()->SetBinLabel(12,mtitel[11]);
169 DAC2_e->GetXaxis()->SetBinLabel(13,mtitel[12]);
170 DAC2_e->GetXaxis()->SetBinLabel(14,mtitel[13]);
171 DAC2_e->GetXaxis()->SetBinLabel(15,mtitel[14]);
172 DAC2_e->GetXaxis()->SetBinLabel(16,mtitel[15]);
173 DAC2_e->GetYaxis()->SetTitle("Steps");
174
175 TH1D *DAC1_m2 = new TH1D("DAC values after curve 1 MAIN 2","DAC values after curve 1 MAIN 2",16,0,16);
176 TH1D *DAC2_m2 = new TH1D("DAC values after curve 2 MAIN 2","DAC values after curve 2 MAIN 2",16,0,16);
177 TH1D *DAC1_e2 = new TH1D("DAC values after curve 1 EXTRA 2","DAC values after curve 1 EXTRA 2",16,0,16);
178 TH1D *DAC2_e2 = new TH1D("DAC values after curve 2 EXTRA 2","DAC values after curve 2 EXTRA 2",16,0,16);
179
180 TH1D *Calo_trigg_m = new TH1D("Calo_trigg_hits_m","Hits in each channel at Calorimeter triggers MAIN",17,0.,17.);
181 Calo_trigg_m->GetXaxis()->SetBinLabel(1,"#triggers");
182 Calo_trigg_m->GetXaxis()->SetBinLabel(2,mtitel[0]);
183 Calo_trigg_m->GetXaxis()->SetBinLabel(3,mtitel[1]);
184 Calo_trigg_m->GetXaxis()->SetBinLabel(4,mtitel[2]);
185 Calo_trigg_m->GetXaxis()->SetBinLabel(5,mtitel[3]);
186 Calo_trigg_m->GetXaxis()->SetBinLabel(6,mtitel[4]);
187 Calo_trigg_m->GetXaxis()->SetBinLabel(7,mtitel[5]);
188 Calo_trigg_m->GetXaxis()->SetBinLabel(8,mtitel[6]);
189 Calo_trigg_m->GetXaxis()->SetBinLabel(9,mtitel[7]);
190 Calo_trigg_m->GetXaxis()->SetBinLabel(10,mtitel[8]);
191 Calo_trigg_m->GetXaxis()->SetBinLabel(11,mtitel[9]);
192 Calo_trigg_m->GetXaxis()->SetBinLabel(12,mtitel[10]);
193 Calo_trigg_m->GetXaxis()->SetBinLabel(13,mtitel[11]);
194 Calo_trigg_m->GetXaxis()->SetBinLabel(14,mtitel[12]);
195 Calo_trigg_m->GetXaxis()->SetBinLabel(15,mtitel[13]);
196 Calo_trigg_m->GetXaxis()->SetBinLabel(16,mtitel[14]);
197 Calo_trigg_m->GetXaxis()->SetBinLabel(17,mtitel[15]);
198 Calo_trigg_m->GetYaxis()->SetTitle("Hits");
199
200
201 TH1D *Calo_trigg_e = new TH1D("Calo_trigg_hits_e","Hits in each channel at Calorimeter triggers EXTRA",17,0.,17.);
202 Calo_trigg_e->GetXaxis()->SetBinLabel(1,"#triggers");
203 Calo_trigg_e->GetXaxis()->SetBinLabel(2,etitel[0]);
204 Calo_trigg_e->GetXaxis()->SetBinLabel(3,etitel[1]);
205 Calo_trigg_e->GetXaxis()->SetBinLabel(4,etitel[2]);
206 Calo_trigg_e->GetXaxis()->SetBinLabel(5,etitel[3]);
207 Calo_trigg_e->GetXaxis()->SetBinLabel(6,etitel[4]);
208 Calo_trigg_e->GetXaxis()->SetBinLabel(7,etitel[5]);
209 Calo_trigg_e->GetXaxis()->SetBinLabel(8,etitel[6]);
210 Calo_trigg_e->GetXaxis()->SetBinLabel(9,etitel[7]);
211 Calo_trigg_e->GetXaxis()->SetBinLabel(10,etitel[8]);
212 Calo_trigg_e->GetXaxis()->SetBinLabel(11,etitel[9]);
213 Calo_trigg_e->GetXaxis()->SetBinLabel(12,etitel[10]);
214 Calo_trigg_e->GetXaxis()->SetBinLabel(13,etitel[11]);
215 Calo_trigg_e->GetXaxis()->SetBinLabel(14,etitel[12]);
216 Calo_trigg_e->GetXaxis()->SetBinLabel(15,etitel[13]);
217 Calo_trigg_e->GetXaxis()->SetBinLabel(16,etitel[14]);
218 Calo_trigg_e->GetXaxis()->SetBinLabel(17,etitel[15]);
219 Calo_trigg_e->GetYaxis()->SetTitle("Hits");
220
221 TH1D *Calo_trigg_m2 = new TH1D("Calo_trigg_hits_m2","Hits in each channel at Calorimeter triggers MAIN",17,0.,17.);
222 Calo_trigg_m2->GetXaxis()->SetTitle("Channel");
223 Calo_trigg_m2->GetYaxis()->SetTitle("Hits");
224
225 TH1D *Calo_trigg_e2 = new TH1D("Calo_trigg_hits_e2","Hits in each channel at Calorimeter triggers EXTRA",17,0.,17.);
226 Calo_trigg_e2->GetXaxis()->SetTitle("Event");
227 Calo_trigg_e2->GetYaxis()->SetTitle("Channel");
228
229 //for(Int_t k = 0; k < nevents; k++){
230
231
232 //l = new TLine(.056,.056,0.,6000.);
233 //l.SetLineColor(2);
234 //l->Draw();
235
236 //create histograms
237 //MAIN board
238 TH1D *CAS1M = new TH1D("CAS1 (MAIN), PMT 124","CAS1 (MAIN), PMT124",256,0.,1.);
239 CAS1M->GetXaxis()->SetTitle("DAC [V]");
240 CAS1M->GetYaxis()->SetTitle("Events");
241 TH1D *CAS2M = new TH1D("CAS2 (EXTRA), PMT 137","CAS2 (EXTRA), PMT137",256,0.,1.);
242 CAS2M->GetXaxis()->SetTitle("DAC [V]");
243 CAS2M->GetYaxis()->SetTitle("Events");
244 TH1D *CAS3M = new TH1D("CAS3 (MAIN), PMT 109","CAS3 (MAIN), PMT109",256,0.,1.);
245 CAS3M->GetXaxis()->SetTitle("DAC [V]");
246 CAS3M->GetYaxis()->SetTitle("Events");
247 TH1D *CAS4M = new TH1D("CAS4 (EXTRA), PMT 122","CAS4 (EXTRA), PMT122",256,0.,1.);
248 CAS4M->GetXaxis()->SetTitle("DAC [V]");
249 CAS4M->GetYaxis()->SetTitle("Events");
250
251 TH1D *CARD1M = new TH1D("CARD1 (MAIN), PMT 065","CARD1 (MAIN), PMT065",256,0.,1.);
252 CARD1M->GetXaxis()->SetTitle("DAC [V]");
253 CARD1M->GetYaxis()->SetTitle("Events");
254 TH1D *CARD2M = new TH1D("CARD2 (MAIN), PMT 059","CARD2 (MAIN), PMT059",256,0.,1.);
255 CARD2M->GetXaxis()->SetTitle("DAC [V]");
256 CARD2M->GetYaxis()->SetTitle("Events");
257 TH1D *CARD3M = new TH1D("CARD3 (EXTRA), PMT 053","CARD3 (EXTRA), PMT053",256,0.,1.);
258 CARD3M->GetXaxis()->SetTitle("DAC [V]");
259 CARD3M->GetYaxis()->SetTitle("Events");
260 TH1D *CARD4M = new TH1D("CARD4 (EXTRA), PMT 055","CARD4 (EXTRA), PMT055",256,0.,1.);
261 CARD4M->GetXaxis()->SetTitle("DAC [V]");
262 CARD4M->GetYaxis()->SetTitle("Events");
263
264 TH1D *CAT1M = new TH1D("CAT1 (MAIN), PMT 134","CAT1 (MAIN), PMT134",256,0.,1.);
265 CAT1M->GetXaxis()->SetTitle("DAC [V]");
266 CAT1M->GetYaxis()->SetTitle("Events");
267 TH1D *CAT2M = new TH1D("CAT2 (MAIN), PMT 136","CAT2 (MAIN), PMT136",256,0.,1.);
268 CAT2M->GetXaxis()->SetTitle("DAC [V]");
269 CAT2M->GetYaxis()->SetTitle("Events");
270 TH1D *CAT3M = new TH1D("CAT3 (MAIN), PMT 101","CAT3 (MAIN), PMT101",256,0.,1.);
271 CAT3M->GetXaxis()->SetTitle("DAC [V]");
272 CAT3M->GetYaxis()->SetTitle("Events");
273 TH1D *CAT4M = new TH1D("CAT4 (MAIN), PMT 132","CAT4 (MAIN), PMT132",256,0.,1.);
274 CAT4M->GetXaxis()->SetTitle("DAC [V]");
275 CAT4M->GetYaxis()->SetTitle("Events");
276
277 //EXTRA board
278 TH1D *CAS1E = new TH1D("CAS1 (MAIN), PMT 135","CAS1 (MAIN), PMT135",256,0.,1.);
279 CAS1E->GetXaxis()->SetTitle("DAC [V]");
280 CAS1E->GetYaxis()->SetTitle("Events");
281 TH1D *CAS2E = new TH1D("CAS2 (EXTRA), PMT 105","CAS2 (EXTRA), PMT105",256,0.,1.);
282 CAS2E->GetXaxis()->SetTitle("DAC [V]");
283 CAS2E->GetYaxis()->SetTitle("Events");
284 TH1D *CAS3E = new TH1D("CAS3 (MAIN), PMT 161","CAS3 (MAIN), PMT161",256,0.,1.);
285 CAS3E->GetXaxis()->SetTitle("DAC [V]");
286 CAS3E->GetYaxis()->SetTitle("Events");
287 TH1D *CAS4E = new TH1D("CAS4 (EXTRA), PMT 160","CAS4 (EXTRA), PMT160",256,0.,1.);
288 CAS4E->GetXaxis()->SetTitle("DAC [V]");
289 CAS4E->GetYaxis()->SetTitle("Events");
290
291 TH1D *CARD1E = new TH1D("CARD1 (MAIN), PMT 063","CARD1 (MAIN), PMT063",256,0.,1.);
292 CARD1E->GetXaxis()->SetTitle("DAC [V]");
293 CARD1E->GetYaxis()->SetTitle("Events");
294 TH1D *CARD2E = new TH1D("CARD2 (MAIN), PMT 037","CARD2 (MAIN), PMT037",256,0.,1.);
295 CARD2E->GetXaxis()->SetTitle("DAC [V]");
296 CARD2E->GetYaxis()->SetTitle("Events");
297 TH1D *CARD3E = new TH1D("CARD3 (EXTRA), PMT 062","CARD3 (EXTRA), PMT062",256,0.,1.);
298 CARD3E->GetXaxis()->SetTitle("DAC [V]");
299 CARD3E->GetYaxis()->SetTitle("Events");
300 TH1D *CARD4E = new TH1D("CARD4 (EXTRA), PMT 057","CARD4 (EXTRA), PMT057",256,0.,1.);
301 CARD4E->GetXaxis()->SetTitle("DAC [V]");
302 CARD4E->GetYaxis()->SetTitle("Events");
303
304 TH1D *CAT1E = new TH1D("CAT1 (MAIN), PMT 100","CAT1 (MAIN), PMT100",256,0.,1.);
305 CAT1E->GetXaxis()->SetTitle("DAC [V]");
306 CAT1E->GetYaxis()->SetTitle("Events");
307 TH1D *CAT2E = new TH1D("CAT2 (MAIN), PMT 103","CAT2 (MAIN), PMT103",256,0.,1.);
308 CAT2E->GetXaxis()->SetTitle("DAC [V]");
309 CAT2E->GetYaxis()->SetTitle("Events");
310 TH1D *CAT3E = new TH1D("CAT3 (MAIN), PMT 139","CAT3 (MAIN), PMT139",256,0.,1.);
311 CAT3E->GetXaxis()->SetTitle("DAC [V]");
312 CAT3E->GetYaxis()->SetTitle("Events");
313 TH1D *CAT4E = new TH1D("CAT4 (MAIN), PMT 097","CAT4 (MAIN), PMT097",256,0.,1.);
314 CAT4E->GetXaxis()->SetTitle("DAC [V]");
315 CAT4E->GetYaxis()->SetTitle("Events");
316
317
318 //Long64_t nevents = tr->GetEntries();
319 Double_t mintime = tr->GetMinimum("Pscu.OrbitalTime");
320 Double_t maxtime = tr->GetMaximum("Pscu.OrbitalTime");
321 Double_t nbintime = (maxtime-mintime)/1000.;
322
323 /*******************Declarations*****************/
324
325 const Int_t size = nevents;
326 Double_t time;
327 UShort_t cnt = 1;
328
329 UShort_t Curve1[2][4096];
330 UShort_t Curve2[2][4096];
331 UShort_t hitmap_tr[2][16];
332 UShort_t n_tr[2];
333 UShort_t DAC1[2][8];
334 UShort_t DAC2[2][8];
335
336 /*************************************************/
337
338 //Go through all events and update histograms and plots
339 //for (Int_t i = 0; i < nevents; i++){
340 //for (Int_t i = 0; i < 1; i++){
341 Int_t i = 0;
342 ph = eh->GetPscuHeader();
343 time = ph->GetOrbitalTime();
344 tr->GetEntry(nCal1);
345
346 for(Int_t j = 0; j < 16; j++)
347 hitmap_tr[0][j] = ace1->hitmap_tr[j];
348 for(Int_t j = 0; j < 4096; j++){
349 Curve1[0][j] = ace1->curve1[j];
350 Curve2[0][j] = ace1->curve2[j];
351 }
352 for(Int_t j = 0;j<8;j++){
353 DAC1[0][j] = ace1->DAC1[j];
354 DAC2[0][j] = ace1->DAC1[j];
355 DAC1[1][j] = ace2->DAC1[j];
356 DAC2[1][j] = ace2->DAC1[j];
357 }
358 n_tr[0] = ace1->n_tr;
359
360
361 for(Int_t j = 0; j < 16; j++)
362 hitmap_tr[1][j] = ace2->hitmap_tr[j];
363 for(Int_t j = 0; j < 4096; j++){
364 Curve1[1][j] = ace2->curve1[j];
365 Curve2[1][j] = ace2->curve2[j];
366 }
367 n_tr[1] = ace2->n_tr;
368 Calo_trigg_m->Fill(0.001,n_tr[0]);
369 Calo_trigg_e->Fill(0.001,n_tr[1]);
370 for(Int_t j = 0; j < 16; j++){
371 Calo_trigg_m->Fill(j+1,hitmap_tr[0][j]);
372 Calo_trigg_e->Fill(j+1,hitmap_tr[1][j]);
373 }
374
375 for(Int_t j = 0; j < 8; j++){
376 DAC1_m->Fill(j*2,(DAC1[0][0] & 0x00FF));
377 DAC1_m->Fill(j*2+1,(DAC1[0][0] & 0xFF00)/256);
378 DAC2_m->Fill(j*2,(DAC2[0][0] & 0x00FF));
379 DAC2_m->Fill(j*2+1,(DAC2[0][0] & 0xFF00)/256);
380 DAC1_e->Fill(j*2,(DAC1[1][0] & 0x00FF));
381 DAC1_e->Fill(j*2+1,(DAC1[1][0] & 0xFF00)/256);
382 DAC2_e->Fill(j*2,(DAC2[1][0] & 0x00FF));
383 DAC2_e->Fill(j*2+1,(DAC2[1][0] & 0xFF00)/256);
384 }
385 for(Int_t j=0;j<256;j++){
386 CAS1M->Fill(j/256.,Curve1[0][j*16+2]);
387 CAS2M->Fill(j/256.,Curve2[0][j*16+14]);
388 CAS3M->Fill(j/256.,Curve1[0][j*16+10]);
389 CAS4M->Fill(j/256.,Curve2[0][j*16+6]);
390
391 CARD1M->Fill(j/256.,Curve1[0][j*16+12]);
392 CARD2M->Fill(j/256.,Curve1[0][j*16+4]);
393 CARD3M->Fill(j/256.,Curve2[0][j*16+8]);
394 CARD4M->Fill(j/256.,Curve2[0][j*16]);
395
396 CAT1M->Fill(j/256.,Curve1[0][j*16+13]);
397 CAT2M->Fill(j/256.,Curve1[0][j*16+1]);
398 CAT3M->Fill(j/256.,Curve1[0][j*16+9]);
399 CAT4M->Fill(j/256.,Curve1[0][j*16+5]);
400
401 CAS1E->Fill(j/256.,Curve1[1][j*16+2]);
402 CAS2E->Fill(j/256.,Curve2[1][j*16+14]);
403 CAS3E->Fill(j/256.,Curve1[1][j*16+10]);
404 CAS4E->Fill(j/256.,Curve2[1][j*16+6]);
405
406 CARD1E->Fill(j/256.,Curve1[1][j*16+12]);
407 CARD2E->Fill(j/256.,Curve1[1][j*16+4]);
408 CARD3E->Fill(j/256.,Curve2[1][j*16+8]);
409 CARD4E->Fill(j/256.,Curve2[1][j*16]);
410
411 CAT1E->Fill(j/256.,Curve1[1][j*16+13]);
412 CAT2E->Fill(j/256.,Curve1[1][j*16+1]);
413 CAT3E->Fill(j/256.,Curve1[1][j*16+9]);
414 CAT4E->Fill(j/256.,Curve1[1][j*16+5]);
415 }
416
417
418
419 //Draw histograms
420 gStyle->SetOptDate(0);
421
422 //report sheet 2
423 TCanvas *Canv_report1 = new TCanvas("Report sheet 1", "Report sheet 1", 1280, 1024);
424 Canv_report1->Range(0,0,100,100);
425
426 char *namn;
427 TLatex *t = new TLatex();
428 t->SetTextFont(32);
429 t->SetTextColor(1);
430 t->SetTextAlign(12);
431 t->SetTextSize(0.035);
432 namn="Calibration by the MAIN board";
433 t->DrawLatex(35.,95.,namn);
434
435 t->SetTextSize(0.015);
436 //t->DrawLatex(75.,98.,mytsf->GetName());
437 t->DrawLatex(75.,98.,base.Data());
438
439 t->SetTextColor(1);
440 t->SetTextSize(0.035);
441 namn="CAS";
442 t->DrawLatex(3.,94.,namn);
443 namn="CARD";
444 t->DrawLatex(3.,65.,namn);
445 namn="CAT";
446 t->DrawLatex(3.,34.,namn);
447 TPad *pd1,*pd2,*pd3,*pd4,*pd5,*pd6,*pd7,*pd8,*pd9,*pd10,*pd11,*pd12;
448 pd1 = new TPad("pd1","This is pad1",0.,0.68,0.25,.92);
449 pd2 = new TPad("pd2","This is pad2",0.25,0.68,0.5,.92);
450 pd3 = new TPad("pd3","This is pad3",0.5,0.68,0.75,.92);
451 pd4 = new TPad("pd4","This is pad4",0.75,0.68,1.0,.92);
452 pd5 = new TPad("pd5","This is pad5",0.,0.37,0.25,0.62);
453 pd6 = new TPad("pd6","This is pad6",0.25,0.37,.5,0.62);
454 pd7 = new TPad("pd7","This is pad7",0.5,0.37,0.75,0.62);
455 pd8 = new TPad("pd8","This is pad8",0.75,0.37,1.0,0.62);
456 pd9 = new TPad("pd9","This is pad9",0.0,0.06,0.25,0.31);
457 pd10 = new TPad("pd10","This is pad10",0.25,0.06,.5,0.31);
458 pd11 = new TPad("pd11","This is pad11",0.5,0.06,0.75,0.31);
459 pd12 = new TPad("pd12","This is pad12",0.75,0.06,1.,0.31);
460 Canv_report1->cd();
461 pd1->Range(0,0,100,100);
462 pd2->Range(0,0,100,100);
463 pd3->Range(0,0,100,100);
464 pd4->Range(0,0,100,100);
465 pd5->Range(0,0,100,100);
466 pd6->Range(0,0,100,100);
467 pd7->Range(0,0,100,100);
468 pd8->Range(0,0,100,100);
469 pd9->Range(0,0,100,100);
470 pd10->Range(0,0,100,100);
471 pd11->Range(0,0,100,100);
472 pd12->Range(0,0,100,100);
473 //pd13->Range(0,0,100,100);
474 //pd14->Range(0,0,100,100);
475 //pd15->Range(0,0,100,100);
476 //pd16->Range(0,0,100,100);
477 pd1->Draw();
478 pd2->Draw();
479 pd3->Draw();
480 pd4->Draw();
481 pd5->Draw();
482 pd6->Draw();
483 pd7->Draw();
484 pd8->Draw();
485 pd9->Draw();
486 pd10->Draw();
487 pd11->Draw();
488 pd12->Draw();
489
490 pd1->cd();
491 CAS1M->SetLineColor(1);
492 CAS1M->Draw();
493 //CAS1E->SetLineColor(2);
494 //CAS1E->Draw("SAME");
495 pd2->cd();
496 CAS2M->SetLineColor(1);
497 CAS2M->Draw();
498 //CAS2E->SetLineColor(2);
499 //CAS2E->Draw("SAME");
500 pd3->cd();
501 CAS3M->SetLineColor(1);
502 CAS3M->Draw();
503 //CAS3E->SetLineColor(2);
504 //CAS3E->Draw("SAME");
505 pd4->cd();
506 CAS4M->SetLineColor(1);
507 CAS4M->Draw();
508 //CAS4E->SetLineColor(2);
509 //CAS4E->Draw("SAME");
510
511 pd5->cd();
512 CARD1M->SetLineColor(1);
513 CARD1M->Draw();
514 //CARD1E->SetLineColor(2);
515 //CARD1E->Draw("SAME");
516 pd6->cd();
517 CARD2M->SetLineColor(1);
518 CARD2M->Draw();
519 //CARD2E->SetLineColor(2);
520 //CARD2E->Draw("SAME");
521 pd7->cd();
522 CARD3M->SetLineColor(1);
523 CARD3M->Draw();
524 //CARD3E->SetLineColor(2);
525 //CARD3E->Draw("SAME");
526 pd8->cd();
527 CARD4M->SetLineColor(1);
528 CARD4M->Draw();
529 //CARD4E->SetLineColor(2);
530 //CARD4E->Draw("SAME");
531
532 pd9->cd();
533 CAT1M->SetLineColor(1);
534 CAT1M->Draw();
535 //CAT1E->SetLineColor(2);
536 //CAT1E->Draw("SAME");
537 pd10->cd();
538 CAT2M->SetLineColor(1);
539 CAT2M->Draw();
540 //CAT2E->SetLineColor(2);
541 //CAT2E->Draw("SAME");
542 pd11->cd();
543 CAT3M->SetLineColor(1);
544 CAT3M->Draw();
545 //CAT3E->SetLineColor(2);
546 //CAT3E->Draw("SAME");
547 pd12->cd();
548 CAT4M->SetLineColor(1);
549 CAT4M->Draw();
550 //CAT4E->SetLineColor(2);
551 //CAT4E->Draw("SAME");
552
553
554
555 TCanvas *Canv_report2 = new TCanvas("Report sheet 2", "Report sheet 2", 1280, 1024);
556 Canv_report2->Range(0,0,100,100);
557
558 /*tsf = (TSystemFile*)AcList->First();
559 sprintf(error,"File: %s ",tsf->GetName());
560 TLatex *t=new TLatex();
561 t->SetTextFont(32);
562 t->SetTextColor(1);
563 t->SetTextAlign(12);
564 t->SetTextSize(0.015);
565 t->DrawLatex(2.,99.,error);
566 char *namn;
567 TLatex *t2 = new TLatex();
568 t->SetTextFont(32);
569 t->SetTextColor(1);
570 t->SetTextAlign(12);
571 t->SetTextSize(0.035);
572 namn="CAS";
573 t->DrawLatex(48.,94.,namn);
574 namn="CAT";
575 t->DrawLatex(48.,65.,namn);
576 namn="CARD";
577 t->DrawLatex(48.,34.,namn);
578 */
579 t->SetTextFont(32);
580 t->SetTextColor(1);
581 t->SetTextAlign(12);
582 t->SetTextSize(0.035);
583 namn="Calibration by the EXTRA board";
584 t->DrawLatex(35.,95.,namn);
585
586 t->SetTextSize(0.015);
587 t->DrawLatex(75.,98.,base.Data());
588
589 t->SetTextColor(1);
590 t->SetTextSize(0.035);
591
592 namn="CAS";
593 t->DrawLatex(3.,94.,namn);
594 namn="CARD";
595 t->DrawLatex(3.,65.,namn);
596 namn="CAT";
597 t->DrawLatex(3.,34.,namn);
598
599 pd1 = new TPad("pd1","This is pad1",0.,0.68,0.25,.92);
600 pd2 = new TPad("pd2","This is pad2",0.25,0.68,0.5,.92);
601 pd3 = new TPad("pd3","This is pad3",0.5,0.68,0.75,.92);
602 pd4 = new TPad("pd4","This is pad4",0.75,0.68,1.0,.92);
603 pd5 = new TPad("pd5","This is pad5",0.,0.37,0.25,0.62);
604 pd6 = new TPad("pd6","This is pad6",0.25,0.37,.5,0.62);
605 pd7 = new TPad("pd7","This is pad7",0.5,0.37,0.75,0.62);
606 pd8 = new TPad("pd8","This is pad8",0.75,0.37,1.0,0.62);
607 pd9 = new TPad("pd9","This is pad9",0.0,0.06,0.25,0.31);
608 pd10 = new TPad("pd10","This is pad10",0.25,0.06,.5,0.31);
609 pd11 = new TPad("pd11","This is pad11",0.5,0.06,0.75,0.31);
610 pd12 = new TPad("pd12","This is pad12",0.75,0.06,1.,0.31);
611 Canv_report2->cd();
612 pd1->Range(0,0,100,100);
613 pd2->Range(0,0,100,100);
614 pd3->Range(0,0,100,100);
615 pd4->Range(0,0,100,100);
616 pd5->Range(0,0,100,100);
617 pd6->Range(0,0,100,100);
618 pd7->Range(0,0,100,100);
619 pd8->Range(0,0,100,100);
620 pd9->Range(0,0,100,100);
621 pd10->Range(0,0,100,100);
622 pd11->Range(0,0,100,100);
623 pd12->Range(0,0,100,100);
624 //pd13->Range(0,0,100,100);
625 //pd14->Range(0,0,100,100);
626 //pd15->Range(0,0,100,100);
627 //pd16->Range(0,0,100,100);
628 pd1->Draw();
629 pd2->Draw();
630 pd3->Draw();
631 pd4->Draw();
632 pd5->Draw();
633 pd6->Draw();
634 pd7->Draw();
635 pd8->Draw();
636 pd9->Draw();
637 pd10->Draw();
638 pd11->Draw();
639 pd12->Draw();
640
641 pd1->cd();
642 //CAS1M->SetLineColor(1);
643 //CAS1M->Draw();
644 CAS1E->SetLineColor(1);
645 CAS1E->Draw();
646 pd2->cd();
647 //CAS2M->SetLineColor(1);
648 //CAS2M->Draw();
649 CAS2E->SetLineColor(1);
650 CAS2E->Draw();
651 pd3->cd();
652 //CAS3M->SetLineColor(1);
653 //CAS3M->Draw();
654 CAS3E->SetLineColor(1);
655 CAS3E->Draw();
656 pd4->cd();
657 //CAS4M->SetLineColor(1);
658 //CAS4M->Draw();
659 CAS4E->SetLineColor(1);
660 CAS4E->Draw();
661
662 pd5->cd();
663 //CARD1M->SetLineColor(1);
664 //CARD1M->Draw();
665 CARD1E->SetLineColor(1);
666 CARD1E->Draw();
667 pd6->cd();
668 //CARD2M->SetLineColor(1);
669 //CARD2M->Draw();
670 CARD2E->SetLineColor(1);
671 CARD2E->Draw();
672 pd7->cd();
673 //CARD3M->SetLineColor(1);
674 //CARD3M->Draw();
675 CARD3E->SetLineColor(1);
676 CARD3E->Draw();
677 pd8->cd();
678 //CARD4M->SetLineColor(1);
679 //CARD4M->Draw();
680 CARD4E->SetLineColor(1);
681 CARD4E->Draw();
682
683 pd9->cd();
684 //CAT1M->SetLineColor(1);
685 //CAT1M->Draw();
686 CAT1E->SetLineColor(1);
687 CAT1E->Draw();
688 pd10->cd();
689 //CAT2M->SetLineColor(1);
690 //CAT2M->Draw();
691 CAT2E->SetLineColor(1);
692 CAT2E->Draw();
693 pd11->cd();
694 //CAT3M->SetLineColor(1);
695 //CAT3M->Draw();
696 CAT3E->SetLineColor(1);
697 CAT3E->Draw();
698 pd12->cd();
699 //CAT4M->SetLineColor(1);
700 //CAT4M->Draw();
701 CAT4E->SetLineColor(1);
702 CAT4E->Draw();
703
704 TCanvas *Canv_report3 = new TCanvas("Report sheet 3","Report sheet 3", 1280, 1024);
705 Canv_report3->Range(0,0,100,100);
706
707 t->SetTextFont(32);
708 t->SetTextColor(1);
709 t->SetTextAlign(12);
710 t->SetTextSize(0.035);
711 namn="AC Calibration Quick Look";
712 t->DrawLatex(35.,95.,namn);
713
714 t->SetTextSize(0.015);
715 t->SetTextColor(1);
716 t->DrawLatex(75.,98.,base.Data());
717
718 t->SetTextSize(0.035);
719
720 pd1 = new TPad("pd1","This is pad1",0.52,0.51,0.98,0.92,17);
721 pd1->SetLogy(1);
722 pd2 = new TPad("pd2","This is pad2",0.52,0.03,0.98,0.48,17);
723 pd2->SetLogy(1);
724 pd3 = new TPad("pd3","This is pad3",0.02,0.73,0.48,0.92,17);
725 pd4 = new TPad("pd4","This is pad4",0.02,0.50,0.48,0.69,17);
726 pd5 = new TPad("pd5","This is pad5",0.02,0.27,0.48,0.46,17);
727 pd6 = new TPad("pd6","This is pad6",0.02,0.04,0.48,0.23,17);
728 Canv_report3->cd();
729 pd1->Range(0,0,100,100);
730 pd2->Range(0,0,100,100);
731 pd3->Range(0,0,100,100);
732 pd4->Range(0,0,100,100);
733 pd5->Range(0,0,100,100);
734 pd6->Range(0,0,100,100);
735 pd1->Draw();
736 pd2->Draw();
737 pd3->Draw();
738 pd4->Draw();
739 pd5->Draw();
740 pd6->Draw();
741
742 pd1->cd();
743 Calo_trigg_m->SetLineColor(1);
744 Calo_trigg_m->SetStats(kFALSE);
745 Calo_trigg_m->Draw();
746
747 //pd2->cd();
748 //Calo_trigg_e->Draw();
749 pd2->cd();
750 Calo_trigg_e->SetLineColor(1);
751 Calo_trigg_e->SetStats(kFALSE);
752 Calo_trigg_e->Draw();
753
754
755 pd3->cd();
756 DAC1_m->SetMinimum(0);
757 DAC1_m->SetMaximum(260);
758 DAC1_m->SetStats(kFALSE);
759 DAC1_m->Draw();
760
761 pd4->cd();
762 DAC2_m->SetMinimum(0);
763 DAC2_m->SetMaximum(260);
764 DAC2_m->SetStats(kFALSE);
765 DAC2_m->Draw();
766
767 pd5->cd();
768 DAC1_e->SetMinimum(0);
769 DAC1_e->SetMaximum(260);
770 DAC1_e->SetStats(kFALSE);
771 DAC1_e->Draw();
772
773 pd6->cd();
774 DAC2_e->SetMinimum(0);
775 DAC2_e->SetMaximum(260);
776 DAC2_e->SetStats(kFALSE);
777 DAC2_e->Draw();
778
779 Canv_report3->Update();
780
781 const string fil = (const char*)base;
782 Int_t posiz = fil.find("dw_");
783 if ( posiz == -1 ) posiz = fil.find("DW_");
784 Int_t posiz2 = posiz+13;
785 TString file2;
786 //stringcopy(file2,base,posiz,posiz2);
787 //
788 const char *figrec = file2;
789
790 //string *outdir = new string(outDir);
791 //string *Format = new string(format);
792 char *figsave = 0;
793 figsave = Form("%s/AcCALIB1_%s.%s",outDir.Data(),figrec,format.Data());
794 Canv_report1->SaveAs(figsave);
795 figsave = Form("%s/AcCALIB2_%s.%s",outDir.Data(),figrec,format.Data());
796 Canv_report2->SaveAs(figsave);
797 figsave = Form("%s/AcCALIB3_%s.%s",outDir.Data(),figrec,format.Data());
798 Canv_report3->SaveAs(figsave);
799
800
801
802
803
804 /*
805 TString *file[17];
806 file = "dw_000000_000.dat";
807 file = getFilename(base);
808 char *figrec = 0;
809 figrec = "dw_000000_000";
810 memcpy(figrec, file, 13);
811 char *outdir;
812 outdir = outDir;
813 char *figsave = 0;
814 figsave = Form("%sAcCALIB1_%s.eps",outdir,figrec);
815 Canv_report1->SaveAs(figsave);
816 figsave = Form("%sAcCALIB2_%s.eps",outdir,figrec);
817 Canv_report2->SaveAs(figsave);
818 figsave = Form("%sAcCALIB3_%s.eps",outdir,figrec);
819 Canv_report3->SaveAs(figsave);
820 */
821
822 }
823
824
825 TString* getFilename(TString filename){
826 TString *errS = new TString("err");
827 string *file = new string(filename); //kan bugga, var char *file f�ut
828 TString *file3 = new TString("dw_000000_000.dat"); //13
829 //file3 = "dw_000000_000.dat";
830 string *fil = new string(filename);
831 Int_t posiz = fil->find("dw_");
832 if ( posiz == -1 ) posiz = fil->find("DW_");
833 if ( posiz == -1 ) return errS;
834 memcpy(file3, file+posiz, 13);
835 return file3;
836 };
837
838 void PrintFigure(TString *file[17], TString outDir, TString figty, TCanvas& figure) {
839 char *figrec = 0;
840 figrec = "dw_000000_000";
841 memcpy(figrec, file, 13);
842 //char *ty;
843 string *ty = new string(figty);
844 //char *outdir;
845 string *outdir = new string(outDir);
846 char *figsave = 0;
847 figsave = Form("%s/%s_%s.gif",outdir->c_str(),ty->c_str(),figrec);
848 figure.SaveAs(figsave);
849 return;
850 }
851
852
853 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){
854 if ( to == 0 ){
855 Int_t t2length = s2.Length();
856 s1 = "";
857 to = t2length;
858 };
859 for (Int_t i = from; i<to; i++){
860 s1.Append(s2[i],1);
861 };
862 }
863
864
865 int main(int argc, char* argv[]){
866 TString outDir = ".";
867 TString format = "jpg";
868 int nCal = 0;
869
870
871 if (argc < 2){
872 printf("You have to insert at least the file to analyze \n");
873 printf("Try '--help' for more information. \n");
874 exit(1);
875 }
876
877 if (!strcmp(argv[1], "--help")){
878 printf( "Usage: AcCalib FILE [OPTION] \n");
879 printf( "\t --help Print this help and exit \n");
880 printf( "\t -outDir[path] Path where to put the output [default ./] \n");
881 printf( "\t -format[path] Set the format for the output file [default 'jpg']\n");
882 printf( "\t -from # Set the starting event [default 0]\n");
883 printf( "\t -to # Set the last event [default 0]\n");
884 exit(1);
885 }
886
887 for (int i = 2; i < argc; i++){
888 if (!strcmp(argv[i], "-outDir")){
889 if (++i >= argc){
890 printf( "-outDir needs arguments. \n");
891 printf( "Try '--help' for more information. \n");
892 exit(1);
893 } else {
894 outDir = argv[i];
895 }
896 }
897
898 if (!strcmp(argv[i], "-format")) {
899 if (++i >= argc){
900 printf( "-format needs arguments. \n");
901 printf( "Try '--help' for more information. \n");
902 exit(1);
903 } else {
904 format = argv[i];
905 continue;
906 }
907 }
908
909 if (!strcmp(argv[i], "-nCal1")) {
910 if (++i >= argc){
911 printf( "-nCal1 needs arguments. \n");
912 printf( "Try '--help' for more information. \n");
913 exit(1);
914 }
915 if (isdigit(*argv[i]) && (atoi(argv[i]) > 0)) {
916 nCal = atoi(argv[i]);
917 } else {
918 cerr << "-nCal1 needs a integer value. \n";
919 cout << "Try '--help' for more information. \n";
920 exit(1);
921 }
922 }
923
924 }
925 AcCALIB(argv[1], nCal, outDir, format);
926 }

  ViewVC Help
Powered by ViewVC 1.1.23