new dielectron tasks from Remi
authortgunji <Taku.Gunji@cern.ch>
Fri, 31 Jan 2014 08:52:05 +0000 (09:52 +0100)
committertgunji <Taku.Gunji@cern.ch>
Fri, 31 Jan 2014 08:52:05 +0000 (09:52 +0100)
PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_Cent.C [new file with mode: 0644]
PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_Peri.C [new file with mode: 0644]
PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_SemiCent1.C [new file with mode: 0644]
PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_SemiCent2.C [new file with mode: 0644]
PWGDQ/dielectron/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C [new file with mode: 0644]
PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C [new file with mode: 0644]

diff --git a/PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_Cent.C b/PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_Cent.C
new file mode 100644 (file)
index 0000000..34ed048
--- /dev/null
@@ -0,0 +1,155 @@
+AliAnalysisTask *AddTask_Remi_LMEEPbPb2011AOD_Cent(Char_t* outputFileName="LMEEoutput.root", Bool_t runAll=kFALSE,Bool_t setMC=kFALSE,Bool_t getFromAlien=kFALSE, Bool_t PIDbaseline=kFALSE, Bool_t rejOnly=kTRUE) {
+
+  Bool_t bESDANA=kFALSE; //Autodetect via InputHandler
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+       Error("AddTask_Remi_LMEEPbPb2011", "No analysis manager found.");
+       return 0;
+  }
+
+
+//  create task and add it to the manager
+//     gSystem->AddIncludePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE");
+
+
+  TString configBasePath("$TRAIN_ROOT/cbaumann_dielectron/");
+  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
+  //  if (trainRoot.IsNull()) configBasePath= "/home/tanizaki/nfs/LMee_Deflection/";
+  if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";
+
+
+  if (getFromAlien &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C .")) &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C ."))
+     ) {
+        configBasePath=Form("%s/",gSystem->pwd());
+  }
+
+  TString configFile("ConfigRemiLMEEPbPb2011AOD.C");
+  TString configLMEECutLib("LMEECutLibRemi.C");
+
+  TString configFilePath(configBasePath+configFile);
+  TString configLMEECutLibPath(configBasePath+configLMEECutLib);
+
+  //AOD Usage currently tested with separate task, to be merged
+  if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011", "no dedicated AOD configuration");
+  }
+  else if (mgr->GetInputEventHandler()->IsA()==AliESDInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011AOD","switching on ESD specific code");
+       bESDANA=kTRUE;
+  }
+
+
+  //Do we have an MC handler?
+  Bool_t hasMC=setMC;
+  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
+       hasMC=kTRUE;
+
+
+
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data()))
+       gROOT->LoadMacro(configLMEECutLibPath.Data());
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data()))
+       gROOT->LoadMacro(configFilePath.Data());
+
+
+  LMEECutLibRemi* cutlib = new LMEECutLibRemi();
+  AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
+  if (!hasMC) task->UsePhysicsSelection();
+  task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SelectCollisionCandidates(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SetRejectPileup();
+  task->SelectCollisionCandidates(AliVEvent::kAny);  
+  task->SetEventFilter(cutlib->GetEventCuts(LMEECutLibRemi::kPbPb2011TPCandTOF)); //
+
+  //load dielectron configuration file
+
+  //add dielectron analysis with different cuts to the task
+
+
+if (rejOnly) {
+
+      AliDielectron *lowmass1=ConfigRemiLMEEPbPb2011AOD(1,hasMC,bESDANA);
+      task->AddDielectron(lowmass1);
+      printf("add: %s\n",lowmass1->GetName());
+
+  
+  //  AliDielectron *lowmass2=ConfigRemiLMEEPbPb2011AOD(2,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass2);
+  //  printf("add: %s\n",lowmass2->GetName());
+
+  
+  //  AliDielectron *lowmass3=ConfigRemiLMEEPbPb2011AOD(3,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass3);
+  //  printf("add: %s\n",lowmass3->GetName());
+
+  
+  //  AliDielectron *lowmass4=ConfigRemiLMEEPbPb2011AOD(4,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass4);
+  //  printf("add: %s\n",lowmass4->GetName());
+
+  
+  //  AliDielectron *lowmass5=ConfigRemiLMEEPbPb2011AOD(5,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass5);
+  //  printf("add: %s\n",lowmass5->GetName());
+
+  
+
+}
+else {
+  AliDielectron *lowmass4=ConfigRemiLMEEPbPb2011AOD(4,hasMC,bESDANA);
+  task->AddDielectron(lowmass4);
+  printf("add: %s\n",lowmass4->GetName());
+
+
+  AliDielectron *lowmass1=ConfigRemiLMEEPbPb2011AOD(1,hasMC,bESDANA);
+  task->AddDielectron(lowmass1);
+  printf("add: %s\n",lowmass1->GetName());
+
+
+if (PIDbaseline) {
+       AliDielectron *lowmass7=ConfigRemiLMEEPbPb2011AOD(7,hasMC,bESDANA);
+       task->AddDielectron(lowmass7);
+       printf("add: %s\n",lowmass7->GetName());
+
+}
+}
+
+  mgr->AddTask(task);
+
+  //create output container
+  AliAnalysisDataContainer *coutput1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_tree",
+               TTree::Class(),
+               AliAnalysisManager::kExchangeContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_out",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist2 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_CF",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist3 =
+       mgr->CreateContainer("Remi_EventStatPbPb2011",
+               TH1D::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+
+  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/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_Peri.C b/PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_Peri.C
new file mode 100644 (file)
index 0000000..ac5d4a3
--- /dev/null
@@ -0,0 +1,155 @@
+AliAnalysisTask *AddTask_Remi_LMEEPbPb2011AOD_Peri(Char_t* outputFileName="LMEEoutput.root", Bool_t runAll=kFALSE,Bool_t setMC=kFALSE,Bool_t getFromAlien=kFALSE, Bool_t PIDbaseline=kFALSE, Bool_t rejOnly=kTRUE) {
+
+  Bool_t bESDANA=kFALSE; //Autodetect via InputHandler
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+       Error("AddTask_Remi_LMEEPbPb2011", "No analysis manager found.");
+       return 0;
+  }
+
+
+//  create task and add it to the manager
+//     gSystem->AddIncludePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE");
+
+
+  TString configBasePath("$TRAIN_ROOT/cbaumann_dielectron/");
+  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
+  //  if (trainRoot.IsNull()) configBasePath= "/home/tanizaki/nfs/LMee_Deflection/";
+  if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";
+
+
+  if (getFromAlien &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C .")) &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C ."))
+      ) {
+    configBasePath=Form("%s/",gSystem->pwd());
+  }
+
+
+  TString configFile("ConfigRemiLMEEPbPb2011AOD.C");
+  TString configLMEECutLib("LMEECutLibRemi.C");
+
+  TString configFilePath(configBasePath+configFile);
+  TString configLMEECutLibPath(configBasePath+configLMEECutLib);
+
+  //AOD Usage currently tested with separate task, to be merged
+  if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011", "no dedicated AOD configuration");
+  }
+  else if (mgr->GetInputEventHandler()->IsA()==AliESDInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011AOD","switching on ESD specific code");
+       bESDANA=kTRUE;
+  }
+
+
+  //Do we have an MC handler?
+  Bool_t hasMC=setMC;
+  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
+       hasMC=kTRUE;
+
+
+
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data()))
+       gROOT->LoadMacro(configLMEECutLibPath.Data());
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data()))
+       gROOT->LoadMacro(configFilePath.Data());
+
+
+  LMEECutLibRemi* cutlib = new LMEECutLibRemi();
+  AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
+  if (!hasMC) task->UsePhysicsSelection();
+  task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SelectCollisionCandidates(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SetRejectPileup();
+  task->SelectCollisionCandidates(AliVEvent::kAny);  
+  task->SetEventFilter(cutlib->GetEventCuts(LMEECutLibRemi::kPbPb2011TPCandTOF)); //
+
+  //load dielectron configuration file
+
+  //add dielectron analysis with different cuts to the task
+
+
+if (rejOnly) {
+
+  //    AliDielectron *lowmass1=ConfigRemiLMEEPbPb2011AOD(1,hasMC,bESDANA);
+  //    task->AddDielectron(lowmass1);
+  //    printf("add: %s\n",lowmass1->GetName());
+
+  
+  //  AliDielectron *lowmass2=ConfigRemiLMEEPbPb2011AOD(2,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass2);
+  //  printf("add: %s\n",lowmass2->GetName());
+
+  
+  //  AliDielectron *lowmass3=ConfigRemiLMEEPbPb2011AOD(3,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass3);
+  //  printf("add: %s\n",lowmass3->GetName());
+
+  
+    AliDielectron *lowmass4=ConfigRemiLMEEPbPb2011AOD(4,hasMC,bESDANA);
+    task->AddDielectron(lowmass4);
+    printf("add: %s\n",lowmass4->GetName());
+
+  
+  //  AliDielectron *lowmass5=ConfigRemiLMEEPbPb2011AOD(5,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass5);
+  //  printf("add: %s\n",lowmass5->GetName());
+
+
+}
+else {
+  AliDielectron *lowmass4=ConfigRemiLMEEPbPb2011AOD(4,hasMC,bESDANA);
+  task->AddDielectron(lowmass4);
+  printf("add: %s\n",lowmass4->GetName());
+
+
+  AliDielectron *lowmass1=ConfigRemiLMEEPbPb2011AOD(1,hasMC,bESDANA);
+  task->AddDielectron(lowmass1);
+  printf("add: %s\n",lowmass1->GetName());
+
+
+if (PIDbaseline) {
+       AliDielectron *lowmass7=ConfigRemiLMEEPbPb2011AOD(7,hasMC,bESDANA);
+       task->AddDielectron(lowmass7);
+       printf("add: %s\n",lowmass7->GetName());
+
+}
+}
+
+  mgr->AddTask(task);
+
+  //create output container
+  AliAnalysisDataContainer *coutput1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_tree",
+               TTree::Class(),
+               AliAnalysisManager::kExchangeContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_out",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist2 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_CF",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist3 =
+       mgr->CreateContainer("Remi_EventStatPbPb2011",
+               TH1D::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+
+  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/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_SemiCent1.C b/PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_SemiCent1.C
new file mode 100644 (file)
index 0000000..acbcc4b
--- /dev/null
@@ -0,0 +1,112 @@
+AliAnalysisTask *AddTask_Remi_LMEEPbPb2011AODSemiCent1(Char_t* outputFileName="LMEEoutput.root", Bool_t runAll=kFALSE,Bool_t setMC=kFALSE,Bool_t getFromAlien=kFALSE, Bool_t PIDbaseline=kFALSE, Bool_t rejOnly=kTRUE) {
+
+  Bool_t bESDANA=kFALSE; //Autodetect via InputHandler
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+       Error("AddTask_Remi_LMEEPbPb2011", "No analysis manager found.");
+       return 0;
+  }
+
+
+//  create task and add it to the manager
+//     gSystem->AddIncludePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE");
+
+
+  TString configBasePath("$TRAIN_ROOT/cbaumann_dielectron/");
+  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
+  //  if (trainRoot.IsNull()) configBasePath= "/home/tanizaki/nfs/LMee_Deflection/";
+  if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";
+
+
+  if (getFromAlien &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C .")) &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C ."))
+      ) {
+    configBasePath=Form("%s/",gSystem->pwd());
+  }
+
+
+  TString configFile("ConfigRemiLMEEPbPb2011AOD.C");
+  TString configLMEECutLib("LMEECutLibRemi.C");
+
+  TString configFilePath(configBasePath+configFile);
+  TString configLMEECutLibPath(configBasePath+configLMEECutLib);
+
+  //AOD Usage currently tested with separate task, to be merged
+  if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011", "no dedicated AOD configuration");
+  }
+  else if (mgr->GetInputEventHandler()->IsA()==AliESDInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011AOD","switching on ESD specific code");
+       bESDANA=kTRUE;
+  }
+
+
+  //Do we have an MC handler?
+  Bool_t hasMC=setMC;
+  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
+       hasMC=kTRUE;
+
+
+
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data()))
+       gROOT->LoadMacro(configLMEECutLibPath.Data());
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data()))
+       gROOT->LoadMacro(configFilePath.Data());
+
+
+  LMEECutLibRemi* cutlib = new LMEECutLibRemi();
+  AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
+  if (!hasMC) task->UsePhysicsSelection();
+  task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SelectCollisionCandidates(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SetRejectPileup();
+  task->SelectCollisionCandidates(AliVEvent::kAny);  
+  task->SetEventFilter(cutlib->GetEventCuts(LMEECutLibRemi::kPbPb2011TPCandTOF)); //
+
+  //load dielectron configuration file
+
+  //add dielectron analysis with different cuts to the task
+
+  AliDielectron *lowmass2=ConfigRemiLMEEPbPb2011AOD(2,hasMC,bESDANA);
+  task->AddDielectron(lowmass2);
+  printf("add: %s\n",lowmass2->GetName());
+
+
+  mgr->AddTask(task);
+
+  //create output container
+  AliAnalysisDataContainer *coutput1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_tree",
+               TTree::Class(),
+               AliAnalysisManager::kExchangeContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_out",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist2 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_CF",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist3 =
+       mgr->CreateContainer("Remi_EventStatPbPb2011",
+               TH1D::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+
+  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/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_SemiCent2.C b/PWGDQ/dielectron/macrosLMEE/AddTask_Remi_LMEEPbPb2011AOD_SemiCent2.C
new file mode 100644 (file)
index 0000000..1dde6f8
--- /dev/null
@@ -0,0 +1,155 @@
+AliAnalysisTask *AddTask_Remi_LMEEPbPb2011AOD_SemiCent2(Char_t* outputFileName="LMEEoutput.root", Bool_t runAll=kFALSE,Bool_t setMC=kFALSE,Bool_t getFromAlien=kFALSE, Bool_t PIDbaseline=kFALSE, Bool_t rejOnly=kTRUE) {
+
+  Bool_t bESDANA=kFALSE; //Autodetect via InputHandler
+  //get the current analysis manager
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+       Error("AddTask_Remi_LMEEPbPb2011", "No analysis manager found.");
+       return 0;
+  }
+
+
+//  create task and add it to the manager
+//     gSystem->AddIncludePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE");
+
+
+  TString configBasePath("$TRAIN_ROOT/cbaumann_dielectron/");
+  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");
+  //  if (trainRoot.IsNull()) configBasePath= "/home/tanizaki/nfs/LMee_Deflection/";
+  if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";
+
+
+  if (getFromAlien &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C .")) &&
+      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/c/cbaumann/PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C ."))
+      ) {
+    configBasePath=Form("%s/",gSystem->pwd());
+  }
+
+
+  TString configFile("ConfigRemiLMEEPbPb2011AOD.C");
+  TString configLMEECutLib("LMEECutLibRemi.C");
+
+  TString configFilePath(configBasePath+configFile);
+  TString configLMEECutLibPath(configBasePath+configLMEECutLib);
+
+  //AOD Usage currently tested with separate task, to be merged
+  if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011", "no dedicated AOD configuration");
+  }
+  else if (mgr->GetInputEventHandler()->IsA()==AliESDInputHandler::Class()){
+       ::Info("AddTaskLMEEPbPb2011AOD","switching on ESD specific code");
+       bESDANA=kTRUE;
+  }
+
+
+  //Do we have an MC handler?
+  Bool_t hasMC=setMC;
+  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
+       hasMC=kTRUE;
+
+
+
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data()))
+       gROOT->LoadMacro(configLMEECutLibPath.Data());
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data()))
+       gROOT->LoadMacro(configFilePath.Data());
+
+
+  LMEECutLibRemi* cutlib = new LMEECutLibRemi();
+  AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
+  if (!hasMC) task->UsePhysicsSelection();
+  task->SetTriggerMask(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SelectCollisionCandidates(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral);
+//  task->SetRejectPileup();
+  task->SelectCollisionCandidates(AliVEvent::kAny);  
+  task->SetEventFilter(cutlib->GetEventCuts(LMEECutLibRemi::kPbPb2011TPCandTOF)); //
+
+  //load dielectron configuration file
+
+  //add dielectron analysis with different cuts to the task
+
+
+if (rejOnly) {
+
+  //    AliDielectron *lowmass1=ConfigRemiLMEEPbPb2011AOD(1,hasMC,bESDANA);
+  //    task->AddDielectron(lowmass1);
+  //    printf("add: %s\n",lowmass1->GetName());
+
+  
+  //    AliDielectron *lowmass2=ConfigRemiLMEEPbPb2011AOD(2,hasMC,bESDANA);
+  //    task->AddDielectron(lowmass2);
+  //    printf("add: %s\n",lowmass2->GetName());
+
+  
+      AliDielectron *lowmass3=ConfigRemiLMEEPbPb2011AOD(3,hasMC,bESDANA);
+      task->AddDielectron(lowmass3);
+      printf("add: %s\n",lowmass3->GetName());
+
+  
+  //  AliDielectron *lowmass4=ConfigRemiLMEEPbPb2011AOD(4,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass4);
+  //  printf("add: %s\n",lowmass4->GetName());
+
+  
+  //  AliDielectron *lowmass5=ConfigRemiLMEEPbPb2011AOD(5,hasMC,bESDANA);
+  //  task->AddDielectron(lowmass5);
+  //  printf("add: %s\n",lowmass5->GetName());
+
+
+}
+else {
+  AliDielectron *lowmass4=ConfigRemiLMEEPbPb2011AOD(4,hasMC,bESDANA);
+  task->AddDielectron(lowmass4);
+  printf("add: %s\n",lowmass4->GetName());
+
+
+  AliDielectron *lowmass1=ConfigRemiLMEEPbPb2011AOD(1,hasMC,bESDANA);
+  task->AddDielectron(lowmass1);
+  printf("add: %s\n",lowmass1->GetName());
+
+
+if (PIDbaseline) {
+       AliDielectron *lowmass7=ConfigRemiLMEEPbPb2011AOD(7,hasMC,bESDANA);
+       task->AddDielectron(lowmass7);
+       printf("add: %s\n",lowmass7->GetName());
+
+}
+}
+
+  mgr->AddTask(task);
+
+  //create output container
+  AliAnalysisDataContainer *coutput1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_tree",
+               TTree::Class(),
+               AliAnalysisManager::kExchangeContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist1 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_out",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist2 =
+       mgr->CreateContainer("Remi_LMEEPbPb2011_CF",
+               TList::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+  AliAnalysisDataContainer *cOutputHist3 =
+       mgr->CreateContainer("Remi_EventStatPbPb2011",
+               TH1D::Class(),
+               AliAnalysisManager::kOutputContainer,
+               outputFileName);
+
+
+  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/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C b/PWGDQ/dielectron/macrosLMEE/ConfigRemiLMEEPbPb2011AOD.C
new file mode 100644 (file)
index 0000000..212c632
--- /dev/null
@@ -0,0 +1,504 @@
+//#include "PWGDQ/dielectron/macrosLMEE/LMEECutLib.C"
+
+void InitHistograms(AliDielectron *die, Int_t cutDefinition);
+void InitCF(AliDielectron* die, Int_t cutDefinition);
+void EnableMC();
+
+TString names=("noPairing;TPCTOFCentnoRej;TPCTOFSemiCent1noRej;TPCTOFSemiCent2noRej;TPCTOFPerinoRej;TPCTOFAllCentnoRej;TPCTOFCentRej;TPCTOFSemiCent1Rej;TPCTOFSemiCent2Rej;TPCTOFPeriRej;TPCTOFAllCentRej;");
+TObjArray *arrNames=names.Tokenize(";");
+const Int_t nDie=arrNames->GetEntries();
+
+Bool_t MCenabled=kFALSE;
+
+
+AliDielectron* ConfigRemiLMEEPbPb2011AOD(Int_t cutDefinition, Bool_t hasMC=kFALSE, Bool_t ESDanalysis=kFALSE)
+{
+
+  Int_t selectedPID=-1;
+  Int_t selectedCentrality=-1;
+  Int_t selectedPairCut=-1;
+  Bool_t rejectionStep=kFALSE;
+  Bool_t PairCut=kFALSE;
+  LMEECutLibRemi*  LMCL = new LMEECutLibRemi();
+
+  //
+  // Setup the instance of AliDielectron
+  //
+
+  MCenabled=hasMC;
+
+  // create the actual framework object
+
+  TString name=Form("%02d",cutDefinition);
+  if ((cutDefinition)<arrNames->GetEntriesFast()){
+       name=arrNames->At((cutDefinition))->GetName();
+  }
+
+  //thisCut only relevant for MC:
+  AliDielectron *die =
+       new AliDielectron(Form
+               ("%s",name.Data()),
+               Form("Track cuts: %s",name.Data()));
+  //      die->SetZDCRecenteringFilename("/home/tanizaki/nfs/ZDCrpH1Recentering/ZDCRecenteringProfile.root");
+  //  die->SetZDCRecenteringFilename("alien:///alice/cern.ch/user/r/rtanizak/ZDCrpH1/ZDCRecentProf/ZDCRecenteringProfile.root")
+
+  //Setup AnalysisSelection:
+  if (cutDefinition==0) {
+       //not yet implemented
+  }
+  else if (cutDefinition==1) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011Central;
+    rejectionStep = kFALSE;
+    PairCut = kFALSE;
+
+  }
+  else if (cutDefinition==2) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral1;
+    rejectionStep = kFALSE;
+    PairCut = kFALSE;
+
+  }
+  else if (cutDefinition==3) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral2;
+    rejectionStep = kFALSE;
+    PairCut = kFALSE;
+
+  }
+  else if (cutDefinition==4) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011Peripheral;
+    rejectionStep = kFALSE;
+    PairCut = kFALSE;
+
+  }
+  else if (cutDefinition==5) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011AllCentral;
+    rejectionStep = kFALSE;
+    PairCut = kFALSE;
+
+  }
+
+  else if (cutDefinition==6) {
+       selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+       selectedCentrality = LMEECutLibRemi::kPbPb2011Central;
+       rejectionStep = kFALSE;
+        PairCut = kTRUE;
+
+  }
+  else if (cutDefinition==7) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral1;
+    rejectionStep = kFALSE;
+    PairCut = kTRUE;
+
+  }
+  else if (cutDefinition==8) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011SemiCentral2;
+    rejectionStep = kFALSE;
+    PairCut = kTRUE;
+
+  }
+  else if (cutDefinition==9) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011Peripheral;
+    rejectionStep = kFALSE;
+    PairCut = kTRUE;
+
+  }
+  else if (cutDefinition==10) {
+    selectedPID = LMEECutLibRemi::kPbPb2011TPCandTOFwide;
+    selectedCentrality = LMEECutLibRemi::kPbPb2011AllCentral;
+    rejectionStep = kFALSE;
+    PairCut = kTRUE;
+
+  }
+
+  else {
+       cout << " =============================== " << endl;
+       cout << " ==== INVALID CONFIGURATION ==== " << endl;
+       cout << " =============================== " << endl;
+  }
+
+
+  //Now configure task
+
+  //Apply correct Pre-Filter Scheme, if necessary
+  die->SetPreFilterAllSigns();
+
+  //switch off KF PArticle:
+  die->SetUseKF(kFALSE);
+
+  if (selectedPID == LMEECutLibRemi::kPbPb2011NoPID) {
+         die->SetNoPairing();
+   }
+
+  if (rejectionStep) {
+    if (ESDanalysis) {
+      die->GetTrackFilter().AddCuts( LMCL->GetESDTrackCutsAna(selectedPID) );
+      die->GetPairPreFilterLegs().AddCuts( LMCL->GetESDTrackCutsAna(selectedPID) );
+    }
+
+    //die->GetTrackFilter().AddCuts(LMCL->GetPIDCutsPre(selectedPID) );
+    die->GetTrackFilter().AddCuts(LMCL->GetPIDCutsAna(selectedPID) );
+    die->GetPairPreFilterLegs().AddCuts(LMCL->GetPIDCutsAna(selectedPID) );
+    die->GetPairPreFilter().AddCuts(LMCL->GetPairCuts(selectedPID) );
+
+    //    if(PairCut){
+    //      die->GetPairFilter().AddCuts( LMCL->GetPairCutsInvMass(selectedPairCut));
+    //    }
+  }
+  else { //No Prefilter, no Pairfilter
+    
+    if (ESDanalysis) {
+      die->GetTrackFilter().AddCuts( LMCL->GetESDTrackCutsAna(selectedPID) );
+    }
+    
+    die->GetTrackFilter().AddCuts( LMCL->GetTrackCutsAna(selectedPID) );
+    die->GetTrackFilter().AddCuts( LMCL->GetPIDCutsAna(selectedPID) );
+    die->GetEventFilter().AddCuts(LMCL->GetCentralityCuts(selectedCentrality));
+    
+    //    if(PairCut){
+    //      die->GetPairFilter().AddCuts( LMCL->GetPairCutsInvMass(selectedPairCut));
+    //    }
+    die->GetPairFilter().AddCuts(LMCL->GetPairCuts2(selectedPID,kFALSE));
+    
+  }
+  //Introduce NULL-check for pp?
+  die->GetEventFilter().AddCuts(LMCL->GetCentralityCuts(selectedCentrality));
+
+
+
+
+  AliDielectronTrackRotator *rot= 0x0;
+  /*AliDielectronTrackRotator *rot= LMCL->GetTrackRotator(selectedPID);
+  die->SetTrackRotator(rot);
+   */
+  AliDielectronMixingHandler *mix=LMCL->GetMixingHandler(selectedPID);
+  die->SetMixingHandler(mix);
+
+  // histogram setup
+  // only if an AliDielectronHistos object is attached to the
+  // dielectron framework histograms will be filled
+  //
+  InitHistograms(die,cutDefinition);
+
+  // the last definition uses no cuts and only the QA histograms should be filled!
+//  InitCF(die,cutDefinition);
+
+  return die;
+}
+
+//______________________________________________________________________________________
+
+void InitHistograms(AliDielectron *die, Int_t cutDefinition)
+{
+  //
+  // Initialise the histograms
+  //
+
+  //Setup histogram Manager
+  AliDielectronHistos *histos=
+       new AliDielectronHistos(die->GetName(),
+               die->GetTitle());
+  //Initialise histogram classes
+  histos->SetReservedWords("Track;Pair;Pre;RejTrack;RejPair");
+
+  //Event class
+//  if (cutDefinition==nDie-1) 
+               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)));
+  }
+
+  //ME and track rot
+  if (die->GetMixingHandler()) {
+       histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(3)));
+       histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(4)));
+       histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(6)));
+       histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(7)));
+  }
+  if (die->GetTrackRotator()) {
+       histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(10)));
+  }
+
+  //PreFilter Classes
+  //to fill also track info from 2nd event loop until 2
+  for (Int_t i=0; i<2; ++i){
+       histos->AddClass(Form("Pre_%s",AliDielectron::TrackClassName(i)));
+  }
+
+
+  //Create Classes for Rejected Tracks/Pairs:
+  for (Int_t i=0; i<2; ++i){
+       histos->AddClass(Form("RejTrack_%s",AliDielectron::TrackClassName(i)));
+  }
+  for (Int_t i=0; i<3; ++i){
+       histos->AddClass(Form("RejPair_%s",AliDielectron::PairClassName(i)));
+  }
+
+  /*
+  //track rotation
+
+  histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(AliDielectron::kEv1PMRot)));
+  histos->AddClass(Form("Track_Legs_%s",AliDielectron::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","Centrality","Centrality;Centrality [%]","0,10,20,40,80,100,101",
+               AliDielectronVarManager::kCentrality);
+       /*        histos->UserHistogram("Event","v0ACrpH2","VZERO-AC;v0ACrpH2",
+                             100,-2.0,2.0,
+                             AliDielectronVarManager::kv0ACrpH2);
+        histos->UserHistogram("Event","v0ArpH2","VZERO-A;v0ArpH2",
+                             100,-2.0,2.0,
+                             AliDielectronVarManager::kv0ArpH2);
+        histos->UserHistogram("Event","v0CrpH2","VZERO-C;v0CrpH2",
+                             100,-2.0,2.0,
+                             AliDielectronVarManager::kv0CrpH2);
+        histos->UserHistogram("Event","v0ArpH2_vs_v0CrpH2","VZERO-A vs VZERO-C;v0ArpH2;v0CrpH2",
+                              100,-2.0,2.0,100, -2.0, 2.0,
+                              AliDielectronVarManager::kv0ArpH2,AliDielectronVarManager::kv0CrpH2);
+       //      histos->UserHistgram("Event","resov0ACrpH2","VZERO-A;v0ArpH2",
+       //                           100, -2.0,2.0, AliDielectronVarManager::kresov0ACrpH2);
+       */
+
+       histos->UserHistogram("Event","ZDCArpH1","ZDC-ZN-A;ZDCrpH1",
+                              100,-3.5,3.5,
+                              AliDielectronVarManager::kZDCArpH1);
+       /*        histos->UserHistogram("Event","ZDCrpResH1","ZDC;ZDCrpResH1",
+                              100,-3.5,3.5,
+                              AliDielectronVarManager::kZDCrpResH1);
+       histos->UserHistogram("Event","v0ZDCrpRes","ZDC;v0ZDCrpRes",
+                              100,-3.5,3.5,
+                              AliDielectronVarManager::kv0ZDCrpRes);
+       */
+        histos->UserProfile("Event","ZDCrpResH1Prof","ZDC;ZDCrpResH1",
+                           AliDielectronVarManager::kZDCrpResH1, 
+                           10, 0, 100,
+                              AliDielectronVarManager::kCentrality);
+    
+        histos->UserProfile("Event","v0ZDCrpResProf","ZDC;v0ZDCrpRes",
+                            AliDielectronVarManager::kv0ZDCrpRes,
+                            10, 0, 100,
+                           AliDielectronVarManager::kCentrality);
+       
+       
+       histos->UserHistogram("Event","RefMult","RefMultiplicity;Multiplixity",
+                             100,-3.5,3.5,
+                             AliDielectronVarManager::kRefMult);
+       histos->UserHistogram("Event","kXvPrim","VertexX;vertex_x",
+                             100,0.03,0.1,
+                             AliDielectronVarManager::kXvPrim);
+       histos->UserHistogram("Event","kYvPrim","VartexY;vertex_y",
+                             100,0.2,0.3,
+                             AliDielectronVarManager::kYvPrim);
+       
+
+
+        histos->UserHistogram("Pair","InvMassAllPairplaneMagInPro","Inner Product of Mag and ee plane vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
+                             1000, 0.0,1.0,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
+       histos->UserHistogram("Pair","InvMassLowPairplaneMagInPro","ee plane Mag component vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
+                             300, 0.0,0.03,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
+       histos->UserHistogram("Pair","InvMassMiddlePairplaneMagInPro","ee plane Mag component vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
+                              180,0.12, 0.3,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
+       histos->UserHistogram("Pair","InvMassHighPairplaneMagInPro","ee plane Mag component vs Inv.Mass;Inv. Mass [GeV];Phi [rad]",
+                              200, 0.3, 0.5,100,-2.0,2.0,AliDielectronVarManager::kM,AliDielectronVarManager::kPairPlaneMagInPro);
+
+
+        histos->UserHistogram("Pair","PtAllPairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
+                              500,0.0,10.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
+        histos->UserHistogram("Pair","PtLowPairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
+                             100,0.0,1.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
+        histos->UserHistogram("Pair","PtMiddlePairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
+                             100,1.0,2.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
+        histos->UserHistogram("Pair","PtHighPairplaneMagInPro","ee plane Mag component vs Pt;Pt [GeV];Phi [rad]",
+                             200,2.0,10.0,100,-2.0,2.0,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
+
+
+       /*      histos->UserHistogram("Pair","AllInvMassPtPairplaneMagInPro","ee plane Mag component",
+                             1000,0.0 ,0.5,500,0.0,10.0,100,-2.0,2.0,
+                             AliDielectronVarManager::kM,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro,
+                             kFALSE,kFALSE,kFALSE,999);
+       */
+
+       
+       //              histos->UserHistogram("Pair","AllInvMassPtPairplaneMagInPro","ee plane Mag component vs Pt;Inv.Mass[GeV];Pt [GeV];Phi [rad]",
+       //                                    1000,0.0,0.5,500,0.0,10.0,100,-2.0,2.0,
+       //                                    AliDielectronVarManager::kM,AliDielectronVarManager::kPt,AliDielectronVarManager::kPairPlaneMagInPro);
+       
+
+  //add histograms to Track classes
+       /*  histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Track","Px","Px;Px [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPx);
+  histos->UserHistogram("Track","Py","Py;Py [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPy);
+  histos->UserHistogram("Track","Pz","Pz;Pz [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPz);
+  histos->UserHistogram("Track","P","P;P [GeV];#tracks",200,0,20.,AliDielectronVarManager::kP);
+       */
+  /*
+  histos->UserHistogram("Track","NclsSFracTPC","NclsSFracTPC; NclsSFracTPC;#tracks",200,0,10.,AliDielectronVarManager::kNclsSFracTPC);
+  histos->UserHistogram("Track","TPCclsDiff","TPCclsDiff; TPCclsDiff;#tracks",200,0,10.,AliDielectronVarManager::kTPCclsDiff);
+
+  histos->UserHistogram("Track","ITS_dEdx_P","ITS_dEdx;P [GeV];ITS signal (arb units);#tracks",
+         400,0.0,20.,1000,0.,1000.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal,kTRUE);
+
+  histos->UserHistogram("Track","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
+         400,0.0,20.,200,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",
+         400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+  histos->UserHistogram("Track","TPCnSigmaKao_P","TPC number of sigmas Kaons;P [GeV];TPC number of sigmas Kaons;#tracks",
+         400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,kTRUE);
+  histos->UserHistogram("Track","TPCnSigmaPio_P","TPC number of sigmas Pions;P [GeV];TPC number of sigmas Pions;#tracks",
+         400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,kTRUE);
+
+  histos->UserHistogram("Track","TRDpidPobEle_P","TRD PID probability Electrons;P [GeV];TRD prob Electrons;#tracks",
+         400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobEle,kTRUE);
+  histos->UserHistogram("Track","TRDpidPobPio_P","TRD PID probability Pions;P [GeV];TRD prob Pions;#tracks",
+         400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobPio,kTRUE);
+
+  histos->UserHistogram("Track","TOFnSigmaKao_P","TOF number of sigmas Kaons;P [GeV];TOF number of sigmas Kaons;#tracks",
+         400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaKao,kTRUE);
+  histos->UserHistogram("Track","TOFnSigmaPro_P","TOF number of sigmas Protons;P [GeV];TOF number of sigmas Protons;#tracks",
+         400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaPro,kTRUE);
+
+  histos->UserHistogram("Track","TOFbeta","TOF beta;P [GeV];TOF beta;#tracks",
+         400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta,kTRUE);
+
+
+  histos->UserHistogram("Track","Eta","Eta; Eta;#tracks",
+         200,-2,2,AliDielectronVarManager::kEta);
+  histos->UserHistogram("Track","Phi","Phi; Phi;#tracks",
+         200,0.,3.15,AliDielectronVarManager::kPhi);
+
+  histos->UserHistogram("Track","Eta_Phi","Eta Phi Map; Eta; Phi;#tracks",
+         200,-2,2,200,0,3.15,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+
+  histos->UserHistogram("Track","dXY_dZ","dXY dZ Map; dXY; dZ;#tracks",
+         200,-2,2,200,-2,2.,AliDielectronVarManager::kImpactParXY,AliDielectronVarManager::kImpactParZ);
+
+
+  histos->UserHistogram("Track","dXY","dXY;dXY [cm];#tracks",200,-2.,2.,AliDielectronVarManager::kImpactParXY);
+  histos->UserHistogram("Track","dZ","dZ;dZ [cm];#tracks",200,-2.,2.,AliDielectronVarManager::kImpactParZ);
+
+         histos->UserHistogram("Track","TPCcrossedRowsOverFindable","Number of Crossed Rows TPC over Findable;TPC crossed rows over findable;#tracks",100,0.,1.,AliDielectronVarManager::kNFclsTPCfCross);
+         histos->UserHistogram("Track","TPCcrossedRows","Number of Crossed Rows TPC;TPC crossed rows;#tracks",159,0.,159.,AliDielectronVarManager::kNFclsTPCr);
+         histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",159,0.,159.,AliDielectronVarManager::kNclsTPC);
+         histos->UserHistogram("Track","ITSnCls","Number of Clusters ITS;ITS number clusteres;#tracks",159,0.,159.,AliDielectronVarManager::kNclsITS);
+
+         histos->UserHistogram("Track","TPCchi2","TPC Chi2 value;TPC chi2;#tracks",100,0.,10.,AliDielectronVarManager::kTPCchi2Cl);
+         histos->UserHistogram("Track","ITSchi2","ITS Chi2 value;ITS chi2;#tracks",100,0.,10.,AliDielectronVarManager::kITSchi2Cl);
+
+         histos->UserHistogram("Track","TPCnCls_kNFclsTPCr","nTPC vs nTPCr;nTPC vs nTPCr;#tracks",159,0.,159.,159,0.,159.,AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kNFclsTPCr);
+
+         histos->UserHistogram("Track","kNFclsTPCr_pT","nTPCr vs pt;nTPCr vs pt;#tracks",159,0.,159.,200,0.,20.,AliDielectronVarManager::kNFclsTPCr,AliDielectronVarManager::kPt);
+
+  */
+         //add histograms to Pair classes
+         histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
+                 500,0.0,5.00,AliDielectronVarManager::kM);
+         histos->UserHistogram("Pair","Rapidity","Rapidity;Rapidity;#pairs",
+                 100,-2.,2.,AliDielectronVarManager::kY);
+         histos->UserHistogram("Pair","OpeningAngle","Opening angle;angle",
+                 100,0.,3.15,AliDielectronVarManager::kOpeningAngle);
+         //2D Histo Plot
+         histos->UserHistogram("Pair","InvMassPairPt","Inv.Mass vs PairPt;Inv. Mass [GeV], pT [GeV];#pairs",
+                 500,0.0,5.0,500,0.,50.,AliDielectronVarManager::kM,AliDielectronVarManager::kPt);
+
+         histos->UserHistogram("Pair","InvMassOpeningAngle","Opening Angle vs Inv.Mass;Inv. Mass [GeV];#pairs",
+                 500,0.0,5.0,200,0.,6.3,AliDielectronVarManager::kM,AliDielectronVarManager::kOpeningAngle);
+         /*
+         //add histograms to Track classes
+         histos->UserHistogram("Pre","Pt","Pt;Pt [GeV];#tracks",200,0,20.,AliDielectronVarManager::kPt);
+
+         histos->UserHistogram("Pre","ITS_dEdx_P","ITS_dEdx;P [GeV];ITS signal (arb units);#tracks",
+                 400,0.0,20.,1000,0.,1000.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kITSsignal,kTRUE);
+
+         histos->UserHistogram("Pre","dEdx_P","dEdx;P [GeV];TPC signal (arb units);#tracks",
+                 400,0.0,20.,200,0.,200.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,kTRUE);
+
+
+         histos->UserHistogram("Pre","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons;#tracks",
+                 400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,kTRUE);
+         histos->UserHistogram("Pre","TPCnSigmaKao_P","TPC number of sigmas Kaons;P [GeV];TPC number of sigmas Kaons;#tracks",
+                 400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,kTRUE);
+         histos->UserHistogram("Pre","TPCnSigmaPio_P","TPC number of sigmas Pions;P [GeV];TPC number of sigmas Pions;#tracks",
+                 400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,kTRUE);
+
+         histos->UserHistogram("Pre","TRDpidPobEle_P","TRD PID probability Electrons;P [GeV];TRD prob Electrons;#tracks",
+                 400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobEle,kTRUE);
+         histos->UserHistogram("Pre","TRDpidPobPio_P","TRD PID probability Pions;P [GeV];TRD prob Pions;#tracks",
+                 400,0.0,20.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobPio,kTRUE);
+
+         histos->UserHistogram("Pre","TOFnSigmaKao_P","TOF number of sigmas Kaons;P [GeV];TOF number of sigmas Kaons;#tracks",
+                 400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaKao,kTRUE);
+         histos->UserHistogram("Pre","TOFnSigmaPro_P","TOF number of sigmas Protons;P [GeV];TOF number of sigmas Protons;#tracks",
+                 400,0.0,20.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaPro,kTRUE);
+
+         histos->UserHistogram("Pre","Eta_Phi","Eta Phi Map; Eta; Phi;#tracks",
+                 200,-2,2,200,0,3.15,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+
+         histos->UserHistogram("Pre","dXY","dXY;dXY [cm];#tracks",200,-2.,2.,AliDielectronVarManager::kImpactParXY);
+
+  histos->UserHistogram("Pre","ZVertex ","ZVertex ;ZVertex[cm];#tracks",20,-20,20,AliDielectronVarManager::kZv);
+  histos->UserHistogram("Pre","XVertex ","XVertex ;XVertex[cm];#tracks",20,-20,20,AliDielectronVarManager::kXv);
+  histos->UserHistogram("Pre","YVertex ","YVertex ;YVertex[cm];#tracks",20,-20,20,AliDielectronVarManager::kYv);
+
+  histos->UserHistogram("Pre","TPCnCls","Number of Clusters TPC;TPC number clusteres;#tracks",159,0.,159.,AliDielectronVarManager::kNclsTPC);
+         */
+  //add histograms to Pair classes For Rejected Pairs:
+  die->SetHistogramManager(histos);
+}
+
+
+void InitCF(AliDielectron* die, Int_t cutDefinition)
+{
+  //
+  // Setupd the CF Manager if needed
+  //
+  AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
+
+  //pair variables
+  cf->AddVariable(AliDielectronVarManager::kP,200,0,20);
+  cf->AddVariable(AliDielectronVarManager::kM,201,-0.01,4.01); //20Mev Steps
+  cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);
+
+  cf->AddVariable(AliDielectronVarManager::kCentrality,"0.,10.0,30.0,40.0,60.,80.,100.");
+
+  //leg variables
+  cf->AddVariable(AliDielectronVarManager::kP,200,0.,20.,kTRUE);
+    cf->AddVariable(AliDielectronVarManager::kITSsignal,1000,0.0.,1000.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCsignal,500,0.0.,500.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10,kTRUE);
+
+  //only in this case write MC truth info
+  if (MCenabled) {
+       cf->SetStepForMCtruth();
+       cf->SetStepsForMCtruthOnly();
+       cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
+       cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
+  }
+
+  cf->SetStepsForSignal();
+  die->SetCFManagerPair(cf);
+}
+
+//--------------------------------------
+void EnableMC() {
+  MCenabled=kTRUE;
+}
+
diff --git a/PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C b/PWGDQ/dielectron/macrosLMEE/LMEECutLibRemi.C
new file mode 100644 (file)
index 0000000..97ce54a
--- /dev/null
@@ -0,0 +1,553 @@
+class LMEECutLibRemi {
+
+  public:
+       static  enum LMMECutSet {
+               kPbPb2011NoPID,
+               kPbPb2011TPCandTOF,
+               kPbPb2011TPCandTOFHPT,
+               kPbPb2011TPC, //TOF required, more relaxed cut on TPC
+               kPbPb2011TPCandTOFwide, //TOF required, more relaxed cut on TPC
+               kPbPb2011TPCorTOF,
+               kpp2010TPCandTOF,
+               kpp2010TPCorTOF,
+               kCUTSETMAX
+       };
+
+       static  enum LMMECentSel {
+               kPbPb2011Central,
+               kPbPb2011SemiCentral1,
+                kPbPb2011SemiCentral2,
+               kPbPb2011Peripheral,
+                kPbPb2011AllCentral,
+                kCENTSELMAX
+       };
+
+        static  enum LMEEPairCutSet{
+               kPbPb2011MassLow,
+               kPbPb2011MassMiddle,
+               kPbPb2011MassHigh,
+               kPbPb2011MassAll,
+               
+               kPAIRCUTSETMAX
+       };
+
+
+
+       //char* LMEECutNames[kCUTSETMAX] = { "PbPb2011TPCandTOF","PbPb2011TPCorTOF"};
+
+
+       LMEECutLib() {}
+
+       AliDielectronEventCuts*     GetEventCuts(Int_t cutSet);
+       AliAnalysisCuts*            GetCentralityCuts(Int_t centSel);
+       AliDielectronTrackRotator*  GetTrackRotator(Int_t cutSet);
+       AliDielectronMixingHandler* GetMixingHandler(Int_t cutSet);
+
+       AliAnalysisCuts* GetPIDCutsAna(Int_t cutSet);  
+       AliAnalysisCuts* GetPIDCutsPre(Int_t cutSet);  
+
+       AliAnalysisCuts* GetPairCuts2(Int_t cutSet,Bool_t tooglePC=kFALSE);
+       AliAnalysisCuts* GetPairCuts(Int_t cutSet);  
+        AliAnalysisCuts* GetPairCutsInvMass(Int_t cutSet);
+
+       AliAnalysisCuts* GetTrackCutsAna(Int_t cutSet);  
+       AliAnalysisCuts* GetTrackCutsPre(Int_t cutSet);  
+
+
+
+
+       AliDielectronEventCuts* GetEventCuts(Int_t cutSet) {
+         AliDielectronEventCuts* eventCuts = 0x0;
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+                 eventCuts=new AliDielectronEventCuts("eventCuts","Vertex Track && |vtxZ|<10 && ncontrib>0");
+                 eventCuts->SetVertexType(AliDielectronEventCuts::kVtxSPD); // AOD
+                 //eventCuts->SetVertexType(AliDielectronEventCuts::kVtxTPC); // AOD
+                 //           eventCuts->SetCentralityRange(0.0,80.0);
+                 eventCuts->SetRequireVertex();
+                 eventCuts->SetMinVtxContributors(1);
+                 eventCuts->SetVertexZ(-10.,10.);
+                 break;
+               default: cout << "No Event Cut defined" << endl;
+         }
+         return eventCuts;
+       }
+
+       AliAnalysisCuts* GetCentralityCuts(Int_t centSel) {
+         AliDielectronVarCuts* centCuts = 0x0;
+         switch (centSel) {
+               case kPbPb2011Central:
+                 centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011Central");
+                 centCuts->AddCut(AliDielectronVarManager::kCentrality,0.,10.);
+                 break;
+               case kPbPb2011SemiCentral1:
+                 centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011SemiCentral1");
+                 //Restrict to 50%, Trigger selction
+                 centCuts->AddCut(AliDielectronVarManager::kCentrality,10.,30.);
+                 break;
+                case kPbPb2011SemiCentral2:
+                 centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011SemiCentral2");
+                 //Restrict to 50%, Trigger selction
+                 centCuts->AddCut(AliDielectronVarManager::kCentrality,30.,50.);//
+                 break;
+
+               case kPbPb2011Peripheral:
+                 centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011Peripheral");
+                 centCuts->AddCut(AliDielectronVarManager::kCentrality,50.,90.);
+                 break;
+                 
+               case kPbPb2011AllCentral:
+                 centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011AllCentral");
+                 centCuts->AddCut(AliDielectronVarManager::kCentrality,0.,100.);
+                 break;
+
+                       default: cout << "No Centrality selected" << endl;
+
+
+         }
+         return centCuts;
+       }
+
+
+       AliDielectronTrackRotator* GetTrackRotator(Int_t cutSet) {
+         AliDielectronTrackRotator* trackRotator = 0x0;
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+                 trackRotator = new AliDielectronTrackRotator();
+                 trackRotator->SetIterations(20);
+                 trackRotator->SetConeAnglePhi(TMath::Pi()/180*165);
+                 trackRotator->SetStartAnglePhi(TMath::Pi());
+                 break;
+               default: cout << "No Rotator defined" << endl;
+         }
+         return trackRotator;
+       }
+
+
+       AliDielectronMixingHandler* GetMixingHandler(Int_t cutSet) {
+         AliDielectronMixingHandler* mixingHandler = 0x0;
+         switch (cutSet) {
+               case kPbPb2011TPCorTOF  :
+/*
+                 mixingHandler = new AliDielectronMixingHandler;
+                 mixingHandler->AddVariable(AliDielectronVarManager::kZvPrim,"-10,-5,0,5,10");
+                 mixingHandler->AddVariable(AliDielectronVarManager::kCentrality,"0,5,10,20,40,80");
+                 mixingHandler->SetDepth(25);
+                 mixingHandler->SetMixType(AliDielectronMixingHandler::kAll);
+                 break;
+*/
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+                 mixingHandler = new AliDielectronMixingHandler;
+                 mixingHandler->AddVariable(AliDielectronVarManager::kZvPrim,"-10,-5,0,5,10");
+                 mixingHandler->AddVariable(AliDielectronVarManager::kCentrality,"0,5,10,20,40,80");
+                  mixingHandler->AddVariable(AliDielectronVarManager::kv0ACrpH2,"-6*(TMath::Pi()/6),-5*(TMath::Pi()/6),-4*(TMath::Pi()/6),-3*(TMath::Pi()/6),-2*(TMath::Pi()/6),-1*(TMath::Pi()/6),0,1*(TMath::Pi()/6),2*(TMath::Pi()/6),3*(TMath::Pi()/6),4*(TMath::Pi()/6),5*(TMath::Pi()/6),6*(TMath::Pi()/6)");
+                 //mixingHandler->SetDepth(50);
+                 mixingHandler->SetDepth(15);
+                 mixingHandler->SetMixType(AliDielectronMixingHandler::kAll);
+                 break;
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+                 mixingHandler = new AliDielectronMixingHandler;
+                 mixingHandler->AddVariable(AliDielectronVarManager::kZvPrim,"-10,-5,0,5,10");
+                 mixingHandler->AddVariable(AliDielectronVarManager::kNacc,"0,10000");
+                 //might want to add multiplicity?
+                 mixingHandler->SetDepth(50);
+                 mixingHandler->SetMixType(AliDielectronMixingHandler::kAll);
+                 break;
+               default: cout << "No Rotator defined" << endl;
+         }
+         return mixingHandler;
+       }
+
+
+       AliAnalysisCuts* GetPIDCutsAna(Int_t cutSet) {
+         AliAnalysisCuts* anaCuts=0x0;
+
+         // + [2] added for Dec2010 Cut! 
+         TF1 *lowerCut = new TF1("lowerCut", "[0] * TMath::Exp([1]*x) + [2]", 0, 20);
+         /* until Nov2010
+                lowerCut->SetParameter(0, -2.7);
+                lowerCut->SetParameter(1, -0.4357);
+          */
+         /* 18.01.2011 ALiHFEpid.cxx */
+         lowerCut->SetParameter(0,-3.7);
+         lowerCut->SetParameter(1,-0.8);
+         lowerCut->SetParameter(2,-0.35);
+
+         if (MCenabled) { //overwrite parameters
+               lowerCut->SetParameter(0,-2.5);
+               lowerCut->SetParameter(2,-2.2);
+         }
+
+         //---------------------------------------------
+         AliDielectronPID *pidTPCTOFeOnly = new AliDielectronPID("TPC-TOF","TPC-TOF");
+         pidTPCTOFeOnly->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3,3.,0.0,100.,kFALSE);
+         pidTPCTOFeOnly->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.0 , 100., kFALSE );
+
+
+          AliDielectronPID *pidTPCandTOF = new AliDielectronPID("TPC-TOF-HFE","TPC-TOF-HFE");
+          pidTPCandTOF->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.,0.0,100.,kFALSE);
+          pidTPCandTOF->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3.,3.,0.,100.,kTRUE);
+          pidTPCandTOF->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.0 , 100., kFALSE );
+
+         AliDielectronPID *pidTPChardTOF = new AliDielectronPID("TPC-TOF-HFE","TPC-TOF-HFE");
+         pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,lowerCut,3.,0.0,100.,kFALSE);
+         pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3,3.,0.,100.,kTRUE);
+         pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-3.,3.,0.,100.,kTRUE);
+         pidTPChardTOF->AddCut(AliDielectronPID::kTPC,AliPID::kKaon,-3.,3.,0.,100.,kTRUE);
+         pidTPChardTOF->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.0 , 100., kFALSE );
+         //___________________________________________
+         AliDielectronPID *pidTT = new AliDielectronPID("TPC-TOF","TPC-TOF");
+         pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-1.5,3.,0.2,0.4,kFALSE);
+         pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3,3.,0.4,100.,kFALSE);
+         pidTT->AddCut(AliDielectronPID::kTOF ,AliPID::kElectron , -3. , 3. , 0.2 , 100., kFALSE );
+
+         pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kPion,-3,3.,0.,100.,kTRUE);
+         pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kProton,-3.,3.,0.,100.,kTRUE);
+         pidTT->AddCut(AliDielectronPID::kTPC,AliPID::kKaon,-3.,3.,0.,100.,kTRUE);
+         //___________________________________________
+         AliDielectronVarCuts *pidTPCsignal = new AliDielectronVarCuts("pidTPCsignal","cut on the TPC signal");
+         if (MCenabled) {
+         pidTPCsignal->AddCut(AliDielectronVarManager::kTPCsignal,65.,85.); 
+         }     
+         else {
+         pidTPCsignal->AddCut(AliDielectronVarManager::kTPCsignal,75.,90.); 
+         }
+         //___________________________________________
+
+         AliDielectronVarCuts *pidTPCsignalWide = new AliDielectronVarCuts("pidTPCsignalWide","cut on the TPC signal");
+         pidTPCsignalWide->AddCut(AliDielectronVarManager::kTPCsignal,75.,90.);
+
+
+         AliDielectronVarCuts *pTPCHPT = new AliDielectronVarCuts("P>.4hpt","P>.4hpt");
+         pTPCHPT->AddCut(AliDielectronVarManager::kPt,.4,3.0);
+
+         AliDielectronVarCuts *pTPC = new AliDielectronVarCuts("P>.4","P>.4");
+         pTPC->AddCut(AliDielectronVarManager::kPt,.4,2.0);
+         
+         AliDielectronVarCuts *pMin = new AliDielectronVarCuts("P>.2","P>.2");
+         pMin->AddCut(AliDielectronVarManager::kPt,.2,2.5);
+
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+                 AliDielectronCutGroup* cgSecondTrackFilterNoPID = new AliDielectronCutGroup("cgNoPID","cgNoPID",AliDielectronCutGroup::kCompAND);
+                 cgSecondTrackFilterNoPID->AddCut(pTPC);
+                 anaCuts= cgSecondTrackFilterNoPID;
+                 break;
+               case kPbPb2011TPCandTOFHPT:
+                 AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
+                 cgSecondTrackFilterPIDTPC1->AddCut(pTPCHPT);
+                 cgSecondTrackFilterPIDTPC1->AddCut(pidTPCTOFeOnly);
+                 cgSecondTrackFilterPIDTPC1->AddCut(pidTPCsignal);
+                 anaCuts = cgSecondTrackFilterPIDTPC1;
+               case kPbPb2011TPCandTOF :
+                 AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
+                 cgSecondTrackFilterPIDTPC1->AddCut(pTPC);
+                 //cgSecondTrackFilterPIDTPC1->AddCut(pidTPChardTOF);
+                 cgSecondTrackFilterPIDTPC1->AddCut(pidTPCTOFeOnly);
+                 cgSecondTrackFilterPIDTPC1->AddCut(pidTPCsignal);
+                 anaCuts = cgSecondTrackFilterPIDTPC1;
+                 break;
+               case kPbPb2011TPC :
+                  AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
+                  cgSecondTrackFilterPIDTPC1->AddCut(pTPC);
+                  cgSecondTrackFilterPIDTPC1->AddCut(pidTPCsignalWide);
+                  anaCuts = cgSecondTrackFilterPIDTPC1;
+                  break;
+
+               case kPbPb2011TPCandTOFwide :
+                  AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
+                  cgSecondTrackFilterPIDTPC1->AddCut(pTPC);
+                  cgSecondTrackFilterPIDTPC1->AddCut(pidTPCandTOF);
+                  cgSecondTrackFilterPIDTPC1->AddCut(pidTPCsignalWide);
+                  anaCuts = cgSecondTrackFilterPIDTPC1;
+                  break;
+
+               case kPbPb2011TPCorTOF  :
+                 AliDielectronCutGroup* cgSecondTrackFilterPIDTPC2 = new AliDielectronCutGroup("cgPIDTPC2","cgPIDTPC2",AliDielectronCutGroup::kCompAND);
+                 cgSecondTrackFilterPIDTPC2->AddCut(pMin);
+                 cgSecondTrackFilterPIDTPC2->AddCut(pidTT);
+                 cgSecondTrackFilterPIDTPC2->AddCut(pidTPCsignal);
+                 anaCuts = cgSecondTrackFilterPIDTPC2;
+                 break;
+               case kpp2010TPCandTOF :
+                 AliDielectronCutGroup* cgSecondTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
+                 cgSecondTrackFilterPIDTPC->AddCut(pTPC);
+                 //cgSecondTrackFilterPIDTPC->AddCut(pidTPChardTOF);
+                 cgSecondTrackFilterPIDTPC->AddCut(pidTPCTOFeOnly);
+                 anaCuts = cgSecondTrackFilterPIDTPC;
+                 break;
+               case kpp2010TPCorTOF  :
+                 AliDielectronCutGroup* cgSecondTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
+                 cgSecondTrackFilterPIDTPC->AddCut(pMin);
+                 cgSecondTrackFilterPIDTPC->AddCut(pidTT);
+                 anaCuts = cgSecondTrackFilterPIDTPC;
+                 break;
+               default: cout << "No Analysis PID Cut defined " << endl;
+         }
+         return anaCuts;
+       }
+
+       AliAnalysisCuts* GetPIDCutsPre(Int_t cutSet) {
+         AliAnalysisCuts* anaCuts=0x0;
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+                 AliDielectronCutGroup* cgSecondTrackFilterPIDTPC = new AliDielectronCutGroup("cgPIDTPC","cgPIDTPC",AliDielectronCutGroup::kCompAND);
+                 AliDielectronCutGroup* cgITSTPC = new AliDielectronCutGroup("cgITSTPC","cgITSTPC",AliDielectronCutGroup::kCompAND);
+                 AliDielectronPID *pidITSTPC = new AliDielectronPID("TPCpre","TPCpre");
+                 pidITSTPC->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-3.,3.);
+                 cgITSTPC->AddCut(pidITSTPC);
+
+
+                 AliDielectronCutGroup* cgITSSA = new AliDielectronCutGroup("cgITSSA","cgITSSA",AliDielectronCutGroup::kCompAND);
+                 AliDielectronPID *pidITSSA = new  AliDielectronPID("pidITSSA","pidITSSA");
+                 pidITSSA->AddCut(AliDielectronPID::kITS,AliPID::kElectron,-3.,3.);
+                 cgITSSA->AddCut(pidITSSA);
+                 //      cgITSSA->AddCut(GetTrackCutsPre(cutSet));
+
+                 AliDielectronCutGroup* cgInitialTrackFilter = new AliDielectronCutGroup("cgInitialTrackFilter","cgInitialTrackFilter",AliDielectronCutGroup::kCompOR);
+                 cgInitialTrackFilter->AddCut(cgITSTPC);
+                 cgInitialTrackFilter->AddCut(cgITSSA);
+                 anaCuts = cgInitialTrackFilter;
+                 break;
+               default: cout << "No Pre-PID Cut defined " << endl;
+         }
+         return anaCuts;
+       }
+
+
+
+        AliAnalysisCuts* GetPairCuts2(Int_t cutSet, Bool_t togglePC /*=kFALSE*/)  {
+          AliAnalysisCuts* pairCuts=0x0;
+          switch (cutSet) {
+                case kPbPb2011TPCorTOF  :
+                case kpp2010TPCandTOF :
+                  AliDielectronVarCuts* pairCutsV= new AliDielectronVarCuts("InvMass","InvMass > 150 MeV");
+                  pairCutsV->AddCut(AliDielectronVarManager::kM,0.15,100.,kTRUE);
+                  pairCuts = pairCutsV;
+                  break;
+               case kPbPb2011NoPID:
+                case kPbPb2011TPCandTOF :
+                case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFHPT:
+                case kPbPb2011TPCandTOFwide :
+                case kpp2010TPCorTOF  :
+                  if (!togglePC) {
+
+                  AliDielectronCutGroup* pairCutsCG2 =new AliDielectronCutGroup("pairCutsCG2","pairCutsCG2",AliDielectronCutGroup::kCompOR);
+                  AliDielectronCutGroup* pairCutsCG =new AliDielectronCutGroup("pairCutsCG","pairCutsCG",AliDielectronCutGroup::kCompAND);
+                  pairCutsPhiv =new AliDielectronVarCuts("Phiv Cuts","Phiv<2.0rad");
+                  pairCutsPhiv->AddCut(AliDielectronVarManager::kPhivPair, 0.0, 2.0); 
+                  pairCutsInvM =new AliDielectronVarCuts("InvM Cuts","InvM<0.3");
+                  pairCutsInvM->AddCut(AliDielectronVarManager::kM, 0.0, 0.3); 
+                  pairCutsInvMgood =new AliDielectronVarCuts("InvM Cuts good","InvM>0.3");
+                  pairCutsInvMgood->AddCut(AliDielectronVarManager::kM, 0.3, 99999.); 
+                  pairCutsCG->AddCut(pairCutsPhiv);
+                  pairCutsCG->AddCut(pairCutsInvM);
+                  pairCutsCG2->AddCut(pairCutsInvMgood);
+                  pairCutsCG2->AddCut(pairCutsCG);
+                  pairCuts = pairCutsCG2;
+                  }
+                  else {
+                        AliDielectronVarCuts* pairCutsV =new AliDielectronVarCuts("OpeningAngle","Opening angle > .035rad");
+                        pairCutsV->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.035,kTRUE);
+                        pairCuts = pairCutsV;
+                  }
+                  break;
+                default: cout << "No Pair Cuts defined " << endl;
+          }
+          return pairCuts;
+        }
+
+
+       AliAnalysisCuts* GetPairCuts(Int_t cutSet)  {  
+         AliAnalysisCuts* pairCuts=0x0;
+         switch (cutSet) {
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+                       AliDielectronVarCuts* pairCutsM=0x0;
+                 pairCutsM = new AliDielectronVarCuts("InvMass","InvMass > 150 MeV");
+                 pairCutsM->AddCut(AliDielectronVarManager::kM,0.15,100.,kTRUE);
+                 pairCuts = pairCutsM;
+                 break;
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+               case kPbPb2011TPCandTOFHPT:
+               case kpp2010TPCorTOF  :
+
+                 AliDielectronCutGroup* pairCutsCG =new AliDielectronCutGroup("pairCutsCG","pairCutsCG",AliDielectronCutGroup::kCompAND);
+                 AliDielectronVarCuts* pairCutsPhiv =new AliDielectronVarCuts("Phiv Cuts","Phiv<2.0rad");
+                 pairCutsPhiv->AddCut(AliDielectronVarManager::kPhivPair, 2.0, 3.2); 
+                 AliDielectronVarCuts* pairCutsInvM =new AliDielectronVarCuts("InvM Cuts","InvM<0.3");
+                 pairCutsInvM->AddCut(AliDielectronVarManager::kM, 0.0, 0.3); 
+                 pairCutsCG->AddCut(pairCutsPhiv);
+                 pairCutsCG->AddCut(pairCutsInvM);
+
+                 pairCuts = pairCutsCG;
+
+
+               //pairCuts =new AliDielectronVarCuts("OpeningAngle","Opening angle > .035rad");
+               //pairCuts->AddCut(AliDielectronVarManager::kOpeningAngle, 0. , 0.035);
+               break;
+               default: cout << "No Pair Cuts defined " << endl;
+         } 
+         return pairCuts;
+       }
+
+       AliAnalysisCuts* GetESDTrackCutsAna(Int_t cutSet) {
+         AliESDtrackCuts* esdTrackCutsH = 0x0;
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+                       // standard cuts with very loose DCA: Bit4 (Int: 16), AOD095&115
+                 
+                        esdTrackCutsH = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kFALSE); 
+                        esdTrackCutsH->SetMaxDCAToVertexXY(2.4);
+                        esdTrackCutsH->SetMaxDCAToVertexZ(3.2);
+                        esdTrackCutsH->SetDCAToVertex2D(kTRUE);
+               /* 
+
+                 esdTrackCutsH = new AliESDtrackCuts();
+                 esdTrackCutsH->SetAcceptKinkDaughters(kFALSE);
+                 //Not done so far via dielectron cuts:
+                 */
+                 /*
+                 esdTrackCuts->SetDCAToVertex2D(kFALSE);
+                 esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
+                 esdTrackCuts->SetMaxChi2PerClusterITS(36);
+                  */
+
+                 break;
+               default: cout << "No Analysis Track Cut defined " << endl;
+         }
+         return esdTrackCutsH;
+       } 
+
+  AliAnalysisCuts* GetPairCutsInvMass(Int_t cutSet) {
+    AliDielectronVarCuts* pairCuts=0x0;
+    switch (cutSet) {
+    case kPbPb2011MassLow :
+      pairCuts = new AliDielectronVarCuts("InvMass","0 MeV  < InvMass < 30 MeV");
+      pairCuts->AddCut(AliDielectronVarManager::kM, 0.,0.03);
+      break;
+    case kPbPb2011MassMiddle :
+      pairCuts = new AliDielectronVarCuts("InvMass","120 MeV  < InvMass < 300 MeV");
+      pairCuts->AddCut(AliDielectronVarManager::kM, 0.12,0.30);
+      break;
+    case kPbPb2011MassHigh :
+      pairCuts = new AliDielectronVarCuts("InvMass","300 MeV  < InvMass < 500 MeV");
+      pairCuts->AddCut(AliDielectronVarManager::kM, 0.30,0.50);
+      break;
+    case kPbPb2011MassAll :
+      pairCuts = new AliDielectronVarCuts("InvMass","0 GeV  < InvMass < 10 GeV");
+      pairCuts->AddCut(AliDielectronVarManager::kM, 0.0,10.0);
+      break;
+
+    default: cout << "No Pair Cuts defined " << endl;
+    }
+    return pairCuts;
+  }
+
+
+       AliAnalysisCuts* GetTrackCutsAna(Int_t cutSet) {
+         AliDielectronCutGroup* trackCuts=0x0;
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPC :
+               case kPbPb2011TPCandTOFwide :
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+                       trackCuts = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
+
+                       AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kPt,0.05,6.);
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kEta,-0.84,0.84);
+                       //DCA Cut
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     3.0, 100.0);
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   3.5);
+                       AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+                       trackCutsDiel->SetAODFilterBit(16); //does nothing for ESDs
+                       trackCutsDiel->SetRequireITSRefit(kTRUE);
+                       trackCutsDiel->SetRequireTPCRefit(kTRUE);
+
+                       trackCutsDiel->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
+//                     trackCutsAOD->AddCut(AliDielectronVarManager::kNclsTPC,     80., 140.0);
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCr,     110.0, 160.0);
+                       trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCfCross,     0.8, 1.0);//tighter than before,
+                                                                                                                                                                                //due to AOD production
+                       trackCuts->AddCut(trackCutsDiel);
+                       trackCuts->AddCut(trackCutsAOD);
+                 break;
+               default: cout << "No Analysis Track Cut defined " << endl;
+         }
+         return trackCuts;
+       } 
+
+       AliAnalysisCuts* GetTrackCutsPre(Int_t cutSet) {
+         AliESDtrackCuts* trackCuts=0x0;
+         switch (cutSet) {
+               case kPbPb2011NoPID:
+               case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+               case kPbPb2011TPCorTOF  :
+               case kpp2010TPCandTOF :
+               case kpp2010TPCorTOF  :
+/*
+                       trackCuts = new AliESDtrackCuts();
+                       trackCuts->SetDCAToVertex2D(kTRUE);
+                       trackCuts->SetMaxDCAToVertexZ(3.0);
+                       trackCuts->SetMaxDCAToVertexXY(1.0);
+                 trackCuts->SetEtaRange( -0.84 , 0.84 );
+                 trackCuts->SetPtRange(  0.05 , 0.5);
+                 trackCuts->SetAcceptKinkDaughters(kFALSE);
+                 trackCuts->SetRequireITSRefit(kTRUE);
+                 trackCuts->SetRequireITSStandAlone(kTRUE);
+                 trackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
+                 trackCuts->SetMinNClustersITS(3); //PhotonGroup-Dalitz: 2?!
+*/
+                 cout << "No Pre-Track Cut defined for AODs at the moment " << endl;
+                 break;
+               default: cout << "No Pre-Track Cut defined " << endl;
+         }
+         return trackCuts;
+       }
+
+};