+
+}
+
+//____________________________________________________________________________
+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