updates for Markus
authorcbaumann <cbaumann@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 24 May 2013 00:07:12 +0000 (00:07 +0000)
committercbaumann <cbaumann@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 24 May 2013 00:07:12 +0000 (00:07 +0000)
PWGDQ/dielectron/macrosLMEE/AddTask_mkoehler_CCbarMC.C
PWGDQ/dielectron/macrosLMEE/Config_mk_CCbarPbPb.C
PWGDQ/dielectron/macrosLMEE/Config_mkoehler_CCbarMC.C

index 0b07d2d..9a76857 100644 (file)
@@ -1,87 +1,68 @@
 
 
-AliAnalysisTask *AddTask_mkoehler_CCbarMC(){
+
+AliAnalysisTask *AddTask_mkoehler_CCbarMC(Bool_t hasMC_aod = kFALSE){
   //get the current analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-    Error("AddTask_mkoehler_CCbarMC", "No analysis manager found.");
-    return 0;
+    ::Error("AddTask_mkoehler_CCbar", "No analysis manager found.");
+    return NULL;
   }
-
   if (!mgr->GetInputEventHandler()) {
-    ::Error("AddTask_mkoehler_CCbarMC", "This task requires an input event handler");
+    ::Error("AddTask_mkoehler_CCbar", "This task requires an input event handler");
     return NULL;
   }
 
-TString configFile("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/Config_mkoehler_CCbarMC.C");
-//TString configFile("Config_mkoehler_CCbarMC.C");
-
-
-  Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
-  Bool_t isAOD=mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class();
+  //Do we have an MC handler?
+  Bool_t hasMC=(mgr->GetMCtruthEventHandler()!=0x0);
+  
+  TString configFile("Config_mkoehler_CCbarMC.C");
+  Bool_t isAOD=0;
 
   //create task and add it to the manager
-  AliAnalysisTaskMultiDielectron *task = new AliAnalysisTaskMultiDielectron("MultiDie");
-  if (!hasMC) return ;
-
-
-
-  TString checkconfig="$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/Config_mkoehler_CCbarMC";
-//  TString checkconfig="ConfigCCbar_mkoehler_CCbarMC";
+  AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDie");
+  mgr->AddTask(task);
+  
+  //load dielectron configuration file
+  TString checkconfig="Config_mkoehler_CCbarMC";
   if (!gROOT->GetListOfGlobalFunctions()->FindObject(checkconfig.Data()))
     gROOT->LoadMacro(configFile.Data());
-
+  
+  
+  
+  
+  
+    //Add event filter
   AliDielectronEventCuts *eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
   eventCuts->SetRequireVertex();
   eventCuts->SetMinVtxContributors(1);
   eventCuts->SetVertexZ(-10.,10.);
   task->SetEventFilter(eventCuts);
-
-//  task->SetRejectPileup();
-
-  mgr->AddTask(task);
   
-  //load dielectron configuration file
-//  gROOT->LoadMacro("Config_mkoehler_CCbarMC.C");
-//gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/Config_mkoehler_CCbarMC.C");
-
+  
   //add dielectron analysis with different cuts to the task
-
   for (Int_t i=0; i<nDie; ++i){ //nDie defined in config file
-    AliDielectron *diel_lowMC = Config_mkoehler_CCbarMC(i,isAOD);
-    task->AddDielectron(diel_lowMC);
-
+    AliDielectron *jpsi=Config_mkoehler_CCbarMC(i,isAOD);
+    task->AddDielectron(jpsi);
   }
-  
 
-  //create output container
-  AliAnalysisDataContainer *coutput1 =
-    mgr->CreateContainer("tree_lowmassMC",
-                         TTree::Class(),
-                         AliAnalysisManager::kExchangeContainer,
-                         "default");
+  //----------------------
+  //create data containers
+  //----------------------
   
   AliAnalysisDataContainer *cOutputHist1 =
-    mgr->CreateContainer("Histos_diel_lowmassMC",
-                         TList::Class(),
-                         AliAnalysisManager::kOutputContainer,
+    mgr->CreateContainer("mkoehler_CCbarMC_QA", TList::Class(), AliAnalysisManager::kOutputContainer,
                          "LMEEoutput.root");
-
+  
   AliAnalysisDataContainer *cOutputHist2 =
-    mgr->CreateContainer("CF_diel_lowmassMC",
-                         TList::Class(),
-                         AliAnalysisManager::kOutputContainer,
+    mgr->CreateContainer("mkoehler_CCbarMC_CF", TList::Class(), AliAnalysisManager::kOutputContainer,
                          "LMEEoutput.root");
-  
 
   AliAnalysisDataContainer *cOutputHist3 =
-    mgr->CreateContainer("mkoehler_lowmassMC_EventStat",
-                         TH1D::Class(),
-                         AliAnalysisManager::kOutputContainer,
-                         "LMEEoutput.root");
-
+    mgr->CreateContainer("mkoehler_CCbarMC_EventStat", TH1D::Class(), AliAnalysisManager::kOutputContainer,
+                        "LMEEoutput.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);
index 0ae484f..57dd1f6 100644 (file)
@@ -68,8 +68,7 @@ AliDielectron* Config_mk_CCbarPbPb(Int_t cutDefinition, Bool_t isAOD=kFALSE)
 
 
       AliDielectronMixingHandler *mix=new AliDielectronMixingHandler;
-      mix->AddVariable(AliDielectronVarManager::kZvPrim, "-10,-9.5,-9,-8.5,-8,-7.5,-7,-6,-4,-2,0,2,4,6,7,7.5,8,8.5,9,9.5,10");
-//      mix->AddVariable(AliDielectronVarManager::kCentrality, "0,2.5,5,7.5,10,12.5,15,17.5,20,25,30,35,40,50,60,70,80");
+      mix->AddVariable(AliDielectronVarManager::kZvPrim, 10,-10.,10.);
       mix->AddVariable(AliDielectronVarManager::kCentrality, "0,6,12,17,23,27,33,39,47,57,90");
       if(cutDefinition==1)mix->AddVariable(AliDielectronVarManager::kV0ArpH2,10,-1.571,1.571);
       mix->SetMixType(AliDielectronMixingHandler::kAll);
@@ -128,10 +127,8 @@ void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t i
   pt->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
   pt->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
   pt->AddCut(AliDielectronVarManager::AliDielectronVarManager::kTPCnSigmaEle,-2,3.);  
-  
-  if(cutDefinition >=0){
   pt->AddCut(AliDielectronVarManager::kNclsTPC,80.,160.);
-  }
+
 
   diele->GetTrackFilter().AddCuts(pt);
 }
@@ -144,7 +141,7 @@ void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t is
   //
 
 AliDielectronVarCuts *mycut = new AliDielectronVarCuts("ptCutEMCAL","cut for EMCal");
-mycut->AddCut(AliDielectronVarManager::kEMCALE,7.5,100.);
+mycut->AddCut(AliDielectronVarManager::kEMCALE,5.,100.);
 mycut->AddCut(AliDielectronVarManager::kEMCALEoverP,0.75,1.25);
 AliDielectronPairLegCuts *varpair=new AliDielectronPairLegCuts();
 varpair->GetLeg1Filter().AddCuts(mycut);
@@ -285,7 +282,7 @@ void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
   AliDielectronCF *cf=new AliDielectronCF(diele->GetName(),diele->GetTitle());
   
   //pair variables
-  cf->AddVariable(AliDielectronVarManager::kPt,"0., 2., 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 20.0");
+  cf->AddVariable(AliDielectronVarManager::kPt,"0., 2., 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 20.0,25.0,30.0,40.0,50.0");
   cf->AddVariable(AliDielectronVarManager::kM,750,0.,15.);
   cf->AddVariable(AliDielectronVarManager::kPairType,12,0,12);
 //  cf->AddVariable(AliDielectronVarManager::kOpeningAngle,"0.,0.1,0.2,0.4,0.6,0.8,1.0,2.0,3.14");
@@ -294,13 +291,13 @@ void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
   cf->AddVariable(AliDielectronVarManager::kPt,"1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2., 3., 5., 10., 15., 20., 30., 40., 50.",kTRUE);
 //   cf->AddVariable(AliDielectronVarManager::kP,"0.0, 1.0, 1.2, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 5.0, 10.0, 100.0",kTRUE);
   cf->AddVariable(AliDielectronVarManager::kNclsTPC,"80, 85, 90, 95, 100, 110, 120, 160",kTRUE);
-//  cf->AddVariable(AliDielectronVarManager::kEta,"-5.0,-1.0,-0.9,-0.7,0.7,0.9,1.0,5.0",kTRUE);
-//   cf->AddVariable(AliDielectronVarManager::kPhi,"0.0,1.0,2.0,3.0,4.0,5.0,6.0",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kEta,"-5.0,-1.0,-0.9,-0.7,0.7,0.9,1.0,5.0",kTRUE);
+   cf->AddVariable(AliDielectronVarManager::kPhi,"0.0,1.0,2.0,3.0,4.0,5.0,6.0",kTRUE);
 //  cf->AddVariable(AliDielectronVarManager::kEMCALE,"1.0,2.0, 3.0, 4.0, 4.5, 5.0, 5.5, 6.0, 7.0, 8.0, 9.0, 10.0,11.0,12.0,16.0,25.0",kTRUE); 
 //  cf->AddVariable(AliDielectronVarManager::kEMCALnSigmaEle,"-3.5,-3.0,-2.0,-1.0,1.0,2.0,3.0,4.0,5.0",kTRUE);
 //  cf->AddVariable(AliDielectronVarManager::kEMCALNCells,25,0,25,kTRUE);
 //  cf->AddVariable(AliDielectronVarManager::kEMCALEoverP,"0.6, 0.65,0.7,0.8,0.9,1.1,1.2,1.3,1.4,1.8,2.0,2.1",kTRUE);
-  
+    cf->AddVariable(AliDielectronVarManager::kNclsSTPC,20,0.,1.,kTRUE);//shared cluster
     //ITS
   cf->AddVariable(AliDielectronVarManager::kNclsITS,6,0.,6.,kTRUE);
   
@@ -309,7 +306,7 @@ void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
   //event variables
   cf->AddVariable(AliDielectronVarManager::kCentrality,20,0.,100.);
 //  cf->AddVariable(AliDielectronVarManager::kMultV0,26,0.,26000.);
-  cf->AddVariable(AliDielectronVarManager::kZvPrim,20,-10.,10.);
+//  cf->AddVariable(AliDielectronVarManager::kZvPrim,20,-10.,10.);
 
 //  cf->AddVariable(AliDielectronVarManager::kITSLayerFirstCls,6,0.,6.,kTRUE);
 
index a1ff609..d497837 100644 (file)
@@ -1,23 +1,23 @@
+void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
+void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
+void InitHistogramsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
+void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD);
+void AddMCsignal(AliDielectron *die);
 
-void InitHistograms(AliDielectron *die, Int_t cutDefinition);
-void InitCF(AliDielectron* die, Int_t cutDefinition);
 
-void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition);
 
-AliESDtrackCuts *SetupESDtrackCuts(Int_t cutDefinition);
-AliDielectronPID *SetPIDcuts(Int_t cutDefinition);
 
-void AddMCsignal(AliDielectron *die);
+AliESDtrackCuts *SetupESDtrackCutsDieleData(Int_t cutDefinition);
+
+TString namesDieleData=("CF;kAnyLeg;kMixLegs");
+
 
-void SetEtaCorrection();
 
-//TString names= ("Electrons;QA;EMCal_AnyLeg");
-TString names= ("Electrons;QA");
+TObjArray *arrNamesDieleData=namesDieleData.Tokenize(";");
 
-TObjArray *arrNames=names.Tokenize(";");
-const Int_t nDie=arrNames->GetEntriesFast();
+const Int_t nDie=arrNamesDieleData->GetEntries();
 
-AliDielectron* Config_mkoehler_CCbarMC(Int_t cutDefinition=1,Bool_t isAOD)
+AliDielectron* Config_mkoehler_CCbarMC(Int_t cutDefinition, Bool_t isAOD=kFALSE)
 {
   //
   // Setup the instance of AliDielectron
@@ -25,365 +25,315 @@ AliDielectron* Config_mkoehler_CCbarMC(Int_t cutDefinition=1,Bool_t isAOD)
   
   // create the actual framework object
   TString name=Form("%02d",cutDefinition);
-  if (cutDefinition<arrNames->GetEntriesFast()){
-    name=arrNames->At(cutDefinition)->GetName();
+  if (cutDefinition<arrNamesDieleData->GetEntriesFast()){
+    name=arrNamesDieleData->At(cutDefinition)->GetName();
   }
-  AliDielectron *die =
-    new AliDielectron(Form("%s",name.Data()),
-                      Form("Track cuts: %s",name.Data()));
+  AliDielectron *diele = new AliDielectron(Form("%s",name.Data()),
+                             Form("Track cuts: %s",name.Data()));
 
   // cut setup
-  SetupTrackCuts(die,cutDefinition);
-
-
+  SetupTrackCutsDieleData(diele, cutDefinition, isAOD);
+  SetupPairCutsDieleData(diele, cutDefinition, isAOD);
 
   //
   // histogram setup
   // only if an AliDielectronHistos object is attached to the
-  // dielectron framework histograms will be filled
+  // dielelectron framework histograms will be filled
   //
-
-
-  InitHistograms(die,cutDefinition);
-  InitCF(die,cutDefinition);
-
-  // eta correction
-//  SetEtaCorrection();
+  InitHistogramsDieleData(diele, cutDefinition, isAOD);
+  InitCFDieleData(diele, cutDefinition, isAOD);
 
   
-  return die;
-
+  return diele;
 }
 
+
 //______________________________________________________________________________________
-void SetupTrackCuts(AliDielectron *die, Int_t cutDefinition)
+void SetupTrackCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
 {
   //
   // Setup the track cuts
   //
 
+  AddMCsignal(diele);
+  
+  //ESD quality cuts DielectronTrackCuts
 
+    diele->GetTrackFilter().AddCuts(SetupESDtrackCutsDieleData(cutDefinition));
+  
+}//SetupTrackCutsDieleData
 
 
-        AddMCsignal(die);
-
-       //track cuts
-        if(cutDefinition>0){
-        die->GetTrackFilter().AddCuts(SetupESDtrackCuts(cutDefinition));
-       }
-
-       //pid cuts
-//     die->GetTrackFilter().AddCuts(SetPIDcuts(cutDefinition));
 
 
-       
-       if(cutDefinition >= 0){
+//______________________________________________________________________________________
+AliESDtrackCuts *SetupESDtrackCutsDieleData(Int_t cutDefinition)
+{
+  //
+  // Setup default AliESDtrackCuts
+  //
+  AliESDtrackCuts *esdTrackCuts = new AliESDtrackCuts;
 
-         
-           AliDielectronVarCuts *mcpid =new AliDielectronVarCuts("mcpid","mcpid");
-           mcpid->SetCutType(AliDielectronVarCuts::kAny);
-           mcpid->AddCut(AliDielectronVarManager::kPdgCode, 11);
-           mcpid->AddCut(AliDielectronVarManager::kPdgCode, -11);
-           die->GetTrackFilter().AddCuts(mcpid);
+  // basic track quality cuts  (basicQ)
+  esdTrackCuts->SetMaxDCAToVertexZ(3.0);
+  esdTrackCuts->SetMaxDCAToVertexXY(1.0);
 
-          AliDielectronVarCuts *MCnoConv =new AliDielectronVarCuts("MCnoConv","MCnoConv");
-                  MCnoConv->AddCut(AliDielectronVarManager::kPdgCodeMother, 22,kTRUE);
-          die->GetTrackFilter().AddCuts(MCnoConv);          
-            
-       }//Base
+  esdTrackCuts->SetEtaRange( -0.9 , 0.9 );
 
+  esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
+  esdTrackCuts->SetRequireITSRefit(kTRUE);
+  esdTrackCuts->SetRequireTPCRefit(kTRUE);
 
+  esdTrackCuts->SetPtRange(.8,1e30);
 
-       if(cutDefinition == 2){//EMCal cut
-         AliDielectronVarCuts *mycut = new AliDielectronVarCuts("CutEMCAL","cut for EMCal");
-         mycut->AddCut(AliDielectronVarManager::kEMCALnSigmaEle,-3.5,10.);
-         mycut->AddCut(AliDielectronVarManager::kEMCALE,3.5,100.);
-         mycut->AddCut(AliDielectronVarManager::kEMCALEoverP,0.7,1.3);
+  esdTrackCuts->SetMinNClustersTPC(70);
+  esdTrackCuts->SetMaxChi2PerClusterTPC(4);
 
-  
-         AliDielectronPairLegCuts *varpair=new AliDielectronPairLegCuts();
-         varpair->GetLeg1Filter().AddCuts(mycut);
-         varpair->GetLeg2Filter().AddCuts(mycut);
-         varpair->SetCutType(AliDielectronPairLegCuts::kAnyLeg);
-//       die->GetPairFilter().AddCuts(varpair);
-       }
+  // default SPD any
+  esdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);
 
+  return esdTrackCuts;
 }
 
-//-----------------------------------pid------------------------------------------------
-
-AliDielectronPID *SetPIDcuts(Int_t cutDefinition){
-
-  AliDielectronPID *pid = new AliDielectronPID();
-
-  
-
- if(cutDefinition >= 1){
-        pid->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-4.5,4.5,0.2,100.,kFALSE);
- }//complete PID
 
+//______________________________________________________________________________________
+void SetupPairCutsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
+{
+  // Setup the pair cuts
 
+  if(cutDefinition >=1){
+  //rapidity selection
+  AliDielectronVarCuts *pairCut=new AliDielectronVarCuts("pairCut","pairCut");
+  pairCut->AddCut(AliDielectronVarManager::kY,-1.,1.);
+  diele->GetPairFilter().AddCuts(pairCut);
 
- return pid;
 
-}
+  AliDielectronVarCuts *mycut = new AliDielectronVarCuts("CutEMCAL","cut for EMCal");
+  mycut->AddCut(AliDielectronVarManager::kEMCALEoverP,0.75,1.25);
+  mycut->AddCut(AliDielectronVarManager::kEMCALE,3.5,100.);
 
-//______________________________________________________________________________________
-AliESDtrackCuts *SetupESDtrackCuts(Int_t cutDefinition)
-{
-  //
-  // Setup default AliESDtrackCuts
-  //
-  AliESDtrackCuts *fesdTrackCuts = new AliESDtrackCuts;
-
-  //global
-  fesdTrackCuts->SetPtRange( 0.8 , 100. );
-  fesdTrackCuts->SetAcceptKinkDaughters(kFALSE);
-  fesdTrackCuts->SetRequireSigmaToVertex(kFALSE);
-  fesdTrackCuts->SetDCAToVertex2D(kFALSE);
-  fesdTrackCuts->SetMaxDCAToVertexZ(3.);
-  fesdTrackCuts->SetMaxDCAToVertexXY(1.);
-  fesdTrackCuts->SetEtaRange( -0.8 , 0.8 );
-  //ITS
-  fesdTrackCuts->SetRequireITSRefit(kTRUE);
-  fesdTrackCuts->SetMinNClustersITS(3); 
-  fesdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kAny);//kFirst
   
-  //TPC
-  fesdTrackCuts->SetRequireTPCRefit(kTRUE);
-//  fesdTrackCuts->SetMinNClustersTPC(80);
-//  fesdTrackCuts->SetMinNCrossedRowsTPC(120);
-//  fesdTrackCuts->SetMinRatioCrossedRowsOverFindableClustersTPC(0.5);
-  fesdTrackCuts->SetMaxChi2PerClusterTPC(4);
 
-  return fesdTrackCuts;
+  AliDielectronPairLegCuts *varpair=new AliDielectronPairLegCuts();
+  varpair->GetLeg1Filter().AddCuts(mycut);
+  varpair->GetLeg2Filter().AddCuts(mycut);
+  if(cutDefinition == 1)varpair->SetCutType(AliDielectronPairLegCuts::kAnyLeg);
+  if(cutDefinition == 2)varpair->SetCutType(AliDielectronPairLegCuts::kMixLegs);
+  diele->GetPairFilter().AddCuts(varpair);
+  }
+
 
-}
+}//SetupPairCutsDieleData
 
 //______________________________________________________________________________________
-void InitHistograms(AliDielectron *die, Int_t cutDefinition)
+void InitHistogramsDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
 {
   //
   // Initialise the histograms
   //
   
-  //Setup histogram classes
-  AliDielectronHistos *histos=
-    new AliDielectronHistos(die->GetName(),
-                            die->GetTitle());
+  //Setup histogram Manager
+  AliDielectronHistos *histos=new AliDielectronHistos(diele->GetName(),diele->GetTitle());
   
-
-
   //Initialise histogram classes
   histos->SetReservedWords("Track;Pair");
   
-  //Event class
-  histos->AddClass("Event");
-  
-
   //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<3; ++i){
+       histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
+
+  }
+  
+  //legs from pair
   for (Int_t i=0; i<3; ++i){
-    histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(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
-  histos->UserHistogram("Event","nEvents","Number of processed events after cuts;Number events",1,0,1,AliDielectronVarManager::kNevents);
-  histos->UserHistogram("Event","ZVertex","ZVertex;ZVertex/cm",480,-12.,12.,AliDielectronVarManager::kZvPrim);
-  histos->UserHistogram("Event","nESDTracks","ESD tracks;ESD tracks;Number events",100,0,200,AliDielectronVarManager::kTracks);
-  histos->UserHistogram("Event","Nacc","Number of accepted tracks;Number events",100,0,200,AliDielectronVarManager::kNacc);
-  histos->UserHistogram("Event","NVtxContrib","Number of Vertex Contributor;NVtx;Number events",100,0,100,AliDielectronVarManager::kNVtxContrib);
-
-
+    //add histograms to event class
+
+    histos->AddClass("Event");
+    histos->UserHistogram("Event","VtxZ","Vertex Z;Z[cm]",500,-40.,40.,AliDielectronVarManager::kZvPrim);
+    histos->UserHistogram("Event","VtxYxVtxZ","Vertexyz;Z[cm];Y[cm]",500,-40.,40.,400,-0.5,0.5,AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kYvPrim);
+    histos->UserHistogram("Event","VtxXxVtxZ","Vertexxz;Z[cm];X[cm]",500,-40.,40.,400,-0.5,0.5,AliDielectronVarManager::kZvPrim,AliDielectronVarManager::kXvPrim);
+    histos->UserHistogram("Event","VtxYxVtxX","Vertexxz;Z[cm];X[cm]",400,-0.5,0.5,400,-0.5,0.5,AliDielectronVarManager::kXvPrim,AliDielectronVarManager::kYvPrim);
+    histos->UserHistogram("Event","MultV0A","MultV0A;multiplicity",1000,0.,1000.,AliDielectronVarManager::kMultV0A);
+    histos->UserHistogram("Event","MultV0C","MultV0C;multiplicity",1000,0.,1000.,AliDielectronVarManager::kMultV0C);
+    histos->UserHistogram("Event","MultV0","MultV0;multiplicity",1000,0.,1000.,AliDielectronVarManager::kMultV0);
+    histos->UserHistogram("Event","RefMult","RefMult;multiplicity",1000,0.,1000.,AliDielectronVarManager::kRefMult);   
+    histos->UserHistogram("Event","RefMultTPConly","RefMultTPConly;multiplicity",1000,0.,1000.,AliDielectronVarManager::kRefMultTPConly);    
+    histos->UserHistogram("Event","VZEROchMult","VZEROchMult;multiplicity",1000,0.,1000.,AliDielectronVarManager::kVZEROchMult);     
+    histos->UserHistogram("Event","MixingBin","kMixingBin;",100,0.,100.,AliDielectronVarManager::kMixingBin);     
+    
+  
+  
+  
   //add histograms to Track classes
-  histos->UserHistogram("Track","P","P;P [GeV];#tracks",500,0.,10.,AliDielectronVarManager::kPIn);
-  histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",500,0.,10.,AliDielectronVarManager::kPt);
-  histos->UserHistogram("Track","Eta","Eta; Eta ;#tracks",100,-1.,1.,AliDielectronVarManager::kEta);
-  histos->UserHistogram("Track","Phi","Phi; Phi ;#tracks",640,0.,6.4,AliDielectronVarManager::kPhi);
-  histos->UserHistogram("Track","ImpParXY","ImpParXY; ÍmpParXY ;#tracks",500,-5.,5.,AliDielectronVarManager::kImpactParXY);
-  histos->UserHistogram("Track","ImpParZ","ImpParZ; ÍmpParZ ;#tracks",500,-5.,5.,AliDielectronVarManager::kImpactParZ);
+  histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",250,0,50.,AliDielectronVarManager::kPt,kTRUE);
+  histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusters;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTPC,kTRUE);
+  histos->UserHistogram("Track","TPCchi2Cl","Chi-2/Clusters TPC;Chi2/ncls number clusters;#tracks",100,0,10,AliDielectronVarManager::kTPCchi2Cl,kTRUE);
+  histos->UserHistogram("Track","TPCnFCls","Number of findable Clusters TPC;Number of findable Clusters TPC;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNFclsTPC,kTRUE);
+  histos->UserHistogram("Track","TPCnFClsfCross","fraction crossed rows/findable;fraction crossed rows/findable;#tracks",200,0.,2.,AliDielectronVarManager::kNFclsTPCfCross,kTRUE);
+  histos->UserHistogram("Track","TPCnFClsr","Number of findable Clusters(crossed rows) TPC;Number of findable crossed rows TPC;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNFclsTPCr,kTRUE);
+  histos->UserHistogram("Track","TPCnFClsrFrac","Number of found/findable Clusters TPC;Number of found/findable Clusters TPC;#tracks",200,0.,2.,AliDielectronVarManager::kNFclsTPCrFrac,kTRUE);
+  histos->UserHistogram("Track","TPCnFClsTPCfCross","Fraction of findable Clusters/Cr.rows TPC;Fraction of findable Clusters/Cr.rows TPC;#tracks",200,0.,2.,AliDielectronVarManager::kNFclsTPCfCross,kTRUE);  
+  histos->UserHistogram("Track","TPCsignalN","Number of points for TPC Signal;TPC Npoints dEdx;#tracks",160,-0.5,159.5,AliDielectronVarManager::kTPCsignalN,kTRUE);    
+  
+  histos->UserHistogram("Track","dXY","dXY;dXY [cm];#tracks",200,-1.5,1.5,AliDielectronVarManager::kImpactParXY,kTRUE);
+  histos->UserHistogram("Track","dZ","dZ;dZ [cm];#tracks",200,-4.,4.,AliDielectronVarManager::kImpactParZ,kTRUE);
+  
+  histos->UserHistogram("Track","Eta_Phi","Eta vs Phi; Eta; Phi;#tracks",
+                        100,-1.2,1.2,144,0,6.285,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi,kTRUE);
 
-  histos->UserHistogram("Track","Eta_phi","Eta vs Phi;Eta;Phi",100,-1.,1.,320,0.,6.4,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
-  histos->UserHistogram("Track","Eta_pt","Eta vs Pt;Eta;Pt",100,-1.,1.,500,0.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Track","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
+                        200,0.2,20.,800,20.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
 
+  histos->UserHistogram("Track","dEdx_Pt","dEdx;Pt [GeV];TPC signal (arb units);#tracks",
+                        200,0.2,20.,800,20.,200.,AliDielectronVarManager::kPt,AliDielectronVarManager::kTPCsignal,kTRUE);
 
+  histos->UserHistogram("Track","TPCnSigmaEle_P","TPCnSigmaEle;P [GeV];TPCnSigmaEle;#tracks",
+                        200,0.2,20.,800,-12.,12.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+  
+  histos->UserHistogram("Track","TPCnSigmaEle_Pt","TPCnSigmaEle;Pt [GeV];TPCnSigmaEle;#tracks",
+                        200,0.2,20.,800,-12.,12.,AliDielectronVarManager::kPt,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
 
-  //track checks (ITS)
-  histos->UserHistogram("Track","ITSchi2Cl_Mom","ITS Chi2 vs Momentum;Mom;ITS chi2",500,0.,5.,50,0.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSchi2Cl);
-  histos->UserHistogram("Track","NclsITS_Mom",";Mom;kNclsITS",500,0.,5.,7,0,7,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsITS);
+  histos->UserHistogram("Track","TPCnSigmaEle_Phi","TPCnSigmaEle;#phi [rad];TPCnSigmaEle;#tracks",
+                        200,0.,2*TMath::Pi(),800,-12.,12.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+  
+  histos->UserHistogram("Track","TPCnSigmaEle_Eta","TPCnSigmaEle;#eta;TPCnSigmaEle;#tracks",
+                        200,-1.,1.,800,-12.,12.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+    
 
-  //track checks (TPC)
-  histos->UserHistogram("Track","TPCsignalNfrac_Mom",";fraction TPCSignalN/TPCncls vs Momentum;Mom;TPCSignalN/TPCncls",500,0.,5.,60,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignalNfrac);
-  histos->UserHistogram("Track","TPCchi2Cl_Mom","TPC Chi2 vs Momentum;Mom;TPC Chi2",500,0.,10.,100,0,5,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCchi2Cl);
-  histos->UserHistogram("Track","TPCclsDiff_Mom","kTPCclsDiff vs Momentum;Mom;kTPCclsDiff",500,0.,10.,100,-10,10,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCclsDiff);
-  histos->UserHistogram("Track","FindableTPCcls_Mom","kNFclsTPC vs Momentum;Mom;kNFclsTPC",500,0.,10.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNFclsTPC);
-  histos->UserHistogram("Track","TPCcls_Mom","kNclsTPC vs Momentum;Mom;kNclsTPC",500,0.,10.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsTPC);
-  histos->UserHistogram("Track","kNclsSFracTPC_Mom","kNclsSFracTPC vs Momentum;Mom;kTPCclsSFrac",500,0.,10.,60,0.,0.12,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNclsSFracTPC);
-  histos->UserHistogram("Track","kNFclsTPCrFrac_Mom","kNFclsTPCrFrac vs Momentum;Mom;kNFclsTPCrFrac",500,0.,10.,60,0.,1.2.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kNFclsTPCrFrac);
+  histos->UserHistogram("Track","dEdx_Phi","dEdx vs phi;#phi [rad];TPC signal (arb units);#tracks",
+                        200,0.,2*TMath::Pi(),800,20.,200.,AliDielectronVarManager::kPhi,AliDielectronVarManager::kTPCsignal,kTRUE);
 
-  //track checks (TOF)
-  histos->UserHistogram("Track","TOFbeta_Mom","kTOFbeta vs Momentum;Mom;TOFbeta",500,0.,5.,120,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta);
-  histos->UserHistogram("Track","TOFPIDBit_Mom","kTOFPIDBit vs Momentum;Mom;TOFPIDbit",500,0.,5.,2,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFPIDBit);
+  histos->UserHistogram("Track","dEdx_Eta","dEdx vs eta;#eta;TPC signal (arb units);#tracks",
+                        200,-1.,1.,800,20.,200.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCsignal,kTRUE);
 
- //pid checks
-  histos->UserHistogram("Track","ITSnSigma_MomPio","ITS number of sigmas Pion vs Momentum;Mom;ITSsigmaPion",500,0.,5.,1000,-20,20,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaPio);
-  histos->UserHistogram("Track","TPCnSigma_MomPio","TPC number of sigmas Pions vs Momentum;Mom;TPCsigmaPion",500,0.,5.,1000,-20,20,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio);
 
-  histos->UserHistogram("Track","ITSnSigma_MomEle","ITS number of sigmas Electrons vs Momentum;Mom;ITSsigmaEle",500,0.,5.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSnSigmaEle);
-  histos->UserHistogram("Track","TPCnSigma_MomEle","TPC number of sigmas Electrons vs Momentum;Mom;TPCsigmaEle",1000,0.,10.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle);
-  histos->UserHistogram("Track","TOFnSigma_MomEle","TOF number of sigmas Electrons vs Momentum;Mom;TOFsigmaEle",500,0.,5.,800,-40,40,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaEle);
 
-  histos->UserHistogram("Track","ITSdEdx_P","dEdx;P [GeV];ITS signal (arb units) vs Momentum;Mom;ITSsignal", 500,0,5,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal);
-  histos->UserHistogram("Track","TPCdEdx_P","dEdx;P [GeV];TPC signal (arb units) vs Momentum;Mom;TPCsignal", 500,0,10.,800,0,200,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal);
+  histos->UserHistogram("Track","dEdx_nSigmaEMCal","dEdx vs nSigmaEMCal;NsigmaEmcal;TPC signal (arb units);NSigmaEMCAL",
+                        200,-5.,5.,800,20.,200.,AliDielectronVarManager::kEMCALnSigmaEle,AliDielectronVarManager::kTPCsignal,kTRUE);
 
+  histos->UserHistogram("Track","dEdx_TPCnSigmaEle","dEdx vs TPCnSigmaEle;TPC signal electrons(arbunits);TPC number of sigmas Electrons;TPC signal (a.u.);#tracks",
+                        100,-10.,10.,800,20.,200.,AliDielectronVarManager::kTPCnSigmaEle,AliDielectronVarManager::kTPCsignal,kTRUE);
 
+  histos->UserHistogram("Track","dEdx_EoverP","dEdx;EoverP;TPC signal (arbunits);E/P",100,0.,5.,800,20.,200.,AliDielectronVarManager::kEMCALEoverP,AliDielectronVarManager::kTPCsignal,kTRUE);
+  
+  histos->UserHistogram("Track","nSigmaEMCal_EoverP","NsigmaEmcal;EoverP;NSigmaEMCAL;E/P",100,0.,5.,200,-5.,5.,AliDielectronVarManager::kEMCALEoverP,AliDielectronVarManager::kEMCALnSigmaEle,kTRUE);
+  histos->UserHistogram("Track","EMCal_E","EmcalE;Cluster Energy [GeV];#Clusters",200,0.,40.,AliDielectronVarManager::kEMCALE,kTRUE);
 
-  //
+  histos->UserHistogram("Track","ITS_FirstCls","ITS First Layer;ITS First Layer;#Entries",6,0.,6.,AliDielectronVarManager::kITSLayerFirstCls,kTRUE);
   //add histograms to Pair classes
-  //
-
-  histos->UserHistogram("Pair","Y",";Rapidity;#pairs",
-                        120,-1.2,1.2,AliDielectronVarManager::kY);
-                       
-  histos->UserHistogram("Pair","Eta",";PseudoRapidity;#pairs",
-                        120,-1.2,1.2,AliDielectronVarManager::kEta);
-                       
-  histos->UserHistogram("Pair","Phi",";PseudoRapidity;#pairs",
-                        320,0,3.2,AliDielectronVarManager::kPhi);
-                       
-  histos->UserHistogram("Pair","Eta_Phi",";PseudoRapidity;Phi",
-                        120,-1.2,1.2,320,0,3.2,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
-                       
-                       
   histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
-                        500,0,4,AliDielectronVarManager::kM);
-
-
-  histos->UserHistogram("Pair","InvMassBin2000","Inv.Mass;Inv. Mass [GeV];#pairs",
-                        2000,0.,10.,AliDielectronVarManager::kM);
-
-   histos->UserHistogram("Pair","InvMass_bin2","Inv.Mass;Inv. Mass [GeV];#pairs",
-        "0. , 0.025, 0.05 , 0.075 ,0.1 ,0.15 , 0.2 , 0.25 , 0.3 , 
-        0.4 ,  0.5 , 0.6, 0.65 , 0.688 , 0.725, 0.75, 0.775, 0.8 , 0.85 ,
-         0.95,  0.975 , 1.0 , 1.025 , 1.05, 1.125 , 1.25 , 1.5 , 1.75 , 2.0 , 
-        2.25, 2.5 , 2.75 , 2.85, 2.95,3.05, 3.1 , 3.15 , 
-        3.3 , 3.5, 3.75 , 4.0",AliDielectronVarManager::kM);
-
-  histos->UserHistogram("Pair",
-                        "InvMass_PhivPair","InvMass_PhivPair;InvMass;PhivPair",
-                        500, 0. , 4., 320 , 0., 3.2 ,
-                         AliDielectronVarManager::kM , AliDielectronVarManager::kPhivPair );
-                        
-  histos->UserHistogram("Pair","PhiV",";PhiV;#pairs",
-                        320,0.,6.4,AliDielectronVarManager::kPhivPair);
-
-
-   histos->UserHistogram("Pair","PhiV_Pt",";Pt;PhiV",
-                        100,0.,10.,320,0.,6.4,AliDielectronVarManager::kPt,AliDielectronVarManager::kPhivPair);
-                        
-                        
-  histos->UserHistogram("Pair",
-                        "InvMass_Pt","InvMass_Pt;InvMass;Pt",
-                        500, 0. , 4., 100 , 0., 5. ,
-                         AliDielectronVarManager::kM , AliDielectronVarManager::kPt );
-
-  histos->UserHistogram("Pair",
-                        "OpAngle","Opening angle;Opening angle;#pairs",
-                        320, 0. , 3.2, 
-                         AliDielectronVarManager::kOpeningAngle);
-
-  histos->UserHistogram("Pair",
-                        "OpAngle_InvMass","OpAngle_InvMass;Opening angle;Invariant Mass",
-                        320, 0. , 3.2, 500 , 0. , 4. ,
-                         AliDielectronVarManager::kOpeningAngle,AliDielectronVarManager::kM);
-
-
-
-  histos->UserHistogram("Pair","kDeltaEta","kDeltaEta;kDeltaEta;#pairs",
-                        160,0.,1.6,AliDielectronVarManager::kDeltaEta);
-
-  histos->UserHistogram("Pair","kDeltaEta_low","kDeltaEta;kDeltaEta;#pairs",
-                        500,0.,0.5,AliDielectronVarManager::kDeltaEta);
-
-  histos->UserHistogram("Pair","kDeltaPhi","kDeltaPhi;kDeltaPhi;#pairs",
-                        320,0.,6.4,AliDielectronVarManager::kDeltaPhi);
-
-  histos->UserHistogram("Pair",
-                        "kDeltaEta_kDeltaPhi","kDeltaEta_kDeltaPhi;kDeltaEta;kDeltaPhi",
-                        160, 0. , 1.6, 320 , 0., 6.4 ,
-                         AliDielectronVarManager::kDeltaEta , AliDielectronVarManager::kDeltaPhi );
-
-
-
-  die->SetHistogramManager(histos);
+                        251,-.01,5.01,AliDielectronVarManager::kM);
+  histos->UserHistogram("Pair","InvMass2D","Inv.Mass;Pt [GeV]; Inv. Mass [GeV]",
+                        20,0.,20.,251,-.01,5.01,AliDielectronVarManager::kPt,AliDielectronVarManager::kM);
+     
+     
+    histos->UserHistogram("Pair","InvMasslong","Inv.Mass;Inv. Mass [GeV];#pairs",
+                        301,-.02,15.02,AliDielectronVarManager::kM);
+    
+  histos->UserHistogram("Pair","Rapidity","Rapidity;Rapidity;#pairs",
+                        50,-1.,1.,AliDielectronVarManager::kY);
+  histos->UserHistogram("Pair","OpeningAngle","Opening angle;angle",
+                        50,0.,3.15,AliDielectronVarManager::kOpeningAngle);
+
+  histos->UserHistogram("Pair","PseudoProperTime","Pseudoproper decay length; pseudoproper-decay-length[#mum];Entries/40#mum",
+                          150,-0.3.,0.3,AliDielectronVarManager::kPseudoProperTime);
+  
+ histos->UserHistogram("Pair","Chi2/NDF","#Chi^{2}/NDF;#Chi^{2}/NDF",
+                        100, 0., 20., AliDielectronVarManager::kChi2NDF);
+  
+  
+  diele->SetHistogramManager(histos);
 }
 
 
-
-
-
-
-void InitCF(AliDielectron* die, Int_t cutDefinition)
+void InitCFDieleData(AliDielectron *diele, Int_t cutDefinition, Bool_t isAOD)
 {
   //
-  // Setup the CF Manager if needed
+  // Setupd the CF Manager if needed
   //
   
-  AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
-
-   
-    //pair variables
-   cf->AddVariable(AliDielectronVarManager::kM, 500,0.,10.);
-       
-   cf->AddVariable(AliDielectronVarManager::kY,24,-1.2,1.2);
-   cf->AddVariable(AliDielectronVarManager::kPhi,64, -3.2, 3.2);
-   cf->AddVariable(AliDielectronVarManager::kPt,100,0.,5.);
-   
-   cf->AddVariable(AliDielectronVarManager::kPairType,4,-0.5,3.5);
-   cf->AddVariable(AliDielectronVarManager::kNumberOfDaughters,5,0,5);
-   cf->AddVariable(AliDielectronVarManager::kPhivPair,640,0.,3.2);
-
-  //leg 
-  cf->AddVariable(AliDielectronVarManager::kPt,100,0.,10.,kTRUE);
-  cf->AddVariable(AliDielectronVarManager::kPhi,36,0.,360.,kTRUE);
-  cf->AddVariable(AliDielectronVarManager::kEta,100,-1.,1.,kTRUE);
-
-
-  cf->AddVariable(AliDielectronVarManager::kImpactParXY,40,-2.,2.,kTRUE);
-  cf->AddVariable(AliDielectronVarManager::kImpactParZ,40,-4.,4.,kTRUE);
-  cf->AddVariable(AliDielectronVarManager::kNclsITS,10,0.,10.,kTRUE);
-  cf->AddVariable(AliDielectronVarManager::kNFclsTPCrFrac,10,0.,1.,kTRUE);
-
-
-  //TPC pid
-  cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,80,-4.,4.,kTRUE);
+  AliDielectronCF *cf=new AliDielectronCF(diele->GetName(),diele->GetTitle());
+  
+  //pair variables
+  cf->AddVariable(AliDielectronVarManager::kPt,"1.0,2.0,3.0,4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0,15.0,16.0,17.0,18.0,19.0,20.0");
+  cf->AddVariable(AliDielectronVarManager::kM,500,0.,10.);//also try variable bi sizes later...
+  
+    cf->AddVariable(AliDielectronVarManager::kPairType,12,0,12);
+  cf->AddVariable(AliDielectronVarManager::kOpeningAngle,31,-0.15,3.15);
+  cf->AddVariable(AliDielectronVarManager::kEta,40,-1.,1.);
+  cf->AddVariable(AliDielectronVarManager::kY,40,-1.,1.);
+  cf->AddVariable(AliDielectronVarManager::kPhi,20,0.,20*0.32);
+//  cf->AddVariable(AliDielectronVarManager::kPseudoProperTime,300,-0.3,0.3);
+//  cf->AddVariable(AliDielectronVarManager::kPseudoProperTimeErr,200,0.,0.1);
+//  cf->AddVariable(AliDielectronVarManager::kPseudoProperTimeResolution,400,-0.1,0.1);
+//  cf->AddVariable(AliDielectronVarManager::kPseudoProperTimePull,400,-0.1,0.1); 
+//  cf->AddVariable(AliDielectronVarManager::kChi2NDF,40, 0., 20.);
+
+  //global leg variables
+  cf->AddVariable(AliDielectronVarManager::kP,50,0.,5.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kPt,"0.,0.5,0.75,0.9,1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 3.0, 4.0, 8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,30.0,50.0,100.0",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kNclsTPC,"65, 70, 75, 80, 85, 90, 95, 100, 120, 160",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCchi2Cl,100, 0., 10.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCsignalN,160,-0.5,159.5,kTRUE);   
+  cf->AddVariable(AliDielectronVarManager::kEta,44,-1.2,1.2,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kPhi,64,0.,64*0.1,kTRUE);
+//  cf->AddVariable(AliDielectronVarManager::kImpactParXY,200,-1.,1.,kTRUE);
+//  cf->AddVariable(AliDielectronVarManager::kImpactParZ,600,-3.,3.,kTRUE);
+  //TPC
+  cf->AddVariable(AliDielectronVarManager::kTPCsignal,"40.,50.,55.,60.,65.,68.,70.,72.,75.,80.,90.,100.,110.,200.",kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCnSigmaEle,20,-3.,4.,kTRUE);
   cf->AddVariable(AliDielectronVarManager::kTPCnSigmaPio,8,1.,4.5,kTRUE);
   cf->AddVariable(AliDielectronVarManager::kTPCnSigmaPro,8,0.,4.,kTRUE);
-
-  if (cutDefinition == 0){
-    cf->SetStepForMCtruth();
-  }
+  cf->AddVariable(AliDielectronVarManager::kNclsSTPC,20,0.,1.,kTRUE);//shared cluster
+    //ITS
+  cf->AddVariable(AliDielectronVarManager::kNclsITS,6,0.,6.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kITSLayerFirstCls,6,0.,6.,kTRUE);
   
-//     cf->SetStepsForEachCut();
-//     cf->SetStepsForCutsIncreasing();
-
+  //TOF
+//  cf->AddVariable(AliDielectronVarManager::kTOFnSigmaEle,20,-3.5,4.,kTRUE);
+//  cf->AddVariable(AliDielectronVarManager::kTOFnSigmaPio,8,0.,4.,kTRUE);
+  //EMCal variables
+//  cf->AddVariable(AliDielectronVarManager::kEMCALE,20,0.,20.,kTRUE); 
+//  cf->AddVariable(AliDielectronVarManager::kEMCALnSigmaEle,50,-5.,5.,kTRUE);
+//  cf->AddVariable(AliDielectronVarManager::kEMCALNCells,50,0,50,kTRUE);
+//  cf->AddVariable(AliDielectronVarManager::kEMCALEoverP,"0.6,0.7,0.8,0.9,1.1,1.2,1.3,1.4,1.8,2.0,4.0",kTRUE);
+  
+//    cf->AddVariable(AliDielectronVarManager::kMixingBin,100,0.,100.);
+    cf->AddVariable(AliDielectronVarManager::kZvPrim,20,-20.,20.);
 
-  die->SetCFManagerPair(cf);
+   
+    
+    if (cutDefinition == 0){
+           cf->SetStepForMCtruth();
+  }
+    
+    
+    
+  //leg variables
+  diele->SetCFManagerPair(cf);
   
 }
 
-
 void AddMCsignal(AliDielectron *die){
-
+  
   AliDielectronSignalMC* diEleOpenCharm = new AliDielectronSignalMC("diEleOpenCharm","di-electrons from open charm");  // dielectrons originating from open charm hadrons
   diEleOpenCharm->SetLegPDGs(11,-11);
   diEleOpenCharm->SetMotherPDGs(402,402);
@@ -393,202 +343,17 @@ void AddMCsignal(AliDielectron *die){
   diEleOpenCharm->SetFillPureMCStep(kTRUE);
   die->AddSignalMC(diEleOpenCharm);
 
-
-  AliDielectronSignalMC* diEleOpenBeauty = new AliDielectronSignalMC("diEleOpenBeauty","di-electrons from open beauty");  // dielectrons originating f$
+//    501 - open beauty mesons     
+  AliDielectronSignalMC* diEleOpenBeauty = new AliDielectronSignalMC("diEleOpenBeauty","di-electrons from open beauty");  // dielectrons originating from open beauty hadrons
   diEleOpenBeauty->SetLegPDGs(11,-11);
-  diEleOpenBeauty->SetMotherPDGs(503,503);
+  diEleOpenBeauty->SetMotherPDGs(501,501);
   diEleOpenBeauty->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
   diEleOpenBeauty->SetCheckBothChargesLegs(kTRUE,kTRUE);
   diEleOpenBeauty->SetCheckBothChargesMothers(kTRUE,kTRUE);
   diEleOpenBeauty->SetFillPureMCStep(kTRUE);
   die->AddSignalMC(diEleOpenBeauty);
-  //signal pairs
-
-   AliDielectronSignalMC* pi0 = new AliDielectronSignalMC("pi0","pi0");
-   pi0->SetLegPDGs(11,-11);
-   pi0->SetMothersRelation(AliDielectronSignalMC::kSame);
-   pi0->SetMotherPDGs(111,111);//pi0
-   pi0->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-   pi0->SetFillPureMCStep(kTRUE);
-   pi0->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//   die->AddSignalMC(pi0);
-
-   AliDielectronSignalMC* eta = new AliDielectronSignalMC("eta","eta");
-   eta->SetLegPDGs(11,-11);
-   eta->SetMothersRelation(AliDielectronSignalMC::kSame);
-   eta->SetMotherPDGs(221,221);//eta
-   eta->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-   //   eta->SetFillPureMCStep(kTRUE);
-   eta->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//   die->AddSignalMC(eta);
-
-   AliDielectronSignalMC* etaprime = new AliDielectronSignalMC("etaprime","etaprime");
-   etaprime->SetMothersRelation(AliDielectronSignalMC::kSame);
-   etaprime->SetMotherPDGs(331,331);//etaprime
-   etaprime->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-   //   etaprime->SetFillPureMCStep(kTRUE);
-   etaprime->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//   die->AddSignalMC(etaprime);
-
-   AliDielectronSignalMC* omega = new AliDielectronSignalMC("omega","omega");
-   omega->SetLegPDGs(11,-11);
-   omega->SetMothersRelation(AliDielectronSignalMC::kSame);
-   omega->SetMotherPDGs(223,223);//omega
-   omega->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-   omega->SetFillPureMCStep(kTRUE);
-   omega->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//   die->AddSignalMC(omega);
-
-   AliDielectronSignalMC* phi = new AliDielectronSignalMC("phi","phi");
-   phi->SetLegPDGs(11,-11);
-   phi->SetMothersRelation(AliDielectronSignalMC::kSame);
-   phi->SetMotherPDGs(333,333);//phi
-   phi->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-   phi->SetFillPureMCStep(kTRUE);
-   phi->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//   die->AddSignalMC(phi);
-
-
-   AliDielectronSignalMC* jpsi = new AliDielectronSignalMC("jpsi","jpsi");
-   jpsi->SetLegPDGs(11,-11);
-   jpsi->SetMothersRelation(AliDielectronSignalMC::kSame);
-   jpsi->SetMotherPDGs(443,443);//jpsi
-   jpsi->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-//   jpsi->SetFillPureMCStep(kTRUE);
-   jpsi->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//   die->AddSignalMC(jpsi);
-   
-   
- AliDielectronSignalMC* diEleContinuum = new AliDielectronSignalMC("diEleContinuum","di-electron continuum");     // all di-electrons originating in the collision
-  diEleContinuum->SetLegPDGs(11,-11);
-  diEleContinuum->SetMotherPDGs(0,0,22,22);
-  diEleContinuum->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kFinalState);
-  diEleContinuum->SetMothersRelation(AliDielectronSignalMC::kSame);
-  diEleContinuum->SetCheckBothChargesLegs(kTRUE,kTRUE);
-  diEleContinuum->SetFillPureMCStep(kTRUE);
-//  die->AddSignalMC(diEleContinuum);
-
-  //
-  // contamination from misidentification and conversions
-  //
-
-  //conversion
-  AliDielectronSignalMC* conversionElePairs = new AliDielectronSignalMC("conversionElePairs","conversion electron pairs");      // pairs made from conversion
-  conversionElePairs->SetLegPDGs(11,-11);
-  conversionElePairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-  //  conversionElePairs->SetMothersRelation(AliDielectronSignalMC::kSame);
-  conversionElePairs->SetLegSources(AliDielectronSignalMC::kSecondary, AliDielectronSignalMC::kSecondary);
-  conversionElePairs->SetMotherPDGs(22,22);
-//  die->AddSignalMC(conversionElePairs);
-
-  AliDielectronSignalMC* conversionLeg = new AliDielectronSignalMC("conversionLeg","pairs with a leg from conversion");      // pairs made from conversion
-  conversionLeg->SetLegPDGs(11,-11);
-  conversionLeg->SetCheckBothChargesLegs(kTRUE,kTRUE);
-  conversionLeg->SetLegSources(AliDielectronSignalMC::kPrimary, AliDielectronSignalMC::kSecondary);
-  conversionLeg->SetMotherPDGs(22,0);
-//  die->AddSignalMC(conversionLeg);
-
-
-
-  // background from secondary electrons
-  AliDielectronSignalMC* secondaryElectrons = new AliDielectronSignalMC("secondaryElectrons","Secondary electrons");   // all di-electrons from secondary electrons (interaction with detector)
-  secondaryElectrons->SetLegPDGs(11,-11);
-  secondaryElectrons->SetLegSources(AliDielectronSignalMC::kSecondary, AliDielectronSignalMC::kSecondary);
-  secondaryElectrons->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(secondaryElectrons);
-
-  AliDielectronSignalMC* primarySecElePairs = new AliDielectronSignalMC("primarySecElePairs","Primary+Secondary electron pairs");  // primary-secondary pairs
-  primarySecElePairs->SetLegPDGs(11,-11);
-  primarySecElePairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-  primarySecElePairs->SetLegSources(AliDielectronSignalMC::kFinalState, AliDielectronSignalMC::kSecondary);
-//  die->AddSignalMC(primarySecElePairs);
-
-  // misidentification
-  AliDielectronSignalMC* allEleMisIdPairs = new AliDielectronSignalMC("allEleMisIdPairs","all electron+misid. pairs");  // one true electron + a mis-id electron (all sources included)
-  allEleMisIdPairs->SetLegPDGs(11,11,kFALSE,kTRUE);
-  allEleMisIdPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(allEleMisIdPairs);
-
-  AliDielectronSignalMC* allMisIdMisIdPairs = new AliDielectronSignalMC("allMisIdMisIdPairs","all misid.+misid. pairs");  // mis-id + mis-id
-  allMisIdMisIdPairs->SetLegPDGs(11,11,kTRUE,kTRUE);
-  allMisIdMisIdPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(allMisIdMisIdPairs);
-
-  AliDielectronSignalMC* elePionPairs = new AliDielectronSignalMC("elePionPairs","electron+pion pairs");    // true electron + mis-id pion
-  elePionPairs->SetLegPDGs(11,211);
-  elePionPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(elePionPairs);
-
-  AliDielectronSignalMC* eleKaonPairs = new AliDielectronSignalMC("eleKaonPairs","electron+kaon pairs");   // true electron + mis-id kaon
-  eleKaonPairs->SetLegPDGs(11,321);
-  eleKaonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(eleKaonPairs);
-
-  AliDielectronSignalMC* eleProtonPairs = new AliDielectronSignalMC("eleProtonPairs","Electron+proton pairs");  // true electron + mis-id proton
-  eleProtonPairs->SetLegPDGs(11,2212);
-  eleProtonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(eleProtonPairs);
-
-  AliDielectronSignalMC* piPiPairs = new AliDielectronSignalMC("piPiPairs","pion+pion pairs");    // mis-id pion + mis-id pion
-  piPiPairs->SetLegPDGs(211,211);
-  piPiPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(piPiPairs);
-
-  AliDielectronSignalMC* piKaonPairs = new AliDielectronSignalMC("piKaonPairs","pion+kaon pairs");  // mis-id pion + mis-id kaon
-  piKaonPairs->SetLegPDGs(211,321);
-  piKaonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(piKaonPairs);
-
-  AliDielectronSignalMC* piProtonPairs = new AliDielectronSignalMC("piProtonPairs","pion+proton pairs");  // mis-id pion + mis-id proton
-  piProtonPairs->SetLegPDGs(211,2212);
-  piProtonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(piProtonPairs);
-
-  AliDielectronSignalMC* kaonKaonPairs = new AliDielectronSignalMC("kaonKaonPairs","kaon+kaon pairs");  // mis-id kaon + mis-id kaon
-  kaonKaonPairs->SetLegPDGs(321,321);
-  kaonKaonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(kaonKaonPairs);
-
-  AliDielectronSignalMC* kaonProtonPairs = new AliDielectronSignalMC("kaonProtonPairs","kaon+proton pairs");   // mis-id kaon + mis-id proton
-  kaonProtonPairs->SetLegPDGs(321,2212);
-  kaonProtonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(kaonProtonPairs);
-
-  AliDielectronSignalMC* protonProtonPairs = new AliDielectronSignalMC("protonProtonPairs","proton+proton pairs");  // mis-id proton + mis-id proton
-  protonProtonPairs->SetLegPDGs(2212,2212);
-  protonProtonPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(protonProtonPairs);
-
-  AliDielectronSignalMC* muonAllPairs = new AliDielectronSignalMC("muonAllPairs","muon+everything pairs");        // mis-id muon + something else (electron, pion, kaon, proton)
-  muonAllPairs->SetLegPDGs(13,13,kFALSE,kTRUE);
-  muonAllPairs->SetCheckBothChargesLegs(kTRUE,kTRUE);
-//  die->AddSignalMC(muonAllPairs);
-
-
-
-}
-
-
-
-void SetEtaCorrection()
-{
-  if (AliDielectronPID::GetEtaCorrFunction()) return;
 
-  TString list=gSystem->Getenv("LIST");
-  
-  TFile f("$TRAIN_ROOT/jpsi_JPSI/EtaCorrMaps.root");
-  if (!f.IsOpen()) return;
-  TList *keys=f.GetListOfKeys();
-
-  for (Int_t i=0; i<keys->GetEntries(); ++i){
-    TString kName=keys->At(i)->GetName();
-    TPRegexp reg(kName);
-    if (reg.MatchB(list)){
-      printf("Using Eta Correction Function: %s\n",kName.Data());
-      AliDielectronPID::SetEtaCorrFunction((TF1*)f.Get(kName.Data()));
-    }
-  }
-}
+}//void AddMCsignal(AliDielectron *die)