X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSRecParticle.cxx;h=78224515d148b1011588586dd441e979dab4414c;hb=7e6ee5e39d1f413890d7227279bc5da9fda26849;hp=0d2d7d5922863fb3937621c6306e0a320a8961a7;hpb=17323043f584137499bf2a6e2f2e2da17448b152;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSRecParticle.cxx b/PHOS/AliPHOSRecParticle.cxx index 0d2d7d59228..78224515d14 100644 --- a/PHOS/AliPHOSRecParticle.cxx +++ b/PHOS/AliPHOSRecParticle.cxx @@ -32,12 +32,13 @@ #include "AliPHOSRecParticle.h" #include "AliPHOSGetter.h" #include "AliPHOSGeometry.h" +#include "AliLog.h" //____________________________________________________________________________ AliPHOSRecParticle::AliPHOSRecParticle(): fPHOSTrackSegment(0) , fDebug( kFALSE ) { // ctor - const Int_t nSPECIES = AliESDtrack::kSPECIESN; + const Int_t nSPECIES = AliPID::kSPECIESN; for(Int_t i = 0; iEvent(gime->EventNumber(), "DRTX") ; + gime->Event(gime->EventNumber(), "DRT") ; + + // Get TrackSegment corresponding to this RecParticle + AliPHOSTrackSegment *ts = gime->TrackSegment(fPHOSTrackSegment); + + // Get EmcRecPoint corresponding to this TrackSegment + Int_t emcRecPointIndex = ts->GetEmcIndex(); + + AliPHOSEmcRecPoint *emcRecPoint = gime->EmcRecPoint(emcRecPointIndex); + + // Get the list of digits forming this EmcRecParticle + Int_t nDigits = emcRecPoint->GetDigitsMultiplicity(); + Int_t *digitList = emcRecPoint->GetDigitsList(); + + // Find the digit with maximum amplitude + AliPHOSDigit *digit = 0; + Int_t maxAmp = 0; + Int_t bestDigitIndex = -1; + for (Int_t iDigit=0; iDigitDigit(digitList[iDigit]); + if (digit->GetAmp() > maxAmp) { + maxAmp = digit->GetAmp(); + bestDigitIndex = iDigit; + } + } + digit = gime->Digit(digitList[bestDigitIndex]); + + // Get the list of primary tracks producing this digit + // and find which track has more track energy. + //Int_t nPrimary = digit->GetNprimary(); + //TParticle *track = 0; + //Double_t energyEM = 0; + //Double_t energyHadron = 0; + //Int_t trackEM = -1; + //Int_t trackHadron = -1; + //for (Int_t iPrim=0; iPrimGetPrimary(iPrim+1); + // if (iPrimary == -1 || TMath::Abs(iPrimary)>10000000) + // continue ; //PH 10000000 is the shift of the track + // //PH indexes in the underlying event + // track = gime->Primary(iPrimary); + // Int_t pdgCode = track->GetPdgCode(); + // Double_t energy = track->Energy(); + // if (pdgCode==22 || TMath::Abs(pdgCode)==11) { + // if (energy > energyEM) { + // energyEM = energy; + // trackEM = iPrimary; + // } + // } + // else { + // if (energy > energyHadron) { + // energyHadron = energy; + // trackHadron = iPrimary; + // } + // } + //} + // Preferences are given to electromagnetic tracks + //if (trackEM != -1) return trackEM; // track is gamma or e+- + //if (trackHadron != -1) return trackHadron; // track is hadron + //return -12345; // no track found :( + + + // Get the list of hits producing this digit, + // find which hit has deposited more energy + // and find the primary track. + + AliPHOSHit *hit = 0; + TClonesArray *hits = gime->Hits(); + Double_t maxedep = 0; + Int_t maxtrack = -1; + Int_t nHits = hits ->GetEntries(); + Int_t id = digit->GetId(); + + for (Int_t iHit=0; iHitHit(iHit); + if(hit->GetId() == id){ + Double_t edep = hit->GetEnergy(); + Int_t track = hit->GetPrimary(); + if(edep > maxedep){ + maxedep = edep; + maxtrack = track; + } + } + } + + if (maxtrack != -1) return maxtrack; // track is hadron + return -12345; // no track found :( +} + //____________________________________________________________________________ const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const { @@ -161,7 +263,7 @@ const TParticle * AliPHOSRecParticle::GetPrimary(Int_t index) const } //____________________________________________________________________________ -void AliPHOSRecParticle::SetPID(Int_t type, Double_t weight) +void AliPHOSRecParticle::SetPID(Int_t type, Float_t weight) { // Set the probability densities that this reconstructed particle // has a type of i: