1)AliMCAnalysisUtils: Added protection when label is -1, checking electron ancestry...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Aug 2009 23:08:16 +0000 (23:08 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Aug 2009 23:08:16 +0000 (23:08 +0000)
2)AliCaloTrackReader: Added info prints when getting second input file

PWG4/PartCorrBase/AliCaloTrackReader.cxx
PWG4/PartCorrBase/AliMCAnalysisUtils.cxx

index 5774b6d..817abc9 100755 (executable)
@@ -314,7 +314,14 @@ void AliCaloTrackReader::Init()
        if(fSecondInputFileName!=""){
                if(fDataType == kAOD){
                        TFile * input2   = new TFile(fSecondInputFileName,"read");
+                       printf("AliCaloTrackReader::Init() - Second input file opened: %s, size %d \n", input2->GetName(), (Int_t) input2->GetSize());
                        fSecondInputAODTree = (TTree*) input2->Get("aodTree");
+                       if(fSecondInputAODTree) printf("AliCaloTrackReader::Init() - Second input tree opened: %s, entries %d \n", 
+                                                                                  fSecondInputAODTree->GetName(), (Int_t) fSecondInputAODTree->GetEntries());
+                       else{
+                        printf("AliCaloTrackReader::Init() - Second input tree not available, STOP \n");
+                        abort();
+                       }
                        fSecondInputAODEvent = new AliAODEvent;
                        fSecondInputAODEvent->ReadFromTree(fSecondInputAODTree);
                        if(fSecondInputFirstEvent >= fSecondInputAODTree->GetEntriesFast()){
index 06313e5..ca7905e 100755 (executable)
@@ -334,7 +334,8 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t label, TClonesArray *mcpa
  \r
        \r
        Int_t tag = 0;\r
-       if(label >= 0 && label <  mcparticles->GetEntriesFast()){\r
+    Int_t nprimaries = mcparticles->GetEntriesFast();\r
+       if(label >= 0 && label < nprimaries ){\r
                //Mother\r
                AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);\r
                Int_t mPdg = TMath::Abs(mom->GetPdgCode());\r
@@ -344,7 +345,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t label, TClonesArray *mcpa
                //GrandParent\r
                AliAODMCParticle * parent = new AliAODMCParticle ;\r
                Int_t pPdg = -1;\r
-               if(iParent > 0){\r
+               if(iParent >= 0){\r
                        parent = (AliAODMCParticle *) mcparticles->At(iParent);\r
                        pPdg = TMath::Abs(parent->GetPdgCode());\r
                }\r
@@ -362,7 +363,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t label, TClonesArray *mcpa
                                if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent);\r
                                \r
                                //GrandParent\r
-                               if(iParent > 0){\r
+                               if(iParent >= 0){\r
                                        parent = (AliAODMCParticle *) mcparticles->At(iParent);\r
                                        pPdg = TMath::Abs(parent->GetPdgCode());\r
                                }\r
@@ -431,6 +432,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t label, TClonesArray *mcpa
                                                if((399 < aPdg && aPdg < 500)||(3999 < aPdg && aPdg < 5000)) cAncestor = kTRUE;\r
                                                if(bAncestor && cAncestor) break;\r
                                                iAncestors = ancestors->GetMother();\r
+                                               if(iAncestors ==-1 ) break; // check what happens here.\r
                                                ancestors = (AliAODMCParticle *) mcparticles->At(iAncestors);\r
                                                aPdg = ancestors->GetPdgCode();\r
                                        }//searching for ancestors\r
@@ -472,6 +474,7 @@ Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t label, TClonesArray *mcpa
                                        if(eleFromEvGen && ((399 < aPdg && aPdg < 500)||(3999 < aPdg && aPdg < 5000))) cAncestor = kTRUE;\r
                                        if(bAncestor && cAncestor) break;\r
                                        iAncestors = ancestors->GetMother();\r
+                                       if(iAncestors ==-1 ) break; // check what happens here.\r
                                        ancestors = (AliAODMCParticle *) mcparticles->At(iAncestors);\r
                                        aPdg = ancestors->GetPdgCode();\r
                                }//searching for ancestors\r