// Different Selections for pp and Pb-Pb: Momentum Range, Max Time, # pions
//-- Author: F. Pierella
//-- Mod By Silvia Arcelli, Francesco Noferini, Barbara Guerzoni
+//-- AliTOFT0v1 contains code speed up provided by Jens Wiechula (look-up table
+// for Power3)
//////////////////////////////////////////////////////////////////////////////
#include "AliESDtrack.h"
fPIDesd(extPID),
fTracks(new TObjArray(10)),
fGTracks(new TObjArray(10)),
- fTracksT0(new TObjArray(10))
+ fTracksT0(new TObjArray(10)),
+ fOptFlag(kFALSE)
{
//
// default constructor
}
Init(NULL);
-
+
+ //initialise lookup table for power 3
+ // a set should only have 10 tracks a t maximum
+ // so up to 15 should be more than enough
+ for (Int_t i=0; i<15; ++i) {
+ fLookupPowerThree[i]=ToCalculatePower(3,i);
+ }
}
//____________________________________________________________________________
fPIDesd(extPID),
fTracks(new TObjArray(10)),
fGTracks(new TObjArray(10)),
- fTracksT0(new TObjArray(10))
+ fTracksT0(new TObjArray(10)),
+ fOptFlag(kFALSE)
{
//
// real constructor
}
Init(event);
-
+ //initialise lookup table for power 3
+ for (Int_t i=0; i<15; ++i) {
+ fLookupPowerThree[i]=Int_t(TMath::Power(3,i));
+ }
}
//____________________________________________________________________________
AliTOFT0v1& AliTOFT0v1::operator=(const AliTOFT0v1 &tzero)
for (Int_t ii=0; ii<tzero.fTracksT0->GetEntries(); ii++)
fTracksT0->AddLast(tzero.fTracksT0->At(ii));
+
+ fOptFlag=tzero.fOptFlag;
return *this;
}
fTracksT0=0x0;
}
+
}
//____________________________________________________________________________
Int_t assparticle[nmaxtracksinsetMax];
Float_t exptof[nmaxtracksinsetMax][3];
+ Float_t momErr[nmaxtracksinsetMax][3];
Float_t timeofflight[nmaxtracksinsetMax];
Float_t momentum[nmaxtracksinsetMax];
Float_t timezero[nmaxtracksinsetMax];
Double_t time=t->GetTOFsignal();
time*=1.E-3; // tof given in nanoseconds
- Double_t exptime[10]; t->GetIntegratedTimes(exptime);
+ Double_t exptime[AliPID::kSPECIESC];
+ t->GetIntegratedTimes(exptime,AliPID::kSPECIESC);
Double_t toflen=t->GetIntegratedLength();
toflen=toflen/100.; // toflen given in m
exptof[j][2]=exptime[4]*1.E-3+fTimeCorr;
momentum[j]=mom;
assparticle[j]=3;
-
- } //end for (Int_t j=0; j<ntracksinsetmy; j++) {
+
+ // in principle GetMomError only depends on two indices k=imass[j] and j itslef (see blow in the ncombinatorial loop)
+ // so it should be possible to make a lookup in order to speed up the code:
+ if (fOptFlag) {
+ momErr[j][0]=GetMomError(0, momentum[j], exptof[j][0]);
+ momErr[j][1]=GetMomError(1, momentum[j], exptof[j][1]);
+ momErr[j][2]=GetMomError(2, momentum[j], exptof[j][2]);
+ }
+ } //end for (Int_t j=0; j<ntracksinsetmy; j++) {
for (Int_t itz=0; itz<ntracksinsetmy;itz++) {
beta[itz]=momentum[itz]/sqrt(massarray[0]*massarray[0]
for (Int_t j=0; j<ntracksinsetmy; j++) {
imass[j] = 3;
}
-
- Int_t ncombinatorial = ToCalculatePower(3,ntracksinsetmy);
-
+
+ Int_t ncombinatorial;
+ if (fOptFlag) ncombinatorial = fLookupPowerThree[ntracksinsetmy];
+ else ncombinatorial = ToCalculatePower(3,ntracksinsetmy);
+
+
// Loop on mass hypotheses
for (Int_t k=0; k < ncombinatorial;k++) {
for (Int_t j=0; j<ntracksinsetmy; j++) {
- imass[j] = (k % ToCalculatePower(3,ntracksinsetmy-j))/ToCalculatePower(3,ntracksinsetmy-j-1);
+ imass[j] = (k % fLookupPowerThree[ntracksinsetmy-j])/fLookupPowerThree[ntracksinsetmy-j-1];
texp[j]=exptof[j][imass[j]];
- dtexp[j]=GetMomError(imass[j], momentum[j], texp[j]);
+ if (fOptFlag) dtexp[j]=momErr[j][imass[j]]; // see comments above in the initialisation of momErr
+ else dtexp[j]=GetMomError(imass[j], momentum[j], texp[j]);
}
Float_t sumAllweights=0.;
// printf("Redo T0\n");
for (Int_t k=0; k < ncombinatorial;k++) {
for (Int_t j=0; j<ntracksinsetmy; j++) {
- imass[j] = (k % ToCalculatePower(3,ntracksinsetmy-j)) / ToCalculatePower(3,ntracksinsetmy-j-1);
+ imass[j] = (k % fLookupPowerThree[ntracksinsetmy-j]) / fLookupPowerThree[ntracksinsetmy-j-1];
texp[j]=exptof[j][imass[j]];
- dtexp[j]=GetMomError(imass[j], momentum[j], texp[j]);
+ if (fOptFlag) dtexp[j]=momErr[j][imass[j]]; // see comments above in the initialisation of momErr
+ else dtexp[j]=GetMomError(imass[j], momentum[j], texp[j]);
}
Float_t sumAllweights=0.;
Bool_t AliTOFT0v1::CheckTPCMatching(AliESDtrack *track,Int_t imass) const{
Bool_t status = kFALSE;
- Double_t exptimes[5];
- track->GetIntegratedTimes(exptimes);
+ Double_t exptimes[AliPID::kSPECIESC];
+ track->GetIntegratedTimes(exptimes,AliPID::kSPECIESC);
Float_t dedx = track->GetTPCsignal();