add robust defaults
authorcbaumann <cbaumann@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Jun 2012 21:43:09 +0000 (21:43 +0000)
committercbaumann <cbaumann@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 19 Jun 2012 21:43:09 +0000 (21:43 +0000)
PWGDQ/dielectron/macrosLMEE/AddTask_cbaumann_LMEEPbPb2011.C
PWGDQ/dielectron/macrosLMEE/AddTask_cbaumann_LMEEpp2010.C
PWGDQ/dielectron/macrosLMEE/ConfigLMEEPbPb2011.C
PWGDQ/dielectron/macrosLMEE/ConfigLMEEpp2010.C

index 0c3f03b..fc9820f 100644 (file)
@@ -1,31 +1,39 @@
-AliAnalysisTask *AddTask_cbaumann_LMEEPbPb2011(Bool_t runRejection=kFALSE, Bool_t setMC=kFALSE){
+AliAnalysisTask *AddTask_cbaumann_LMEEPbPb2011(Bool_t runRejection=kFALSE, Bool_t setMC=kFALSE,Bool_t enableCF=kFALSE){
   //get the current analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-       Error("AddTask_cbaumann_LMEEPbPb2011", "No analysis manager found.");
-       return 0;
+    Error("AddTask_cbaumann_LMEEPbPb2011", "No analysis manager found.");
+    return 0;
   }
 
-  //set config file name
-  TString configFile("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/ConfigLMEEPbPb2011.C");
+  //create config File names: TRAIN_ROOT is for running on GSI train, 
+  // ALICE_ROOT for CERN Lego trains
+  TString configBasePath("$TRAIN_ROOT/cbaumann_dielectron/");
+  TString trainRoot=gSystem->Getenv("TRAIN_ROOT");                                                                            
+  if (trainRoot.IsNull()) configBasePath= "$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/";
+  TString configFile("ConfigLMEEPbPb2011.C");
+  TString configLMEECutLib("LMEECutLib.C");
 
-  //AOD Usage not yet testes/avialable-------------------------------------
+  TString configFilePath(configBasePath+configFile);
+  TString configLMEECutLib(configBasePath+configLMEECutLib);
 
+  //AOD Usage currently tested with separate task, to be merged
   if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
-       ::Info("AddTaskLMEEPbPb2011", "no dedicated AOD configuration");
-//     configFile="$TRAIN_ROOT/util/dielectron/dielectron/macros/ConfigLMEEPbPb2011AOD.C";     
-       
+    ::Info("AddTaskLMEEPbPb2011", "no dedicated AOD configuration");
   }
 
   //Do we have an MC handler?
-  //Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
   Bool_t hasMC=setMC;
+  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
+    hasMC=kTRUE;
 
-//  create task and add it to the manager
-//     gSystem->AddIncludePath("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE");
 
-       gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/LMEECutLib.C");
-       gROOT->LoadMacro(configFile.Data());
+
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configFile.Data()))
+    gROOT->LoadMacro(configFilePath.Data());
+  if (!gROOT->GetListOfGlobalFunctions()->FindObject(configLMEECutLib.Data()))
+    gROOT->LoadMacro(configLMEECutLibPath.Data());
+
   LMEECutLib* cutlib = new LMEECutLib();
   AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
   if (!hasMC){ task->UsePhysicsSelection();
@@ -36,78 +44,60 @@ AliAnalysisTask *AddTask_cbaumann_LMEEPbPb2011(Bool_t runRejection=kFALSE, Bool_
   //load dielectron configuration file
 
   //add dielectron analysis with different cuts to the task
-/*
-  AliDielectron *lowmass1=ConfigLMEEPbPb2011(1,hasMC);
-  task->AddDielectron(lowmass1);
-  printf("add: %s\n",lowmass1->GetName());
-
-  AliDielectron *lowmass2=ConfigLMEEPbPb2011(2,hasMC);
-  task->AddDielectron(lowmass2);
-  printf("add: %s\n",lowmass2->GetName());
-*/
-  /*
-  AliDielectron *lowmass3=ConfigLMEEPbPb2011(3,hasMC);
-  task->AddDielectron(lowmass3);
-  printf("add: %s\n",lowmass3->GetName());
-*/
-if (runRejection) {
-  AliDielectron *lowmass4=ConfigLMEEPbPb2011(4,hasMC);
-  task->AddDielectron(lowmass4);
-  printf("add: %s\n",lowmass4->GetName());
-/*
-  AliDielectron *lowmass8=ConfigLMEEPbPb2011(8,hasMC);
-  task->AddDielectron(lowmass8);
-  printf("add: %s\n",lowmass8->GetName())
-*/
-//  AliDielectron *lowmass5=ConfigLMEEPbPb2011(5,hasMC);
-//  task->AddDielectron(lowmass5);
-//  printf("add: %s\n",lowmass5->GetName());
-}
-else {
-  AliDielectron *lowmass3=ConfigLMEEPbPb2011(3,hasMC);
-  task->AddDielectron(lowmass3);
-  printf("add: %s\n",lowmass3->GetName())
-AliDielectron *lowmass1=ConfigLMEEPbPb2011(1,hasMC);
-  task->AddDielectron(lowmass1);
-  printf("add: %s\n",lowmass1->GetName())
-  AliDielectron *lowmass7=ConfigLMEEPbPb2011(7,hasMC);
-  task->AddDielectron(lowmass7);
-  printf("add: %s\n",lowmass7->GetName())
-}
+  if (runRejection) {
+
+    AliDielectron *lowmass4=ConfigLMEEPbPb2011(4,hasMC,enableCF);
+    task->AddDielectron(lowmass4);
+    printf("add: %s\n",lowmass4->GetName());
+  }
+  else {
+
+    AliDielectron *lowmass3=ConfigLMEEPbPb2011(3,hasMC,enableCF);
+    task->AddDielectron(lowmass3);
+    printf("add: %s\n",lowmass3->GetName())
+      AliDielectron *lowmass1=ConfigLMEEPbPb2011(1,hasMC,enableCF);
+    task->AddDielectron(lowmass1);
+    printf("add: %s\n",lowmass1->GetName())
+      AliDielectron *lowmass7=ConfigLMEEPbPb2011(7,hasMC,enableCF);
+    task->AddDielectron(lowmass7);
+    printf("add: %s\n",lowmass7->GetName())
+  }
 
   mgr->AddTask(task);
 
   //create output container
   AliAnalysisDataContainer *coutput1 =
-       mgr->CreateContainer("cbaumann_LMEEPbPb2011_tree",
-               TTree::Class(),
-               AliAnalysisManager::kExchangeContainer,
-               "cbaumann_LMEEPbPb2011_default.root");
+    mgr->CreateContainer("cbaumann_LMEEPbPb2011_tree",
+       TTree::Class(),
+       AliAnalysisManager::kExchangeContainer,
+       "cbaumann_LMEEPbPb2011_default.root");
 
   AliAnalysisDataContainer *cOutputHist1 =
-       mgr->CreateContainer("cbaumann_LMEEPbPb2011_out",
-               TList::Class(),
-               AliAnalysisManager::kOutputContainer,
-               "cbaumann_LMEEPbPb2011_out.root");
-//  if (hasMC) {
-  AliAnalysisDataContainer *cOutputHist2 =
-       mgr->CreateContainer("cbaumann_LMEEPbPb2011_CF",
-               TList::Class(),
-               AliAnalysisManager::kOutputContainer,
-               "cbaumann_LMEEPbPb2011_out.root");
-
-//       }
+    mgr->CreateContainer("cbaumann_LMEEPbPb2011_out",
+       TList::Class(),
+       AliAnalysisManager::kOutputContainer,
+       "cbaumann_LMEEPbPb2011_out.root");
+  if (enableCF) {
+    AliAnalysisDataContainer *cOutputHist2 =
+      mgr->CreateContainer("cbaumann_LMEEPbPb2011_CF",
+         TList::Class(),
+         AliAnalysisManager::kOutputContainer,
+         "cbaumann_LMEEPbPb2011_out.root");
+
+  }
   AliAnalysisDataContainer *cOutputHist3 =
-       mgr->CreateContainer("cbaumann_EventStatPbPb2011",
-               TH1D::Class(),
-               AliAnalysisManager::kOutputContainer,
-               "cbaumann_LMEEPbPb2011_out.root");
+    mgr->CreateContainer("cbaumann_EventStatPbPb2011",
+       TH1D::Class(),
+       AliAnalysisManager::kOutputContainer,
+       "cbaumann_LMEEPbPb2011_out.root");
 
 
   mgr->ConnectInput(task,  0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(task, 0, coutput1 );
   mgr->ConnectOutput(task, 1, cOutputHist1);
-  mgr->ConnectOutput(task, 2, cOutputHist2);
+  if (enableCF) {
+    mgr->ConnectOutput(task, 2, cOutputHist2);
+  }
   mgr->ConnectOutput(task, 3, cOutputHist3);
 
   return task;
index 4628a06..9549ce4 100644 (file)
@@ -1,9 +1,9 @@
-AliAnalysisTask *AddTask_cbaumann_LMEEpp2010(Bool_t runTwo=kFALSE){
+AliAnalysisTask *AddTask_cbaumann_LMEEpp2010(Bool_t runTwo=kFALSE, Bool_t hasMC=kFALSE, Bool_t enableCF=kFALSE){
   //get the current analysis manager
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) {
-       Error("AddTask_cbaumann_LMEEpp2010", "No analysis manager found.");
-       return 0;
+    Error("AddTask_cbaumann_LMEEpp2010", "No analysis manager found.");
+    return 0;
   }
 
   //set config file name
@@ -12,71 +12,74 @@ AliAnalysisTask *AddTask_cbaumann_LMEEpp2010(Bool_t runTwo=kFALSE){
   //AOD Usage not yet testes/avialable-------------------------------------
 
   if (mgr->GetInputEventHandler()->IsA()==AliAODInputHandler::Class()){
-       ::Info("AddTaskLMEEpp2010", "no dedicated AOD configuration");
-//     configFile="$TRAIN_ROOT/util/dielectron/dielectron/macros/ConfigLMEEpp2010AOD.C";       
-       
+    ::Info("AddTaskLMEEpp2010", "no dedicated AOD configuration");
+    // configFile="$TRAIN_ROOT/util/dielectron/dielectron/macros/ConfigLMEEpp2010AOD.C";       
+
   }
 
-  //Do we have an MC handler?
-  Bool_t hasMC=(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0);
+  //Do we have an MC handler? //Child protected, if auto-recognition fails
+  if (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()!=0x0)
+    hasMC=kTRUE;
 
 
-//  create task and add it to the manager
+  //  create task and add it to the manager
 
-   gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/LMEECutLib.C");
+  gROOT->LoadMacro("$ALICE_ROOT/PWGDQ/dielectron/macrosLMEE/LMEECutLib.C");
   gROOT->LoadMacro(configFile.Data());
   LMEECutLib* cutlib = new LMEECutLib();
   AliAnalysisTaskMultiDielectron *task=new AliAnalysisTaskMultiDielectron("MultiDiEData");
   if (!hasMC) task->UsePhysicsSelection();
   task->SetEventFilter(cutlib->GetEventCuts(LMEECutLib::kpp2010TPCandTOF)); //
-       
+
 
   //load dielectron configuration file
 
   //add dielectron analysis with different cuts to the task
-  
-  AliDielectron *lowmass1=ConfigLMEEpp2010(1,hasMC);
+
+  AliDielectron *lowmass1=ConfigLMEEpp2010(1,hasMC,enableCF);
   task->AddDielectron(lowmass1);
   printf("add: %s\n",lowmass1->GetName());
-if (runTwo) {
-  AliDielectron *lowmass2=ConfigLMEEpp2010(2,hasMC);
-  task->AddDielectron(lowmass2);
-  printf("add: %s\n",lowmass2->GetName());
-}
-  
+
+  if (runTwo) {
+    AliDielectron *lowmass2=ConfigLMEEpp2010(2,hasMC,enableCF);
+    task->AddDielectron(lowmass2);
+    printf("add: %s\n",lowmass2->GetName());
+  }
+
   mgr->AddTask(task);
 
   //create output container
   AliAnalysisDataContainer *coutput1 =
-       mgr->CreateContainer("cbaumann_LMEEpp2010_tree",
-               TTree::Class(),
-               AliAnalysisManager::kExchangeContainer,
-               "cbaumann_LMEEpp2010_default.root");
+    mgr->CreateContainer("cbaumann_LMEEpp2010_tree",
+       TTree::Class(),
+       AliAnalysisManager::kExchangeContainer,
+       "cbaumann_LMEEpp2010_default.root");
 
   AliAnalysisDataContainer *cOutputHist1 =
-       mgr->CreateContainer("cbaumann_LMEEpp2010_out",
-               TList::Class(),
-               AliAnalysisManager::kOutputContainer,
-               "cbaumann_LMEEpp2010_out.root");
-
-  AliAnalysisDataContainer *cOutputHist2 =
-       mgr->CreateContainer("cbaumann_LMEEpp2010_CF",
-               TList::Class(),
-               AliAnalysisManager::kOutputContainer,
-               "cbaumann_LMEEpp2010_out.root");
-
+    mgr->CreateContainer("cbaumann_LMEEpp2010_out",
+       TList::Class(),
+       AliAnalysisManager::kOutputContainer,
+       "cbaumann_LMEEpp2010_out.root");
+  if (enableCF) {
+    AliAnalysisDataContainer *cOutputHist2 =
+      mgr->CreateContainer("cbaumann_LMEEpp2010_CF",
+         TList::Class(),
+         AliAnalysisManager::kOutputContainer,
+         "cbaumann_LMEEpp2010_out.root");
+  }
   AliAnalysisDataContainer *cOutputHist3 =
-       mgr->CreateContainer("cbaumann_EventStatPbPb2011",
-               TH1D::Class(),
-               AliAnalysisManager::kOutputContainer,
-               "cbaumann_LMEEpp2010_out.root");
+    mgr->CreateContainer("cbaumann_EventStatPbPb2011",
+       TH1D::Class(),
+       AliAnalysisManager::kOutputContainer,
+       "cbaumann_LMEEpp2010_out.root");
 
 
   mgr->ConnectInput(task,  0, mgr->GetCommonInputContainer());
   mgr->ConnectOutput(task, 0, coutput1 );
   mgr->ConnectOutput(task, 1, cOutputHist1);
-  mgr->ConnectOutput(task, 2, cOutputHist2);
+  if (enableCF) {
+    mgr->ConnectOutput(task, 2, cOutputHist2);
+  }  
   mgr->ConnectOutput(task, 3, cOutputHist3);
 
   return task;
index f444416..d40b824 100644 (file)
@@ -23,6 +23,9 @@ AliDielectron* ConfigLMEEPbPb2011(Int_t cutDefinition, Bool_t hasMC=kFALSE)
 
   MCenabled=hasMC;
 
+  if (MCenabled)
+         die->SetHasMC(kTRUE);
+
   // create the actual framework object
 
   TString name=Form("%02d",cutDefinition);
@@ -288,18 +291,21 @@ void InitCF(AliDielectron* die, Int_t cutDefinition)
   //pair variables
   cf->AddVariable(AliDielectronVarManager::kP,200,0,20);
   cf->AddVariable(AliDielectronVarManager::kM,201,-0.01,4.01); //20Mev Steps
+  cf->AddVariable(AliDielectronVarManager::kY,100,-2.,2.);
   cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);
 
   cf->AddVariable(AliDielectronVarManager::kCentrality,"0.,10.0,30.0,40.0,60.,80.,100.");
+  cf->AddVariable(AliDielectronVarManager::kOpeningAngle,320,0.,3.2);
   //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::kY,100,-2.,2.,kTRUE);
   //only in this case write MC truth info
   if (MCenabled) {
        cf->SetStepForMCtruth();
        cf->SetStepsForMCtruthOnly();
-       cf->AddVariable(AliDielectronVarManager::kHaveSameMother,21,-10,10,kTRUE);
+       cf->AddVariable(AliDielectronVarManager::kHaveSameMother,5,-2,2);
        cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
        cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
   }
index d2248dd..3c5c538 100644 (file)
@@ -10,7 +10,7 @@ const Int_t nDie=arrNames->GetEntries();
 Bool_t MCenabled=kFALSE;
 
 
-AliDielectron* ConfigLMEEpp2010(Int_t cutDefinition, Bool_t hasMC=kFALSE)
+AliDielectron* ConfigLMEEpp2010(Int_t cutDefinition, Bool_t hasMC=kFALSE, Bool_t enableCF=kTRUE);
 {
 
   Int_t selectedPID=-1;
@@ -23,6 +23,8 @@ AliDielectron* ConfigLMEEpp2010(Int_t cutDefinition, Bool_t hasMC=kFALSE)
 
   MCenabled=hasMC;
 
+  if (MCenabled)
+       die->SetHasMC(kTRUE);
   // create the actual framework object
 
   TString name=Form("%02d",cutDefinition);
@@ -88,7 +90,7 @@ AliDielectron* ConfigLMEEpp2010(Int_t cutDefinition, Bool_t hasMC=kFALSE)
   InitHistograms(die,cutDefinition);
 
   // the last definition uses no cuts and only the QA histograms should be filled!
-  InitCF(die,cutDefinition);
+  if (enableCF) InitCF(die,cutDefinition);
 
   return die;
 }
@@ -259,20 +261,35 @@ void InitCF(AliDielectron* die, Int_t cutDefinition)
   //
   // Setupd the CF Manager if needed
   //
-  AliDielectronCF *cf=new AliDielectronCF(die->GetName(),die->GetTitle());
+       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::kY,100,-2.,2.);
+       cf->AddVariable(AliDielectronVarManager::kPairType,10,0,10);
+
+       cf->AddVariable(AliDielectronVarManager::kCentrality,"0.,10.0,30.0,40.0,60.,80.,100.");
+       cf->AddVariable(AliDielectronVarManager::kOpeningAngle,320,0.,3.2);
+       //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::kY,100,-2.,2.,kTRUE);
+       //only in this case write MC truth info
+       if (MCenabled) {
+               cf->SetStepForMCtruth();
+               cf->SetStepsForMCtruthOnly();
+               cf->AddVariable(AliDielectronVarManager::kHaveSameMother,5,-2,2);
+               cf->AddVariable(AliDielectronVarManager::kPdgCode,10000,-5000.5,4999.5,kTRUE);
+               cf->AddVariable(AliDielectronVarManager::kPdgCodeMother,10000,-5000.5,4999.5,kTRUE);
+       }
 
-  //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);
-/*
-  //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);
-*/
-  //only in this case write MC truth info
+       cf->SetStepsForSignal();
+       die->SetCFManagerPair(cf);
+
+
+//only in this case write MC truth info
   if (MCenabled) {
        cf->SetStepForMCtruth();
        cf->SetStepsForMCtruthOnly();