]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/correlationHF/macros/AddTaskDxHFECorrelationME.C
d54e4888b72dd96333671017cdce64b474e695f6
[u/mrichter/AliRoot.git] / PWGHF / correlationHF / macros / AddTaskDxHFECorrelationME.C
1 //-*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef __CINT__
5 //#include "AliESDtrackCuts.h"
6 //#include "AliAnalysisCuts.h"
7 //#include "AliFlowTrackSimple.h"      // added as hint for hidden library dependency to libPWGflowBase
8 //#include "AliFlowCandidateTrack.h"   // added as hint for hidden library dependency to libPWGflowTasks
9 //#include "AliCFContainer.h"          // added as hint for hidden library dependency to libCORRFW
10 //#include "AliAODRecoDecayHF2Prong.h" // added as hint for hidden library dependency to libPWGHFvertexingHF
11 #include "AliAnalysisTaskDxHFECorrelation.h"
12 #include "AliDxHFECorrelation.h"
13 #include "AliAnalysisManager.h"
14 #include "AliAnalysisDataContainer.h"
15 #include "AliHFEcuts.h"
16 #include "AliLog.h"
17 #include "TObject.h"
18 #include "TClass.h"
19 #include "TDirectory.h"
20 #include "TROOT.h"
21 #include "AliRDHFCutsD0toKpi.h"
22 #include "AliHFAssociatedTrackCuts.h"
23 using namespace std;
24 #endif
25
26
27 /// @file   AddTaskDxHFECorrelation.C
28 /// @author Matthias.Richter@ift.uib.no, Hege.Erdal@ift.uib.no
29 /// @date   2013-02-12
30 /// @brief  Add two instances of D0-HFE correlation task to the manager, SE and ME
31 ///
32 int AddTaskDxHFECorrelationME(TString configuration="")
33 {
34   //First check to see if user wants to see help
35   if (configuration.BeginsWith("help") || 
36       configuration.BeginsWith("--help") || 
37       configuration.BeginsWith("-h") || 
38       configuration.BeginsWith("options") ) {
39     cout <<"\n\n============================================" << endl;
40     cout << "Keywords for AddTaskDxHFECorrelationME.C:\n"
41          << "file=                         - Filename to store output in\n"
42          << "name=                         - Name of analysis, will correspond to directory inside the file \n"
43          << "cutname=                      - Filename where information on event pool for event-mixing is stored (if use external file)\n"
44          << "runD0MassReference            - If you also want to include D2H task for D0selection (for comparison purposes)\n"
45          << "mc                            - Run on MC\n"
46          << "usekine                       - To run on kinematical level \n"
47          << "PbPb                          - To run on PbPb \n"
48          << "trigger=D/D0/electron         - Which particle to trigger on \n"
49          << "\nD0 settings: \n"
50          << "fillD0scheme=both/D0/D0bar    - Which fillsheme to use for D0\n"
51          << "\nelectron settings: \n"
52          << "useinvmasscut                 - If you want to use invariant mass cut (default is 100MeV/c)\n" 
53          << "invmasscut=                   - If you want to specify a different invariant mass cut \n"
54          << "extraname=                    - extraname for directory and list if you run several tasks at once\n"
55          << "tpcclusters=                  - How many TPC clusters to use on single track cuts for electrons (default=120)\n"
56          << "itsclusters=                  - How many itsclusters to be used in single track cuts for electrons (default=4) \n"
57          << "itsreq=                       - (kFirst,kAny,kNone) Which ITSpixel requirement you want to impose\n"
58          << "elmcreco=                     - (aftertrackcuts/aftertofpid/afterfullpid) Where you want to stop in track selection to look for electrons for mc \n\n";
59     return;
60   } 
61
62   TString taskOptions="";
63   Bool_t nameset=kFALSE;
64   Bool_t triggerset=kFALSE;
65   Int_t system=0;
66   // look for configuration arguments if nothing specified
67   // in the function call
68   if (configuration.IsNull() && gDirectory) {
69     const char* confObjectName="run_single_task_configuration";
70     TObject* confObject=gDirectory->FindObject(confObjectName);
71     if (confObject) {
72       configuration=confObject->GetTitle();
73     }
74   }
75
76   // argument scan
77   // TODO: currently the name and trigger type are fixed, this requirement
78   // can be loosened later
79   TString delimiter(" ");
80   TStringToken configurationToken(configuration, delimiter);
81   while (configurationToken.NextToken()) {
82     TString argument=configurationToken;
83     if (argument.BeginsWith("name=")) {
84       //To remove various instances of name, and force directory to be DxHFE
85       if(!nameset){
86         taskOptions+=" "+argument;
87         nameset=kTRUE;
88       }
89     }
90     //At the moment: Make sure trigger is D0
91     else if (argument.BeginsWith("trigger=")) {
92       if(!triggerset){
93         taskOptions+=" trigger=D0";
94         triggerset=kTRUE;
95       }
96     }
97     else if(argument.BeginsWith("PbPb") ||
98             argument.BeginsWith("system=1")){
99       system=1;
100       taskOptions+=" PbPb";
101     }
102     else {
103       // simply pass argument
104       taskOptions+=" "+argument;
105     }
106   }
107   TString path;
108   path="AddTaskDxHFECorrelation.C";
109
110   if (gSystem->AccessPathName(path)!=0) {
111     // first try local macro, than AliRoot default path
112     path="$ALICE_ROOT/PWGHF/correlationHF/macros/AddTaskDxHFECorrelation.C";
113   }
114
115   gROOT->LoadMacro(path);
116
117   if (!nameset) taskOptions+=" name=DxHFE";
118   if (!taskOptions) taskOptions+=" trigger=D0";
119
120   if(!AddTaskDxHFECorrelation(taskOptions)) {
121     printf("Problem setting up the single event correlation task, returning\n");
122     return 0;
123   }
124   
125   taskOptions+=" event-mixing";
126   if(!AddTaskDxHFECorrelation(taskOptions)) {
127     printf("Problem setting up the mixed event correlation task, returning\n");
128       return 0;
129   }
130
131   return 1;
132 }                
133