fMCFile = NULL;
fTracks = NULL;
fMCclusterfile = NULL;
+ fNFastPoints = 0;
+ fMcIndex = 0;
+ fMcId = 0;
}
AliL3Evaluate::AliL3Evaluate(Char_t *mcfile,Int_t *slice)
AliL3Evaluate::~AliL3Evaluate()
{
- if(fDigitsTree)
- fDigitsTree->Delete();
-
-
- /*if(fMCFile)
- {
- fMCFile->Close();
- delete fMCFile;
- }
- */
- if(fTransform)
- delete fTransform;
- if(fTracks)
- delete fTracks;
- if(fPtRes)
- delete fPtRes;
- if(fNGoodTracksPt)
- delete fNGoodTracksPt;
- if(fNFoundTracksPt)
- delete fNFoundTracksPt;
- if(fNFakeTracksPt)
- delete fNFakeTracksPt;
- if(fTrackEffPt)
- delete fTrackEffPt;
- if(fFakeTrackEffPt)
- delete fFakeTrackEffPt;
- if(fNGoodTracksEta)
- delete fNGoodTracksEta;
- if(fNFoundTracksEta)
- delete fNFoundTracksEta;
- if(fNFakeTracksEta)
- delete fNFakeTracksEta;
- if(fTrackEffEta)
- delete fTrackEffEta;
- if(fFakeTrackEffEta)
- delete fFakeTrackEffEta;
+ if(fDigitsTree) fDigitsTree->Delete();
+ if(fMCFile) {
+ fMCFile->Close();
+ delete fMCFile;
+ }
+ if(fTransform) delete fTransform;
+ if(fTracks) delete fTracks;
+ if(fPtRes) delete fPtRes;
+ if(fNGoodTracksPt) delete fNGoodTracksPt;
+ if(fNFoundTracksPt) delete fNFoundTracksPt;
+ if(fNFakeTracksPt) delete fNFakeTracksPt;
+ if(fTrackEffPt) delete fTrackEffPt;
+ if(fFakeTrackEffPt) delete fFakeTrackEffPt;
+ if(fNGoodTracksEta) delete fNGoodTracksEta;
+ if(fNFoundTracksEta) delete fNFoundTracksEta;
+ if(fNFakeTracksEta) delete fNFakeTracksEta;
+ if(fTrackEffEta) delete fTrackEffEta;
+ if(fFakeTrackEffEta) delete fFakeTrackEffEta;
+ if(fMcIndex) delete [] fMcIndex;
+ if(fMcId) delete [] fMcId;
}
void AliL3Evaluate::Setup(Char_t *trackfile,Char_t *path)
//Setup for using the fast simulator.
fIsSlow = false;
+ GetFastClusterIDs(path);
fMCclusterfile = new TFile(mcClusterfile);
if(!fMCclusterfile->IsOpen())
<<"Error setting up particle array"<<ENDLOG;
}
-void AliL3Evaluate::CreateHistos(Int_t nbin,Int_t xlow,Int_t xup)
-{
- //Create the histograms
-
- fPtRes = new TH1F("fPtRes","Relative Pt resolution",30,-10.,10.);
- fNGoodTracksPt = new TH1F("fNGoodTracksPt","Good tracks vs pt",nbin,xlow,xup);
- fNFoundTracksPt = new TH1F("fNFoundTracksPt","Found tracks vs pt",nbin,xlow,xup);
- fNFakeTracksPt = new TH1F("fNFakeTracksPt","Fake tracks vs pt",nbin,xlow,xup);
- fTrackEffPt = new TH1F("fTrackEffPt","Tracking efficiency vs pt",nbin,xlow,xup);
- fFakeTrackEffPt = new TH1F("fFakeTrackEffPt","Efficiency for fake tracks vs pt",nbin,xlow,xup);
-
- fNGoodTracksEta = new TH1F("fNGoodTracksEta","Good tracks vs eta",20,-50,50);
- fNFoundTracksEta = new TH1F("fNFoundTracksEta","Found tracks vs eta",20,-50,50);
- fNFakeTracksEta = new TH1F("fNFakeTracksEta","Fake tracks vs eta",20,-50,50);
- fTrackEffEta = new TH1F("fTrackEffEta","Tracking efficienct vs eta",20,-50,50);
- fFakeTrackEffEta = new TH1F("fFakeTrackEffEta","Efficiency for fake tracks vs eta",20,-50,50);
-
-}
-
Bool_t AliL3Evaluate::SetDigitsTree()
{
CalcEffHistos();
}
-void AliL3Evaluate::FillEffHistos(TObjArray *good_particles,Int_t *particle_id)
-{
- //Fill the efficiency histograms.
-
- for(Int_t i=0; i<good_particles->GetEntriesFast(); i++)
- {
- TParticle *p = (TParticle*)good_particles->UncheckedAt(i);
- Double_t ptg=p->Pt(),pzg=p->Pz();
- Float_t dipangle=TMath::ATan2(pzg,ptg)*180./TMath::Pi();
- fNGoodTracksPt->Fill(ptg);
- fNGoodTracksEta->Fill(dipangle);
- Int_t found = 0;
- for(Int_t k=0; k<fTracks->GetNTracks(); k++)
- {
- AliL3Track *track = fTracks->GetCheckedTrack(k);
- if(!track) continue;
- Int_t nHits = track->GetNumberOfPoints();
- if(nHits < fMinPointsOnTrack) break;
-
- Int_t tracklabel;
- tracklabel = track->GetMCid();
-
- if(TMath::Abs(tracklabel) != particle_id[i]) continue;
- found=1;
- if(tracklabel == particle_id[i]) {fNFoundTracksPt->Fill(ptg); fNFoundTracksEta->Fill(dipangle);}
- else {fNFakeTracksPt->Fill(ptg); fNFakeTracksEta->Fill(dipangle);}
- Float_t pt=track->GetPt();
- fPtRes->Fill((pt-ptg)/ptg*100.);
- break;
-
- }
- }
-}
-
-void AliL3Evaluate::CalcEffHistos(){
-
- Stat_t ngood=fNGoodTracksPt->GetEntries();
- Stat_t nfound=fNFoundTracksPt->GetEntries();
- Stat_t nfake=fNFakeTracksPt->GetEntries();
-
- LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
- <<AliL3Log::kDec<<"There was "<<ngood<<" generated good tracks"<<ENDLOG;
- LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
- <<AliL3Log::kDec<<"Found "<<nfound<<" tracks"<<ENDLOG;
- LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
- <<AliL3Log::kDec<<"Integral efficiency is about "<<nfound/ngood*100<<ENDLOG;
- LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
- <<AliL3Log::kDec<<"Fake tracks relative is about "<<nfake/ngood*100<<ENDLOG;
-
- fNFoundTracksPt->Sumw2(); fNGoodTracksPt->Sumw2();
- fTrackEffPt->Divide(fNFoundTracksPt,fNGoodTracksPt,1,1.,"b");
- fFakeTrackEffPt->Divide(fNFakeTracksPt,fNGoodTracksPt,1,1.,"b");
- fTrackEffPt->SetMaximum(1.4);
- fTrackEffPt->SetXTitle("P_{T} [GeV]");
- fTrackEffPt->SetLineWidth(2);
- fFakeTrackEffPt->SetFillStyle(3013);
- fTrackEffPt->SetLineColor(4);
- fFakeTrackEffPt->SetFillColor(2);
-
- fNFoundTracksEta->Sumw2(); fNGoodTracksEta->Sumw2();
- fTrackEffEta->Divide(fNFoundTracksEta,fNGoodTracksEta,1,1.,"b");
- fFakeTrackEffEta->Divide(fNFakeTracksEta,fNGoodTracksEta,1,1.,"b");
- fTrackEffEta->SetMaximum(1.4);
- fTrackEffEta->SetXTitle("#lambda [degrees]");
- fTrackEffEta->SetLineWidth(2);
- fFakeTrackEffEta->SetFillStyle(3013);
- fTrackEffEta->SetLineColor(4);
- fFakeTrackEffEta->SetFillColor(2);
-
-}
-
void AliL3Evaluate::AssignIDs()
{
//Assign MC id to the tracks.
- UInt_t *index=0,tmp_ind=0;
- Int_t *pID=0,npoints=0;
-
- if(!fIsSlow)
- {
- pID = GetFastIDs(tmp_ind,npoints);
- index = (UInt_t*)tmp_ind;
- }
-
fTracks->QSort();
LOG(AliL3Log::kDebug,"AliL3Evaluate::AssignIDs","Track Loop")
<<"Assigning MC id to the found tracks...."<<ENDLOG;
for(Int_t i=0; i<fTracks->GetNTracks(); i++)
{
AliL3Track *track = (AliL3Track*)fTracks->GetCheckedTrack(i);
- if(!track)
- {
- LOG(AliL3Log::kWarning,"AliL3Evaluate::AssignIDs","Track Loop")
- <<AliL3Log::kDec<<"No track in track array, index "<<i<<ENDLOG;
- continue;
- }
+ if(!track) continue;
if(track->GetNumberOfPoints() < fMinPointsOnTrack) break;
- Int_t tID;
- if(!fIsSlow)
- tID = GetMCTrackLabel(track,index,pID,npoints);
- else
- tID = GetMCTrackLabel(track);
+ Int_t tID = GetMCTrackLabel(track);
track->SetMCid(tID);
printf("track %i id %d\n",i,tID);
}
-
- if(pID) delete [] pID;
- if(index) delete [] index;
}
struct S {Int_t lab; Int_t max;};
-Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track,UInt_t *index,Int_t *pID,Int_t npoints)
-{
+Int_t AliL3Evaluate::GetMCTrackLabel(AliL3Track *track){
//Returns the MCtrackID of the belonging clusters.
//If MCLabel < 0, means that track is fake.
//Fake track means that more than 10 percent of clusters are assigned incorrectly.
-
+
Int_t num_of_clusters = track->GetNumberOfPoints();
S *s=new S[num_of_clusters];
Int_t i;
for (i=0; i<num_of_clusters; i++) s[i].lab=s[i].max=0;
UInt_t *hitnum = track->GetHitNumbers();
UInt_t id;
-
- Int_t **trackID;
- if(fIsSlow)
- trackID = GetClusterIDs(track);
- else
- trackID = GetClusterIDs(track,index,pID,npoints);
-
+ Int_t ** trackID = GetClusterIDs(track);
Int_t lab=123456789;
for (i=0; i<num_of_clusters; i++)
UInt_t pos = id&0x3fffff;
AliL3SpacePointData *points = fClusters[slice][patch];
-
- if(!points)
- continue;
-
+ if(!points) continue;
if(pos>=fNcl[slice][patch])
{
LOG(AliL3Log::kError,"AliL3Evaluate::GetMCTrackLabel","Clusterarray")
UInt_t pos = id&0x3fffff;
AliL3SpacePointData *points = fClusters[slice][patch];
-
- if(!points)
- continue;
-
+ if(!points) continue;
if(pos>=fNcl[slice][patch])
{
LOG(AliL3Log::kError,"AliL3Evaluate::GetMCTrackLabel","Clusterarray")
}
-Int_t **AliL3Evaluate::GetClusterIDs(AliL3Track *track,UInt_t *index,Int_t *pID,Int_t npoints)
+Int_t **AliL3Evaluate::GetClusterIDs(AliL3Track *track)
{
//Return the MC information of all clusters belonging to track.
-
+
Int_t num_of_clusters = track->GetNumberOfPoints();
Int_t **trackID = new Int_t*[num_of_clusters];
UInt_t *hitnum = track->GetHitNumbers();
UInt_t id;
-
Float_t xyz[3];
- Int_t sector,padrow;
+ Int_t padrow;
for(Int_t i=0; i<num_of_clusters; i++)
{
id = hitnum[i];
else
{
Int_t tmp_pid=0;
- for(Int_t ii=0; ii<npoints; ii++)
+ for(Int_t ii=0; ii<fNFastPoints; ii++)
{
- tmp_pid = pID[ii];
- if(index[ii] == id) break;
+ tmp_pid = fMcId[ii];
+ if(fMcIndex[ii] == id) break;
}
trackID[i] = new Int_t[3];
trackID[i][0] = tmp_pid;
return trackID;
}
-Int_t *AliL3Evaluate::GetFastIDs(UInt_t &tmp_ind,Int_t &npoints)
+void AliL3Evaluate::GetFastClusterIDs(Char_t *path)
{
//Get the MC id of space points in case of using the fast simulator.
-
- FILE *infile = fopen("point_mc.dat","r");
- if(!infile) return 0;
+ char fname[256];
+ sprintf(fname,"%s/point_mc.dat",path);
+ FILE *infile = fopen(fname,"r");
+ if(!infile) return;
Int_t hitid,hitmc,i;
for(i=0; ; i++)
if(fscanf(infile,"%d %d",&hitid,&hitmc)==EOF) break;
- npoints = i;
rewind(infile);
- Int_t *pID = new Int_t[npoints];
- UInt_t *ind = new UInt_t[npoints];
- tmp_ind = (UInt_t)ind;
+ fNFastPoints = i;
+ fMcId = new Int_t[fNFastPoints];
+ fMcIndex = new UInt_t[fNFastPoints];
- for(i=0; i<npoints; i++)
+ for(i=0; i<fNFastPoints; i++)
{
if(fscanf(infile,"%d %d",&hitid,&hitmc)==EOF) break;
- pID[i] = hitmc;
- ind[i] = hitid;
+ fMcId[i] = hitmc;
+ fMcIndex[i] = hitid;
}
fclose(infile);
+}
+
+void AliL3Evaluate::CreateHistos(Int_t nbin,Int_t xlow,Int_t xup)
+{
+ //Create the histograms
+
+ fPtRes = new TH1F("fPtRes","Relative Pt resolution",30,-10.,10.);
+ fNGoodTracksPt = new TH1F("fNGoodTracksPt","Good tracks vs pt",nbin,xlow,xup);
+ fNFoundTracksPt = new TH1F("fNFoundTracksPt","Found tracks vs pt",nbin,xlow,xup);
+ fNFakeTracksPt = new TH1F("fNFakeTracksPt","Fake tracks vs pt",nbin,xlow,xup);
+ fTrackEffPt = new TH1F("fTrackEffPt","Tracking efficiency vs pt",nbin,xlow,xup);
+ fFakeTrackEffPt = new TH1F("fFakeTrackEffPt","Efficiency for fake tracks vs pt",nbin,xlow,xup);
+
+ fNGoodTracksEta = new TH1F("fNGoodTracksEta","Good tracks vs eta",20,-50,50);
+ fNFoundTracksEta = new TH1F("fNFoundTracksEta","Found tracks vs eta",20,-50,50);
+ fNFakeTracksEta = new TH1F("fNFakeTracksEta","Fake tracks vs eta",20,-50,50);
+ fTrackEffEta = new TH1F("fTrackEffEta","Tracking efficienct vs eta",20,-50,50);
+ fFakeTrackEffEta = new TH1F("fFakeTrackEffEta","Efficiency for fake tracks vs eta",20,-50,50);
+}
- return pID;
+void AliL3Evaluate::FillEffHistos(TObjArray *good_particles,Int_t *particle_id)
+{
+ //Fill the efficiency histograms.
+ for(Int_t i=0; i<good_particles->GetEntriesFast(); i++)
+ {
+ TParticle *p = (TParticle*)good_particles->UncheckedAt(i);
+ Double_t ptg=p->Pt(),pzg=p->Pz();
+ Float_t dipangle=TMath::ATan2(pzg,ptg)*180./TMath::Pi();
+ fNGoodTracksPt->Fill(ptg);
+ fNGoodTracksEta->Fill(dipangle);
+ Int_t found = 0;
+ for(Int_t k=0; k<fTracks->GetNTracks(); k++)
+ {
+ AliL3Track *track = fTracks->GetCheckedTrack(k);
+ if(!track) continue;
+ Int_t nHits = track->GetNumberOfPoints();
+ if(nHits < fMinPointsOnTrack) break;
+
+ Int_t tracklabel;
+ tracklabel = track->GetMCid();
+
+ if(TMath::Abs(tracklabel) != particle_id[i]) continue;
+ found=1;
+ if(tracklabel == particle_id[i]) {fNFoundTracksPt->Fill(ptg); fNFoundTracksEta->Fill(dipangle);}
+ else {fNFakeTracksPt->Fill(ptg); fNFakeTracksEta->Fill(dipangle);}
+ Float_t pt=track->GetPt();
+ fPtRes->Fill((pt-ptg)/ptg*100.);
+ break;
+
+ }
+ }
+}
+
+void AliL3Evaluate::CalcEffHistos(){
+
+ Stat_t ngood=fNGoodTracksPt->GetEntries();
+ Stat_t nfound=fNFoundTracksPt->GetEntries();
+ Stat_t nfake=fNFakeTracksPt->GetEntries();
+
+ LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
+ <<AliL3Log::kDec<<"There was "<<ngood<<" generated good tracks"<<ENDLOG;
+ LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
+ <<AliL3Log::kDec<<"Found "<<nfound<<" tracks"<<ENDLOG;
+ LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
+ <<AliL3Log::kDec<<"Integral efficiency is about "<<nfound/ngood*100<<ENDLOG;
+ LOG(AliL3Log::kInformational,"AliL3Evaluate::FillEffHistos","Efficiency")
+ <<AliL3Log::kDec<<"Fake tracks relative is about "<<nfake/ngood*100<<ENDLOG;
+
+ fNFoundTracksPt->Sumw2(); fNGoodTracksPt->Sumw2();
+ fTrackEffPt->Divide(fNFoundTracksPt,fNGoodTracksPt,1,1.,"b");
+ fFakeTrackEffPt->Divide(fNFakeTracksPt,fNGoodTracksPt,1,1.,"b");
+ fTrackEffPt->SetMaximum(1.4);
+ fTrackEffPt->SetXTitle("P_{T} [GeV]");
+ fTrackEffPt->SetLineWidth(2);
+ fFakeTrackEffPt->SetFillStyle(3013);
+ fTrackEffPt->SetLineColor(4);
+ fFakeTrackEffPt->SetFillColor(2);
+
+ fNFoundTracksEta->Sumw2(); fNGoodTracksEta->Sumw2();
+ fTrackEffEta->Divide(fNFoundTracksEta,fNGoodTracksEta,1,1.,"b");
+ fFakeTrackEffEta->Divide(fNFakeTracksEta,fNGoodTracksEta,1,1.,"b");
+ fTrackEffEta->SetMaximum(1.4);
+ fTrackEffEta->SetXTitle("#lambda [degrees]");
+ fTrackEffEta->SetLineWidth(2);
+ fFakeTrackEffEta->SetFillStyle(3013);
+ fTrackEffEta->SetLineColor(4);
+ fFakeTrackEffEta->SetFillColor(2);
+
}
void AliL3Evaluate::Write2File(Char_t *outputfile)