- // This function calculates the "detector response" PID probabilities
- //
- Int_t ntrk=event->GetNumberOfTracks();
- for (Int_t i=0; i<ntrk; i++) {
- AliESDtrack *t=event->GetTrack(i);
- if ((t->GetStatus()&AliESDtrack::kTRDin)==0)
- if ((t->GetStatus()&AliESDtrack::kTRDout)==0)
- if ((t->GetStatus()&AliESDtrack::kTRDrefit)==0) continue;
- // Int_t ns=AliESDtrack::kSPECIES;
- Int_t ns=AliPID::kSPECIES;
- Double_t p[10];
- for (Int_t j=0; j<ns; j++) {
- Double_t mass=AliPID::ParticleMass(j);
- Double_t mass=masses[j];
- Double_t mom=t->GetP();
- Double_t dedx=t->GetTRDsignal()/fMIP;
- Double_t bethe= AliTRDpidESD::Bethe(mom/mass);
- Double_t sigma=fRes*bethe;
- if (TMath::Abs(dedx-bethe) > fRange*sigma) {
- p[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
- continue;
+ // This function calculates the PID probabilities based on TRD signals
+ //
+ // The method produces probabilities based on the charge
+ // and the position of the maximum time bin in each layer.
+ // The dE/dx information can be used as global charge or 2 to 3
+ // slices. Check AliTRDCalPID and AliTRDCalPIDRefMaker for the actual
+ // implementation.
+ //
+ // Author
+ // Alex Bercuci (A.Bercuci@gsi.de) 2nd May 2007
+ //
+
+ AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
+ if (!calibration) {
+ AliErrorGeneral("AliTRDpidESD::MakePID()"
+ ,"No access to calibration data");
+ return -1;
+ }
+
+// AliTRDrecoParam *rec = AliTRDReconstructor::RecoParam();
+// if (!rec) {
+// AliErrorGeneral("AliTRDpidESD::MakePID()", "No TRD reco param.");
+// return 0x0;
+// }
+
+ // Retrieve the CDB container class with the probability distributions
+ const AliTRDCalPID *pd = calibration->GetPIDObject(AliTRDpidUtil::kLQ);
+ if (!pd) {
+ AliErrorGeneral("AliTRDpidESD::MakePID()"
+ ,"No access to AliTRDCalPID");
+ return -1;
+ }
+
+ // Loop through all ESD tracks
+ Double_t p[10];
+ AliESDtrack *t = NULL;
+ Float_t dedx[AliTRDCalPID::kNSlicesLQ], dEdx;
+ Int_t timebin;
+ Float_t mom, length;
+ Int_t nPlanePID;
+ for (Int_t i=0; i<event->GetNumberOfTracks(); i++) {
+ t = event->GetTrack(i);
+
+ // Check track
+ if(!CheckTrack(t)) continue;
+
+
+ // Skip tracks which have no TRD signal at all
+ if (t->GetTRDsignal()<1.e-5) continue;
+
+ // Loop over detector layers
+ mom = 0.;
+ length = 0.;
+ nPlanePID = 0;
+ for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++)
+ p[iSpecies] = 1./AliPID::kSPECIES;
+
+ for (Int_t iLayer = 0; iLayer < AliTRDgeometry::kNlayer; iLayer++) {
+ // read data for track segment
+ for(int iSlice=0; iSlice<AliTRDCalPID::kNSlicesLQ; iSlice++)
+ dedx[iSlice] = t->GetTRDslice(iLayer, iSlice);
+ dEdx = t->GetTRDslice(iLayer, -1);
+ timebin = t->GetTRDTimBin(iLayer);
+
+ // check data
+ if ((dEdx <= 0.) || (timebin <= -1.)) continue;
+
+ // retrive kinematic info for this track segment
+ if(!RecalculateTrackSegmentKine(t, iLayer, mom, length)){
+ // information is not fully reliable especialy for length
+ // estimation. To be used in the future.
+ }
+
+ // this track segment has fulfilled all requierments
+ nPlanePID++;
+
+ // Get the probabilities for the different particle species
+ for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
+ p[iSpecies] *= pd->GetProbability(iSpecies, mom, dedx, length, iLayer);
+ //p[iSpecies] *= pd->GetProbabilityT(iSpecies, mom, timebin);