92 |
}; |
}; |
93 |
|
|
94 |
|
|
95 |
void CaloBragg::CleanPlanes(Float_t epiano[22][2]){ |
void CaloBragg::CleanPlanes(Float_t epiano[22][2], Bool_t zpiano[22][2]){ |
96 |
// return; |
// return; |
97 |
Int_t hitplanes = 0; |
Int_t hitplanes = 0; |
98 |
|
Float_t f5 = 0.; |
99 |
for (Int_t i = 0; i<22; i++){ |
for (Int_t i = 0; i<22; i++){ |
100 |
for (Int_t j = 1; j>=0; j--){ |
for (Int_t j = 1; j>=0; j--){ |
101 |
if ( epiano[i][j] > 0.7 ) hitplanes++; |
zpiano[i][j] = false; |
102 |
|
if ( epiano[i][j] > 0.7 ){ |
103 |
|
if ( hitplanes < 100 ) f5 += epiano[i][j]; |
104 |
|
hitplanes++; |
105 |
|
}; |
106 |
}; |
}; |
107 |
}; |
}; |
108 |
|
Int_t atl5 = TMath::Min(hitplanes,100); |
109 |
|
atl5 = TMath::Max(atl5,1); |
110 |
Float_t lowlim = 0.85; |
Float_t lowlim = 0.85; |
111 |
|
//Float_t lowlim = 1.; |
112 |
Float_t dedxone = 0.; |
Float_t dedxone = 0.; |
113 |
Float_t step1 = 0.8*L2->GetCaloLevel2()->qtot/(Float_t)hitplanes; |
// Float_t step1 = 0.8*L2->GetCaloLevel2()->qtot/(Float_t)hitplanes; |
114 |
while ( dedxone < step1 ){ |
Float_t step1 = 0.8*f5/atl5; |
115 |
|
// while ( dedxone < step1 ){ |
116 |
for (Int_t i = 0; i<22; i++){ |
for (Int_t i = 0; i<22; i++){ |
117 |
for (Int_t j = 1; j>=0; j--){ |
for (Int_t j = 1; j>=0; j--){ |
118 |
|
if (debug) printf("Acleanplanes: i %i j %i step1 %f dedxone %f epiano[i][j] %f \n",i,j,step1,dedxone,epiano[i][j]); |
119 |
if ( epiano[i][j] >= step1 && dedxone < 0.7 ) dedxone = epiano[i][j]; |
if ( epiano[i][j] >= step1 && dedxone < 0.7 ) dedxone = epiano[i][j]; |
120 |
|
if ( dedxone >= step1 ) break; // new |
121 |
}; |
}; |
122 |
|
if ( dedxone >= step1 ) break; // new |
123 |
}; |
}; |
124 |
} |
// } |
125 |
if ( dedxone < 0.7 ){ |
if ( dedxone < 0.7 ){ // here we could have instead while dedxone == 0. ... perhaps better... |
126 |
for (Int_t i = 0; i<22; i++){ |
for (Int_t i = 0; i<22; i++){ |
127 |
for (Int_t j = 1; j>=0; j--){ |
for (Int_t j = 1; j>=0; j--){ |
128 |
|
if (debug) printf("Bcleanplanes dedxone < 0.7: i %i j %i step1 %f dedxone %f epiano[i][j] %f \n",i,j,step1,dedxone,epiano[i][j]); |
129 |
if ( epiano[i][j] > 0. && dedxone < 0.7 ) dedxone = epiano[i][j]; |
if ( epiano[i][j] > 0. && dedxone < 0.7 ) dedxone = epiano[i][j]; |
130 |
|
if ( dedxone >= 0.7 ) break; // new |
131 |
}; |
}; |
132 |
|
if ( dedxone >= 0.7 ) break; // new |
133 |
}; |
}; |
134 |
} |
} |
135 |
// |
// |
140 |
for (Int_t i = 0; i<22; i++){ |
for (Int_t i = 0; i<22; i++){ |
141 |
for (Int_t j = 1; j>=0; j--){ |
for (Int_t j = 1; j>=0; j--){ |
142 |
if ( epiano[i][j] < dedxone*lowlim ){ |
if ( epiano[i][j] < dedxone*lowlim ){ |
143 |
// printf(" %i %i epiano %f limit %f nulliferus %i nullius %i \n",i,j,epiano[i][j],dedxone*lowlim,nulliferus,nullius); |
if ( debug ) printf("Ccleanplanes: %i %i epiano %f limit %f nulliferus %i nullius %i \n",i,j,epiano[i][j],dedxone*lowlim,nulliferus,nullius); |
144 |
epiano[i][j] = 0.; |
// epiano[i][j] = 0.; |
145 |
|
zpiano[i][j] = true; |
146 |
|
if ( epiano[i][j] < dedxone*0.05 ) epiano[i][j] = 0.; |
147 |
} else { |
} else { |
148 |
//x printf(" %i %i epiano %f limit %f nulliferus %i nullius %i \n",i,j,epiano[i][j],dedxone*lowlim,nulliferus,nullius); |
if ( debug ) printf("Dcleanplanes else: %i %i epiano %f limit %f nulliferus %i nullius %i \n",i,j,epiano[i][j],dedxone*lowlim,nulliferus,nullius); |
149 |
nulliferus = 0; |
nulliferus = 0; |
150 |
revulsera = true; |
revulsera = true; |
151 |
}; |
}; |
152 |
if ( epiano[i][j] < 0.7 && revulsera ) nulliferus++; |
// if ( epiano[i][j] < 0.7 && revulsera ) nulliferus++; |
153 |
|
if ( (zpiano[i][j] || epiano[i][j] < 0.7 ) && revulsera ) nulliferus++; |
154 |
if ( nulliferus > 10 ) nullius = true; |
if ( nulliferus > 10 ) nullius = true; |
155 |
if ( nullius ) epiano[i][j] = 0.; |
// if ( nullius ) epiano[i][j] = 0.; |
156 |
|
if ( nullius ) zpiano[i][j] = true; |
157 |
}; |
}; |
158 |
}; |
}; |
159 |
|
|
210 |
// |
// |
211 |
}; |
}; |
212 |
// |
// |
213 |
this->CleanPlanes(*&epiano); |
Bool_t zpiano[22][2]; |
214 |
|
this->CleanPlanes(*&epiano, *&zpiano); |
215 |
// |
// |
216 |
PamTrack *ptrack = 0; |
PamTrack *ptrack = 0; |
217 |
CaloTrkVar *track = 0; |
CaloTrkVar *track = 0; |
240 |
if(L2->GetCaloLevel2()->npcfit[0]==0 && L2->GetCaloLevel2()->npcfit[1]==0 && L2->GetCaloLevel2()->npcfit[2]==0 && L2->GetCaloLevel2()->npcfit[3]==0) return;// controllo sulla traccia nel calorimetro |
if(L2->GetCaloLevel2()->npcfit[0]==0 && L2->GetCaloLevel2()->npcfit[1]==0 && L2->GetCaloLevel2()->npcfit[2]==0 && L2->GetCaloLevel2()->npcfit[3]==0) return;// controllo sulla traccia nel calorimetro |
241 |
|
|
242 |
// |
// |
243 |
|
Bool_t zcalo[44]; |
244 |
for(Int_t p=0; p<22; p++){ |
for(Int_t p=0; p<22; p++){ |
245 |
for(Int_t v=0; v<2; v++){ |
for(Int_t v=0; v<2; v++){ |
246 |
/*per usare traccia non del calo camboare cibar*/ |
/*per usare traccia non del calo camboare cibar*/ |
247 |
calorimetro[(2*p)+1-v][0] = L2->GetCaloLevel2()->cibar[p][v];//strip attraversata |
calorimetro[(2*p)+1-v][0] = L2->GetCaloLevel2()->cibar[p][v];//strip attraversata |
248 |
calorimetro[(2*p)+1-v][1] = epiano[p][v]; //energia del piano //(epiano[p][v])/0.89 |
calorimetro[(2*p)+1-v][1] = epiano[p][v]; //energia del piano //(epiano[p][v])/0.89 |
249 |
|
zcalo[(2*p)+1-v] = zpiano[p][v]; |
250 |
|
if ( debug ) printf(" idx %i %f %i \n",(2*p)+1-v,epiano[p][v], zpiano[p][v]); |
251 |
}; |
}; |
252 |
}; |
}; |
253 |
|
|
311 |
// |
// |
312 |
|
|
313 |
Float_t lastok = 0.; |
Float_t lastok = 0.; |
314 |
|
// if ( false ){ |
315 |
// Bool_t goback = false; |
// Bool_t goback = false; |
316 |
for ( int o = 0; o < estremi[1][0]; o++ ){ |
for ( int o = 0; o < estremi[1][0]; o++ ){ |
317 |
// |
// |
318 |
if ( calorimetro[o][1] > 0.7 ) lastok = calorimetro[o][1]; |
if (debug) printf(" goforth1: o %i calo %f lastok %f \n",o,calorimetro[o][1],lastok); |
319 |
if ( calorimetro[o][1] < 0.7 && lastok > 0. ) calorimetro[o][1] = lastok; |
if ( calorimetro[o][1] > 0.7 && !zcalo[o] ) lastok = calorimetro[o][1]; |
320 |
|
if ( (zcalo[o] || calorimetro[o][1] < 0.7) && lastok > 0. ){ |
321 |
|
if ( fabs(calorimetro[o][1]-lastok)/calorimetro[o][1] > 0.5 ) { |
322 |
|
if (debug) printf(" goforthchange %f %f \n",calorimetro[o][1],lastok); |
323 |
|
calorimetro[o][1] = lastok; |
324 |
|
if (debug) printf(" goforthchang+ %f %f \n",calorimetro[o][1],lastok); |
325 |
|
} |
326 |
|
} |
327 |
|
if (debug) printf(" goforth2: o %i calo %f lastok %f \n",o,calorimetro[o][1],lastok); |
328 |
// if ( calorimetro[o][1] < 0.7 ) goback = true; |
// if ( calorimetro[o][1] < 0.7 ) goback = true; |
329 |
// |
// |
330 |
}; |
}; |
332 |
// if ( goback ){ |
// if ( goback ){ |
333 |
for ( int o = estremi[1][0]; o >= 0; o-- ){ |
for ( int o = estremi[1][0]; o >= 0; o-- ){ |
334 |
// |
// |
335 |
// printf(" goback1: o %i calo %f lastok %f \n",o,calorimetro[o][1],lastok); |
if (debug) printf(" goback1: o %i calo %f lastok %f \n",o,calorimetro[o][1],lastok); |
336 |
if ( o < estremi[1][0] && calorimetro[o][1] > calorimetro[o+1][1]*1.2 && lastok > 0. ) calorimetro[o][1] = lastok; |
if ( o < estremi[1][0] && calorimetro[o][1] > calorimetro[o+1][1]*1.2 && lastok > 0. ) calorimetro[o][1] = lastok; |
337 |
if ( calorimetro[o][1] > 0.7 ) lastok = calorimetro[o][1]; |
if ( calorimetro[o][1] > 0.7 && !zcalo[o] ) lastok = calorimetro[o][1]; |
338 |
if ( calorimetro[o][1] < 0.7 && lastok > 0. ) calorimetro[o][1] = lastok; |
if ( (zcalo[o] || calorimetro[o][1] < 0.7) && lastok > 0. ){ |
339 |
// printf(" goback2: o %i calo %f lastok %f \n",o,calorimetro[o][1],lastok); |
if ( fabs(calorimetro[o][1]-lastok)/calorimetro[o][1] > 0.5 ) { |
340 |
|
if ( debug ) printf(" gobackchange \n"); |
341 |
|
calorimetro[o][1] = lastok; |
342 |
|
} |
343 |
|
} |
344 |
|
if (debug) printf(" goback2: o %i calo %f lastok %f \n",o,calorimetro[o][1],lastok); |
345 |
// |
// |
346 |
}; |
}; |
347 |
// }; |
// }; |
348 |
|
//} |
349 |
|
|
350 |
if ( startZero ) { |
if ( startZero ) { |
351 |
estremi[0][0] = 0.; |
estremi[0][0] = 0.; |
494 |
TString thid2 = Form("hCaloBragg2"); |
TString thid2 = Form("hCaloBragg2"); |
495 |
TH2F *th2 = dynamic_cast<TH2F*>(gDirectory->FindObject(thid2)); |
TH2F *th2 = dynamic_cast<TH2F*>(gDirectory->FindObject(thid2)); |
496 |
if ( th2 ) th2->Delete(); |
if ( th2 ) th2->Delete(); |
497 |
th2 = new TH2F(thid2,thid2,300,-0.5,300.,1000,0.,150.); |
th2 = new TH2F(thid2,thid2,300,-0.5,300.,1000,0.,25.); //150 |
498 |
th2->SetMarkerStyle(20); |
th2->SetMarkerStyle(20); |
499 |
th2->SetMarkerColor(kRed); |
th2->SetMarkerColor(kRed); |
500 |
// |
// |
501 |
TString thid3 = Form("hCaloBragg3"); |
TString thid3 = Form("hCaloBragg3"); |
502 |
TH2F *th3 = dynamic_cast<TH2F*>(gDirectory->FindObject(thid3)); |
TH2F *th3 = dynamic_cast<TH2F*>(gDirectory->FindObject(thid3)); |
503 |
if ( th3 ) th3->Delete(); |
if ( th3 ) th3->Delete(); |
504 |
th3 = new TH2F(thid3,thid3,300,-0.5,300.,1000,0.,150.); |
th3 = new TH2F(thid3,thid3,300,-0.5,300.,1000,0.,25.);//150. |
505 |
th3->SetMarkerStyle(20); |
th3->SetMarkerStyle(20); |
506 |
th3->SetMarkerColor(kBlue); |
th3->SetMarkerColor(kBlue); |
507 |
|
|
996 |
}else{ |
}else{ |
997 |
out[ipla] = dE; //MeV |
out[ipla] = dE; //MeV |
998 |
Ezero = Ezero - dE;//energia residua |
Ezero = Ezero - dE;//energia residua |
999 |
if ( debug ) printf(" zompa %i out %f dE %f ezero %f \n",ipla,out[ipla],dE,Ezero); |
// if ( debug ) printf(" zompa %i out %f dE %f ezero %f \n",ipla,out[ipla],dE,Ezero); |
1000 |
}; |
}; |
1001 |
//se sono su un piano Y (tutti i pari) dopo c'e' il tungsteno |
//se sono su un piano Y (tutti i pari) dopo c'e' il tungsteno |
1002 |
if(ipla%2 == 0){ |
if(ipla%2 == 0){ |