]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSFastRecParticle.cxx
Added README to PHOS/macros/Trigger/OCDB, explaining the content.
[u/mrichter/AliRoot.git] / PHOS / AliPHOSFastRecParticle.cxx
index 787c9115ce829aa02c936980daf620011cbede00..6ef6bfbf9b0a7a5fd07e583a557662cac5d89618 100644 (file)
 
 /* $Id$ */
 
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.39  2005/05/28 14:19:04  schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
+
 //_________________________________________________________________________
 //  A  Particle modified by PHOS response and produced by AliPHOSvFast
 //  To become a general class of AliRoot ?    
 // --- Standard library ---
 
 // --- AliRoot header files ---
-
+#include "AliLog.h"
 #include "AliPHOSFastRecParticle.h"
 #include "TPad.h"
 #include "TPaveText.h"
 
-ClassImp(AliPHOSFastRecParticle) 
+ClassImp(AliPHOSFastRecParticle) 
 
 //____________________________________________________________________________
-AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle()
+AliPHOSFastRecParticle::AliPHOSFastRecParticle() :
+  fIndexInList(0),
+  fTof(0.f),
+  fType(0)
 {
   // ctor
-  fType = 0 ; 
+
+  for(Int_t i=0; i<AliPID::kSPECIESCN; i++) {
+    fPID[i] = -111.;
+  }
+  
 }
 
 //____________________________________________________________________________
  AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp)
-   : TParticle(rp)
+   : TParticle(rp),
+     fIndexInList(rp.fIndexInList),//?
+     fTof(rp.fTof),//?
+     fType(rp.fType)
 {
   // copy ctor
-
-  fType        = rp.fType ;
   fPdgCode     = rp.fPdgCode;
   fStatusCode  = rp.fStatusCode;
   fMother[0]   = rp.fMother[0];
@@ -68,17 +84,23 @@ AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle()
   fVt          = rp.fVt;
   fPolarTheta  = rp.fPolarTheta;
   fPolarPhi    = rp.fPolarPhi;
-  fParticlePDG = rp.fParticlePDG; 
+  fParticlePDG = rp.fParticlePDG;
+
+  for(Int_t i=0; i<AliPID::kSPECIESCN; i++) {
+    fPID[i] = rp.fPID[i];
+  }
 }
 
 //____________________________________________________________________________
- AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
+ AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp) :
+   fIndexInList(0),
+   fTof(0.f),
+   fType(0)
 {
   // ctor from a TParticle (crummy?!)
   TParticle & pnoconst = (TParticle &)(pp) ;
   AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
-  fType        = 0  ;
   fPdgCode     = p.fPdgCode;
   fStatusCode  = p.fStatusCode;
   fMother[0]   = p.fMother[0];
@@ -98,9 +120,20 @@ AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle()
   fPolarTheta  = p.fPolarTheta;
   fPolarPhi    = p.fPolarPhi;
   fParticlePDG = p.fParticlePDG; 
-
+  
+  for(Int_t i=0; i<AliPID::kSPECIESCN; i++) {
+    fPID[i] = p.fPID[i];
+  }
+  
 }
 
+//____________________________________________________________________________
+AliPHOSFastRecParticle & AliPHOSFastRecParticle::operator = (const AliPHOSFastRecParticle &)
+{
+  Fatal("operator =", "not implemented");
+  return *this;
+
+}
 //____________________________________________________________________________
 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
 {
@@ -148,8 +181,8 @@ void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t , Int_t )
     clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
     Text_t  line1[40] ;
     Text_t  line2[40] ;
-    sprintf( line1, "PID: %s ", (const char*)Name() ) ;
-    sprintf( line2, "ENERGY: %f ", Energy() ) ;
+    snprintf( line1,40, "PID: %s ", (const char*)Name() ) ;
+    snprintf( line2,40, "ENERGY: %f ", Energy() ) ;
     clustertext ->AddText(line1) ;
     clustertext ->AddText(line2) ;
     clustertext ->Draw("");   
@@ -198,7 +231,8 @@ Bool_t AliPHOSFastRecParticle::IsPi0(TString purity) const
   if      (purity == "low"   ) pi0Like = TestPIDBit(9);
   else if (purity == "medium") pi0Like = TestPIDBit(10);
   else if (purity == "high"  ) pi0Like = TestPIDBit(11);
-  else Error("IsPi0","Wrong purity type: %s",purity.Data());
+  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
@@ -219,7 +253,8 @@ Bool_t AliPHOSFastRecParticle::IsElectron(TString purity) const
   if      (purity == "low"   ) photonLike = TestPIDBit(6);
   else if (purity == "medium") photonLike = TestPIDBit(7);
   else if (purity == "high"  ) photonLike = TestPIDBit(8);
-  else Error("IsElectron","Wrong purity type: %s",purity.Data());
+  else 
+    AliError(Form("Wrong purity type: %s",purity.Data()));
   
   if (photonLike                                   && //  photon by PCA
       (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& //  fast by TOF
@@ -231,7 +266,7 @@ Bool_t AliPHOSFastRecParticle::IsElectron(TString purity) const
 }
 
 //____________________________________________________________________________
-Bool_t AliPHOSFastRecParticle::IsElecCon(TString purity) const
+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"
@@ -241,7 +276,8 @@ Bool_t AliPHOSFastRecParticle::IsElecCon(TString purity) const
   if      (purity == "low"   ) photonLike = TestPIDBit(6);
   else if (purity == "medium") photonLike = TestPIDBit(7);
   else if (purity == "high"  ) photonLike = TestPIDBit(8);
-  else Error("IsElectron","Wrong purity type: %s",purity.Data());
+  else 
+    AliError(Form("Wrong purity type: %s",purity.Data()));
   
   if (photonLike                                   && //  photon by PCA
       (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& //  fast by TOF
@@ -390,18 +426,18 @@ TString AliPHOSFastRecParticle::Name() const
     name = "Photon high purity, ";
 
   if      (IsPi0("low"))
-    name += "Pi0 low purity, ";
+    name = "Pi0 low purity, ";
   else if (IsPi0("medium"))
-    name += "Pi0 medium purity, ";
+    name = "Pi0 medium purity, ";
   else if (IsPi0("high"))
-    name += "Pi0 high purity, ";
+    name = "Pi0 high purity, ";
 
   if      (IsElectron("low"))
-    name += "Electron low purity, ";
+    name = "Electron low purity, ";
   else if (IsElectron("medium"))
-    name += "Electron medium purity, ";
+    name = "Electron medium purity, ";
   else if (IsElectron("high"))
-    name += "Electron high purity, ";
+    name = "Electron high purity, ";
 
   if     (IsHadron()) {
     name = "hadron";
@@ -486,24 +522,35 @@ void AliPHOSFastRecParticle::Paint(Option_t *)
 }
 
 //____________________________________________________________________________
-void AliPHOSFastRecParticle::Print()const
+void AliPHOSFastRecParticle::Print(const Option_t *)const
 {
   // Print the type, energy and momentum of the reconstructed particle
 
-  TString message ; 
-  message  = "\n   PID bits are %d%d%d %d%d%d %d%d%d %d%d%d" ; 
-  message += ", type is \"%s\"\n" ; 
-  message += "   (E,Px,Py,Pz) = (% .3e, % .3e, % .3e, % .3e) GeV\n" ; 
-  Info("Print", message.Data(), 
-       TestPIDBit(0),TestPIDBit(1),
-       TestPIDBit(2),TestPIDBit(3),
-       TestPIDBit(4),TestPIDBit(5),
-       TestPIDBit(6),TestPIDBit(7),
-       TestPIDBit(8),TestPIDBit(9),
-       TestPIDBit(10),TestPIDBit(11),
-       Name().Data(), 
-       Energy(), 
-       Px(), 
-       Py(),
-       Pz() ); 
+  AliInfo(Form("Print  -----------------------------")) ;  
+  printf("PID bits are %d%d%d %d%d%d %d%d%d %d%d%d",  
+        TestPIDBit(0),TestPIDBit(1),
+        TestPIDBit(2),TestPIDBit(3),
+        TestPIDBit(4),TestPIDBit(5),
+        TestPIDBit(6),TestPIDBit(7),
+        TestPIDBit(8),TestPIDBit(9),
+        TestPIDBit(10),TestPIDBit(11)) ; 
+  printf(", type is \"%s\"\n", Name().Data()) ; 
+  printf("  (E,Px,Py,Pz) = (% .3e, % .3e, % .3e, % .3e) GeV\n",     
+        Energy(), 
+        Px(), 
+        Py(),
+        Pz() ) ; 
+  printf("  TOF = %.3e ns\n", ToF() ) ; 
+  printf("  PID weight: \n" ) ;
+  printf("             photon ->              %f\n", fPID[AliPID::kPhoton] ) ; 
+  printf("             electron ->            %f\n", fPID[AliPID::kElectron] ) ; 
+  printf("             Conversion electron -> %f\n", fPID[AliPID::kEleCon] ) ; 
+  printf("             muon ->                %f\n", fPID[AliPID::kMuon] ) ; 
+  printf("             neutral pion ->        %f\n", fPID[AliPID::kPi0] ) ; 
+  printf("             charged pion ->        %f\n", fPID[AliPID::kPion] ) ; 
+  printf("             charged kaon ->        %f\n", fPID[AliPID::kKaon] ) ; 
+  printf("             neutral kaon ->        %f\n", fPID[AliPID::kKaon0] ) ; 
+  printf("             proton ->              %f\n", fPID[AliPID::kProton] ) ; 
+  printf("             neutron ->             %f\n", fPID[AliPID::kNeutron] ) ; 
+
 }