]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/PartCorrDep/AliAnaParticlePartonCorrelation.cxx
remove ; after include
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaParticlePartonCorrelation.cxx
index d1178973ffe9e547797b4f454288c591115f3125..669427ff6dd9864b866435c5c2c743993c547ff5 100755 (executable)
 //#include "Riostream.h"
 #include "TH2F.h"
 #include "TParticle.h"
+#include "TClass.h"
 
 //---- ANALYSIS system ----
 #include "AliAnaParticlePartonCorrelation.h" 
-#include "AliLog.h"
 #include "AliStack.h"  
 #include "AliAODPWG4ParticleCorrelation.h"
 
@@ -87,8 +87,6 @@ TList *  AliAnaParticlePartonCorrelation::GetCreateOutputObjects()
 {  
   // Create histograms to be saved in output file 
 
-  AliDebug(1,"Init parton histograms");
-
   TList * outputContainer = new TList() ; 
   outputContainer->SetName("ParticlePartonHistos") ; 
   
@@ -149,6 +147,7 @@ TList *  AliAnaParticlePartonCorrelation::GetCreateOutputObjects()
   outputContainer->Add(fhPtRatAwayParton);
   
   return outputContainer;
+
 }
 
 //____________________________________________________________________________
@@ -156,8 +155,10 @@ void AliAnaParticlePartonCorrelation::InitParameters()
 {
   
   //Initialize the parameters of the analysis.
-  SetInputAODName("photons");
-  
+  SetInputAODName("PWG4Particle");
+  SetAODObjArrayName("Partons");  
+  AddToHistogramsName("AnaPartonCorr_");
+
 }
 
 //__________________________________________________________________
@@ -168,6 +169,9 @@ void AliAnaParticlePartonCorrelation::Print(const Option_t * opt) const
   if(! opt)
     return;
   
+  printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
+  AliAnaPartCorrBaseClass::Print(" ");
+
 } 
 
 //__________________________________________________________________
@@ -177,12 +181,19 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD()
   //Add partons to the reference list of the trigger particle
   //Partons are considered those in the first eight possitions in the stack
   //being 0, and 1 the 2 protons, and 6 and 7 the outgoing final partons.
-  if(!GetInputAODBranch())
-       AliFatal(Form("ParticlePartonCorrelation::FillAOD: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data()));    
-  
+  if(!GetInputAODBranch()){
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - No input particles in AOD with name branch < %s > \n",GetInputAODName().Data());
+    abort();   
+  }
+       
+  if(strcmp(GetInputAODBranch()->GetClass()->GetName(), "AliAODPWG4ParticleCorrelation")){
+       printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - Wrong type of AOD object, change AOD class name in input AOD: It should be <AliAODPWG4ParticleCorrelation> and not <%s> \n",GetInputAODBranch()->GetClass()->GetName());
+       abort();
+  }    
+       
   if(GetDebug() > 1){
-    printf("Begin parton correlation analysis, fill AODs \n");
-    printf("In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - Begin fill AODs \n");
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
   }
   
   //Loop on stored AOD particles
@@ -191,46 +202,57 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD()
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     
     AliStack * stack =  GetMCStack() ;
-    if(!stack) AliFatal("No Stack available, STOP");
-    
+    if(!stack){ 
+      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - No Stack available, STOP\n");
+      abort();
+    }
     if(stack->GetNtrack() < 8) {
-      printf("*** small number of particles, not a PYTHIA simulation? ***:  n tracks %d \n", stack->GetNprimary());
+      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() *** small number of particles, not a PYTHIA simulation? ***:  n tracks %d \n", stack->GetNprimary());
       continue ;
     }
     
     //Fill AOD reference only with partons
     TParticle * parton = new TParticle ;
-    
+
+    //Array with reference to partons, initialize
+    TObjArray * objarray  = new TObjArray;
+
     for(Int_t ipr = 0;ipr < 8; ipr ++ ){
       parton = stack->Particle(ipr) ;
-      particle->AddTrack(parton);
-      //parton->Print();
-    }
+         objarray->Add(parton);
+    }//parton loop
+       
+    objarray->SetName(GetAODObjArrayName());
+    if(objarray->GetEntriesFast() > 0) particle->AddObjArray(objarray);
 
   }//Aod branch loop
-
if(GetDebug() > 1) printf("End parton correlation analysis, fill AODs \n");
+  
 if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillAOD() - End fill AODs \n");
 }
+
 //__________________________________________________________________
 void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()  
 {
   //Particle-Parton Correlation Analysis, fill histograms
-  if(!GetInputAODBranch())
-       AliFatal(Form("ParticlePartonCorrelation::FillHistos: No input particles in AOD with name branch < %s > \n",GetInputAODName().Data())); 
-  
+  if(!GetInputAODBranch()){
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - No input particles in AOD with name branch < %s > \n",GetInputAODName().Data());
+    abort();   
+  }
   if(GetDebug() > 1){
-    printf("Begin parton correlation analysis, fill histograms \n");
-    printf("In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Begin parton correlation analysis, fill histograms \n");
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - In particle branch aod entries %d\n", GetInputAODBranch()->GetEntriesFast());
   }
-
+  
   AliStack * stack =  GetMCStack() ;
-  if(!stack) AliFatal("No Stack available, STOP");
-
+  if(!stack) {
+    printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - No Stack available, STOP\n");
+    abort();
+  }
   //Loop on stored AOD particles
   Int_t naod = GetInputAODBranch()->GetEntriesFast();
   TParticle *  mom =new TParticle ;
-
+  
   for(Int_t iaod = 0; iaod < naod ; iaod++){
     AliAODPWG4ParticleCorrelation* particle =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(iaod));
     
@@ -241,7 +263,11 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
     Int_t iparent  = 2000;
     Int_t iawayparent = -1;
 
-    if(!(particle->GetRefTracks()) || (particle->GetRefTracks())->GetEntriesFast() < 7) AliFatal("Reference list with partons not filled, STOP analysis");
+    TObjArray * objarray = particle->GetObjArray(GetAODObjArrayName());
+    if(!(objarray) || (objarray->GetEntriesFast() < 7) ) {
+      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Reference list with partons not filled, STOP analysis\n");
+      abort();
+    }
 
     //Check and get indeces of mother and parton    
     if(imom < 8 ) iparent = imom ;   //mother is already a parton
@@ -257,16 +283,16 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
       }   
     }
     
-    if(GetDebug() > 1) printf("N reference partons %d; labels:  mother %d, parent %d \n", (particle->GetRefTracks())->GetEntriesFast(), imom, iparent);
-
+    if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - N reference partons %d; labels:  mother %d, parent %d \n", objarray->GetEntriesFast(), imom, iparent);
+    
     
     if(iparent < 0 || iparent > 8) { 
-      if(GetDebug() > 0 ) printf("Failed to find appropriate parton, index %d", iparent);
+      if(GetDebug() > 0 ) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Failed to find appropriate parton, index %d", iparent);
       continue ;
     }
 
     //Near parton is the parton that fragmented and created the mother    
-    TParticle * nearParton = (TParticle*) (particle->GetRefTracks())->At(iparent);
+    TParticle * nearParton = (TParticle*) objarray->At(iparent);
     Float_t  ptNearParton    = nearParton->Pt();
     Float_t  phiNearParton   = nearParton->Phi() ;
     Float_t  etaNearParton   = nearParton->Eta() ;
@@ -279,12 +305,12 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
     if(iparent == 7) iawayparent =6;
     else if(iparent == 6) iawayparent =7;
     else{
-      printf("Parent parton is not final state, skip \n");
+      printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - Parent parton is not final state, skip \n");
       continue;
     }
 
     //Away parton is the other final parton.
-    TParticle * awayParton = (TParticle*) (particle->GetRefTracks())->At(iawayparent);
+    TParticle * awayParton = (TParticle*) objarray->At(iawayparent);
     Float_t  ptAwayParton    = awayParton->Pt();
     Float_t  phiAwayParton   = awayParton->Phi() ;
     Float_t  etaAwayParton   = awayParton->Eta() ;
@@ -293,9 +319,8 @@ void  AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms()
     fhDeltaPtAwayParton->Fill(ptTrigg,ptTrigg-ptAwayParton);
     fhPtRatAwayParton->Fill(ptTrigg,ptAwayParton/ptTrigg);
     
   }
 
-  if(GetDebug() > 1) printf("End parton correlation analysis, fill histograms \n");
+  if(GetDebug() > 1) printf("AliAnaParticlePartonCorrelation::MakeAnalysisFillHistograms() - End fill histograms \n");
   
 }