including new options for high p_T QA (ITSRefit) adding eta window confiuration to...
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskJetCluster.C
CommitLineData
34fc6450 1AliAnalysisTaskJetCluster *AddTaskJetCluster(char* bRec = "AOD",char* bGen = "",UInt_t filterMask = 16, UInt_t iPhysicsSelectionFlag = AliVEvent::kMB,Char_t *jf = "KT", Float_t radius = 0.4,Int_t nSkip = 0,Int_t kWriteAOD = kFALSE,char* deltaFile = "",Float_t ptTrackCut = 0.15, Float_t etaTrackWindow = 0.9);
a1d44e31 2
bbb42949 3Int_t kBackgroundMode = 0;
4Float_t kPtTrackCut = 0.15;
99baea81 5Float_t kTrackEtaWindow = 0.8;
a1d44e31 6
bbb42949 7AliAnalysisTaskJetCluster *AddTaskJetClusterDelta(UInt_t filterMask = 16,Bool_t kUseAODMC = kFALSE,UInt_t iPhysicsSelectionFlag = AliVEvent::kMB,Char_t *jf = "KT", UInt_t iFlag){
a1d44e31 8 AliAnalysisTaskJetCluster *js = 0;
9 if(kUseAODMC&&false){// do not use the MC info yet
10 if(iFlag&(1<<0))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,0.00001);
11 if(iFlag&(1<<1))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,0.1);
12 if(iFlag&(1<<2))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,0.2);
13 if(iFlag&(1<<4))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,0.4);
14 if(iFlag&(1<<6))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,0.6);
15 if(iFlag&(1<<8))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,0.8);
16 if(iFlag&(1<<10))js = AddTaskJetCluster("AOD","AODMC",filterMask,iPhysicsSelectionFlag,jf,1.0);
17 }
18 else{
19 if(iFlag&(1<<0))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,0.00001);
20 if(iFlag&(1<<1))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,0.1);
21 if(iFlag&(1<<2))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,0.2);
22 if(iFlag&(1<<4))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,0.4);
23 if(iFlag&(1<<6))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,0.6);
24 if(iFlag&(1<<8))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,0.8);
25 if(iFlag&(1<<10))js = AddTaskJetCluster("AOD","",filterMask,iPhysicsSelectionFlag,jf,1.0);
26 }
27
28 return js;
29 }
30
31
34fc6450 32AliAnalysisTaskJetCluster *AddTaskJetCluster(char* bRec,char* bGen ,UInt_t filterMask,UInt_t iPhysicsSelectionFlag,Char_t *jf,Float_t radius,Int_t nSkip,Int_t kWriteAOD,char *deltaFile,Float_t ptTrackCut,Float_t etaTrackWindow)
a1d44e31 33 {
34 // Creates a jet fider task, configures it and adds it to the analysis manager.
35 kPtTrackCut = ptTrackCut;
34fc6450 36 kTrackEtaWindow = etaTrackWindow;
a1d44e31 37
38 TString outputFile(deltaFile);
39 // Get the pointer to the existing analysis manager via the static access method.
40 //==============================================================================
41 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
42 if (!mgr) {
43 ::Error("AddTaskJetCluster", "No analysis manager to connect to.");
44 return NULL;
45 }
46
47 // Check the analysis type using the event handlers connected to the analysis manager.
48 //==============================================================================
49 if (!mgr->GetInputEventHandler()) {
50 ::Error("AddTaskJetCluster", "This task requires an input event handler");
51 return NULL;
52 }
53
54 TString type = mgr->GetInputEventHandler()->GetDataType();
55 TString typeRec(bRec);
56 TString typeGen(bGen);
57 if(!typeRec.Contains("AODextra")) {
58 typeGen.ToUpper();
59 typeRec.ToUpper();
60 }
61 cout << "typeRec: " << typeRec << endl;
62 // Create the task and configure it.
63 //===========================================================================
64
65
66
67
68 TString cAdd = "";
69 cAdd += Form("%02d_",(int)((radius+0.01)*10.));
70 cAdd += Form("B%d",(int)kBackgroundMode);
71 cAdd += Form("_Filter%05d",filterMask);
72 cAdd += Form("_Cut%05d",(int)(1000.*kPtTrackCut));
73 cAdd += Form("_Skip%02d",nSkip);
74 Printf("%s %E",cAdd.Data(),kPtTrackCut);
75 AliAnalysisTaskJetCluster* pwg4spec = new AliAnalysisTaskJetCluster(Form("JetCluster%s_%s%s",bRec,jf,cAdd.Data()));
76
77 // or a config file
78 // pwg4spec->SetAnalysisType(AliAnalysisTaskJetCluster::kAnaMC);
79 // if(iAODanalysis)pwg4spec->SetAODInput(kTRUE);
80 // pwg4spec->SetDebugLevel(11);
81 pwg4spec->SetFilterMask(filterMask);
82 // pwg4spec->SetUseGlobalSelection(kTRUE);
83
84 if(type == "AOD"){
85 // Assume all jet are produced already
86 pwg4spec->SetAODTrackInput(kTRUE);
87 pwg4spec->SetAODMCInput(kTRUE);
88 }
89
90 if(typeRec.Contains("AODMC2b")){// work down from the top AODMC2b -> AODMC2 -> AODMC -> AOD
91 pwg4spec->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCChargedAcceptance);
84476a72 92 pwg4spec->SetTrackPtCut(kPtTrackCut);
99baea81 93 pwg4spec->SetTrackEtaWindow(kTrackEtaWindow);
a1d44e31 94 }
95 else if (typeRec.Contains("AODMC2")){
96 pwg4spec->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCCharged);
84476a72 97 pwg4spec->SetTrackPtCut(kPtTrackCut);
99baea81 98 pwg4spec->SetTrackEtaWindow(5);
a1d44e31 99 }
100 else if (typeRec.Contains("AODMC")){
101 pwg4spec->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODMCAll);
84476a72 102 pwg4spec->SetTrackPtCut(kPtTrackCut);
99baea81 103 pwg4spec->SetTrackEtaWindow(5);
a1d44e31 104 }
105 else if (typeRec.Contains("AODextraonly")) {
106 pwg4spec->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextraonly);
107 pwg4spec->SetTrackPtCut(kPtTrackCut);
99baea81 108 pwg4spec->SetTrackEtaWindow(kTrackEtaWindow);
a1d44e31 109 }
110 else if (typeRec.Contains("AODextra")) {
111 cout << "AliAnalysisTaskJetCluster::kTrackAODextra: " << AliAnalysisTaskJetCluster::kTrackAODextra << endl;
112 pwg4spec->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAODextra);
113 pwg4spec->SetTrackPtCut(kPtTrackCut);
99baea81 114 pwg4spec->SetTrackEtaWindow(kTrackEtaWindow);
a1d44e31 115 }
116 else if (typeRec.Contains("AOD")) {
117 pwg4spec->SetTrackTypeRec(AliAnalysisTaskJetCluster::kTrackAOD);
118 pwg4spec->SetTrackPtCut(kPtTrackCut);
99baea81 119 pwg4spec->SetTrackEtaWindow(kTrackEtaWindow);
a1d44e31 120 }
121
a1d44e31 122 pwg4spec->SetRparam(radius);
123
124 switch (jf) {
125 case "ANTIKT":
126 pwg4spec->SetAlgorithm(2); // antikt from fastjet/JetDefinition.hh
127 break;
128 case "CA":
129 pwg4spec->SetAlgorithm(1); // CA from fastjet/JetDefinition.hh
130 break;
131 case "KT":
132 pwg4spec->SetAlgorithm(0); // kt from fastjet/JetDefinition.hh
133 break;
134 default:
135 ::Error("AddTaskJetCluster", "Wrong jet finder selected\n");
136 return 0;
137 }
138
139
140 if(kWriteAOD){
141 if(outputFile.Length())pwg4spec->SetJetOutputFile(outputFile);
142 pwg4spec->SetJetOutputBranch(Form("clusters%s_%s%s",bRec,jf,cAdd.Data()));
143 pwg4spec->SetJetOutputMinPt(0); // store only jets / clusters above a certain threshold
144 }
145
146 pwg4spec->SetNSkipLeadingRan(nSkip);
147
148 if(iPhysicsSelectionFlag)pwg4spec->SelectCollisionCandidates(iPhysicsSelectionFlag);
149
150 mgr->AddTask(pwg4spec);
151
152 // Create ONLY the output containers for the data produced by the task.
153 // Get and connect other common input/output containers via the manager as below
154 //==============================================================================
155 AliAnalysisDataContainer *coutput1_Spec = mgr->CreateContainer(Form("pwg4cluster_%s_%s_%s%s",bRec,bGen,jf,cAdd.Data()), TList::Class(),AliAnalysisManager::kOutputContainer,Form("%s:PWG4_cluster_%s_%s_%s%s",AliAnalysisManager::GetCommonFileName(),bRec,bGen,jf,cAdd.Data()));
156
157 mgr->ConnectInput (pwg4spec, 0, mgr->GetCommonInputContainer());
158 mgr->ConnectOutput (pwg4spec, 0, mgr->GetCommonOutputContainer());
159 mgr->ConnectOutput (pwg4spec, 1, coutput1_Spec );
160
161 return pwg4spec;
162}