]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskEmcalDiJetAna.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskEmcalDiJetAna.C
CommitLineData
3773435b 1AliAnalysisTaskEmcalDiJetAna* AddTaskEmcalDiJetAna(TString kTracksName = "PicoTracks",
2 TString kClusName = "caloClusterCorr",
3 Double_t R = 0.4,
4 Double_t ptminTrack = 0.15,
5 Double_t etminClus = 0.3,
6 Int_t rhoType = 0,
7 TString trigClass = "",
8 const char *CentEst = "V0A",
9 Int_t pSel = AliVEvent::kINT7,
bb84b374 10 Int_t matchFullCh = AliAnalysisTaskEmcalDiJetBase::kNoMatching,
4bd08270 11 Double_t ptTrackBias = 0.,
e50460de 12 Int_t corrType = AliAnalysisTaskEmcalDiJetBase::kCorrelateTwo,
8daeee93 13 Float_t nefCut = 0.95,
3a4799fa 14 Int_t nCentBins = 5,
15 Double_t scaleFact = 1.42
3773435b 16 ) {
17
18 enum AlgoType {kKT, kANTIKT};
19 enum JetType {kFULLJETS, kCHARGEDJETS, kNEUTRALJETS};
20
21 // #### Define manager and data container names
22 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
23 if (!mgr) {
24 ::Error("AddTaskEmcalDiJet", "No analysis manager to connect to.");
25 return NULL;
26 }
27
28 // Check the analysis type using the event handlers connected to the analysis manager.
29 //==============================================================================
30 if (!mgr->GetInputEventHandler())
31 {
32 ::Error("AddTaskEmcalDiJet", "This task requires an input event handler");
33 return NULL;
34 }
35
36 // #### Add necessary jet finder tasks
37 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
38
39 AliEmcalJetTask* jetFinderTaskFull = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kFULLJETS, ptminTrack, etminClus);
40 AliEmcalJetTask* jetFinderTaskCharged = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
785ed98a 41 jetFinderTaskFull->SelectCollisionCandidates(AliVEvent::kAny);
42 jetFinderTaskCharged->SelectCollisionCandidates(AliVEvent::kAny);
43
3773435b 44
45 TString strJetsFull = jetFinderTaskFull->GetName();
46 TString strJetsCh = jetFinderTaskCharged->GetName();
47
48 // Add kt jet finder and rho task in case we want background subtraction
49 gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskRhoSparse.C");
50 AliEmcalJetTask *jetFinderKt;
51 AliEmcalJetTask *jetFinderAKt;
52 AliAnalysisTaskRhoSparse *rhoTask;
53 if(rhoType==1) {
54 jetFinderKt = AddTaskEmcalJet(kTracksName, kClusName, kKT, R, kCHARGEDJETS, ptminTrack, etminClus);
55 jetFinderKt->SetMinJetPt(0.);
56 jetFinderAKt = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
785ed98a 57 jetFinderKt->SelectCollisionCandidates(AliVEvent::kAny);
58 jetFinderAkt->SelectCollisionCandidates(AliVEvent::kAny);
59
3a4799fa 60 TF1 *fScale = new TF1("fScale","[0]",0.,100.);
61 fScale->SetParameter(0,scaleFact);
9e5eee5d 62 TString rhoSparseName = Form("RhoSparseR%03d",(int)(100*R));
63 rhoTask = AddTaskRhoSparse(jetFinderKt->GetName(),
3773435b 64 jetFinderAKt->GetName(),
9e5eee5d 65 kTracksName.Data(),
66 kClusName.Data(),
67 rhoSparseName.Data(),
3773435b 68 R,
9e5eee5d 69 "TPC",
3773435b 70 0.01,
71 0.15,
72 0,
73 fScale,
74 0,
75 kTRUE,
9e5eee5d 76 rhoSparseName.Data(),
3773435b 77 kTRUE
78 );
79 rhoTask->SetCentralityEstimator(CentEst);
80
81 }
bb84b374 82 TString wagonName = Form("DiJet_%s_%s_Rho%dTC%sMatch%dHadTrig%d",strJetsFull.Data(),strJetsCh.Data(),rhoType,trigClass.Data(),matchFullCh,(Int_t)(ptTrackBias));
3773435b 83
84 //Configure DiJet task
85 AliAnalysisTaskEmcalDiJetAna *taskDiJet = NULL;
86 taskDiJet = new AliAnalysisTaskEmcalDiJetAna(wagonName.Data());
8daeee93 87
8e49a788 88 taskDiJet->SetUseAliAnaUtils(kTRUE);
4bd08270 89 taskDiJet->SetTriggerClass(trigClass.Data());
8e49a788 90
4bd08270 91 if(ptminTrack==0.) {
8e49a788 92 taskDiJet->SetIsPythia(kTRUE);
4bd08270 93 taskDiJet->SetDoFullFull(kTRUE);
94 }
c66364a6 95 taskDiJet->SetJetCorrelationType(corrType);
4bd08270 96
97
3773435b 98 Printf("strJetsFull: %s",strJetsFull.Data());
99 Printf("strJetsCh: %s",strJetsCh.Data());
100
101 taskDiJet->AddParticleContainer(kTracksName.Data());
102 taskDiJet->AddClusterContainer(kClusName.Data());
103
3773435b 104 taskDiJet->SetContainerFull(0);
105 taskDiJet->SetContainerCharged(1);
106 taskDiJet->AddJetContainer(strJetsFull.Data(),"EMCAL",R);
107 taskDiJet->AddJetContainer(strJetsCh.Data(),"TPC",R);
108
9e5eee5d 109 taskDiJet->SetZLeadingCut(0.98,0.98,0);
e50460de 110 taskDiJet->SetNEFCut(0.,nefCut,0);
9e5eee5d 111
3773435b 112 for(Int_t i=0; i<2; i++) {
eca9052c 113 taskDiJet->SetPercAreaCut(0.6, i);
bb84b374 114 taskDiJet->SetPtBiasJetTrack(ptTrackBias,i);
3773435b 115 }
116
117 taskDiJet->SetRhoType(rhoType);
118 if(rhoType==1) {
9e5eee5d 119 taskDiJet->SetRhoName(rhoTask->GetOutRhoScaledName(),0);
120 taskDiJet->SetRhoName(rhoTask->GetOutRhoName(),1);
3773435b 121 }
122
123 taskDiJet->SetCentralityEstimator(CentEst);
8daeee93 124 taskDiJet->SetCentRange(0.,100.);
125 taskDiJet->SetNCentBins(nCentBins);
3773435b 126
127 taskDiJet->SelectCollisionCandidates(pSel);
128
129 taskDiJet->SetFullChargedMatchingType(matchFullCh);
130
131 taskDiJet->SetDoChargedCharged(kTRUE);
132 taskDiJet->SetDoFullCharged(kTRUE);
8daeee93 133 taskDiJet->SetMatchFullCharged(kFALSE);
3773435b 134
135 mgr->AddTask(taskDiJet);
136
137 //Connnect input
138 mgr->ConnectInput (taskDiJet, 0, mgr->GetCommonInputContainer() );
139
140 //Connect output
141 AliAnalysisDataContainer *coutput1 = 0x0;
142
6ab30d5f 143 TString contName(wagonName);
144 contName += "_histos";
3773435b 145
6ab30d5f 146 // TString outputfile = Form("%s:%s",AliAnalysisManager::GetCommonFileName(),wagonName.Data());
147 TString outputfile = Form("%s",AliAnalysisManager::GetCommonFileName());
3773435b 148
6ab30d5f 149 coutput1 = mgr->CreateContainer(contName.Data(), TList::Class(),AliAnalysisManager::kOutputContainer,outputfile);
3773435b 150
151 mgr->ConnectOutput(taskDiJet,1,coutput1);
152
153 return taskDiJet;
154}