MCmodif1 EMCal phys sel off, EMCal trigger on
[u/mrichter/AliRoot.git] / PWGJE / FlavourJetTasks / macros / AddTasksFlavourJet.C
CommitLineData
647ea9aa 1void AddTasksFlavourJet(const Int_t iCandType = 1 /*0 = D0, 1=Dstar...*/,
92d9c9cb 2 const TString sCutFile = "cutsHF/D0toKpiCutsppRecVtxNoPileupRejNoEMCAL.root",
3 const Double_t dJetPtCut = 1.,
4 const Double_t dJetAreaCut = 0.,
5 const char *acctype = "TPC",
6 const TString sRunPeriod = "LHC10b",
7 const Int_t uBeamType = 0,
8 const UInt_t uTriggerMask = AliVEvent::kMB, /*for jets; the D mesons trigger is defined in the cut object*/
9 const Bool_t bIsMC = kFALSE,
10 const Bool_t bIsReco = kFALSE,
11 const Bool_t bIsMap = kFALSE,
12 TString sText=""/*completes the name of the candidate task lists*/
13 )
f6e094bd 14{
92d9c9cb 15 const TString sInputTrkMC = "MCParticlesSelected";
16 const TString sInputTrkRec = "tracks";
17 const TString sUsedTrks = "PicoTracks";
18 const TString sUsedClus = "";
19 TString sInputTrk = bIsReco ? sInputTrkRec : sInputTrkMC;
20 const Int_t iJetAlgo = 1;
21 const Int_t iJetType = 1;
22 /*
23 const Int_t nRadius = 3;
24 const Double_t aRadius[] = { 0.2, 0.4, 0.6 };
25 const TString sRadius[] = { "R02", "R04", "R06" };
26 */
27 const Int_t nRadius = 1;
28 const Double_t aRadius[] = { 0.4 };
29 const TString sRadius[] = { "R04" };
30
31 //=============================================================================
32
33 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
34
35 if (!mgr) {
36 ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "No analysis manager to connect to.");
37 return;
38 }
39
40 TString type = mgr->GetInputEventHandler()->GetDataType();
41 if (!type.Contains("ESD") && !type.Contains("AOD")) {
42 ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "Task manager to have an ESD or AOD input handler.");
43 return;
44 }
45
46 if (!mgr->GetInputEventHandler()) {
47 ::Error("AddTasksFlavourJet.C::AddTasksFlavourJet", "This task requires an input event handler");
48 return;
49 }
50 //=============================================================================
51
52 UInt_t uAnaType = (((iJetType==0) || (iJetType==2)) ? 1 : 0);
53 Int_t iLeading = ((iJetType==0) ? 3 : ((iJetType==1) ? 0 : 1));
54 Int_t leadHadType=0; /* 0=charged, 1=neutral, 2=both*/
55 //D mesons -- PID
56 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPIDResponse.C");
57 AliAnalysisTaskSE *taskRespPID = AddTaskPIDResponse(bIsMC);
58
59 // -- D meson selection
60
d2f609e4 61 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/FlavourJetTasks/macros/AddTaskDFilterAndCorrelations.C");
62
bbb94467 63
92d9c9cb 64 // EMCal framework
65 // -- Physics selection task
a1a0a01b 66 if(!bIsMC){
67 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalPhysicsSelection.C");
68 AliPhysicsSelectionTask *physSelTask = AddTaskEmcalPhysicsSelection(kTRUE, kTRUE, uTriggerMask, 5, 5, 10, kTRUE, -1, -1, -1, -1);
69
70 if (!physSelTask) {
71 cout << "no physSelTask";
72 return;
73 }
92d9c9cb 74 }
92d9c9cb 75 // --
76 gROOT->LoadMacro("$ALICE_ROOT/PWG/EMCAL/macros/AddTaskEmcalSetup.C");
77 AliEmcalSetupTask *taskSetupEMCal = AddTaskEmcalSetup();
ad6abcae 78 //taskSetupEMCal->SetOcdbPath("raw://"); //needed for period LHC12h and i
92d9c9cb 79 taskSetupEMCal->SetGeoPath("$ALICE_ROOT/OADB/EMCAL");
80 taskSetupEMCal->SelectCollisionCandidates(uTriggerMask);
81
82 // Jet preparation
83 //gROOT->LoadMacro("/data/Work/jets/testEMCalJetFramework/code/v4/AddTaskJetPreparation.C");
84 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskJetPreparation.C");
a1a0a01b 85 AddTaskJetPreparation(sRunPeriod,"PicoTracks",bIsMC ? "MCParticlesSelected" : "",/*next 7 emcal default settings*/"","",2.,0.,0.03,0.015,0.15,uTriggerMask, kFALSE /*track cluster*/,kFALSE /*do histos*/,kTRUE /*make pico tracks*/,kTRUE /*make emcal trigger*/,kFALSE /*is emcal train*/);
92d9c9cb 86
92d9c9cb 87
88 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
89 //gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetSample.C");
90
92d9c9cb 91 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskJetResponseMaker.C");
92
93 for (Int_t i=0; i<nRadius; i++) {
94 //jet reconstruction for correlation
95 //AliEmcalJetTask *taskFJ = AddTaskEmcalJet(bIsMC&&!bIsReco ? sInputTrkMC.Data() : sUsedTrks.Data(),sUsedClus.Data(),iJetAlgo,aRadius[i],iJetType);
96 //I think like follows it's fine: sUsedTrks contains the picotracks of MC or reco tracks according to IsReco
97 AliEmcalJetTask *taskFJ = AddTaskEmcalJet(sUsedTrks.Data(),sUsedClus.Data(),iJetAlgo,aRadius[i],iJetType);
98
99 taskFJ->SelectCollisionCandidates(uTriggerMask);
100
101
102 // AliAnalysisTaskEmcalJetSample *taskjetsample=AddTaskEmcalJetSample(sUsedTrks.Data(),"",taskFJ->GetName(),
103 // "Rho",aRadius[i],dJetPtCut,dJetAreaCut,AliAnalysisTaskEmcalJet::kTPC,iLeading,
104 // "AliAnalysisTaskEmcalJetSample");
105 //taskjetsample->SelectCollisionCandidates(uTriggerMask);
106
bbb94467 107 //Filter and correlation with D meson
92d9c9cb 108
d2f609e4 109 AddTaskDFilterAndCorrelations(
bbb94467 110 iCandType,
92d9c9cb 111 sCutFile,
112 bIsMC,
113 bIsReco,
bbb94467 114 "",
92d9c9cb 115 taskFJ->GetName(),
bbb94467 116 //Form("JetR%s",sRadius[i].Data()),
92d9c9cb 117 iLeading,
118 leadHadType,
119 aRadius[i],
120 dJetPtCut,
121 acctype
bbb94467 122 //percjetareacut=1.
123 );
92d9c9cb 124
125 AliEmcalJetTask *taskMCJ;
126 //jet reconstruction for correction map
127 if(bIsMap){
d2f609e4 128 taskMCJ = AddTaskEmcalJet(sInputTrkMC.Data(),sUsedClus.Data(),iJetAlgo,aRadius[i], iJetType);
129
130 AddTaskDFilterAndCorrelations(
131 iCandType,
132 sCutFile,
133 bIsMC,
134 kFALSE,
135 sText,
136 taskFJ->GetName(),
137 iLeading,
138 leadHadType,
139 aRadius[i],
140 dJetPtCut,
141 acctype
142 //percjetareacut=1.
143 );
144
bc985fb9 145
d2f609e4 146 // definition of correction map
147 Int_t tag=0;
148 if(iCandType == 0) tag=AliEmcalJet::kD0;
149 if(iCandType == 1) tag=AliEmcalJet::kDStar;
150 Printf("************** tag = %d", tag&0x1);
151 AliJetResponseMaker* taskResp=AddTaskJetResponseMaker(
152 sUsedTrks.Data(),sUsedClus.Data(),taskFJ->GetName(),"",aRadius[i],
153 sInputTrkMC.Data(),"",taskMCJ->GetName(),"",aRadius[i],dJetPtCut,dJetAreaCut,5,0,AliJetResponseMaker::kGeometrical, 0.25,0.25,"TPC",-999,-999,-999,"AliJetResponseMaker", kFALSE, 0, -10,10, tag );
154 taskResp->SetMinJetMCPt(0); //added to bypass a return not needed (feature of PrepareJetTask)
155 //taskResp->SetHistoType(1);
bc985fb9 156
92d9c9cb 157 }
92d9c9cb 158 }
159
160 return;
f6e094bd 161}