+
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsPhoton(TString purity) const
+{
+ // Rec.Particle is a photon if it has a photon-like shape, fast and neutral
+ // photon-like shape is defined with a purity "low", "medium" or "high"
+
+ purity.ToLower();
+ Bool_t photonLike = kFALSE;
+ if (purity == "low" ) photonLike = TestPIDBit(6);
+ else if (purity == "medium") photonLike = TestPIDBit(7);
+ else if (purity == "high" ) photonLike = TestPIDBit(8);
+ if (photonLike && // photon by PCA
+ (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF
+ (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV
+ !TestPIDBit(14)) // no charged track
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsPi0(TString purity) const
+{
+ // Rec.Particle is a pi0 if it has a pi0-like shape, fast and neutral
+ // pi0-like shape is defined with a purity "low", "medium" or "high"
+
+ purity.ToLower();
+ Bool_t pi0Like = kFALSE;
+ if (purity == "low" ) pi0Like = TestPIDBit(9);
+ else if (purity == "medium") pi0Like = TestPIDBit(10);
+ else if (purity == "high" ) pi0Like = TestPIDBit(11);
+ else
+ AliError(Form("Wrong purity type: %s",purity.Data()));
+ if (pi0Like && // pi0 by PCA
+ (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF
+ (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV
+ !TestPIDBit(14)) // no charged track
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsElectron(TString purity) const
+{
+ // Rec.Particle is an electron if it has a photon-like shape, fast and charged
+ // photon-like shape is defined with a purity "low", "medium" or "high"
+
+ purity.ToLower();
+ Bool_t photonLike = kFALSE;
+ if (purity == "low" ) photonLike = TestPIDBit(6);
+ else if (purity == "medium") photonLike = TestPIDBit(7);
+ else if (purity == "high" ) photonLike = TestPIDBit(8);
+ else
+ AliError(Form("Wrong purity type: %s",purity.Data()));
+
+ if (photonLike && // photon by PCA
+ (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF
+ (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV
+ TestPIDBit(14)) // no charged track
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsEleCon(TString purity) const
+{
+ // Rec.Particle is an electron if it has a photon-like shape, fast and charged
+ // photon-like shape is defined with a purity "low", "medium" or "high"
+
+ purity.ToLower();
+ Bool_t photonLike = kFALSE;
+ if (purity == "low" ) photonLike = TestPIDBit(6);
+ else if (purity == "medium") photonLike = TestPIDBit(7);
+ else if (purity == "high" ) photonLike = TestPIDBit(8);
+ else
+ AliError(Form("Wrong purity type: %s",purity.Data()));
+
+ if (photonLike && // photon by PCA
+ (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF
+ (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV
+ !TestPIDBit(14)) // no charged track
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsHardPhoton() const
+{
+ // Rec.Particle is a hard photon (E > 30 GeV) if its second moment M2x
+ // corresponds to photons
+ if (TestPIDBit(12) && !TestPIDBit(14))
+ return kTRUE;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsHardPi0() const
+{
+ // Rec.Particle is a hard pi0 (E > 30 GeV) if its second moment M2x
+ // corresponds to pi0
+ if (TestPIDBit(13)&& !TestPIDBit(14))
+ return kTRUE;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsHadron() const
+{
+ // Rec.Particle is an hadron if it does not look like
+ // a low-purity photon nor low-purity pi0
+
+ if ( !TestPIDBit(6) && !TestPIDBit(9) ) // not photon nor pi0
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsChargedHadron() const
+{
+ // Rec.Particle is a charged hadron if it does not look like
+ // a low-purity photon nor low-purity pi0 and is low-purity charged
+
+ if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
+ !TestPIDBit(2)) // charged by CPV
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsNeutralHadron() const
+{
+ // Rec.Particle is a neutral hadron if it does not look like
+ // a low-purity photon nor low-purity pi0 and is high-purity neutral
+
+ if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
+ TestPIDBit(2)) // neutral by CPV
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsFastChargedHadron() const
+{
+ // Rec.Particle is a fast charged hadron if it does not look like
+ // a low-purity photon nor low-purity pi0, is low-purity charged
+ // and is high-purity fast
+
+ if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
+ !TestPIDBit(2) && // charged by CPV
+ TestPIDBit(5)) // fast by TOF
+ return kTRUE ;
+ else
+ return kFALSE;
+}
+
+//____________________________________________________________________________
+Bool_t AliPHOSFastRecParticle::IsSlowChargedHadron() const
+{
+ // Rec.Particle is a slow neutral hadron if it does not look like
+ // a low-purity photon nor low-purity pi0, is high-purity neutral
+ // and is not high-purity fast
+
+ if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
+ !TestPIDBit(2) && // charged by CPV
+ !TestPIDBit(5)) // slow by TOF
+ return kTRUE ;
+ else
+ return kFALSE;
+
+}