]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliReaderESD.cxx
Set IMAGE_PATH to .
[u/mrichter/AliRoot.git] / ANALYSIS / AliReaderESD.cxx
index 28a1346cf5ba5974f703389d3ae6cf98cbc99b43..b6aa2dfe1fb79eb9ae14da4afe15a509ec422d84 100644 (file)
@@ -1,4 +1,20 @@
-#include "AliReaderESD.h"
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
 //____________________________________________________________________
 //////////////////////////////////////////////////////////////////////
 //                                                                  //
 //                                                                  //
 //////////////////////////////////////////////////////////////////////
 
-#include <TPDGCode.h>
-#include <TString.h>
-#include <TObjString.h>
-#include <TTree.h>
 #include <TFile.h>
-#include <TKey.h>
-#include <TParticle.h>
-#include <TH1.h>
-
 #include <TGliteXmlEventlist.h>
+#include <TH1.h>
+#include <TPDGCode.h>
+#include <TParticle.h>
+#include <TString.h>
 
-#include <AliRun.h>
-#include <AliRunLoader.h>
-#include <AliStack.h>
-#include <AliESDtrack.h>
-#include <AliKalmanTrack.h>
-#include <AliESD.h>
-
-#include "AliAnalysis.h"
-#include "AliAODRun.h"
 #include "AliAOD.h"
 #include "AliAODParticle.h"
-#include "AliAODParticleCut.h"
 #include "AliClusterMap.h"
+#include "AliESD.h"
+#include "AliESDtrack.h"
+#include "AliLog.h"
+#include "AliReaderESD.h"
+#include "AliRunLoader.h"
+#include "AliStack.h"
 
 ClassImp(AliReaderESD)
 
@@ -56,7 +64,7 @@ AliReaderESD::AliReaderESD(const Char_t* esdfilename, const Char_t* galfilename)
  fReadMuon(kFALSE),
  fReadPHOS(kFALSE),
  fNTPCClustMin(0),
- fNTPCClustMax(150),
+ fNTPCClustMax(1500),
  fTPCChi2PerClustMin(0.0),
  fTPCChi2PerClustMax(10e5),
  fChi2Min(0.0),
@@ -155,8 +163,7 @@ Int_t AliReaderESD::ReadNext()
 //reads next event from fFile
   //fRunLoader is for reading Kine
   
-  if (AliVAODParticle::GetDebug())
-    Info("ReadNext","Entered");
+  AliDebug(1,"Entered");
     
   if (fEventSim == 0x0)  fEventSim = new AliAOD();
   if (fEventRec == 0x0)  fEventRec = new AliAOD();
@@ -182,10 +189,7 @@ Int_t AliReaderESD::ReadNext()
      AliESD* esd = dynamic_cast<AliESD*>(fFile->Get(esdname));
      if (esd == 0x0)
       {
-        if (AliVAODParticle::GetDebug() > 2 )
-          {
-            Info("ReadNext","Can not find AliESD object named %s",esdname.Data());
-          }
+        AliDebug(3,Form("Can not find AliESD object named %s",esdname.Data()));
         fCurrentDir++;
         delete fFile;//we have to assume there is no more ESD objects in the fFile
         fFile = 0x0;
@@ -228,7 +232,7 @@ Int_t AliReaderESD::ReadESD(AliESD* esd)
 Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
 {
   //****** Tentative particle type "concentrations"
-  static const Double_t concentr[5]={0.05, 0., 0.85, 0.10, 0.05};
+  static const Double_t kConcentr[5]={0.05, 0., 0.85, 0.10, 0.05};
   
   Double_t pidtable[kNSpecies];//array used for reading pid probabilities from ESD track
   Double_t w[kNSpecies];
@@ -255,7 +259,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
   if (fITSTrackPoints)
    {
      Info("ReadESD","Magnetic Field is %f",mf);
-     AliKalmanTrack::SetMagneticField(mf);
+     //AliKalmanTrack::SetMagneticField(mf);
    }
  
   AliStack* stack = 0x0;
@@ -278,10 +282,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
      vertex->GetXYZ(vertexpos);
    }
    
-  if (AliVAODParticle::GetDebug() > 0)
-   {
-     Info("ReadESD","Primary Vertex is (%f,%f,%f)",vertexpos[0],vertexpos[1],vertexpos[2]);
-   }
+  AliDebug(1,Form("Primary Vertex is (%f,%f,%f)",vertexpos[0],vertexpos[1],vertexpos[2]));
    
   Info("ReadESD","Reading Event %d",fCurrentEvent);
 
@@ -299,8 +300,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
      //if (esdtrack->HasVertexParameters() == kFALSE) 
      if ((esdtrack->GetStatus() & AliESDtrack::kITSrefit) == kFALSE)
       {
-        if (AliVAODParticle::GetDebug() > 2) 
-          Info("ReadNext","Particle skipped: Data at vertex not available.");
+        AliDebug(3,Form("Particle skipped: Data at vertex not available."));
         continue;
       }
 
@@ -308,27 +308,24 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
       {
        if ((esdtrack->GetStatus() & AliESDtrack::kTPCin) == kFALSE)
         {
-          if (AliVAODParticle::GetDebug() > 2) 
-            Info("ReadNext","Particle skipped: Was not reconstructed in TPC.");
+          AliDebug(3,"Particle skipped: Was not reconstructed in TPC.");
           continue;
         }
       }     
 
      if ((esdtrack->GetStatus() & AliESDtrack::kESDpid) == kFALSE) 
       {
-        if (AliVAODParticle::GetDebug() > 2) 
-          Info("ReadNext","Particle skipped: PID BIT is not set.");
+        AliDebug(3,"Particle skipped: PID BIT is not set.");
         continue;
       }
 
 
-     Double_t extx;
+     Double_t alpha,extx;
      Double_t extp[5];
-     esdtrack->GetConstrainedExternalParameters(extx,extp);
+     esdtrack->GetConstrainedExternalParameters(alpha,extx,extp);
      if (extp[4] == 0.0)
       {
-        if (AliVAODParticle::GetDebug() > 2) 
-          Info("ReadNext","Track has 0 contrianed curvature -> Probobly parameters never updated. Skipping.");
+        AliDebug(3,"Track has 0 contrianed curvature -> Probobly parameters never updated. Skipping.");
         continue;
       } 
      esdtrack->GetESDpid(pidtable);
@@ -357,8 +354,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
          {
            if(Rejected(p->GetPdgCode())) 
             {
-              if ( AliVAODParticle::GetDebug() > 5 )
-                Info("ReadNext","Simulated Particle PID (%d) did not pass the cut.",p->GetPdgCode());
+              AliDebug(6,Form("Simulated Particle PID (%d) did not pass the cut.",p->GetPdgCode()));
               continue; //check if we are intersted with particles of this type 
             }
          }  
@@ -371,17 +367,16 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
       
      //Here we apply Bayes' formula
      Double_t rc=0.;
-     for (Int_t s=0; s<AliPID::kSPECIES; s++) rc+=concentr[s]*pidtable[s];
+     for (Int_t s=0; s<AliPID::kSPECIES; s++) rc+=kConcentr[s]*pidtable[s];
      if (rc==0.0) 
       {
-        if (AliVAODParticle::GetDebug() > 2) 
-          Info("ReadNext","Particle rejected since total bayessian PID probab. is zero.");
+        AliDebug(3,"Particle rejected since total bayessian PID probab. is zero.");
         continue;
       }
 
-     for (Int_t s=0; s<AliPID::kSPECIES; s++) w[s]=concentr[s]*pidtable[s]/rc;
+     for (Int_t s=0; s<AliPID::kSPECIES; s++) w[s]=kConcentr[s]*pidtable[s]/rc;
 
-     if (AliVAODParticle::GetDebug() > 4)
+     if (AliDebugLevel() > 4)
       { 
         Info("ReadNext","###########################################################################");
         Info("ReadNext","Momentum: %f %f %f",mom[0],mom[1],mom[2]);
@@ -400,7 +395,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
            msg+=")";
          }
         Info("ReadNext","%s",msg.Data());
-      }//if (AliVAODParticle::GetDebug()>4)
+      }//if (AliDebugLevel()>4)
 
       AliTrackPoints* tpts = 0x0;
       if (fNTrackPoints > 0) 
@@ -453,15 +448,13 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
         Float_t pp = w[s];
         if (pp == 0.0) 
          {
-           if ( AliVAODParticle::GetDebug() > 5 )
-             Info("ReadNext","Probability of being PID %d is zero. Continuing.",pdgcode);
+           AliDebug(6,Form("Probability of being PID %d is zero. Continuing.",pdgcode));
            continue;
          }
 
         if(Rejected(pdgcode)) 
          {
-           if ( AliVAODParticle::GetDebug() > 5 )
-             Info("ReadNext","PID (%d) did not pass the cut.",pdgcode);
+           AliDebug(6,Form("PID (%d) did not pass the cut.",pdgcode));
            continue; //check if we are intersted with particles of this type 
          }
 
@@ -482,8 +475,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
         if(Rejected(track))//check if meets all criteria of any of our cuts
                        //if it does not delete it and take next good track
          { 
-           if ( AliVAODParticle::GetDebug() > 4 )
-             Info("ReadNext","Track did not pass the cut");
+           AliDebug(5,"Track did not pass the cut");
            delete track;
            continue;
          }
@@ -508,7 +500,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
         if (particle) fEventSim->AddParticle(particle);
         keeppart = kTRUE;
 
-        if (AliVAODParticle::GetDebug() > 4 )
+        if (AliDebugLevel() > 4 )
          {
            Info("ReadNext","\n\nAdding Particle with incarnation %d",pdgcode);
            track->Print();
@@ -563,7 +555,7 @@ Int_t AliReaderESD::ReadESDCentral(AliESD* esd)
 /**********************************************************/
 Int_t AliReaderESD::ReadESDMuon(AliESD* esd)
 {
-
+  // Reads the muon tracks from the ESD
   Double_t vertexpos[3];//vertex position, assuming no secondary decay
 
   const AliESDVertex* vertex = esd->GetVertex();
@@ -579,18 +571,16 @@ Int_t AliReaderESD::ReadESDMuon(AliESD* esd)
 
  Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ;
 
- if (AliVAODParticle::GetDebug() > 0) {
-   Info("ReadESD","Reading Event %d",fCurrentEvent);
-   Info("ReadESD","Found %d tracks.",nTracks);
- }
+ AliDebug(1,Form("Reading Event %d \nFound %d tracks.",fCurrentEvent,nTracks));
+
  // settings
-  Float_t Chi2Cut = 100.;
-  Float_t PtCutMin = 1.;
-  Float_t PtCutMax = 10000.;
+  Float_t chi2Cut = 100.;
+  Float_t ptCutMin = 1.;
+  Float_t ptCutMax = 10000.;
   Float_t muonMass = 0.105658389;
   Int_t pdgcode = -13;
   Double_t thetaX, thetaY, pYZ;
-  Double_t pxRec1, pyRec1, pzRec1, E1;
+  Double_t pxRec1, pyRec1, pzRec1, e1;
   Int_t charge;
 
   Int_t ntrackhits;
@@ -610,8 +600,8 @@ Int_t AliReaderESD::ReadESDMuon(AliESD* esd)
       pxRec1  = pzRec1 * TMath::Tan(thetaX);
       pyRec1  = pzRec1 * TMath::Tan(thetaY);
       charge = Int_t(TMath::Sign(1.,muonTrack->GetInverseBendingMomentum()));
-      E1 = TMath::Sqrt(muonMass * muonMass + pxRec1 * pxRec1 + pyRec1 * pyRec1 + pzRec1 * pzRec1);
-      fV1.SetPxPyPzE(pxRec1, pyRec1, pzRec1, E1);
+      e1 = TMath::Sqrt(muonMass * muonMass + pxRec1 * pxRec1 + pyRec1 * pyRec1 + pzRec1 * pzRec1);
+      fV1.SetPxPyPzE(pxRec1, pyRec1, pzRec1, e1);
 
       ntrackhits = muonTrack->GetNHit();
       fitfmin    = muonTrack->GetChi2();
@@ -622,9 +612,9 @@ Int_t AliReaderESD::ReadESDMuon(AliESD* esd)
       // chi2 per d.o.f.
       Float_t ch1 =  fitfmin / (2.0 * ntrackhits - 5);
 
-      if ((ch1 < Chi2Cut) && (pt1 > PtCutMin) && (pt1 < PtCutMax)) {
+      if ((ch1 < chi2Cut) && (pt1 > ptCutMin) && (pt1 < ptCutMax)) {
        AliAODParticle* track = new AliAODParticle(pdgcode*charge,1,iTrack, 
-                                                   pxRec1, pyRec1,pzRec1, E1,
+                                                   pxRec1, pyRec1,pzRec1, e1,
                                                    vertexpos[0], vertexpos[1], vertexpos[2], 0.);
         fEventRec->AddParticle(track);
       }