]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/EMCALTasks/macros/AddTaskEMCALClusterize.C
update macros after last changes
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / macros / AddTaskEMCALClusterize.C
CommitLineData
193828fd 1AliAnalysisTaskEMCALClusterize* AddTaskEMCALClusterize(
2 const Int_t bMC = kFALSE,
531f682d 3 const Bool_t exotic = kTRUE,
193828fd 4 const TString name = "V1Unfold",
531f682d 5 TString & arrayName,
193828fd 6 const TString trigger = "",
193828fd 7 const Bool_t tm = kTRUE,
8 const Int_t minEcell = 50,
9 const Int_t minEseed = 100,
10 const Int_t maxDeltaT = 250,
11 const Int_t timeWindow = 1000,
12 const Int_t minEUnf = 15,
13 const Int_t minFrac = 1
14 )
15{
5994e71f 16 // Get the pointer to the existing analysis manager via the static access method.
17 //==============================================================================
18 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
531f682d 19 if (!mgr)
20 {
193828fd 21 ::Error("AddTaskEMCALClusterize", "No analysis manager to connect to.");
5994e71f 22 return NULL;
23 }
24
25 // Check the analysis type using the event handlers connected to the analysis manager.
26 //==============================================================================
531f682d 27 if (!mgr->GetInputEventHandler())
28 {
29 ::Error("AddTaskEMCALClusterize", "This clusterize requires an input event handler");
5994e71f 30 return NULL;
31 }
32
531f682d 33 //-------------------------------------------------------
34 // Init the task and do settings
35 //-------------------------------------------------------
36
193828fd 37 AliAnalysisTaskEMCALClusterize* clusterize = new AliAnalysisTaskEMCALClusterize(Form("EMCALClusterize%s_Ecell%d_Eseed%d_DT%d_WT%d",
38 name.Data(),minEcell,minEseed,maxDeltaT,timeWindow));
39
531f682d 40 // Set clusters branch name, make sure the analysis after this one read this name
41
42 arrayName = Form("%s_Ecell%d_Eseed%d_DT%d_WT%d",name.Data(),minEcell,minEseed,maxDeltaT,timeWindow);
43 clusterize->SetAODBranchName(arrayName);
193828fd 44
531f682d 45 printf("Created Branch Name: \n",arrayName.Data());
193828fd 46 //clusterize->SetOCDBPath("local://$ALICE_ROOT/OCDB");
47
531f682d 48 // Some general settings to create AOD file in case we want to keep it
193828fd 49 clusterize->SwitchOffFillAODCaloCells();
50 clusterize->SwitchOffFillAODHeader();
51 clusterize->FillAODFile(kFALSE); // fill aod.root with clusters?, not really needed for analysis.
52
531f682d 53 // Do track matching after clusterization
193828fd 54 if(tm) clusterize->SwitchOnTrackMatching();
55 else clusterize->SwitchOffTrackMatching();
56
531f682d 57 //-------------------------------------------------------
58 // Set clusterization parameters via rec param
59 //-------------------------------------------------------
193828fd 60
5994e71f 61 AliEMCALRecParam * params = clusterize->GetRecParam();
193828fd 62
531f682d 63 // Position and SS weight parameter
5994e71f 64 params->SetW0(4.5);
193828fd 65
531f682d 66 // Time cuts, depend on data type (no cells time in AODs)
193828fd 67 TString sHandler((mgr->GetInputEventHandler())->ClassName());
531f682d 68 if(sHandler.Contains("AOD"))
69 {
193828fd 70 printf("AliAnalysisTaskEMCALClusterize - Open time cuts for AODs\n");
71 params->SetTimeCut(1e6);//Open this cut for AODs
72 params->SetTimeMin(-1); //Open this cut for AODs
73 params->SetTimeMax(1e6);//Open this cut for AODs
74 }
531f682d 75 else
76 {
193828fd 77 printf("AliAnalysisTaskEMCALClusterize - Set time cuts for ESDs\n");
5eef1db1 78 if(maxDeltaT > 1) params->SetTimeCut(maxDeltaT*1.e-9);
79 else { params->SetTimeCut(250*1.e-9); printf("default maxDeltaT = 250 ns\n"); }// Same as in reco
80
531f682d 81 if(timeWindow > 1)
82 {
5eef1db1 83 params->SetTimeMin(-1*timeWindow*1.e-9);
84 params->SetTimeMax(timeWindow*1.e-9);
85 }
531f682d 86 else
87 { // same as in reco
5eef1db1 88 params->SetTimeMin(425*1.e-9);
89 params->SetTimeMax(825*1.e-9);
90 printf("default time window 425 ns < T < 825 ns\n");
91 }
193828fd 92 }
93
531f682d 94 // Energy cuts
193828fd 95 params->SetClusteringThreshold(minEseed/1.e3);
96 params->SetMinECut (minEcell/1.e3);
97
98 // Clusterizer type
99 if(name.Contains("V2")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv2);
100 if(name.Contains("V1")) params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerv1);
101 if(name.Contains("NxN"))params->SetClusterizerFlag(AliEMCALRecParam::kClusterizerNxN);
102
531f682d 103 //-------------------------------------------------------
104 // Unfolding, 2 options :
105 //-------------------------------------------------------
193828fd 106
531f682d 107 // 1) Just unfold existing clusters
193828fd 108 if(name.Contains("JustUnfold"))
109 clusterize->JustUnfold(kTRUE); // if TRUE, do just unfolding, do not recluster cells
110 else
111 clusterize->JustUnfold(kFALSE);
112
531f682d 113 // 2) Unfold clusters created in the clusterize (revise settings)
114 if (name.Contains("Unfold"))
115 {
193828fd 116 clusterize->SwitchOnCellEnergySelection();
117 clusterize->SetCellCuts(minEUnf/1000.,minFrac/10000.);
118 printf("AliAnalysisTaskEMCALClusterize - Cuts: min E %f, frac %f\n",minEUnf/1000.,minFrac/10000.);
119 //clusterize->SwitchOffCellEnergySelection();
531f682d 120
193828fd 121 if(!name.Contains("Just"))
531f682d 122 params->SetUnfold(kTRUE);
123 else
124 params->SetUnfold(kFALSE);
125
193828fd 126 } // unfold
5994e71f 127
531f682d 128 //-------------------------------------------------------
129 // Configure AliEMCALRecoUtils
130 //-------------------------------------------------------
131
193828fd 132 AliEMCALRecoUtils * reco = clusterize->GetRecoUtils();
531f682d 133 gROOT->LoadMacro("$ALICE_ROOT/PWGGA/EMCALTasks/macros/ConfigureEMCALRecoUtils.C"); // $ALICE_ROOT/PWGGA/EMCALTasks/macros
134 ConfigureEMCALRecoUtils(reco,bMC,exotic);
5994e71f 135
531f682d 136 //-------------------------------------------------------
193828fd 137 //Alignment matrices
531f682d 138 //-------------------------------------------------------
139
7e1720e3 140 clusterize->SetImportGeometryFromFile(kTRUE); // import geometry.root file
141
531f682d 142 if(!kMC)
143 {
144 clusterize->SwitchOnLoadOwnGeometryMatrices();
5994e71f 145 }
146
531f682d 147 //-------------------------------------------------------
148 // Trigger options
149 //-------------------------------------------------------
150
193828fd 151 if(trigger=="EMC7"){
531f682d 152 printf("Clusterizing task trigger EMC7\n");
193828fd 153 clusterize->SelectCollisionCandidates(AliVEvent::kEMC7);
154 }
155 else if (trigger=="INT7"){
531f682d 156 printf("Clusterizing task trigger INT7\n");
193828fd 157 clusterize->SelectCollisionCandidates(AliVEvent::kINT7);
158 }
cd54ca47 159 else if(trigger=="EMC1"){
531f682d 160 printf("Clusterizing task trigger EMC1\n");
193828fd 161 clusterize->SelectCollisionCandidates(AliVEvent::kEMC1);
162 }
163 else if(trigger=="MB"){
531f682d 164 printf("Clusterizing task trigger MB\n");
193828fd 165 clusterize->SelectCollisionCandidates(AliVEvent::kMB);
531f682d 166 }
167 else if(trigger=="PHOS"){
168 printf("Clusterizing task trigger PHOS\n");
169 clusterize->SelectCollisionCandidates(AliVEvent::kPHI7);
170 }
171 else if(trigger=="PHOSPb"){
172 printf("Clusterizing task trigger PHOSPb\n");
173 clusterize->SelectCollisionCandidates(AliVEvent::kPHOSPb);
193828fd 174 }
531f682d 175 else if(trigger=="AnyINT")
176 {
177 printf("Clusterizing task trigger AnyINT\n");
178 clusterize->SelectCollisionCandidates(AliVEvent::kAnyINT);
179 }
180 else if(trigger=="INT")
181 {
182 printf("Clusterizing task trigger AnyINT\n");
183 clusterize->SelectCollisionCandidates(AliVEvent::kAny);
184 }
185 else if(trigger=="EMCEGA")
186 {
187 printf("Clusterizing task trigger EMC Gamma\n");
188 clusterize->SelectCollisionCandidates(AliVEvent::kEMCEGA);
189 }
190 else if(trigger=="EMCEJE")
191 {
192 printf("Clusterizing task trigger EMC Jet\n");
193 clusterize->SelectCollisionCandidates(AliVEvent::kEMCEJE);
194 }
195 else if(trigger=="Central")
196 {
197 printf("Clusterizing task trigger Central\n");
198 clusterize->SelectCollisionCandidates(AliVEvent::kCentral);
199 }
200 else if(trigger=="SemiCentral")
201 {
202 printf("Clusterizing task trigger SemiCentral\n");
203 clusterize->SelectCollisionCandidates(AliVEvent::kSemiCentral);
204 }
205
206 //-------------------------------------------------------
207 // Final settings, pass to manager and set the containers
208 //-------------------------------------------------------
193828fd 209
5994e71f 210 mgr->AddTask(clusterize);
211
212 // Create containers for input/output
213 AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
214 AliAnalysisDataContainer *coutput1 = mgr->GetCommonOutputContainer() ;
215
216 mgr->ConnectInput (clusterize, 0, cinput1 );
217 mgr->ConnectOutput (clusterize, 0, coutput1 );
218
219 return clusterize;
220
193828fd 221}