]>
Commit | Line | Data |
---|---|---|
70b4a8d6 | 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 | // $Id$ | |
17 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
9780bd43 | 19 | /// \class AliMUONCheck |
20 | /// | |
21 | /// This class check the ESD tree, providing the matching with the trigger | |
22 | /// response and designing useful plots (Pt, Y, ITS vertex, multiplicity). | |
23 | /// Note that there is a special flag to turn on for pdc06 production. | |
24 | /// It also checks the TR tree giving hit densities on the two first and | |
25 | /// last planes of the spectrometer as well as the time of flight on these planes. | |
26 | /// MUONkine() provides event stack and check if the event are generated with | |
27 | /// at least one muon and two muons (for PDC06). | |
28 | /// DumpDigit() as a replacement of the function from MUONCheck.C macro. | |
29 | /// | |
30 | /// \author Frederic Yermia, INFN Torino | |
3d1463c8 | 31 | //----------------------------------------------------------------------------- |
9780bd43 | 32 | |
70b4a8d6 | 33 | #include "AliMUONCheck.h" |
9780bd43 | 34 | #include "AliMUONConstants.h" |
2e6ca202 | 35 | #include "AliMUONMCDataInterface.h" |
36 | #include "AliMUONDataInterface.h" | |
a55f49a0 | 37 | #include "AliMpCDB.h" |
9780bd43 | 38 | #include "AliMpSegmentation.h" |
39 | #include "AliMpVSegmentation.h" | |
40 | #include "AliMpDEManager.h" | |
88544f7e | 41 | #include "AliMpCDB.h" |
2e6ca202 | 42 | #include "AliMUONVDigitStore.h" |
70b4a8d6 | 43 | |
9780bd43 | 44 | #include "AliRunLoader.h" |
70b4a8d6 | 45 | #include "AliLoader.h" |
9780bd43 | 46 | #include "AliStack.h" |
47 | #include "AliTrackReference.h" | |
48 | #include "AliTracker.h" | |
af885e0f | 49 | #include "AliESDEvent.h" |
9780bd43 | 50 | #include "AliESDMuonTrack.h" |
aad72f45 | 51 | #include "AliESDVertex.h" |
f7a1cc68 | 52 | #include "AliMagF.h" |
70b4a8d6 | 53 | #include "AliLog.h" |
70b4a8d6 | 54 | |
9780bd43 | 55 | #include <TSystem.h> |
56 | #include <TCanvas.h> | |
57 | #include <TLorentzVector.h> | |
58 | #include <TFile.h> | |
59 | #include <TH1.h> | |
60 | #include <TParticle.h> | |
70b4a8d6 | 61 | |
5398f946 | 62 | /// \cond CLASSIMP |
70b4a8d6 | 63 | ClassImp(AliMUONCheck) |
5398f946 | 64 | /// \endcond |
6b092dfc | 65 | |
31edb2d7 | 66 | //_____________________________________________________________________________ |
67 | const TString& AliMUONCheck::GetDefaultOutFileName() | |
68 | { | |
69 | /// Default output file name | |
70 | static const TString kDefaultOutFileName = "output.txt"; | |
71 | return kDefaultOutFileName; | |
72 | } | |
de62e2bd | 73 | |
31edb2d7 | 74 | //_____________________________________________________________________________ |
5a560b6a | 75 | AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t firstEvent, Int_t lastEvent,const char* outDir) |
76 | : TObject(), | |
2e6ca202 | 77 | fFileName(galiceFile), |
78 | fFileNameSim(), | |
79 | fesdFileName(esdFile), | |
7d5d0cc5 | 80 | fkOutDir(outDir), |
31edb2d7 | 81 | fOutFileName(GetDefaultOutFileName()), |
2e6ca202 | 82 | fFirstEvent(firstEvent), |
83 | fLastEvent(lastEvent) | |
5a560b6a | 84 | { |
cab86c08 | 85 | /// ctor |
5a560b6a | 86 | } |
2e6ca202 | 87 | |
70b4a8d6 | 88 | //_____________________________________________________________________________ |
2e6ca202 | 89 | AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* galiceFileSim, |
90 | const char* esdFile,Int_t firstEvent, Int_t lastEvent, | |
91 | const char* outDir) | |
70b4a8d6 | 92 | : TObject(), |
2e6ca202 | 93 | fFileName(galiceFile), |
94 | fFileNameSim(galiceFileSim), | |
95 | fesdFileName(esdFile), | |
7d5d0cc5 | 96 | fkOutDir(outDir), |
31edb2d7 | 97 | fOutFileName(GetDefaultOutFileName()), |
2e6ca202 | 98 | fFirstEvent(firstEvent), |
99 | fLastEvent(lastEvent) | |
70b4a8d6 | 100 | { |
71a2d3aa | 101 | /// ctor |
9780bd43 | 102 | } |
103 | ||
70b4a8d6 | 104 | //_____________________________________________________________________________ |
105 | AliMUONCheck::~AliMUONCheck() | |
106 | { | |
2e6ca202 | 107 | /// Destructor |
70b4a8d6 | 108 | } |
109 | ||
110 | //_____________________________________________________________________________ | |
111 | void | |
9780bd43 | 112 | AliMUONCheck::CheckESD(Bool_t pdc06TriggerResponse) |
70b4a8d6 | 113 | { |
71a2d3aa | 114 | /// Check ESD files |
70b4a8d6 | 115 | |
9780bd43 | 116 | // Histograms |
117 | TH1F * fhMUONVertex ; //! | |
118 | TH1F * fhMUONMult ; //! | |
119 | ||
120 | // create histograms | |
121 | fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.); | |
122 | fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5); | |
70b4a8d6 | 123 | |
9780bd43 | 124 | TH1F *hY = new TH1F("hY","Rapidity",100,-5.,-1.); |
125 | TH1F *hPt = new TH1F("hPt","Pt",100, 0.,20.); | |
70b4a8d6 | 126 | |
9780bd43 | 127 | // ------------->open the ESD file |
128 | TFile* esdFile = TFile::Open(fesdFileName.Data()); | |
129 | ||
2e6ca202 | 130 | if (!esdFile || !esdFile->IsOpen()) |
131 | { | |
9780bd43 | 132 | AliError(Form("Error opening %s file \n",fesdFileName.Data())); |
2e6ca202 | 133 | return; |
134 | } | |
135 | ||
9780bd43 | 136 | Int_t fSPLowpt=0 ; //! |
137 | Int_t fSPHighpt=0 ; //! | |
138 | Int_t fSPAllpt=0 ; //! | |
139 | Int_t fSMLowpt=0 ; //! | |
140 | Int_t fSMHighpt =0 ; //! | |
141 | Int_t fSMAllpt=0 ; //! | |
142 | Int_t fSULowpt=0 ; //! | |
143 | Int_t fSUHighpt=0 ; //! | |
144 | Int_t fSUAllpt=0 ; //! | |
145 | Int_t fUSLowpt=0 ; //! | |
146 | Int_t fUSHighpt=0 ; //! | |
147 | Int_t fUSAllpt=0 ; //! | |
148 | Int_t fLSLowpt=0 ; //! | |
149 | Int_t fLSHighpt=0 ; //! | |
150 | Int_t fLSAllpt=0 ; //! | |
2e6ca202 | 151 | |
9780bd43 | 152 | Int_t fSLowpt=0 ; //! |
153 | Int_t fSHighpt=0 ; //! | |
2e6ca202 | 154 | |
9780bd43 | 155 | Int_t fnTrackTrig=0 ; //! |
156 | Int_t ftracktot=0 ; //! | |
157 | Int_t effMatch=0 ; //! | |
158 | ||
159 | TLorentzVector fV1; | |
160 | Float_t muonMass = 0.105658389; | |
161 | Double_t thetaX, thetaY, pYZ; | |
162 | Double_t fPxRec1, fPyRec1, fPzRec1, fE1; | |
9780bd43 | 163 | |
af885e0f | 164 | AliESDEvent* fESD = new AliESDEvent(); |
2e6ca202 | 165 | TTree* tree = (TTree*) esdFile->Get("esdTree"); |
166 | if (!tree) | |
167 | { | |
9780bd43 | 168 | Error("CheckESD", "no ESD tree found"); |
1130977f | 169 | AliError(Form("no ESD tree found")); |
9780bd43 | 170 | return ; |
171 | } | |
2e6ca202 | 172 | fESD->ReadFromTree(tree); |
9780bd43 | 173 | |
2e6ca202 | 174 | Int_t fnevents = tree->GetEntries(); |
9780bd43 | 175 | Int_t endOfLoop = fLastEvent+1; |
2e6ca202 | 176 | |
9780bd43 | 177 | if ( fLastEvent == -1 ) endOfLoop = fnevents; |
178 | Int_t ievent=0; | |
179 | Int_t nev=0; | |
2e6ca202 | 180 | |
9780bd43 | 181 | for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) |
70b4a8d6 | 182 | { |
2e6ca202 | 183 | nev++; |
a99c3449 | 184 | if (tree->GetEvent(ievent) <= 0) |
2e6ca202 | 185 | { |
9780bd43 | 186 | Error("CheckESD", "no ESD object found for event %d", ievent); |
187 | return ; | |
188 | } | |
2e6ca202 | 189 | AliESDVertex* vertex = (AliESDVertex*) fESD->GetVertex(); |
9780bd43 | 190 | |
191 | Double_t zVertex = 0. ; | |
e690d4d0 | 192 | if (vertex) zVertex = vertex->GetZ(); |
2e6ca202 | 193 | |
9780bd43 | 194 | Int_t nTracks = (Int_t)fESD->GetNumberOfMuonTracks() ; |
195 | ULong64_t trigword=fESD->GetTriggerMask(); | |
2e6ca202 | 196 | |
197 | if(pdc06TriggerResponse) | |
198 | { | |
9780bd43 | 199 | if (trigword & 0x01) { |
200 | fSPLowpt++; | |
201 | } | |
2e6ca202 | 202 | |
9780bd43 | 203 | if (trigword & 0x02){ |
204 | fSPHighpt++; | |
205 | } | |
206 | if (trigword & 0x04){ | |
207 | fSPAllpt++; | |
208 | } | |
209 | if (trigword & 0x08){ | |
210 | fSMLowpt++; | |
211 | } | |
212 | if (trigword & 0x010){ | |
213 | fSMHighpt++; | |
214 | } | |
215 | if (trigword & 0x020){ | |
216 | fSMAllpt++; | |
217 | } | |
218 | if (trigword & 0x040){ | |
219 | fSULowpt++; | |
220 | } | |
221 | if (trigword & 0x080){ | |
222 | fSUHighpt++; | |
223 | } | |
224 | if (trigword & 0x100){ | |
225 | fSUAllpt++; | |
226 | } | |
227 | if (trigword & 0x200){ | |
228 | fUSLowpt++; | |
229 | } | |
2e6ca202 | 230 | |
9780bd43 | 231 | if (trigword & 0x400){ |
232 | fUSHighpt++; | |
233 | } | |
234 | if (trigword & 0x800){ | |
235 | fUSAllpt++; | |
236 | } | |
237 | if (trigword & 0x1000){ | |
238 | fLSLowpt++; | |
239 | } | |
2e6ca202 | 240 | |
9780bd43 | 241 | if (trigword & 0x2000){ |
242 | fLSHighpt++; | |
243 | } | |
2e6ca202 | 244 | |
9780bd43 | 245 | if (trigword & 0x4000){ |
246 | fLSAllpt++; | |
247 | } | |
248 | }// if pdc06TriggerResponse | |
249 | else { | |
250 | if (trigword & 0x01) { | |
251 | fSLowpt++; | |
252 | } | |
2e6ca202 | 253 | |
9780bd43 | 254 | if (trigword & 0x02){ |
255 | fSHighpt++; | |
256 | } | |
257 | if (trigword & 0x04){ | |
258 | fLSLowpt++; | |
259 | } | |
260 | if (trigword & 0x08){ | |
261 | fLSHighpt++; | |
262 | } | |
263 | if (trigword & 0x010){ | |
264 | fUSLowpt++; | |
265 | } | |
266 | if (trigword & 0x020){ | |
267 | fUSHighpt++; | |
268 | } | |
269 | } | |
270 | ||
271 | Int_t tracktrig=0; | |
2e6ca202 | 272 | |
273 | for ( Int_t iTrack1 = 0; iTrack1<nTracks; ++iTrack1 ) | |
274 | { //1st loop | |
9780bd43 | 275 | AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1); |
b1fea02e | 276 | |
277 | // skip fake tracks (ghosts) | |
278 | if (!muonTrack->ContainTrackerData()) continue; | |
279 | ||
9780bd43 | 280 | ftracktot++; |
281 | ||
282 | thetaX = muonTrack->GetThetaX(); | |
283 | thetaY = muonTrack->GetThetaY(); | |
284 | pYZ = 1./TMath::Abs(muonTrack->GetInverseBendingMomentum()); | |
2e6ca202 | 285 | |
9780bd43 | 286 | fPzRec1 = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY)); |
287 | fPxRec1 = fPzRec1 * TMath::Tan(thetaX); | |
288 | fPyRec1 = fPzRec1 * TMath::Tan(thetaY); | |
9780bd43 | 289 | fE1 = TMath::Sqrt(muonMass * muonMass + fPxRec1 * fPxRec1 + fPyRec1 * fPyRec1 + fPzRec1 * fPzRec1); |
290 | fV1.SetPxPyPzE(fPxRec1, fPyRec1, fPzRec1, fE1); | |
291 | // -----------> transverse momentum | |
292 | Float_t pt1 = fV1.Pt(); | |
293 | // ----------->Rapidity | |
294 | Float_t y1 = fV1.Rapidity(); | |
2e6ca202 | 295 | |
296 | if(muonTrack->GetMatchTrigger()) | |
297 | { | |
9780bd43 | 298 | fnTrackTrig++; |
299 | tracktrig++; | |
300 | } | |
301 | hY->Fill(y1); | |
302 | hPt->Fill(pt1); | |
2e6ca202 | 303 | } // loop on track |
304 | ||
9780bd43 | 305 | fhMUONVertex->Fill(zVertex) ; |
306 | fhMUONMult->Fill(Float_t(nTracks)) ; | |
2e6ca202 | 307 | |
9780bd43 | 308 | } // loop over events |
309 | ||
310 | AliInfo(Form("Terminate %s:", GetName())) ; | |
311 | ||
312 | effMatch=100*fnTrackTrig/ftracktot; | |
2e6ca202 | 313 | |
314 | if(pdc06TriggerResponse) | |
315 | { | |
9780bd43 | 316 | printf("=================================================================\n") ; |
317 | printf("================ %s ESD SUMMARY ==============\n", GetName()) ; | |
318 | printf(" \n") ; | |
319 | printf(" Total number of processed events %d \n", nev) ; | |
320 | printf("\n") ; | |
321 | printf("\n") ; | |
322 | printf("Table 1: \n") ; | |
323 | printf(" Global Trigger output Low pt High pt All\n") ; | |
324 | printf(" number of Single Plus :\t"); | |
325 | printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ; | |
326 | printf("\n"); | |
327 | printf(" number of Single Minus :\t"); | |
328 | printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ; | |
329 | printf("\n"); | |
330 | printf(" number of Single Undefined :\t"); | |
331 | printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ; | |
332 | printf("\n"); | |
333 | printf(" number of UnlikeSign pair :\t"); | |
334 | printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ; | |
335 | printf("\n"); | |
336 | printf(" number of LikeSign pair :\t"); | |
337 | printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ; | |
338 | printf("\n"); | |
339 | printf("===================================================\n") ; | |
340 | printf("\n") ; | |
341 | printf("matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); | |
342 | printf("================================================================\n") ; printf("\n") ; | |
2e6ca202 | 343 | |
9780bd43 | 344 | }//if(pdc06TriggerResponse) |
345 | ||
7d5d0cc5 | 346 | gSystem->cd(fkOutDir); |
9780bd43 | 347 | |
de62e2bd | 348 | FILE *outtxt=fopen(fOutFileName.Data(),"a"); |
2e6ca202 | 349 | |
9780bd43 | 350 | if(pdc06TriggerResponse){ |
351 | fprintf(outtxt," \n"); | |
352 | fprintf(outtxt,"===================================================\n"); | |
353 | fprintf(outtxt,"================ ESD SUMMARY ==============\n"); | |
354 | fprintf(outtxt," \n"); | |
355 | fprintf(outtxt," Total number of processed events %d \n", nev); | |
356 | fprintf(outtxt,"\n"); | |
357 | fprintf(outtxt,"\n"); | |
358 | fprintf(outtxt,"Table 1: \n"); | |
359 | fprintf(outtxt," Global Trigger output Low pt High pt All\n"); | |
360 | fprintf(outtxt," number of Single Plus :\t"); | |
361 | fprintf(outtxt,"%i\t%i\t%i\t",fSPLowpt,fSPHighpt,fSPAllpt); | |
362 | fprintf(outtxt,"\n"); | |
363 | fprintf(outtxt," number of Single Minus :\t"); | |
364 | fprintf(outtxt,"%i\t%i\t%i\t",fSMLowpt,fSMHighpt,fSMAllpt); | |
365 | fprintf(outtxt,"\n"); | |
366 | fprintf(outtxt," number of Single Undefined :\t"); | |
367 | fprintf(outtxt,"%i\t%i\t%i\t",fSULowpt,fSUHighpt,fSUAllpt); | |
368 | fprintf(outtxt,"\n"); | |
369 | fprintf(outtxt," number of UnlikeSign pair :\t"); | |
370 | fprintf(outtxt,"%i\t%i\t%i\t",fUSLowpt,fUSHighpt,fUSAllpt); | |
371 | fprintf(outtxt,"\n"); | |
372 | fprintf(outtxt," number of LikeSign pair :\t"); | |
373 | fprintf(outtxt,"%i\t%i\t%i\t",fLSLowpt,fLSHighpt, fLSAllpt); | |
374 | fprintf(outtxt,"\n"); | |
375 | fprintf(outtxt,"===================================================\n"); | |
376 | fprintf(outtxt,"\n"); | |
377 | fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); | |
378 | }//if(pdc06TriggerResponse) | |
9780bd43 | 379 | |
2e6ca202 | 380 | else { |
381 | ||
9780bd43 | 382 | fprintf(outtxt," \n"); |
383 | fprintf(outtxt,"===================================================\n"); | |
384 | fprintf(outtxt,"================ ESD SUMMARY ==============\n"); | |
385 | fprintf(outtxt," \n"); | |
386 | fprintf(outtxt," Total number of processed events %d \n", nev); | |
387 | fprintf(outtxt,"\n"); | |
388 | fprintf(outtxt,"\n"); | |
389 | fprintf(outtxt,"Table 1: \n"); | |
390 | fprintf(outtxt," Global Trigger output Low pt High pt \n"); | |
391 | fprintf(outtxt," number of Single :\t"); | |
392 | fprintf(outtxt,"%i\t%i\t",fSLowpt,fSHighpt); | |
393 | fprintf(outtxt,"\n"); | |
394 | fprintf(outtxt," number of UnlikeSign pair :\t"); | |
395 | fprintf(outtxt,"%i\t%i\t",fUSLowpt,fUSHighpt); | |
396 | fprintf(outtxt,"\n"); | |
397 | fprintf(outtxt," number of LikeSign pair :\t"); | |
398 | fprintf(outtxt,"%i\t%i\t",fLSLowpt,fLSHighpt); | |
399 | fprintf(outtxt,"\n"); | |
400 | fprintf(outtxt,"===================================================\n"); | |
401 | fprintf(outtxt,"\n"); | |
402 | fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); | |
403 | }//else | |
404 | fclose(outtxt); | |
405 | ||
406 | TCanvas * c1 = new TCanvas("c1", "ESD", 400, 10, 600, 700) ; | |
407 | c1->Divide(1,2) ; | |
408 | c1->cd(1) ; | |
409 | fhMUONVertex->Draw() ; | |
410 | c1->cd(2) ; | |
411 | fhMUONMult->Draw() ; | |
412 | c1->Print("VertexAndMul.eps") ; | |
413 | TCanvas *c2 = new TCanvas("c2","ESD",400,10,600,700); | |
414 | c2->Divide(1,2); | |
415 | c2->cd(1); | |
416 | hY->Draw(); | |
417 | c2->cd(2); | |
418 | hPt->Draw(); | |
419 | c2->Print("YandPt.eps") ; | |
70b4a8d6 | 420 | } |
9780bd43 | 421 | |
422 | //_____________________________________________________________________________ | |
423 | void | |
424 | AliMUONCheck::CheckKine() | |
425 | { | |
71a2d3aa | 426 | /// Check Stack |
9780bd43 | 427 | |
2e6ca202 | 428 | AliMUONMCDataInterface diSim(fFileNameSim.Data()); |
429 | if (!diSim.IsValid()) return; | |
430 | ||
431 | Int_t fnevents = diSim.NumberOfEvents(); | |
9780bd43 | 432 | |
9780bd43 | 433 | Int_t endOfLoop = fLastEvent+1; |
434 | ||
435 | if ( fLastEvent == -1 ) endOfLoop = fnevents; | |
436 | ||
9780bd43 | 437 | Int_t nev=0; |
438 | Int_t nmu=0; | |
439 | Int_t nonemu=0; | |
440 | Int_t ndimu=0; | |
9780bd43 | 441 | |
2e6ca202 | 442 | for ( Int_t ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) |
443 | { | |
9780bd43 | 444 | Int_t nmu2=0; |
2e6ca202 | 445 | ++nev; |
9780bd43 | 446 | |
2e6ca202 | 447 | AliStack* stack = diSim.Stack(ievent); |
448 | Int_t npa = stack->GetNprimary(); | |
449 | Int_t npb = stack->GetNtrack(); | |
9780bd43 | 450 | printf("Primary particles %i \n",npa); |
451 | printf("Sec particles %i \n",npb); | |
452 | printf("=================================================================\n") ; | |
453 | printf("Primary particles listing: \n"); | |
454 | printf("=================================================================\n") ; | |
2e6ca202 | 455 | for (Int_t i=0; i<npa; ++i) |
456 | { | |
9780bd43 | 457 | TParticle *p = stack->Particle(i); |
458 | p->Print(""); | |
459 | Int_t pdg=p->GetPdgCode(); | |
460 | ||
b8bec44f | 461 | if (TMath::Abs(pdg) == 13) |
2e6ca202 | 462 | { |
463 | ++nmu2; | |
9780bd43 | 464 | } |
465 | } | |
466 | printf("=================================================================\n") ; | |
467 | printf("=================================================================\n") ; | |
468 | ||
469 | printf("Secondaries particles listing: \n"); | |
470 | printf("=================================================================\n") ; | |
2e6ca202 | 471 | for (Int_t i=npa; i<npb; ++i) |
472 | { | |
9780bd43 | 473 | stack->Particle(i)->Print(""); |
474 | } | |
2e6ca202 | 475 | |
9780bd43 | 476 | printf("=================================================================\n") ; |
477 | printf(">>> Event %d, Number of primary particles is %d \n",ievent, npa); | |
478 | printf(">>> Event %d, Number of secondary articles is %d \n",ievent, npb-npa); | |
479 | printf("=================================================================\n"); | |
2e6ca202 | 480 | if(nmu2>0) |
481 | { | |
9780bd43 | 482 | printf(">>> Okay!!! Event %d with at least one muon on primary stack! \n",ievent); |
2e6ca202 | 483 | ++nonemu; |
9780bd43 | 484 | } |
485 | ||
2e6ca202 | 486 | if(nmu2==0) |
487 | { | |
9780bd43 | 488 | printf(">>> Warning!!! Event %d without muon on primary stack! \n",ievent); |
2e6ca202 | 489 | ++nmu; |
9780bd43 | 490 | } |
2e6ca202 | 491 | |
492 | if(nmu2>1) | |
493 | { | |
9780bd43 | 494 | printf(">>> Okay!!! Event %d with at least two muons on primary stack! \n",ievent); |
2e6ca202 | 495 | ++ndimu; |
9780bd43 | 496 | } |
497 | printf("=================================================================\n"); | |
498 | printf(" \n"); | |
499 | printf(" \n") ; | |
500 | }//ievent | |
501 | ||
9780bd43 | 502 | printf("=================================================================\n") ; |
503 | printf(" Total number of processed events %d \n", nev) ; | |
504 | printf(" \n") ; | |
505 | ||
2e6ca202 | 506 | if(nmu>0) |
507 | { | |
9780bd43 | 508 | printf("---> WARNING!!! <---\n"); |
509 | printf(" %i events without muon on primary stack \n",nmu); | |
510 | } | |
511 | ||
2e6ca202 | 512 | if(nmu==0) |
513 | { | |
9780bd43 | 514 | printf("---> OKAY!!! <---\n"); |
515 | printf(" %i events generated with at least one muon on primary stack \n",nonemu); | |
516 | } | |
2e6ca202 | 517 | |
518 | if(ndimu>0) | |
519 | { | |
9780bd43 | 520 | printf("---> OKAY!!! <---\n"); |
521 | printf(" %i events generated with at least two muons on primary stack \n",ndimu); | |
522 | } | |
2e6ca202 | 523 | |
9780bd43 | 524 | printf(" \n") ; |
525 | printf("*** Leaving MuonKine() *** \n"); | |
526 | printf("**************************************************************** \n"); | |
527 | ||
7d5d0cc5 | 528 | gSystem->cd(fkOutDir); |
de62e2bd | 529 | FILE *outtxt=fopen(fOutFileName.Data(),"a"); |
9780bd43 | 530 | fprintf(outtxt," \n"); |
531 | fprintf(outtxt,"=================================================================\n"); | |
532 | fprintf(outtxt,"================ MUONkine SUMMARY ================\n"); | |
533 | fprintf(outtxt,"\n"); | |
534 | fprintf(outtxt,"=================================================================\n"); | |
535 | fprintf(outtxt," Total number of processed events %d \n", nev) ; | |
536 | fprintf(outtxt," \n"); | |
537 | ||
2e6ca202 | 538 | if(nmu>0) |
539 | { | |
9780bd43 | 540 | fprintf(outtxt," ---> WARNING!!! <--- \n"); |
541 | fprintf(outtxt," %i events without muon on primary stack \n",nmu); | |
542 | } | |
2e6ca202 | 543 | |
544 | if(nmu==0) | |
545 | { | |
9780bd43 | 546 | fprintf(outtxt," ---> OKAY!!! <--- \n"); |
547 | fprintf(outtxt," %i events generated with at least one muon on primary stack \n",nonemu); | |
548 | } | |
2e6ca202 | 549 | |
550 | if(ndimu>0) | |
551 | { | |
9780bd43 | 552 | fprintf(outtxt," ---> OKAY!!! <--- \n"); |
553 | fprintf(outtxt," %i events generated with at least two muons on primary stack \n",ndimu); | |
554 | } | |
2e6ca202 | 555 | |
9780bd43 | 556 | fprintf(outtxt," \n") ; |
557 | fprintf(outtxt,"*** Leaving MuonKine() *** \n"); | |
558 | fprintf(outtxt,"**************************************************************** \n"); | |
559 | fclose(outtxt); | |
9780bd43 | 560 | } |
561 | ||
562 | //_____________________________________________________________________________ | |
563 | void | |
564 | AliMUONCheck::CheckTrackRef() | |
565 | { | |
2e6ca202 | 566 | /// Check TrackRef files |
567 | ||
568 | AliMUONMCDataInterface diSim(fFileNameSim.Data()); | |
569 | if ( !diSim.IsValid() ) return; | |
9780bd43 | 570 | |
9780bd43 | 571 | Int_t flag11=0,flag12=0,flag13=0,flag14=0; |
2e6ca202 | 572 | |
9780bd43 | 573 | TH1F *tof01= new TH1F("tof01","TOF for first tracking plane",100,0.,100); |
574 | tof01->SetXTitle("tof (ns)"); | |
575 | TH1F *tof14= new TH1F("tof14","TOF for MT22",100,0.,100); | |
576 | tof14->SetXTitle("tof (ns)"); | |
577 | ||
578 | TH1F *hitDensity[4]; | |
579 | hitDensity[0] = new TH1F("TR_dhits01","",30,0,300); | |
580 | hitDensity[0]->SetFillColor(3); | |
581 | hitDensity[0]->SetXTitle("R (cm)"); | |
582 | hitDensity[1] = new TH1F("TR_dhits10","",30,0,300); | |
583 | hitDensity[1]->SetFillColor(3); | |
584 | hitDensity[1]->SetXTitle("R (cm)"); | |
585 | hitDensity[2] = new TH1F("TR_dhits11","",30,0,300); | |
586 | hitDensity[2]->SetFillColor(3); | |
587 | hitDensity[2]->SetXTitle("R (cm)"); | |
588 | hitDensity[3] = new TH1F("TR_dhits14","",30,0,300); | |
589 | hitDensity[3]->SetFillColor(3); | |
590 | hitDensity[3]->SetXTitle("R (cm)"); | |
9780bd43 | 591 | |
2e6ca202 | 592 | Int_t fnevents = diSim.NumberOfEvents(); |
593 | ||
9780bd43 | 594 | Int_t endOfLoop = fLastEvent+1; |
595 | ||
596 | if ( fLastEvent == -1 ) endOfLoop = fnevents; | |
597 | ||
9780bd43 | 598 | Int_t nev=0; |
599 | Int_t ntot=fLastEvent+1-fFirstEvent; | |
2e6ca202 | 600 | |
601 | for ( Int_t ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) | |
602 | { | |
9780bd43 | 603 | Int_t save=-99; |
2e6ca202 | 604 | ++nev; |
605 | ||
606 | Int_t nentries = diSim.NumberOfTrackRefs(ievent); | |
9780bd43 | 607 | |
2e6ca202 | 608 | for ( Int_t l=0; l<nentries; ++l ) |
9780bd43 | 609 | { |
2e6ca202 | 610 | TClonesArray* trackRefs = diSim.TrackRefs(ievent,l); |
611 | if (!trackRefs) continue; | |
612 | ||
613 | Int_t nnn = trackRefs->GetEntriesFast(); | |
614 | ||
615 | for ( Int_t k=0; k<nnn; ++k ) | |
9780bd43 | 616 | { |
2e6ca202 | 617 | AliTrackReference *tref = static_cast<AliTrackReference*>(trackRefs->UncheckedAt(k)); |
9780bd43 | 618 | Int_t label = tref->GetTrack(); |
619 | Float_t x = tref->X(); // x-pos of hit | |
620 | Float_t y = tref->Y(); // y-pos | |
621 | Float_t z = tref->Z(); | |
622 | ||
623 | Float_t r=TMath::Sqrt(x*x+y*y); | |
624 | Float_t time = tref->GetTime(); | |
625 | ||
626 | Float_t wgt=1/(2*10*TMath::Pi()*r)/(ntot); | |
627 | ||
628 | if (save!=label){ | |
629 | save=label; | |
630 | flag11=0; | |
631 | flag12=0; | |
632 | flag13=0; | |
633 | flag14=0; | |
634 | } | |
2e6ca202 | 635 | |
9780bd43 | 636 | if (save==label){ |
637 | ||
638 | //Ch 1, z=-526.16 | |
639 | if (z<=-521&& z>=-531&&flag11==0){ | |
640 | flag11=1; | |
641 | hitDensity[0]->Fill(r,wgt); | |
642 | tof01->Fill(1000000000*time,1); | |
643 | }; | |
644 | ||
645 | //Ch 10, z=-1437.6 | |
646 | if (z<=-1432&&z>=-1442&&flag12==0){ | |
647 | flag12=1; | |
648 | hitDensity[1]->Fill(r,wgt); | |
649 | } | |
2e6ca202 | 650 | |
9780bd43 | 651 | //Ch 11, z=-1603.5 |
652 | if (z<=-1598&& z>=-1608&&flag13==0){ | |
653 | flag13=1; | |
654 | hitDensity[2]->Fill(r,wgt); | |
655 | }; | |
656 | ||
657 | //ch 14 z=-1720.5 | |
658 | if(z<=-1715&&z>=-1725&&flag14==0){ | |
659 | flag14=1; | |
660 | hitDensity[3]->Fill(r,wgt); | |
661 | tof14->Fill(1000000000*time,1); | |
662 | }; | |
663 | ||
664 | }//if save==label | |
2e6ca202 | 665 | |
9780bd43 | 666 | }//hits de tTR |
2e6ca202 | 667 | |
9780bd43 | 668 | }//entree de tTR |
2e6ca202 | 669 | |
9780bd43 | 670 | }//evt loop |
2e6ca202 | 671 | |
7d5d0cc5 | 672 | gSystem->cd(fkOutDir); |
9780bd43 | 673 | TCanvas *c6 = new TCanvas("c6","TOF",400,10,600,700); |
674 | c6->Divide(1,2); | |
675 | c6->cd(1); | |
676 | ||
677 | tof01->Draw(); | |
678 | c6->cd(2); | |
679 | tof14->Draw(); | |
680 | c6->Print("tof_on_trigger.ps"); | |
2e6ca202 | 681 | |
9780bd43 | 682 | TCanvas *c5 = new TCanvas("c5","TRef:Hits Density",400,10,600,700); |
683 | c5->Divide(2,2); | |
684 | c5->cd(1); | |
685 | hitDensity[0]->Draw(); | |
686 | c5->cd(2); | |
687 | hitDensity[1]->Draw(); | |
688 | c5->cd(3); | |
689 | hitDensity[2]->Draw(); | |
690 | c5->cd(4); | |
691 | hitDensity[3]->Draw(); | |
692 | c5->Print("TR_Hit_densities.ps"); | |
693 | printf("=================================================================\n") ; | |
694 | printf("================ %s Tref SUMMARY ==============\n", GetName()) ; | |
695 | printf(" \n") ; | |
696 | printf(" Total number of processed events %d \n", nev) ; | |
697 | printf("*** Leaving TRef() *** \n"); | |
698 | printf("*************************************************** \n"); | |
9780bd43 | 699 | } |
700 | ||
701 | //_____________________________________________________________________________ | |
702 | void | |
703 | AliMUONCheck::CheckOccupancy(Bool_t perDetEle) const | |
704 | { | |
2e6ca202 | 705 | /// Check occupancy for the first event selected |
706 | ||
9780bd43 | 707 | Int_t dEoccupancyBending[14][26]; |
708 | Int_t dEoccupancyNonBending[14][26]; | |
709 | Int_t cHoccupancyBending[14]; | |
710 | Int_t cHoccupancyNonBending[14]; | |
711 | Int_t totaloccupancyBending =0; | |
712 | Int_t totaloccupancyNonBending =0; | |
2e6ca202 | 713 | |
9780bd43 | 714 | Int_t dEchannelsBending[14][26]; |
715 | Int_t dEchannelsNonBending[14][26]; | |
716 | Int_t cHchannelsBending[14]; | |
717 | Int_t cHchannelsNonBending[14]; | |
718 | Int_t totalchannelsBending =0; | |
719 | Int_t totalchannelsNonBending =0; | |
2e6ca202 | 720 | |
721 | Int_t nchambers = AliMUONConstants::NCh(); | |
722 | ||
723 | AliMUONDataInterface di(fFileNameSim); | |
724 | ||
725 | AliMUONVDigitStore* digitStore = di.DigitStore(fFirstEvent); | |
726 | ||
727 | // Compute values | |
728 | for (Int_t ichamber=0; ichamber<nchambers; ++ichamber) | |
729 | { | |
9780bd43 | 730 | cHchannelsBending[ichamber]=0; |
731 | cHchannelsNonBending[ichamber]=0; | |
2e6ca202 | 732 | cHoccupancyBending[ichamber]=0; |
733 | cHoccupancyNonBending[ichamber]=0; | |
734 | ||
735 | for (Int_t idetele=0; idetele<26; idetele++) | |
736 | { | |
9780bd43 | 737 | Int_t detele = 100*(ichamber +1)+idetele; |
2e6ca202 | 738 | |
739 | if ( AliMpDEManager::IsValidDetElemId(detele) ) | |
740 | { | |
741 | Int_t cathode(0); | |
742 | ||
743 | const AliMpVSegmentation* segbend = AliMpSegmentation::Instance() | |
744 | ->GetMpSegmentation(detele, AliMp::kCath0); | |
745 | const AliMpVSegmentation* segnonbend = AliMpSegmentation::Instance() | |
746 | ->GetMpSegmentation(detele, AliMp::kCath1); | |
747 | ||
748 | if (AliMpDEManager::GetPlaneType(detele, AliMp::kCath0) != AliMp::kBendingPlane ) | |
749 | { | |
750 | const AliMpVSegmentation* tmp = segbend; | |
751 | segbend = segnonbend; | |
752 | segnonbend = tmp; | |
753 | cathode = 1; | |
754 | } | |
755 | ||
756 | Int_t nchannels = segbend->NofPads(); | |
757 | Int_t ndigits = digitStore->GetSize(detele,cathode); | |
758 | dEchannelsBending[ichamber][idetele] = nchannels; | |
759 | dEoccupancyBending[ichamber][idetele] = ndigits; | |
760 | cHchannelsBending[ichamber] += nchannels; | |
761 | cHoccupancyBending[ichamber] += ndigits; | |
762 | totalchannelsBending += nchannels; | |
763 | totaloccupancyBending += ndigits; | |
764 | ||
765 | nchannels = segnonbend->NofPads(); | |
766 | ndigits = digitStore->GetSize(detele,1-cathode); | |
767 | ||
768 | dEchannelsNonBending[ichamber][idetele] = nchannels; | |
92b90935 | 769 | dEoccupancyNonBending[ichamber][idetele] = ndigits; |
2e6ca202 | 770 | cHchannelsNonBending[ichamber] += nchannels; |
771 | cHoccupancyNonBending[ichamber] += ndigits; | |
772 | totalchannelsNonBending += nchannels; | |
773 | totaloccupancyNonBending += ndigits; | |
9780bd43 | 774 | } |
2e6ca202 | 775 | if (perDetEle) |
776 | { | |
777 | printf(">>> Detection element %4d has %5d channels in bending and %5d channels in nonbending \n", | |
778 | detele, dEchannelsBending[ichamber][idetele], dEchannelsNonBending[ichamber][idetele] ); | |
9780bd43 | 779 | } |
780 | } | |
781 | printf(">>> Chamber %2d has %6d channels in bending and %6d channels in nonbending \n", | |
2e6ca202 | 782 | ichamber+1, cHchannelsBending[ichamber], cHchannelsNonBending[ichamber]); |
9780bd43 | 783 | } |
784 | printf(">>Spectrometer has %7d channels in bending and %7d channels in nonbending \n", | |
2e6ca202 | 785 | totalchannelsBending, totalchannelsNonBending); |
786 | ||
787 | // Output values | |
788 | ||
5213784e | 789 | for ( Int_t ichamber = 0; ichamber < nchambers; ++ichamber ) |
2e6ca202 | 790 | { |
9780bd43 | 791 | printf(">>> Chamber %2d nChannels Bending %5d nChannels NonBending %5d \n", |
2e6ca202 | 792 | ichamber+1, |
793 | cHoccupancyBending[ichamber], | |
c8218bec | 794 | cHoccupancyNonBending[ichamber]); |
795 | if ( cHchannelsBending[ichamber] != 0 && cHchannelsBending[ichamber] ) { | |
796 | printf(">>> Chamber %2d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n", | |
797 | ichamber+1, | |
798 | 100.*((Float_t) cHoccupancyBending[ichamber])/((Float_t) cHchannelsBending[ichamber]), | |
799 | 100.*((Float_t) cHoccupancyNonBending[ichamber])/((Float_t) cHchannelsBending[ichamber])); | |
800 | } | |
2e6ca202 | 801 | |
802 | if ( perDetEle ) | |
803 | { | |
804 | for(Int_t idetele=0; idetele<26; idetele++) | |
805 | { | |
806 | Int_t detele = idetele + 100*(ichamber+1); | |
807 | if ( AliMpDEManager::IsValidDetElemId(detele) ) | |
808 | { | |
809 | printf(">>> DetEle %4d nChannels Bending %5d nChannels NonBending %5d \n", | |
810 | idetele+100*(ichamber+1), | |
811 | dEoccupancyBending[ichamber][idetele], | |
812 | dEoccupancyNonBending[ichamber][idetele]); | |
c8218bec | 813 | |
814 | if ( dEchannelsBending[ichamber][idetele] != 0 && dEchannelsBending[ichamber][idetele] !=0 ) { | |
815 | printf(">>> DetEle %4d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n", | |
816 | idetele+100*(ichamber+1), | |
817 | 100.*((Float_t) dEoccupancyBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]), | |
818 | 100.*((Float_t) dEoccupancyNonBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele])); | |
819 | } | |
2e6ca202 | 820 | } |
9780bd43 | 821 | } |
822 | } | |
2e6ca202 | 823 | } |
824 | ||
c8218bec | 825 | if ( totalchannelsBending != 0 && totalchannelsNonBending != 0 ) { |
826 | printf(">>> Muon Spectrometer Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n", | |
827 | 100.*((Float_t) totaloccupancyBending)/((Float_t) totalchannelsBending), | |
828 | 100.*((Float_t) totaloccupancyNonBending)/((Float_t) totalchannelsNonBending)); | |
829 | } | |
9780bd43 | 830 | } |
831 | ||
9780bd43 | 832 | //_____________________________________________________________________________ |
833 | void AliMUONCheck::SetEventsToCheck(Int_t firstEvent, Int_t lastEvent) | |
834 | { | |
2e6ca202 | 835 | /// Set first and last event number to check |
836 | ||
9780bd43 | 837 | fFirstEvent = firstEvent; |
838 | fLastEvent = lastEvent; | |
839 | } |