Modifiactions for running Event Mixing on the analysis train
authormiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 27 May 2012 14:16:21 +0000 (14:16 +0000)
committermiweber <miweber@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 27 May 2012 14:16:21 +0000 (14:16 +0000)
PWGCF/EBYE/BalanceFunctions/AliAnalysisTaskEventMixingBF.cxx
PWGCF/EBYE/macros/AddMixingHandler.C

index ecfd846..04dd0b0 100755 (executable)
@@ -427,13 +427,14 @@ void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
        return;\r
       }\r
       \r
-     //AliAODHeader *aodHeaderMain = aodEventMain->GetHeader();\r
-     //AliAODHeader *aodHeaderMix  = aodEventMix->GetHeader();    \r
+     AliAODHeader *aodHeaderMain = aodEventMain->GetHeader();\r
+     AliAODHeader *aodHeaderMix  = aodEventMix->GetHeader();    \r
   \r
 \r
       // event selection done in AliAnalysisTaskSE::Exec() --> this is not used\r
       fHistEventStats->Fill(1); //all events\r
 \r
+      // // this is not needed (checked in mixing handler!)\r
       // Bool_t isSelectedMain = kTRUE;\r
       // Bool_t isSelectedMix = kTRUE;\r
 \r
@@ -444,59 +445,60 @@ void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
       // if(isSelectedMain && isSelectedMix) {\r
       //       fHistEventStats->Fill(2); //triggered events\r
        \r
-      //       //Centrality stuff (centrality in AOD header)\r
-      //       if(fUseCentrality) {\r
-      //         fCentrality = aodHeaderMain->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
+       //Centrality stuff (centrality in AOD header)\r
+       if(fUseCentrality) {\r
+         fCentrality = aodHeaderMain->GetCentralityP()->GetCentralityPercentile(fCentralityEstimator.Data());\r
          \r
-      //         // QA for centrality estimators\r
-      //         fHistCentStats->Fill(0.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0M"));\r
-      //         fHistCentStats->Fill(1.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("FMD"));\r
-      //         fHistCentStats->Fill(2.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TRK"));\r
-      //         fHistCentStats->Fill(3.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKL"));\r
-      //         fHistCentStats->Fill(4.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL0"));\r
-      //         fHistCentStats->Fill(5.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL1"));\r
-      //         fHistCentStats->Fill(6.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));\r
-      //         fHistCentStats->Fill(7.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));\r
-      //         fHistCentStats->Fill(8.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));\r
+         // QA for centrality estimators\r
+         fHistCentStats->Fill(0.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0M"));\r
+         fHistCentStats->Fill(1.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("FMD"));\r
+         fHistCentStats->Fill(2.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TRK"));\r
+         fHistCentStats->Fill(3.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKL"));\r
+         fHistCentStats->Fill(4.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL0"));\r
+         fHistCentStats->Fill(5.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("CL1"));\r
+         fHistCentStats->Fill(6.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("V0MvsFMD"));\r
+         fHistCentStats->Fill(7.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("TKLvsV0M"));\r
+         fHistCentStats->Fill(8.,aodHeaderMain->GetCentralityP()->GetCentralityPercentile("ZEMvsZDC"));\r
          \r
-      //         // take only events inside centrality class\r
-      //         if((fCentrality < fCentralityPercentileMin) || (fCentrality > fCentralityPercentileMax)) \r
-      //           return;\r
+         // take only events inside centrality class\r
+         if((fCentrality < fCentralityPercentileMin) || (fCentrality > fCentralityPercentileMax)) \r
+           return;\r
          \r
-      //         // centrality QA (V0M)\r
-      //         fHistV0M->Fill(aodEventMain->GetVZEROData()->GetMTotV0A(), aodEventMain->GetVZEROData()->GetMTotV0C());\r
+         // centrality QA (V0M)\r
+         fHistV0M->Fill(aodEventMain->GetVZEROData()->GetMTotV0A(), aodEventMain->GetVZEROData()->GetMTotV0C());\r
          \r
-      //         // centrality QA (reference tracks)\r
-      //         fHistRefTracks->Fill(0.,aodHeaderMain->GetRefMultiplicity());\r
-      //         fHistRefTracks->Fill(1.,aodHeaderMain->GetRefMultiplicityPos());\r
-      //         fHistRefTracks->Fill(2.,aodHeaderMain->GetRefMultiplicityNeg());\r
-      //         fHistRefTracks->Fill(3.,aodHeaderMain->GetTPConlyRefMultiplicity());\r
-      //         fHistRefTracks->Fill(4.,aodHeaderMain->GetNumberOfITSClusters(0));\r
-      //         fHistRefTracks->Fill(5.,aodHeaderMain->GetNumberOfITSClusters(1));\r
-      //         fHistRefTracks->Fill(6.,aodHeaderMain->GetNumberOfITSClusters(2));\r
-      //         fHistRefTracks->Fill(7.,aodHeaderMain->GetNumberOfITSClusters(3));\r
-      //         fHistRefTracks->Fill(8.,aodHeaderMain->GetNumberOfITSClusters(4));\r
-      //       }\r
+         // centrality QA (reference tracks)\r
+         fHistRefTracks->Fill(0.,aodHeaderMain->GetRefMultiplicity());\r
+         fHistRefTracks->Fill(1.,aodHeaderMain->GetRefMultiplicityPos());\r
+         fHistRefTracks->Fill(2.,aodHeaderMain->GetRefMultiplicityNeg());\r
+         fHistRefTracks->Fill(3.,aodHeaderMain->GetTPConlyRefMultiplicity());\r
+         fHistRefTracks->Fill(4.,aodHeaderMain->GetNumberOfITSClusters(0));\r
+         fHistRefTracks->Fill(5.,aodHeaderMain->GetNumberOfITSClusters(1));\r
+         fHistRefTracks->Fill(6.,aodHeaderMain->GetNumberOfITSClusters(2));\r
+         fHistRefTracks->Fill(7.,aodHeaderMain->GetNumberOfITSClusters(3));\r
+         fHistRefTracks->Fill(8.,aodHeaderMain->GetNumberOfITSClusters(4));\r
+       }\r
        \r
-      //       const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();\r
-      //       const AliAODVertex *vertexMix  = aodEventMix->GetPrimaryVertex();\r
-      //       \r
-      //       if(vertexMain && vertexMix) {\r
-      //         Double32_t fCovMain[6];\r
-      //         Double32_t fCovMix[6];\r
-      //         vertexMain->GetCovarianceMatrix(fCovMain);\r
-      //         vertexMix->GetCovarianceMatrix(fCovMix);\r
+       // // this is not needed (checked in mixing handler!)\r
+       // const AliAODVertex *vertexMain = aodEventMain->GetPrimaryVertex();\r
+       // const AliAODVertex *vertexMix  = aodEventMix->GetPrimaryVertex();\r
+       \r
+       // if(vertexMain && vertexMix) {\r
+       //   Double32_t fCovMain[6];\r
+       //   Double32_t fCovMix[6];\r
+       //   vertexMain->GetCovarianceMatrix(fCovMain);\r
+       //   vertexMix->GetCovarianceMatrix(fCovMix);\r
          \r
-      //         if(vertexMain->GetNContributors() > 0 && vertexMix->GetNContributors() > 0) {\r
-      //           if(fCovMain[5] != 0 && fCovMix[5] != 0) {\r
-      //             fHistEventStats->Fill(3); //events with a proper vertex\r
-      //             if(TMath::Abs(vertexMain->GetX()) < fVxMax && TMath::Abs(vertexMix->GetX()) < fVxMax ) {\r
-      //               if(TMath::Abs(vertexMain->GetY()) < fVyMax && TMath::Abs(vertexMix->GetY()) < fVyMax) {\r
-      //                 if(TMath::Abs(vertexMain->GetZ()) < fVzMax && TMath::Abs(vertexMix->GetZ()) < fVzMax) {\r
-      //                   fHistEventStats->Fill(4); //analyzed events\r
-      //                   fHistVx->Fill(vertexMain->GetX());\r
-      //                   fHistVy->Fill(vertexMain->GetY());\r
-      //                   fHistVz->Fill(vertexMain->GetZ());\r
+       //   if(vertexMain->GetNContributors() > 0 && vertexMix->GetNContributors() > 0) {\r
+       //     if(fCovMain[5] != 0 && fCovMix[5] != 0) {\r
+       //       fHistEventStats->Fill(3); //events with a proper vertex\r
+       //       if(TMath::Abs(vertexMain->GetX()) < fVxMax && TMath::Abs(vertexMix->GetX()) < fVxMax ) {\r
+       //      if(TMath::Abs(vertexMain->GetY()) < fVyMax && TMath::Abs(vertexMix->GetY()) < fVyMax) {\r
+       //        if(TMath::Abs(vertexMain->GetZ()) < fVzMax && TMath::Abs(vertexMix->GetZ()) < fVzMax) {\r
+       //          fHistEventStats->Fill(4); //analyzed events\r
+       //          fHistVx->Fill(vertexMain->GetX());\r
+       //          fHistVy->Fill(vertexMain->GetY());\r
+       //          fHistVz->Fill(vertexMain->GetZ());\r
 \r
                    // Loop over tracks in main event\r
                    for (Int_t iTracksMain = 0; iTracksMain < aodEventMain->GetNumberOfTracks(); iTracksMain++) {\r
@@ -648,7 +650,7 @@ void AliAnalysisTaskEventMixingBF::UserExecMix(Option_t *)
       //                 }//Vz cut\r
       //               }//Vy cut\r
       //             }//Vx cut\r
-      //           }//proper vertex resolution\r
+      //           }//proper vertexresolution\r
       //         }//proper number of contributors\r
       //       }//vertex object valid\r
       // }//triggered event \r
index 816a21c..218340c 100644 (file)
@@ -7,12 +7,39 @@
 #include <AliVEvent.h>//|
 #endif//|
 
-void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t centStep = 2, AliMultiInputEventHandler* multiInputHandler, Bool_t useMC = kFALSE, Bool_t usePhysSel = kFALSE,TString opts = "")
+void AddMixingHandler(Double_t centMin = 70, Double_t centMax = 80, Double_t centStep = 2, Bool_t bAOD = kTRUE, Bool_t useMC = kFALSE, Bool_t usePhysSel = kFALSE,TString opts = "")
 {
+  
+    AliESDInputHandler *esdInputHandler = 0;
+    AliAODInputHandler *aodInputHandler = 0;
+    AliMCEventHandler  *mcInputHandler  = 0;
+  
+    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+
+    AliMultiInputEventHandler *multiInputHandler = new AliMultiInputEventHandler();
+    mgr->SetInputEventHandler(multiInputHandler);
+    
+    if (!bAOD) {
+      esdInputHandler = new AliESDInputHandler();
+      multiInputHandler->AddInputEventHandler(esdInputHandler);
+      //centralityInputHandler = new AliCentralityInputHandler();
+      //multiInputHandler->AddInputEventHandler(centralityInputHandler);
+      if (bMCtruth) {
+       mcInputHandler = new AliMCEventHandler();
+       multiInputHandler->AddInputEventHandler(mcInputHandler);
+       // Not reading track references
+       mchandler->SetReadTR(kFALSE);
+      }
+    } else if (bAOD) {
+      aodInputHandler = new AliAODInputHandler();
+      multiInputHandler->AddInputEventHandler(aodInputHandler);
+    } else {
+      Printf("Error: Only ESD and AOD input format is supported !!!");
+      return;
+    }
 
    if (!multiInputHandler) return;
 
-   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
    const Int_t bufferSize = 1;
    const Int_t mixNum = 5;
    AliMixInputEventHandler *mixHandler = new AliMixInputEventHandler(bufferSize, mixNum);