1 //Author: Anders Strand Vestbo
2 //Last Modified: 5.01.2001
9 #include <TClonesArray.h>
12 #include "AliSimDigits.h"
14 #include "AliTPCClustersArray.h"
15 #include "AliTPCClustersRow.h"
16 #include "AliTPCcluster.h"
17 #include "AliTPCParam.h"
19 #include "AliL3Defs.h"
20 #include "AliL3Transform.h"
21 #include "AliL3SpacePointData.h"
22 #include "AliL3Track.h"
23 #include "AliL3FileHandler.h"
24 #include "AliL3TrackArray.h"
25 #include "AliL3Evaluate.h"
26 #include "AliL3Logging.h"
29 //Class for tracking evaluation.
31 ClassImp(AliL3Evaluate)
33 AliL3Evaluate::AliL3Evaluate()
37 fMCclusterfile = NULL;
45 AliL3Evaluate::AliL3Evaluate(Char_t *mcfile,Int_t *slice)
47 //Normal constructor. Input are the rootfile containing the
48 //original MC information of the simulated event.
50 fMCFile = new TFile(mcfile,"READ");
51 if(!fMCFile->IsOpen())
53 LOG(AliL3Log::kError,"AliL3Evaluation::AliL3Evaluation","File Open")
54 <<"Inputfile "<<mcfile<<" does not exist"<<ENDLOG;
58 fParam = (AliTPCParam*)fMCFile->Get("75x40_100x60");
59 fTransform = new AliL3Transform();
66 AliL3Evaluate::AliL3Evaluate(Int_t *slice)
71 fTransform = new AliL3Transform();
75 AliL3Evaluate::~AliL3Evaluate()
77 if(fDigitsTree) fDigitsTree->Delete();
82 if(fTransform) delete fTransform;
83 if(fTracks) delete fTracks;
84 if(fPtRes) delete fPtRes;
85 if(fNGoodTracksPt) delete fNGoodTracksPt;
86 if(fNFoundTracksPt) delete fNFoundTracksPt;
87 if(fNFakeTracksPt) delete fNFakeTracksPt;
88 if(fTrackEffPt) delete fTrackEffPt;
89 if(fFakeTrackEffPt) delete fFakeTrackEffPt;
90 if(fNGoodTracksEta) delete fNGoodTracksEta;
91 if(fNFoundTracksEta) delete fNFoundTracksEta;
92 if(fNFakeTracksEta) delete fNFakeTracksEta;
93 if(fTrackEffEta) delete fTrackEffEta;
94 if(fFakeTrackEffEta) delete fFakeTrackEffEta;
95 if(fMcIndex) delete [] fMcIndex;
96 if(fMcId) delete [] fMcId;
97 if(fNtuppel) delete fNtuppel;
100 void AliL3Evaluate::Setup(Char_t *trackfile,Char_t *path)
102 //Read in the hit and track information from produced files.
105 AliL3FileHandler *clusterfile[36][5];
106 for(Int_t s=fMinSlice; s<=fMaxSlice; s++)
108 for(Int_t p=0; p<5; p++)
111 clusterfile[s][p] = new AliL3FileHandler();
112 sprintf(fname,"%s/points_%d_%d.raw",path,s,p);
113 if(!clusterfile[s][p]->SetBinaryInput(fname))
115 LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
116 <<"Inputfile "<<fname<<" does not exist"<<ENDLOG;
117 delete clusterfile[s][p];
118 clusterfile[s][p] = 0;
121 fClusters[s][p] = (AliL3SpacePointData*)clusterfile[s][p]->Allocate();
122 clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]);
123 clusterfile[s][p]->CloseBinaryInput();
127 AliL3FileHandler *tfile = new AliL3FileHandler();
128 if(!tfile->SetBinaryInput(trackfile)){
129 LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
130 <<"Inputfile "<<trackfile<<" does not exist"<<ENDLOG;
133 fTracks = new AliL3TrackArray();
134 tfile->Binary2TrackArray(fTracks);
135 tfile->CloseBinaryInput();
139 void AliL3Evaluate::SetupSlow(Char_t *trackfile,Char_t *path)
141 //Setup for using the slow simulator.
144 Setup(trackfile,path);
147 LOG(AliL3Log::kError,"AliL3Evaluation::SetupSlow","Digits Tree")
148 <<"Error setting up digits tree"<<ENDLOG;
149 if(!SetMCParticleArray())
150 LOG(AliL3Log::kError,"AliL3Evaluation::Setup","Particle array")
151 <<"Error setting up particle array"<<ENDLOG;
154 void AliL3Evaluate::SetupFast(Char_t *trackfile,Char_t *mcClusterfile,Char_t *path)
156 //Setup for using the fast simulator.
159 GetFastClusterIDs(path);
161 fMCclusterfile = new TFile(mcClusterfile);
162 if(!fMCclusterfile->IsOpen())
163 LOG(AliL3Log::kError,"AliL3Evaluation::SetupFast","File Open")
164 <<"Inputfile "<<mcClusterfile<<" does not exist"<<ENDLOG;
166 Setup(trackfile,path);
168 if(!SetMCParticleArray())
169 LOG(AliL3Log::kError,"AliL3Evaluation::SetupFast","Particle array")
170 <<"Error setting up particle array"<<ENDLOG;
173 Bool_t AliL3Evaluate::SetDigitsTree()
177 fDigitsTree = (TTree*)fMCFile->Get("TreeD_75x40_100x60");
178 if(!fDigitsTree) return false;
179 fDigitsTree->GetBranch("Segment")->SetAddress(&fDigits);
180 for(Int_t i=0; i<fDigitsTree->GetEntries(); i++)
182 if(!fDigitsTree->GetEvent(i)) continue;
183 Int_t se,ro,slice,slicerow;
184 fParam->AdjustSectorRow(fDigits->GetID(),se,ro);
185 fTransform->Sector2Slice(slice,slicerow,se,ro);
186 fRowid[slice][slicerow] = i;
192 Bool_t AliL3Evaluate::SetMCParticleArray()
195 AliRun *gAlice = (AliRun*)fMCFile->Get("gAlice");
198 LOG(AliL3Log::kError,"AliL3Evaluate::SetParticleArray","gAlice")
199 <<"AliRun object non existing on file"<<ENDLOG;
204 fParticles=gAlice->Particles();
209 TObjArray *AliL3Evaluate::DefineGoodTracks(Int_t slice,Int_t *padrow,Int_t good_number,Int_t *particle_id)
211 //Loop over MC particles, and mark the good ones
212 //(which the tracker should find...)
214 Int_t np=fParticles->GetEntriesFast();
215 AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
216 TPC->SetParam(fParam);
217 Int_t ver = TPC->IsVersion();
218 LOG(AliL3Log::kInformational,"AliL3Evaluate::DefineGoodTracks","TPC version")
219 <<"TPC version "<<ver<<" found on file"<<ENDLOG;
221 //Int_t nrow_up=TPC->GetParam()->GetNRowUp();
222 //Int_t nrows=TPC->GetParam()->GetNRowLow()+nrow_up;
223 Int_t zero=TPC->GetParam()->GetZeroSup();
225 //Int_t number_of_rows = padrow[1] - padrow[0] + 1;
227 Int_t *good = new Int_t[np];
228 for(Int_t ii=0; ii<np; ii++)
234 LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","TPC version")
235 <<"TPC version "<<ver<<" does not match."<<ENDLOG;
236 fMCclusterfile->cd();
237 AliTPCClustersArray carray;
238 carray.Setup(fParam);
239 carray.SetClusterType("AliTPCcluster");
240 Bool_t clusterok = carray.ConnectTree("Segment Tree");
242 LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","Cluster Array")
243 <<"Error loading clusters from rootfile"<<ENDLOG;
245 for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++)
248 AliSegmentID *s = carray.LoadEntry(i);
249 fParam->AdjustSectorRow(s->GetID(),sec,row);
250 fTransform->Sector2Slice(sl,lr,sec,row);
252 if(sl != slice) {carray.ClearRow(sec,row); continue;}
253 if(lr < padrow[0]) {carray.ClearRow(sec,row); continue;}
254 if(lr > padrow[1]) {carray.ClearRow(sec,row); continue;}
255 AliTPCClustersRow *cRow = carray.GetRow(sec,row);
256 for(Int_t j=0; j<cRow->GetArray()->GetEntriesFast(); j++)
258 AliTPCcluster *cluster=(AliTPCcluster*)(*cRow)[j];
259 Int_t lab=cluster->GetLabel(0);
264 if(carray.GetRow(sec,row))
265 carray.ClearRow(sec,row);
271 LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","TPC version")
272 <<"TPC version "<<ver<<" does not match."<<ENDLOG;
273 Int_t *count = new Int_t[np]; //np number of particles.
275 for (i=0; i<np; i++) count[i]=0;
276 for (i=padrow[0]; i<=padrow[1]; i++) {
277 Int_t index = fRowid[slice][i];
278 if (!fDigitsTree->GetEvent(index)) continue;
280 fParam->AdjustSectorRow(fDigits->GetID(),sec,row);
282 while (fDigits->Next()) {
283 Int_t it=fDigits->CurrentRow(), ip=fDigits->CurrentColumn();
284 Short_t dig = fDigits->GetDigit(it,ip);
285 Int_t idx0=fDigits->GetTrackID(it,ip,0);
286 Int_t idx1=fDigits->GetTrackID(it,ip,1);
287 Int_t idx2=fDigits->GetTrackID(it,ip,2);
288 if (idx0>=0 && dig>=zero) count[idx0]+=1;
289 if (idx1>=0 && dig>=zero) count[idx1]+=1;
290 if (idx2>=0 && dig>=zero) count[idx2]+=1;
292 for (Int_t j=0; j<np; j++) {
293 if (count[j]>1) {//at least two digits at this padrow
303 LOG(AliL3Log::kError,"AliL3Evaluation::FillEffHistos","TPC version")
304 <<"No valid TPC version found"<<ENDLOG;
308 Float_t torad=TMath::Pi()/180;
310 Float_t phi_min = slice*20 - 10;
311 Float_t phi_max = slice*20 + 10;
312 TObjArray *good_part = new TObjArray();
314 for(Int_t i=0; i<fParticles->GetEntriesFast(); i++)
316 TParticle *p = (TParticle*)fParticles->UncheckedAt(i);
317 if(p->GetFirstMother()>0) continue; //secondary particle
318 if(good[i] < good_number) {continue;}
320 Double_t ptg=p->Pt(),pxg=p->Px(),pyg=p->Py(),pzg=p->Pz();
321 Double_t phi_part = TMath::ATan2(pyg,pxg);
322 if (phi_part < 0) phi_part += 2*TMath::Pi();
325 if(phi_part < phi_min*torad || phi_part > phi_max*torad) {continue;}
326 if(ptg<0.100) continue;
327 if(fabs(pzg/ptg)>0.999) {continue;}
328 Int_t entries = good_part->GetEntriesFast();
329 good_part->AddLast(p);
330 particle_id[entries] = i;
333 LOG(AliL3Log::kInformational,"AliL3Evaluate::DefineGoodTracks","NPart")
334 <<AliL3Log::kDec<<"Found "<<good_part->GetEntriesFast()
335 <<" good Particles (Tracks) out of "<<fParticles->GetEntriesFast()<<ENDLOG;
340 void AliL3Evaluate::EvaluatePatch(Int_t slice,Int_t patch,Int_t min_points,Int_t good_number)
342 //Make efficiency plots for tracking on patch level (before any merging).
344 Int_t row[5][2] = {{ 0, 45},{46,77},{78,109},{110,141},{142,173}};
345 Int_t *particle_id = new Int_t[fParticles->GetEntriesFast()];
346 TObjArray *good_particles = DefineGoodTracks(slice,row[patch],good_number,particle_id);
347 SetMinPoints(min_points);
350 FillEffHistos(good_particles,particle_id);
352 delete good_particles;
353 delete [] particle_id;
356 void AliL3Evaluate::EvaluateSlice(Int_t slice,Int_t min_points,Int_t good_number)
358 //Make efficiency plots for tracking on a slice (after merging).
359 //min_points = minimum points on track to be considered for evaluation
360 //good_number = minimum hits (padrows) produced by simulated track for consideration.
362 Int_t row[2] = {0,173};
363 Int_t *particle_id = new Int_t[fParticles->GetEntriesFast()];
364 TObjArray *good_particles = DefineGoodTracks(slice,row,good_number,particle_id);
365 SetMinPoints(min_points);
368 FillEffHistos(good_particles,particle_id);
370 delete good_particles;
371 delete [] particle_id;
374 void AliL3Evaluate::EvaluateGlobal(Int_t min_points,Int_t good_number)
376 //Make efficiency plots for tracking on several slices.
378 Int_t row[2] = {0,173};
379 Int_t *particle_id = new Int_t[fParticles->GetEntriesFast()];
380 SetMinPoints(min_points);
383 for(Int_t slice=fMinSlice;slice<=fMaxSlice;slice++){
384 TObjArray *good_particles = DefineGoodTracks(slice,row,good_number,particle_id);
385 FillEffHistos(good_particles,particle_id);
386 delete good_particles;
391 void AliL3Evaluate::AssignIDs()
393 //Assign MC id to the tracks.
396 LOG(AliL3Log::kDebug,"AliL3Evaluate::AssignIDs","Track Loop")
397 <<"Assigning MC id to the found tracks...."<<ENDLOG;
398 for(Int_t i=0; i<fTracks->GetNTracks(); i++)
400 AliL3Track *track = (AliL3Track*)fTracks->GetCheckedTrack(i);
402 if(track->GetNumberOfPoints() < fMinPointsOnTrack) break;
403 Int_t tID = GetMCTrackLabel(track);
405 printf("track %i id %d\n",i,tID);
410 struct S {Int_t lab; Int_t max;};
411 Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track){
412 //Returns the MCtrackID of the belonging clusters.
413 //If MCLabel < 0, means that track is fake.
414 //Fake track means that more than 10 percent of clusters are assigned incorrectly.
416 Int_t num_of_clusters = track->GetNumberOfPoints();
417 S *s=new S[num_of_clusters];
419 for (i=0; i<num_of_clusters; i++) s[i].lab=s[i].max=0;
420 UInt_t *hitnum = track->GetHitNumbers();
423 Int_t ** trackID = GetClusterIDs(track);
426 for (i=0; i<num_of_clusters; i++)
428 //Tricks to get the clusters belonging to this track:
430 Int_t slice = (id>>25) & 0x7f;
431 Int_t patch = (id>>22) & 0x7;
432 UInt_t pos = id&0x3fffff;
434 AliL3SpacePointData *points = fClusters[slice][patch];
435 if(!points) continue;
436 if(pos>=fNcl[slice][patch])
438 LOG(AliL3Log::kError,"AliL3Evaluate::GetMCTrackLabel","Clusterarray")
439 <<AliL3Log::kDec<<"ERROR"<<ENDLOG;
443 //Get the label of the cluster:
444 //printf("label %d %d %d\n",trackID[i][0],trackID[i][1],trackID[i][2]);
445 lab=abs(trackID[i][0]);
447 for (j=0; j<num_of_clusters; j++)
448 if (s[j].lab==lab || s[j].max==0) break;
454 for (i=0; i<num_of_clusters; i++)
455 if (s[i].max>max) {max=s[i].max; lab=s[i].lab;}
459 for (i=0; i<num_of_clusters; i++)
462 Int_t slice = (id>>25) & 0x7f;
463 Int_t patch = (id>>22) & 0x7;
464 UInt_t pos = id&0x3fffff;
466 AliL3SpacePointData *points = fClusters[slice][patch];
467 if(!points) continue;
468 if(pos>=fNcl[slice][patch])
470 LOG(AliL3Log::kError,"AliL3Evaluate::GetMCTrackLabel","Clusterarray")
471 <<AliL3Log::kDec<<"ERROR"<<ENDLOG;
475 if (abs(trackID[i][1]) == lab ||
476 abs(trackID[i][2]) == lab ) max++;
479 //check if more than 10% of the clusters are incorrectly assigned (fake track):
480 if (1.-Float_t(max)/num_of_clusters > 0.10)
490 Int_t **AliL3Evaluate::GetClusterIDs(AliL3Track *track)
492 //Return the MC information of all clusters belonging to track.
494 Int_t num_of_clusters = track->GetNumberOfPoints();
495 Int_t **trackID = new Int_t*[num_of_clusters];
497 UInt_t *hitnum = track->GetHitNumbers();
502 for(Int_t i=0; i<num_of_clusters; i++)
505 Int_t slice = (id>>25) & 0x7f;
506 Int_t patch = (id>>22) & 0x7;
507 UInt_t pos = id&0x3fffff;
509 AliL3SpacePointData *points = fClusters[slice][patch];
513 LOG(AliL3Log::kError,"AliL3Evaluate::GetClusterIDs","Clusterarray")
514 <<"No points at slice "<<slice<<" patch "<<patch<<" pos "<<pos<<ENDLOG;
517 if(pos>=fNcl[slice][patch])
519 LOG(AliL3Log::kError,"AliL3Evaluate::GetClusterIDs","Clusterarray")
520 <<AliL3Log::kDec<<"ERROR"<<ENDLOG;
524 xyz[0] = points[pos].fX;
525 xyz[1] = points[pos].fY;
526 xyz[2] = points[pos].fZ;
527 //sector = points[pos].fSector;
528 padrow = points[pos].fPadRow;
530 fTransform->Slice2Sector(slice,padrow,se,ro);
531 fTransform->Global2Raw(xyz,se,ro);
535 Int_t p = fRowid[slice][padrow];
537 if(!fDigitsTree->GetEvent(p))
538 LOG(AliL3Log::kError,"AliL3Evaluate::GetClusterIDs","Digits Tree")
539 <<"Error reading digits tree"<<ENDLOG;
541 trackID[i] = new Int_t[3];
542 trackID[i][0] = fDigits->GetTrackID((Int_t)xyz[2],(Int_t)xyz[1],0);
543 trackID[i][1] = fDigits->GetTrackID((Int_t)xyz[2],(Int_t)xyz[1],1);
544 trackID[i][2] = fDigits->GetTrackID((Int_t)xyz[2],(Int_t)xyz[1],2);
549 for(Int_t ii=0; ii<fNFastPoints; ii++)
552 if(fMcIndex[ii] == id) break;
554 trackID[i] = new Int_t[3];
555 trackID[i][0] = tmp_pid;
563 void AliL3Evaluate::GetFastClusterIDs(Char_t *path)
565 //Get the MC id of space points in case of using the fast simulator.
567 sprintf(fname,"%s/point_mc.dat",path);
568 FILE *infile = fopen(fname,"r");
573 if(fscanf(infile,"%d %d",&hitid,&hitmc)==EOF) break;
576 fMcId = new Int_t[fNFastPoints];
577 fMcIndex = new UInt_t[fNFastPoints];
579 for(i=0; i<fNFastPoints; i++)
581 if(fscanf(infile,"%d %d",&hitid,&hitmc)==EOF) break;
588 void AliL3Evaluate::CreateHistos(Int_t nbin,Int_t xlow,Int_t xup)
590 //Create the histograms
592 fNtuppel = new TNtuple("fNtuppel","Pt resolution","pt_gen:pt_found:nHits");
594 fPtRes = new TH1F("fPtRes","Relative Pt resolution",30,-10.,10.);
595 fNGoodTracksPt = new TH1F("fNGoodTracksPt","Good tracks vs pt",nbin,xlow,xup);
596 fNFoundTracksPt = new TH1F("fNFoundTracksPt","Found tracks vs pt",nbin,xlow,xup);
597 fNFakeTracksPt = new TH1F("fNFakeTracksPt","Fake tracks vs pt",nbin,xlow,xup);
598 fTrackEffPt = new TH1F("fTrackEffPt","Tracking efficiency vs pt",nbin,xlow,xup);
599 fFakeTrackEffPt = new TH1F("fFakeTrackEffPt","Efficiency for fake tracks vs pt",nbin,xlow,xup);
601 fNGoodTracksEta = new TH1F("fNGoodTracksEta","Good tracks vs eta",20,-50,50);
602 fNFoundTracksEta = new TH1F("fNFoundTracksEta","Found tracks vs eta",20,-50,50);
603 fNFakeTracksEta = new TH1F("fNFakeTracksEta","Fake tracks vs eta",20,-50,50);
604 fTrackEffEta = new TH1F("fTrackEffEta","Tracking efficienct vs eta",20,-50,50);
605 fFakeTrackEffEta = new TH1F("fFakeTrackEffEta","Efficiency for fake tracks vs eta",20,-50,50);
608 void AliL3Evaluate::FillEffHistos(TObjArray *good_particles,Int_t *particle_id)
610 //Fill the efficiency histograms.
612 for(Int_t i=0; i<good_particles->GetEntriesFast(); i++)
614 TParticle *p = (TParticle*)good_particles->UncheckedAt(i);
615 Double_t ptg=p->Pt(),pzg=p->Pz();
616 Float_t dipangle=TMath::ATan2(pzg,ptg)*180./TMath::Pi();
617 fNGoodTracksPt->Fill(ptg);
618 fNGoodTracksEta->Fill(dipangle);
620 for(Int_t k=0; k<fTracks->GetNTracks(); k++)
622 AliL3Track *track = fTracks->GetCheckedTrack(k);
624 Int_t nHits = track->GetNumberOfPoints();
625 if(nHits < fMinPointsOnTrack) break;
628 tracklabel = track->GetMCid();
630 if(TMath::Abs(tracklabel) != particle_id[i]) continue;
632 if(tracklabel == particle_id[i]) {fNFoundTracksPt->Fill(ptg); fNFoundTracksEta->Fill(dipangle);}
633 else {fNFakeTracksPt->Fill(ptg); fNFakeTracksEta->Fill(dipangle);}
634 Float_t pt=track->GetPt();
635 fPtRes->Fill((pt-ptg)/ptg*100.);
636 fNtuppel->Fill(ptg,pt,nHits);
643 void AliL3Evaluate::CalcEffHistos(){
645 Stat_t ngood=fNGoodTracksPt->GetEntries();
646 Stat_t nfound=fNFoundTracksPt->GetEntries();
647 Stat_t nfake=fNFakeTracksPt->GetEntries();
649 LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
650 <<AliL3Log::kDec<<"There was "<<ngood<<" generated good tracks"<<ENDLOG;
651 LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
652 <<AliL3Log::kDec<<"Found "<<nfound<<" tracks"<<ENDLOG;
653 LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
654 <<AliL3Log::kDec<<"Integral efficiency is about "<<nfound/ngood*100<<ENDLOG;
655 LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
656 <<AliL3Log::kDec<<"Fake tracks relative is about "<<nfake/ngood*100<<ENDLOG;
658 fNFoundTracksPt->Sumw2(); fNGoodTracksPt->Sumw2();
659 fTrackEffPt->Divide(fNFoundTracksPt,fNGoodTracksPt,1,1.,"b");
660 fFakeTrackEffPt->Divide(fNFakeTracksPt,fNGoodTracksPt,1,1.,"b");
661 fTrackEffPt->SetMaximum(1.4);
662 fTrackEffPt->SetXTitle("P_{T} [GeV]");
663 fTrackEffPt->SetLineWidth(2);
664 fFakeTrackEffPt->SetFillStyle(3013);
665 fTrackEffPt->SetLineColor(4);
666 fFakeTrackEffPt->SetFillColor(2);
668 fNFoundTracksEta->Sumw2(); fNGoodTracksEta->Sumw2();
669 fTrackEffEta->Divide(fNFoundTracksEta,fNGoodTracksEta,1,1.,"b");
670 fFakeTrackEffEta->Divide(fNFakeTracksEta,fNGoodTracksEta,1,1.,"b");
671 fTrackEffEta->SetMaximum(1.4);
672 fTrackEffEta->SetXTitle("#lambda [degrees]");
673 fTrackEffEta->SetLineWidth(2);
674 fFakeTrackEffEta->SetFillStyle(3013);
675 fTrackEffEta->SetLineColor(4);
676 fFakeTrackEffEta->SetFillColor(2);
680 void AliL3Evaluate::Write2File(Char_t *outputfile)
682 //Write histograms to file:
684 TFile *of = new TFile(outputfile,"RECREATE");
687 LOG(AliL3Log::kError,"AliL3Evaluate::Write2File","File Open")
688 <<"Problems opening rootfile"<<ENDLOG;
695 fNGoodTracksPt->Write();
696 fNFoundTracksPt->Write();
697 fNFakeTracksPt->Write();
698 fTrackEffPt->Write();
699 fFakeTrackEffPt->Write();
700 fNGoodTracksEta->Write();
701 fNFoundTracksEta->Write();
702 fNFakeTracksEta->Write();
703 fTrackEffEta->Write();
704 fFakeTrackEffEta->Write();
711 TNtuple *AliL3Evaluate::CalculateResiduals()
714 TNtuple *ntuppel=new TNtuple("ntuppel","Residuals","residual_trans:residual_long:zHit:pt:dipangle:beta:padrow:nHits");
716 for(int f=fMinSlice; f<=fMaxSlice; f++)
718 AliL3FileHandler *tfile = new AliL3FileHandler();
720 sprintf(fname,"tracks_tr_%d_0.raw",f);
721 if(!tfile->SetBinaryInput(fname)){
722 LOG(AliL3Log::kError,"AliL3Evaluation::Setup","File Open")
723 <<"Inputfile "<<fname<<" does not exist"<<ENDLOG;
726 fTracks = new AliL3TrackArray();
727 tfile->Binary2TrackArray(fTracks);
728 tfile->CloseBinaryInput();
732 for(Int_t i=0; i<fTracks->GetNTracks(); i++)
735 AliL3Track *track = (AliL3Track*)fTracks->GetCheckedTrack(i);
738 track->CalculateHelix();
739 UInt_t *hitnum = track->GetHitNumbers();
744 for(Int_t j=0; j<track->GetNumberOfPoints(); j++)
747 Int_t slice = (id>>25) & 0x7f;
748 Int_t patch = (id>>22) & 0x7;
749 UInt_t pos = id&0x3fffff;
751 AliL3SpacePointData *points = fClusters[slice][patch];
755 LOG(AliL3Log::kError,"AliL3Evaluate::CalculateResiduals","Clusterarray")
756 <<"No points at slice "<<slice<<" patch "<<patch<<" pos "<<pos<<ENDLOG;
759 if(pos>=fNcl[slice][patch])
761 LOG(AliL3Log::kError,"AliL3Evaluate::CalculateResiduals","Clusterarray")
762 <<AliL3Log::kDec<<"ERROR"<<ENDLOG;
766 xyz[0] = points[pos].fX;
767 xyz[1] = points[pos].fY;
768 xyz[2] = points[pos].fZ;
769 padrow = points[pos].fPadRow;
770 fTransform->Global2Local(xyz,slice);
772 Float_t xyz_cross[3];
773 track->GetCrossingPoint(padrow,xyz_cross);
774 Double_t beta = track->GetCrossingAngle(padrow);
776 Double_t yres = xyz_cross[1] - xyz[1];
777 Double_t zres = xyz_cross[2] - xyz[2];
779 Double_t dipangle = atan(track->GetTgl());
780 ntuppel->Fill(yres,zres,xyz_cross[2],track->GetPt(),dipangle,beta,padrow,track->GetNumberOfPoints());