]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliAnaShowerParameters: Put a protection in case of weird case where label of MC...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Sep 2010 17:26:57 +0000 (17:26 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 30 Sep 2010 17:26:57 +0000 (17:26 +0000)
AliMCAnalysisUtils: Check if the parent has index larger or equal than 0 instead of larger than 0 to get the correct parent.

PWG4/PartCorrBase/AliMCAnalysisUtils.cxx
PWG4/PartCorrDep/AliAnaShowerParameter.cxx

index 78891b9e18a0f8af60a7b798ad9e453f77cd4079..f5646c6966b458b947d3f468641c44374e7bf296 100755 (executable)
@@ -149,7 +149,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, const Int_t nl
     TParticle * parent = new TParticle ;
     Int_t pPdg = -1;
     Int_t pStatus =-1;
-    if(iParent > 0){
+    if(iParent >= 0){
       parent = stack->Particle(iParent);
       pPdg = TMath::Abs(parent->GetPdgCode());
       pStatus = parent->GetStatusCode();  
index 1b10d91b3788b99cef96282e2ae3ccb5ac3ada39..2abd88719f23e9ca6c5bd10aa2516fcf331f58f0 100644 (file)
@@ -901,6 +901,11 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
     if(IsDataMC()){
       //Get the tag from AliMCAnalysisUtils for PID
       Int_t tag =ph->GetTag();
+      if ( ph->GetLabel() < 0){
+        if(GetDebug() > 0) 
+          printf("AliAnaShowerParameter::MakeAnalysisFillHistograms() - Label is -1; problem in the MC ESD? ");
+        continue;
+      }
       
       //Check if the tag matches on of the different particle types and fill the corresponding histograms
       if( GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPhoton)&&!(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0))) //kMCPhoton; making sure that this is not a Pi0 cluster (it should not happen).
@@ -909,9 +914,9 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
         fhPhiMCPhoton ->Fill(ecluster,phicluster);
         fhEtaMCPhoton ->Fill(ecluster,etacluster);
         fhLambdaMCPhoton ->Fill(ecluster,lambdaMainCluster,iNumCell);
-        Int_t iCurrent = ph->GetLabel();
         Double_t ePhot;
         //Get the true energy of the photon
+        Int_t iCurrent = ph->GetLabel();
         TParticle* pCurrent = stack->Particle(iCurrent);
         ePhot = pCurrent->Energy();      
         fhPhotTrueE->Fill(ecluster,ePhot,lambdaMainCluster);
@@ -921,7 +926,8 @@ void  AliAnaShowerParameter::MakeAnalysisFillHistograms()
       }//kMCPhoton
       
       if(GetMCAnalysisUtils()->CheckTagBit(tag,AliMCAnalysisUtils::kMCPi0)) //kMCPi0 : single cluster created by 2 photons from the same Pi0 decay
-      {         
+      {     
+        
         //Fill the basic information about the Pi0 cluster
         fhEMCPi0  ->Fill(ecluster);
         fhPhiMCPi0 ->Fill(ecluster,phicluster);