Using herwig65.inc instead of HERWIG65.INC
[u/mrichter/AliRoot.git] / MUON / MUONCheck.C
CommitLineData
c121e924 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
88cb7938 18//
19// Macro for checking aliroot output and associated files contents
20// Gines Martinez, Subatech June 2003
21//
e516b01d 22#if !defined(__CINT__) || defined(__MAKECINT__)
88cb7938 23// ROOT includes
24#include "TBranch.h"
25#include "TClonesArray.h"
26#include "TFile.h"
27#include "TH1.h"
bf485fb9 28#include "TMath.h"
88cb7938 29#include "TParticle.h"
30#include "TTree.h"
da47578c 31#include "TNtuple.h"
88cb7938 32
33// STEER includes
34#include "AliRun.h"
35#include "AliRunLoader.h"
36#include "AliHeader.h"
37#include "AliLoader.h"
38#include "AliStack.h"
39
40// MUON includes
41#include "AliMUON.h"
ce3f5e87 42#include "AliMUONData.h"
88cb7938 43#include "AliMUONHit.h"
44#include "AliMUONConstants.h"
45#include "AliMUONDigit.h"
46#include "AliMUONRawCluster.h"
47#include "AliMUONGlobalTrigger.h"
48#include "AliMUONLocalTrigger.h"
8547965d 49#include "AliMUONTrack.h"
bf485fb9 50#include "AliMUONTrackParam.h"
84da0ea0 51#include "AliMUONTriggerConstants.h"
84da0ea0 52#include "AliMUONTriggerCircuitNew.h"
bf485fb9 53
54#include "AliMpVSegmentation.h"
55#include "AliMpIntPair.h"
6babe058 56#include "AliMpDEManager.h"
57#include "AliMpSegFactory.h"
e516b01d 58#endif
2b32c661 59
bf485fb9 60void MUONkine(Int_t event2Check=0, char * filename="galice.root")
88cb7938 61{
3b0cf968 62 // Stack of particle for each event
63 AliStack* stack;
88cb7938 64 // Creating Run Loader and openning file containing Hits
65 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
66 if (RunLoader ==0x0) {
67 printf(">>> Error : Error Opening %s file \n",filename);
68 return;
69 }
3b0cf968 70
88cb7938 71 RunLoader->LoadKinematics("READ");
72 Int_t ievent, nevents;
73 nevents = RunLoader->GetNumberOfEvents();
74
75 for(ievent=0; ievent<nevents; ievent++) { // Event loop
2b32c661 76 if (event2Check!=0) ievent=event2Check;
88cb7938 77 Int_t iparticle, nparticles;
78 // Getting event ievent
79 RunLoader->GetEvent(ievent);
3b0cf968 80 stack = RunLoader->Stack();
81 nparticles = (Int_t) stack->GetNtrack();
88cb7938 82 printf(">>> Event %d, Number of particles is %d \n",ievent, nparticles);
83 for(iparticle=0; iparticle<nparticles; iparticle++) {
3b0cf968 84 stack->Particle(iparticle)->Print("");
88cb7938 85 }
2b32c661 86 if (event2Check!=0) ievent=nevents;
88cb7938 87 }
88 RunLoader->UnloadKinematics();
89}
90
91
bf485fb9 92void MUONhits(Int_t event2Check=0, char * filename="galice.root")
88cb7938 93{
88cb7938 94 // Creating Run Loader and openning file containing Hits
95 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
96 if (RunLoader ==0x0) {
97 printf(">>> Error : Error Opening %s file \n",filename);
98 return;
99 }
88cb7938 100 // Loading MUON subsystem
101 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
1a1cdff8 102 MUONLoader->LoadHits("READ"); // Loading Tree of hits for MUON
103 AliMUONData muondata(MUONLoader,"MUON","MUON"); // Creating MUON data container
88cb7938 104 Int_t ievent, nevents;
105 nevents = RunLoader->GetNumberOfEvents();
106
107 for(ievent=0; ievent<nevents; ievent++) { // Event loop
2b32c661 108 if (event2Check!=0) ievent=event2Check;
88cb7938 109 printf(">>> Event %d \n",ievent);
88cb7938 110 // Getting event ievent
111 RunLoader->GetEvent(ievent);
ce3f5e87 112 muondata.SetTreeAddress("H");
88cb7938 113 Int_t itrack, ntracks;
1a1cdff8 114 ntracks = (Int_t) muondata.GetNtracks();
88cb7938 115 for (itrack=0; itrack<ntracks; itrack++) { // Track loop
88cb7938 116 //Getting List of Hits of Track itrack
bf485fb9 117 muondata.GetTrack(itrack);
88cb7938 118 Int_t ihit, nhits;
ce3f5e87 119 nhits = (Int_t) muondata.Hits()->GetEntriesFast();
bf485fb9 120 printf(">>> Track %d, Number of hits %d \n",itrack,nhits);
88cb7938 121 AliMUONHit* mHit;
122 for(ihit=0; ihit<nhits; ihit++) {
ce3f5e87 123 mHit = static_cast<AliMUONHit*>(muondata.Hits()->At(ihit));
6464217e 124 mHit->Print("full");
88cb7938 125 }
ce3f5e87 126 muondata.ResetHits();
88cb7938 127 } // end track loop
2b32c661 128 if (event2Check!=0) ievent=nevents;
88cb7938 129 } // end event loop
130 MUONLoader->UnloadHits();
131}
132
133
bf485fb9 134void MUONdigits(Int_t event2Check=0, char * filename="galice.root")
88cb7938 135{
88cb7938 136 // Creating Run Loader and openning file containing Hits
137 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
138 if (RunLoader ==0x0) {
139 printf(">>> Error : Error Opening %s file \n",filename);
140 return;
141 }
ce3f5e87 142 // Loading MUON subsystem
88cb7938 143 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
144 MUONLoader->LoadDigits("READ");
ce3f5e87 145 // Creating MUON data container
146 AliMUONData muondata(MUONLoader,"MUON","MUON");
75fbac63 147
88cb7938 148 Int_t ievent, nevents;
149 nevents = RunLoader->GetNumberOfEvents();
88cb7938 150 AliMUONDigit * mDigit;
151
88cb7938 152 for(ievent=0; ievent<nevents; ievent++) {
2b32c661 153 if (event2Check!=0) ievent=event2Check;
88cb7938 154 printf(">>> Event %d \n",ievent);
155 RunLoader->GetEvent(ievent);
75fbac63 156
88cb7938 157 // Addressing
158 Int_t ichamber, nchambers;
159 nchambers = AliMUONConstants::NCh(); ;
6babe058 160 muondata.SetTreeAddress("D,GLT");
75fbac63 161
bf485fb9 162 muondata.GetDigits();
163 // Loop on chambers
164 for( ichamber=0; ichamber<nchambers; ichamber++) {
165 Int_t idigit, ndigits;
75fbac63 166 TClonesArray* digits = muondata.Digits(ichamber);
167 digits->Sort();
168 ndigits = (Int_t)digits->GetEntriesFast();
bf485fb9 169 for(idigit=0; idigit<ndigits; idigit++) {
75fbac63 170 mDigit = static_cast<AliMUONDigit*>(digits->At(idigit));
171 mDigit->Print("tracks");
bf485fb9 172 } // end digit loop
173 } // end chamber loop
174 muondata.ResetDigits();
2b32c661 175 if (event2Check!=0) ievent=nevents;
88cb7938 176 } // end event loop
177 MUONLoader->UnloadDigits();
178}
179
75fbac63 180void MUONsdigits(Int_t event2Check=0, char * filename="galice.root")
181{
182 // Creating Run Loader and openning file containing Hits
183 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
184 if (RunLoader ==0x0) {
185 printf(">>> Error : Error Opening %s file \n",filename);
186 return;
187 }
188 // Loading MUON subsystem
189 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
190 MUONLoader->LoadSDigits("READ");
191 // Creating MUON data container
192 AliMUONData muondata(MUONLoader,"MUON","MUON");
193
194 Int_t ievent, nevents;
195 nevents = RunLoader->GetNumberOfEvents();
196 AliMUONDigit * mDigit;
197
198 for(ievent=0; ievent<nevents; ievent++) {
199 if (event2Check!=0) ievent=event2Check;
200 printf(">>> Event %d \n",ievent);
201 RunLoader->GetEvent(ievent);
202
203 // Addressing
204 Int_t ichamber, nchambers;
205 nchambers = AliMUONConstants::NCh(); ;
206 muondata.SetTreeAddress("S");
207
208 muondata.GetSDigits();
209 // Loop on chambers
210 for( ichamber=0; ichamber<nchambers; ichamber++) {
211 Int_t idigit, ndigits;
212 TClonesArray* digits = muondata.SDigits(ichamber);
213 ndigits = (Int_t)digits->GetEntriesFast();
214 for(idigit=0; idigit<ndigits; idigit++) {
215 mDigit = static_cast<AliMUONDigit*>(digits->At(idigit));
216 mDigit->Print("tracks");
217 } // end digit loop
218 } // end chamber loop
219 muondata.ResetSDigits();
220 if (event2Check!=0) ievent=nevents;
221 } // end event loop
222 MUONLoader->UnloadSDigits();
223}
224
bf485fb9 225void MUONoccupancy(Int_t event2Check=0, Bool_t perDetEle =kFALSE, char * filename="galice.root") {
226 // Creating Run Loader and openning file containing Hits
227 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
228 if (RunLoader ==0x0) {
229 printf(">>> Error : Error Opening %s file \n",filename);
230 return;
231 }
232 // Loading MUON subsystem
233 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
234 MUONLoader->LoadDigits("READ");
235 // Creating MUON data container
236 AliMUONData muondata(MUONLoader,"MUON","MUON");
237
238 Int_t ievent, nevents;
239 nevents = RunLoader->GetNumberOfEvents();
240 AliMUONDigit * mDigit =0x0;
241 AliMpVSegmentation * segbend = 0x0;
242 AliMpVSegmentation * segnonbend = 0x0;
243 AliMpIntPair pad(0,0);
244
245 Int_t dEoccupancy_bending[14][26];
246 Int_t dEoccupancy_nonbending[14][26];
247 Int_t cHoccupancy_bending[14];
248 Int_t cHoccupancy_nonbending[14];
249 Int_t totaloccupancy_bending =0;
250 Int_t totaloccupancy_nonbending =0;
251
252 Int_t dEchannels_bending[14][26];
253 Int_t dEchannels_nonbending[14][26];
254 Int_t cHchannels_bending[14];
255 Int_t cHchannels_nonbending[14];
256 Int_t totalchannels_bending =0;
257 Int_t totalchannels_nonbending =0;
258
259 Int_t ichamber, nchambers,idetele, detele, ix, iy;
260 nchambers = AliMUONConstants::NCh(); ;
261
6babe058 262 AliMpSegFactory factory;
263
bf485fb9 264 for (ichamber=0; ichamber<nchambers; ichamber++) {
265 cHchannels_bending[ichamber]=0;
266 cHchannels_nonbending[ichamber]=0;
267 for (idetele=0; idetele<26; idetele++) {
268 detele= 100*(ichamber +1)+idetele;
269 dEchannels_bending[ichamber][idetele]=0;
270 dEchannels_nonbending[ichamber][idetele]=0;
271 dEoccupancy_bending[ichamber][idetele]=0;
272 dEoccupancy_nonbending[ichamber][idetele]=0;
6babe058 273 if ( AliMpDEManager::IsValidDetElemId(detele) ) {
274
275 segbend = factory.CreateMpSegmentation(detele, 0);
276 segnonbend = factory.CreateMpSegmentation(detele, 1);
277 if (AliMpDEManager::GetPlaneType(detele, 0) != kBendingPlane ) {
278 AliMpVSegmentation* tmp = segbend;
279 segbend = segnonbend;
280 segnonbend = tmp;
281 }
282
bf485fb9 283 for(ix=0; ix<=segbend->MaxPadIndexX(); ix++) {
284 for(iy=0; iy<=segbend->MaxPadIndexY(); iy++) {
285 pad.SetFirst(ix);
286 pad.SetSecond(iy);
287 if( segbend->HasPad(pad) ) {
288 dEchannels_bending[ichamber][idetele]++;
289 cHchannels_bending[ichamber]++;
290 totalchannels_bending++;
291 }
292 }
293 }
294 for(ix=0; ix<=segnonbend->MaxPadIndexX(); ix++) {
295 for(iy=0; iy<=segnonbend->MaxPadIndexY(); iy++) {
296 pad.SetFirst(ix);
297 pad.SetSecond(iy);
298 if(segnonbend->HasPad(pad)) {
299 dEchannels_nonbending[ichamber][idetele]++;
300 cHchannels_nonbending[ichamber]++;
301 totalchannels_nonbending++;
302 }
303 }
304 }
305 if (perDetEle) printf(">>> Detection element %4d has %5d channels in bending and %5d channels in nonbending \n",
306 detele, dEchannels_bending[ichamber][idetele], dEchannels_nonbending[ichamber][idetele] );
307 }
308 }
309 printf(">>> Chamber %2d has %6d channels in bending and %6d channels in nonbending \n",
310 ichamber+1, cHchannels_bending[ichamber], cHchannels_nonbending[ichamber]);
311 }
312 printf(">>Spectrometer has %7d channels in bending and %7d channels in nonbending \n",
313 totalchannels_bending, totalchannels_nonbending);
314
6babe058 315 factory.DeleteSegmentations();
316
bf485fb9 317 ievent=event2Check;
318 printf(">>> Event %d \n",ievent);
319 RunLoader->GetEvent(ievent);
320
321 // Addressing
322 muondata.SetTreeAddress("D");
323 muondata.GetDigits();
324 // Loop on chambers
325 for( ichamber=0; ichamber<nchambers; ichamber++) {
326 cHoccupancy_bending[ichamber] = 0;
327 cHoccupancy_nonbending[ichamber]= 0;
328 Int_t idigit, ndigits;
329 ndigits = (Int_t) muondata.Digits(ichamber)->GetEntriesFast();
330 for(idigit=0; idigit<ndigits; idigit++) {
331 mDigit = static_cast<AliMUONDigit*>(muondata.Digits(ichamber)->At(idigit));
332 Int_t detele = mDigit->DetElemId();
333 Int_t idetele = detele-(ichamber+1)*100;
334 if ( mDigit->Cathode() == 0 ) {
335
336 cHoccupancy_bending[ichamber]++;
337 dEoccupancy_bending[ichamber][idetele]++;
338 totaloccupancy_bending++;
339 }
340 else {
341 cHoccupancy_nonbending[ichamber]++;
342 dEoccupancy_nonbending[ichamber][idetele]++;
343 totaloccupancy_nonbending++;
344 }
345 } // end digit loop
346
347 printf(">>> Chamber %2d nChannels Bending %5d nChannels NonBending %5d \n",
348 ichamber+1,
349 cHoccupancy_bending[ichamber],
350 cHoccupancy_nonbending[ichamber]);
0ad940df 351 printf(">>> Chamber %2d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
bf485fb9 352 ichamber+1,
353 100.*((Float_t) cHoccupancy_bending[ichamber])/((Float_t) cHchannels_bending[ichamber]),
354 100.*((Float_t) cHoccupancy_nonbending[ichamber])/((Float_t) cHchannels_bending[ichamber]) );
355
356
357 for(Int_t idetele=0; idetele<26; idetele++) {
358 Int_t detele = idetele + 100*(ichamber+1);
6babe058 359 if ( AliMpDEManager::IsValidDetElemId(detele) ) {
bf485fb9 360 if (perDetEle) {
361 printf(">>> DetEle %4d nChannels Bending %5d nChannels NonBending %5d \n",
362 idetele+100*(ichamber+1),
363 dEoccupancy_bending[ichamber][idetele],
364 dEoccupancy_nonbending[ichamber][idetele]);
0ad940df 365 printf(">>> DetEle %4d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
bf485fb9 366 idetele+100*(ichamber+1),
367 100.*((Float_t) dEoccupancy_bending[ichamber][idetele])/((Float_t) dEchannels_bending[ichamber][idetele]),
368 100.*((Float_t) dEoccupancy_nonbending[ichamber][idetele])/((Float_t) dEchannels_bending[ichamber][idetele]));
369 }
370 }
371 }
372 } // end chamber loop
0ad940df 373 printf(">>> Muon Spectrometer Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
bf485fb9 374 100.*((Float_t) totaloccupancy_bending)/((Float_t) totalchannels_bending),
375 100.*((Float_t) totaloccupancy_nonbending)/((Float_t) totalchannels_nonbending) );
376 muondata.ResetDigits();
377 // } // end cathode loop
378 MUONLoader->UnloadDigits();
379}
380
381void MUONrecpoints(Int_t event2Check=0, char * filename="galice.root") {
88cb7938 382
88cb7938 383 // Creating Run Loader and openning file containing Hits
384 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
385 if (RunLoader ==0x0) {
386 printf(">>> Error : Error Opening %s file \n",filename);
387 return;
388 }
ce3f5e87 389 // Getting MUONloader
88cb7938 390 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
391 MUONLoader->LoadRecPoints("READ");
ce3f5e87 392 // Creating MUON data container
393 AliMUONData muondata(MUONLoader,"MUON","MUON");
88cb7938 394
395 Int_t ievent, nevents;
396 nevents = RunLoader->GetNumberOfEvents();
e516b01d 397 AliMUONRawCluster * mRecPoint = 0;
88cb7938 398
88cb7938 399 for(ievent=0; ievent<nevents; ievent++) {
2b32c661 400 if (event2Check!=0) ievent=event2Check;
88cb7938 401 printf(">>> Event %d \n",ievent);
402 RunLoader->GetEvent(ievent);
88cb7938 403 // Addressing
404 Int_t ichamber, nchambers;
405 nchambers = AliMUONConstants::NTrackingCh();
6babe058 406 muondata.SetTreeAddress("RC,TC");
88cb7938 407 char branchname[30];
1a1cdff8 408 muondata.GetRawClusters();
88cb7938 409 // Loop on chambers
410 for( ichamber=0; ichamber<nchambers; ichamber++) {
88cb7938 411 sprintf(branchname,"MUONRawClusters%d",ichamber+1);
412 //printf(">>> branchname %s\n",branchname);
88cb7938 413 Int_t irecpoint, nrecpoints;
ce3f5e87 414 nrecpoints = (Int_t) muondata.RawClusters(ichamber)->GetEntriesFast();
bf485fb9 415 // printf(">>> Chamber %2d, Number of recpoints = %6d \n",ichamber+1, nrecpoints);
88cb7938 416 for(irecpoint=0; irecpoint<nrecpoints; irecpoint++) {
ce3f5e87 417 mRecPoint = static_cast<AliMUONRawCluster*>(muondata.RawClusters(ichamber)->At(irecpoint));
6464217e 418 mRecPoint->Print("full");
88cb7938 419 } // end recpoint loop
420 } // end chamber loop
ce3f5e87 421 muondata.ResetRawClusters();
2b32c661 422 if (event2Check!=0) ievent=nevents;
88cb7938 423 } // end event loop
424 MUONLoader->UnloadRecPoints();
425}
426
fc103025 427void MUONrectrigger (Int_t event2Check=0, char * filename="galice.root", Int_t WRITE = 0)
9e48bfe3 428{
84da0ea0 429
da47578c 430 // reads and dumps trigger objects from MUON.RecPoints.root
88cb7938 431 TClonesArray * globalTrigger;
432 TClonesArray * localTrigger;
433
da47578c 434 // Do NOT print out all the info if the loop runs over all events
435 Int_t PRINTOUT = (event2Check == 0 ) ? 0 : 1 ;
9e48bfe3 436
da47578c 437 // Book a ntuple for more detailled studies
9e48bfe3 438 TNtuple *TgtupleGlo = new TNtuple("TgtupleGlo","Global Trigger Ntuple","ev:global:spapt:smapt:undefapt:uplpt:uphpt:upapt:lpapt");
84da0ea0 439 TNtuple *TgtupleLoc = new TNtuple("TgtupleLoc","Local Trigger Ntuple","ev:LoCircuit:LoStripX:LoDev:StripY:LoLpt:LoHpt:LoApt:y11:y21:x11");
da47578c 440
441 // counters
442 Int_t SPLowpt=0,SPHighpt=0,SPAllpt=0;
443 Int_t SMLowpt=0,SMHighpt=0,SMAllpt=0;
444 Int_t SULowpt=0,SUHighpt=0,SUAllpt=0;
445 Int_t USLowpt=0,USHighpt=0,USAllpt=0;
446 Int_t LSLowpt=0,LSHighpt=0,LSAllpt=0;
447
88cb7938 448 // Creating Run Loader and openning file containing Hits
449 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
450 if (RunLoader ==0x0) {
c121e924 451 printf(">>> Error : Error Opening %s file \n",filename);
452 return;
88cb7938 453 }
84da0ea0 454
455 // Loading MUON subsystem
456 RunLoader->LoadgAlice();
457 AliMUON* pMUON = (AliMUON*)RunLoader->GetAliRun()->GetModule("MUON");
88cb7938 458
88cb7938 459 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
6d2a906b 460 MUONLoader->LoadDigits("READ");
ce3f5e87 461 // Creating MUON data container
462 AliMUONData muondata(MUONLoader,"MUON","MUON");
88cb7938 463
c121e924 464
88cb7938 465 Int_t ievent, nevents;
466 nevents = RunLoader->GetNumberOfEvents();
467
0ad940df 468 AliMUONGlobalTrigger *gloTrg(0x0);
469 AliMUONLocalTrigger *locTrg(0x0);
88cb7938 470
471 for (ievent=0; ievent<nevents; ievent++) {
2b32c661 472 if (event2Check!=0) ievent=event2Check;
da47578c 473 if (ievent%100==0 || event2Check) cout << "Processing event " << ievent << endl;
c121e924 474 RunLoader->GetEvent(ievent);
475
9e48bfe3 476 muondata.SetTreeAddress("D,GLT");
6d2a906b 477 muondata.GetTriggerD();
c121e924 478
479 globalTrigger = muondata.GlobalTrigger();
480 localTrigger = muondata.LocalTrigger();
481
482 Int_t nglobals = (Int_t) globalTrigger->GetEntriesFast(); // should be 1
483 Int_t nlocals = (Int_t) localTrigger->GetEntriesFast(); // up to 234
da47578c 484 if (PRINTOUT) printf("###################################################\n");
eba3379e 485 if (PRINTOUT) printf("event %d nglobal %d nlocal %d \n",ievent,nglobals,nlocals);
486
c121e924 487 for (Int_t iglobal=0; iglobal<nglobals; iglobal++) { // Global Trigger
488 gloTrg = static_cast<AliMUONGlobalTrigger*>(globalTrigger->At(iglobal));
88cb7938 489
da47578c 490 SPLowpt+=gloTrg->SinglePlusLpt() ;
491 SPHighpt+=gloTrg->SinglePlusHpt() ;
492 SPAllpt+=gloTrg->SinglePlusApt() ;
493 SMLowpt+=gloTrg->SingleMinusLpt();
494 SMHighpt+=gloTrg->SingleMinusHpt();
495 SMAllpt+=gloTrg->SingleMinusApt();
496 SULowpt+=gloTrg->SingleUndefLpt();
497 SUHighpt+=gloTrg->SingleUndefHpt();
498 SUAllpt+=gloTrg->SingleUndefApt();
499 USLowpt+=gloTrg->PairUnlikeLpt();
500 USHighpt+=gloTrg->PairUnlikeHpt();
501 USAllpt+=gloTrg->PairUnlikeApt();
502 LSLowpt+=gloTrg->PairLikeLpt();
503 LSHighpt+=gloTrg->PairLikeHpt();
504 LSAllpt+=gloTrg->PairLikeApt();
88cb7938 505
eba3379e 506 if (PRINTOUT) gloTrg->Print("full");
507
c121e924 508 } // end of loop on Global Trigger
509
510 for (Int_t ilocal=0; ilocal<nlocals; ilocal++) { // Local Trigger
c121e924 511 locTrg = static_cast<AliMUONLocalTrigger*>(localTrigger->At(ilocal));
eba3379e 512 if (PRINTOUT) locTrg->Print("full");
84da0ea0 513
fc103025 514 AliMUONTriggerCircuitNew * circuit = &(pMUON->TriggerCircuitNew(locTrg->LoCircuit()-1));
515
516 TgtupleLoc->Fill(ievent,locTrg->LoCircuit(),locTrg->LoStripX(),locTrg->LoDev(),locTrg->LoStripY(),locTrg->LoLpt(),locTrg->LoHpt(),locTrg->LoApt(),circuit->GetY11Pos(locTrg->LoStripX()),circuit->GetY21Pos(locTrg->LoStripX()+locTrg->LoDev()+1),circuit->GetX11Pos(locTrg->LoStripY()));
c121e924 517 } // end of loop on Local Trigger
da47578c 518
519
520 // fill ntuple
4af32a88 521 //TNtuple *Tgtuple = new TNtuple("Tgtuple","Trigger Ntuple","ev:global:spapt:smapt:undefapt:uplpt:uphpt:upapt:lpapt");
9e48bfe3 522 TgtupleGlo->Fill(ievent,nglobals,gloTrg->SinglePlusApt(),gloTrg->SingleMinusApt(),gloTrg->SingleUndefApt(),gloTrg->PairUnlikeLpt(),gloTrg->PairUnlikeHpt(),gloTrg->PairUnlikeApt(),gloTrg->PairLikeApt());
da47578c 523
c121e924 524 muondata.ResetTrigger();
2b32c661 525 if (event2Check!=0) ievent=nevents;
88cb7938 526 } // end loop on event
da47578c 527
528 // Print out summary if loop ran over all event
144414de 529 if (!event2Check){
530 printf("\n");
531 printf("===================================================\n");
532 printf("=================== SUMMARY =====================\n");
533 printf("\n");
534 printf("Total number of events processed %d \n", (event2Check==0) ? nevents : 1);
535 printf("\n");
536 printf(" Global Trigger output Low pt High pt All\n");
537 printf(" number of Single Plus :\t");
538 printf("%i\t%i\t%i\t",SPLowpt,SPHighpt,SPAllpt);
539 printf("\n");
540 printf(" number of Single Minus :\t");
541 printf("%i\t%i\t%i\t",SMLowpt,SMHighpt,SMAllpt);
542 printf("\n");
543 printf(" number of Single Undefined :\t");
544 printf("%i\t%i\t%i\t",SULowpt,SUHighpt,SUAllpt);
545 printf("\n");
546 printf(" number of UnlikeSign pair :\t");
547 printf("%i\t%i\t%i\t",USLowpt,USHighpt,USAllpt);
548 printf("\n");
549 printf(" number of LikeSign pair :\t");
550 printf("%i\t%i\t%i\t",LSLowpt,LSHighpt, LSAllpt);
551 printf("\n");
552 printf("===================================================\n");
553 }
554
da47578c 555 if (WRITE){
9e48bfe3 556 TFile *myFile = new TFile("TriggerCheck.root", "RECREATE");
557 TgtupleGlo->Write();
558 TgtupleLoc->Write();
da47578c 559 myFile->Close();
560 }
c121e924 561
da47578c 562 MUONLoader->UnloadRecPoints();
563}
88cb7938 564
9e48bfe3 565
bf485fb9 566void MUONrectracks (Int_t event2Check=0, char * filename="galice.root"){
8547965d 567// reads and dumps trigger objects from MUON.RecPoints.root
568 TClonesArray * RecTracks;
569
570 // Creating Run Loader and openning file containing Hits
571 AliRunLoader * RunLoader = AliRunLoader::Open(filename,"MUONFolder","READ");
572 if (RunLoader ==0x0) {
573 printf(">>> Error : Error Opening %s file \n",filename);
574 return;
575 }
576
577 AliLoader * MUONLoader = RunLoader->GetLoader("MUONLoader");
578 MUONLoader->LoadTracks("READ");
579 // Creating MUON data container
580 AliMUONData muondata(MUONLoader,"MUON","MUON");
581
582 Int_t ievent, nevents;
583 nevents = RunLoader->GetNumberOfEvents();
584
e516b01d 585 // AliMUONTrack * rectrack;
8547965d 586
587 for (ievent=0; ievent<nevents; ievent++) {
2b32c661 588 if (event2Check!=0) ievent=event2Check;
8547965d 589 RunLoader->GetEvent(ievent);
590
591 muondata.SetTreeAddress("RT");
592 muondata.GetRecTracks();
593 RecTracks = muondata.RecTracks();
594
595
596 Int_t nrectracks = (Int_t) RecTracks->GetEntriesFast(); //
597
bf485fb9 598 printf(">>> Event %d, Number of Recconstructed tracks %d \n",ievent, nrectracks);
599 // loop over tracks
6464217e 600
601 // setting pointer for tracks, triggertracks & trackparam at vertex
bf485fb9 602 AliMUONTrack* recTrack = 0;
603 AliMUONTrackParam* trackParam = 0;
604
605 for (Int_t iRecTracks = 0; iRecTracks < nrectracks; iRecTracks++) {
6464217e 606 // // reading info from tracks
607 recTrack = (AliMUONTrack*) RecTracks->At(iRecTracks);
608 trackParam = (AliMUONTrackParam*) (recTrack->GetTrackParamAtHit())->First();
609 trackParam->ExtrapToZ(0.0);
610 recTrack->Print("full");
bf485fb9 611 } // end loop tracks
612
8547965d 613 muondata.ResetRecTracks();
2b32c661 614 if (event2Check!=0) ievent=nevents;
8547965d 615 } // end loop on event
616 MUONLoader->UnloadTracks();
617}
618