]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C
added jet trigger patch maker
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / macros / AddTaskEmcalJet.C
CommitLineData
2096d71d 1// $Id$
2
25283b37 3AliEmcalJetTask* AddTaskEmcalJet(
6a20534a 4 const UInt_t type = AliEmcalJetTask::kAKT | AliEmcalJetTask::kFullJet | AliEmcalJetTask::kR040Jet,
2096d71d 5 const char *nTracks = "Tracks",
6 const char *nClusters = "CaloClusters",
2096d71d 7 const Double_t minTrPt = 0.15,
1f9c287f 8 const Double_t minClPt = 0.30,
22be30e2 9 const Double_t ghostArea = 0.005,
6a20534a 10 const Double_t radius = 0.4,
11 const char *tag = "Jet"
2096d71d 12)
25283b37 13{
14 // Get the pointer to the existing analysis manager via the static access method.
15 //==============================================================================
16 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
17 if (!mgr)
18 {
19 ::Error("AddTaskAliEmcalJet", "No analysis manager to connect to.");
20 return NULL;
21 }
22
23 // Check the analysis type using the event handlers connected to the analysis manager.
24 //==============================================================================
25 if (!mgr->GetInputEventHandler())
26 {
27 ::Error("AddTaskAliEmcalJet", "This task requires an input event handler");
28 return NULL;
29 }
30
31 //-------------------------------------------------------
32 // Init the task and do settings
33 //-------------------------------------------------------
34
89d03e5a 35 Double_t minJetPt = 0;
36
c683922f 37 char *algoString;
6a20534a 38 if ((type & AliEmcalJetTask::kKT) != 0) {
c683922f 39 algoString = "KT";
89d03e5a 40 minJetPt = 0.1;
6a20534a 41 } else if ((type & AliEmcalJetTask::kAKT) != 0) {
c683922f 42 algoString = "AKT";
89d03e5a 43 minJetPt = 1.0;
44 }
45
c683922f 46 char *typeString;
6a20534a 47 if ((type & AliEmcalJetTask::kFullJet) != 0)
c683922f 48 typeString = "Full";
6a20534a 49 else if ((type & AliEmcalJetTask::kChargedJet) != 0)
c683922f 50 typeString = "Charged";
6a20534a 51 else if ((type & AliEmcalJetTask::kNeutralJet) != 0)
c683922f 52 typeString = "Neutral";
89d03e5a 53
c683922f 54 char radiusString[200];
6a20534a 55 if ((type & AliEmcalJetTask::kR020Jet) != 0)
56 sprintf(radiusString,"R020");
57 else if ((type & AliEmcalJetTask::kR030Jet) != 0)
58 sprintf(radiusString,"R030");
59 else if ((type & AliEmcalJetTask::kR040Jet) != 0)
60 sprintf(radiusString,"R040");
61 else
62 sprintf(radiusString,"R0%2.0f",radius*100.0);
89d03e5a 63
c683922f 64 char pTString[200];
01cb0d1f 65 if (minTrPt==0)
66 sprintf(pTString,"pT0000");
67 else if (minTrPt<1.0)
c683922f 68 sprintf(pTString,"pT0%3.0f",minTrPt*1000.0);
69 else if (minTrPt>=1.0)
70 sprintf(pTString,"pT%4.0f",minTrPt*1000.0);
89d03e5a 71
c683922f 72 char ETString[200];
01cb0d1f 73 if (minClPt==0)
74 sprintf(ETString,"ET0000");
75 else if (minClPt<1.0)
c683922f 76 sprintf(ETString,"ET0%3.0f",minClPt*1000.0);
77 else if (minClPt>=1.0)
78 sprintf(ETString,"ET%4.0f",minClPt*1000.0);
79
80 TString name;
6a20534a 81 if (*nTracks && *nClusters)
82 name = TString(Form("%s_%s%s%s_%s_%s_%s_%s",
83 tag,algoString,typeString,radiusString,nTracks,pTString,nClusters,ETString));
84 else if (!*nClusters)
85 name = TString(Form("%s_%s%s%s_%s_%s",
86 tag,algoString,typeString,radiusString,nTracks,pTString));
87 else if (!*nTracks)
88 name = TString(Form("%s_%s%s%s_%s_%s",
89 tag,algoString,typeString,radiusString,nClusters,ETString));
c683922f 90
89d03e5a 91 AliEmcalJetTask* mgrTask = mgr->GetTask(name.Data());
c683922f 92 if (mgrTask)
93 return mgrTask;
94
2096d71d 95 AliEmcalJetTask* jetTask = new AliEmcalJetTask(name);
96 jetTask->SetTracksName(nTracks);
97 jetTask->SetClusName(nClusters);
c683922f 98 jetTask->SetJetsName(name);
6a20534a 99 jetTask->SetJetType(type);
25283b37 100 jetTask->SetMinJetTrackPt(minTrPt);
101 jetTask->SetMinJetClusPt(minClPt);
89d03e5a 102 jetTask->SetMinJetPt(minJetPt);
6a20534a 103 if ((type & (AliEmcalJetTask::kRX1Jet|AliEmcalJetTask::kRX2Jet|AliEmcalJetTask::kRX3Jet)) != 0)
104 jetTask->SetRadius(radius);
1f9c287f 105 jetTask->SetGhostArea(ghostArea);
25283b37 106
107 //-------------------------------------------------------
108 // Final settings, pass to manager and set the containers
109 //-------------------------------------------------------
110
111 mgr->AddTask(jetTask);
112
113 // Create containers for input/output
2096d71d 114 AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer() ;
115 mgr->ConnectInput (jetTask, 0, cinput);
116
25283b37 117 return jetTask;
25283b37 118}
6a20534a 119
120
121AliEmcalJetTask* AddTaskEmcalJet(
122 const char *nTracks = "Tracks",
123 const char *nClusters = "CaloClusters",
124 const Int_t algo = 1,
125 const Double_t radius = 0.4,
126 const Int_t type = 0,
127 const Double_t minTrPt = 0.15,
128 const Double_t minClPt = 0.30,
129 const Double_t ghostArea = 0.01 ,
130 const char *tag = "Jet"
131)
132{
133
134 UInt_t jetType = 0;
135
136 if (algo == 0)
137 jetType |= AliEmcalJetTask::kKT;
138 else
139 jetType |= AliEmcalJetTask::kAKT;
140
141 if (type==0)
142 jetType |= AliEmcalJetTask::kFullJet;
143 else if (type==1)
144 jetType |= AliEmcalJetTask::kChargedJet;
145 else if (type==2)
146 jetType |= AliEmcalJetTask::kNeutralJet;
147
148 if (radius==0.2)
149 jetType |= AliEmcalJetTask::kR020Jet;
150 else if (radius==0.3)
151 jetType |= AliEmcalJetTask::kR030Jet;
152 else if (radius==0.4)
153 jetType |= AliEmcalJetTask::kR040Jet;
154 else
155 jetType |= AliEmcalJetTask::kRX1Jet;
156
157 return AddTaskEmcalJet(jetType, nTracks, nClusters, minTrPt, minClPt, ghostArea, radius, tag);
158}