1 |
mocchiut |
1.1 |
#include <CaloProfile.h> |
2 |
mocchiut |
1.2 |
// |
3 |
|
|
ClassImp(CaloLat); |
4 |
|
|
ClassImp(CaloLong); |
5 |
|
|
ClassImp(Calo2D); |
6 |
mocchiut |
1.1 |
|
7 |
mocchiut |
1.9 |
|
8 |
|
|
int isempty(struct stack *s){ |
9 |
|
|
return (s->top == EMPTY) ? 1 : 0; |
10 |
|
|
} |
11 |
|
|
|
12 |
|
|
void emptystack(struct stack* s){ |
13 |
|
|
s->top=EMPTY; |
14 |
|
|
strcpy(s->data," "); |
15 |
|
|
} |
16 |
|
|
|
17 |
|
|
void push(struct stack* s,int item){ |
18 |
|
|
if(s->top == (MAX-1)){ |
19 |
|
|
printf("\n ERROR! STACK FULL (too many digits in SetLower/UpperLimit)\n"); |
20 |
|
|
} else { |
21 |
|
|
s->data[++s->top]=(char)item; |
22 |
|
|
}; |
23 |
|
|
} |
24 |
|
|
|
25 |
|
|
char pop(struct stack* s){ |
26 |
|
|
char ret=(char)EMPTY; |
27 |
|
|
if(!isempty(s)){ |
28 |
|
|
ret= s->data[s->top--]; |
29 |
|
|
}; |
30 |
|
|
return ret; |
31 |
|
|
} |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
int ipop(struct stack* s){ |
35 |
|
|
int ret=EMPTY; |
36 |
|
|
if(s->top == EMPTY) |
37 |
|
|
printf("\n ERROR! STACK EMPTY (too few digits in SetLower/UpperLimit)\n"); |
38 |
|
|
else { |
39 |
|
|
ret= s->data[s->top--]; |
40 |
|
|
}; |
41 |
|
|
return ret; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
|
45 |
|
|
void display(struct stack s){ |
46 |
|
|
int ss = s.top; |
47 |
|
|
while(s.top != EMPTY){ |
48 |
|
|
printf("\n%d",s.data[s.top--]); |
49 |
|
|
}; |
50 |
|
|
printf(" s.top %i \n",ss); |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
int isoperator(char e){ |
54 |
|
|
if(e == '+' || e == '-' || e == '*' || e == '/' || e == '%') |
55 |
|
|
return 1; |
56 |
|
|
else |
57 |
|
|
return 0; |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
int priority(char e){ |
62 |
|
|
int pri = 0; |
63 |
|
|
if(e == '*' || e == '/' || e =='%') |
64 |
|
|
pri = 2; |
65 |
|
|
else { |
66 |
|
|
if(e == '+' || e == '-') pri = 1; |
67 |
|
|
}; |
68 |
|
|
return pri; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
void infix2postfix(char* infix, char * postfix, int insertspace){ |
72 |
|
|
char *i,*p; |
73 |
|
|
struct stack X; |
74 |
|
|
char n1; |
75 |
|
|
emptystack(&X); |
76 |
|
|
i = &infix[0]; |
77 |
|
|
p = &postfix[0]; |
78 |
|
|
while(*i){ |
79 |
|
|
while(*i == ' ' || *i == '\t' ){ |
80 |
|
|
i++; |
81 |
|
|
}; |
82 |
|
|
TString c=i; |
83 |
|
|
if( isdigit(*i) || isalpha(*i) || c.BeginsWith(".") ){ |
84 |
|
|
while( isdigit(*i) || isalpha(*i) || c.BeginsWith(".") ){ |
85 |
|
|
*p = *i; |
86 |
|
|
p++; |
87 |
|
|
i++; |
88 |
|
|
c=i; |
89 |
|
|
}; |
90 |
|
|
/*SPACE CODE*/ |
91 |
|
|
if(insertspace){ |
92 |
|
|
*p = ' '; |
93 |
|
|
p++; |
94 |
|
|
}; |
95 |
|
|
/*END SPACE CODE*/ |
96 |
|
|
}; |
97 |
|
|
if( *i == '(' ){ |
98 |
|
|
push(&X,*i); |
99 |
|
|
i++; |
100 |
|
|
}; |
101 |
|
|
if( *i == ')'){ |
102 |
|
|
n1 = pop(&X); |
103 |
|
|
while( n1 != '(' ){ |
104 |
|
|
*p = n1; |
105 |
|
|
p++; |
106 |
|
|
/*SPACE CODE*/ |
107 |
|
|
if(insertspace){ |
108 |
|
|
*p = ' '; |
109 |
|
|
p++; |
110 |
|
|
}; |
111 |
|
|
/*END SPACE CODE*/ |
112 |
|
|
n1 = pop(&X); |
113 |
|
|
}; |
114 |
|
|
i++; |
115 |
|
|
}; |
116 |
|
|
if( isoperator(*i) ){ |
117 |
|
|
if(isempty(&X)){ |
118 |
|
|
push(&X,*i); |
119 |
|
|
} else { |
120 |
|
|
n1 = pop(&X); |
121 |
|
|
while( priority(n1) >= priority(*i) ){ |
122 |
|
|
*p = n1; |
123 |
|
|
p++; |
124 |
|
|
/*SPACE CODE*/ |
125 |
|
|
if(insertspace){ |
126 |
|
|
*p = ' '; |
127 |
|
|
p++; |
128 |
|
|
}; |
129 |
|
|
/*END SPACE CODE*/ |
130 |
|
|
n1 = pop(&X); |
131 |
|
|
}; |
132 |
|
|
push(&X,n1); |
133 |
|
|
push(&X,*i); |
134 |
|
|
}; |
135 |
|
|
i++; |
136 |
|
|
}; |
137 |
|
|
}; |
138 |
|
|
while(!isempty(&X)){ |
139 |
|
|
n1 = pop(&X); |
140 |
|
|
*p = n1; |
141 |
|
|
p++; |
142 |
|
|
/*SPACE CODE*/ |
143 |
|
|
if(insertspace){ |
144 |
|
|
*p = ' '; |
145 |
|
|
p++; |
146 |
|
|
}; |
147 |
|
|
/*END SPACE CODE*/ |
148 |
|
|
}; |
149 |
|
|
*p = '\0'; |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
|
153 |
|
|
Float_t evaluate(char *postfix){ |
154 |
|
|
// |
155 |
|
|
Float_t op1 = 0.; |
156 |
|
|
Float_t op2 = 0.; |
157 |
|
|
Float_t result = 0.; |
158 |
|
|
// |
159 |
|
|
TString e = postfix; |
160 |
|
|
Float_t st[50]; |
161 |
|
|
memset(st,0,50*sizeof(Float_t)); |
162 |
|
|
TObjArray *ae = e.Tokenize(" "); |
163 |
|
|
Int_t o = 0; |
164 |
|
|
Int_t a = 0; |
165 |
|
|
Int_t ap = 0; |
166 |
|
|
// |
167 |
|
|
while ( o < ae->GetEntries() ){ |
168 |
|
|
if ( ((TString)(((TObjString*)ae->At(o))->GetString())).IsFloat() ){ |
169 |
|
|
st[a] = (Float_t)((TString)(((TObjString*)ae->At(o))->GetString())).Atof();; |
170 |
|
|
a++; |
171 |
|
|
} else { |
172 |
|
|
ap = a-1; |
173 |
|
|
op1 = st[ap--]; |
174 |
|
|
op2 = st[ap]; |
175 |
|
|
const char *p=((TString)(((TObjString*)ae->At(o))->GetString())).Data(); |
176 |
|
|
switch(*p){ |
177 |
|
|
case '+': |
178 |
|
|
result = op2 + op1; |
179 |
|
|
break; |
180 |
|
|
case '-': |
181 |
|
|
result = op2 - op1; |
182 |
|
|
break; |
183 |
|
|
case '/': |
184 |
|
|
result = op2 / op1; |
185 |
|
|
break; |
186 |
|
|
case '*': |
187 |
|
|
result = op2 * op1; |
188 |
|
|
break; |
189 |
|
|
case '%': |
190 |
|
|
result = (Int_t)round(op2) % (Int_t)round(op1); |
191 |
|
|
break; |
192 |
|
|
default: |
193 |
|
|
printf("\nInvalid Operator: %s \n",((TString)(((TObjString*)ae->At(o))->GetString())).Data()); |
194 |
|
|
return 0; |
195 |
|
|
}; |
196 |
|
|
st[ap] = result; |
197 |
|
|
a = ap+1; |
198 |
|
|
// |
199 |
|
|
}; |
200 |
|
|
o++; |
201 |
|
|
}; |
202 |
|
|
return result; |
203 |
|
|
// |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
mocchiut |
1.1 |
//////////////////////////////////////////////////////////////////////// |
209 |
|
|
/** |
210 |
|
|
* 1-dimension function describing lateral distribution of the |
211 |
|
|
* shower as viewed by calorimeter |
212 |
|
|
* (projection of 3d function in one direction) |
213 |
|
|
* |
214 |
|
|
* xi[0] = x or y coordinate relative to shower axis |
215 |
|
|
* parmin[0] = rt |
216 |
|
|
* parmin[1] = p |
217 |
|
|
* parmin[2] = rc |
218 |
|
|
* |
219 |
|
|
*/ |
220 |
|
|
//////////////////////////////////////////////////////////////////////// |
221 |
|
|
Double_t cfradx(Double_t *xi, Double_t *parmin) { |
222 |
|
|
|
223 |
|
|
double fradxmin2,p,rt,rc,es,x,pig,norm,c; |
224 |
|
|
x=*xi; |
225 |
|
|
pig = acos(-1.); |
226 |
|
|
rt=parmin[0]; |
227 |
|
|
p=parmin[1]; |
228 |
|
|
rc=parmin[2]; |
229 |
|
|
norm=parmin[3]; |
230 |
|
|
c=parmin[4]; |
231 |
|
|
x=x-c; |
232 |
|
|
es=1.5; |
233 |
|
|
fradxmin2=p*pig*pow(rc,2)/pow((pow(x,2)+pow(rc,2)),es); |
234 |
|
|
fradxmin2=fradxmin2+(1-p)*pig*pow(rt,2)/pow((pow(x,2)+pow(rt,2)),es); |
235 |
|
|
fradxmin2=norm*fradxmin2/(2*pig); |
236 |
|
|
//cout<<"x,fradxmin2 "<< x<<" "<<fradxmin2 <<endl; |
237 |
|
|
return fradxmin2; |
238 |
|
|
} |
239 |
|
|
|
240 |
|
|
|
241 |
|
|
Double_t cfunc(Double_t *tin,Double_t *par) |
242 |
|
|
{ |
243 |
|
|
|
244 |
|
|
Double_t gaa,a,tm,et,value,t,t0; |
245 |
|
|
t=*tin; |
246 |
|
|
et=par[0]; |
247 |
|
|
a=par[1]; |
248 |
|
|
tm=par[2]; |
249 |
|
|
t0=par[3]; |
250 |
|
|
gaa=TMath::Gamma(a); |
251 |
|
|
|
252 |
|
|
value=et*((a-1)/(tm*gaa))*pow(((a-1)*(t-t0)/tm),(a-1))*exp(-(a-1)*(t-t0)/tm); |
253 |
|
|
return value; |
254 |
|
|
} |
255 |
|
|
|
256 |
|
|
|
257 |
|
|
//-------------------------------------- |
258 |
|
|
/** |
259 |
|
|
* Default constructor |
260 |
|
|
*/ |
261 |
|
|
CaloLat::CaloLat(){ |
262 |
|
|
Clear(); |
263 |
|
|
}; |
264 |
|
|
|
265 |
|
|
/** |
266 |
|
|
* Default constructor |
267 |
|
|
*/ |
268 |
mocchiut |
1.2 |
Calo2D::Calo2D(){ |
269 |
mocchiut |
1.1 |
Clear(); |
270 |
|
|
}; |
271 |
|
|
|
272 |
|
|
CaloLat::CaloLat(PamLevel2 *l2p){ |
273 |
|
|
// |
274 |
|
|
Clear(); |
275 |
|
|
// |
276 |
|
|
L2 = l2p; |
277 |
|
|
// |
278 |
|
|
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
279 |
|
|
// |
280 |
|
|
OBT = 0; |
281 |
|
|
PKT = 0; |
282 |
|
|
atime = 0; |
283 |
|
|
// |
284 |
|
|
debug = false; |
285 |
|
|
// |
286 |
|
|
}; |
287 |
|
|
|
288 |
mocchiut |
1.2 |
Calo2D::Calo2D(PamLevel2 *l2p){ |
289 |
mocchiut |
1.1 |
// |
290 |
|
|
Clear(); |
291 |
|
|
// |
292 |
|
|
L2 = l2p; |
293 |
|
|
// |
294 |
|
|
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
295 |
|
|
// |
296 |
|
|
OBT = 0; |
297 |
|
|
PKT = 0; |
298 |
|
|
atime = 0; |
299 |
|
|
// |
300 |
|
|
debug = false; |
301 |
|
|
// |
302 |
|
|
}; |
303 |
|
|
|
304 |
|
|
void CaloLat::Clear(){ |
305 |
|
|
// |
306 |
|
|
}; |
307 |
|
|
|
308 |
mocchiut |
1.2 |
void Calo2D::Clear(){ |
309 |
mocchiut |
1.1 |
// |
310 |
|
|
}; |
311 |
|
|
|
312 |
|
|
void CaloLat::Print(){ |
313 |
|
|
// |
314 |
|
|
Process(); |
315 |
|
|
// |
316 |
|
|
printf("==================== Calorimeter Lateral Profile =======================\n"); |
317 |
|
|
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
318 |
|
|
// printf(" nx [number of X combination]:.. %i\n",nx); |
319 |
|
|
// printf(" ny [number of Y combination]:.. %i\n",ny); |
320 |
|
|
printf("========================================================================\n"); |
321 |
|
|
// |
322 |
|
|
}; |
323 |
|
|
|
324 |
mocchiut |
1.2 |
void Calo2D::Print(){ |
325 |
mocchiut |
1.1 |
// |
326 |
|
|
Process(); |
327 |
|
|
// |
328 |
mocchiut |
1.2 |
printf("==================== Calorimeter 2D Profile =======================\n"); |
329 |
mocchiut |
1.1 |
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
330 |
|
|
// printf(" nx [number of X combination]:.. %i\n",nx); |
331 |
|
|
// printf(" ny [number of Y combination]:.. %i\n",ny); |
332 |
|
|
printf("========================================================================\n"); |
333 |
|
|
// |
334 |
|
|
}; |
335 |
|
|
|
336 |
|
|
void CaloLat::Draw(){ |
337 |
|
|
// |
338 |
|
|
Process(); |
339 |
|
|
Draw(-1,-1); |
340 |
|
|
}; |
341 |
|
|
|
342 |
mocchiut |
1.2 |
void Calo2D::Draw(){ |
343 |
mocchiut |
1.1 |
// |
344 |
|
|
Process(); |
345 |
|
|
Draw(-1); |
346 |
|
|
}; |
347 |
|
|
|
348 |
|
|
void CaloLat::Draw(Int_t view,Int_t plane){ |
349 |
|
|
// |
350 |
|
|
Int_t minv = 0; |
351 |
|
|
Int_t maxv = 0; |
352 |
|
|
Int_t minp = 0; |
353 |
|
|
Int_t maxp = 0; |
354 |
|
|
// |
355 |
|
|
if ( view == -1 ){ |
356 |
|
|
minv = 0; |
357 |
|
|
maxv = 2; |
358 |
|
|
} else { |
359 |
|
|
minv = view; |
360 |
|
|
maxv = view+1; |
361 |
|
|
}; |
362 |
|
|
|
363 |
|
|
if ( plane == -1 ){ |
364 |
|
|
minp = 0; |
365 |
|
|
maxp = 22; |
366 |
|
|
} else { |
367 |
|
|
minp = plane; |
368 |
|
|
maxp = plane+1; |
369 |
|
|
}; |
370 |
|
|
// |
371 |
|
|
Process(); |
372 |
|
|
// |
373 |
|
|
gStyle->SetLabelSize(0.04); |
374 |
|
|
gStyle->SetNdivisions(510,"XY"); |
375 |
|
|
// |
376 |
|
|
for (Int_t v=minv; v<maxv;v++){ |
377 |
|
|
for (Int_t p=minp; p<maxp;p++){ |
378 |
|
|
TString hid = Form("clatv%ip%i",v,p); |
379 |
|
|
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
380 |
|
|
if ( tc ){ |
381 |
|
|
// tc->Clear(); |
382 |
|
|
} else { |
383 |
|
|
tc = new TCanvas(hid,hid); |
384 |
|
|
}; |
385 |
|
|
// |
386 |
|
|
TString thid = Form("hlatv%ip%i",v,p); |
387 |
|
|
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
388 |
|
|
if ( th ) th->Delete(); |
389 |
|
|
// th->Clear(); |
390 |
|
|
// th->Reset(); |
391 |
|
|
// } else { |
392 |
|
|
th = new TH1F(thid,thid,96,-0.5,95.5); |
393 |
|
|
// }; |
394 |
|
|
tc->cd(); |
395 |
|
|
// |
396 |
|
|
for (Int_t st=0;st<96;st++){ |
397 |
|
|
th->Fill(st,estrip[v][p][st]); |
398 |
|
|
}; |
399 |
|
|
th->Draw(); |
400 |
|
|
tc->Modified(); |
401 |
|
|
tc->Update(); |
402 |
|
|
}; |
403 |
|
|
}; |
404 |
|
|
// |
405 |
|
|
gStyle->SetLabelSize(0); |
406 |
|
|
gStyle->SetNdivisions(1,"XY"); |
407 |
|
|
// |
408 |
|
|
}; |
409 |
|
|
|
410 |
mocchiut |
1.2 |
void Calo2D::Draw(Int_t plane){ |
411 |
mocchiut |
1.1 |
// |
412 |
mocchiut |
1.2 |
Int_t minp = 0; |
413 |
|
|
Int_t maxp = 0; |
414 |
mocchiut |
1.1 |
// |
415 |
mocchiut |
1.2 |
if ( plane == -1 ){ |
416 |
|
|
minp = 0; |
417 |
|
|
maxp = 23; |
418 |
mocchiut |
1.1 |
} else { |
419 |
mocchiut |
1.2 |
minp = plane; |
420 |
|
|
maxp = plane+1; |
421 |
mocchiut |
1.1 |
}; |
422 |
|
|
// |
423 |
|
|
Process(); |
424 |
|
|
// |
425 |
|
|
gStyle->SetLabelSize(0.04); |
426 |
|
|
gStyle->SetNdivisions(510,"XY"); |
427 |
|
|
// |
428 |
mocchiut |
1.2 |
for (Int_t p=minp; p<maxp;p++){ |
429 |
|
|
TString hid = Form("c2dp%i",p); |
430 |
|
|
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
431 |
|
|
if ( tc ){ |
432 |
|
|
// tc->Clear(); |
433 |
|
|
} else { |
434 |
|
|
tc = new TCanvas(hid,hid); |
435 |
|
|
}; |
436 |
|
|
// |
437 |
|
|
TString thid = Form("h2dp%i",p); |
438 |
|
|
TH2F *th = dynamic_cast<TH2F*>(gDirectory->FindObject(thid)); |
439 |
|
|
if ( th ) th->Delete(); |
440 |
|
|
// th->Clear(); |
441 |
|
|
// th->Reset(); |
442 |
|
|
// } else { |
443 |
|
|
Int_t minx = smax[p] - 10; |
444 |
|
|
if ( minx < 0 ) minx = 0; |
445 |
|
|
Int_t maxx = minx + 20; |
446 |
|
|
if ( maxx > 95 ){ |
447 |
|
|
maxx = 95; |
448 |
|
|
minx = 75; |
449 |
|
|
}; |
450 |
|
|
Int_t miny = smay[p] - 10; |
451 |
|
|
if ( miny < 0 ) miny = 0; |
452 |
|
|
Int_t maxy = miny + 20; |
453 |
|
|
if ( maxy > 95 ){ |
454 |
|
|
maxy = 95; |
455 |
|
|
miny = 75; |
456 |
|
|
}; |
457 |
|
|
th = new TH2F(thid,thid,20,(Float_t)minx-0.5,(Float_t)maxx-0.5,20,(Float_t)miny-0.5,(Float_t)maxy-0.5); |
458 |
|
|
// th = new TH2F(thid,thid,96,-0.5,95.5,96,-0.5,95.5); |
459 |
|
|
// }; |
460 |
|
|
tc->cd(); |
461 |
|
|
// |
462 |
|
|
for (Int_t stx=minx;stx<maxx+1;stx++){ |
463 |
|
|
for (Int_t sty=miny;sty<maxy+1;sty++){ |
464 |
|
|
th->Fill(stx,sty,estrip[p][stx][sty]); |
465 |
|
|
}; |
466 |
|
|
}; |
467 |
|
|
gStyle->SetPalette(1); |
468 |
|
|
// tc->SetLogz(); |
469 |
|
|
// th->Draw("colbox"); |
470 |
|
|
th->Draw("cont4"); |
471 |
|
|
tc->Modified(); |
472 |
|
|
tc->Update(); |
473 |
mocchiut |
1.1 |
}; |
474 |
|
|
// |
475 |
|
|
gStyle->SetLabelSize(0); |
476 |
|
|
gStyle->SetNdivisions(1,"XY"); |
477 |
|
|
// |
478 |
|
|
}; |
479 |
|
|
|
480 |
|
|
void CaloLat::Delete(){ |
481 |
|
|
Clear(); |
482 |
|
|
//delete this; |
483 |
|
|
}; |
484 |
|
|
|
485 |
mocchiut |
1.2 |
void Calo2D::Delete(){ |
486 |
mocchiut |
1.1 |
Clear(); |
487 |
|
|
//delete this; |
488 |
|
|
}; |
489 |
|
|
|
490 |
mocchiut |
1.2 |
|
491 |
mocchiut |
1.1 |
void CaloLat::Process(){ |
492 |
|
|
// |
493 |
|
|
if ( !L2 ){ |
494 |
|
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
495 |
|
|
printf(" ERROR: CaloHough variables not filled \n"); |
496 |
|
|
return; |
497 |
|
|
}; |
498 |
|
|
// |
499 |
|
|
Bool_t newentry = false; |
500 |
|
|
// |
501 |
|
|
if ( L2->IsORB() ){ |
502 |
|
|
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime ){ |
503 |
|
|
newentry = true; |
504 |
|
|
OBT = L2->GetOrbitalInfo()->OBT; |
505 |
|
|
PKT = L2->GetOrbitalInfo()->pkt_num; |
506 |
|
|
atime = L2->GetOrbitalInfo()->absTime; |
507 |
|
|
}; |
508 |
|
|
} else { |
509 |
|
|
newentry = true; |
510 |
|
|
}; |
511 |
|
|
// |
512 |
|
|
if ( !newentry ) return; |
513 |
|
|
// |
514 |
|
|
if ( debug ) printf(" Start processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
515 |
|
|
// |
516 |
|
|
Clear(); |
517 |
|
|
// |
518 |
|
|
// let's start |
519 |
|
|
// |
520 |
|
|
memset(estrip,0, 4224*sizeof(Float_t)); |
521 |
|
|
Float_t mip1 = 0.; |
522 |
|
|
Int_t view1 = 0; |
523 |
|
|
Int_t plane1 = 0; |
524 |
|
|
Int_t strip1 = 0; |
525 |
|
|
// |
526 |
|
|
for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){ |
527 |
|
|
mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); |
528 |
|
|
estrip[view1][plane1][strip1] = mip1; |
529 |
|
|
}; |
530 |
|
|
// |
531 |
|
|
if ( debug ) this->Print(); |
532 |
|
|
if ( debug ) printf(" exit \n"); |
533 |
|
|
// |
534 |
|
|
}; |
535 |
|
|
|
536 |
mocchiut |
1.2 |
void Calo2D::Process(){ |
537 |
|
|
// |
538 |
|
|
if ( !L2 ){ |
539 |
|
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
540 |
|
|
printf(" ERROR: CaloHough variables not filled \n"); |
541 |
|
|
return; |
542 |
|
|
}; |
543 |
|
|
// |
544 |
|
|
Bool_t newentry = false; |
545 |
|
|
// |
546 |
|
|
if ( L2->IsORB() ){ |
547 |
|
|
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime ){ |
548 |
|
|
newentry = true; |
549 |
|
|
OBT = L2->GetOrbitalInfo()->OBT; |
550 |
|
|
PKT = L2->GetOrbitalInfo()->pkt_num; |
551 |
|
|
atime = L2->GetOrbitalInfo()->absTime; |
552 |
|
|
}; |
553 |
|
|
} else { |
554 |
|
|
newentry = true; |
555 |
|
|
}; |
556 |
|
|
// |
557 |
|
|
if ( !newentry ) return; |
558 |
|
|
// |
559 |
|
|
if ( debug ) printf(" Start processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
560 |
|
|
// |
561 |
|
|
Clear(); |
562 |
|
|
// |
563 |
|
|
// let's start |
564 |
|
|
// |
565 |
|
|
Float_t es[2][22][96]; |
566 |
|
|
memset(es,0, 4224*sizeof(Float_t)); |
567 |
|
|
memset(estrip,0, 4224*sizeof(Float_t)); |
568 |
|
|
Float_t mip1 = 0.; |
569 |
|
|
Int_t view1 = 0; |
570 |
|
|
Int_t plane1 = 0; |
571 |
|
|
Int_t strip1 = 0; |
572 |
|
|
// |
573 |
|
|
for (Int_t i=0; i<L2->GetCaloLevel1()->istrip ; i++){ |
574 |
|
|
mip1 = L2->GetCaloLevel1()->DecodeEstrip(i,view1,plane1,strip1); |
575 |
|
|
es[view1][plane1][strip1] = mip1; |
576 |
|
|
}; |
577 |
|
|
// |
578 |
|
|
Int_t plane2 = 0; |
579 |
|
|
Float_t emax[23]; |
580 |
|
|
memset(emax,0,sizeof(Float_t)*23); |
581 |
|
|
memset(smax,0,sizeof(Int_t)*23); |
582 |
|
|
memset(smay,0,sizeof(Int_t)*23); |
583 |
|
|
// |
584 |
|
|
// |
585 |
|
|
for (Int_t p=0; p < 23 ; p++){ |
586 |
|
|
// |
587 |
|
|
plane1 = p-1; |
588 |
|
|
plane2 = p; |
589 |
|
|
// |
590 |
|
|
if ( p == 0 ){ |
591 |
|
|
plane1 = -1; |
592 |
|
|
plane2 = 0; |
593 |
|
|
}; |
594 |
|
|
if ( p == 22 ){ |
595 |
|
|
plane1 = 21; |
596 |
|
|
plane2 = -1; |
597 |
|
|
}; |
598 |
|
|
// |
599 |
|
|
for (Int_t s=0; s < 96 ; s++){ // x |
600 |
|
|
for (Int_t ss=0; ss < 96 ; ss++){ // y |
601 |
|
|
if ( p == 0 ){ |
602 |
|
|
estrip[p][s][ss] += es[1][plane2][ss]; |
603 |
|
|
if ( (es[1][plane2][ss]) > emax[p] ){ |
604 |
|
|
smax[p] = 45; |
605 |
|
|
smay[p] = ss; |
606 |
|
|
emax[p] = es[1][plane2][ss] ; |
607 |
|
|
}; |
608 |
|
|
}; |
609 |
|
|
if ( p > 0 && p < 22 ){ |
610 |
|
|
estrip[p][s][ss] += es[0][plane1][s] + es[1][plane2][ss]; |
611 |
|
|
if ( (es[0][plane1][s] + es[1][plane2][ss]) > emax[p] ){ |
612 |
|
|
smax[p] = s; |
613 |
|
|
smay[p] = ss; |
614 |
|
|
emax[p] = es[0][plane1][s] + es[1][plane2][ss] ; |
615 |
|
|
}; |
616 |
|
|
}; |
617 |
|
|
if ( p == 22 ){ |
618 |
|
|
estrip[p][s][ss] += es[0][plane1][s]; |
619 |
|
|
if ( (es[1][plane2][s]) > emax[p] ){ |
620 |
|
|
smax[p] = s; |
621 |
|
|
smay[p] = 45; |
622 |
|
|
emax[p] = es[1][plane2][s] ; |
623 |
|
|
}; |
624 |
|
|
}; |
625 |
|
|
}; |
626 |
|
|
}; |
627 |
|
|
// |
628 |
|
|
}; |
629 |
|
|
// |
630 |
|
|
if ( debug ) this->Print(); |
631 |
|
|
if ( debug ) printf(" exit \n"); |
632 |
|
|
// |
633 |
|
|
}; |
634 |
|
|
|
635 |
|
|
|
636 |
|
|
/** |
637 |
|
|
* Default constructor |
638 |
|
|
*/ |
639 |
|
|
CaloLong::CaloLong(){ |
640 |
|
|
Clear(); |
641 |
|
|
}; |
642 |
|
|
|
643 |
|
|
CaloLong::CaloLong(PamLevel2 *l2p){ |
644 |
|
|
// |
645 |
|
|
Clear(); |
646 |
|
|
// |
647 |
|
|
L2 = l2p; |
648 |
|
|
// |
649 |
|
|
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
650 |
|
|
// |
651 |
|
|
OBT = 0; |
652 |
|
|
PKT = 0; |
653 |
|
|
atime = 0; |
654 |
|
|
// |
655 |
mocchiut |
1.8 |
clp = L2->GetCaloLevel2(); |
656 |
|
|
// |
657 |
mocchiut |
1.2 |
sel = true; |
658 |
|
|
cont = false; |
659 |
|
|
N = 0; |
660 |
|
|
NC = 22; |
661 |
|
|
mask18b = -1; |
662 |
|
|
// |
663 |
|
|
no18x = true; |
664 |
|
|
debug = false; |
665 |
mocchiut |
1.5 |
maskXE = false; |
666 |
|
|
maskXO = false; |
667 |
|
|
maskYE = false; |
668 |
|
|
maskYO = false; |
669 |
mocchiut |
1.2 |
// |
670 |
mocchiut |
1.9 |
lmax = 0.; |
671 |
|
|
umax = 100.; |
672 |
|
|
slmax = ""; |
673 |
|
|
sumax = ""; |
674 |
mocchiut |
1.11 |
xyaverage = true; |
675 |
mocchiut |
1.9 |
// |
676 |
mocchiut |
1.2 |
}; |
677 |
|
|
|
678 |
mocchiut |
1.5 |
void CaloLong::MaskSection(TString sec){ |
679 |
|
|
sec.ToUpper(); |
680 |
|
|
if ( sec.Contains("XO") ) maskXO = true; |
681 |
|
|
if ( sec.Contains("YO") ) maskYO = true; |
682 |
|
|
if ( sec.Contains("XE") ) maskXE = true; |
683 |
|
|
if ( sec.Contains("YE") ) maskYE = true; |
684 |
|
|
} |
685 |
|
|
|
686 |
mocchiut |
1.8 |
void CaloLong::UnMaskSections(){ |
687 |
|
|
this->UnMaskSection("XEXOYEYO"); |
688 |
|
|
} |
689 |
|
|
|
690 |
|
|
void CaloLong::UnMaskSection(TString sec){ |
691 |
|
|
sec.ToUpper(); |
692 |
|
|
if ( sec.Contains("XO") ) maskXO = false; |
693 |
|
|
if ( sec.Contains("YO") ) maskYO = false; |
694 |
|
|
if ( sec.Contains("XE") ) maskXE = false; |
695 |
|
|
if ( sec.Contains("YE") ) maskYE = false; |
696 |
|
|
} |
697 |
|
|
|
698 |
mocchiut |
1.2 |
void CaloLong::Clear(){ |
699 |
|
|
// |
700 |
|
|
memset(eplane,0, 2*22*sizeof(Float_t)); |
701 |
|
|
// |
702 |
|
|
chi2 = 0.; |
703 |
|
|
ndf = 0.; |
704 |
|
|
E0 = 0.; |
705 |
mocchiut |
1.9 |
defE0 = 0.; |
706 |
mocchiut |
1.2 |
a = 0.; |
707 |
|
|
b = 0.; |
708 |
|
|
errE0 = 0.; |
709 |
|
|
erra = 0.; |
710 |
|
|
errb = 0.; |
711 |
|
|
etmax = 0.; |
712 |
|
|
asymm = 0.; |
713 |
|
|
fitresult = 0; |
714 |
|
|
// |
715 |
|
|
X0pl = 0.76; |
716 |
|
|
// |
717 |
|
|
}; |
718 |
|
|
|
719 |
|
|
void CaloLong::Print(){ |
720 |
|
|
// |
721 |
mocchiut |
1.6 |
Fit(); |
722 |
mocchiut |
1.2 |
// |
723 |
|
|
printf("==================== Calorimeter Longitudinal Profile =======================\n"); |
724 |
|
|
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
725 |
|
|
printf(" fitresult:.. %i\n",fitresult); |
726 |
|
|
printf(" chi2 :.. %f\n",chi2); |
727 |
|
|
printf(" ndf :.. %f\n",ndf); |
728 |
|
|
printf(" nchi2 :.. %f\n",chi2/ndf); |
729 |
|
|
printf(" E0 :.. %f\n",E0); |
730 |
|
|
printf(" E0/260. :.. %f\n",E0/260.); |
731 |
mocchiut |
1.9 |
printf(" defE0 :.. %f\n",defE0); |
732 |
|
|
printf(" lower :.. %f\n",lmax); |
733 |
|
|
printf(" upper :.. %f\n",umax); |
734 |
|
|
printf(" s lower :.. %s\n",slmax.Data()); |
735 |
|
|
printf(" s upper :.. %s\n",sumax.Data()); |
736 |
mocchiut |
1.2 |
printf(" a :.. %f\n",a); |
737 |
|
|
printf(" b :.. %f\n",b); |
738 |
|
|
printf(" errE0 :.. %f\n",errE0); |
739 |
|
|
printf(" erra :.. %f\n",erra); |
740 |
|
|
printf(" errb :.. %f\n",errb); |
741 |
|
|
printf(" asymm :.. %f\n",asymm); |
742 |
|
|
printf(" tmax :.. %f\n",((a-1.)/b)); |
743 |
|
|
printf(" etmax :.. %f\n",etmax); |
744 |
|
|
printf(" X0pl :.. %f\n",X0pl); |
745 |
|
|
printf("========================================================================\n"); |
746 |
|
|
// |
747 |
|
|
}; |
748 |
|
|
|
749 |
|
|
void CaloLong::SetNoWpreSampler(Int_t n){ |
750 |
|
|
// |
751 |
|
|
if ( NC+n <= 22 && NC+n >= 0 ){ |
752 |
|
|
N = n; |
753 |
|
|
} else { |
754 |
|
|
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
755 |
|
|
printf(" you are giving N presampler = %i and N calo = %i \n",n,NC); |
756 |
|
|
printf(" WARNING: using default values NWpre = 0, NWcalo = 22\n"); |
757 |
|
|
NC = 22; |
758 |
|
|
N = 0; |
759 |
|
|
}; |
760 |
|
|
} |
761 |
|
|
|
762 |
|
|
void CaloLong::SetNoWcalo(Int_t n){ |
763 |
|
|
if ( N+n <= 22 && N+n >= 0 ){ |
764 |
|
|
NC = n; |
765 |
|
|
} else { |
766 |
|
|
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
767 |
|
|
printf(" you are giving N W presampler = %i and N W calo = %i \n",N,n); |
768 |
|
|
printf(" WARNING: using default values NWpre = 0, NWcalo = 22\n"); |
769 |
|
|
NC = 22; |
770 |
|
|
N = 0; |
771 |
|
|
}; |
772 |
|
|
} |
773 |
|
|
|
774 |
mocchiut |
1.3 |
void CaloLong::SplitInto(Int_t NoWpreSampler, Int_t NoWcalo){ |
775 |
|
|
this->SetNoWpreSampler(0); |
776 |
|
|
this->SetNoWcalo(0); |
777 |
|
|
if ( NoWpreSampler < NoWcalo ){ |
778 |
|
|
this->SetNoWpreSampler(NoWpreSampler); |
779 |
|
|
this->SetNoWcalo(NoWcalo); |
780 |
|
|
} else { |
781 |
|
|
this->SetNoWcalo(NoWcalo); |
782 |
|
|
this->SetNoWpreSampler(NoWpreSampler); |
783 |
|
|
}; |
784 |
|
|
} |
785 |
|
|
|
786 |
mocchiut |
1.1 |
void CaloLong::Process(){ |
787 |
|
|
// |
788 |
|
|
if ( !L2 ){ |
789 |
|
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
790 |
|
|
printf(" ERROR: CaloHough variables not filled \n"); |
791 |
|
|
return; |
792 |
|
|
}; |
793 |
|
|
// |
794 |
|
|
Bool_t newentry = false; |
795 |
|
|
// |
796 |
|
|
if ( L2->IsORB() ){ |
797 |
|
|
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime ){ |
798 |
|
|
newentry = true; |
799 |
|
|
OBT = L2->GetOrbitalInfo()->OBT; |
800 |
|
|
PKT = L2->GetOrbitalInfo()->pkt_num; |
801 |
|
|
atime = L2->GetOrbitalInfo()->absTime; |
802 |
|
|
}; |
803 |
|
|
} else { |
804 |
|
|
newentry = true; |
805 |
|
|
}; |
806 |
|
|
// |
807 |
|
|
if ( !newentry ) return; |
808 |
|
|
// |
809 |
|
|
if ( debug ) printf(" Start processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
810 |
|
|
// |
811 |
|
|
Clear(); |
812 |
|
|
// |
813 |
|
|
// let's start |
814 |
|
|
// |
815 |
mocchiut |
1.2 |
if ( cont ){ |
816 |
|
|
for (Int_t i=0; i<22; i++){ |
817 |
|
|
if ( i == (18+N) ){ |
818 |
|
|
mask18b = 18 + N; |
819 |
|
|
break; |
820 |
|
|
}; |
821 |
|
|
}; |
822 |
|
|
}; |
823 |
|
|
// |
824 |
|
|
if ( sel ){ |
825 |
|
|
for (Int_t i=0; i<22; i++){ |
826 |
|
|
if ( i == (18-N) ){ |
827 |
|
|
mask18b = 18 - N; |
828 |
|
|
break; |
829 |
|
|
}; |
830 |
|
|
}; |
831 |
|
|
}; |
832 |
|
|
// |
833 |
|
|
// if ( mask18b == 18 ) mask18b = -1; |
834 |
mocchiut |
1.1 |
// |
835 |
mocchiut |
1.2 |
Int_t view = 0; |
836 |
|
|
Int_t plane = 0; |
837 |
|
|
Int_t strip = 0; |
838 |
|
|
Float_t mip = 0.; |
839 |
mocchiut |
1.5 |
Bool_t gof = true; |
840 |
mocchiut |
1.2 |
for (Int_t i=0; i < L2->GetCaloLevel1()->istrip; i++){ |
841 |
|
|
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
842 |
mocchiut |
1.5 |
gof = true; |
843 |
|
|
if ( maskXE && (plane%2)==0 && view==1 ) gof = false; |
844 |
|
|
if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; |
845 |
|
|
if ( maskYE && (plane%2)!=0 && view==0 ) gof = false; |
846 |
|
|
if ( maskYO && (plane%2)==0 && view==0 ) gof = false; |
847 |
|
|
if ( gof ) eplane[view][plane] += mip; |
848 |
mocchiut |
1.2 |
}; |
849 |
|
|
// |
850 |
mocchiut |
1.4 |
// inclination factor (stolen from Daniele's code) |
851 |
mocchiut |
1.2 |
// |
852 |
|
|
Float_t ytgx = 0; |
853 |
|
|
Float_t ytgy = 0; |
854 |
mocchiut |
1.8 |
ytgx = 0.76 * clp->tanx[0]; |
855 |
|
|
ytgy = 0.76 * clp->tany[0]; |
856 |
mocchiut |
1.2 |
X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); |
857 |
|
|
// |
858 |
|
|
// Find experimental plane of maximum |
859 |
|
|
// |
860 |
|
|
Int_t pmax = 0; |
861 |
|
|
Int_t vmax = 0; |
862 |
|
|
Float_t emax = 0.; |
863 |
mocchiut |
1.1 |
for (Int_t v=0; v<2; v++){ |
864 |
|
|
for (Int_t i=0; i<22; i++){ |
865 |
mocchiut |
1.2 |
if ( eplane[v][i] > emax ){ |
866 |
|
|
emax = eplane[v][i]; |
867 |
|
|
vmax = v; |
868 |
|
|
pmax = i; |
869 |
|
|
}; |
870 |
mocchiut |
1.1 |
}; |
871 |
|
|
}; |
872 |
|
|
// |
873 |
mocchiut |
1.2 |
// |
874 |
|
|
// |
875 |
|
|
if ( vmax == 0 ) pmax++; |
876 |
|
|
etmax = pmax * X0pl; |
877 |
|
|
// |
878 |
mocchiut |
1.1 |
if ( debug ) this->Print(); |
879 |
|
|
if ( debug ) printf(" exit \n"); |
880 |
|
|
// |
881 |
|
|
}; |
882 |
|
|
|
883 |
mocchiut |
1.8 |
void CaloLong::SetEnergies(Float_t myene[][22]){ |
884 |
|
|
// |
885 |
|
|
if ( !L2 ){ |
886 |
|
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
887 |
|
|
printf(" ERROR: CaloHough variables not filled \n"); |
888 |
|
|
return; |
889 |
|
|
}; |
890 |
|
|
// |
891 |
|
|
Bool_t newentry = false; |
892 |
|
|
// |
893 |
|
|
if ( L2->IsORB() ){ |
894 |
|
|
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime ){ |
895 |
|
|
newentry = true; |
896 |
|
|
OBT = L2->GetOrbitalInfo()->OBT; |
897 |
|
|
PKT = L2->GetOrbitalInfo()->pkt_num; |
898 |
|
|
atime = L2->GetOrbitalInfo()->absTime; |
899 |
|
|
}; |
900 |
|
|
} else { |
901 |
|
|
newentry = true; |
902 |
|
|
}; |
903 |
|
|
// |
904 |
|
|
if ( !newentry ) return; |
905 |
|
|
// |
906 |
|
|
if ( debug ) printf(" SET ENERGIES Start processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
907 |
|
|
// |
908 |
|
|
Clear(); |
909 |
|
|
// |
910 |
|
|
// let's start |
911 |
|
|
// |
912 |
|
|
if ( cont ){ |
913 |
|
|
for (Int_t i=0; i<22; i++){ |
914 |
|
|
if ( i == (18+N) ){ |
915 |
|
|
mask18b = 18 + N; |
916 |
|
|
break; |
917 |
|
|
}; |
918 |
|
|
}; |
919 |
|
|
}; |
920 |
|
|
// |
921 |
|
|
if ( sel ){ |
922 |
|
|
for (Int_t i=0; i<22; i++){ |
923 |
|
|
if ( i == (18-N) ){ |
924 |
|
|
mask18b = 18 - N; |
925 |
|
|
break; |
926 |
|
|
}; |
927 |
|
|
}; |
928 |
|
|
}; |
929 |
|
|
// |
930 |
|
|
// if ( mask18b == 18 ) mask18b = -1; |
931 |
|
|
// |
932 |
|
|
Int_t view = 0; |
933 |
|
|
Int_t plane = 0; |
934 |
|
|
Bool_t gof = true; |
935 |
|
|
for (view=0; view < 2; view++){ |
936 |
|
|
for (plane=0; plane < 22; plane++){ |
937 |
|
|
gof = true; |
938 |
|
|
if ( maskXE && (plane%2)==0 && view==1 ) gof = false; |
939 |
|
|
if ( maskXO && (plane%2)!=0 && view==1 ) gof = false; |
940 |
|
|
if ( maskYE && (plane%2)!=0 && view==0 ) gof = false; |
941 |
|
|
if ( maskYO && (plane%2)==0 && view==0 ) gof = false; |
942 |
|
|
if ( gof ) eplane[view][plane] = myene[view][plane]; |
943 |
|
|
if ( debug ) printf(" XE %i XO %i YE %i YO %i eplane %i %i = %f ........... myene %i %i = %f\n", maskXE, maskXO, maskYE, maskYO,view,plane,eplane[view][plane],view,plane,myene[view][plane]); |
944 |
|
|
}; |
945 |
|
|
}; |
946 |
|
|
// |
947 |
|
|
// inclination factor (stolen from Daniele's code) |
948 |
|
|
// |
949 |
|
|
Float_t ytgx = 0; |
950 |
|
|
Float_t ytgy = 0; |
951 |
|
|
ytgx = 0.76 * clp->tanx[0]; |
952 |
|
|
ytgy = 0.76 * clp->tany[0]; |
953 |
|
|
X0pl = sqrt( pow(0.76,2.) + pow(ytgx,2.) + pow(ytgy,2.) ); |
954 |
|
|
// |
955 |
|
|
// Find experimental plane of maximum |
956 |
|
|
// |
957 |
|
|
Int_t pmax = 0; |
958 |
|
|
Int_t vmax = 0; |
959 |
|
|
Float_t emax = 0.; |
960 |
|
|
for (Int_t v=0; v<2; v++){ |
961 |
|
|
for (Int_t i=0; i<22; i++){ |
962 |
|
|
if ( eplane[v][i] > emax ){ |
963 |
|
|
emax = eplane[v][i]; |
964 |
|
|
vmax = v; |
965 |
|
|
pmax = i; |
966 |
|
|
}; |
967 |
|
|
}; |
968 |
|
|
}; |
969 |
|
|
// |
970 |
|
|
// |
971 |
|
|
// |
972 |
|
|
if ( vmax == 0 ) pmax++; |
973 |
|
|
etmax = pmax * X0pl; |
974 |
|
|
// |
975 |
|
|
if ( debug ) this->Print(); |
976 |
|
|
if ( debug ) printf(" exit \n"); |
977 |
|
|
// |
978 |
|
|
}; |
979 |
mocchiut |
1.2 |
|
980 |
|
|
Double_t ccurve(Double_t *ti,Double_t *par){ |
981 |
|
|
// |
982 |
|
|
Double_t t = *ti; |
983 |
|
|
Double_t cE0 = par[0]; |
984 |
|
|
Double_t ca = par[1]; |
985 |
|
|
Double_t cb = par[2]; |
986 |
|
|
Double_t gammaa = TMath::Gamma(ca); |
987 |
|
|
// |
988 |
|
|
Double_t value = cE0 * cb * ( pow((cb * t),(ca - 1)) * exp( -cb * t ) ) / gammaa; |
989 |
|
|
// |
990 |
|
|
return value; |
991 |
|
|
// |
992 |
|
|
} |
993 |
|
|
|
994 |
|
|
void CaloLong::Fit(){ |
995 |
|
|
this->Fit(false); |
996 |
|
|
}; |
997 |
|
|
|
998 |
mocchiut |
1.12 |
Float_t CaloLong::Evaluate(TString s, Float_t tmax, Float_t X0pl){ |
999 |
mocchiut |
1.9 |
/* SAMPLE OUTPUT: |
1000 |
|
|
Enter Infix Expression : A + B + C / (E - F) |
1001 |
|
|
Postfix Expression is : A B + C E F - / + |
1002 |
|
|
*/ |
1003 |
mocchiut |
1.12 |
if ( !s.Contains("tmax") && !s.Contains("X0pl") ){ |
1004 |
mocchiut |
1.9 |
printf(" ERROR, the input formula must contain \"t\"\n"); |
1005 |
|
|
return 0.; |
1006 |
|
|
}; |
1007 |
mocchiut |
1.10 |
if ( tmax != tmax ){ |
1008 |
|
|
printf(" ERROR, tmax is nan! \n"); |
1009 |
|
|
return 0.; |
1010 |
|
|
}; |
1011 |
mocchiut |
1.9 |
TString g=Form("%f",tmax); |
1012 |
mocchiut |
1.12 |
TString h=Form("%f",X0pl); |
1013 |
mocchiut |
1.9 |
TString *ts= new TString(""); |
1014 |
|
|
ts->Prepend(s.Data()); |
1015 |
mocchiut |
1.12 |
ts->ReplaceAll("tmax",4,g.Data(),g.Capacity()); |
1016 |
|
|
ts->ReplaceAll("X0pl",4,h.Data(),h.Capacity()); |
1017 |
mocchiut |
1.9 |
ts->Prepend("("); |
1018 |
|
|
ts->Append(")"); |
1019 |
|
|
if ( debug ) printf(" ts %s tssize %i capac %i s %s g %s \n",ts->Data(),ts->Sizeof(),ts->Capacity(),s.Data(),g.Data()); |
1020 |
|
|
char in[50],post[50]; |
1021 |
|
|
strcpy(&in[0]," "); |
1022 |
|
|
strcpy(&in[0],ts->Data()); |
1023 |
|
|
strcpy(&post[0]," "); |
1024 |
|
|
if ( debug ) printf("Infix Expression is : ##%s##\n",&in[0]); |
1025 |
|
|
infix2postfix(&in[0],&post[0],1); |
1026 |
|
|
if ( debug ) printf("Postfix Expression is : ##%s##\n",&post[0]); |
1027 |
|
|
/* SAMPLE OUTPUT: |
1028 |
|
|
Enter Postfix Expression : 3 5 + 2 / |
1029 |
|
|
3 5 + 2 / EQUALS 4 |
1030 |
|
|
*/ |
1031 |
|
|
Float_t res = evaluate(&post[0]); |
1032 |
|
|
if ( debug ) printf("%s EQUALS %f\n",post,res); |
1033 |
|
|
return res; |
1034 |
|
|
} |
1035 |
|
|
|
1036 |
mocchiut |
1.2 |
void CaloLong::Fit(Bool_t draw){ |
1037 |
|
|
// |
1038 |
|
|
Process(); |
1039 |
|
|
// |
1040 |
|
|
// |
1041 |
|
|
if ( !L2 ){ |
1042 |
|
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
1043 |
|
|
printf(" ERROR: CaloHough variables not filled \n"); |
1044 |
|
|
return; |
1045 |
|
|
}; |
1046 |
|
|
// |
1047 |
|
|
Bool_t newentry = false; |
1048 |
|
|
// |
1049 |
|
|
if ( L2->IsORB() ){ |
1050 |
|
|
if ( L2->GetOrbitalInfo()->pkt_num != fPKT || L2->GetOrbitalInfo()->OBT != fOBT || L2->GetOrbitalInfo()->absTime != fatime ){ |
1051 |
|
|
newentry = true; |
1052 |
|
|
fOBT = L2->GetOrbitalInfo()->OBT; |
1053 |
|
|
fPKT = L2->GetOrbitalInfo()->pkt_num; |
1054 |
|
|
fatime = L2->GetOrbitalInfo()->absTime; |
1055 |
|
|
}; |
1056 |
|
|
} else { |
1057 |
|
|
newentry = true; |
1058 |
|
|
}; |
1059 |
|
|
// |
1060 |
|
|
if ( !newentry ) return; |
1061 |
|
|
// |
1062 |
|
|
if ( debug ) printf(" Start fitting event at OBT %u PKT %u time %u \n",fOBT,fPKT,fatime); |
1063 |
|
|
// |
1064 |
|
|
if ( draw ){ |
1065 |
|
|
gStyle->SetLabelSize(0.04); |
1066 |
|
|
gStyle->SetNdivisions(510,"XY"); |
1067 |
|
|
}; |
1068 |
|
|
// |
1069 |
|
|
TString hid = Form("clongfit"); |
1070 |
|
|
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
1071 |
|
|
// if ( tc ) tc->Delete(); |
1072 |
|
|
// if ( tc ) tc->Close(); |
1073 |
|
|
if ( !tc && draw ){ |
1074 |
|
|
tc = new TCanvas(hid,hid); |
1075 |
|
|
} else { |
1076 |
|
|
if ( tc ) tc->cd(); |
1077 |
|
|
}; |
1078 |
|
|
// |
1079 |
|
|
TString thid = Form("hlongfit"); |
1080 |
mocchiut |
1.11 |
TH2F *th = dynamic_cast<TH2F*>(gDirectory->FindObject(thid)); |
1081 |
mocchiut |
1.2 |
if ( th ) th->Delete(); |
1082 |
mocchiut |
1.11 |
// |
1083 |
|
|
TString ghid = Form("glongfit"); |
1084 |
|
|
TGraphErrors *gh = dynamic_cast<TGraphErrors*>(gDirectory->FindObject(ghid)); |
1085 |
|
|
if ( gh ) gh->Delete(); |
1086 |
|
|
// |
1087 |
mocchiut |
1.2 |
Float_t xpos = 0.; |
1088 |
|
|
Float_t enemip = 0.; |
1089 |
|
|
Float_t xmax = NC * X0pl + 0.2; |
1090 |
mocchiut |
1.11 |
// |
1091 |
|
|
Double_t xxx[50]; |
1092 |
|
|
Double_t exx[50]; |
1093 |
|
|
Double_t yyy[50]; |
1094 |
|
|
Double_t eyy[50]; |
1095 |
|
|
Int_t numpo = 0; |
1096 |
|
|
memset(xxx,0,50*sizeof(Double_t)); |
1097 |
|
|
memset(exx,0,50*sizeof(Double_t)); |
1098 |
|
|
memset(yyy,0,50*sizeof(Double_t)); |
1099 |
|
|
memset(eyy,0,50*sizeof(Double_t)); |
1100 |
mocchiut |
1.2 |
// |
1101 |
mocchiut |
1.4 |
// AGH, BUG! |
1102 |
|
|
// |
1103 |
|
|
Int_t mmin = 0; |
1104 |
|
|
Int_t mmax = 0; |
1105 |
|
|
if ( cont ){ |
1106 |
|
|
mmin = N; |
1107 |
|
|
mmax = NC+N; |
1108 |
|
|
} else { |
1109 |
|
|
mmin = 0; |
1110 |
|
|
mmax = NC; |
1111 |
|
|
}; |
1112 |
|
|
// |
1113 |
mocchiut |
1.11 |
Float_t emax = 0.; |
1114 |
mocchiut |
1.4 |
Float_t qtotparz = 0.; |
1115 |
|
|
for (Int_t st=mmin;st<mmax+1;st++){ |
1116 |
mocchiut |
1.2 |
enemip = 0.; |
1117 |
mocchiut |
1.4 |
xpos = (st - mmin) * X0pl; |
1118 |
mocchiut |
1.11 |
// |
1119 |
|
|
if ( xyaverage ){ |
1120 |
|
|
// |
1121 |
|
|
if ( st > mmin && st < mmax ){ |
1122 |
|
|
if ( no18x && ( st == 18+1 || st == mask18b+1 )){ |
1123 |
|
|
if ( !maskYO ){ |
1124 |
|
|
enemip = 2. * eplane[1][st]; |
1125 |
|
|
} else { |
1126 |
|
|
enemip = eplane[1][st]; |
1127 |
|
|
}; |
1128 |
mocchiut |
1.7 |
} else { |
1129 |
mocchiut |
1.11 |
enemip = eplane[0][st-1] + eplane[1][st]; |
1130 |
mocchiut |
1.7 |
}; |
1131 |
mocchiut |
1.2 |
} else { |
1132 |
mocchiut |
1.11 |
if ( st == mmin ){ |
1133 |
|
|
if ( !maskYE ){ |
1134 |
|
|
enemip = 2. * eplane[1][st]; |
1135 |
|
|
} else { |
1136 |
|
|
enemip = eplane[1][st]; |
1137 |
|
|
}; |
1138 |
|
|
}; |
1139 |
|
|
if ( st == mmax ){ |
1140 |
|
|
if ( !maskXE ){ |
1141 |
|
|
enemip = 2. * eplane[0][st-1]; |
1142 |
|
|
} else { |
1143 |
|
|
enemip = eplane[0][st-1]; |
1144 |
|
|
}; |
1145 |
|
|
}; |
1146 |
|
|
}; |
1147 |
|
|
// |
1148 |
|
|
qtotparz += enemip; |
1149 |
|
|
if ( enemip > emax ) emax = enemip; |
1150 |
|
|
if ( enemip > 0. ){ |
1151 |
|
|
xxx[numpo] = xpos; |
1152 |
|
|
exx[numpo] = 0.1; |
1153 |
|
|
yyy[numpo] = enemip; |
1154 |
|
|
eyy[numpo] = sqrt(enemip*3.)+sqrt(5.); |
1155 |
|
|
numpo++; |
1156 |
|
|
// th->Fill(xpos,enemip); |
1157 |
|
|
if ( debug ) printf(" AVE Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
1158 |
mocchiut |
1.2 |
}; |
1159 |
|
|
} else { |
1160 |
mocchiut |
1.11 |
for (Int_t jj=0; jj<2; jj++){ |
1161 |
|
|
if ( st > mmin && st < mmax ){ |
1162 |
|
|
if ( jj == 0 && no18x && ( st == 18+1 || st == mask18b+1 )){ |
1163 |
|
|
enemip = eplane[1][st]; |
1164 |
|
|
} else { |
1165 |
|
|
if ( jj == 0 ){ |
1166 |
|
|
enemip = eplane[jj][st-1]; |
1167 |
|
|
} else { |
1168 |
|
|
enemip = eplane[jj][st]; |
1169 |
|
|
}; |
1170 |
|
|
}; |
1171 |
mocchiut |
1.7 |
} else { |
1172 |
mocchiut |
1.11 |
if ( st == mmin && jj == 1 ){ |
1173 |
|
|
enemip = eplane[jj][st]; |
1174 |
|
|
}; |
1175 |
|
|
if ( st == mmax && jj == 0){ |
1176 |
|
|
enemip = eplane[jj][st-1]; |
1177 |
|
|
}; |
1178 |
mocchiut |
1.7 |
}; |
1179 |
mocchiut |
1.11 |
// |
1180 |
|
|
qtotparz += enemip; |
1181 |
|
|
if ( enemip > emax ) emax = enemip; |
1182 |
|
|
if ( enemip > 0. ){ |
1183 |
|
|
xxx[numpo] = xpos; |
1184 |
|
|
exx[numpo] = 0.1; |
1185 |
|
|
yyy[numpo] = enemip; |
1186 |
|
|
eyy[numpo] = sqrt(enemip*3.)+sqrt(5.); |
1187 |
|
|
// eyy[numpo] = sqrt(enemip)/(st*0.95); |
1188 |
|
|
numpo++; |
1189 |
|
|
// th->Fill(xpos,enemip); |
1190 |
|
|
if ( debug ) printf(" XY Filling: st %i xpos %f energy %f \n",st,xpos,enemip); |
1191 |
mocchiut |
1.7 |
}; |
1192 |
mocchiut |
1.11 |
}; |
1193 |
mocchiut |
1.2 |
}; |
1194 |
mocchiut |
1.11 |
|
1195 |
mocchiut |
1.2 |
// |
1196 |
|
|
// for (Int_t v=1; v>=0;v--)// { |
1197 |
|
|
// // |
1198 |
|
|
// if ( v == 1 ){ |
1199 |
|
|
// xpos = (st - N) * X0pl; |
1200 |
|
|
// } else { |
1201 |
|
|
// xpos = (st + 1 - N) * X0pl; |
1202 |
|
|
// }; |
1203 |
|
|
// // |
1204 |
|
|
// if ( no18x && st == 18 && v == 0 ){ |
1205 |
|
|
// // skip plane 18x |
1206 |
|
|
// } else { |
1207 |
|
|
// if ( v == 1 && st == mask18b ){ |
1208 |
|
|
// // emulate plane 18x |
1209 |
|
|
// } else { |
1210 |
|
|
// if ( eplane[v][st] > 0. ){ |
1211 |
|
|
// th->Fill(xpos,eplane[v][st]); |
1212 |
|
|
// if ( debug ) printf(" Filling: st %i v %i xpos %f energy %f \n",st,v,xpos,eplane[v][st]); |
1213 |
|
|
// }; |
1214 |
|
|
// }; |
1215 |
|
|
// }; |
1216 |
|
|
// // |
1217 |
|
|
// }; |
1218 |
|
|
}; |
1219 |
|
|
// |
1220 |
mocchiut |
1.11 |
// th = new TH2F(thid,thid,int(NC*1.5),-0.2,xmax); |
1221 |
|
|
th = new TH2F(thid,thid,1000,-0.2,xmax,1000,0.,emax*1.2); |
1222 |
|
|
gh = new TGraphErrors(numpo,xxx,yyy,exx,eyy); |
1223 |
|
|
TF1 *lfit = dynamic_cast<TF1*>(gDirectory->FindObject("lfit")); |
1224 |
|
|
if ( lfit ) lfit->Delete(); |
1225 |
|
|
lfit = new TF1("lfit",ccurve,0.,xmax,3); |
1226 |
mocchiut |
1.8 |
if ( debug ) printf("qtot %f qtotparz %f \n",clp->qtot,qtotparz); |
1227 |
mocchiut |
1.4 |
E0 = qtotparz; |
1228 |
mocchiut |
1.8 |
// E0 = clp->qtot; |
1229 |
mocchiut |
1.2 |
a = 5.; |
1230 |
|
|
b = 0.5; |
1231 |
|
|
if ( debug ) printf(" STARTING PARAMETERS: E0 %f a %f b %f \n",E0,a,b); |
1232 |
|
|
lfit->SetParameters(E0,a,b); |
1233 |
|
|
// lfit->SetParLimits(0,0.,1000.); |
1234 |
|
|
// lfit->SetParLimits(1,-1.,80.); |
1235 |
|
|
// lfit->SetParLimits(2,-1.,10.); |
1236 |
mocchiut |
1.11 |
// TString optio = "ROW"; // "RO" |
1237 |
|
|
TString optio = "RO"; // "RO" |
1238 |
mocchiut |
1.2 |
if ( debug ){ |
1239 |
mocchiut |
1.11 |
optio += "NV"; |
1240 |
|
|
if ( draw ) optio += "V"; |
1241 |
|
|
} else { |
1242 |
|
|
optio += "NQ"; |
1243 |
|
|
if ( draw ) optio += "Q"; |
1244 |
mocchiut |
1.2 |
}; |
1245 |
|
|
// |
1246 |
|
|
if ( debug ) printf(" OK, start the fitting procedure...\n"); |
1247 |
|
|
// |
1248 |
mocchiut |
1.11 |
// fitresult = th->Fit("lfit",optio); |
1249 |
|
|
fitresult = gh->Fit("lfit",optio); |
1250 |
mocchiut |
1.2 |
// |
1251 |
|
|
if ( debug ) printf(" the fit is done! result: %i \n",fitresult); |
1252 |
|
|
// |
1253 |
|
|
E0 = lfit->GetParameter(0); |
1254 |
|
|
a = lfit->GetParameter(1); |
1255 |
|
|
b = lfit->GetParameter(2); |
1256 |
|
|
errE0 = lfit->GetParError(0); |
1257 |
|
|
erra = lfit->GetParError(1); |
1258 |
|
|
errb = lfit->GetParError(2); |
1259 |
|
|
chi2 = lfit->GetChisquare(); |
1260 |
|
|
ndf = lfit->GetNDF(); |
1261 |
|
|
Float_t tmax = 0.; |
1262 |
|
|
if ( debug ) printf(" Parameters are retrieved \n"); |
1263 |
|
|
if ( b != 0 ) tmax = (a - 1.)/b; |
1264 |
|
|
// |
1265 |
|
|
if ( fitresult != 0 ){ |
1266 |
|
|
if ( debug ) printf(" The fit failed, no integrals calculation and asymm is set to -1. \n"); |
1267 |
|
|
asymm = -1.; |
1268 |
mocchiut |
1.9 |
defE0 = -1.; |
1269 |
mocchiut |
1.2 |
} else { |
1270 |
mocchiut |
1.12 |
if ( slmax.MaybeRegexp() ) lmax = this->Evaluate(slmax,tmax,X0pl); |
1271 |
|
|
if ( sumax.MaybeRegexp() ) umax = this->Evaluate(sumax,tmax,X0pl); |
1272 |
mocchiut |
1.2 |
Int_t npp = 1000; |
1273 |
mocchiut |
1.9 |
double *xpp=new double[npp]; |
1274 |
|
|
double *wpp=new double[npp]; |
1275 |
|
|
lfit->CalcGaussLegendreSamplingPoints(npp,xpp,wpp,1e-12); |
1276 |
|
|
defE0 = lfit->IntegralFast(npp,xpp,wpp,lmax,umax); |
1277 |
|
|
// |
1278 |
mocchiut |
1.2 |
double *xp=new double[npp]; |
1279 |
|
|
double *wp=new double[npp]; |
1280 |
|
|
lfit->CalcGaussLegendreSamplingPoints(npp,xp,wp,1e-12); |
1281 |
|
|
Float_t imax = lfit->IntegralFast(npp,xp,wp,0.,tmax); |
1282 |
|
|
// Float_t imax = lfit->Integral(0.,tmax); |
1283 |
|
|
if ( debug ) printf(" Integral till maximum (%f): %f \n",tmax,imax); |
1284 |
|
|
Int_t np = 1000; |
1285 |
|
|
double *x=new double[np]; |
1286 |
|
|
double *w=new double[np]; |
1287 |
|
|
lfit->CalcGaussLegendreSamplingPoints(np,x,w,1e-12); |
1288 |
|
|
Float_t i10max = lfit->IntegralFast(np,x,w,0.,10.*tmax); |
1289 |
|
|
delete x; |
1290 |
|
|
delete w; |
1291 |
|
|
delete xp; |
1292 |
|
|
delete wp; |
1293 |
|
|
// Float_t i10max = lfit->Integral(0.,10.*tmax); |
1294 |
|
|
if ( debug ) printf(" Integral: %f \n",i10max); |
1295 |
|
|
// |
1296 |
|
|
if ( i10max != imax ){ |
1297 |
|
|
asymm = imax / (i10max-imax); |
1298 |
|
|
} else { |
1299 |
|
|
if ( debug ) printf(" i10max == imax, asymm undefined\n"); |
1300 |
|
|
asymm = -2.; |
1301 |
|
|
}; |
1302 |
mocchiut |
1.4 |
if ( asymm != asymm ){ |
1303 |
|
|
if ( debug ) printf(" asymm is nan \n"); |
1304 |
|
|
asymm = -3.; |
1305 |
|
|
}; |
1306 |
mocchiut |
1.2 |
//lfit->Integral(0.,tmax)/(lfit->Integral(0.,10.*tmax)-lfit->Integral(0.,tmax)); |
1307 |
|
|
if ( debug ) printf(" Asymmetry has been calculated \n"); |
1308 |
|
|
}; |
1309 |
|
|
// |
1310 |
mocchiut |
1.4 |
if ( asymm < 0. || ndf <= 0. || chi2 < 0. || tmax < 0. ){ |
1311 |
|
|
if ( debug ) printf(" Funny asymm||ndf||chi2||tmax values, fit failed \n"); |
1312 |
|
|
fitresult = 100; |
1313 |
|
|
}; |
1314 |
|
|
// |
1315 |
mocchiut |
1.2 |
if ( draw ){ |
1316 |
|
|
// |
1317 |
|
|
tc->cd(); |
1318 |
|
|
// gStyle->SetOptStat(11111); |
1319 |
|
|
tc->SetTitle(); |
1320 |
|
|
th->SetTitle(""); |
1321 |
|
|
th->SetName(""); |
1322 |
|
|
th->SetMarkerStyle(20); |
1323 |
|
|
// axis titles |
1324 |
|
|
th->SetXTitle("Depth [X0]"); |
1325 |
|
|
th->SetYTitle("Energy [MIP]"); |
1326 |
mocchiut |
1.11 |
// th->DrawCopy("Perror"); |
1327 |
|
|
th->DrawCopy(); |
1328 |
|
|
gh->SetMarkerSize(1.); |
1329 |
|
|
gh->SetMarkerStyle(21); |
1330 |
|
|
// gh->SetMarkerColor(kRed); |
1331 |
|
|
gh->Draw("Psame"); |
1332 |
mocchiut |
1.2 |
lfit->Draw("same"); |
1333 |
|
|
tc->Modified(); |
1334 |
|
|
tc->Update(); |
1335 |
|
|
// |
1336 |
|
|
gStyle->SetLabelSize(0); |
1337 |
|
|
gStyle->SetNdivisions(1,"XY"); |
1338 |
|
|
// |
1339 |
mocchiut |
1.4 |
} else { |
1340 |
|
|
if ( th ) th->Delete(); |
1341 |
mocchiut |
1.2 |
}; |
1342 |
|
|
// |
1343 |
mocchiut |
1.11 |
// delete lfit; |
1344 |
mocchiut |
1.2 |
// |
1345 |
|
|
}; |
1346 |
|
|
|
1347 |
|
|
void CaloLong::Draw(){ |
1348 |
|
|
// |
1349 |
|
|
Process(); |
1350 |
|
|
Draw(-1); |
1351 |
|
|
}; |
1352 |
|
|
|
1353 |
|
|
void CaloLong::Draw(Int_t view){ |
1354 |
|
|
// |
1355 |
|
|
Int_t minv = 0; |
1356 |
|
|
Int_t maxv = 0; |
1357 |
|
|
// |
1358 |
|
|
if ( view == -1 ){ |
1359 |
|
|
maxv = -1; |
1360 |
|
|
} else { |
1361 |
|
|
minv = view; |
1362 |
|
|
maxv = view+1; |
1363 |
|
|
}; |
1364 |
|
|
// |
1365 |
|
|
Process(); |
1366 |
|
|
// |
1367 |
|
|
gStyle->SetLabelSize(0.04); |
1368 |
|
|
gStyle->SetNdivisions(510,"XY"); |
1369 |
|
|
// |
1370 |
|
|
if ( maxv != -1 ){ |
1371 |
|
|
for (Int_t v=minv; v<maxv;v++){ |
1372 |
|
|
TString hid = Form("clongv%i",v); |
1373 |
|
|
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
1374 |
|
|
if ( tc ){ |
1375 |
|
|
// tc->Clear(); |
1376 |
|
|
} else { |
1377 |
|
|
tc = new TCanvas(hid,hid); |
1378 |
|
|
}; |
1379 |
|
|
// |
1380 |
|
|
TString thid = Form("hlongv%i",v); |
1381 |
|
|
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
1382 |
|
|
if ( th ) th->Delete(); |
1383 |
|
|
// th->Clear(); |
1384 |
|
|
// th->Reset(); |
1385 |
|
|
// } else { |
1386 |
|
|
th = new TH1F(thid,thid,22,-0.5,21.5); |
1387 |
|
|
// }; |
1388 |
|
|
tc->cd(); |
1389 |
|
|
// |
1390 |
|
|
for (Int_t st=0;st<22;st++){ |
1391 |
|
|
th->Fill(st,eplane[v][st]); |
1392 |
|
|
}; |
1393 |
|
|
th->Draw(); |
1394 |
|
|
tc->Modified(); |
1395 |
|
|
tc->Update(); |
1396 |
|
|
}; |
1397 |
|
|
} else { |
1398 |
|
|
// |
1399 |
|
|
TString hid = Form("clongvyvx"); |
1400 |
|
|
TCanvas *tc = dynamic_cast<TCanvas*>(gDirectory->FindObject(hid)); |
1401 |
|
|
if ( tc ){ |
1402 |
|
|
} else { |
1403 |
|
|
tc = new TCanvas(hid,hid); |
1404 |
|
|
}; |
1405 |
|
|
// |
1406 |
|
|
TString thid = Form("hlongvyvx"); |
1407 |
|
|
TH1F *th = dynamic_cast<TH1F*>(gDirectory->FindObject(thid)); |
1408 |
|
|
if ( th ) th->Delete(); |
1409 |
|
|
th = new TH1F(thid,thid,44,-0.5,43.5); |
1410 |
|
|
tc->cd(); |
1411 |
|
|
Int_t pp=0; |
1412 |
|
|
for (Int_t st=0;st<22;st++){ |
1413 |
|
|
for (Int_t v=1; v>=0;v--){ |
1414 |
|
|
// |
1415 |
|
|
th->Fill(pp,eplane[v][st]); |
1416 |
|
|
// |
1417 |
|
|
pp++; |
1418 |
|
|
}; |
1419 |
|
|
}; |
1420 |
|
|
th->Draw(); |
1421 |
|
|
tc->Modified(); |
1422 |
|
|
tc->Update(); |
1423 |
|
|
}; |
1424 |
|
|
// |
1425 |
|
|
gStyle->SetLabelSize(0); |
1426 |
|
|
gStyle->SetNdivisions(1,"XY"); |
1427 |
|
|
// |
1428 |
|
|
}; |
1429 |
|
|
|
1430 |
|
|
void CaloLong::Delete(){ |
1431 |
|
|
Clear(); |
1432 |
|
|
//delete this; |
1433 |
|
|
}; |
1434 |
mocchiut |
1.9 |
|
1435 |
|
|
|
1436 |
|
|
|
1437 |
|
|
|
1438 |
|
|
|
1439 |
|
|
|
1440 |
|
|
|
1441 |
|
|
|
1442 |
|
|
|
1443 |
|
|
|
1444 |
|
|
|
1445 |
|
|
|
1446 |
|
|
|
1447 |
|
|
|
1448 |
|
|
|
1449 |
|
|
|
1450 |
|
|
|
1451 |
|
|
|
1452 |
|
|
|
1453 |
|
|
|