]>
Commit | Line | Data |
---|---|---|
36c8e4e6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /////////////////////////////////////////////////////////////////////////// | |
17 | // // | |
18 | // // | |
19 | // Class to test TPC warm-up LASER EVENTS rejection. // | |
20 | // // | |
21 | // Author: Alexander Kalweit (GSI) // | |
22 | // Modified: Jacek Otwinowski (GSI) // | |
23 | /////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include "Riostream.h" | |
26 | #include "TChain.h" | |
27 | #include "TTree.h" | |
28 | #include "TH1F.h" | |
29 | #include "TH2F.h" | |
30 | #include "TH3F.h" | |
31 | #include "TList.h" | |
32 | #include "TMath.h" | |
33 | #include "TCanvas.h" | |
34 | #include "TObjArray.h" | |
35 | #include "TF1.h" | |
36 | #include "TFile.h" | |
37 | ||
38 | #include "AliAnalysisTaskSE.h" | |
39 | #include "AliAnalysisManager.h" | |
40 | ||
41 | #include "AliHeader.h" | |
42 | #include "AliGenPythiaEventHeader.h" | |
43 | #include "AliGenCocktailEventHeader.h" | |
44 | #include "AliPhysicsSelection.h" | |
45 | #include "AliTriggerAnalysis.h" | |
46 | ||
47 | #include "AliPID.h" | |
48 | #include "AliESDtrackCuts.h" | |
49 | #include "AliESDVertex.h" | |
50 | #include "AliESDEvent.h" | |
51 | #include "AliESDInputHandler.h" | |
52 | #include "AliESDtrack.h" | |
53 | #include "AliESDpid.h" | |
54 | ||
55 | #include "AliMCEventHandler.h" | |
56 | #include "AliMCEvent.h" | |
57 | #include "AliStack.h" | |
58 | #include "AliRecoParam.h" | |
59 | ||
60 | #include "AliLog.h" | |
61 | ||
62 | #include "AliAnalysisNoiseTPC.h" | |
63 | ||
64 | ||
65 | ClassImp(AliAnalysisNoiseTPC) | |
66 | ||
67 | //________________________________________________________________________ | |
68 | AliAnalysisNoiseTPC::AliAnalysisNoiseTPC() | |
69 | : AliAnalysisTaskSE("TaskChargedHadron"), fESD(0), fListHist(0), fESDtrackCuts(0), | |
70 | fHistNoiseTracks(0),fTimeBins(0),fTimeStart(0),fTimeEnd(0) | |
71 | { | |
72 | // default Constructor | |
73 | } | |
74 | ||
75 | ||
76 | //________________________________________________________________________ | |
77 | AliAnalysisNoiseTPC::AliAnalysisNoiseTPC(const char *name,UInt_t StartTime, UInt_t EndTime, Int_t deltaTime) | |
78 | : AliAnalysisTaskSE(name), fESD(0), fListHist(0), fESDtrackCuts(0), | |
79 | fHistNoiseTracks(0), fTimeBins(0), fTimeStart(StartTime), fTimeEnd(EndTime) | |
80 | { | |
81 | // | |
82 | // standard constructur which should be used | |
83 | // | |
84 | Printf("*** CONSTRUCTOR CALLED ****"); | |
85 | if(deltaTime) | |
86 | { | |
87 | fTimeBins = TMath::Nint((fTimeEnd-fTimeStart)/deltaTime); | |
88 | printf("fTimeBins %d \n",fTimeBins); | |
89 | } else { | |
90 | printf("deltaTime is 0 \n"); | |
91 | } | |
92 | ||
93 | // Output slot #0 writes into a TList container | |
94 | DefineOutput(1, TList::Class()); | |
95 | ||
96 | } | |
97 | ||
98 | ||
99 | ||
100 | ||
101 | //________________________________________________________________________ | |
102 | void AliAnalysisNoiseTPC::UserCreateOutputObjects() | |
103 | { | |
104 | // Create histograms | |
105 | // Called once | |
106 | ||
107 | fESDtrackCuts = new AliESDtrackCuts("AliESDtrackCuts","AliESDtrackCuts"); | |
108 | fESDtrackCuts->SetAcceptKinkDaughters(kFALSE); | |
109 | fESDtrackCuts->SetMinNClustersTPC(80); | |
110 | fESDtrackCuts->SetMaxChi2PerClusterTPC(2); | |
111 | // | |
112 | fESDtrackCuts->SetRequireTPCRefit(kTRUE); | |
113 | fESDtrackCuts->SetRequireITSRefit(kFALSE); | |
114 | fESDtrackCuts->SetEtaRange(-0.005,+0.005); | |
115 | fESDtrackCuts->SetPtRange(10., 1e10); | |
116 | ||
117 | ||
118 | fListHist = new TList(); | |
119 | fListHist->SetOwner(kTRUE); | |
120 | // | |
121 | /* | |
122 | UInt_t StartTime = 1272672000; // 1st of May | |
123 | UInt_t EndTime = 1288569600; // 1st of Nov | |
124 | Double_t deltaTime = EndTime - StartTime; | |
125 | Int_t timeBins = TMath::Nint(deltaTime/(15.*60)); // every 15min | |
126 | */ | |
127 | ||
128 | // event number in file, # noise tracks, isSelectMB, isSelectWarm, has vtx., time | |
129 | Int_t binsHistNoise[6] = { 20000, 100, 2, 2, 2, fTimeBins}; | |
130 | Double_t xminHistNoise[6] = { -0.5, -0.5, -0.5, -0.5,-0.5, fTimeStart}; | |
131 | Double_t xmaxHistNoise[6] = {19999.5, 99.5, 1.5, 1.5, 1.5, fTimeEnd}; | |
132 | fHistNoiseTracks = new THnSparseS("fHistNoiseTracks","noise tracks: ev in file, # noise tracks, isSelectMB, isSelectWarm, has vtx,time",6,binsHistNoise,xminHistNoise,xmaxHistNoise); | |
133 | // | |
134 | fListHist->Add(fHistNoiseTracks); | |
135 | // | |
136 | ||
137 | PostData(1, fListHist); | |
138 | } | |
139 | ||
140 | //________________________________________________________________________ | |
141 | void AliAnalysisNoiseTPC::UserExec(Option_t *) | |
142 | { | |
143 | // | |
144 | // main event loop | |
145 | // | |
146 | AliLog::SetGlobalLogLevel(AliLog::kError); | |
147 | // | |
148 | // Check Monte Carlo information and other access first: | |
149 | // | |
150 | fESD = dynamic_cast<AliESDEvent*>( InputEvent() ); | |
151 | if (!fESD) { | |
152 | //Printf("ERROR: fESD not available"); | |
153 | return; | |
154 | } | |
155 | ||
156 | if (!fESDtrackCuts) { | |
157 | Printf("ERROR: fESDtrackCuts not available"); | |
158 | return; | |
159 | } | |
160 | ||
161 | // | |
162 | // check if event is selected by physics selection class | |
163 | // | |
164 | AliPhysicsSelection *physicsSelection = NULL; | |
165 | AliTriggerAnalysis* triggerAnalysis = NULL; | |
166 | ||
167 | AliInputEventHandler* inputHandler = (AliInputEventHandler*) AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler(); | |
168 | if (!inputHandler) | |
169 | { | |
170 | Printf("ERROR: Could not receive input handler"); | |
171 | return; | |
172 | } | |
173 | ||
174 | Bool_t isSelectedMB = kFALSE; | |
175 | // check MB | |
176 | isSelectedMB = inputHandler->IsEventSelected() & AliVEvent::kMB; | |
177 | ||
178 | // get physics selection | |
179 | physicsSelection = static_cast<AliPhysicsSelection*> (inputHandler->GetEventSelection()); | |
180 | if(!physicsSelection) return; | |
181 | ||
182 | // check Warm Up events | |
183 | Bool_t isSelectedWarm = kFALSE; | |
184 | triggerAnalysis = physicsSelection->GetTriggerAnalysis(); | |
185 | if(!triggerAnalysis) return; | |
186 | isSelectedWarm = triggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kTPCLaserWarmUp); | |
187 | ||
188 | // | |
189 | // monitor vertex position | |
190 | // | |
191 | const AliESDVertex *vertex = fESD->GetPrimaryVertexTracks(); | |
192 | if(vertex->GetNContributors()<1) { | |
193 | // SPD vertex | |
194 | vertex = fESD->GetPrimaryVertexSPD(); | |
195 | if(vertex->GetNContributors()<1) vertex = 0x0; | |
196 | } | |
197 | ||
198 | Int_t trackCounter = 0; | |
199 | for (Int_t i=0; i<fESD->GetNumberOfTracks(); ++i) | |
200 | { | |
201 | AliESDtrack *track = fESD->GetTrack(i); | |
202 | if (!track) | |
203 | continue; | |
204 | ||
205 | if (track->GetTPCNcls() < 30) continue; | |
206 | //if (track->GetTPCchi2()/track->GetTPCNcls() > 0.3) continue; | |
207 | if (TMath::Abs(track->Eta()) > 0.005) continue; | |
208 | if (track->Pt() < 4) continue; | |
209 | if (track->GetKinkIndex(0) > 0) continue; | |
210 | ||
211 | UInt_t status = track->GetStatus(); | |
212 | if ((status&AliESDtrack::kITSrefit)==1) continue; // explicitly ask for tracks without ITS refit | |
213 | if ((status&AliESDtrack::kTPCrefit)==0) continue; | |
214 | ||
215 | if (track->GetTPCsignal() > 10) continue; // explicitly ask for tracks without dE/dx | |
216 | ||
217 | //if (TMath::Abs(track->GetZ()) < 50) continue; | |
218 | ||
219 | trackCounter++; | |
220 | } | |
221 | ||
222 | /* | |
223 | Float_t dca[2], cov[3]; | |
224 | // 1st track loop to determine multiplicities | |
225 | for (Int_t i=0;i<fESD->GetNumberOfTracks();++i) { | |
226 | AliESDtrack *track = fESD->GetTrack(i); | |
227 | if (!track) continue; | |
228 | if (fESDtrackCuts->AcceptTrack(track)) { | |
229 | UInt_t status = track->GetStatus(); | |
230 | if ((status&AliESDtrack::kITSrefit)==1) continue; // explicitly ask for tracks without ITS refit | |
231 | if (track->GetTPCsignal() > 30) continue; // explicitly ask for tracks without dE/dx | |
232 | //if (track->GetTPCNcls() > 80) continue; | |
233 | track->GetImpactParameters(dca, cov); | |
234 | if (TMath::Abs(dca[0]) > 10) continue; | |
235 | trackCounter++; | |
236 | // | |
237 | } | |
238 | } | |
239 | */ | |
240 | ||
241 | // run number, # noise tracks, isSelectedMB, isSelectedWarm, has vtx. | |
242 | Bool_t hasVtx = vertex; | |
243 | if (trackCounter > 98) trackCounter = 98; | |
244 | //Double_t vecNoise[7] = {fESD->GetRunNumber(),fESD->GetEventNumberInFile(), trackCounter, isSelectedMB, isSelectedWarm, hasVtx, fESD->GetTimeStamp()}; | |
245 | Double_t vecNoise[6] = {fESD->GetEventNumberInFile(), trackCounter, isSelectedMB, isSelectedWarm, hasVtx, fESD->GetTimeStamp()}; | |
246 | fHistNoiseTracks->Fill(vecNoise); | |
247 | ||
248 | ||
249 | if (trackCounter > 0) { | |
250 | cout << "NOISE_EVENT_CATEGORY:"<<"\t"<< | |
251 | AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetCurrentFile()->GetName()<<"\t"<< | |
252 | fESD->GetEventNumberInFile() << "\t" << | |
253 | fESD->GetTimeStamp() <<endl; | |
254 | } | |
255 | ||
256 | /* | |
257 | if (trackCounter > -1) { | |
258 | fHistNoiseTracks->Fill(vecNoise); | |
259 | if (trackCounter > 25 && trackCounter < 90 && fESD->GetEventSpecie() != AliRecoParam::kCalib) { // dump all availbale info for these events | |
260 | cout << "NOISE_EVENT_CATEGORY:"<<"\t"<< | |
261 | AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetCurrentFile()->GetName()<<"\t"<< | |
262 | fESD->GetEventNumberInFile() << "\t" << | |
263 | fESD->GetTimeStamp() <<endl; | |
264 | for (Int_t i=0;i<fESD->GetNumberOfTracks();++i) { | |
265 | AliESDtrack *track = fESD->GetTrack(i); | |
266 | if (fESDtrackCuts->AcceptTrack(track)) cout << "NOISE_TRACK:"<<"\t"<< | |
267 | track->GetTPCNcls() <<"\t"<< | |
268 | track->GetTPCsignal() <<"\t"<< | |
269 | track->GetAlpha() <<"\t"<< | |
270 | track->Pt() <<"\t"<< | |
271 | track->GetZ() <<"\t"<< | |
272 | track->Eta() << endl; | |
273 | } | |
274 | } | |
275 | if (fESD->GetEventSpecie() == AliRecoParam::kCalib) { | |
276 | cout << "LASER_EVENT_CATEGORY:"<<"\t"<< | |
277 | AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()->GetTree()->GetCurrentFile()->GetName()<<"\t"<< | |
278 | fESD->GetEventNumberInFile() << "\t" << | |
279 | fESD->GetTimeStamp() <<endl; | |
280 | } | |
281 | ||
282 | } | |
283 | */ | |
284 | ||
285 | // Post output data | |
286 | PostData(1, fListHist); | |
287 | ||
288 | } | |
289 | ||
290 | //________________________________________________________________________ | |
291 | void AliAnalysisNoiseTPC::Terminate(Option_t *) | |
292 | { | |
293 | // Draw result to the screen | |
294 | // Called once at the end of the query | |
295 | Printf("*** CONSTRUCTOR CALLED ****"); | |
296 | ||
297 | } | |
298 | ||
299 |