-updates jpsi default QAtask (raul)
authorjbook <jbook>
Thu, 6 Nov 2014 08:44:42 +0000 (09:44 +0100)
committerjbook <jbook@cern.ch>
Thu, 6 Nov 2014 08:44:42 +0000 (09:44 +0100)
-new centrality pPb task (Michael)
-new variables for different Centrality estimators (Michael) and TPC track length (Raul)

PWGDQ/dielectron/AliDielectronVarManager.cxx
PWGDQ/dielectron/AliDielectronVarManager.h
PWGDQ/dielectron/macrosJPSI/AddTask_jpsi_Default.C
PWGDQ/dielectron/macrosJPSI/AddTask_mwinn_JPsiCent.C [new file with mode: 0644]
PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mw_pPbCENT.C [new file with mode: 0644]

index 627eb05..d587a66 100644 (file)
@@ -414,8 +414,11 @@ const char* AliDielectronVarManager::fgkParticleNames[AliDielectronVarManager::k
   {"Nch",                    "N_{ch} #cbar_{#||{#eta}<1.6}",                       ""},
   {"Nch05",                  "N_{ch} #cbar_{#||{#eta}<0.5}",                       ""},
   {"Nch10",                  "N_{ch} #cbar_{#||{#eta}<1.0}",                       ""},
-  {"Centrality",             "centrality",                                         "(%)"},
-  {"CentralitySPD",          "centrality_{SPD}",                                   "(%)"},
+  {"Centrality",             "centrality_{V0M}",                                  "(%)"},
+  {"CentralityV0A",          "centrality_{V0A}",                                  "(%)"},
+  {"CentralityV0C",          "centrality_{V0C}",                                  "(%)"},
+  {"CentralityZNA",          "centrality_{ZNA}",                                  "(%)"},
+  {"CentralitySPD",          "centrality_{SPD}",                                  "(%)"},
   {"TriggerInclONL",         "online trigger bit (inclusive)",                     ""},
   {"TriggerInclOFF",         "offline trigger bit (inclusive)",                    ""},
   {"TriggerExclOFF",         "offline trigger bit (exclusive)",                    ""},
index 4f4e150..d2adae6 100644 (file)
@@ -424,8 +424,11 @@ public:
     kNch05,                  // MC true number of charged particles in |eta|<0.5
     kNch10,                  // MC true number of charged particles in |eta|<1.0
 
-    kCentrality,             // event centrality fraction
-    kCentralitySPD,          // centrality using SPD
+    kCentrality,             // event centrality fraction V0M
+    kCentralityV0A,          // event centrality fraction V0A
+    kCentralityV0C,          // event centrality fraction V0C
+    kCentralityZNA,          // event centrality fraction ZNA
+    kCentralitySPD,          // centrality using SPD (from second layer)
     kTriggerInclONL,         // online trigger bits fired (inclusive)
     kTriggerInclOFF,         // offline trigger bits fired (inclusive)
     kTriggerExclOFF,         // offline only this trigger bit fired (exclusive)
@@ -1943,10 +1946,17 @@ inline void AliDielectronVarManager::FillVarESDEvent(const AliESDEvent *event, D
   // Fill common AliVEvent interface information
   FillVarVEvent(event, values);
 
-  Double_t centralityF=-1; Double_t centralitySPD=-1;
+  Double_t centralityF=-1; 
+  Double_t centralitySPD=-1; 
+  Double_t centralityV0A = -1; 
+  Double_t centralityV0C = -1;
+  Double_t centralityZNA = -1;
   AliCentrality *esdCentrality = const_cast<AliESDEvent*>(event)->GetCentrality();
   if (esdCentrality) centralityF = esdCentrality->GetCentralityPercentile("V0M");
   if (esdCentrality) centralitySPD = esdCentrality->GetCentralityPercentile("CL1");
+  if (esdCentrality) centralityV0A = esdCentrality->GetCentralityPercentile("V0A");
+  if (esdCentrality) centralityV0C = esdCentrality->GetCentralityPercentile("V0C");
+  if (esdCentrality) centralityZNA = esdCentrality->GetCentralityPercentile("ZNA");
   
   // Fill AliESDEvent interface specific information
   const AliESDVertex *primVtx = event->GetPrimaryVertex();
@@ -1955,6 +1965,10 @@ inline void AliDielectronVarManager::FillVarESDEvent(const AliESDEvent *event, D
   values[AliDielectronVarManager::kZRes]       = primVtx->GetZRes();
   values[AliDielectronVarManager::kCentrality] = centralityF;
   values[AliDielectronVarManager::kCentralitySPD] = centralitySPD;
+  values[AliDielectronVarManager::kCentralityV0A] = centralityV0A;
+  values[AliDielectronVarManager::kCentralityV0C] = centralityV0C;
+  values[AliDielectronVarManager::kCentralityZNA] = centralityZNA;
+  
 
   const AliESDVertex *vtxTPC = event->GetPrimaryVertexTPC(); 
   values[AliDielectronVarManager::kNVtxContribTPC] = (vtxTPC ? vtxTPC->GetNContributors() : 0);
@@ -2017,12 +2031,22 @@ inline void AliDielectronVarManager::FillVarAODEvent(const AliAODEvent *event, D
   AliAODHeader *header = dynamic_cast<AliAODHeader*>(event->GetHeader());
   assert(header&&"Not a standard AOD");
 
-  Double_t centralityF=-1; Double_t centralitySPD=-1;
+  Double_t centralityF=-1; 
+  Double_t centralitySPD=-1; 
+  Double_t centralityV0A = -1; 
+  Double_t centralityV0C = -1;
+  Double_t centralityZNA = -1;
   AliCentrality *aodCentrality = header->GetCentralityP();
   if (aodCentrality) centralityF = aodCentrality->GetCentralityPercentile("V0M");
   if (aodCentrality) centralitySPD = aodCentrality->GetCentralityPercentile("CL1");
+  if (aodCentrality) centralityV0A = aodCentrality->GetCentralityPercentile("V0A");
+  if (aodCentrality) centralityV0C = aodCentrality->GetCentralityPercentile("V0C");
+  if (aodCentrality) centralityZNA = aodCentrality->GetCentralityPercentile("ZNA");
   values[AliDielectronVarManager::kCentrality] = centralityF;
   values[AliDielectronVarManager::kCentralitySPD] = centralitySPD;
+  values[AliDielectronVarManager::kCentralityV0A] = centralityV0A;
+  values[AliDielectronVarManager::kCentralityV0C] = centralityV0C;
+  values[AliDielectronVarManager::kCentralityZNA] = centralityZNA;
 
   values[AliDielectronVarManager::kRefMult]        = header->GetRefMultiplicity();        // similar to Ntrk
   values[AliDielectronVarManager::kRefMultTPConly] = header->GetTPConlyRefMultiplicity(); // similar to Nacc
index dbcc093..becfca2 100644 (file)
@@ -4,11 +4,37 @@ void InitCF(AliDielectron* die, Int_t cutDefinition);
 void SetupEventCuts(AliDielectron *die, Int_t cutDefinition);
 void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
 void SetupPairCuts(AliDielectron *die,  Int_t cutDefinition);
+//QAtask
+
+void SetupV0cuts(AliDielectron *die, Int_t cutDefinition);
+void SetupV0Add(AliDielectron *die, Int_t cutDefinition);
+
+/*
+namespace ConfDef {
+       
+       void InitHistograms(AliDielectron *die, Int_t cutDefinition);
+       void InitCF(AliDielectron* die, Int_t cutDefinition);
+       void SetupV0Cuts(AliDielectron *die, Int_t cutDefinition);
+       void SetupV0Add(AliDielectron *die, Int_t cutDefinition);
+       void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
+       void SetupPairCuts(AliDielectron *die, Int_t cutDefinition);
+       void SetEtaCorrection();        
+       enum {kDefault,kHF,kLmee,kDefault_activevolume,kDefault_conversions,kDefault_conversions_wPID};
+}
+*/
 
+enum ConfDef {kDefault,kHF,kLmee,kDefault_activevolume,kDefault_conversions,kDefault_conversions_wPID};
 void SetupMCsignals(AliDielectron *die);
-TVectorD *GetRunNumbers();
+//TVectorD *GetRunNumbers();
+TVectorD *GetRunNumbers() {
+    if (period="LHC10d"){
+    return AliDielectronHelper::MakeArbitraryBinning ("122374,122375,124751,125023,125085,125097,125100,125101,125134,125296,125628,125630,125632,125633,125842,125843,125844,125847,125848,125849,125850,125851,125855,125941,125942,125943,125944,125945,125946,125947,125948,125949,125950,125951,125952,125953,125954,125955,125956,125957,125958,125959,125960,125961,125962,125963,125964,125965,125966,125969,125970,125976,125978,125981,125982,125983,125984,125985,125986,125997,125998,125999,126004,126007,126008,126073,126078,126081,126082,126088,126090,126097,126158,126160,126168,126283,126284,126285,126351,126352,126359,126403,126404,126405,126406,126407,126408,126409,126422,126424,126425,126432");
+     }
+}
+  // increasing order of run array is important
 
-TString names=("default");
+//TString names=("default");
+TString names=("JPsi;kHFe;Lmee;Jpsi_activevolume;Jpsi_conversions;Jpsi_conversions_wPID");
 TObjArray *arrNames=names.Tokenize(";");
 
 const Int_t nDie=arrNames->GetEntries();
@@ -78,7 +104,7 @@ AliAnalysisTask* AddTask_jpsi_Default(TString prod="", Bool_t isMC=kFALSE)
   case k13c: task->SetTriggerMask(AliVEvent::kINT7); break;
   case k13d: task->SetTriggerMask(AliVEvent::kAnyINT); break;
   case k13e: task->SetTriggerMask(AliVEvent::kAnyINT); break;
- case k13f: task->SetTriggerMask(AliVEvent::kAnyINT); break;
+  case k13f: task->SetTriggerMask(AliVEvent::kAnyINT); break;
   }
   mgr->AddTask(task);
 
@@ -152,15 +178,30 @@ AliDielectron* ConfigDefault(Int_t cutDefinition)
   /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv CUTS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
   SetupEventCuts(die,cutDefinition);
   SetupTrackCuts(die,cutDefinition);
+  
+  if (cutDefinition ==ConfDef::kDefault || cutDefinition ==ConfDef::kLmee || cutDefinition ==ConfDef::kDefault_activevolume){
+               SetupV0Cuts(die,cutDefinition);
+       }
+               
+//V0s to have a pure e+e- sample to check the TPC nsigma       
+  if (cutDefinition ==ConfDef::kDefault_conversions || cutDefinition ==ConfDef::kDefault_conversions_wPID){
+               SetupV0add(die,cutDefinition);
+       }
+       
+  if (cutDefinition ==ConfDef::kLmee || cutDefinition ==ConfDef::kDefault_conversions || cutDefinition ==ConfDef::kDefault_conversions_wPID ){
+               die->SetNoPairing();
+       }       
+  
+  //SetupV0Cuts(die,cutDefinition); 
   SetupPairCuts(die,cutDefinition);
 
   /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv MISC vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
   // Monte Carlo Signals
   if (hasMC) SetupMCsignals(die);
   // prefilter settings
-  die->SetPreFilterUnlikeOnly();//  die->SetNoPairing();//  die->SetPreFilterAllSigns();
+  // die->SetPreFilterUnlikeOnly();//  die->SetNoPairing();//  die->SetPreFilterAllSigns();
   // cut QA
-  die->SetCutQA();
+  // die->SetCutQA();
 
   /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv OUTPUT vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
   InitHistograms(die,cutDefinition);
@@ -201,7 +242,138 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
   // Setup the track cuts
   //
 
-  /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv TRACK CUTS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */
+    AliDielectronCutGroup* cuts = new AliDielectronCutGroup("cuts","cuts",AliDielectronCutGroup::kCompAND);
+       die->GetTrackFilter().AddCuts(cuts);
+       
+       //default quality cuts
+       AliDielectronTrackCuts *refit=new AliDielectronTrackCuts("refit","refit");
+       
+       if (cutDefinition==ConfDef::kDefault){
+               refit->SetRequireITSRefit(kTRUE);
+               refit->SetRequireTPCRefit(kTRUE);
+               refit->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
+       }else if(cutDefinition==ConfDef::kHF){
+               refit->SetRequireITSRefit(kTRUE);
+               refit->SetRequireTPCRefit(kTRUE);
+               refit->SetClusterRequirementITS(AliESDtrackCuts::kFirst,AliESDtrackCuts::kBoth);
+       }else if(cutDefinition==ConfDef::kLmee){
+               refit->SetRequireITSRefit(kTRUE);
+               refit->SetRequireTPCRefit(kTRUE);
+               refit->SetClusterRequirementITS(AliESDtrackCuts::kFirst,AliESDtrackCuts::kAny);
+       }else if (cutDefinition ==ConfDef::kDefault_activevolume){
+               refit->SetRequireITSRefit(kTRUE);
+               refit->SetRequireTPCRefit(kTRUE);
+               refit->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
+       }else if (cutDefinition ==ConfDef::kDefault_conversions){
+               refit->SetRequireITSRefit(kTRUE);
+               refit->SetRequireTPCRefit(kTRUE);
+               //    refit->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
+       }else if(cutDefinition ==ConfDef::kDefault_conversions_wPID){
+               refit->SetRequireITSRefit(kTRUE);
+               refit->SetRequireTPCRefit(kTRUE);
+               //  refit->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
+               
+       }
+       cuts->AddCut(refit);
+       
+       
+       //pt and kink mother
+       AliDielectronVarCuts *pt = new AliDielectronVarCuts("ptCut","pt cut");
+       
+       if (cutDefinition==kDefault){
+               pt->AddCut(AliDielectronVarManager::kPt,1.,1.e30);
+               pt->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+               pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);    
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-3.,3.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPio,3.5,1000.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPro,3.,1000.);
+               //rjim NTPCclusters cut
+               pt->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);  
+               pt->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+               //impact parameter
+               pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+               pt->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+       }
+       else if (cutDefinition==kHF) {
+               pt->AddCut(AliDielectronVarManager::kPt,1.,1.e30);
+               pt->AddCut(AliDielectronVarManager::kEta,-0.8,0.8);
+               //to be checked
+               pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-0.5.,3.);
+               if (AliDielectronVarManager::kTOFPIDBit >0.8){
+                       pt->AddCut(AliDielectronVarManager::kTOFnSigmaEle,-3.,3.);
+               }
+               //TPC PID ClusteR
+               pt->AddCut(AliDielectronVarManager::kTPCsignalN,80.,160.);
+               //rjim NTPCcluster cut
+               pt->AddCut(AliDielectronVarManager::kNclsTPC,120.,160.);  
+               pt->AddCut(AliDielectronVarManager::kNFclsTPCfCross,0.6,1.1);    
+               pt->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+               //    pt->AddCut(AliDielectronVarManager::kNClsITS,4.,200); 
+               //rjim 
+               pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+               pt->AddCut(AliDielectronVarManager::kImpactParZ,-2.,2.);  
+       }
+       else if (cutDefinition==kLmee) {
+               pt->AddCut(AliDielectronVarManager::kPt,0.2,1.e30);
+               pt->AddCut(AliDielectronVarManager::kEta,-0.8,0.8);
+               pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-3.,3.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPio,3.,1000.);
+               pt->AddCut(AliDielectronVarManager::kTOFnSigmaEle,-3.,3.); 
+               //rjim Nitsclusters cut
+               //  pt->AddCut(AliDielectronVarManager::kNclsITS,4.,160.);
+               //add ncrossed rows tpc instead cluster instead Ncluster
+               pt->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);
+               pt->AddCut(AliDielectronVarManager::kNFclsTPCfCross,0.8,1.0);    
+               pt->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.); 
+               pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+               pt->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+       }else if(cutDefinition==kDefault_activevolume){
+               pt->AddCut(AliDielectronVarManager::kPt,1.,1.e30);
+               pt->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+               pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-3.,3.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPio,3.5,1000.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPro,3.,1000.);
+               //    pt->AddCut(AliDielectronVarManager::kTPCactvol,120.,200.);
+               // NTPCclusters
+               pt->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);  
+               pt->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+               //impact parameter
+               pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+               pt->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+               //  pt->AddCut(AliDielectronVarManager::kTOFPIDBit,0.8,2.0);
+       }else if(cutDefinition==kDefault_conversions){
+               pt->AddCut(AliDielectronVarManager::kPt,1.,1.e30);
+               pt->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+               pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
+               //    pt->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-3.,3.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPio,3.5,1000.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPro,3.,1000.);
+               pt->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);  
+               pt->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+               pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+               pt->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+       }else if(cutDefinition==kDefault_conversions_wPID){
+               pt->AddCut(AliDielectronVarManager::kPt,1.,1.e30);
+               pt->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+               pt->AddCut(AliDielectronVarManager::kKinkIndex0,0.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaEle,-3.,3.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPio,3.5,1000.);
+               pt->AddCut(AliDielectronVarManager::kTPCnSigmaPro,3.,1000.);
+               pt->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);  
+               pt->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+               pt->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+               pt->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+       }
+       cuts->AddCut(pt);
+       
+       
+       
+       /*
+       
+  // vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv TRACK CUTS vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv /
   AliDielectronVarCuts *varAccCuts   = new AliDielectronVarCuts("acc","acc");
   varAccCuts->AddCut(AliDielectronVarManager::kPt,           0.8, 1e30);
   varAccCuts->AddCut(AliDielectronVarManager::kEta,         -0.9,  0.9);
@@ -248,8 +420,62 @@ void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
   //   AliDielectronTrackCuts *noconv=new AliDielectronTrackCuts("noConv","noConv");
   //   noconv->SetV0DaughterCut(AliPID::kElectron,kTRUE);
   //   cuts->AddCut(noconv);
+
+       cuts->Print();
+}
+void SetupV0Cuts(AliDielectron *die, Int_t cutDefinition)
+{
+       //
+       // Setup the V0 cuts
+       //
+       AliDielectronV0Cuts *gammaV0Cuts = new AliDielectronV0Cuts("IsGamma","IsGamma");
+       gammaV0Cuts->SetPdgCodes(22,11,11);
+       gammaV0Cuts->SetDefaultPID(13); // TPC+-10, TOF+-3 if available
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kCosPointingAngle,TMath::Cos(0.02),1.0, kFALSE);
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kChi2NDF, 0.0,  10.0, kFALSE);//to be checked, if properly filled
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kLegDist, 0.0,   0.25, kFALSE);
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kR, 3.0,  90.0, kFALSE);
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kPsiPair, 0.0,   0.05, kFALSE);
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kM, 0.0,   0.05, kFALSE);
+       // gammaV0Cuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0.0,   0.1, kFALSE);
+       gammaV0Cuts->AddCut(AliDielectronVarManager::kArmPt, 0.0,   0.05, kFALSE);
+       // gammaV0Cuts->AddCut(AliDielectronVarManager::kArmAlpha, -0.35,0.35, kFALSE); // not sure if it works as expected
+       gammaV0Cuts->SetExcludeTracks(kTRUE);//ktrue excludes tracks v0s, 
+       //kfalse 
+       // gammaV0Cuts->Print();
+       //  const Double_t |cutAlphaG| < 0.35; &&  const Double_t cutQTG < 0.05;
+       //  const Double_t |cutAlphaG2|[2] = {0.6, 0.8}; && const Double_t cutQTG2 < 0.04;
+       die->GetTrackFilter().AddCuts(gammaV0Cuts);
+       gammaV0Cuts->Print();   // 
 }
 
+void SetupV0add(AliDielectron *die, Int_t cutDefinition)
+{
+       //
+       // Setup the V0 cuts
+       //
+       AliDielectronV0Cuts *gammaV0Add = new AliDielectronV0Cuts("IsGamma2","IsGamma2");
+       gammaV0Add->SetPdgCodes(22,11,11);
+       gammaV0Add->SetDefaultPID(13); // TPC+-10, TOF+-3 if available
+       gammaV0Add->AddCut(AliDielectronVarManager::kCosPointingAngle,TMath::Cos(0.02),1.0, kFALSE);
+       gammaV0Add->AddCut(AliDielectronVarManager::kChi2NDF, 0.0,  10.0, kFALSE);//to be checked, if properly filled
+       gammaV0Add->AddCut(AliDielectronVarManager::kLegDist, 0.0,   0.25, kFALSE);
+       gammaV0Add->AddCut(AliDielectronVarManager::kR, 3.0,  90.0, kFALSE);
+       gammaV0Add->AddCut(AliDielectronVarManager::kPsiPair, 0.0,   0.05, kFALSE);
+       gammaV0Add->AddCut(AliDielectronVarManager::kM, 0.0,   0.05, kFALSE);
+       // gammaV0Cuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0.0,   0.1, kFALSE);
+       gammaV0Add->AddCut(AliDielectronVarManager::kArmPt, 0.0,   0.05, kFALSE);
+       // gammaV0Cuts->AddCut(AliDielectronVarManager::kArmAlpha, -0.35,0.35, kFALSE); // not sure if it works as expected
+       
+       gammaV0Add->SetExcludeTracks(kFALSE);//ktrue excludes tracks v0s, 
+       
+       //kfalse 
+       // gammaV0Cuts->Print();
+       //  const Double_t |cutAlphaG| < 0.35; &&  const Double_t cutQTG < 0.05;
+       //  const Double_t |cutAlphaG2|[2] = {0.6, 0.8}; && const Double_t cutQTG2 < 0.04;
+       die->GetTrackFilter().AddCuts(gammaV0Add);
+       gammaV0Add->Print();    // 
+}
 //______________________________________________________________________________________
 void SetupPairCuts(AliDielectron *die, Int_t cutDefinition)
 {
@@ -318,17 +544,54 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
   }
 
   //add histograms to Track classes
-  histos->UserHistogram("Track","","",200,0,20.,AliDielectronVarManager::kPt);
   histos->UserHistogram("Track","","",
+                       200,0,20.,AliDielectronVarManager::kPIn);  
+  //general histograms per run number
+  histos->UserHistogram("Track","","",
+                       400,0.2,20.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(100,-10.,10.),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kTPCnSigmaEle);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(100,-10.,10.),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kTPCnSigmaEle);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(100,-10.,10.),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kITSnSigmaEle);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(100,-10.,10.),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kTOFnSigmaEle);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(161,-0.5,161.5),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kNclsTPC);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(300,0.5,300.5),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kNclsTRD);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(150,0.,150.),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+  histos->UserHistogram("Track","","",GetRunNumbers(),AliDielectronHelper::MakeLinBinning(5,-0.5,2.0),
+                       AliDielectronVarManager::kRunNumber,AliDielectronVarManager::kTOFPIDBit);
+  histos->UserHistogram("Track","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
                         400,0.2,20.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
-
+  //  histos->UserHistogram("Track","","",GetRunNumbers(),
+  //           400,0.2,20.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
+  histos->UserHistogram("Track","","",
+                       100,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaEle);
   histos->UserHistogram("Track","","",
                         100,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
   histos->UserHistogram("Track","","",
                         100,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,kTRUE);
   histos->UserHistogram("Track","","",
                         100,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPro,kTRUE);
-
+  histos->UserHistogram("Track","","",
+                       200,0.2,20.,100,-15.,15.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,kTRUE);           
+  histos->UserHistogram("Track","","",
+                       200,0.2,20.,100,0.,1.2,AliDielectronVarManager::kP,AliDielectronVarManager::kTOFbeta,kTRUE);
+  histos->UserHistogram("Track","","",
+                       200,0.2,20.,200,-20.,20.,AliDielectronVarManager::kP,AliDielectronVarManager::kTOFnSigmaEle,kTRUE);    
+  histos->UserHistogram("Track","","",
+                       144,0.0,6.285,100,0.0,200,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCsignal);
+  histos->UserHistogram("Track","","",
+                       40,-1.0,1.0,100,0.0,200,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCsignal);
+  histos->UserHistogram("Track","","",
+                       100,-5,5.,100,-5.,5.,AliDielectronVarManager::kTPCnSigmaEle,AliDielectronVarManager::kITSnSigmaEle);
+  histos->UserHistogram("Track","","",
+                       100,-5,5.,100,-5.,5.,AliDielectronVarManager::kTOFnSigmaEle,AliDielectronVarManager::kTPCnSigmaEle);
   histos->UserHistogram("Track","","",
                         100,-2,2,144,0,6.285,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
   histos->UserHistogram("Track","","",
@@ -339,7 +602,104 @@ void InitHistograms(AliDielectron *die, Int_t cutDefinition)
                         150,-15,15,160,-0.5,159.5,AliDielectronVarManager::kYsignedIn,AliDielectronVarManager::kTPCsignalN);
   histos->UserHistogram("Track","","",
                         1000,0.,0.,AliDielectronVarManager::kKinkIndex0);
-
+       
+  //rjim findable cluster vs pt
+  histos->UserHistogram("Track","","",
+                       200.,0.0.,20.0, 161,-0.5,161.5,AliDielectronVarManager::kPt,AliDielectronVarManager::kNFclsTPCr);
+  //rjim frac find vs pt
+  histos->UserHistogram("Track","","",
+                       200.0,0.0,20.0,160,0,1.1,AliDielectronVarManager::kPt,AliDielectronVarManager::kNFclsTPCrFrac);
+  
+  // histos rjimenez 2nd part
+  //check tofbit
+  
+  histos->UserHistogram("Track","","",5,-0.5,2.0,AliDielectronVarManager::kTOFPIDBit);
+  
+  histos->UserHistogram("Track","","",
+                       3.,-0.5,2.5, 200,0.,20.,AliDielectronVarManager::kTOFPIDBit,AliDielectronVarManager::kPt);
+  
+  histos->UserHistogram("Track","","",
+                       160,-0.5,159.5,AliDielectronVarManager::kNFclsTPCr);
+  histos->UserHistogram("Track","","",
+                       160,0,1.1,AliDielectronVarManager::kNFclsTPCrFrac);
+  
+  //rjimenez nsigma vseta
+  histos->UserHistogram("Track","","",
+                       20,-1.0,1.0,100,-10.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kITSnSigmaEle);
+  
+  histos->UserHistogram("Track","","",
+                       20,-1.0,1.0,100,-10.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle);
+  
+  histos->UserHistogram("Track","","",
+                       20,-1.0,1.0,100,-10.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTOFnSigmaEle); 
+  //rjimenez nsigma vs phi
+  histos->UserHistogram("Track","","",
+                       20,0.0,7.0,100,-10.,10.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kITSnSigmaEle);
+  
+  histos->UserHistogram("Track","","",
+                       20,0.0,7.0,100,-10.,10.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCnSigmaEle);
+  
+  histos->UserHistogram("Track","","",
+                       20,0.0,7.0,100,-10.,10.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTOFnSigmaEle);
+  
+  //for now SPD tracklets but multiplicity should be implemented
+  histos->UserHistogram("Track","","",
+                       100,0.0,100.,100,-10.,10.,AliDielectronVarManager::kNaccTrckltsEsd10Corr,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+  histos->UserHistogram("Track","","",
+                       100,0.0,100.,200,-20.,20.,AliDielectronVarManager::kNaccTrckltsEsd10Corr,AliDielectronVarManager::kTOFnSigmaEle,kTRUE);      
+  //
+  histos->UserHistogram("Track","","",
+                       200,-20,20,160,-0.5,159.5,AliDielectronVarManager::kYsignedIn,AliDielectronVarManager::kTPCsignalN);
+       
+  histos->UserHistogram("Track","","",
+                       200,-20.,20.,100,-10.,10.,AliDielectronVarManager::kYsignedIn,AliDielectronVarManager::kTPCnSigmaEle);
+  
+  histos->UserHistogram("Track","","",
+                       200,-20.,20.,200,0.2,20.,AliDielectronVarManager::kYsignedIn,AliDielectronVarManager::kPIn);
+  histos->UserHistogram("Track","","",
+                       500,-1.,1.,AliDielectronVarManager::kImpactParXY);
+  histos->UserHistogram("Track","","",
+                       600,-3.,3.,AliDielectronVarManager::kImpactParZ);
+  //inner and outer read out TPC clusters
+  histos->UserHistogram("Track","","",
+                       70,0.0,7.0,160.,0.0,160.0,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCclsIRO);
+  histos->UserHistogram("Track","","",
+                       70,0.0,7.0,160.,0.0,160.0,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCclsORO);
+  histos->UserHistogram("Track","","",
+                       10000,0.0,1.0,AliDielectronVarManager::kM);
+  histos->UserHistogram("Track","","",
+                       200,0.0,20.0,10000,0.0,1.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kM);
+  histos->UserHistogram("Track","","",
+                       300,0.,300.,AliDielectronVarManager::kNclsTRD);
+  histos->UserHistogram("Track","","",
+                       200.,0.0.,20.0, 301,-0.5,300.5,AliDielectronVarManager::kPt,AliDielectronVarManager::kNclsTRD);
+  histos->UserHistogram("Track","","",
+                       11,-0.5,10.5.,AliDielectronVarManager::kTRDntracklets);
+  
+  histos->UserHistogram("Track","","",
+                       200.,0.0.,20.0,11,-0.5,10.5,AliDielectronVarManager::kPt,AliDielectronVarManager::kTRDntracklets);
+  
+  histos->UserHistogram("Track","","",
+                       150.,-15.0.,15.0,20,0.,1.,AliDielectronVarManager::kYsignedIn,AliDielectronVarManager::kTRDprobEle);
+  
+  histos->UserHistogram("Track","","",
+                       150.,-15.0,15.0,20,0.,1.,AliDielectronVarManager::kYsignedIn,AliDielectronVarManager::kTRDprobPio);
+  
+  histos->UserHistogram("Track","","",
+                       200.,0.2,20.0,20,0.,1.,AliDielectronVarManager::kP,AliDielectronVarManager::kTRDprob2DEle);
+  
+  histos->UserHistogram("Track","","",
+                       200.,0.2,20.0,20,0.,1.,AliDielectronVarManager::kP,AliDielectronVarManager::kTRDprob2DPio);
+  
+  histos->UserHistogram("Track","","",
+                       8.,-0.5,7.5,AliDielectronVarManager::kTRDpidQuality);
+  
+  histos->UserHistogram("Track","","",
+                       100.,0.0,1.0,AliDielectronVarManager::kTRDpidEffLeg);
+  
+  histos->UserHistogram("Track","","",
+                       20,-1.0,1.0,70,-3.5,3.5,AliDielectronVarManager::kEta,AliDielectronVarManager::kTRDphi);
+  
   histos->UserHistogram("Track","","",500,-1.,1.,AliDielectronVarManager::kImpactParXY);
   histos->UserHistogram("Track","","",600,-3.,3.,AliDielectronVarManager::kImpactParZ);
 
diff --git a/PWGDQ/dielectron/macrosJPSI/AddTask_mwinn_JPsiCent.C b/PWGDQ/dielectron/macrosJPSI/AddTask_mwinn_JPsiCent.C
new file mode 100644 (file)
index 0000000..6ff448f
--- /dev/null
@@ -0,0 +1,109 @@
+AliAnalysisTask *AddTask_mwinn_JPsiCent(){
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    Error("AddTask_jpsi_JPsi", "No analysis manager found.");
+    return 0;
+  }
+
+
+  //Do we have an MC handler?
+  Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
+  
+  //Get the current train configuration
+  TString trainConfig=gSystem->Getenv("CONFIG_FILE");
+  
+  //set config file name
+  //  TString configFile("$TRAIN_ROOT/mwinn_jpsiCorr/ConfigJpsi2eeDataCent_light.C");
+  TString configFile("ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mw_pPbCENT.C");
+  //  TString configFile("$ALICE_ROOT/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mw_pPbcent.C");
+  //TString configFile("$TRAIN_ROOT/jpsi_JPSI/ConfigJpsiStandard.C");
+  if ( trainConfig.Contains("PbPb") ) configFile="$TRAIN_ROOT/jpsi_JPSI/ConfigJpsi2eePbPb.C";
+  
+  //if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
+  //  ::Info("AddTaskJPSI", "Using AOD configuration");
+  //  configFile="$TRAIN_ROOT/util/dielectron/dielectron/macros/ConfigJpsi2eeDataAOD.C";
+  // }
+
+  TString list=gSystem->Getenv("LIST");
+  //create task and add it to the manager
+  AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDieData");
+   if (!hasMC&&(!list.Contains("LHC12h")) ) task->UsePhysicsSelection();//taking out for testing//taken out for AOD
+   task->SetTriggerMask(AliVEvent::kTRD|AliVEvent::kINT7);
+  /*  if (list.Contains("LHC13b"))task->SetTriggerMask(AliVEvent::kINT7); //kINT7?, MB-trigger for MB pPb
+  if (list.Contains("LHC13c"))task->SetTriggerMask(AliVEvent::kINT7); //kINT7?, MB-trigger for MB pPb
+  if (list.Contains("LHC13d"))task->SetTriggerMask(AliVEvent::kTRD); //TRD trigger
+  if (list.Contains("LHC13e"))task->SetTriggerMask(AliVEvent::kTRD); //TRD trigger//only for testing
+  if (list.Contains("LHC11d")) task->SetTriggerMask(AliVEvent::kEMCEJE+AliVEvent::kEMC7+AliVEvent::kEMCEGA);
+  //if (list.Contains("LHC12h")) task->SetTRDtrigger(1+2);*/
+  mgr->AddTask(task);
+
+  
+  //load dielectron configuration file
+  gROOT->LoadMacro(configFile.Data());
+  
+  //add dielectron analysis with different cuts to the task
+  cout << "!!!!!!!!!!!! nDie = " << nDie << endl;
+  for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file
+    AliDielectron *jpsi=ConfigJpsi2ee(i);
+    if (!jpsi) continue;
+    task->AddDielectron(jpsi);
+//    printf("add: %s\n",jpsi->GetName());
+  }
+  
+  //Add event filter
+  AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
+  //********************************
+  //AOD selection not working, because default Vertex in Contructor of AliDielectronEventCuts not available for AODs!!!!!!!
+  //Therefore chose default one for AODs
+  eventCuts->SetVertexType(AliDielectronEventCuts::kVtxAny);
+  //******************
+  eventCuts->SetRequireVertex();//NOTE: all of these cuts can for some reasons not be applied to self-filtered AODs by mwinn in, also true for 2013AODs bug in Dielectron-framework
+  //(list/hera/alice/mwinn/mwinn/train/lists/...)
+  //  eventCuts->SetRequire2013vertexandevent();//taken out for AOD
+  eventCuts->SetMinVtxContributors(1);//taken out for AOD
+  eventCuts->SetVertexZ(-10.,10.);//taken out for AOD
+  //  eventCuts->Print();
+//   eventCuts->SetVertexType(AliDielectronEventCuts::kVtxTracksOrSPD);
+//   eventCuts->SetRequireV0and();
+//   if ( trainConfig=="PbPb" ){
+//     eventCuts->SetCutOnMultipicityITSTPC();
+//   }
+   task->SetEventFilter(eventCuts);
+
+//   task->SetTriggerOnV0AND();
+  if ( trainConfig=="pp" ) task->SetRejectPileup();
+  
+  //create output container
+  AliAnalysisDataContainer *coutput1 =
+    mgr->CreateContainer("jpsi_mwinn_tree",
+                         TTree::Class(),
+                         AliAnalysisManager::kExchangeContainer,
+                         "jpsi_mwinn_default");
+  
+  AliAnalysisDataContainer *cOutputHist1 =
+    mgr->CreateContainer("jpsiAOD_mwinn_QA",
+                         TList::Class(),
+                         AliAnalysisManager::kOutputContainer,
+                         "jpsi_mwinn.root");
+
+  AliAnalysisDataContainer *cOutputHist2 =
+    mgr->CreateContainer("jpsi_mwinn_CF",
+                         TList::Class(),
+                         AliAnalysisManager::kOutputContainer,
+                         "jpsi_mwinn.root");
+  
+  AliAnalysisDataContainer *cOutputHist3 =
+    mgr->CreateContainer("jpsi_mwinn_EventStat",
+                         TH1D::Class(),
+                         AliAnalysisManager::kOutputContainer,
+                         "jpsi_mwinn.root");
+  
+  mgr->ConnectInput(task,  0, mgr->GetCommonInputContainer());
+  mgr->ConnectOutput(task, 0, coutput1 );
+  mgr->ConnectOutput(task, 1, cOutputHist1);
+  mgr->ConnectOutput(task, 2, cOutputHist2);
+  mgr->ConnectOutput(task, 3, cOutputHist3);
+  
+  return task;
+}
diff --git a/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mw_pPbCENT.C b/PWGDQ/dielectron/macrosJPSI/ConfigJpsi_mw_pPbCENT.C
new file mode 100644 (file)
index 0000000..9f4ddf6
--- /dev/null
@@ -0,0 +1,499 @@
+ void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition);
+void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition);
+void InitHistogramsDieleData(AliDielectron *diele, Int_t cutDefinition);
+void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition);
+void SetupV0Cuts(AliDielectron *diele, Int_t cutDefinition);
+
+//blabla
+//blabla
+TString namesDieleData=("basicQ+ITS012+p>.8+nostrongexclusionPID;basicQ+ITS012+p>.8+noexclusionPID+nomassprefilter;basicQ+ITS012+p>.8+noexclusionPID+nomassprefilter_differentmixing");//;basicQ+ITS012+p>.8+noexclusionPID+nomassprefilter+activevolumecut");//;noITS");//;basicQ+ITS012+p>.8+noexclusionPID+nomassprefilterTOFifavail");//;basicQ+SPDany+pt>1+PID;basicQ+ITS012+pt>1+PID;basicQ+SPDany+pt>1+noexclPIDforcontrolpurpose;basicQ+SPDfirst+p>1.+PID;basicQ+SPDfirst+noPIDcuts+nopairing");// basicQ+SPDany+pt>1+p>1.2+PIDrequirementsHFEnoexclPIDforcontrolpurpose;basicQ+SPDany+pt>1+p>1.2+PIDrequirementsHFE+PID;basicQ+SPDany+p>1.+PID");
+//TString namesDieleData=("basicQ+SPDfirst+pt>1+PID");
+
+TObjArray *arrNamesDieleData=namesDieleData.Tokenize(";");
+
+const Int_t nDie=arrNamesDieleData->GetEntries();
+
+AliDielectron* ConfigJpsi2ee(Int_t cutDefinition) 
+{
+  //
+  // Setup the instance of AliDielectron
+  //
+  
+  // create the actual framework object
+  TString name=Form("%02d",cutDefinition);;
+  if (cutDefinition<arrNamesDieleData->GetEntriesFast()){
+    name=arrNamesDieleData->At(cutDefinition)->GetName();
+  }
+  AliDielectron *diele = new AliDielectron(Form("%s",name.Data()),
+                             Form("Track cuts: %s",name.Data()));
+  //setter to enable/disable KF-package
+  diele->SetUseKF(kFALSE);
+  // estimators filename
+  //NOTE: what does this mean?: estimator for pp multiplicity, not needed for instance for my pA-purpose(mwinn 16.1.2012)..
+  //diele->SetEstimatorFilename("$ALICE_ROOT/PWGDQ/dielectron/files/estimators.root");
+  //diele->SetEstimatorFilename("TRAIN_ROOT/mwinn_jpsiCorr/estimators_pPb.root");
+  //  diele->SetEstimatorFilename("$TRAIN_ROOT/mwinn_jpsiCorr/estimators_pPb.root");
+  //cout <<"TRAIN_ROOT" << TRAIN_ROOT << endl;
+  //diele->SetEstimatorFilename("estimators.root");
+  // cut setup
+  SetupTrackCutsDieleData(diele, cutDefinition);
+  SetupPairCutsDieleData(diele, cutDefinition);
+  SetupV0Cuts(diele, cutDefinition);
+  //
+  // histogram setup
+  // only if an AliDielectronHistos object is attached to the
+  // dielelectron framework histograms will be filled
+  //
+    InitHistogramsDieleData(diele, cutDefinition);
+  
+  // the last definition uses no cuts and only the QA histograms should be filled!, now for all cuts
+
+    InitCFDieleData(diele, cutDefinition);//first 2 cut sets in 3rd included
+  //for last CF-Container has to set no pairing condition...
+
+
+    //outcommented at the 26.11.2013
+    //  AliDielectronTrackRotator *rot=new AliDielectronTrackRotator;
+    // rot->SetConeAnglePhi(TMath::Pi());
+    //rot->SetIterations(20);
+    // diele->SetTrackRotator(rot);
+  
+  //outcommented for central train!! 10.09.2013
+  
+    AliDielectronMixingHandler *mix = new AliDielectronMixingHandler;
+    mix->SetMixType(AliDielectronMixingHandler::kAll);
+    if(cutDefinition==3)  mix->AddVariable(AliDielectronVarManager::kZvPrim,"-10., -7.5, -5., -2.5 ,0, 2.5, 5., 7.5 , 10.");
+    mix->AddVariable(AliDielectronVarManager::kNaccTrckltsEsd10, "0.0,10.0, 20.0, 30.0, 40.0, ,50.0, 60.0, 80.0, 10000.0");//0-10,10-20,20-30,30-40,40-50,50-60, 60-80,80
+    //NOTE: other mixing classes probably needed!!!
+    mix->SetDepth(20);//need more jobs in one run in order to satisfy Pool-depth requirements, default settings not enough...
+    diele->SetMixingHandler(mix);
+    
+   //no QA-class by Julian (attention introduced on he 15.06. 2013, will produce crashes with earlier Aliroot versions)
+   diele->SetCutQA();  
+   //   if(cutDefinition==3)diele->SetNoPairing();
+  return diele;
+}
+
+//______________________________________________________________________________________
+void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition /*, Bool_t isAOD*/)
+{
+  //
+  // Setup the track cuts
+  //
+  
+  
+  
+  AliDielectronTrackCuts *ITSrefit=new AliDielectronTrackCuts("ITSrefit","ITSrefit");
+  ITSrefit->SetRequireITSRefit(kTRUE);
+  diele->GetTrackFilter().AddCuts(ITSrefit);
+  
+  AliDielectronTrackCuts *TPCrefit=new AliDielectronTrackCuts("TPCrefit","TPCrefit");
+  TPCrefit->SetRequireTPCRefit(kTRUE);
+  diele->GetTrackFilter().AddCuts(TPCrefit);  
+
+  //Pt cut ----------------------------------------------------------
+  AliDielectronVarCuts *p = new AliDielectronVarCuts("mom","mom");
+  p->AddCut(AliDielectronVarManager::kPt,0.8,1e30);
+  
+  diele->GetTrackFilter().AddCuts(p);
+  
+  
+  AliDielectronVarCuts *kink = new AliDielectronVarCuts("kink","kink");
+  kink->AddCut(AliDielectronVarManager::kKinkIndex0,.000001,1e30,kTRUE);
+  diele->GetTrackFilter().AddCuts(kink);
+  
+
+  AliDielectronVarCuts *sPD = new AliDielectronVarCuts("SPDfirstlayercut","SPDfirstlayercut");
+  sPD->AddCut(AliDielectronVarManager::kITSLayerFirstCls,-0.5,1.5);//change 30.5.2013
+  if(cutDefinition==2){
+     sPD->AddCut(AliDielectronVarManager::kITSLayerFirstCls,-0.5,0.5);//change 30.5.2013
+  }
+  diele->GetTrackFilter().AddCuts(sPD);
+
+
+ // TPC #clusteres cut
+ AliDielectronVarCuts *clustercut = new AliDielectronVarCuts("60cluster","60cluster");
+ clustercut->AddCut(AliDielectronVarManager::kNclsTPC,70.,160.);//ATTENTION: wider in order to vary on CFContainer level
+
+  diele->GetTrackFilter().AddCuts(clustercut);
+  
+  AliDielectronVarCuts *chisquarecut = new AliDielectronVarCuts("chisquarecut4","chisquarecut4");
+  chisquarecut->AddCut(AliDielectronVarManager::kTPCchi2Cl,0.,4.);
+  //cut to be added for comparison with AODs: kITSchi2Cl
+  //NOTE next cut added in order to be compatible with AODs!!!!!
+  // chisquarecut->AddCut(AliDielectronVarManager::kITSchi2Cl,0.,36.);
+  diele->GetTrackFilter().AddCuts(chisquarecut);
+
+  AliDielectronVarCuts *etacut = new AliDielectronVarCuts("etacut","etacut");
+  
+  etacut ->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);//ATTENTION: wider in order to vary on CFContainer level
+  diele->GetTrackFilter().AddCuts(etacut);
+  
+  AliDielectronVarCuts *dcacut = new AliDielectronVarCuts("dcacut","dcacut");
+  //TODO: DCA cuts to be investigated!!! NOTE: why?? (mwinn, 15.01.2013)
+  dcacut->AddCut(AliDielectronVarManager::kImpactParXY,-1.,1.);
+  dcacut->AddCut(AliDielectronVarManager::kImpactParZ,-3.,3.);
+  //for comparison with AODs cut at -2,2 for z-vertex coordinate
+  //NOTE next cut added in order to be compatible with AODs!!!!!
+  //  dcacut->AddCut(AliDielectronVarManager::kImpactParZ,-2.,2.);
+  diele->GetTrackFilter().AddCuts(dcacut);
+  
+    
+  // PID cuts --------------------------------------------------------
+    AliDielectronPID *pid = new AliDielectronPID("PID10","TPC nSigma e>-3, e<4, pion>2.5,proton>2.5");
+    pid->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.);//ATTENTION looser, postprocessing by CFContainer machinerie
+    //problem with variable Cuts for nsigma electron in order to express proton and pion exclusion as electron cuts, and how to integrate them into CFContainer....., if not feasible different dielectron objects...
+    if(cutDefinition!=3) pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.5,3.0,0.,0.,kTRUE);//attention changed at the 19th of may to 2.0 instead of 1.5
+    pid->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-20.,3.0,0.,0.,kTRUE);//attention changed at the 19th of may, instead of 1.5, also important for trending
+   
+
+  if(cutDefinition==3){
+    pid->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-5.0,3.0,0.,0.,kTRUE);
+    AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;
+    esdTrackCuts->SetMinLengthActiveVolumeTPC();
+    diele->GetTrackFilter().AddCuts(esdTrackCuts);
+  }
+  
+  diele->GetTrackFilter().AddCuts(pid);
+
+}
+
+//______________________________________________________________________________________
+void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition /*, Bool_t isAOD*/)
+{
+  //
+  // Setup the pair cuts
+  //
+  // conversion rejection
+  //Double_t gCut = 0.05;             // default
+  Double_t gCut = 0.2;             // default for pPb was 0.100, reduced here for studies, in CFContainer as variable
+  if(cutDefinition==0){//changed at the 11.12.2013!!!!!!!!, default without prefilter cut
+  AliDielectronVarCuts *gammaCut=new AliDielectronVarCuts("prefiltercut 100 MeV","prefiltercut 100 MeV");
+  gammaCut->AddCut(AliDielectronVarManager::kM,0.,gCut);
+  //add to this cut further restrictions via 
+  /*  AliDielectronPairLegCuts* daughtercut = new AliDielectronPairLegCuts("cuts on daughter particles for prefilter","cuts on daughter particles for prefilter");
+  AliDielectronPID *pID_pre = new AliDielectron("PIDcut prefilter", "PIDcut prefilter");
+  //has to invert logic: exclude range
+  //second: has to bet connecction between the daughtercut and the invariant mass cut...
+  pID_pre->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.5,3.5,0.,0.,kTRUE);//attention changed at the 19th of may to 2.0 instead of 1.5
+  pID_pre->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-20.,3.0,0.,0.,kTRUE);
+  pID_pre->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.0,3.0);
+  AliDielectronVarCuts *otherthanPID = new AliDielectronVarCuts("everything except of PID","everything except of PID");
+  otherthanPID->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+  otherthanPID->AddCut(AliDielectronVarManager::kITSLayerFirstCls,-0.5,0.5);
+  otherthanPID->AddCut(AliDielectronVarManager::kPt,1.0,1e30);
+  daughtercut->GetLeg1Filter().AddCuts(pID_pre);
+  daughtercut->GetLeg2Filter().AddCuts(pID_pre);
+  daughtercut->GetLeg1Filter().AddCuts( otherthanPID);
+  daughtercut->GetLeg2Filter().AddCuts( otherthanPID);*/
+  //....some lines missing...
+  //  AliDielectronVarCut
+  diele->GetPairPreFilter().AddCuts(gammaCut);
+  //  diele->GetPairPrefilter().AddCuts(daughtercut);
+  //  diele->SetPreFilterUnlikeOnly();//outcommented 11.06.2013
+  }
+  
+  //Invariant mass and rapidity selection
+  AliDielectronVarCuts *pairCut=new AliDielectronVarCuts("|Y|-cut","|Y|-cut");
+  
+  pairCut->AddCut(AliDielectronVarManager::kY,-.9,.9);
+  
+  diele->GetPairFilter().AddCuts(pairCut);
+}
+//______________________________________________________________________________________
+void SetupV0Cuts(AliDielectron *diele, Int_t cutDefinition)
+{
+  //
+  // Setup the V0 cuts
+  //
+
+  
+  AliDielectronV0Cuts *gammaV0Cuts = new AliDielectronV0Cuts("IsGamma","IsGamma");
+  gammaV0Cuts->SetPdgCodes(22,11,11);
+  gammaV0Cuts->SetDefaultPID(13); // TPC+-10, TOF+-3 if available
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kCosPointingAngle, TMath::Cos(0.02),   1.0, kFALSE);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kChi2NDF,                       0.0,  10.0, kFALSE);//to be checked, if properly filled
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kLegDist,                       0.0,   0.25, kFALSE);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kR,                             3.0,  90.0, kFALSE);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kPsiPair,                       0.0,   0.05, kFALSE);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kM,                             0.0,   0.05, kFALSE);
+  //  gammaV0Cuts->AddCut(AliDielectronVarManager::kOpeningAngle,              0.0,   0.1, kFALSE);
+  gammaV0Cuts->AddCut(AliDielectronVarManager::kArmPt,                         0.0,   0.05, kFALSE);
+  //  gammaV0Cuts->AddCut(AliDielectronVarManager::kArmAlpha,                     -0.35,  0.35, kFALSE); // not sure if it works as expected
+  gammaV0Cuts->SetExcludeTracks(kTRUE);
+  // gammaV0Cuts->Print();
+  
+  //  const Double_t |cutAlphaG| < 0.35; &&  const Double_t cutQTG < 0.05;
+ //  const Double_t |cutAlphaG2|[2] = {0.6, 0.8}; &&  const Double_t cutQTG2 < 0.04;
+
+  diele->GetTrackFilter().AddCuts(gammaV0Cuts);
+}
+
+
+//______________________________________________________________________________________
+
+
+void InitHistogramsDieleData(AliDielectron *diele, Int_t cutDefinition /*, Bool_t isAOD*/)
+{
+  //
+  // Initialise the histograms
+  //
+  
+  //Setup histogram Manager
+  AliDielectronHistos *histos=new AliDielectronHistos(diele->GetName(),diele->GetTitle());
+  
+  //Initialise histogram classes
+  histos->SetReservedWords("Track;Pair");
+  
+  //Track classes
+  //to fill also track info from 2nd event loop until 2
+  for (Int_t i=0; i<2; ++i){
+    histos->AddClass(Form("Track_%s",AliDielectron::TrackClassName(i)));
+  }
+  
+  //Pair classes
+  // to fill also mixed event histograms loop until 10
+  for (Int_t i=0; i<10 /*for mixing until 10*/; ++i){ //
+    histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
+  }
+  
+  //legs from pair
+  for (Int_t i=0; i<3; ++i){
+    histos->AddClass(Form("Track_Legs_%s",AliDielectron::PairClassName(i)));
+  }
+   //track rotation
+   histos->AddClass(Form("Pair_%s",PairClassName(AliDielectron::kEv1PMRot)));
+   histos->AddClass(Form("Track_Legs_%s",PairClassName(AliDielectron::kEv1PMRot)));
+
+
+  
+  
+  //add histograms to event class
+  if (cutDefinition==0) {
+    histos->AddClass("Event");
+    histos->AddClass("Event_noCuts"); 
+    histos->UserHistogram("Event","VtxZ","Vertex Z;Z[cm]",300,-15.,15.,AliDielectronVarManager::kZvPrim);
+   histos->UserHistogram("Event","CentralityV0M","CentralityV0M;centrality_{V0M}(%)",100,0.0,100.0,AliDielectronVarManager::kCentrality);
+   histos->UserHistogram("Event","CentralityCL1","CentralityCL1;centrality_{CL1}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralitySPD);
+   histos->UserHistogram("Event","CentralityV0A","CentralityV0A;centrality_{V0A}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralityV0A);
+   histos->UserHistogram("Event","CentralityV0C","CentralityV0C;centrality_{V0C}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralityV0C);
+   histos->UserHistogram("Event","CentralityZNA","CentralityZNA;centrality_{ZNA}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralityZNA);
+   
+   histos->UserHistogram("Event","CentralityCL1_vs_CentralityZNA","CentralityCL1_vs_CentralityZNA;centrality_{CL1}(%);centrality_{ZNA}(%)",100,0.0,100.0,100.0,0.0,100.0,AliDielectronVarManager::kCentralitySPD,AliDielectronVarManager::kCentralityZNA);
+   histos->UserHistogram("Event","CentralityCL1_vs_CentralityV0A","CentralityCL1_vs_CentralityV0A;centrality_{CL1}(%);centrality_{V0A}(%)",100,0.0,100.0,100.0,0.0,100.0,AliDielectronVarManager::kCentralitySPD,AliDielectronVarManager::kCentralityV0A);
+   histos->UserHistogram("Event","CentralityCL1_vs_CentralityV0A","CentralityCL1_vs_CentralityV0M;centrality_{CL1}(%);centrality_{V0M}(%)",100,0.0,100.0,100.0,0.0,100.0,AliDielectronVarManager::kCentralitySPD,AliDielectronVarManager::kCentrality);
+   histos->UserHistogram("Event","CentralityV0A_vs_AmplitudeV0A","CentralityV0A_vs_AmplitudeV0A",100,0.0,100.0,401,-0.5,400.5,AliDielectronVarManager::kCentralityV0A,AliDielectronVarManager::kMultV0A);
+   histos->UserHistogram("Event","CentralityV0A_vs_AmplitudeV0Aeq","CentralityV0A_vs_AmplitudeV0Aeq",100,0.0,100.0,401,-0.5,400.5,AliDielectronVarManager::kCentralityV0A,AliDielectronVarManager::kEqMultV0A);
+  histos->UserHistogram("Event","AmplitudeV0A_vs_AmplitudeV0Aeq","AmplitudeV0A_vs_AmplitudeV0Aeq",401,-0.5,400.5,401,-0.5,400.5,AliDielectronVarManager::kMultV0A,AliDielectronVarManager::kEqMultV0A);
+   histos->UserHistogram("Event","CentralityCL1_vs_SPDTrckltsCorr10","CentralityCL1_vs_SPDTrckltsCorr10",100,0.0,100.0,200.0,-0.5,200.5,AliDielectronVarManager::kCentralityV0A,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+
+
+    // nAcc
+   //    histos->UserHistogram("Event","NAccRaw","Accepted raw SPD tracklets, |y|<1; nTrackl; #Entries",101,-0.5,100.5, AliDielectronVarManager::kNaccTrckltsEsd10); 
+    //   histos->UserHistogram("Event","NAccCorr","Accepted corr SPD tracklets, |y|<1; nTrackl; #Entries",101,-0.5,100.5, AliDielectronVarManager::kNaccTrckltsEsd10Corr); 
+   // nAcc vs Zvtx
+     histos->UserHistogram("Event","NAccRaw_vs_Zvtx","Accepted raw SPD tracklets vs Z vtx, |y|<1; Zvtx[cm]; nTrackl ",300,-15.,15.,301,-0.5,300.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd10);
+ histos->UserHistogram("Event","NAccRaw_vs_Zvtx_16","Accepted raw SPD tracklets vs Z vtx, |y|<1.6; Zvtx[cm]; nTrackl ",300,-15.,15.,301,-0.5,300.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd16);
+ histos->UserHistogram("Event","NAccRaw_vs_Zvtx_05","Accepted raw SPD tracklets vs Z vtx, |y|<0.5; Zvtx[cm]; nTrackl ",300,-15.,15.,301,-0.5,300.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd05);
+
+  histos->UserHistogram("Event","NAccCorr_vs_Zvtx","Accepted corr. SPD tracklets vs Z vtx, |y|<1; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+ histos->UserHistogram("Event","NAccCorr_vs_Zvtx_16","Accepted corr raw SPD tracklets vs Z vtx, |y|<1.6; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd16Corr);
+ histos->UserHistogram("Event","NAccCorr_vs_Zvtx_05","Accepted corr raw SPD tracklets vs Z vtx, |y|<0.5; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd05Corr);
+ histos->UserHistogram("Event","NAccV0A_vs_Zvtx","V0A amplitude vs. Z vtx, |y|<1; Zvtx[cm]; nTrackl ",300,-15.,15.,401,-0.5,400.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kMultV0A); 
+
+ histos->UserHistogram("Event","NAccTPCITS_vs_Zvtx_05","Accepted raw combined tracks vs Z vtx, |y|<0.5; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsTpcEsd05);
+ histos->UserHistogram("Event","NAccTPCITS_vs_Zvtx","Accepted raw combined tracks vs Z vtx, |y|<1.0; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsTpcEsd10);
+ histos->UserHistogram("Event","NAccTPCITS_vs_Zvtx_16","Accepted raw combined tracks vs Z vtx, |y|<1.6; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsTpcEsd16);
+
+histos->UserHistogram("Event","NAccITSsa_vs_Zvtx_05","Accepted raw ITS tracks +tracklets vs Z vtx, |y|<0.5; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsPureEsd05);
+ histos->UserHistogram("Event","NAccITSsa_vs_Zvtx","Accepted raw ITS tracks +tracklets vs Z vtx, |y|<1.0; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsPureEsd10);
+ histos->UserHistogram("Event","NAccTPCITSsa_vs_Zvtx_16","Accepted raw ITS tracks +tracklets vs Z vtx, |y|<1.6; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsPureEsd16);
+
+
+
+
+ histos->UserHistogram("Event","NAccTPCITSCorr_vs_Zvtx_05","Accepted corr combined tracks vs Z vtx, |y|<0.5; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsTpcEsd05Corr);
+ histos->UserHistogram("Event","NAccTPCITSCorr_vs_Zvtx","Accepted corr combined tracks vs Z vtx, |y|<1.0; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsTpcEsd10Corr);
+ histos->UserHistogram("Event","NAccTPCITSCorr_vs_Zvtx_16","Accepted corr combined tracks vs Z vtx, |y|<1.6; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccItsTpcEsd16Corr);
+
+ histos->UserHistogram("Event","NAccCorr_vs_Zvtx","Accepted corr SPD tracklets vs Z vtx, |y|<1; Zvtx[cm]; nTrackl ",300,-15.,15.,101,-0.5,100.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+
+ histos->UserHistogram("Event","V0ACentrality_vs_NaccTrckltsEsd10Corr","Accepted corr SPD tracklets vs V0A centrality, |y|<1; Zvtx[cm]; nTrackl ",100,0.0,100.,201,-0.5,200.5, AliDielectronVarManager::kCentralityV0A,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+
+   
+ histos->UserHistogram("Event","NaccRaw_vs_NaccCorr","Accepted raw SPD tracklets vs acc. corrected SPD tracklets, |y|<1; nTrackl(raw); nTrackl(corr)",201,-0.5,200.5,201,-0.5,200.5, AliDielectronVarManager::kNaccTrckltsEsd10,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+   histos->UserHistogram("Event","NaccRaw_vs_NaccCorr_05","Accepted raw SPD tracklets vs acc. corrected SPD tracklets, |y|<0.5;  nTrackl(raw); nTrackl(corr)",201,-0.5,200.5,201,-0.5,200.5, AliDielectronVarManager::kNaccTrckltsEsd05,AliDielectronVarManager::kNaccTrckltsEsd05Corr);
+   histos->UserHistogram("Event","NaccRaw_vs_NaccCorr_16","Accepted raw SPD tracklets vs acc. corrected SPD tracklets, |y|<1.6;  nTrackl(raw); nTrackl(corr)",201,-0.5,200.5,201,-0.5,200.5, AliDielectronVarManager::kNaccTrckltsEsd16,AliDielectronVarManager::kNaccTrckltsEsd16Corr);
+    
+
+   // no event cuts 
+   histos->UserHistogram("Event_noCuts","VtxZ","Vertex Z;Z[cm]",300,-15.,15.,AliDielectronVarManager::kZvPrim);
+   histos->UserHistogram("Event_noCuts","CentralityV0M","CentralityV0M;centrality_{V0M}(%)",100,0.0,100.0,AliDielectronVarManager::kCentrality);
+   histos->UserHistogram("Event_noCuts","CentralityCL1","CentralityCL1;centrality_{CL1}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralitySPD);
+   histos->UserHistogram("Event_noCuts","CentralityV0A","CentralityV0A;centrality_{V0A}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralityV0A);
+   histos->UserHistogram("Event_noCuts","CentralityV0C","CentralityV0C;centrality_{V0C}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralityV0C);
+   histos->UserHistogram("Event_noCuts","CentralityZNA","CentralityZNA;centrality_{ZNA}(%)",100,0.0,100.0,AliDielectronVarManager::kCentralityZNA);
+    // nAcc
+   //  histos->UserHistogram("Event_noCuts","NAccRaw","Accepted raw SPD tracklets, |y|<1; nTrackl; #Entries",101,-0.5,100.5, AliDielectronVarManager::kNaccTrckltsEsd10);
+    histos->UserHistogram("Event_noCuts","NAccCorr","Accepted corr SPD tracklets, |y|<1; nTrackl; #Entries",201,-0.5,200.5, AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+   // nAcc vs Zvtx
+   histos->UserHistogram("Event_noCuts","NAccRaw_vs_Zvtx","Accepted raw SPD tracklets vs Z vtx, |y|<1; Zvtx[cm]; nTrackl ",300,-15.,15.,201,-0.5,200.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd10);
+   histos->UserHistogram("Event_noCuts","CentralityCL1_vs_CentralityZNA","CentralityCL1_vs_CentralityZNA;centrality_{CL1}(%);centrality_{ZNA}(%)",200,0.0,200.0,100.0,0.0,100.0,AliDielectronVarManager::kCentralitySPD,AliDielectronVarManager::kCentralityZNA);
+   histos->UserHistogram("Event_noCuts","CentralityCL1_vs_CentralityV0A","CentralityCL1_vs_CentralityV0A;centrality_{CL1}(%);centrality_{V0A}(%)",100,0.0,100.0,100.0,0.0,100.0,AliDielectronVarManager::kCentralitySPD,AliDielectronVarManager::kCentralityV0A);
+  histos->UserHistogram("Event_noCuts","CentralityCL1_vs_CentralityV0A","CentralityCL1_vs_CentralityV0M;centrality_{CL1}(%);centrality_{V0M}(%)",100,0.0,100.0,100.0,0.0,100.0,AliDielectronVarManager::kCentralitySPD,AliDielectronVarManager::kCentrality);
+
+   // }
+
+   //    histos->UserHistogram("Event_noCuts","NAccCorr_vs_Zvtx","Accepted corr SPD tracklets vs Z vtx, |y|<1; Zvtx[cm]; nTrackl ",300,-15.,15.,101,-0.5,100.5, AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kNaccTrckltsEsd10Corr);
+   
+  }
+  
+  //add histograms to Track classes
+  histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",400,0,20.,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Track","TOFPIDBit","TOFPIDBit;TOFPIDBit;#tracks",2,-0.5,1.5,AliDielectronVarManager::kTOFPIDBit);
+  histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTPC);
+  histos->UserHistogram("Track","TPCnClsFracS","fraction of shared Clusters TPC; fraction of shared TPC clusters;#tracks",110,-0.1,1.1,AliDielectronVarManager::kNclsSFracTPC);
+  histos->UserHistogram("Track","TPCsignalN","Number of PID Clusters TPC;TPC PID number clusteres;#tracks",160,-0.5,159.5,AliDielectronVarManager::kTPCsignalN);
+  histos->UserHistogram("Track","TPCchi2Cl","TPCchi2Cl",100,0,8,AliDielectronVarManager::kTPCchi2Cl);
+  histos->UserHistogram("Track","nClsoverfindablecluster","Number of found Clusters TPC over findably ;TPC number cluster over findable;#tracks",160,0.0,1.1,AliDielectronVarManager::kNFclsTPCrFrac);
+  //  histos->UserHistogram("Track","TPCnCls vs PT","Number of Clusters TPC vs PT;TPC number clusteres;pT [GeV/c];#tracks",159,0.,159.,200,0.2,20,AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kPt,kTRUE);
+  //need more histograms: TPC-cluster vs. mult., TPC-cluster vs. z-Vertex-position, TPC nclus found/crossed, average nsigma electron vs mult. , vs. z-vertex-position, number of selected tracks per event pos, neg. number of selected tracks per event (distribution and vs. run number -> could be already done ), number of dielectron pairs vs. phi and vs rapidity, pT vs mass, average pT of pairs vs run, average invariant mass vs run (the later two can be easily done via report)
+  //  histos->UserHistogram("Track","TPCnCls vs PT","Number of Clusters TPC vs PT;TPC number clusteres;pT [GeV/c];#tracks",159,0.,159.,200,0.2,20,AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kPt,kTRUE);
+  histos->UserHistogram("Track","dXY","dXY;dXY [cm];#tracks",500,-1.,1.,AliDielectronVarManager::kImpactParXY);
+  histos->UserHistogram("Track","dZ","dZ;dZ [cm];#tracks",600,-3.,3.,AliDielectronVarManager::kImpactParZ);
+  histos->UserHistogram("Track","Eta_Phi","Eta Phi Map; Eta; Phi;#tracks",
+                        100,-1,1,144,0,6.285,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+
+  histos->UserHistogram("Track","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
+                        200,0.2,20.,100,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
+  histos->UserHistogram("Track","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons;#tracks",
+                        200,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+  histos->UserHistogram("Track","TPCnSigmaPi_P","TPC number of sigmas Kaons;PIN [GeV];TPC number of sigmas Pions;#tracks",
+                        200,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,kTRUE);
+  histos->UserHistogram("Track","TPCnSigmaPro_P","TPC number of sigmas Protons;PIN [GeV];TPC number of sigmas Protons;#tracks",
+                        200,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPro,kTRUE);
+  histos->UserHistogram("Track","TPCnSigmaKao_P","TPC number of sigmas Kaons;PIN [GeV];TPC number of sigmas Kaons;#tracks",
+                        200,0.2,20.,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,kTRUE);
+  //  histos->UserHistogram("Track","TOFbeta_P","TOF beta;P [GeV];TOF beta;#tracks",
+  //                    200,0.2,20.,100,0.,1.,AliDielectronVarManager::kP,AliDielectronVarManager::kTOFnSigmaEle,kTRUE);
+  histos->UserHistogram("Track","TOFnSigmaEle_P","TOF number of sigmas Electrons;P [GeV];TOF number of sigmas Electrons;#tracks",
+                        200,0.2,20.,200,-20.,20.,AliDielectronVarManager::kP,AliDielectronVarManager::kTOFnSigmaEle,kTRUE);
+  // histos->UserHistogram("Track","TRDnCls","Number of Clusters TRD;TRD number clusters;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTRD);
+  //  histos->UserHistogram("Track","TRDntracklets","Number of tracklets TRD;TRD number tracklets;#tracks",7,-0.5,6.5,AliDielectronVarManager::kTRDntracklets);
+  // histos->UserHistogram("Track","TPCnSigmaEle_P_eta","total Momentum[GeV/c] - eta - TPC number of sigmas Electrons;PIN [GeV/c];Eta; TPC number of sigmas Electrons;#tracks",
+  //                   200,0.2,20.,20,-1.0,1,100,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+  //  histos->UserHistogram("Track","TRDprobEle_P","TRD electron prob.;P [GeV];TRD electron prob.;#tracks",
+  //                    200,0.2,20.,100,.0,1.,AliDielectronVarManager::kP,AliDielectronVarManager::kTRDprobEle,kTRUE);
+  // histos->UserHistogram("Track","TRDprobEle2D_P","TRD electron prob. 2D;P [GeV];TRD electron prob. 2D;#tracks",
+  //                    200,0.2,20.,100,.0,1.,AliDielectronVarManager::kP,AliDielectronVarManager::kTRDprob2DEle,kTRUE);
+
+  
+
+
+      
+  //add histograms to Pair classes
+  histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
+                        125,0.,125*.04,AliDielectronVarManager::kM);
+  histos->UserHistogram("Pair","Rapidity","Rapidity;Rapidity;#pairs",
+                        110,-1.1,1.1,AliDielectronVarManager::kY);
+  histos->UserHistogram("Pair","Pt","Pt;Pt;#pairs",
+                        200,0.,20.,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Pair","OpeningAngle","Opening angle;angle",
+                        100,0.,3.15,AliDielectronVarManager::kOpeningAngle);
+  histos->UserHistogram("Pair","OpeningAngletransverse","Opening angle transverse;angle",
+                        100,0.,3.15,AliDielectronVarManager::kDeltaPhi);
+  histos->UserHistogram("Pair","Chi2NDF","chisquareNDF;chisquare/ndf;#pairs",
+                        100,0.,30.,AliDielectronVarManager::kChi2NDF);
+  // histos->UserHistogram("Pair","distanceXY","distancelegsXY;distanceXY[cm];#pairs",
+  //                   100,0.,.0001,AliDielectronVarManager::kLegDistXY);
+  // histos->UserHistogram("Pair","distance","distancelegs;distance[cm];#pairs",
+  //                    100,0.,.0001,AliDielectronVarManager::kLegDist);
+  //  histos->UserHistogram("Pair","pseudoproperdecaylength","pseudoproperdecaylength;pseudoproperdecaylength[cm];#pairs",
+  //                   100,0.,.5,AliDielectronVarManager::kPseudoProperTime);
+  //  histos->UserHistogram("Pair","Armenteros-Podolanski","Armenteros-Podolanski;ArmAlpha;ArmPt[GeV];#tracks",
+  //                   100,-10.0,10.,100,0.,2.,AliDielectronVarManager::kArmAlpha,AliDielectronVarManager::kArmPt,kTRUE);
+  //   histos->UserHistogram("Pair","InvMass_OpeningAngle_Pt","InvMass - OpeningAngle - Pt;Inv. Mass [GeV/c^2]; Opening angle;pTdielectron[GeV/c]",
+  //                   125,0.,125*.04, 100,0.,3.15, 100, 0.,10.,AliDielectronVarManager::kM, AliDielectronVarManager::kOpeningAngle,AliDielectronVarManager::kPt);
+   //  histos->UserHistogram("Pair","InvMass_OpeningAngletransverse_Pt","InvMass - OpeningAngletransverse - Pt;Inv. Mass [GeV/c^2]; Opening angle transverse;pTdielectron[GeV/c]",
+   //                  125,0.,125*.04, 100,0.,3.15, 100, 0.,10.,AliDielectronVarManager::kM, AliDielectronVarManager::kDeltaPhi,AliDielectronVarManager::kPt,kTRUE );
+
+  diele->SetHistogramManager(histos);
+}
+
+
+void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition /*, Bool_t isAOD*/)
+{
+  //
+  // Setupd the CF Manager if needed
+  //
+  
+  AliDielectronCF *cf=new AliDielectronCF(diele->GetName(),diele->GetTitle());
+  
+  //pair variables
+  //  cf->AddVariable(AliDielectronVarManager::kPt,"0.0, 1.0, 1.3, 1.5, 2.0, 3.0, 5.0, 6.0, 7.0, 8.0, 10.0");
+  cf->AddVariable(AliDielectronVarManager::kPt,"0.0, 1.3, 1.5, 4.5, 10.0");
+  //  cf->AddVariable(AliDielectronVarManager::kY,"-0.9,-0.8,-0.5,0.5,0.8,0.9");
+  // cf->AddVariable(AliDielectronVarManager::kDeltaEta,20,0,TMath::Pi());//added for private train to be checked what about memory consumption
+  cf->AddVariable(AliDielectronVarManager::kM,500,0.,500*.01); //20Mev Steps
+  //  cf->AddVariable(AliDielectronVarManager::kPseudoProperTime,150,-0.3,0.3);
+  // cf->AddVariable(AliDielectronVarManager::kPseudoProperTimeErr,600,0.,0.3);
+  cf->AddVariable(AliDielectronVarManager::kPairType,"-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5,10.5");//ATTENTION: to be changed for ME
+  // cf->AddVariable(AliDielectronVarManager::kArmAlpha,"-10.,-5.,-2.,-.1.,0.,1.,2.,5.,10.");
+  //cf->AddVariable(AliDielectronVarManager::kArmPt,"0.0,0.4,0.6,0.8,1.0,1.5,2.0,3.0");
+
+  //leg variables
+  //first three variables new in order to emulate AODs
+  // cf->AddVariable(AliDielectronVarManager::kImpactParZ,"-2.0,2.0", kTRUE);
+  //  cf->AddVariable(AliDielectronVarManager::kITSchi2Cl,"0.,36.,100.0", kTRUE);
+  //  cf->AddVariable(AliDielectronVarManager::kNFclsTPCfCross,"0.0, 0.8, 1.01", kTRUE);  
+  //  cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,"-5.0,-3.0,3.0",kTRUE);
+  //
+  cf->AddVariable(AliDielectronVarManager::kPt,"0.8, 1.0, 1.1",kTRUE);//ATTENTION OMITTED
+    //cf->AddVariable(AliDielectronVarManager::kNclsTPC,"0, 60, 65, 70, 75, 80, 90, 100, 120, 160",kTRUE);
+  // cf->AddVariable(AliDielectronVarManager::kTPCsignalN,"0, 50, 60, 70, 80, 90, 100,120, 160",kTRUE);
+  //  cf->AddVariable(AliDielectronVarManager::kTPCchi2Cl,"0, 0.5, 1., 1.5, 2., 2.5, 3., 3.5, 4.",kTRUE);  
+  // cf->AddVariable(AliDielectronVarManager::kEta, "-0.9, -0.8, -0.5,  0.0, 0.5, 0.8, 0.9", kTRUE);
+  //  cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,"-3.0, -2,  3.",kTRUE);
+  //  cf->AddVariable(AliDielectronVarManager::kTOFnSigmaEle,"-3.0, -2.5,-2,-1.5,-1, -0.5, 3., 4.",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCnSigmaPio,"3.,3.5, 4.",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCnSigmaPro,"3.,3.5, 4.",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kITSLayerFirstCls,2,-0.5,1.5,kTRUE);
+  //  cf->AddVariable(AliDielectronVarManager::kPIn,"0.0,0.7, 0.8, 0.9, 0.95, 1.0, 1.05, 1.1, 1.2,1.5,2.0,3.0,4.0,5.0, 100.0",kTRUE);
+  //event variables
+  //cf->AddVariable(AliDielectronVarManager::kNaccTrcklts,"0.0, 9.0, 17.0, 25.0, 36.0, 55.0, 500.0");
+  cf->AddVariable(AliDielectronVarManager::kNaccTrckltsEsd10Corr, "0.0,0.5,13.5, 18.5, 24.5, 29.5,35.5, 44.5, 59.5,74.5, 99.5, 129.5, 199.50");
+  //  cf->AddVariable(AliDielectronVarManager::kNaccTrckltsEsd16Corr, "0.0,20.8, 28.8, 38.4, 48.0,57.6, 72.0, 112.0, 160.0, 208.0, 320.00"); //to be done in a separate train run...
+  //  cf->AddVariable(AliDielectronVarManager::kNaccTrckltsEsd05Corr, "0.0,6.5, 9.0, 12.0, 15.0,18.0, 22.5, 35.0, 50.0, 65.0, 100.00");//to be done in a separate train run
+  cf->AddVariable(AliDielectronVarManager::kCentrality, "0.0, 20.0, 40.0, 60.0,  100.0");
+  cf->AddVariable(AliDielectronVarManager::kCentralitySPD, "0.0, 20.0, 40.0, 60.0, 80.0, 100.0");
+  cf->AddVariable(AliDielectronVarManager::kCentralityV0A, "0.0, 20.0, 40.0, 60.0, 80.0, 100.0");
+  //cf->AddVariable(AliDielectronVarManager::kMultV0A, "0.0, 80.0, 160.0, 240.0, 320.0, 400.0");//not needed: take correspondence from centrality...
+  cf->AddVariable(AliDielectronVarManager::kCentralityZNA, "0.0, 20.0, 40.0, 60.0, 80.0, 100.0");
+  cf->AddVariable(AliDielectronVarManager::kZvPrim,"-10., -7.5, -5.,2.5,  0., 2.5, 5., 7.5, 10.");
+  //  cf->AddVariable(AliDielectronVarManager::kImpactParXY,"-1.0,-0.6,-0.4,-0.2,0.2,0.4,0.6,1.0");
+
+
+  /*if (!isAOD){
+    Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
+    if (hasMC){
+      cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
+      cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
+      cf->AddVariable(AliDielectronVarManager::kPdgCodeGrandMother,10000,-5000.5,4999.5,kTRUE);
+      }
+  }*/
+
+  
+  //only in this case write MC truth info
+  //if (cutDefinition==0){
+  //  cf->SetStepForMCtruth();
+  //}
+
+  diele->SetCFManagerPair(cf);
+  
+}
+