-Bool_t AliL3Evaluate::InitMC()
-{
- if(fIsSlow)
- {
- fDigitsFile->cd();
- fDigitsTree = (TTree*)fDigitsFile->Get("TreeD_75x40_100x60");
- if(!fDigitsTree) return false;
- fDigitsTree->GetBranch("Segment")->SetAddress(&fDigits);
- for(Int_t i=0; i<fDigitsTree->GetEntries(); i++)
- {
- if(!fDigitsTree->GetEvent(i)) continue;
- Int_t se,ro,slice,slicerow;
- fParam->AdjustSectorRow(fDigits->GetID(),se,ro);
- fTransform->Sector2Slice(slice,slicerow,se,ro);
- fRowid[slice][slicerow] = i;
- }
- }
-
- fEventFile->cd();
- AliRun *gAlice = (AliRun*)fEventFile->Get("gAlice");
- if (!gAlice)
- {
- LOG(AliL3Log::kError,"AliL3Evaluate::SetParticleArray","gAlice")
- <<"AliRun object non existing on file"<<ENDLOG;
- return false;
- }
-
- gAlice->GetEvent(0);
-
- return true;
-
-}
-
-
-
-void AliL3Evaluate::DefineGoodTracks(Int_t *slice,Int_t *padrow,Int_t good_number)
-{
- //Loop over MC particles, and mark the good ones
- //(which the tracker should find...)
-
- AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
-
- TPC->SetParam(fParam);
-
- Int_t ver = TPC->IsVersion();
- LOG(AliL3Log::kInformational,"AliL3Evaluate::DefineGoodTracks","TPC version")
- <<"TPC version "<<ver<<" found on file"<<ENDLOG;
-
- Int_t zero=TPC->GetParam()->GetZeroSup();
-
- Int_t np = gAlice->GetNtrack();
- Int_t *good = new Int_t[np];
- for(Int_t ii=0; ii<np; ii++)
- good[ii] = 0;
-
- if(ver==1)
- {
- if(fIsSlow)
- LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","TPC version")
- <<"TPC version "<<ver<<" does not match."<<ENDLOG;
- fMCclusterfile->cd();
- AliTPCClustersArray carray;
- carray.Setup(fParam);
- carray.SetClusterType("AliTPCcluster");
- Bool_t clusterok = carray.ConnectTree("Segment Tree");
- if(!clusterok)
- LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","Cluster Array")
- <<"Error loading clusters from rootfile"<<ENDLOG;
-
- for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++)
- {
- Int_t sec,row,sl,lr;
- AliSegmentID *s = carray.LoadEntry(i);
- fParam->AdjustSectorRow(s->GetID(),sec,row);
- fTransform->Sector2Slice(sl,lr,sec,row);
-
- if(sl != slice[0]) {carray.ClearRow(sec,row); continue;}
- if(lr < padrow[0]) {carray.ClearRow(sec,row); continue;}
- if(lr > padrow[1]) {carray.ClearRow(sec,row); continue;}
- AliTPCClustersRow *cRow = carray.GetRow(sec,row);
- for(Int_t j=0; j<cRow->GetArray()->GetEntriesFast(); j++)
- {
- AliTPCcluster *cluster=(AliTPCcluster*)(*cRow)[j];
- Int_t lab=cluster->GetLabel(0);
- if(lab<0) continue;
- lab=TMath::Abs(lab);
- good[lab]++;
- }
- if(carray.GetRow(sec,row))
- carray.ClearRow(sec,row);
- }
- }
- else if(ver==2)
- {
- if(!fIsSlow)
- LOG(AliL3Log::kError,"AliL3Evaluate::DefineGoodTracks","TPC version")
- <<"TPC version "<<ver<<" does not match."<<ENDLOG;
- Int_t *count = new Int_t[np]; //np number of particles.
- Int_t i;
- for (i=0; i<np; i++) count[i]=0;
- for(Int_t sl=slice[0]; sl<=slice[1]; sl++)
- {
- for (i=padrow[0]; i<=padrow[1]; i++) {
- Int_t index = fRowid[sl][i];
- if (!fDigitsTree->GetEvent(index)) continue;
- Int_t sec,row;
- fParam->AdjustSectorRow(fDigits->GetID(),sec,row);
- fDigits->First();
- do {
- Int_t it=fDigits->CurrentRow(), ip=fDigits->CurrentColumn();
- Short_t dig = fDigits->GetDigit(it,ip);
- Int_t idx0=fDigits->GetTrackID(it,ip,0);
- Int_t idx1=fDigits->GetTrackID(it,ip,1);
- Int_t idx2=fDigits->GetTrackID(it,ip,2);
-
- if (idx0>=0 && dig>=zero) count[idx0]+=1;
- if (idx1>=0 && dig>=zero) count[idx1]+=1;
- if (idx2>=0 && dig>=zero) count[idx2]+=1;
- } while (fDigits->Next());
-
- for (Int_t j=0; j<np; j++)
- {
- if (count[j]>1) //at least two digits at this padrow
- good[j]++;
-
- count[j]=0;
- }
- }
- }
- delete[] count;
- }
-
- else
- {
- LOG(AliL3Log::kError,"AliL3Evaluation::FillEffHistos","TPC version")
- <<"No valid TPC version found"<<ENDLOG;
- return;
- }
-
-
- //The following code has been taken from offlinemacro->AliTPCComparison.C
-
- TTree *TH=gAlice->TreeH();
- Int_t npart=(Int_t)TH->GetEntries();
- Int_t nt=0;
- Int_t max = 15000;
- while (npart--) {
- AliTPChit *hit0=0;
-
- TPC->ResetHits();
- TH->GetEvent(npart);
- AliTPChit * hit = (AliTPChit*) TPC->FirstHit(-1);
- while (hit){
- if (hit->fQ==0.) break;
- hit = (AliTPChit*) TPC->NextHit();
- }
- if (hit) {
- hit0 = new AliTPChit(*hit); //Make copy of hit
- hit = hit0;
- }
- else continue;
- AliTPChit *hit1=(AliTPChit*)TPC->NextHit();
- if (hit1==0) continue;
- if (hit1->fQ != 0.) continue;
- Int_t i=hit->Track();
- TParticle *p = (TParticle*)gAlice->Particle(i);
-
- printf("Checking particle %d with code %d\n",i,p->GetPdgCode());
- if (p->GetFirstMother()>=0) continue; //secondary particle
- if (good[i] < good_number) continue;
- if (p->Pt()<fMinGoodPt) continue;
- if (TMath::Abs(p->Pz()/p->Pt())>0.999) continue;
- printf("Checking particle %d, nHits %d\n",i,good[i]);
- fGoodGen++;
- fGoodTracks[nt].label=i;
- fGoodTracks[nt].code=p->GetPdgCode();
- //**** px py pz - in global coordinate system, x y z - in local !
- fGoodTracks[nt].px=hit->X(); fGoodTracks[nt].py=hit->Y(); fGoodTracks[nt].pz=hit->Z();
-
- nt++;
- if (hit0) delete hit0;
- if (nt==max) {cerr<<"Too many good tracks !n"; break;}
- }
-
- delete [] good;
-
-}
-
-void AliL3Evaluate::EvaluatePatch(Int_t slice,Int_t patch,Int_t min_points,Int_t good_number)