]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG3/vertexingHF/RunAnalysisAODVertexingHF.C
Fix in the last caall to CleanOwnPrimaryVertex
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / RunAnalysisAODVertexingHF.C
index 043260a03e9c23ae8ea4688cdf23788a026fce9d..f28c70c6767fb09c70536f28975999fd790b991d 100644 (file)
@@ -15,7 +15,7 @@ void RunAnalysisAODVertexingHF()
   //
 
 
-  gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/PWG3 -I$ALICE_ROOT/PWG3/vertexingHF -g"); 
+  gSystem->SetIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_ROOT/OADB -I$ALICE_ROOT/PWG3 -I$ALICE_ROOT/PWG3/base -I$ALICE_ROOT/PWG3/vertexingHF -g"); 
   //
   TString trainName = "D2H";
   TString analysisMode = "grid"; // "local", "grid", or "proof"
@@ -23,7 +23,7 @@ void RunAnalysisAODVertexingHF()
   Long64_t nentries=123567890,firstentry=0;
   Bool_t useParFiles=kFALSE;
   Bool_t useAlienPlugin=kTRUE;
-  TString pluginmode="test";
+  TString pluginmode="full";
   Bool_t saveProofToAlien=kFALSE;
   TString proofOutdir = "";
   TString loadMacroPath="$ALICE_ROOT/PWG3/vertexingHF/macros/";
@@ -137,7 +137,7 @@ void RunAnalysisAODVertexingHF()
   TString dataset; // for proof
 
   if(!useAlienPlugin) {
-    TString makeAODInputChain="MakeAODInputChain.C"; makeAODInputChain.Prepend(loadMacroPath.Data());
+    TString makeAODInputChain="../MakeAODInputChain.C"; makeAODInputChain.Prepend(loadMacroPath.Data());
     if(inputMode=="list") {
       // Local files
       gROOT->LoadMacro(makeAODInputChain.Data());
@@ -175,10 +175,14 @@ void RunAnalysisAODVertexingHF()
   //-------------------------------------------------------------------
   // Analysis tasks (wagons of the train)   
   //
+  // First add the task for the PID response setting
+  gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
+  AliAnalysisTaskSE *setupTask = AddTaskPIDResponse(kFALSE,kTRUE);
+
   TString taskName;
   
   ////// ADD THE FULL D2H TRAIN
-  /*taskName="AddD2HTrain.C"; taskName.Prepend(loadMacroPath.Data());
+  /*taskName="../AddD2HTrain.C"; taskName.Prepend(loadMacroPath.Data());
   gROOT->LoadMacro(taskName.Data());
   Bool_t readMC=kFALSE;
   AddD2HTrain(readMC);//,1,0,0,0,0,0,0,0,0,0,0);*/
@@ -211,22 +215,19 @@ void RunAnalysisAODVertexingHF()
     gROOT->LoadMacro(taskName.Data());
     AliAnalysisTaskSEBkgLikeSignD0 *lsD0Task = AddTaskBkgLikeSignD0();
     
-    taskName="AddTaskBkgLikeSignJPSI.C"; taskName.Prepend(loadMacroPath.Data());
-    gROOT->LoadMacro(taskName.Data());
-    AliAnalysisTaskSEBkgLikeSignJPSI *lsJPSITask = AddTaskBkgLikeSignJPSI();
-    
-    //taskName="AddTaskBtoJPSItoEle.C"; taskName.Prepend(loadMacroPath.Data());
-    //gROOT->LoadMacro(taskName.Data());
-    //AliAnalysisTaskSEBtoJPSItoEle *jpsiTask = AddTaskBtoJPSItoEle();
-    
     taskName="AddTaskCFMultiVarMultiStep.C"; taskName.Prepend(loadMacroPath.Data());
     gROOT->LoadMacro(taskName.Data());
     AliCFHeavyFlavourTaskMultiVarMultiStep *cfmvmsTask = AddTaskCFMultiVarMultiStep();
     
-    taskName="AddTaskCharmFraction.C"; taskName.Prepend(loadMacroPath.Data());
+
+    taskName="AddTaskSECharmFraction.C"; 
+    taskName.Prepend(loadMacroPath.Data());
     gROOT->LoadMacro(taskName.Data());
-    Int_t switchMC[5]={1,1,1,1,1};
-    AliAnalysisTaskSECharmFraction *cFractTask = AddTaskCharmFraction("d0D0",switchMC);
+    Int_t switchMC[5]={0,0,0,0,0};
+    Int_t ppPbPb=1;// 0 for pp, 1 for PbPb, used to siwtch on/off the removal of daughters from the primary vertex
+    AliAnalysisTaskSECharmFraction *cFractTask = AddTaskSECharmFraction("standard",switchMC,readMC,kTRUE,kFALSE,"D0toKpiCharmFractCuts.root","c",ppPbPb);
+    // arguments: filename,switchMC,readmc,usepid,likesign,cutfilename,containerprefix
+
     
     // attach a private task (not committed)
     // (the files MyTask.h MyTask.cxx AddMyTask.C have to be declared in plugin
@@ -275,40 +276,50 @@ AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test",Bool_t useParFiles
   // Check if user has a valid token, otherwise make one. This has limitations.
   // One can always follow the standard procedure of calling alien-token-init then
   //   source /tmp/gclient_env_$UID in the current shell.
-   if (!AliAnalysisGrid::CreateToken()) return NULL;
    AliAnalysisAlien *plugin = new AliAnalysisAlien();
    // Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
    plugin->SetRunMode(pluginmode.Data());
-   plugin->SetUser("dainesea");
-   plugin->SetNtestFiles(1);
+   plugin->SetUser();
    // Set versions of used packages
    plugin->SetAPIVersion("V1.1x");
-   plugin->SetROOTVersion("v5-26-00b-6");
-   plugin->SetAliROOTVersion("v4-19-18-AN");
+   plugin->SetROOTVersion();
+   plugin->SetAliROOTVersion();
+
+   gROOT->LoadMacro("$ALICE_ROOT/PWG3/vertexingHF/AddGoodRuns.C");
+
    // Declare input data to be processed.
-   // Method 1: Create automatically XML collections using alien 'find' command.
-   // Define production directory LFN
-   //  plugin->SetGridDataDir("/alice/cern.ch/user/r/rbala/data_pass4_good_runCINT1B_8thfeb/");
-   //plugin->SetGridDataDir("/alice/sim/PDC_09/LHC09a4/AOD3/");
-   // Set data search pattern
-   plugin->SetGridDataDir("/alice/data/2010/LHC10b");
-   plugin->SetDataPattern("pass2/AOD001/*AliAOD.root");
+   //************************************************
+   // Set data search pattern for DATA
+   //************************************************   
+   plugin->SetGridDataDir("/alice/data/2010/LHC10d"); // specify LHC period
+   plugin->SetDataPattern("pass2/AOD018/*AliAOD.root"); // specify reco pass and AOD set
    plugin->SetFriendChainName("./AliAOD.VertexingHF.root");
-   //plugin->SetFriendChainName("deltas/AliAOD.VertexingHF.root");
+   // OR plugin->SetFriendChainName("deltas/AliAOD.VertexingHF.root");
    // Adds only the good runs from the Monalisa Run Condition Table
-   AddGoodRuns(plugin,"LHC10b");
-   // ...then add run numbers to be considered
-   // plugin->SetMaxMergeFiles(100);
-   plugin->SetNrunsPerMaster(100);
-   //plugin->SetNumberOfReplicas(2);
-   //  or
-   //plugin->SetRunRange(529000,529007);
-   // Method 2: Declare existing data files (raw collections, xml collections, root file)
-   // If no path mentioned data is supposed to be in the work directory (see SetGridWorkingDir())
-   // XML collections added via this method can be combined with the first method if
-   // the content is compatible (using or not tags)
-   //plugin->AddDataFile("/alice/cern.ch/user/r/rbala/newtrain/collection/collection_aod_lhc08w.xml");
-   //   plugin->AddDataFile("/alice/data/2008/LHC08c/000057657/raw/Run57657.Merged.RAW.tag.root");
+   // More than one period can be added but the period name has to be removed from GridDataDir (to be tested)
+   Int_t totruns=0;
+   //totruns += AddGoodRuns(plugin,"LHC10b"); // specify LHC period
+   //totruns += AddGoodRuns(plugin,"LHC10c"); // specify LHC period
+   totruns += AddGoodRuns(plugin,"LHC10d"); // specify LHC period
+   plugin->SetNrunsPerMaster(totruns);
+   
+   //************************************************
+   // Set data search pattern for MONTECARLO
+   //************************************************
+   /* 
+   plugin->SetGridDataDir("/alice/sim/LHC10d3"); // specify MC sample
+   plugin->SetDataPattern("AOD005/*AliAOD.root"); // specify AOD set
+   plugin->SetFriendChainName("./AliAOD.VertexingHF.root");
+   // OR plugin->SetFriendChainName("deltas/AliAOD.VertexingHF.root");
+   // Adds only the good runs from the Monalisa Run Condition Table 
+   // More than one period can be added!
+   Int_t totruns=0;
+   totruns += AddGoodRuns(plugin,"LHC10b","LHC10d3"); // specify LHC period for anchor runs; and the name of the MC production
+   //totruns += AddGoodRuns(plugin,"LHC10c","LHC10f7"); // specify LHC period for anchor runs;  and the name of the MC production
+   //totruns += AddGoodRuns(plugin,"LHC10d","LHC10f7"); // specify LHC period for anchor runs;  and the name of the MC production
+   plugin->SetNrunsPerMaster(totruns);
+   */
+   //
    // Define alien work directory where all files will be copied. Relative to alien $HOME.
    plugin->SetGridWorkingDir("myHFanalysis");
    // Declare alien output directory. Relative to working directory.
@@ -318,75 +329,32 @@ AliAnalysisGrid* CreateAlienHandler(TString pluginmode="test",Bool_t useParFiles
    //plugin->SetAnalysisSource("AliDStarJets.cxx");
    // Declare all libraries (other than the default ones for the framework. These will be
    // loaded by the generated analysis macro. Add all extra files (task .cxx/.h) here.
-   plugin->SetAdditionalLibs("libPWG3vertexingHF.so libPWG3base.so libPWG3muon.so");
+   plugin->SetAdditionalLibs("libPWG3base.so libPWG3vertexingHF.so");
    // use par files
    if(useParFiles) {
      plugin->EnablePackage("STEERBase.par");
      plugin->EnablePackage("ESD.par");
      plugin->EnablePackage("AOD.par");
      plugin->EnablePackage("ANALYSIS.par");
+     plugin->EnablePackage("OADB.par");
      plugin->EnablePackage("ANALYSISalice.par");
      plugin->EnablePackage("CORRFW.par");
      plugin->EnablePackage("PWG3base.par");
      plugin->EnablePackage("PWG3vertexingHF.par");
-     plugin->EnablePackage("PWG3muon.par");
    }
-   plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/PWG3 -I$ALICE_ROOT/PWG3/vertexingHF -g");
-   // Declare the output file names separated by blancs.
-   // (can be like: file.root or file.root@ALICE::Niham::File)
+   plugin->AddIncludePath("-I. -I$ROOTSYS/include -I$ALICE_ROOT -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TPC -I$ALICE_ROOT/CONTAINERS -I$ALICE_ROOT/STEER -I$ALICE_ROOT/TRD -I$ALICE_ROOT/macros -I$ALICE_ROOT/ANALYSIS  -I$ALICE_ROOT/OADB -I$ALICE_ROOT/PWG3 -I$ALICE_ROOT/PWG3/base -I$ALICE_ROOT/PWG3/vertexingHF -g");
+
    plugin->SetDefaultOutputs(kTRUE);
-   //plugin->SetOutputFiles("output.root CmpHF.root CmpHFnt.root D0InvMass.root InvMassDplus.root InvMassDplus_nt1.root InvMassDplus_nt2.root");
-   // Optionally define the files to be archived.
-   //   plugin->SetOutputArchive("log_archive.zip:stdout,stderr@ALICE::NIHAM::File root_archive.zip:*.root@ALICE::NIHAM::File");
-   //   plugin->SetOutputArchive("log_archive.zip:stdout,stderr");
+   // merging via jdl
+   plugin->SetMergeViaJDL(kTRUE);
+   plugin->SetOneStageMerging(kFALSE);
+   plugin->SetMaxMergeStages(2);
+
    // Optionally set a name for the generated analysis macro (default MyAnalysis.C)
    plugin->SetAnalysisMacro("AnalysisHF.C");
    // Optionally set maximum number of input files/subjob (default 100, put 0 to ignore)
-   plugin->SetSplitMaxInputFileNumber(10);
-   // Optionally set number of failed jobs that will trigger killing waiting sub-jobs.
-   //plugin->SetMaxInitFailed(5);
-   // Optionally resubmit threshold.
-   //plugin->SetMasterResubmitThreshold(90);
-   // Optionally set time to live (default 30000 sec)
-   //plugin->SetTTL(20000);
-   // Optionally set input format (default xml-single)
-   plugin->SetInputFormat("xml-single");
    // Optionally modify the name of the generated JDL (default analysis.jdl)
    plugin->SetJDLName("TaskHF.jdl");
-   // Optionally modify job price (default 1)
-   //plugin->SetPrice(1);      
-   // Optionally modify split mode (default 'se')    
-   plugin->SetSplitMode("se");
-
 
    return plugin;
 }
-//----------------------------------------------------------------------------
-void AddGoodRuns(AliAnalysisAlien* plugin,TString lhcPeriod) {
-  //
-  // Adds good runs from the Monalisa Run Condition Table
-  //
-  plugin->SetRunPrefix("000");
-
-  if(lhcPeriod=="LHC10b") {
-    Int_t nruns=52;
-    Int_t runlist[52]={117222, 117220, 117120, 117118, 117116, 117112, 117109, 117099, 117092, 117086, 117082, 117077, 117063, 117060, 117059, 117054, 117053, 117052, 117050, 117048, 116643, 116611, 116609, 116574, 116571, 116562, 116561, 116559, 116403, 116402, 116401, 116288, 116102, 115514, 115414, 115401, 115393, 115345, 115335, 115328, 115325, 115322, 115318, 115310, 115193, 115186, 114931};
-   
-    for(Int_t k=0;k<nruns;k++){
-      plugin->AddRunNumber(runlist[k]);
-    }
-    plugin->SetNrunsPerMaster(nruns);
-  }
-
-  if(lhcPeriod=="LHC10c") { 
-    Int_t nruns=57;
-    Int_t runlist[57]={120829, 120825, 120824, 120823, 120822, 120821, 120820, 120758, 120750, 120741, 120671, 120617, 120616, 120505, 120504, 120503, 120244, 120079, 120076, 120073, 120072, 120069, 120067, 119862, 119859, 119856, 119853, 119849, 119846, 119845, 119844, 119842, 119841, 119163, 119161, 119159};
-   
-    for(Int_t k=0;k<nruns;k++){
-      plugin->AddRunNumber(runlist[k]);
-    }
-    plugin->SetNrunsPerMaster(nruns);
-  }
-
-  return;
-}