Add fast merging option (Diego)
[u/mrichter/AliRoot.git] / PWG3 / dielectron / AliAnalysisTaskDielectronEfficiency.cxx
index ed8e58c..6d669a8 100644 (file)
@@ -220,19 +220,19 @@ void AliAnalysisTaskDielectronEfficiency::FillPlots(AliVEvent *event)
   // Fill histograms
   //
   AliESDEvent *esd=dynamic_cast<AliESDEvent*>(event);
-
+  if (!esd) return;
   Int_t ntrack=esd->GetNumberOfTracks();
 
   // Fetch Stack 
   AliMCEventHandler *mcH = (AliMCEventHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetMCtruthEventHandler());
   if(!mcH) {
-    AliError("No MC handler found\n")
+    AliError("No MC handler found\n");
     return;
   }
   
   AliMCEvent *mcev=mcH->MCEvent();
   if (!mcev){
-    AliError("No MC event found\n")
+    AliError("No MC event found\n");
     return;
   }
   AliStack*  pStack = mcev->Stack();
@@ -284,10 +284,10 @@ void AliAnalysisTaskDielectronEfficiency::FillPlots(AliVEvent *event)
 
       //MC mother
       Int_t idMotherP=pP->GetFirstMother();
-      TParticle *motherP=0;
+//       TParticle *motherP=0;
       //       Int_t pdgMotherP=0;
       if (idMotherP>-1){
-        motherP=pStack->Particle(idMotherP);
+//         motherP=pStack->Particle(idMotherP);
       //       pdgMotherP=motherP->GetPdgCode();
       }
       //===============
@@ -359,8 +359,8 @@ void AliAnalysisTaskDielectronEfficiency::FillPlots(AliVEvent *event)
             fHist->Fill("DataCuts","dndyPt",v.Rapidity(),jpsi.GetPt());
 
             //Additional TRD cuts
-            if ( (trackN->GetStatus()&AliESDtrack::kTRDrefit!=0) &&trackN->GetTRDntrackletsPID()>4 ){
-              if ( (trackP->GetStatus()&AliESDtrack::kTRDrefit!=0) &&trackP->GetTRDntrackletsPID()>4 ){
+            if ( ((trackN->GetStatus()&AliESDtrack::kTRDrefit)!=0) && trackN->GetTRDntrackletsPID()>4 ){
+              if ( ((trackP->GetStatus()&AliESDtrack::kTRDrefit)!=0) && trackP->GetTRDntrackletsPID()>4 ){
                 if (motherN){
                   fHist->Fill("DataTRDCuts","JpsiMCPt",motherN->Pt());
                   fHist->Fill("DataTRDCuts","e+Pt",pP->Pt());
@@ -403,7 +403,7 @@ void AliAnalysisTaskDielectronEfficiency::FillPlots(AliVEvent *event)
 // }
 
 
-void AliAnalysisTaskDielectronEfficiency::FillMCInfo(AliStack *pStack)
+void AliAnalysisTaskDielectronEfficiency::FillMCInfo(AliStack * const pStack)
 {
   //
   // fill pure MC histograms
@@ -411,8 +411,8 @@ void AliAnalysisTaskDielectronEfficiency::FillMCInfo(AliStack *pStack)
   
   TLorentzVector v;
   //Fill MC info
-  for (Int_t ipart=0; ipart<pStack->GetNprimary(); ++ipart){
-    TParticle *part=pStack->Particle(pStack->GetPrimary(ipart));
+  for (Int_t ipart=0; ipart<pStack->GetNtrack(); ++ipart){
+    TParticle *part=pStack->Particle(ipart);
 //     printf("Particle %d\n",part->GetPdgCode());
     if (part->GetPdgCode()!=fIdMCMother || part->GetNDaughters()!=2) continue;
     TParticle *d1=pStack->Particle(part->GetFirstDaughter());