]>
Commit | Line | Data |
---|---|---|
d599d913 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
17 | ||
d599d913 | 18 | //_________________________________________________________________________ |
0e46b9ae | 19 | // |
d599d913 | 20 | // This is a TTask that made the calculation of the Time zero using TOF. |
7aeeaf38 | 21 | // Description: The algorithm used to calculate the time zero of |
22 | // interaction using TOF detector is the following. | |
23 | // We select in the MonteCarlo some primary particles - or tracks in | |
24 | // the following - that strike the TOF detector (the larger part are | |
25 | // pions, kaons or protons). | |
26 | // We choose a set of 10 selected tracks, for each track You have the | |
27 | // length of the track when the TOF is reached (a standard TOF hit | |
28 | // does not contain this additional information, this is the reason | |
29 | // why we implemented a new time zero dedicated TOF hit class | |
30 | // AliTOFhitT0; in order to store this type of hit You have to use the | |
31 | // AliTOFv4T0 as TOF class in Your Config.C. In AliTOFv4T0 the | |
32 | // StepManager was modified in order to fill the TOF hit branch with | |
33 | // this type of hits; in fact the AliTOF::AddT0Hit is called rather | |
34 | // that the usual AliTOF::AddHit), the momentum at generation (from | |
35 | // TreeK) and the time of flight given by the TOF detector. | |
36 | // (Observe that the ctor of the AliTOF class, when the AliTOFv4T0 | |
37 | // class is used, is called with the "tzero" option: it is in order | |
38 | // create the fHits TClonesArray filled with AliTOFhitT0 objects, | |
39 | // rather than with normal AliTOFhit) | |
40 | // Then Momentum and time of flight for each track are smeared | |
41 | // according to known experimental resolution (all sources of error | |
42 | // have been token into account). | |
43 | // Let consider now only one set of 10 tracks (the algorithm is the | |
44 | // same for all sets). | |
45 | // Assuming the (mass) hypothesis that each track can be AUT a pion, | |
46 | // AUT a kaon, AUT a proton, we consider all the 3 at 10 possible | |
47 | // cases. | |
d599d913 | 48 | // For each track in each (mass) configuration |
7aeeaf38 | 49 | // (a configuration can be |
50 | // e.g. pion/pion/kaon/proton/pion/proton/kaon/kaon/pion/pion) | |
51 | // we calculate the time zero (we know in fact the velocity of the | |
52 | // track after the assumption about its mass, the time of flight given | |
53 | // by the TOF, and the corresponding path travelled till the TOF | |
54 | // detector). Then for each mass configuration we have 10 time zero | |
55 | // and we can calculate the ChiSquare for the current configuration | |
56 | // using the weighted mean over all 10 time zero. | |
57 | // We call the best assignment the mass configuration that gives the | |
58 | // minimum value of the ChiSquare. | |
59 | // We plot the weighted mean over all 10 time zero for the best | |
60 | // assignment, the ChiSquare for the best assignment and the | |
61 | // corresponding confidence level. | |
62 | // The strong assumption is the MC selection of primary particles. It | |
63 | // will be introduced in the future also some more realistic | |
64 | // simulation about this point. | |
0e46b9ae | 65 | // |
d599d913 | 66 | // Use case: |
67 | // root [0] AliTOFT0 * tzero = new AliTOFT0("galice.root") | |
68 | // Warning in <TDatabasePDG::TDatabasePDG>: object already instantiated | |
69 | // root [1] tzero->ExecuteTask() | |
70 | // root [2] tzero->ExecuteTask("tim") | |
71 | // // available parameters: | |
72 | // tim - print benchmarking information | |
7aeeaf38 | 73 | // all - print usefull informations about the number of |
74 | // misidentified tracks and a comparison about the | |
75 | // true configuration (known from MC) and the best | |
d599d913 | 76 | // assignment |
0e46b9ae | 77 | // |
d599d913 | 78 | //-- Author: F. Pierella |
0e46b9ae | 79 | // |
80 | //_________________________________________________________________________ | |
81 | ||
e939a978 | 82 | #include <TCanvas.h> |
83 | #include <TClonesArray.h> | |
84 | #include <TFile.h> | |
85 | #include <TFolder.h> | |
86 | #include <TFrame.h> | |
87 | #include <TH1.h> | |
88 | #include <TParticle.h> | |
89 | #include <TBenchmark.h> | |
90 | #include <TTask.h> | |
91 | #include <TTree.h> | |
92 | #include <TRandom.h> | |
a1e17193 | 93 | #include <TROOT.h> |
0e46b9ae | 94 | |
d3c7bfac | 95 | #include "AliMC.h" |
88cb7938 | 96 | #include "AliRun.h" |
d3c7bfac | 97 | |
d599d913 | 98 | #include "AliTOFhitT0.h" |
0e46b9ae | 99 | #include "AliTOFT0.h" |
100 | #include "AliTOF.h" | |
101 | ||
d599d913 | 102 | ClassImp(AliTOFT0) |
103 | ||
104 | //____________________________________________________________________________ | |
655e379f | 105 | AliTOFT0::AliTOFT0(): |
106 | TTask("AliTOFT0",""), | |
107 | fNevents(0), | |
108 | fTimeResolution(0), | |
109 | fLowerMomBound(0), | |
110 | fUpperMomBound(0), | |
111 | fT0File(""), | |
112 | fHeadersFile("") | |
d599d913 | 113 | { |
114 | // ctor | |
d599d913 | 115 | } |
116 | ||
117 | //____________________________________________________________________________ | |
655e379f | 118 | AliTOFT0::AliTOFT0(char* headerFile, Int_t nEvents): |
119 | TTask("AliTOFT0",""), | |
120 | fNevents(nEvents), | |
121 | fTimeResolution(1.2e-10), | |
122 | fLowerMomBound(1.5), | |
123 | fUpperMomBound(2.), | |
124 | fT0File(""), | |
125 | fHeadersFile(headerFile) | |
d599d913 | 126 | { |
7aeeaf38 | 127 | // |
128 | // | |
129 | // | |
130 | ||
655e379f | 131 | //fNevents=nEvents ; // Number of events for which calculate the T0, |
d599d913 | 132 | // default 0: it means all evens in current file |
655e379f | 133 | //fLowerMomBound=1.5; // [GeV/c] default value |
134 | //fUpperMomBound=2. ; // [GeV/c] default value | |
135 | //fTimeResolution = 1.2e-10; // 120 ps by default | |
136 | //fHeadersFile = headerFile ; | |
d599d913 | 137 | |
138 | TFile * file = (TFile*) gROOT->GetFile(fHeadersFile.Data() ) ; | |
139 | ||
140 | //File was not opened yet | |
141 | if(file == 0){ | |
142 | if(fHeadersFile.Contains("rfio")) | |
143 | file = TFile::Open(fHeadersFile,"update") ; | |
144 | else | |
145 | file = new TFile(fHeadersFile.Data(),"update") ; | |
146 | gAlice = (AliRun *) file->Get("gAlice") ; | |
147 | } | |
148 | ||
149 | // add Task to //root/Tasks folder | |
150 | TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; | |
151 | roottasks->Add(this) ; | |
152 | } | |
153 | ||
5c016a7b | 154 | //____________________________________________________________________________ |
655e379f | 155 | AliTOFT0::AliTOFT0(const AliTOFT0 & tzero): |
156 | TTask("AliTOFT0",""), | |
157 | fNevents(0), | |
158 | fTimeResolution(0), | |
159 | fLowerMomBound(0), | |
160 | fUpperMomBound(0), | |
161 | fT0File(""), | |
162 | fHeadersFile("") | |
5c016a7b | 163 | { |
7aeeaf38 | 164 | // copy ctr |
165 | ||
5c016a7b | 166 | ( (AliTOFT0 &)tzero ).Copy(*this); |
167 | } | |
168 | ||
d599d913 | 169 | //____________________________________________________________________________ |
170 | AliTOFT0::~AliTOFT0() | |
171 | { | |
172 | // dtor | |
173 | } | |
174 | ||
175 | //____________________________________________________________________________ | |
176 | void AliTOFT0::Exec(Option_t *option) | |
177 | { | |
178 | // | |
179 | // calculate T0 distribution for all events using chisquare | |
180 | // | |
181 | Int_t ngood=0; | |
182 | Int_t nmisidentified=0; | |
183 | Int_t nmisidentified0=0; | |
184 | Int_t nmisidentified1=0; | |
185 | Int_t nmisidentified2=0; | |
186 | Int_t nmisidentified3=0; | |
187 | Int_t nmisidentified4=0; | |
188 | Int_t nmisidentified5=0; | |
189 | Int_t nmisidentified6=0; | |
190 | Int_t nmisidentified7=0; | |
191 | Int_t nmisidentified8=0; | |
192 | Int_t nmisidentified9=0; | |
193 | Int_t ipartold = -1; | |
194 | Int_t ipart; | |
195 | Int_t selected=0; | |
196 | Int_t istop=0; | |
197 | Float_t timeresolutioninns=fTimeResolution*(1.e+9); // convert in [ns] | |
198 | const Int_t kUPDATE = 5; // for visual option | |
199 | Int_t itimes=0; | |
200 | TCanvas* c1=0; | |
201 | TCanvas* c2=0; | |
202 | TCanvas* c3=0; | |
203 | ||
204 | if(strstr(option,"visual")){ | |
205 | // Create a new canvas. | |
206 | //c1 = new TCanvas("c1","Dynamic Visual Filling of time zero histo",10,10,500,500); | |
207 | c1 = new TCanvas("c1","Dynamic Visual Filling of time zero histo",10,10,370,370); | |
208 | c1->SetFillColor(35); | |
209 | c1->GetFrame()->SetFillColor(21); | |
210 | c1->GetFrame()->SetBorderSize(6); | |
211 | c1->GetFrame()->SetBorderMode(-1); | |
212 | ||
213 | //c2 = new TCanvas("c2","Dynamic Visual Filling of chisquare histo",550,10,500,500); | |
214 | c2 = new TCanvas("c2","Dynamic Visual Filling of chisquare histo",380,10,370,370); | |
215 | c2->SetFillColor(35); | |
216 | c2->GetFrame()->SetFillColor(21); | |
217 | c2->GetFrame()->SetBorderSize(6); | |
218 | c2->GetFrame()->SetBorderMode(-1); | |
219 | ||
220 | //c3 = new TCanvas("c3","Dynamic Visual Filling of confidence level histo",280,550,500,500); | |
221 | c3 = new TCanvas("c3","Dynamic Visual Filling of confidence level histo",760,10,370,370); | |
222 | c3->SetFillColor(35); | |
223 | c3->GetFrame()->SetFillColor(21); | |
224 | c3->GetFrame()->SetBorderSize(6); | |
225 | c3->GetFrame()->SetBorderMode(-1); | |
226 | } | |
227 | ||
228 | if(strstr(option,"tim") || strstr(option,"all")) | |
229 | gBenchmark->Start("TOFT0"); | |
230 | ||
231 | TH1F *htzerobest= new TH1F("htzerobest","T0 for best assignment",200,-1.,1.); | |
232 | TH1F* hchibest = new TH1F("hchibest","ChiSquare Min Distribution",80,0.,40.); | |
233 | TH1F* hchibestconflevel = new TH1F("hchibestconflevel","ChiSquare Min Confidence Level",10,0.,1.); | |
234 | ||
235 | // setting histo colors | |
236 | if(strstr(option,"visual")){ | |
237 | htzerobest->SetFillColor(48); | |
238 | hchibest->SetFillColor(50); | |
239 | hchibestconflevel->SetFillColor(52); | |
240 | } | |
241 | ||
242 | Int_t assparticle[10]={3,3,3,3,3,3,3,3,3,3}; | |
243 | Int_t truparticle[10]={3,3,3,3,3,3,3,3,3,3}; | |
244 | Float_t t0best=999.; | |
245 | Float_t timeofflight[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
246 | Float_t momentum[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
247 | Float_t timezero[10]; | |
248 | Float_t weightedtimezero[10]; | |
249 | Float_t beta[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
250 | Float_t sqMomError[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
251 | Float_t sqTrackError[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
252 | Float_t massarray[3]={0.13957,0.493677,0.9382723}; | |
253 | Float_t dummychisquare=0.; | |
254 | Float_t chisquare=999.; | |
255 | Float_t tracktoflen[10]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; | |
256 | ||
7aeeaf38 | 257 | AliTOF *detTOF = (AliTOF *) gAlice->GetDetector ("TOF"); |
d599d913 | 258 | |
7aeeaf38 | 259 | if (!detTOF) { |
d599d913 | 260 | Error("AliTOFT0","TOF not found"); |
261 | return; | |
262 | } | |
263 | ||
264 | if(strstr(option,"all")){ | |
0e46b9ae | 265 | AliInfo(Form("Selecting primary tracks with momentum between %d GeV/c and %d GeV/c", fLowerMomBound, fUpperMomBound)); |
266 | AliInfo("Memorandum: 0 means PION | 1 means KAON | 2 means PROTON") | |
d599d913 | 267 | } |
268 | ||
269 | if (fNevents == 0) fNevents = (Int_t) gAlice->TreeE()->GetEntries(); | |
270 | ||
271 | for (Int_t ievent = 0; ievent < fNevents; ievent++) { | |
272 | gAlice->GetEvent(ievent); | |
7aeeaf38 | 273 | TTree *hitTree = detTOF->TreeH (); |
274 | if (!hitTree) | |
d599d913 | 275 | return; |
276 | TParticle* particle; | |
277 | AliTOFhitT0* tofHit; | |
7aeeaf38 | 278 | TClonesArray* tofHits = detTOF->Hits(); |
d599d913 | 279 | |
280 | Int_t lasttrack=-1; | |
281 | Int_t nset=0; | |
5fff655e | 282 | |
7aeeaf38 | 283 | hitTree->SetBranchStatus("*",0); // switch off all branches |
284 | hitTree->SetBranchStatus("TOF*",1); // switch on only TOF | |
5fff655e | 285 | |
d599d913 | 286 | // Start loop on primary tracks in the hits containers |
287 | ||
7aeeaf38 | 288 | Int_t ntracks = static_cast<Int_t>(hitTree->GetEntries()); |
d599d913 | 289 | for (Int_t track = 0; track < ntracks; track++) |
290 | { | |
291 | if(nset>=5) break; // check on the number of set analyzed | |
292 | ||
293 | gAlice->ResetHits(); | |
7aeeaf38 | 294 | hitTree->GetEvent(track); |
0e46b9ae | 295 | |
296 | AliMC *mcApplication = (AliMC*)gAlice->GetMCApp(); | |
297 | ||
298 | particle = mcApplication->Particle(track); | |
7aeeaf38 | 299 | Int_t nhits = tofHits->GetEntriesFast(); |
d599d913 | 300 | |
301 | for (Int_t hit = 0; hit < nhits; hit++) | |
302 | { | |
7aeeaf38 | 303 | tofHit = (AliTOFhitT0 *) tofHits->UncheckedAt(hit); |
d599d913 | 304 | ipart = tofHit->GetTrack(); |
305 | // check to discard the case when the same particle is selected more than one | |
306 | // time | |
307 | ||
308 | if (ipart != ipartold){ | |
309 | ||
5d12ce38 | 310 | particle = (TParticle*)gAlice->GetMCApp()->Particle(ipart); |
d599d913 | 311 | |
312 | Float_t idealtime=tofHit->GetTof(); | |
313 | // Float_t time=idealtime; | |
314 | Float_t time = gRandom->Gaus(idealtime, fTimeResolution); | |
315 | Float_t toflen=tofHit->GetLen(); | |
316 | toflen=toflen/100.; // toflen given in m | |
317 | Int_t pdg = particle->GetPdgCode(); | |
318 | Int_t abspdg =TMath::Abs(pdg); | |
319 | Float_t idealmom = particle->P(); | |
320 | Float_t momres=idealmom*0.025; // 2.5% res token into account for all momenta | |
321 | Float_t mom =gRandom->Gaus(idealmom,momres); | |
322 | ||
323 | Bool_t isgoodpart=(abspdg==211 || abspdg==2212 || abspdg==321); | |
324 | ||
325 | time*=1.E+9; // tof given in nanoseconds | |
326 | if (particle->GetFirstMother() < 0 && isgoodpart && mom<=fUpperMomBound && mom>=fLowerMomBound){ | |
327 | selected+=1; | |
328 | istop=selected; | |
329 | if(istop>10) break; | |
330 | Int_t index=selected-1; | |
331 | timeofflight[index]=time; | |
332 | tracktoflen[index]=toflen; | |
333 | momentum[index]=mom; | |
0e46b9ae | 334 | //AliInfo(Form(" %d %d %d ", timeofflight[index], tracktoflen[index], momentum[index])); |
d599d913 | 335 | switch (abspdg) { |
336 | case 211: | |
337 | truparticle[index]=0; | |
338 | break ; | |
339 | case 321: | |
340 | truparticle[index]=1; | |
341 | break ; | |
342 | case 2212: | |
343 | truparticle[index]=2; | |
344 | break ; | |
345 | } | |
346 | ||
347 | } | |
348 | ipartold = ipart; | |
349 | ||
350 | if(istop==10){ // start analysis on current set | |
351 | nset+=1; | |
352 | lasttrack=track; | |
353 | istop=0; | |
354 | selected=0; | |
0e46b9ae | 355 | //AliInfo("starting t0 calculation for current set"); |
d599d913 | 356 | for (Int_t i1=0; i1<3;i1++) { |
ea7a588a | 357 | beta[0]=momentum[0]/sqrt(massarray[i1]*massarray[i1]+momentum[0]*momentum[0]); |
d599d913 | 358 | for (Int_t i2=0; i2<3;i2++) { |
ea7a588a | 359 | beta[1]=momentum[1]/sqrt(massarray[i2]*massarray[i2]+momentum[1]*momentum[1]); |
d599d913 | 360 | for (Int_t i3=0; i3<3;i3++) { |
ea7a588a | 361 | beta[2]=momentum[2]/sqrt(massarray[i3]*massarray[i3]+momentum[2]*momentum[2]); |
d599d913 | 362 | for (Int_t i4=0; i4<3;i4++) { |
ea7a588a | 363 | beta[3]=momentum[3]/sqrt(massarray[i4]*massarray[i4]+momentum[3]*momentum[3]); |
d599d913 | 364 | for (Int_t i5=0; i5<3;i5++) { |
ea7a588a | 365 | beta[4]=momentum[4]/sqrt(massarray[i5]*massarray[i5]+momentum[4]*momentum[4]); |
d599d913 | 366 | for (Int_t i6=0; i6<3;i6++) { |
ea7a588a | 367 | beta[5]=momentum[5]/sqrt(massarray[i6]*massarray[i6]+momentum[5]*momentum[5]); |
d599d913 | 368 | for (Int_t i7=0; i7<3;i7++) { |
ea7a588a | 369 | beta[6]=momentum[6]/sqrt(massarray[i7]*massarray[i7]+momentum[6]*momentum[6]); |
d599d913 | 370 | for (Int_t i8=0; i8<3;i8++) { |
ea7a588a | 371 | beta[7]=momentum[7]/sqrt(massarray[i8]*massarray[i8]+momentum[7]*momentum[7]); |
d599d913 | 372 | for (Int_t i9=0; i9<3;i9++) { |
ea7a588a | 373 | beta[8]=momentum[8]/sqrt(massarray[i9]*massarray[i9]+momentum[8]*momentum[8]); |
d599d913 | 374 | for (Int_t i10=0; i10<3;i10++) { |
d599d913 | 375 | beta[9]=momentum[9]/sqrt(massarray[i10]*massarray[i10]+momentum[9]*momentum[9]); |
376 | ||
d599d913 | 377 | Float_t meantzero=0.; |
378 | Float_t sumAllweights=0.; | |
379 | for (Int_t itz=0; itz<10;itz++) { | |
380 | sqMomError[itz]=((1.-beta[itz]*beta[itz])*0.025)*((1.-beta[itz]*beta[itz])*0.025)*(tracktoflen[itz]/(0.299792*beta[itz]))*(tracktoflen[itz]/(0.299792*beta[itz])); // this gives the square of the momentum error in nanoseconds | |
381 | sqTrackError[itz]=(timeresolutioninns*timeresolutioninns+sqMomError[itz]); // total error for the current track | |
382 | sumAllweights+=1./sqTrackError[itz]; | |
ea7a588a | 383 | |
384 | timezero[itz]=(tracktoflen[itz]/(beta[itz]*0.299792))-timeofflight[itz]; | |
385 | weightedtimezero[itz]=((tracktoflen[itz]/(beta[itz]*0.299792))-timeofflight[itz])/sqTrackError[itz];// weighted time zero for current track | |
d599d913 | 386 | meantzero+=weightedtimezero[itz]; |
387 | } // end loop for (Int_t itz=0; itz<10;itz++) | |
388 | meantzero=meantzero/sumAllweights; // it is given in [ns] | |
389 | ||
390 | dummychisquare=0.; | |
391 | // calculate the chisquare for the current assignment | |
392 | for (Int_t icsq=0; icsq<10;icsq++) { | |
393 | dummychisquare+=(timezero[icsq]-meantzero)*(timezero[icsq]-meantzero)/sqTrackError[icsq]; | |
394 | } // end loop for (Int_t icsq=0; icsq<10;icsq++) | |
395 | ||
396 | if(dummychisquare<=chisquare){ | |
397 | assparticle[0]=i1; | |
398 | assparticle[1]=i2; | |
399 | assparticle[2]=i3; | |
400 | assparticle[3]=i4; | |
401 | assparticle[4]=i5; | |
402 | assparticle[5]=i6; | |
403 | assparticle[6]=i7; | |
404 | assparticle[7]=i8; | |
405 | assparticle[8]=i9; | |
406 | assparticle[9]=i10; | |
407 | chisquare=dummychisquare; | |
408 | t0best=meantzero; | |
409 | } // close if(dummychisquare<=chisquare) | |
410 | ||
411 | } // end loop on i10 | |
412 | } // end loop on i9 | |
413 | } // end loop on i8 | |
414 | } // end loop on i7 | |
415 | } // end loop on i6 | |
416 | } // end loop on i5 | |
417 | } // end loop on i4 | |
418 | } // end loop on i3 | |
419 | } // end loop on i2 | |
420 | } // end loop on i1 | |
421 | ||
422 | if(truparticle[0]==assparticle[0] && truparticle[1]==assparticle[1] && truparticle[2]==assparticle[2] && truparticle[3]==assparticle[3] && truparticle[4]==assparticle[4]&& truparticle[5]==assparticle[5] && truparticle[6]==assparticle[6] && truparticle[7]==assparticle[7] && truparticle[8]==assparticle[8] && truparticle[9]==assparticle[9]) ngood+=1; | |
423 | if(truparticle[0]!=assparticle[0]) nmisidentified0+=1; | |
424 | if(truparticle[1]!=assparticle[1]) nmisidentified1+=1; | |
425 | if(truparticle[2]!=assparticle[2]) nmisidentified2+=1; | |
426 | if(truparticle[3]!=assparticle[3]) nmisidentified3+=1; | |
427 | if(truparticle[4]!=assparticle[4]) nmisidentified4+=1; | |
428 | if(truparticle[5]!=assparticle[5]) nmisidentified5+=1; | |
429 | if(truparticle[6]!=assparticle[6]) nmisidentified6+=1; | |
430 | if(truparticle[7]!=assparticle[7]) nmisidentified7+=1; | |
431 | if(truparticle[8]!=assparticle[8]) nmisidentified8+=1; | |
432 | if(truparticle[9]!=assparticle[9]) nmisidentified9+=1; | |
433 | // filling histos | |
434 | htzerobest->Fill(t0best); | |
435 | hchibest->Fill(chisquare); | |
436 | Double_t dblechisquare=(Double_t)chisquare; | |
437 | Float_t confLevel=(Float_t)TMath::Prob(dblechisquare,9); // ndf 10-1=9 | |
438 | hchibestconflevel->Fill(confLevel); | |
439 | itimes++; | |
440 | if(strstr(option,"all")){ | |
0e46b9ae | 441 | AliInfo(Form("True Assignment %d %d %d %d %d %d %d %d %d %d", truparticle[0], truparticle[1], truparticle[2], truparticle[3], truparticle[4], truparticle[5], truparticle[6], truparticle[7], truparticle[8], truparticle[9])); |
442 | AliInfo(Form("Best Assignment %d %d %d %d %d %d %d %d %d %d", assparticle[0], assparticle[1], assparticle[2], assparticle[3], assparticle[4], assparticle[5], assparticle[6], assparticle[7], assparticle[8], assparticle[9])); | |
443 | AliInfo(Form("Minimum ChiSquare for current set %d ", chisquare)); | |
444 | AliInfo(Form("Confidence Level (Minimum ChiSquare) %d", confLevel)); | |
d599d913 | 445 | } |
446 | if (strstr(option,"visual") && itimes && (itimes%kUPDATE) == 0) { | |
447 | if (itimes == kUPDATE){ | |
448 | c1->cd(); | |
449 | htzerobest->Draw(); | |
450 | c2->cd(); | |
451 | hchibest->Draw(); | |
452 | c3->cd(); | |
453 | hchibestconflevel->Draw(); | |
454 | } | |
455 | c1->Modified(); | |
456 | c1->Update(); | |
457 | c2->Modified(); | |
458 | c2->Update(); | |
459 | c3->Modified(); | |
460 | c3->Update(); | |
461 | if (gSystem->ProcessEvents()) | |
462 | break; | |
463 | } | |
464 | chisquare=999.; | |
465 | t0best=999.; | |
466 | ||
467 | } // end for the current set. close if(istop==5) | |
468 | } // end condition on ipartold | |
469 | } // end loop on hits for the current track | |
470 | if(istop>=10) break; | |
471 | } // end loop on ntracks | |
472 | } //event loop | |
473 | ||
474 | if(strstr(option,"all")){ | |
475 | nmisidentified=(nmisidentified0+nmisidentified1+nmisidentified2+nmisidentified3+nmisidentified4+nmisidentified5+nmisidentified6+nmisidentified7+nmisidentified8+nmisidentified9); | |
0e46b9ae | 476 | AliInfo(Form("total number of tracks token into account %i", 10*5*fNevents)); |
d599d913 | 477 | Float_t badPercentage=100.*(Float_t)nmisidentified/(10*5*fNevents); |
0e46b9ae | 478 | AliInfo(Form("total misidentified %i (%d %) ", nmisidentified, badPercentage)); |
479 | AliInfo(Form("Total Number of set token into account %i", 5*fNevents)); | |
d599d913 | 480 | Float_t goodSetPercentage=100.*(Float_t)ngood/(5*fNevents); |
0e46b9ae | 481 | AliInfo(Form("Number of set with no misidentified tracks %i (%d %)", ngood, goodSetPercentage)); |
d599d913 | 482 | } |
483 | ||
484 | // free used memory for canvas | |
485 | delete c1; c1=0; | |
486 | delete c2; c2=0; | |
487 | delete c3; c3=0; | |
488 | ||
489 | // generating output filename only if not previously specified using SetTZeroFile | |
490 | char outFileName[70]; | |
491 | strcpy(outFileName,"ht010tr120ps"); // global time resolution has to be converted from Int_t to char | |
492 | // in order to have in the output filename this parameter | |
493 | strcat(outFileName,fHeadersFile); | |
494 | ||
495 | if(fT0File.IsNull()) fT0File=outFileName; | |
496 | ||
497 | TFile* houtfile = new TFile(fT0File,"recreate"); | |
498 | houtfile->cd(); | |
499 | htzerobest->Write(0,TObject::kOverwrite); | |
500 | hchibest->Write(0,TObject::kOverwrite); | |
501 | hchibestconflevel->Write(0,TObject::kOverwrite); | |
502 | houtfile->Close(); | |
503 | ||
504 | ||
505 | if(strstr(option,"tim") || strstr(option,"all")){ | |
506 | gBenchmark->Stop("TOFT0"); | |
0e46b9ae | 507 | AliInfo("AliTOFT0:"); |
508 | /* | |
d599d913 | 509 | cout << " took " << gBenchmark->GetCpuTime("TOFT0") << " seconds in order to calculate T0 " |
0e46b9ae | 510 | << gBenchmark->GetCpuTime("TOFT0")/fNevents << " seconds per event " << endl ; |
511 | */ | |
512 | gBenchmark->Print("TOFT0"); | |
d599d913 | 513 | } |
514 | } | |
515 | ||
516 | //__________________________________________________________________ | |
7aeeaf38 | 517 | void AliTOFT0::SetTZeroFile(char * file ) |
518 | { | |
519 | // | |
520 | // | |
521 | // | |
522 | printf("Destination file : %s \n", file) ; | |
d599d913 | 523 | fT0File=file; |
7aeeaf38 | 524 | |
d599d913 | 525 | } |
7aeeaf38 | 526 | |
d599d913 | 527 | //__________________________________________________________________ |
5c016a7b | 528 | void AliTOFT0::Print(Option_t* /*option*/)const |
d599d913 | 529 | { |
7aeeaf38 | 530 | // |
531 | // | |
532 | // | |
533 | printf("------------------- %s -------------\n", GetName()) ; | |
d599d913 | 534 | if(!fT0File.IsNull()) |
7aeeaf38 | 535 | printf(" Writing T0 Distribution to file %s \n",(char*) fT0File.Data()); |
536 | ||
d599d913 | 537 | } |
538 | ||
539 | //__________________________________________________________________ | |
540 | Bool_t AliTOFT0::operator==( AliTOFT0 const &tzero )const | |
541 | { | |
7aeeaf38 | 542 | // |
543 | // Equal operator | |
d599d913 | 544 | // |
545 | ||
546 | if( (fTimeResolution==tzero.fTimeResolution)&&(fLowerMomBound==tzero.fLowerMomBound)&&(fUpperMomBound==tzero.fUpperMomBound)) | |
547 | return kTRUE ; | |
548 | else | |
549 | return kFALSE ; | |
550 | } |