]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
add debug statements, start adding access to AOD kinematics
authorgconesab <gustavo.conesa.balbastre@cern.ch>
Wed, 31 Dec 2014 15:31:40 +0000 (16:31 +0100)
committergconesab <gustavo.conesa.balbastre@cern.ch>
Wed, 31 Dec 2014 16:45:58 +0000 (17:45 +0100)
PWGGA/CaloTrackCorrelations/AliAnaGeneratorKine.cxx
PWGGA/CaloTrackCorrelations/AliAnaGeneratorKine.h

index 3e5ff63dab59f3b45df6a14c3280b31dffe2e1e7..d55a4cec8dd88bf1d7cff613bf956c668f704b75 100755 (executable)
@@ -40,12 +40,12 @@ AliAnaCaloTrackCorrBaseClass(),
 fTriggerDetector(),  fTriggerDetectorString(),
 fFidCutTrigger(0),
 fMinChargedPt(0),    fMinNeutralPt(0),
-fStack(0),
+fStack(0),           fAODMCparticles(0),
 //fParton2(0),         fParton3(0),
 fParton6(0),         fParton7(0),
 fJet6(),             fJet7(),
 fTrigger(),          fLVTmp(),
-fPtHard(0),
+fNPrimaries(0),      fPtHard(0),
 fhPtHard(0),         fhPtParton(0),    fhPtJet(0),
 fhPtPartonPtHard(0), fhPtJetPtHard(0), fhPtJetPtParton(0)
 {
@@ -102,7 +102,11 @@ Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(Int_t   indexTrig,
   
   AliDebug(1,"Start");
   
-  if( fStack->GetNprimary() < 7 ) return kFALSE ;
+  if( fNPrimaries < 7 )
+  {
+    AliDebug(1,Form("End, not enough partons, n primaries %d",fNPrimaries));
+    return kFALSE ;
+  }
   
   //Get the index of the mother
   iparton =  (fStack->Particle(indexTrig))->GetFirstMother();
@@ -122,7 +126,7 @@ Bool_t  AliAnaGeneratorKine::CorrelateWithPartonOrJet(Int_t   indexTrig,
   
   if(iparton < 6)
   {
-    //printf("This particle is not from hard process - pdg %d, parton index %d\n",partType, iparton);
+    AliDebug(1,Form("This particle is not from hard process - pdg %d, parton index %d\n",partType, iparton));
     return kFALSE; 
   }
   
@@ -465,8 +469,6 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
   
   AliDebug(1,"Start");
   
-  Int_t nPrimary = fStack->GetNprimary();
-  
 //  if( nPrimary > 2 ) fParton2 = fStack->Particle(2) ;
 //  if( nPrimary > 3 ) fParton3 = fStack->Particle(3) ;
   
@@ -474,7 +476,8 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
   Float_t p6eta = -10;
   Float_t p6pt  =  0 ;
   fParton6 = 0x0;
-  if( nPrimary > 6 )
+  
+  if( fNPrimaries > 6 )
   {
     fParton6 = fStack->Particle(6) ;
     p6pt  = fParton6->Pt();
@@ -482,12 +485,12 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
     p6phi = fParton6->Phi();
     if(p6phi < 0) p6phi +=TMath::TwoPi();
   }
-  
+
   Float_t p7phi = -1 ;
   Float_t p7eta = -10;
   Float_t p7pt  =  0 ;
   fParton7 = 0x0;
-  if( nPrimary > 7 )
+  if( fNPrimaries > 7 )
   {
     fParton7 = fStack->Particle(7) ;
     p7pt  = fParton7->Pt();
@@ -495,8 +498,7 @@ void  AliAnaGeneratorKine::GetPartonsAndJets()
     p7phi = fParton7->Phi();
     if(p7phi < 0) p7phi +=TMath::TwoPi();
   }
-
-
+  
   //printf("parton6: pt %2.2f, eta %2.2f, phi %2.2f with pdg %d\n",fParton6->Pt(),fParton6->Eta(),p6phi, fParton6->GetPdgCode());
   //printf("parton7: pt %2.2f, eta %2.2f, phi %2.2f with pdg %d\n",fParton7->Pt(),fParton7->Eta(),p7phi, fParton7->GetPdgCode());
   
@@ -583,7 +585,7 @@ void AliAnaGeneratorKine::GetXE(Int_t   indexTrig,
   if(phiTrig < 0 ) phiTrig += TMath::TwoPi();
   
   //Loop on primaries, start from position 8, no partons
-  for(Int_t ipr = 8; ipr < fStack->GetNprimary(); ipr ++ )
+  for(Int_t ipr = 8; ipr < fNPrimaries; ipr ++ )
   {
     TParticle * particle = fStack->Particle(ipr) ;
     
@@ -615,7 +617,11 @@ void AliAnaGeneratorKine::GetXE(Int_t   indexTrig,
     // ---------------------------------------------------
     // Get the index of the mother, get from what parton
     Int_t ipartonAway =  particle->GetFirstMother();
-    if(ipartonAway < 0) return;
+    if(ipartonAway < 0)
+    {
+      AliDebug(1,"End, no mother index");
+      return;
+    }
     
     TParticle * mother = fStack->Particle(ipartonAway);
     while (ipartonAway > 7) 
@@ -731,7 +737,7 @@ void  AliAnaGeneratorKine::IsLeadingAndIsolated(Int_t indexTrig,
   Float_t sumChPt         = 0;
   
   //Loop on primaries, start from position 8, no partons
-  for(Int_t ipr = 8; ipr < fStack->GetNprimary(); ipr ++ )
+  for(Int_t ipr = 8; ipr < fNPrimaries; ipr ++ )
   {
     if(ipr == indexTrig) continue;
     TParticle * particle = fStack->Particle(ipr) ;
@@ -890,14 +896,37 @@ void  AliAnaGeneratorKine::MakeAnalysisFillHistograms()
   
   AliDebug(1,"Start");
   
-  fStack =  GetMCStack() ;
   
-  if( !fStack )
-    AliFatal("No Stack available, STOP");
+  // Get the ESD MC particles container
+  fStack = 0;
+  if( GetReader()->ReadStack() )
+  {
+    fStack = GetMCStack();
+    if( !fStack )
+    {
+      AliFatal("Stack not available, is the MC handler called? STOP");
+      return;
+    }
+    fNPrimaries = fStack->GetNprimary(); // GetNtrack();
+  }
+  
+  // Get the AOD MC particles container
+  fAODMCparticles = 0;
+  if( GetReader()->ReadAODMCParticles() )
+  {
+    fAODMCparticles = GetReader()->GetAODMCParticles();
+    if( !fAODMCparticles )
+    {
+      AliFatal("Standard MCParticles not available!");
+      return;
+    }
+    fNPrimaries = fAODMCparticles->GetEntriesFast();
+  }
+
 
   GetPartonsAndJets();
   
-  for(Int_t ipr = 0; ipr < fStack->GetNprimary(); ipr ++ )
+  for(Int_t ipr = 0; ipr < fNPrimaries; ipr ++ )
   {
     TParticle * particle = fStack->Particle(ipr) ;
     
index 2b1f3c84d2b2b24c3d05e1f2ea5ca8bcf3333867..d0ff81a73724e1bef40adc228a21c01b1afab435 100755 (executable)
@@ -73,29 +73,31 @@ public:
   
 private:
 
-  Int_t       fTriggerDetector ;            // Detector : EMCAL, PHOS, CTS
-  TString     fTriggerDetectorString ;      // Detector : EMCAL, PHOS, CTS
+  Int_t            fTriggerDetector ;       // Detector : EMCAL, PHOS, CTS
+  TString          fTriggerDetectorString ; // Detector : EMCAL, PHOS, CTS
 
-  AliFiducialCut* fFidCutTrigger;           //! fiducial cut for the trigger detector
+  AliFiducialCut * fFidCutTrigger;          //! fiducial cut for the trigger detector
   
-  Float_t     fMinChargedPt;                //! Minimum energy for charged particles in correlation
-  Float_t     fMinNeutralPt;                //! Minimum energy for neutral particles in correlation
+  Float_t          fMinChargedPt;           //! Minimum energy for charged particles in correlation
+  Float_t          fMinNeutralPt;           //! Minimum energy for neutral particles in correlation
   
-  AliStack  * fStack;                       //! access stack
-  
-//  TParticle * fParton2;                     //! Initial state Parton
-//  TParticle * fParton3;                     //! Initial state Parton
+  AliStack       * fStack;                  //! access ESD stack
+  TClonesArray   * fAODMCparticles ;        //! access AOD stack
+
+//  TParticle      * fParton2;              //! Initial state Parton
+//  TParticle      * fParton3;              //! Initial state Parton
   
-  TParticle * fParton6;                     //! Final state Parton
-  TParticle * fParton7;                     //! Final state Parton
+  TParticle      * fParton6;                //! Final state Parton
+  TParticle      * fParton7;                //! Final state Parton
   
-  TLorentzVector fJet6;                     //! Pythia jet close to parton in position 6
-  TLorentzVector fJet7;                     //! Pythia jet close to parton in position 7
+  TLorentzVector   fJet6;                   //! Pythia jet close to parton in position 6
+  TLorentzVector   fJet7;                   //! Pythia jet close to parton in position 7
 
-  TLorentzVector fTrigger;                  //! Trigger momentum, avoid generating TLorentzVectors per event
-  TLorentzVector fLVTmp;                    //! momentum, avoid generating TLorentzVectors per event
+  TLorentzVector   fTrigger;                //! Trigger momentum, avoid generating TLorentzVectors per event
+  TLorentzVector   fLVTmp;                  //! momentum, avoid generating TLorentzVectors per event
   
-  Float_t     fPtHard;                      //! Generated pT hard
+  Int_t            fNPrimaries;             //! N primaries
+  Float_t          fPtHard;                 //! Generated pT hard
   
   // Histograms
   
@@ -152,7 +154,7 @@ private:
   AliAnaGeneratorKine              (const AliAnaGeneratorKine & gk) ; // cpy ctor
   AliAnaGeneratorKine & operator = (const AliAnaGeneratorKine & gk) ; // cpy assignment
   
-  ClassDef(AliAnaGeneratorKine,5)
+  ClassDef(AliAnaGeneratorKine,6)
   
 } ;