Updated lmee PbPb analysis configs
authortbroker <tbroeker@ikf.uni-frankfurt.de>
Mon, 26 May 2014 13:25:20 +0000 (15:25 +0200)
committertbroker <tbroeker@ikf.uni-frankfurt.de>
Tue, 27 May 2014 07:37:43 +0000 (09:37 +0200)
Cutlib file added

PWGDQ/dielectron/macrosLMEE/AddTask_reichelt_LMEEPbPb2011AOD.C
PWGDQ/dielectron/macrosLMEE/Config_reichelt_LMEEPbPb2011.C [new file with mode: 0644]
PWGDQ/dielectron/macrosLMEE/LMEECutLib_reichelt.C [new file with mode: 0644]

index 164dab0..0d44788 100644 (file)
@@ -1,5 +1,5 @@
 AliAnalysisTask *AddTask_reichelt_LMEEPbPb2011AOD(Char_t* outputFileName="LMEEoutput.root", 
- Bool_t runAll=kFALSE, Bool_t setMC=kFALSE, Bool_t getFromAlien=kFALSE, 
+ Bool_t flag1=kFALSE, Bool_t flag2=kFALSE, Bool_t getFromAlien=kFALSE, 
  Int_t triggerNames=(AliVEvent::kMB+AliVEvent::kCentral+AliVEvent::kSemiCentral), Int_t collCands=AliVEvent::kAny) 
 {
   Bool_t bESDANA=kFALSE; //Autodetect via InputHandler
@@ -19,9 +19,9 @@ AliAnalysisTask *AddTask_reichelt_LMEEPbPb2011AOD(Char_t* outputFileName="LMEEou
   
   
   //Load updated macros from private ALIEN path
-  if (getFromAlien &&
-      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/p/preichel/PWGDQ/dielectron/macrosLMEE/Config_reichelt_LMEEPbPb2011.C .")) &&
-      (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/p/preichel/PWGDQ/dielectron/macrosLMEE/LMEECutLib_reichelt.C ."))
+  if (getFromAlien //&&
+      && (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/p/preichel/PWGDQ/dielectron/macrosLMEE/Config_reichelt_LMEEPbPb2011.C ."))
+      && (!gSystem->Exec("alien_cp alien:///alice/cern.ch/user/p/preichel/PWGDQ/dielectron/macrosLMEE/LMEECutLib_reichelt.C ."))
       ) {
     configBasePath=Form("%s/",gSystem->pwd());
   }
@@ -43,9 +43,7 @@ AliAnalysisTask *AddTask_reichelt_LMEEPbPb2011AOD(Char_t* outputFileName="LMEEou
   
   
   //Do we have an MC handler?
-  Bool_t hasMC=setMC;
-  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
-    hasMC=kTRUE;
+  Bool_t hasMC = (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler() != 0x0);
   
   //load dielectron configuration files
   if (!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data()))
@@ -69,7 +67,7 @@ AliAnalysisTask *AddTask_reichelt_LMEEPbPb2011AOD(Char_t* outputFileName="LMEEou
     AliDielectron *diel_low = Config_reichelt_LMEEPbPb2011(i,hasMC,bESDANA);
     if(!diel_low)continue;
     task->AddDielectron(diel_low);
-    printf("add: %s\n",diel_low->GetName());
+    printf("successfully added AliDielectron: %s\n",diel_low->GetName());
   }//loop
   
   mgr->AddTask(task);
diff --git a/PWGDQ/dielectron/macrosLMEE/Config_reichelt_LMEEPbPb2011.C b/PWGDQ/dielectron/macrosLMEE/Config_reichelt_LMEEPbPb2011.C
new file mode 100644 (file)
index 0000000..30cb83a
--- /dev/null
@@ -0,0 +1,447 @@
+//#include "AliDielectron.h"
+//#include "PWGDQ/dielectron/macrosLMEE/LMEECutLib.C"
+
+void InitHistograms(AliDielectron *die, Int_t cutDefinition);
+void InitCF(AliDielectron* die, Int_t cutDefinition);
+//adjust for 1,4,8
+TString names=("ITSTPCTOFif_trkSPDfirst_1_kSemi;ITSTPCTOFif_trkSPDfirst5cls_4_kSemi;ITS2gevTPCTOFif_trkSPDfirst_5_tight_kSemi");
+TObjArray *arrNames=names.Tokenize(";");
+const Int_t nDie=arrNames->GetEntries();
+Bool_t MCenabled=kFALSE;//needed for LMEEcutlib
+
+AliDielectron* Config_reichelt_LMEEPbPb2011(Int_t cutDefinition, Bool_t hasMC=kFALSE, Bool_t isESD=kFALSE)
+{
+  //
+  // Setup the instance of AliDielectron
+  //
+  
+  Int_t selectedPID=-1;
+  Int_t selectedCentrality=-1;
+  Bool_t rejectionStep=kFALSE;
+  //Bool_t doPairing=kTRUE;
+  LMEECutLib*  LMcutlib = new LMEECutLib();
+  
+  // task name
+  TString name=Form("%02d",cutDefinition);
+  if (cutDefinition<arrNames->GetEntriesFast())  name=arrNames->At(cutDefinition)->GetName();
+  
+  // init AliDielectron
+  AliDielectron *die = new AliDielectron(Form("%s",name.Data()), Form("AliDielectron with cuts: %s",name.Data()));
+  //die->SetHasMC(hasMC);
+  MCenabled=hasMC;
+  
+  cout << "cutDefinition = " << cutDefinition << endl;
+  // Setup Analysis Selection
+  if (cutDefinition==0) {           // Config for Technical Preliminaries for QM2014 (no prefilter used!)
+    selectedPID = LMEECutLib::kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1;
+    selectedCentrality = LMEECutLib::kPbPb2011SemiCentral;
+  }
+  else if (cutDefinition==1) {      // Config for systematic checks 1
+    selectedPID = LMEECutLib::kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4;
+    selectedCentrality = LMEECutLib::kPbPb2011SemiCentral;
+  }
+  else if (cutDefinition==2) {      // Config for systematic checks 2
+    selectedPID = LMEECutLib::kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight;
+    selectedCentrality = LMEECutLib::kPbPb2011SemiCentral;
+  }
+  else {
+    cout << " =============================== " << endl;
+    cout << " ==== INVALID CONFIGURATION ==== " << endl;
+    cout << " cutDefinition = " << cutDefinition << endl;
+    cout << " =============================== " << endl;
+  }
+  // __________________________________________________
+  // POSSIBLE FURTHER SETTINGS
+  // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+  // deactivate pairing to check track cuts or run with loose pid cuts:
+  //die->SetNoPairing();
+  // apply correct Pre-Filter Scheme, if necessary
+  //die->SetPreFilterAllSigns();
+  //die->SetPreFilterUnlikeOnly();
+  // --------------------------------------------------
+  
+  //
+  // Now configure task
+  //
+  // add centrality selection to event cuts
+  die->GetEventFilter().AddCuts( LMcutlib->GetCentralityCuts(selectedCentrality) );
+  // switch off KF Particle
+  die->SetUseKF(kFALSE);
+  
+  // --------------------------------------------------
+  // with Rejection Step (Prefilter)
+  // --------------------------------------------------
+  if (rejectionStep) 
+  {
+    if (isESD) {
+      die->GetTrackFilter().AddCuts( LMcutlib->GetESDTrackCutsAna(selectedPID) );
+      die->GetPairPreFilterLegs().AddCuts( LMcutlib->GetESDTrackCutsAna(selectedPID) ); // this is redundant!?
+    }
+    // set initial track filter.
+    // the function 'GetPIDCutsPre()' must also call 'GetTrackCutsPre()'!
+         die->GetTrackFilter().AddCuts( LMcutlib->GetPIDCutsPre(selectedPID) );
+    // set Prefilter. "remove all tracks from the Single track arrays that pass the cuts in this filter" (comment in AliDielectron.cxx)
+    // cuts = REJECTION!!!
+    die->GetPairPreFilter().AddCuts( LMcutlib->GetPairCutsPre(selectedPID) ); 
+    // "apply leg cuts after the pre filter" (comment in AliDielectron.cxx)
+    
+    
+    // the function 'GetPIDCutsAna()' must also call 'GetTrackCutsAna()'!
+         die->GetPairPreFilterLegs().AddCuts( LMcutlib->GetPIDCutsAna(selectedPID) );
+    
+    
+    // set Pairfilter.
+    // cuts = SELECTION!!!
+         die->GetPairFilter().AddCuts( LMcutlib->GetPairCutsAna(selectedPID,kFALSE) );
+    
+       }
+  // --------------------------------------------------
+  // without Rejection Step
+  // --------------------------------------------------
+       else 
+  {
+         if (isESD) {
+      die->GetTrackFilter().AddCuts( LMcutlib->GetESDTrackCutsAna(selectedPID) );
+         }
+    // the function 'GetPIDCutsAna()' must also call 'GetTrackCutsAna()'!
+         die->GetTrackFilter().AddCuts( LMcutlib->GetPIDCutsAna(selectedPID) );
+         die->GetPairFilter().AddCuts( LMcutlib->GetPairCutsAna(selectedPID,kFALSE) );
+       }
+  // --------------------------------------------------
+  
+  
+  AliDielectronTrackRotator *rot= 0x0;
+  //To save time and as it is not 100% test, rotation switched off
+  /*AliDielectronTrackRotator *rot= LMcutlib->GetTrackRotator(selectedPID);
+   die->SetTrackRotator(rot);
+   */
+  AliDielectronMixingHandler *mix=LMcutlib->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;Track_Legs;Pre;RejPair;RejTrack");
+  
+  //Event class
+  histos->AddClass("Event"); // all classes will be stored in 'THashList fHistoList'
+  
+  //Track classes
+  //to fill also track info from 2nd event loop until 3
+  // in AliDielectron.cxx: fgkTrackClassNames[4] = {"ev1+","ev1-","ev2+","ev2-"};
+  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
+  // fgkPairClassNames[11] = {
+  //  "ev1+_ev1+",  "ev1+_ev1-",  "ev1-_ev1-",  // 0-2 (same event)
+  //  "ev1+_ev2+",  "ev1-_ev2+",  "ev2+_ev2+",  // 3-4 (+5)
+  //  "ev1+_ev2-",  "ev1-_ev2-",                // 6-7
+  //  "ev2+_ev2-",  "ev2-_ev2-",  "ev1+_ev1-_TR"
+  // };
+  for (Int_t i=0; i<3; ++i){
+    histos->AddClass(Form("Pair_%s",AliDielectron::PairClassName(i)));
+    // Legs of final Pairs. Both charges together. No duplicate entries.
+    histos->AddClass(Form("Track_Legs_%s",AliDielectron::PairClassName(i))); // not TrackClassName, see 'AliDielectron::FillHistograms(...)'
+  }
+  
+  //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<3; ++i){
+    histos->AddClass(Form("RejPair_%s",AliDielectron::PairClassName(i)));
+    // Legs of rejected Pairs. Both charges together. One track can and will make multiple entries.
+    histos->AddClass(Form("RejTrack_%s",AliDielectron::PairClassName(i))); // not TrackClassName, see 'AliDielectron::FillHistogramsPair(...)'
+  }
+  
+  /*
+   //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;#events",1,0.,1.,AliDielectronVarManager::kNevents);
+       histos->UserHistogram("Event","Centrality","Centrality;Centrality [%]","-1,0,10,20,30,40,50,60,70,80,90,100,101;#events",AliDielectronVarManager::kCentrality);
+  histos->UserHistogram("Event","centrality","N events vs centrality;centrality [%];#events",100,0,100,AliDielectronVarManager::kCentrality);
+  histos->UserHistogram("Event","nESDTracks","ESD tracks;ESD tracks;#events",1000,0,10000,AliDielectronVarManager::kNTrk);
+  histos->UserHistogram("Event","Nacc","Number of accepted tracks;Nacc;#events",1200,0,1200,AliDielectronVarManager::kNacc);
+  histos->UserHistogram("Event","epTPC","TPC event plane angle (uncorr);EP angle TPC (uc);#events",320,-3.2,3.2,AliDielectronVarManager::kTPCrpH2uc);
+  histos->UserHistogram("Event","epV0AC","V0AC event plane angle;EP angle V0AC;#events",320,-3.2,3.2,AliDielectronVarManager::kv0ACrpH2);
+  histos->UserHistogram("Event","epV0AC_epTPC","event plane angle V0AC vs TPC;EP angle TPC (uc);EP angle V0AC",
+                        160,-1.6,1.6,160,-1.6,1.6,AliDielectronVarManager::kTPCrpH2uc,AliDielectronVarManager::kv0ACrpH2);
+  
+  
+  //add histograms to Track classes
+  histos->UserHistogram("Track","Pt","Pt;Pt [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Track","Px","Px;Px [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPx);
+  histos->UserHistogram("Track","Py","Py;Py [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPy);
+  histos->UserHistogram("Track","Pz","Pz;Pz [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPz);
+  histos->UserHistogram("Track","P_PIn","TPC inner P vs P; P [GeV]; TPC inner P [GeV]",
+                        160,0.,8.,160,0.,8.,AliDielectronVarManager::kP,AliDielectronVarManager::kPIn);
+  
+  // ITS
+  Bool_t makeLogx = kFALSE;
+  histos->UserHistogram("Track","ITS_dEdx_P","ITS dEdx;P [GeV];ITS signal (arb units)",
+                        160,0.,8.,700,0.,700.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSsignal,makeLogx);
+  histos->UserHistogram("Track","ITSnSigmaEle_P","ITS number of sigmas Electrons;P [GeV];ITS number of sigmas Electrons",
+                        160,0.,8.,100,-5.,5.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaEle,makeLogx);
+  histos->UserHistogram("Track","ITSnSigmaPio_P","ITS number of sigmas Pions;P [GeV];ITS number of sigmas Pions",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaPio,makeLogx);
+histos->UserHistogram("Track","ITSnSigmaKao_P","ITS number of sigmas Kaons;P [GeV];ITS number of sigmas Kaons",
+                      160,0.,8.,200,-10.,10.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaKao,makeLogx);
+//histos->UserHistogram("Track","ITSnSigmaPro_P","ITS number of sigmas Protons;P [GeV];ITS number of sigmas Protons",
+//                      160,0.,8.,200,-10.,10.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaPro,makeLogx);
+  // TPC
+  histos->UserHistogram("Track","TPC_dEdx_P","TPC dEdx;P [GeV];TPC signal (arb units)",
+                        160,0.,8.,120,0.,120.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,makeLogx);
+  histos->UserHistogram("Track","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons",
+                        160,0.,8.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,makeLogx);
+  histos->UserHistogram("Track","TPCnSigmaEle_P_dEdx","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons;TPC signal (arb units)",
+                        80,0.,4.,80,-4.,4.,50,50.,100.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,AliDielectronVarManager::kTPCsignal,makeLogx);
+  histos->UserHistogram("Track","TPC_dEdx_P_run","TPC dEdx;P [GeV];TPC signal (arb units);run number",
+                        AliDielectronHelper::MakeLinBinning(80,0.,4.), 
+                        AliDielectronHelper::MakeLinBinning(50,50.,100.), 
+                        AliDielectronHelper::MakeArbitraryBinning("167900, 167987, 167988, 168310, 168311, 168322, 168325, 168341, 168342, 168361, 168362, 168458, 168460, 168464, 168467, 168511, 168512, 168514, 168777, 168826, 168988, 168992, 169035, 169040, 169044, 169045, 169091, 169094, 169099, 169138, 169144, 169145, 169148, 169156, 169160, 169167, 169238, 169411, 169415, 169417, 169418, 169419, 169420, 169475, 169498, 169504, 169506, 169512, 169515, 169550, 169553, 169554, 169555, 169557, 169586, 169587, 169588, 169590, 169591, 169835, 169837, 169838, 169846, 169855, 169858, 169859, 170027, 170040, 170081, 170083, 170084, 170085, 170088, 170089, 170091, 170155, 170159, 170163, 170193, 170203, 170204, 170207, 170228, 170230, 170268, 170269, 170270, 170306, 170308, 170309, 170311, 170312, 170313, 170315, 170387, 170388, 170572, 170593, 170600"), 
+                        AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,AliDielectronVarManager::kRunNumber);
+  //                        AliDielectronHelper::MakeArbitraryBinning("170593, 170572, 170388, 170387, 170315, 170313, 170312, 170311, 170309, 170308, 170306, 170270, 170269, 170268, 170230, 170228, 170207, 170204, 170203, 170193, 170163, 170159, 170155, 170091, 170089, 170088, 170085, 170084, 170083, 170081, 170040, 170027, 169859, 169858, 169855, 169846, 169838, 169837, 169835, 169591, 169590, 169588, 169587, 169586, 169557, 169555, 169554, 169553, 169550, 169515, 169512, 169506, 169504, 169498, 169475, 169420, 169419, 169418, 169417, 169415, 169411, 169238, 169167, 169160, 169156, 169148, 169145, 169144, 169138, 169099, 169094, 169091, 169045, 169044, 169040, 169035, 168992, 168988, 168826, 168777, 168514, 168512, 168511, 168467, 168464, 168460, 168458, 168362, 168361, 168342, 168341, 168325, 168322, 168311, 168310, 167988, 167987, 167800"), 
+  
+  histos->UserHistogram("Track","TPCnSigmaPio_P","TPC number of sigmas Pions;P [GeV];TPC number of sigmas Pions",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,makeLogx);
+  histos->UserHistogram("Track","TPCnSigmaKao_P","TPC number of sigmas Kaons;P [GeV];TPC number of sigmas Kaons",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,makeLogx);
+  histos->UserHistogram("Track","TPCnSigmaPro_P","TPC number of sigmas Protons;P [GeV];TPC number of sigmas Protons",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPro,makeLogx);
+  // TRD
+  // TRD variables need lot of computing time. since a performance update by Julian, they will not be computed if not needed! (status 7.3.14)
+  //  histos->UserHistogram("Track","TRDpidPobEle_P","TRD PID probability Electrons;P [GeV];TRD prob Electrons",
+  //                        160,0.,8.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobEle,makeLogx);
+  //  histos->UserHistogram("Track","TRDpidPobPio_P","TRD PID probability Pions;P [GeV];TRD prob Pions",
+  //                        160,0.,8.,100,0.,1.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTRDprobPio,makeLogx);
+  // TOF
+  histos->UserHistogram("Track","TOFnSigmaEle_P","TOF number of sigmas Electrons;P [GeV];TOF number of sigmas Electrons",
+                        160,0.,8.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaEle,makeLogx);
+  histos->UserHistogram("Track","TOFnSigmaPio_P","TOF number of sigmas Pions;P [GeV];TOF number of sigmas Pions",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaPio,makeLogx);
+  histos->UserHistogram("Track","TOFnSigmaKao_P","TOF number of sigmas Kaons;P [GeV];TOF number of sigmas Kaons",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaKao,makeLogx);
+  histos->UserHistogram("Track","TOFnSigmaPro_P","TOF number of sigmas Protons;P [GeV];TOF number of sigmas Protons",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFnSigmaPro,makeLogx);
+  histos->UserHistogram("Track","TOFbeta","TOF beta;P [GeV];TOF beta",
+                        160,0.,8.,120,0.,1.2,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTOFbeta,makeLogx);
+  // 2D-PID
+  histos->UserHistogram("Track","PIn_TPCnSigmaEle_ITSnSigmaEle","2D PID - TPC vs ITS;P [GeV];TPC number of sigmas Electrons;ITS number of sigmas Electrons",
+                        50,0.,2.5, 160,-12.,20., 150,-10.,20.,
+                        AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,AliDielectronVarManager::kITSnSigmaEle,makeLogx);
+  histos->UserHistogram("Track","PIn_TPCnSigmaEle_TOFnSigmaEle","2D PID - TPC vs TOF;P [GeV];TPC number of sigmas Electrons;TOF number of sigmas Electrons",
+                        50,0.,2.5, 160,-12.,20., 50,-5.,5.,
+                        AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,AliDielectronVarManager::kTOFnSigmaEle,makeLogx);
+  
+  // Eta and Phi
+  histos->UserHistogram("Track","Eta","Eta;Eta;#tracks",
+                        200,-2,2,AliDielectronVarManager::kEta);
+  histos->UserHistogram("Track","Phi","Phi;Phi;#tracks",
+                        320,0.,6.4,AliDielectronVarManager::kPhi);
+  histos->UserHistogram("Track","Eta_Phi","Eta Phi Map;Eta;Phi",
+                        100,-1,1,320,0,6.4,AliDielectronVarManager::kEta,AliDielectronVarManager::kPhi);
+                        
+  histos->UserHistogram("Track","TPC_dEdx_Eta","TPC dEdx;Eta;TPC signal (arb units)",
+                        100,-1,1,120,0.,120.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCsignal);
+  histos->UserHistogram("Track","TPC_dEdx_Eta_P","TPC dEdx;Eta;TPC signal (arb units); TPC inner P [GeV]",
+                        100,-1,1,60,0.,120.,80,0.,4.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCsignal,AliDielectronVarManager::kPIn);
+  histos->UserHistogram("Track","TPCnSigmaEle_Eta","TPC number of sigmas Electrons; Eta; TPC number of sigmas Electrons",
+                        100,-1,1,100,-5.,5.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle);
+  histos->UserHistogram("Track","TPCnSigmaEle_Eta_P","TPC number of sigmas Electrons; Eta; TPC number of sigmas Electrons; TPC inner P [GeV]",
+                        100,-1,1,80,-4.,4.,80,0.,4.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaEle,AliDielectronVarManager::kPIn);
+  histos->UserHistogram("Track","TPCnSigmaKao_Eta","TPC number of sigmas Kaons; Eta; TPC number of sigmas Kaons",
+                        100,-1,1,200,-10.,10.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaKao);
+  histos->UserHistogram("Track","TPCnSigmaKao_Eta_P","TPC number of sigmas Kaons; Eta; TPC number of sigmas Kaons; TPC inner P [GeV]",
+                        50,-1,1,100,-10.,10.,80,0.,4.,AliDielectronVarManager::kEta,AliDielectronVarManager::kTPCnSigmaKao,AliDielectronVarManager::kPIn);
+  
+  // DCA
+  histos->UserHistogram("Track","dXY","dXY;dXY [cm];#tracks",
+                        200,-2.,2.,AliDielectronVarManager::kImpactParXY);
+  histos->UserHistogram("Track","dZ","dZ;dZ [cm];#tracks",
+                        400,-4.,4.,AliDielectronVarManager::kImpactParZ);
+  histos->UserHistogram("Track","dXY_dZ","dXY dZ Map;dXY;dZ",
+                        100,-1.,1.,300,-3.,3.,AliDielectronVarManager::kImpactParXY,AliDielectronVarManager::kImpactParZ);
+  
+  // Quality
+  histos->UserHistogram("Track","TPCcrossedRowsOverFindable","Number of Crossed Rows TPC over Findable;TPC crossed rows over findable;#tracks",120,0.,1.2,AliDielectronVarManager::kNFclsTPCfCross);
+  histos->UserHistogram("Track","TPCcrossedRows","Number of Crossed Rows TPC;TPC crossed rows;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNFclsTPCr);
+  histos->UserHistogram("Track","TPCnCls","Number of Clusters TPC;TPC number clusters;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsTPC);
+  histos->UserHistogram("Track","ITSnCls","Number of Clusters ITS;ITS number clusters;#tracks",160,-0.5,159.5,AliDielectronVarManager::kNclsITS);
+  histos->UserHistogram("Track","TPCchi2","TPC Chi2 value;TPC chi2/Cl;#tracks",100,0.,10.,AliDielectronVarManager::kTPCchi2Cl);
+  histos->UserHistogram("Track","ITSchi2","ITS Chi2 value;ITS chi2/Cl;#tracks",100,0.,10.,AliDielectronVarManager::kITSchi2Cl);
+  histos->UserHistogram("Track","NclsSFracTPC","Fraction of shared clusters assigned in the TPC;TPC fraction of shared clusters;#tracks",200,0,10.,AliDielectronVarManager::kNclsSFracTPC);
+  histos->UserHistogram("Track","TPCclsDiff","TPC cluster difference;TPC cluster difference;#tracks",200,0,20.,AliDielectronVarManager::kTPCclsDiff);
+  histos->UserHistogram("Track","TPCsignalN","Number of PID Clusters TPC;TPC number PID clusters;#tracks",160,-0.5,159.5,AliDielectronVarManager::kTPCsignalN);
+  
+  histos->UserHistogram("Track","TPCcrossedRows_TPCnCls","TPC crossed rows vs TPC number clusters;TPC number clusters;TPC crossed rows",
+                        160,-0.5,159.5,160,-0.5,159.5,AliDielectronVarManager::kNclsTPC,AliDielectronVarManager::kNFclsTPCr);
+  histos->UserHistogram("Track","TPCcrossedRows_Pt","TPC crossed rows vs Pt;Pt [GeV];TPC crossed rows",
+                        160,0.,8.,160,-0.5,159.5,AliDielectronVarManager::kPt,AliDielectronVarManager::kNFclsTPCr);
+  histos->UserHistogram("Track","TPCcrossedRowsOverFindable_Pt","Number of Crossed Rows TPC over Findable vs Pt;Pt [GeV];TPC crossed rows over findable",
+                        160,0.,8.,120,0.,1.2,AliDielectronVarManager::kPt,AliDielectronVarManager::kNFclsTPCfCross);
+  histos->UserHistogram("Track","TPCcrossedRowsOverFindable_Eta","Number of Crossed Rows TPC over Findable vs Eta;Eta;TPC crossed rows over findable",
+                        100,-1,1,120,0.,1.2,AliDielectronVarManager::kEta,AliDielectronVarManager::kNFclsTPCfCross);
+  histos->UserHistogram("Track","TPCcrossedRowsOverFindable_Phi","Number of Crossed Rows TPC over Findable vs Phi;Phi;TPC crossed rows over findable",
+                        320,0.,6.4,120,0.,1.2,AliDielectronVarManager::kPhi,AliDielectronVarManager::kNFclsTPCfCross);
+  
+  //add histograms to Pair classes
+  histos->UserHistogram("Pair","InvMass","Inv.Mass;Inv. Mass [GeV];#pairs",
+                        500,0.,5.,AliDielectronVarManager::kM);
+  histos->UserHistogram("Pair","PairPt","PairPt;Pair Pt [GeV];#pairs",
+                        160,0.,8.,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Pair","Rapidity","Rapidity;Rapidity;#pairs",
+                        200,-2.,2.,AliDielectronVarManager::kY);
+  histos->UserHistogram("Pair","OpeningAngle","Opening angle;angle;#pairs",
+                        320,0.,3.2,AliDielectronVarManager::kOpeningAngle);
+  
+  //2D and 3D histograms
+  histos->UserHistogram("Pair","InvMass_PairPt","PairPt vs InvMass;Inv. Mass [GeV];Pair Pt [GeV];#pairs",
+                        500,0.,5., 160,0.,8.,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kPt);
+  histos->UserHistogram("Pair","Eta_Phi_Pair","Phi vs Eta (pair);Eta;Phi;#pairs",
+                        100,-1.,1., 320,0.,6.4,
+                        AliDielectronVarManager::kEta, AliDielectronVarManager::kPhi);
+  histos->UserHistogram("Pair","InvMass_PairPt_PhivPair","InvMass:PairPt:PhivPair;Inv. Mass [GeV];Pair Pt [GeV];PhiV",
+                        150,0.,1.5, 40,0.,4., 64,0.,3.2,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kPt, AliDielectronVarManager::kPhivPair);
+  histos->UserHistogram("Pair","InvMass_PairPt_OpeningAngle","InvMass:PairPt:OpeningAngle;Inv. Mass [GeV];Pair Pt [GeV];Opening Angle",
+                        150,0.,1.5, 40,0.,4., 64,0.,3.2,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kPt, AliDielectronVarManager::kOpeningAngle);
+  histos->UserHistogram("Pair","InvMass_PhivPair_OpeningAngle","InvMass:PhivPair:OpeningAngle;Inv. Mass [GeV];PhiV;Opening Angle",
+                        50,0.,0.5, 160,0.,3.2, 40,0.,0.8,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kPhivPair, AliDielectronVarManager::kOpeningAngle);
+  
+  //opening angle and PhiV
+  histos->UserHistogram("Pair","InvMass_OpeningAngle","Opening Angle vs InvMass;Inv. Mass [GeV];Opening Angle;#pairs",
+                        500,0.,5., 160,0.,3.2,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kOpeningAngle);
+  histos->UserHistogram("Pair","InvMass_PhivPair","PhiV vs InvMass;Inv. Mass [GeV];PhiV;#pairs",
+                        500,0.,5., 160,0.,3.2,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kPhivPair);
+  histos->UserHistogram("Pair","PairPt_OpeningAngle","Opening Angle vs PairPt;Pair Pt [GeV];Opening Angle;#pairs",
+                        160,0.,8., 160,0.,3.2,
+                        AliDielectronVarManager::kPt, AliDielectronVarManager::kOpeningAngle);
+  histos->UserHistogram("Pair","PairPt_PhivPair","PhiV vs PairPt;Pair Pt [GeV];PhiV;#pairs",
+                        160,0.,8., 160,0.,3.2,
+                        AliDielectronVarManager::kPt, AliDielectronVarManager::kPhivPair);
+  histos->UserHistogram("Pair","OpeningAngle_PhivPair","PhiV vs OpeningAngle;Opening Angle;PhiV;#pairs",
+                        160,0.,3.2, 160,0.,3.2,
+                        AliDielectronVarManager::kOpeningAngle, AliDielectronVarManager::kPhivPair);
+  
+  //centrality
+  histos->UserHistogram("Pair","InvMass_Centrality","Centrality vs InvMass;Inv. Mass [GeV];Centrality;#pairs",
+                        500,0.,5., 102,-1,101,
+                        AliDielectronVarManager::kM, AliDielectronVarManager::kCentrality);
+  histos->UserHistogram("Pair","PairPt_Centrality","Centrality vs PairPt;Pair Pt [GeV];Centrality;#pairs",
+                        160,0.,8., 102,-1,101,
+                        AliDielectronVarManager::kPt, AliDielectronVarManager::kCentrality);
+  
+  
+/*  
+  //add histograms to Track classes
+  histos->UserHistogram("Pre","Pt","Pt;Pt [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPt);
+  histos->UserHistogram("Pre","Px","Px;Px [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPx);
+  histos->UserHistogram("Pre","Py","Py;Py [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPy);
+  histos->UserHistogram("Pre","Pz","Pz;Pz [GeV];#tracks",200,0,10.,AliDielectronVarManager::kPz);
+  
+  histos->UserHistogram("Pre","ITS_dEdx_P","ITS dEdx;P [GeV];ITS signal (arb units)",
+                        160,0.,8.,700,0.,700.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSsignal,makeLogx);
+  histos->UserHistogram("Pre","TPC_dEdx_P","TPC dEdx;P [GeV];TPC signal (arb units)",
+                        160,0.,8.,120,0.,120.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCsignal,makeLogx);
+  
+  histos->UserHistogram("Pre","ITSnSigmaEle_P","ITS number of sigmas Electrons;P [GeV];ITS number of sigmas Electrons",
+                        160,0.,8.,100,-5.,5.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaEle,makeLogx);
+  //histos->UserHistogram("Pre","ITSnSigmaPio_P","ITS number of sigmas Pions;P [GeV];ITS number of sigmas Pions",
+  //                      160,0.,8.,200,-10.,10.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaPio,makeLogx);
+  //histos->UserHistogram("Pre","ITSnSigmaKao_P","ITS number of sigmas Kaons;P [GeV];ITS number of sigmas Kaons",
+  //                      160,0.,8.,200,-10.,10.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaKao,makeLogx);
+  //histos->UserHistogram("Pre","ITSnSigmaPro_P","ITS number of sigmas Protons;P [GeV];ITS number of sigmas Protons",
+  //                      160,0.,8.,200,-10.,10.,AliDielectronVarManager::kP,AliDielectronVarManager::kITSnSigmaPro,makeLogx);
+  
+  histos->UserHistogram("Pre","TPCnSigmaEle_P","TPC number of sigmas Electrons;P [GeV];TPC number of sigmas Electrons",
+                        160,0.,8.,100,-5.,5.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaEle,makeLogx);
+  histos->UserHistogram("Pre","TPCnSigmaPio_P","TPC number of sigmas Pions;P [GeV];TPC number of sigmas Pions",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPio,makeLogx);
+  histos->UserHistogram("Pre","TPCnSigmaKao_P","TPC number of sigmas Kaons;P [GeV];TPC number of sigmas Kaons",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaKao,makeLogx);
+  histos->UserHistogram("Pre","TPCnSigmaPro_P","TPC number of sigmas Protons;P [GeV];TPC number of sigmas Protons",
+                        160,0.,8.,200,-10.,10.,AliDielectronVarManager::kPIn,AliDielectronVarManager::kTPCnSigmaPro,makeLogx);
+*/  
+  
+  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,100,0.,5.);
+  cf->AddVariable(AliDielectronVarManager::kM,200,-0.01,3.99); //20Mev Steps
+  cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);
+  
+  cf->AddVariable(AliDielectronVarManager::kCentrality,"0.,5.,10.,20.,30.,50.,80.,100.");
+  
+  //leg variables
+  cf->AddVariable(AliDielectronVarManager::kP,160,0.,8.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kITSsignal,350,0.,700.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kTPCsignal,60,0.,120.,kTRUE);
+  cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10,kTRUE);
+  
+  //only in this case write MC truth info
+  if (MCenabled) { // more elegant: die->GetHasMC() 
+    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);
+}
diff --git a/PWGDQ/dielectron/macrosLMEE/LMEECutLib_reichelt.C b/PWGDQ/dielectron/macrosLMEE/LMEECutLib_reichelt.C
new file mode 100644 (file)
index 0000000..61df0da
--- /dev/null
@@ -0,0 +1,911 @@
+class LMEECutLib {
+  
+public:
+       static  enum LMMECutSet {
+
+    kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight,
+    kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight,
+    kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight,
+    kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight,
+    kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4,
+    kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4,
+    kPbPb2011_pidITSTPC_trkSPDfirst_3,            // (cutset w/o pairing)
+    kPbPb2011_pidTPC_trkSPDfirst_3,               // (cutset w/o pairing)
+    kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose, // (cutset w/o pairing)
+    kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose, // (cutset w/o pairing)
+    kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose,      // (cutset w/o pairing)
+    kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose,      // (cutset w/o pairing)
+    kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1,
+    kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1,       // Cutset for Technical Preliminaries for QM2014 (no prefilter used!)
+    kPbPb2011_pidTPCTOF_trkSPDorSDD_1,
+    kPbPb2011_pidTPCTOF_trkSPDfirst_1,
+    kPbPb2011PID_ITSTPCTOFif2,        // (NO FULL CUTSET)
+    kPbPb2011PID_TPCTOF3,             // (NO FULL CUTSET)
+    kPbPb2011TRK_SDDfirstSPDnone,     // (NO FULL CUTSET) complimentary tracks, strictly without SPD, to be combined with others!
+    kPbPb2011TRK_SPDfirst,            // (NO FULL CUTSET) main track selection, with SPD first
+    kPbPb2011TRK_SDDfirstSPDnone4cls, // (NO FULL CUTSET) complimentary tracks, strictly without SPD, to be combined with others!
+    kPbPb2011TRK_SPDfirst5cls,        // (NO FULL CUTSET) main track selection, with SPD first
+    kPbPb2011_TPCITS_TOFif1,
+    kPbPb2011_TPCTOF_Semi2, // changed PairCutsAna from PhiV to OpeningAngle. prefilter cuts renewed (if applicable)
+    // following cutsets are not complete anymore!
+    kPbPb2011_TPCTOF_Semi1, // old prefilter cuts (leg & pair), some are confusing
+    kPbPb2011NoPID, // pairing disabled in config
+    kPbPb2011TPCandTOF, // this was the final one activated by Christoph!
+    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,
+    kPbPb2011MidCentral,
+               kPbPb2011SemiCentral,
+               kPbPb2011Peripheral,
+               kCENTSELMAX
+       };
+  
+       //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* GetPairCutsAna(Int_t cutSet, Bool_t tooglePC=kFALSE);
+       AliAnalysisCuts* GetPairCutsPre(Int_t cutSet);  
+  
+       AliAnalysisCuts* GetPIDCutsAna(Int_t cutSet);  
+       AliAnalysisCuts* GetPIDCutsPre(Int_t cutSet);  
+  
+       AliAnalysisCuts* GetTrackCutsAna(Int_t cutSet);  
+       AliAnalysisCuts* GetTrackCutsPre(Int_t cutSet);  
+       AliAnalysisCuts* GetESDTrackCutsAna(Int_t cutSet);  
+  
+  
+  // Note: event cuts are identical for all analysis 'cutDefinition's that run together!
+  // the selection is hardcoded in the AddTask, currently to 'kPbPb2011_TPCTOF_Semi1'
+       AliDielectronEventCuts* GetEventCuts(Int_t cutSet) {
+         AliDielectronEventCuts* eventCuts = 0x0;
+         switch (cutSet) {
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+      case kPbPb2011_TPCTOF_Semi1:
+      case kPbPb2011NoPID:
+      case kPbPb2011TPCandTOF :
+               case kPbPb2011TPCandTOFHPT:
+      case kPbPb2011TPC :
+      case kPbPb2011TPCandTOFwide :
+      case kPbPb2011TPCorTOF  :
+      case kpp2010TPCandTOF :
+      case kpp2010TPCorTOF  :
+        //Basic Event Cuts for pp and Pb-Pb, additional cuts may be in the AddTask
+        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;
+       }
+  
+  
+       //Selection of relatively 'flat' centralities
+       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 kPbPb2011MidCentral:
+        centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011MidCentral");
+        centCuts->AddCut(AliDielectronVarManager::kCentrality,10.,20.);
+        break;
+      case kPbPb2011SemiCentral:
+        centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011SemiCentral");
+        centCuts->AddCut(AliDielectronVarManager::kCentrality,20.,50.);
+        break;
+      case kPbPb2011Peripheral:
+        centCuts = new AliDielectronVarCuts("centCuts","CentralityPbPb2011Peripheral");
+        centCuts->AddCut(AliDielectronVarManager::kCentrality,50.,90.);
+        break;
+                       default: cout << "No Centrality selected" << endl;
+         }
+         return centCuts;
+       }
+  
+  
+       //Basic track rotator settings from J/Psi, more investigation needed
+       AliDielectronTrackRotator* GetTrackRotator(Int_t cutSet) {
+         AliDielectronTrackRotator* trackRotator = 0x0;
+         switch (cutSet) {
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+      case kPbPb2011_TPCTOF_Semi1:
+      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 kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+      case kPbPb2011_TPCTOF_Semi1:
+        mixingHandler = new AliDielectronMixingHandler;
+        mixingHandler->AddVariable(AliDielectronVarManager::kZvPrim,"-10,-5,0,5,10");
+        mixingHandler->AddVariable(AliDielectronVarManager::kCentrality,"0,5,10,20,30,50,80");
+        // now using TPC event plane, uncorrected. (also, the old phi range was wrong, now same effective binning.)
+        mixingHandler->AddVariable(AliDielectronVarManager::kTPCrpH2uc, 6, TMath::Pi()/-2., TMath::Pi()/2.);
+        mixingHandler->SetDepth(15);
+        mixingHandler->SetMixType(AliDielectronMixingHandler::kAll);
+        break;
+        //[...]
+      default: cout << "No Mixer defined" << endl;
+         }
+         return mixingHandler;
+       }
+  
+  
+  
+       //Pair Cuts for Analysis step - take care of logic - inverted compared to other PairCuts!!
+  // cuts = SELECTION!!!
+       AliAnalysisCuts* GetPairCutsAna(Int_t cutSet, Bool_t togglePC /*=kFALSE*/)  {
+    cout << " >>>>>>>>>>>>>>>>>>>>>> GetPairCutsAna() >>>>>>>>>>>>>>>>>>>>>> " << endl;
+    AliAnalysisCuts* pairCuts=0x0;
+    switch (cutSet) {
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+        cout << "No Pair Cuts used - ok " << endl; // since 18.02.2014
+        break;
+        
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+        //        AliDielectronVarCuts* pairCutsPhivGood =new AliDielectronVarCuts("pairCutsPhivGood","pairCutsPhivGood");
+        //        pairCutsPhivGood->AddCut(AliDielectronVarManager::kPhivPair, 0.0, 2.0); 
+        AliDielectronVarCuts* pairCutsOpAngGood =new AliDielectronVarCuts("pairCutsOpAngGood","pairCutsOpAngGood");
+        pairCutsOpAngGood->AddCut(AliDielectronVarManager::kOpeningAngle, 0.05, 999.); // in upgrade: 0.05
+        AliDielectronVarCuts* pairCutsInvM =new AliDielectronVarCuts("pairCutsInvM","pairCutsInvM");
+        pairCutsInvM->AddCut(AliDielectronVarManager::kM, 0.0, 0.02); // in upgrade: 0.01
+        AliDielectronVarCuts* pairCutsInvMgood =new AliDielectronVarCuts("pairCutsInvMgood","pairCutsInvMgood");
+        pairCutsInvMgood->AddCut(AliDielectronVarManager::kM, 0.02, 99999.);
+        
+        AliDielectronCutGroup* pairCutsCG =new AliDielectronCutGroup("pairCutsCG","pairCutsCG",AliDielectronCutGroup::kCompAND);
+        pairCutsCG->AddCut(pairCutsInvM);
+        pairCutsCG->AddCut(pairCutsOpAngGood);
+        //        pairCutsCG->AddCut(pairCutsPhivGood);
+        
+        AliDielectronCutGroup* pairCutsCG2 =new AliDielectronCutGroup("pairCutsCG2","pairCutsCG2",AliDielectronCutGroup::kCompOR);
+        pairCutsCG2->AddCut(pairCutsInvMgood);
+        pairCutsCG2->AddCut(pairCutsCG);
+        pairCuts = pairCutsCG2;
+        break;
+        
+      case kPbPb2011_TPCTOF_Semi1:
+        //[...] // PhiV and InvMass
+                 default: cout << "No Pair Cuts defined " << endl;
+    }
+    return pairCuts;
+       }
+  
+  
+       //Pair Cuts for PREFILTER step
+  // cuts = REJECTION!!!
+       AliAnalysisCuts* GetPairCutsPre(Int_t cutSet)  {  
+    cout << " >>>>>>>>>>>>>>>>>>>>>> GetPairCutsPre() >>>>>>>>>>>>>>>>>>>>>> " << endl;
+    AliAnalysisCuts* pairCuts=0x0;
+    switch (cutSet) {
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+        AliDielectronVarCuts* pairCutsInvM =new AliDielectronVarCuts("pairCutsInvM","pairCutsInvM");
+        pairCutsInvM->AddCut(AliDielectronVarManager::kM, 0.0, 0.02); // in upgrade: 0.01
+        AliDielectronVarCuts* pairCutsOpAng =new AliDielectronVarCuts("pairCutsOpAng","pairCutsOpAng");
+        pairCutsOpAng->AddCut(AliDielectronVarManager::kOpeningAngle, 0.0, 0.05); // in upgrade: 0.05
+        
+        AliDielectronCutGroup* pairCutsCG =new AliDielectronCutGroup("pairCutsCG","pairCutsCG",AliDielectronCutGroup::kCompAND);
+        pairCutsCG->AddCut(pairCutsInvM);
+        pairCutsCG->AddCut(pairCutsOpAng);
+        //pairCutsCG->AddCut(pairCutsPhiv);
+        pairCuts = pairCutsCG;
+        break;
+        
+      case kPbPb2011_TPCTOF_Semi1:
+        //[...] // PhiV and InvMass
+      default: cout << "No Prefilter Pair Cuts defined " << endl;
+         } 
+         return pairCuts;
+       }
+  
+  
+  
+       AliAnalysisCuts* GetPIDCutsAna(Int_t cutSet) {
+    cout << " >>>>>>>>>>>>>>>>>>>>>> GetPIDCutsAna() >>>>>>>>>>>>>>>>>>>>>> " << endl;
+         AliAnalysisCuts* pidCuts=0x0;
+    
+         //-----------------------------------------------
+         // Define different PID Cuts, that are used later
+         //-----------------------------------------------
+    // PID cuts depend on TPC_inner_p, if not specified
+    // PID cut ranges correspond to global momentum P
+    // check it again!!!
+         //-----------------------------------------------
+         
+    //
+    //
+    //TPC: electron inclusion asymmetric
+         //     pion     exclusion 3sigma
+         //TOF: electron inclusion 3sigma in region where p,K cross electrons in TPC
+         AliDielectronPID *pidTPCTOF_Semi1 = new AliDielectronPID("pidTPCTOF_Semi1","pidTPCTOF_Semi1");
+         pidTPCTOF_Semi1->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -1.5, 3., 0. ,100., kFALSE);
+         pidTPCTOF_Semi1->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3., 0. ,100., kTRUE);
+         pidTPCTOF_Semi1->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3., 0. ,1.7 , kFALSE);
+    //
+    //
+    // LOOSE PID TPC+TOF
+    AliDielectronPID *pidTPCTOF_Semi_LOOSE = new AliDielectronPID("pidTPCTOF_Semi_LOOSE","pidTPCTOF_Semi_LOOSE");
+         pidTPCTOF_Semi_LOOSE->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-12. ,20. , 0. ,100., kFALSE);
+         pidTPCTOF_Semi_LOOSE->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3. , 0. ,1.7 , kFALSE);
+    //
+    //
+    // PID TPC only
+         AliDielectronPID *pidTPC_3 = new AliDielectronPID("pidTPC_3","pidTPC_3");
+         pidTPC_3->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -1.5, 3., 0. ,100., kFALSE);
+         pidTPC_3->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3., 0. ,100., kTRUE);
+    
+    
+    //TPC: electron inclusion asymmetric
+         //     pion     exclusion 3sigma
+         //ITS: electron inclusion asymmetric in region where p,K cross electrons in TPC
+         //TOF: electron inclusion 3sigma in similar region - BUT ONLY IF AVAILABLE
+         AliDielectronPID *pidTPCITS_TOFif1 = new AliDielectronPID("pidTPCITS_TOFif1","pidTPCITS_TOFif1");
+         pidTPCITS_TOFif1->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -1.5, 3. , 0. ,100., kFALSE);
+         pidTPCITS_TOFif1->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3. , 0. ,100., kTRUE);
+         pidTPCITS_TOFif1->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -4. , 1. , 0. ,1.5 , kFALSE);
+         pidTPCITS_TOFif1->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3. , 0. ,1.7 , kFALSE, AliDielectronPID::kIfAvailable);
+    //
+    //
+    //TPC: electron inclusion asymmetric
+         //     pion     exclusion 3sigma
+         //ITS: electron inclusion asymmetric OVER FULL MOMENTUM RANGE
+         //TOF: electron inclusion 3sigma - BUT ONLY IF AVAILABLE
+         AliDielectronPID *pidTPCITS_TOFif2 = new AliDielectronPID("pidTPCITS_TOFif2","pidTPCITS_TOFif2");
+         pidTPCITS_TOFif2->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -1.5, 3. , 0. ,100., kFALSE);
+         pidTPCITS_TOFif2->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3. , 0. ,100., kTRUE);
+         pidTPCITS_TOFif2->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -4. , 1. , 0. ,100., kFALSE);
+         pidTPCITS_TOFif2->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3. , 0. ,100., kFALSE, AliDielectronPID::kIfAvailable);
+    //
+    //
+    // LOOSE PID ITS+TPC+TOFif
+    AliDielectronPID *pidTPCITS_TOFif_LOOSE = new AliDielectronPID("pidTPCITS_TOFif_LOOSE","pidTPCITS_TOFif_LOOSE");
+         pidTPCITS_TOFif_LOOSE->AddCut(AliDielectronPID::kTPC,AliPID::kElectron,-12. ,20. , 0. ,100., kFALSE);
+         pidTPCITS_TOFif_LOOSE->AddCut(AliDielectronPID::kITS,AliPID::kElectron,-10. ,20. , 0. ,100., kFALSE);
+         pidTPCITS_TOFif_LOOSE->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3. , 0. ,100., kFALSE, AliDielectronPID::kIfAvailable);
+    //
+    //
+    // PID ITS+TPC
+    AliDielectronPID *pidTPCITS_3 = new AliDielectronPID("pidTPCITS_3","pidTPCITS_3");
+         pidTPCITS_3->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -1.5, 3. , 0. ,100., kFALSE);
+         pidTPCITS_3->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3. , 0. ,100., kTRUE);
+         pidTPCITS_3->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -4. , 1. , 0. ,100., kFALSE);
+    //
+    //
+    // tighter PID ITS+TPC+TOFif
+    // ITS only up to momentum where proton contamination is seen in TPC signal
+    AliDielectronPID *pidTPCITS_TOFif56 = new AliDielectronPID("pidTPCITS_TOFif56","pidTPCITS_TOFif56");
+         pidTPCITS_TOFif56->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -1.5, 2.5, 0. ,100., kFALSE);
+         pidTPCITS_TOFif56->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3. , 0. ,100., kTRUE);
+         pidTPCITS_TOFif56->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -4. , 0.5, 0. ,  2., kFALSE);
+         pidTPCITS_TOFif56->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -2. , 2. , 0. ,100., kFALSE, AliDielectronPID::kIfAvailable);
+    
+    
+         //Apply ITS cuts (see Hongyan's talks):
+         //3 sigma inclusion of electrons in TPC
+         //3 sigma exclusion of pions in TPC
+         //3 sigma inclusion of electrons in ITS,TOF for p<1.5GeV, where p,K contamination
+         //TOF only IF available!
+         AliDielectronPID *pidTPCandITSTOF = new AliDielectronPID("pidTPCandITSTOF","pidTPCandITSTOF");//"TPC-TOF-ITS"
+         pidTPCandITSTOF->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -3.,3., 0.,100., kFALSE);
+         pidTPCandITSTOF->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3.,3., 0.,100., kTRUE);
+         pidTPCandITSTOF->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -6.,3., 0.,1.5, kFALSE );
+         pidTPCandITSTOF->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3.,3., 0.,1.5, kFALSE,AliDielectronPID::kIfAvailable );
+    
+    // eta range:
+    AliDielectronVarCuts *etaRange090 = new AliDielectronVarCuts("etaRange090","etaRange090");
+    etaRange090->AddCut(AliDielectronVarManager::kEta, -0.90, 0.90);
+    AliDielectronVarCuts *etaRange084 = new AliDielectronVarCuts("etaRange084","etaRange084");
+    etaRange084->AddCut(AliDielectronVarManager::kEta, -0.84, 0.84);
+    AliDielectronVarCuts *etaRange076 = new AliDielectronVarCuts("etaRange076","etaRange076");
+    etaRange076->AddCut(AliDielectronVarManager::kEta, -0.76, 0.76);
+    // pt range:
+    AliDielectronVarCuts *ptRange400to3500 = new AliDielectronVarCuts("ptRange400to3500","ptRange400to3500");
+    ptRange400to3500->AddCut(AliDielectronVarManager::kPt, .4, 3.5);
+    
+    
+         //-----------------------------------------------
+         // Now see what Config actually loads and assemble final cuts
+         //-----------------------------------------------
+    switch (cutSet) {
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight: // tighter "ITSTPCTOFif" PID
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange076);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCITS_TOFif56);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+    
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange076);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCITS_3);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange090);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPC_3);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+      
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose: // loose "ITSTPCTOFif" PID - for 2D contamination study
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange076);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCITS_TOFif_LOOSE);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange090);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCTOF_Semi_LOOSE);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+      
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4: // regular "ITSTPCTOFif" PID
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange076);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCITS_TOFif2);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange090);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCTOF_Semi1);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+        
+      case kPbPb2011_TPCITS_TOFif1:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange084); // was 0.84 -> not ideal
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCITS_TOFif1);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet));
+        pidCuts = cgPIDCutsAna;
+        break;
+      case kPbPb2011_TPCTOF_Semi2:
+      case kPbPb2011_TPCTOF_Semi1:
+        AliDielectronCutGroup* cgPIDCutsAna = new AliDielectronCutGroup("cgPIDCutsAna","cgPIDCutsAna",AliDielectronCutGroup::kCompAND);
+        cgPIDCutsAna->AddCut(etaRange084);
+        cgPIDCutsAna->AddCut(ptRange400to3500);
+        cgPIDCutsAna->AddCut(pidTPCTOF_Semi1);
+        cgPIDCutsAna->AddCut(GetTrackCutsAna(cutSet)); // for 'kPbPb2011_TPCTOF_Semi1', this was called in the Config
+        pidCuts = cgPIDCutsAna;
+        break;
+        //[...]
+               case kPbPb2011TPCandTOFHPT:
+        //test Hongyan's cut
+        AliDielectronCutGroup* cgSecondTrackFilterPIDTPC1 = new AliDielectronCutGroup("cgPIDTPC1","cgPIDTPC1",AliDielectronCutGroup::kCompAND);
+        cgSecondTrackFilterPIDTPC1->AddCut(etaRange084);
+        cgSecondTrackFilterPIDTPC1->AddCut(ptRange400to3500);
+        cgSecondTrackFilterPIDTPC1->AddCut(pidTPCandITSTOF);
+        pidCuts = cgSecondTrackFilterPIDTPC1;
+        break;
+        //[...]
+      default: cout << "No Analysis PID Cut defined " << endl;
+         }
+         return pidCuts;
+       }
+  
+  
+       //Make/Tighten track Cuts that are *NOT* already
+       //done in the AOD production
+       //**IMPORTANT**: For AODs, select FilterBit
+       //the method is ignored for ESDs
+       
+       AliAnalysisCuts* GetTrackCutsAna(Int_t cutSet) {
+    cout << " >>>>>>>>>>>>>>>>>>>>>> GetTrackCutsAna() >>>>>>>>>>>>>>>>>>>>>> " << endl;
+         AliDielectronCutGroup* trackCuts=0x0;
+         switch (cutSet) {
+        
+      
+        //----------
+        // these MAIN settings have to combine different track selections:
+        //----------
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+        // combine typical and new trackcuts with "kCompOR" condition:
+        cgTrackCutsAnaSPDorSDD = new AliDielectronCutGroup("cgTrackCutsAnaSPDorSDD","cgTrackCutsAnaSPDorSDD",AliDielectronCutGroup::kCompOR);
+        cgTrackCutsAnaSPDorSDD->AddCut(GetTrackCutsAna(kPbPb2011TRK_SPDfirst));         // typical trackcuts with requirement of SPD
+        cgTrackCutsAnaSPDorSDD->AddCut(GetTrackCutsAna(kPbPb2011TRK_SDDfirstSPDnone)); // new additional trackcuts with SDD instead of SPD
+        trackCuts = cgTrackCutsAnaSPDorSDD;
+        break;
+        
+        //----------
+        // these MAIN settings just load the main track selection directly below:
+        //----------
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+        //----------
+      case kPbPb2011TRK_SPDfirst: // main track selection, now closer to what Hongyan does...
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     4.0, 100.0); // means at least 2 with PID
+        trackCutsAOD->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCr,     100.0, 160.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCfCross,     0.8, 1.1); // lower limit 0.8 in most filterbits! // 1.1 since 26.02.2014
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1<<4); // (=16) filterbit 4! //GetStandardITSTPCTrackCuts2011(kFALSE); loose DCA, 2D cut
+        trackCutsDiel->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
+        
+        cgTrackCutsAnaSPDfirst = new AliDielectronCutGroup("cgTrackCutsAnaSPDfirst","cgTrackCutsAnaSPDfirst",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsAnaSPDfirst->AddCut(trackCutsDiel);
+        cgTrackCutsAnaSPDfirst->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsAnaSPDfirst;
+        break;
+        
+      case kPbPb2011TRK_SDDfirstSPDnone: // complimentary tracks, strictly without SPD, to be combined with others!
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     3.0, 100.0); // means at least 3 with PID
+        trackCutsAOD->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCr,     100.0, 160.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCfCross,     0.8, 1.1); // lower limit 0.8 in most filterbits! // 1.1 since 26.02.2014
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1<<6); // GetStandardITSTPCTrackCuts2011(kTRUE), SPD none, SDD first
+        
+        cgTrackCutsAnaSDDnoSPD = new AliDielectronCutGroup("cgTrackCutsAnaSDDnoSPD","cgTrackCutsAnaSDDnoSPD",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsAnaSDDnoSPD->AddCut(trackCutsDiel);
+        cgTrackCutsAnaSDDnoSPD->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsAnaSDDnoSPD;
+        break;
+        
+        //----------
+        // MAIN settings - combined trackset - variation 1
+        //----------
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+        // combine typical and new trackcuts with "kCompOR" condition:
+        cgTrackCutsAnaSPDorSDD = new AliDielectronCutGroup("cgTrackCutsAnaSPDorSDD","cgTrackCutsAnaSPDorSDD",AliDielectronCutGroup::kCompOR);
+        cgTrackCutsAnaSPDorSDD->AddCut(GetTrackCutsAna(kPbPb2011TRK_SPDfirst5cls));         // typical trackcuts with requirement of SPD
+        cgTrackCutsAnaSPDorSDD->AddCut(GetTrackCutsAna(kPbPb2011TRK_SDDfirstSPDnone4cls)); // new additional trackcuts with SDD instead of SPD
+        trackCuts = cgTrackCutsAnaSPDorSDD;
+        break;
+        
+        //----------
+        // MAIN settings - single trackset - variation 1
+        //----------
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+        //----------
+      case kPbPb2011TRK_SPDfirst5cls: // main track selection, 5+ ITS clusters
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     5.0, 100.0); // means at least 3 with PID
+        trackCutsAOD->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCr,     100.0, 160.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCfCross,     0.8, 1.1);
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1<<4); // (=16) filterbit 4! //GetStandardITSTPCTrackCuts2011(kFALSE); loose DCA, 2D cut
+        trackCutsDiel->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
+        
+        cgTrackCutsAnaSPDfirst = new AliDielectronCutGroup("cgTrackCutsAnaSPDfirst","cgTrackCutsAnaSPDfirst",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsAnaSPDfirst->AddCut(trackCutsDiel);
+        cgTrackCutsAnaSPDfirst->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsAnaSPDfirst;
+        break;
+        
+      case kPbPb2011TRK_SDDfirstSPDnone4cls: // complimentary tracks, 4+ ITS clusters, strictly without SPD, to be combined with others!
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     4.0, 100.0); // means at least 4 with PID
+        trackCutsAOD->AddCut(AliDielectronVarManager::kTPCchi2Cl,    0.0,   4.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCr,     100.0, 160.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCfCross,     0.8, 1.1);
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1<<6); // GetStandardITSTPCTrackCuts2011(kTRUE), SPD none, SDD first
+        
+        cgTrackCutsAnaSDDnoSPD = new AliDielectronCutGroup("cgTrackCutsAnaSDDnoSPD","cgTrackCutsAnaSDDnoSPD",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsAnaSDDnoSPD->AddCut(trackCutsDiel);
+        cgTrackCutsAnaSDDnoSPD->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsAnaSDDnoSPD;
+        break;
+        
+        // ==========
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2: // no pt and eta ranges in the trackcuts anymore!
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        // trackCutsAOD->AddCut(AliDielectronVarManager::kEta, -0.84, 0.84); // eta commented out later. (05.02.2014)
+        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);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCr,     110.0, 160.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNFclsTPCfCross,     0.8, 1.0);
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(16); //does nothing for ESDs // 16=2^4 -> filter bit 4!
+        trackCutsDiel->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst); //function in AliDielectronTrackCuts
+        
+        cgTrackCutsAna = new AliDielectronCutGroup("cgTrackCutsAna","cgTrackCutsAna",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsAna->AddCut(trackCutsDiel);
+        cgTrackCutsAna->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsAna;
+        break;
+        
+      case kPbPb2011_TPCTOF_Semi1:
+        //[...]
+      default: cout << "No Analysis Track Cut defined " << endl;
+         }
+         return trackCuts;
+       } 
+  
+  
+  
+       //Relaxed PID cuts for additional rejectin step, do not use blindly
+       AliAnalysisCuts* GetPIDCutsPre(Int_t cutSet) {
+    cout << " >>>>>>>>>>>>>>>>>>>>>> GetPIDCutsPre() >>>>>>>>>>>>>>>>>>>>>> " << endl;
+         AliAnalysisCuts* pidCuts=0x0;
+         switch (cutSet) {
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+        
+        // eta range:
+        AliDielectronVarCuts *etaRangePre1 = new AliDielectronVarCuts("etaRangePre1","etaRangePre1");
+        etaRangePre1->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+        // pt range:
+        AliDielectronVarCuts *ptRangePre1 = new AliDielectronVarCuts("ptRangePre1","ptRangePre1");
+        ptRangePre1->AddCut(AliDielectronVarManager::kPt, .2, 3.5); // 0.2 is realistic. turnon at ~180MeV
+        //AliDielectronVarCuts *ptRangePre2 = new AliDielectronVarCuts("ptRangePre2","ptRangePre2");
+        //ptRangePre2->AddCut(AliDielectronVarManager::kPt, .4, 3.5);
+        //AliDielectronVarCuts *ptRangePre3 = new AliDielectronVarCuts("ptRangePre3","ptRangePre3");
+        //ptRangePre3->AddCut(AliDielectronVarManager::kPt, 0.05, 1.5);
+        
+        AliDielectronCutGroup* cgITSTPCTOFpre = new AliDielectronCutGroup("cgITSTPCTOFpre","cgITSTPCTOFpre",AliDielectronCutGroup::kCompAND);
+        AliDielectronPID *pidITSTPCTOFpre = new AliDielectronPID("pidITSTPCTOFpre","pidITSTPCTOFpre");
+        pidITSTPCTOFpre->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -3. , 3., 0. ,100., kFALSE);
+        pidITSTPCTOFpre->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3., 0. ,100., kTRUE);
+        // ITS will be used:
+        //  pidITSTPCTOFpre->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -3. , 3., 0. ,1.7 , kFALSE);
+        // TOF will be used if available, and with pt instead of p:
+        //  pidITSTPCTOFpre->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3., 0.4,100., kFALSE, 
+        //                          AliDielectronPID::kIfAvailable, AliDielectronVarManager::kPt);
+        cgITSTPCTOFpre->AddCut(pidITSTPCTOFpre);
+        cgITSTPCTOFpre->AddCut(etaRangePre1);
+        cgITSTPCTOFpre->AddCut(ptRangePre1);
+        cgITSTPCTOFpre->AddCut(GetTrackCutsAna(cutSet));
+        
+        //        AliDielectronCutGroup* cgTPCpre = new AliDielectronCutGroup("cgTPCpre","cgTPCpre",AliDielectronCutGroup::kCompAND);
+        //        AliDielectronPID *pidTPCpre = new AliDielectronPID("pidTPCpre","pidTPCpre");
+        //        pidTPCpre->AddCut(AliDielectronPID::kTPC,AliPID::kElectron, -3. , 3., 0. ,100., kFALSE);
+        //        pidTPCpre->AddCut(AliDielectronPID::kTPC,AliPID::kPion,     -3. , 3., 0. ,100., kTRUE);
+        //        // TOF will be used if available, and with pt instead of p:
+        //        pidTPCpre->AddCut(AliDielectronPID::kTOF,AliPID::kElectron, -3. , 3., 0.4,5.  , kFALSE, 
+        //                          AliDielectronPID::kIfAvailable, AliDielectronVarManager::kPt);
+        //        cgTPCpre->AddCut(pidTPCpre);
+        //        cgITSTPCTOFpre->AddCut(etaRangePre1);
+        //        cgTPCpre->AddCut(ptRangePre2);
+        //        cgTPCpre->AddCut(GetTrackCutsAna(cutSet));
+        
+        //        AliDielectronCutGroup* cgITSSA = new AliDielectronCutGroup("cgITSSA","cgITSSA",AliDielectronCutGroup::kCompAND);
+        //        AliDielectronPID *pidITSSA = new AliDielectronPID("pidITSSA","pidITSSA");
+        //        pidITSSA->AddCut(AliDielectronPID::kITS,AliPID::kElectron, -3., 3.);
+        //        // this means that very many pions will be used for rejection!
+        //        cgITSSA->AddCut(pidITSSA);
+        //        cgITSTPCTOFpre->AddCut(etaRangePre1);
+        //        cgITSSA->AddCut(ptRangePre3);
+        //        cgITSSA->AddCut(GetTrackCutsPre(cutSet));
+        
+        AliDielectronCutGroup* cgInitialTrackFilter = new AliDielectronCutGroup("cgInitialTrackFilter","cgInitialTrackFilter",AliDielectronCutGroup::kCompOR);
+        cgInitialTrackFilter->AddCut(GetPIDCutsAna(cutSet)); // in case the prefilter cuts do not include all needed global tracks.
+        cgInitialTrackFilter->AddCut(cgITSTPCTOFpre);
+        //cgInitialTrackFilter->AddCut(cgTPCpre);
+        //cgInitialTrackFilter->AddCut(cgITSSA);
+        pidCuts = cgInitialTrackFilter;   // kCompOR works!!! <- checked with 'SetNoPairing()' and commented out 'GetPIDCutsAna(selectedPID)'
+        //cout << " ========== pidCuts prefilter: ========== " << endl;
+        //pidCuts->Print();
+        break;
+        
+      case kPbPb2011_TPCTOF_Semi1:
+        //[...]
+      default: cout << "No Prefilter PID Cut defined " << endl;
+         }
+         return pidCuts;
+       }
+  
+  
+       //Possibly different cut sets for Prefilter step
+       //Not used at the moment
+       AliAnalysisCuts* GetTrackCutsPre(Int_t cutSet) {
+    cout << " >>>>>>>>>>>>>>>>>>>>>> GetTrackCutsPre() >>>>>>>>>>>>>>>>>>>>>> " << endl;
+         AliDielectronCutGroup* trackCuts=0x0;
+         switch (cutSet) {
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kEta,-0.84,0.84);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     3.0, 100.0);
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1); //does nothing for ESDs, ITSSA(???) // maybe use FilterBit(2) instead!
+        
+        cgTrackCutsPre = new AliDielectronCutGroup("cgTrackCutsPre","cgTrackCutsPre",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsPre->AddCut(trackCutsDiel);
+        cgTrackCutsPre->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsPre;
+        break;
+        
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kEta,-0.9,0.9);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     4.0, 100.0);
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1); //does nothing for ESDs, ITSSA(???) // maybe use FilterBit(2) instead!
+        trackCutsDiel->SetRequireITSRefit(kTRUE); //function in AliDielectronTrackCuts
+        trackCutsDiel->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst); //function in AliDielectronTrackCuts
+        
+        cgTrackCutsPre = new AliDielectronCutGroup("cgTrackCutsPre","cgTrackCutsPre",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsPre->AddCut(trackCutsDiel);
+        cgTrackCutsPre->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsPre;
+        break;
+        
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2: // no pt ranges in the trackcuts anymore!
+        AliDielectronVarCuts* trackCutsAOD =new AliDielectronVarCuts("trackCutsAOD","trackCutsAOD");
+        trackCutsAOD->AddCut(AliDielectronVarManager::kEta,-0.84,0.84);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParXY, -1.0,   1.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kImpactParZ,  -3.0,   3.0);
+        trackCutsAOD->AddCut(AliDielectronVarManager::kNclsITS,     3.0, 100.0);
+        AliDielectronTrackCuts *trackCutsDiel = new AliDielectronTrackCuts("trackCutsDiel","trackCutsDiel");
+        trackCutsDiel->SetAODFilterBit(1); //does nothing for ESDs, ITSSA(???) // maybe use FilterBit(2) instead!
+        trackCutsDiel->SetRequireITSRefit(kTRUE); //function in AliDielectronTrackCuts
+        trackCutsDiel->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst); //function in AliDielectronTrackCuts
+        
+        cgTrackCutsPre = new AliDielectronCutGroup("cgTrackCutsPre","cgTrackCutsPre",AliDielectronCutGroup::kCompAND);
+        cgTrackCutsPre->AddCut(trackCutsDiel);
+        cgTrackCutsPre->AddCut(trackCutsAOD);
+        trackCuts = cgTrackCutsPre;
+        break;
+        
+      case kPbPb2011_TPCTOF_Semi1:
+        //[...]
+      default: cout << "No Prefilter Track Cut defined " << endl;
+         }
+         return trackCuts;
+       }
+  
+  
+  
+       //*******************************************************************************
+       //*******************************************************************************
+       //** ESD TRACK CUTS TUNED FOR AGREEMENT BETWEEN AODS AND ESDS  ******************
+       //** NOT NECESSARILY 100% OPTIMIZED FOR DIEL-ANALYSIS          ******************
+       //*******************************************************************************
+       //*******************************************************************************
+  
+       //WHEN RUNNING ON ESDs: LOAD Default Cuts for AODs
+       AliAnalysisCuts* GetESDTrackCutsAna(Int_t cutSet) {
+    //cout << " >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> " << endl;
+    cout << " >>>>>>>>>>>>>>>>>>>>>>  GetESDTrackCutsAna()  >>>>>>>>>>>>>>>>>>>>>> " << endl;
+    //cout << " >>>>>>>>>>>>>>>>>>>>>> Setting ESD Track Cuts >>>>>>>>>>>>>>>>>>>>>> " << endl;
+    //cout << " >>>>>>>>>>>>>>>>>>>>>> ( do we run on ESD?! ) >>>>>>>>>>>>>>>>>>>>>> " << endl;
+    //cout << " >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>> " << endl;
+         AliESDtrackCuts* esdTrackCutsH = 0x0;
+         switch (cutSet) {
+      case kPbPb2011_pidITSTPC_trkSPDfirst_3:
+      case kPbPb2011_pidTPC_trkSPDfirst_3:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_2_loose:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_2_loose:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPD5orSDD4cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst5cls_6_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDorSDD_5_tight:
+      case kPbPb2011_pidITS2gevTPCTOFif_trkSPDfirst_5_tight:
+      case kPbPb2011_pidITSTPCTOFif_trkSPD5orSDD4cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst5cls_4:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDorSDD_1:
+      case kPbPb2011_pidITSTPCTOFif_trkSPDfirst_1:
+      case kPbPb2011_pidTPCTOF_trkSPDorSDD_1:
+      case kPbPb2011_pidTPCTOF_trkSPDfirst_1:
+      case kPbPb2011_TPCITS_TOFif1:
+      case kPbPb2011_TPCTOF_Semi2:
+      case kPbPb2011_TPCTOF_Semi1:
+      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);
+        
+        //The cuts below should be the onyl ones that are missing
+        //explicitely in the TrackCutsAna method
+        //To be sure, StandardITSTPCTrackCuts is loaded however
+        /* 
+         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 ESD Track Cut defined " << endl;
+         }
+         return esdTrackCutsH;
+       } 
+  
+  
+};