]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUON.cxx
Cleaning of the code :
[u/mrichter/AliRoot.git] / MUON / AliMUON.cxx
CommitLineData
4c039060 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 **************************************************************************/
4c039060 15/*
16$Log$
ecfa008b 17Revision 1.29 2000/07/28 13:49:38 morsch
18SetAcceptance defines inner and outer chamber radii according to angular acceptance.
19Can be used for simple acceptance studies.
20
5c1f55c5 21Revision 1.28 2000/07/22 16:43:15 morsch
22Same comment as before, but now done correctly I hope (sorry it's Saturday evening)
23
45085cb9 24Revision 1.27 2000/07/22 16:36:50 morsch
25Change order of indices in creation (new) of xhit and yhit
26
6b18d06a 27Revision 1.26 2000/07/03 11:54:57 morsch
28AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
29The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
30
a30a000f 31Revision 1.25 2000/06/29 12:34:09 morsch
32AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
33it usable with any other geometry class. The link to the object to which it belongs is
34established via an index. This assumes that there exists a global geometry manager
35from which the pointer to the parent object can be obtained (in our case gAlice).
36
d81db581 37Revision 1.24 2000/06/28 15:16:35 morsch
38(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
39to allow development of slat-muon chamber simulation and reconstruction code in the MUON
40framework. The changes should have no side effects (mostly dummy arguments).
41(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
42of chambers with overlapping modules (MakePadHits, Disintegration).
43
802a864d 44Revision 1.23 2000/06/28 12:19:17 morsch
45More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
46cluster and hit reconstruction algorithms in AliMUONClusterFinderVS.
47AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
48It requires two cathode planes. Small modifications in the code will make it usable for
49one cathode plane and, hence, more general (for test beam data).
50AliMUONClusterFinder is now obsolete.
51
30aaba74 52Revision 1.22 2000/06/28 08:06:10 morsch
53Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
54algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
55It also naturally takes care of the TMinuit instance.
56
9825400f 57Revision 1.21 2000/06/27 08:54:41 morsch
58Problems with on constant array sizes (in hitMap, nmuon, xhit, yhit) corrected.
59
d09fafb0 60Revision 1.20 2000/06/26 14:02:38 morsch
61Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
62
f665c1ea 63Revision 1.19 2000/06/22 13:40:51 morsch
64scope problem on HP, "i" declared once
65pow changed to TMath::Power (PH, AM)
66
9ae15266 67Revision 1.18 2000/06/15 07:58:48 morsch
68Code from MUON-dev joined
69
a9e2aefa 70Revision 1.14.4.17 2000/06/14 14:36:46 morsch
71- add TriggerCircuit (PC)
72- add GlobalTrigger and LocalTrigger and specific methods (PC)
73
74Revision 1.14.4.16 2000/06/09 21:20:28 morsch
75Most coding rule violations corrected
76
77Revision 1.14.4.15 2000/05/02 09:54:32 morsch
78RULE RN17 violations corrected
79
80Revision 1.14.4.12 2000/04/26 12:25:02 morsch
81Code revised by P. Crochet:
82- Z position of TriggerChamber changed according to A.Tournaire Priv.Comm.
83- ToF included in the method MakePadHits
84- inner radius of flange between beam shielding and trigger corrected
85- Trigger global volume updated (according to the new geometry)
86
87Revision 1.14.4.11 2000/04/19 19:42:08 morsch
88Some changes of variable names curing viols and methods concerning
89correlated clusters removed.
90
91Revision 1.14.4.10 2000/03/22 16:44:07 gosset
92Memory leak suppressed in function Digitise:
93p_adr->Delete() instead of Clear (I.Chevrot and A.Baldisseri)
94
95Revision 1.14.4.9 2000/03/20 18:15:25 morsch
96Positions of trigger chambers corrected (P.C.)
dbe37a89 97
a9e2aefa 98Revision 1.14.4.8 2000/02/21 15:38:01 morsch
99Call to AddHitList introduced to make this version compatible with head.
dffd31ef 100
a9e2aefa 101Revision 1.14.4.7 2000/02/20 07:45:53 morsch
102Bugs in Trigger part of BuildGeomemetry corrected (P.C)
1cedd08a 103
a9e2aefa 104Revision 1.14.4.6 2000/02/17 14:28:54 morsch
105Trigger included into initialization and digitization
6a935c13 106
a9e2aefa 107Revision 1.14.4.5 2000/02/15 10:02:58 morsch
108Log messages of previous revisions added
5d84196c 109
a9e2aefa 110Revision 1.14.4.2 2000/02/04 10:57:34 gosset
111Z position of the chambers:
112it was the Z position of the stations;
113it is now really the Z position of the chambers.
114 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
115 !!!! AND "AliMUONChamber::ZPosition"
116 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
117 !!!! AND "AliMUONChamber::Z"
50f986db 118
a9e2aefa 119Revision 1.14.4.3 2000/02/04 16:19:04 gosset
120Correction for mis-spelling of NCH
0b34885d 121
a9e2aefa 122Revision 1.14.4.4 2000/02/15 09:43:38 morsch
123Log message added
2b86633d 124
4c039060 125*/
126
a9e2aefa 127
128///////////////////////////////////////////////
fe4da5cc 129// Manager and hits classes for set:MUON //
130////////////////////////////////////////////////
131
132#include <TTUBE.h>
a897a37a 133#include <TBRIK.h>
134#include <TRotMatrix.h>
fe4da5cc 135#include <TNode.h>
a897a37a 136#include <TTree.h>
fe4da5cc 137#include <TRandom.h>
138#include <TObject.h>
139#include <TVector.h>
140#include <TObjArray.h>
a897a37a 141#include <TMinuit.h>
142#include <TParticle.h>
143#include <TROOT.h>
144#include <TFile.h>
145#include <TNtuple.h>
146#include <TCanvas.h>
147#include <TPad.h>
148#include <TDirectory.h>
149#include <TObjectTable.h>
150#include <AliPDG.h>
a9e2aefa 151#include <TTUBE.h>
fe4da5cc 152
153#include "AliMUON.h"
a9e2aefa 154#include "AliMUONHit.h"
155#include "AliMUONPadHit.h"
156#include "AliMUONDigit.h"
157#include "AliMUONTransientDigit.h"
158#include "AliMUONRawCluster.h"
159#include "AliMUONLocalTrigger.h"
160#include "AliMUONGlobalTrigger.h"
ecfa008b 161#include "AliMUONTriggerCircuit.h"
a30a000f 162#include "AliHitMap.h"
a9e2aefa 163#include "AliMUONHitMapA1.h"
164#include "AliMUONChamberTrigger.h"
f665c1ea 165#include "AliMUONConstants.h"
30aaba74 166#include "AliMUONClusterFinderVS.h"
a9e2aefa 167#include "AliMUONTriggerDecision.h"
fe4da5cc 168#include "AliRun.h"
169#include "AliMC.h"
9825400f 170#include "AliMUONClusterInput.h"
fe4da5cc 171#include "iostream.h"
172#include "AliCallf77.h"
a9e2aefa 173#include "AliConst.h"
174
175// Defaults parameters for Z positions of chambers
176// taken from values for "stations" in AliMUON::AliMUON
177// const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.};
178// and from array "dstation" in AliMUONv1::CreateGeometry
179// Float_t dstation[5]={20., 20., 20, 20., 20.};
180// for tracking chambers,
181// according to (Z1 = zch - dstation) and (Z2 = zch + dstation)
182// for the first and second chambers in the station, respectively,
183// and from "DTPLANES" in AliMUONv1::CreateGeometry
184// const Float_t DTPLANES = 15.;
185// for trigger chambers,
186// according to (Z1 = zch) and (Z2 = zch + DTPLANES)
187// for the first and second chambers in the station, respectively
fe4da5cc 188
fe4da5cc 189ClassImp(AliMUON)
fe4da5cc 190//___________________________________________
191AliMUON::AliMUON()
192{
a9e2aefa 193 fIshunt = 0;
194 fHits = 0;
195 fPadHits = 0;
196 fNPadHits = 0;
197 fDchambers = 0;
198 fTriggerCircuits = 0; // cp new design of AliMUONTriggerDecision
199 fNdch = 0;
200 fRawClusters = 0;
201 fNrawch = 0;
202 fGlobalTrigger = 0;
203 fNLocalTrigger = 0;
204 fLocalTrigger = 0;
205 fNLocalTrigger = 0;
5c1f55c5 206 fAccMin = 0.;
207 fAccMax = 0.;
208 fAccCut = kFALSE;
fe4da5cc 209}
210
211//___________________________________________
212AliMUON::AliMUON(const char *name, const char *title)
213 : AliDetector(name,title)
214{
215//Begin_Html
216/*
a897a37a 217<img src="gif/alimuon.gif">
fe4da5cc 218*/
219//End_Html
f665c1ea 220
a9e2aefa 221 fHits = new TClonesArray("AliMUONHit",1000);
1cedd08a 222 gAlice->AddHitList(fHits);
a9e2aefa 223 fPadHits = new TClonesArray("AliMUONPadHit",10000);
224 fNPadHits = 0;
fe4da5cc 225 fIshunt = 0;
226
f665c1ea 227 fNdch = new Int_t[AliMUONConstants::NCh()];
fe4da5cc 228
f665c1ea 229 fDchambers = new TObjArray(AliMUONConstants::NCh());
fe4da5cc 230
231 Int_t i;
232
f665c1ea 233 for (i=0; i<AliMUONConstants::NCh() ;i++) {
a9e2aefa 234 (*fDchambers)[i] = new TClonesArray("AliMUONDigit",10000);
fe4da5cc 235 fNdch[i]=0;
236 }
237
f665c1ea 238 fNrawch = new Int_t[AliMUONConstants::NTrackingCh()];
a897a37a 239
f665c1ea 240 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
a897a37a 241
f665c1ea 242 for (i=0; i<AliMUONConstants::NTrackingCh();i++) {
a897a37a 243 (*fRawClusters)[i] = new TClonesArray("AliMUONRawCluster",10000);
244 fNrawch[i]=0;
245 }
246
a9e2aefa 247 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
248 fNGlobalTrigger = 0;
249 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
250 fNLocalTrigger = 0;
fe4da5cc 251
fe4da5cc 252 SetMarkerColor(kRed);
a9e2aefa 253//
254//
255//
256//
f665c1ea 257
a9e2aefa 258 Int_t ch;
259
f665c1ea 260 fChambers = new TObjArray(AliMUONConstants::NCh());
a9e2aefa 261
262 // Loop over stations
f665c1ea 263 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
a9e2aefa 264 // Loop over 2 chambers in the station
265 for (Int_t stCH = 0; stCH < 2; stCH++) {
266//
267//
268// Default Parameters for Muon Tracking Stations
269
270
271 ch = 2 * st + stCH;
272//
f665c1ea 273 if (ch < AliMUONConstants::NTrackingCh()) {
d81db581 274 (*fChambers)[ch] = new AliMUONChamber(ch);
a9e2aefa 275 } else {
d81db581 276 (*fChambers)[ch] = new AliMUONChamberTrigger(ch);
a9e2aefa 277 }
278
279 AliMUONChamber* chamber = (AliMUONChamber*) (*fChambers)[ch];
280
281 chamber->SetGid(0);
282 // Default values for Z of chambers
f665c1ea 283 chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
a9e2aefa 284//
f665c1ea 285 chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
5c1f55c5 286// Set chamber inner and outer radius to default
f665c1ea 287 chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
288 chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
a9e2aefa 289//
290 } // Chamber stCH (0, 1) in
291 } // Station st (0...)
292 fMaxStepGas=0.01;
293 fMaxStepAlu=0.1;
294 fMaxDestepGas=-1;
295 fMaxDestepAlu=-1;
296//
297 fMaxIterPad = 0;
298 fCurIterPad = 0;
5c1f55c5 299//
300 fAccMin = 0.;
301 fAccMax = 0.;
302 fAccCut = kFALSE;
a9e2aefa 303
304 // cp new design of AliMUONTriggerDecision
f665c1ea 305 fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
306 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
a9e2aefa 307 (*fTriggerCircuits)[circ] = new AliMUONTriggerCircuit();
308 }
309 // cp new design of AliMUONTriggerDecision
310
fe4da5cc 311}
312
313//___________________________________________
a9e2aefa 314AliMUON::AliMUON(const AliMUON& rMUON)
315{
316// Dummy copy constructor
317 ;
318
319}
320
fe4da5cc 321AliMUON::~AliMUON()
322{
a897a37a 323 printf("Calling AliMUON destructor !!!\n");
324
f665c1ea 325 Int_t i;
326 fIshunt = 0;
327 delete fHits;
328 delete fPadHits;
329
330 delete fGlobalTrigger;
331 fNGlobalTrigger = 0;
332
333 delete fLocalTrigger;
334 fNLocalTrigger = 0;
a897a37a 335
f665c1ea 336 for (i=0;i<AliMUONConstants::NCh();i++) {
337 delete (*fDchambers)[i];
338 fNdch[i]=0;
339 }
340 delete fDchambers;
341
342 for (i=0;i<AliMUONConstants::NTrackingCh();i++) {
343 delete (*fRawClusters)[i];
344 fNrawch[i]=0;
345 }
346 delete fRawClusters;
347
348 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
349 delete (*fTriggerCircuits)[circ];
350 }
351 delete fTriggerCircuits;
fe4da5cc 352}
353
354//___________________________________________
355void AliMUON::AddHit(Int_t track, Int_t *vol, Float_t *hits)
356{
357 TClonesArray &lhits = *fHits;
a9e2aefa 358 new(lhits[fNhits++]) AliMUONHit(fIshunt,track,vol,hits);
fe4da5cc 359}
360//___________________________________________
a9e2aefa 361void AliMUON::AddPadHit(Int_t *clhits)
fe4da5cc 362{
a9e2aefa 363 TClonesArray &lclusters = *fPadHits;
364 new(lclusters[fNPadHits++]) AliMUONPadHit(clhits);
fe4da5cc 365}
366//_____________________________________________________________________________
367void AliMUON::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
368{
369 //
370 // Add a MUON digit to the list
371 //
372
373 TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]);
a9e2aefa 374 new(ldigits[fNdch[id]++]) AliMUONDigit(tracks,charges,digits);
fe4da5cc 375}
376
a897a37a 377//_____________________________________________________________________________
378void AliMUON::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
379{
380 //
381 // Add a MUON digit to the list
382 //
383
384 TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
385 new(lrawcl[fNrawch[id]++]) AliMUONRawCluster(c);
386}
a897a37a 387
a9e2aefa 388//___________________________________________
389void AliMUON::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
390 Int_t *singleUndef,
391 Int_t *pairUnlike, Int_t *pairLike)
392{
393// add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
394 TClonesArray &globalTrigger = *fGlobalTrigger;
395 new(globalTrigger[fNGlobalTrigger++])
396 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike,
397 pairLike);
398}
399//___________________________________________
400void AliMUON::AddLocalTrigger(Int_t *localtr)
401{
402// add a MUON Local Trigger to the list
403 TClonesArray &localTrigger = *fLocalTrigger;
404 new(localTrigger[fNLocalTrigger++]) AliMUONLocalTrigger(localtr);
a897a37a 405}
406
fe4da5cc 407//___________________________________________
408void AliMUON::BuildGeometry()
409{
a9e2aefa 410 TNode *node, *nodeF, *top, *nodeS;
411 const int kColorMUON = kBlue;
412 const int kColorMUON2 = kGreen;
a897a37a 413 //
a9e2aefa 414 top=gAlice->GetGeometry()->GetNode("alice");
a897a37a 415// MUON
416//
417// z-Positions of Chambers
a9e2aefa 418 const Float_t kCz[7]={511., 686., 971., 1245., 1445., 1600, 1700.};
419// inner diameter (Xlenght for trigger chamber -> active area)
420 const Float_t kDmin[7]={ 35., 47., 67., 86., 100., 544., 544.};
421// outer diameter (Ylenght for trigger chamber -> active area)
422 const Float_t kDmax[7]={183., 245., 346., 520., 520., 612., 612.};
a897a37a 423
424 TRotMatrix* rot000 = new TRotMatrix("Rot000"," ", 90, 0, 90, 90, 0, 0);
425 TRotMatrix* rot090 = new TRotMatrix("Rot090"," ", 90, 90, 90,180, 0, 0);
426 TRotMatrix* rot180 = new TRotMatrix("Rot180"," ", 90,180, 90,270, 0, 0);
427 TRotMatrix* rot270 = new TRotMatrix("Rot270"," ", 90,270, 90, 0, 0, 0);
428
a9e2aefa 429 Float_t rmin, rmax, dx, dy, dz, dr, xpos, ypos, zpos;
430 Float_t dzc1=4.; // tracking chambers
431 Float_t dzc2=15.; // trigger chambers
432 Float_t hole=102.; // x-y hole around beam pipe for trig. chambers
433 Float_t zscale; // scaling parameter trigger chambers
434 Float_t halfx, halfy;
435 char nameChamber[9], nameSense[9], nameFrame[9], nameNode[8];
436 char nameSense1[9], nameSense2[9];
437 for (Int_t i=0; i<7; i++) {
a897a37a 438 for (Int_t j=0; j<2; j++) {
439 Int_t id=2*i+j+1;
a9e2aefa 440 if (i<5) { // tracking chambers
441 if (j==0) {
442 zpos=kCz[i]-dzc1;
443 } else {
444 zpos=kCz[i]+dzc1;
445 }
a897a37a 446 } else {
a9e2aefa 447 if (j==0) {
448 zpos=kCz[i];
449 } else {
450 zpos=kCz[i]+dzc2;
451 }
a897a37a 452 }
a9e2aefa 453 sprintf(nameChamber,"C_MUON%d",id);
454 sprintf(nameSense,"S_MUON%d",id);
455 sprintf(nameSense1,"S1_MUON%d",id);
456 sprintf(nameSense2,"S2_MUON%d",id);
457 sprintf(nameFrame,"F_MUON%d",id);
458 if (i<5) { // tracking chambers
459 rmin = kDmin[i]/2.-3;
460 rmax = kDmax[i]/2.+3;
461 new TTUBE(nameChamber,"Mother","void",rmin,rmax,0.25,1.);
462 rmin = kDmin[i]/2.;
463 rmax = kDmax[i]/2.;
464 new TTUBE(nameSense,"Sens. region","void",rmin,rmax,0.25, 1.);
465 dx=(rmax-rmin)/2;
466 dy=3.;
467 dz=0.25;
468 TBRIK* frMUON = new TBRIK(nameFrame,"Frame","void",dx,dy,dz);
469 top->cd();
470 sprintf(nameNode,"MUON%d",100+id);
471 node = new TNode(nameNode,"ChamberNode",nameChamber,0,0,zpos,"");
472 node->SetLineColor(kColorMUON);
473 fNodes->Add(node);
474 node->cd();
475 sprintf(nameNode,"MUON%d",200+id);
476 node = new TNode(nameNode,"Sens. Region Node",nameSense,0,0,0,"");
477 node->SetLineColor(kColorMUON);
478 node->cd();
479 dr=dx+rmin;
480 sprintf(nameNode,"MUON%d",300+id);
481 nodeF = new TNode(nameNode,"Frame0",frMUON,dr, 0, 0,rot000,"");
482 nodeF->SetLineColor(kColorMUON);
483 node->cd();
484 sprintf(nameNode,"MUON%d",400+id);
485 nodeF = new TNode(nameNode,"Frame1",frMUON,0 ,dr,0,rot090,"");
486 nodeF->SetLineColor(kColorMUON);
487 node->cd();
488 sprintf(nameNode,"MUON%d",500+id);
489 nodeF = new TNode(nameNode,"Frame2",frMUON,-dr,0,0,rot180,"");
490 nodeF->SetLineColor(kColorMUON);
491 node ->cd();
492 sprintf(nameNode,"MUON%d",600+id);
493 nodeF = new TNode(nameNode,"Frame3",frMUON,0,-dr,0,rot270,"");
494 nodeF->SetLineColor(kColorMUON);
495 } else {
496 zscale=zpos/kCz[5];
497 Float_t xsize=kDmin[i]*zscale;
498 Float_t ysize=kDmax[i]*zscale;
499 Float_t holeScaled=hole*zscale;
500
501 halfx=xsize/2.+3.;
502 halfy=ysize/2.+3.;
503 new TBRIK(nameChamber,"Mother","void",halfx,halfy,0.25);
504 top->cd();
505 sprintf(nameNode,"MUON%d",100+id);
506 node = new TNode(nameNode,"Chambernode",nameChamber,0,0,zpos,"");
507 node->SetLineColor(kColorMUON2);
508 fNodes->Add(node);
509
510// up/down of beam pipe
511 halfx=xsize/2.;
512 halfy=(ysize/2.-holeScaled/2.)/2.;
513 new TBRIK(nameSense,"Sens. region","void",halfx,halfy,0.25);
514
515 node->cd();
516 ypos=holeScaled/2.+((ysize/2.-holeScaled/2.)/2.);
517 sprintf(nameNode,"MUON%d",200+id);
518 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense,0,ypos,0,"");
519 nodeS->SetLineColor(kColorMUON2);
520
521 node->cd();
522 ypos=-1.*ypos;
523 sprintf(nameNode,"MUON%d",300+id);
524 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense,0,ypos,0,"");
525 nodeS->SetLineColor(kColorMUON2);
526
527// left/right of beam pipe
528 halfx=(xsize/2.-holeScaled/2.)/2.;
529 halfy=holeScaled/2.;
530 new TBRIK(nameSense1,"Sens. region","void",halfx,halfy,0.25);
531
532 node->cd();
533 xpos=holeScaled/2.+((xsize/2.-holeScaled/2.)/2.);
534 sprintf(nameNode,"MUON%d",400+id);
535 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense1,xpos,0,0,"");
536 nodeS->SetLineColor(kColorMUON2);
537
538 node->cd();
539 xpos=-1.*xpos;
540 sprintf(nameNode,"MUON%d",500+id);
541 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense1,xpos,0,0,"");
542 nodeS->SetLineColor(kColorMUON2);
543
544// missing corners
545 halfx=17.*zscale/2.;
546 halfy=halfx;
547 new TBRIK(nameSense2,"Sens. region","void",halfx,halfy,0.25);
548
549 node->cd();
550 xpos=holeScaled/2.-halfx;
551 ypos=xpos;
552 sprintf(nameNode,"MUON%d",600+id);
553 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
554 nodeS->SetLineColor(kColorMUON2);
555
556 node->cd();
557 ypos=-1.*xpos;
558 sprintf(nameNode,"MUON%d",700+id);
559 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
560 nodeS->SetLineColor(kColorMUON2);
561
562 node->cd();
563 xpos=-1.*xpos;
564 sprintf(nameNode,"MUON%d",800+id);
565 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
566 nodeS->SetLineColor(kColorMUON2);
567
568 node->cd();
569 ypos=-1.*xpos;
570 sprintf(nameNode,"MUON%d",900+id);
571 nodeS = new TNode(nameNode,"Sens. Region Node",nameSense2,xpos,ypos,0,"");
572 nodeS->SetLineColor(kColorMUON2);
573 }
a897a37a 574 }
575 }
fe4da5cc 576}
577
a897a37a 578
fe4da5cc 579//___________________________________________
580Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
581{
582 return 9999;
583}
584
585//___________________________________________
586void AliMUON::MakeBranch(Option_t* option)
587{
f665c1ea 588 // Create Tree branches for the MUON.
589 const Int_t kBufferSize = 4000;
590 char branchname[30];
591 sprintf(branchname,"%sCluster",GetName());
592
593 AliDetector::MakeBranch(option);
594
595 if (fPadHits && gAlice->TreeH()) {
596 gAlice->TreeH()->Branch(branchname,&fPadHits, kBufferSize);
597 printf("Making Branch %s for clusters\n",branchname);
598 }
599
fe4da5cc 600// one branch for digits per chamber
f665c1ea 601 Int_t i;
602
603 for (i=0; i<AliMUONConstants::NCh() ;i++) {
604 sprintf(branchname,"%sDigits%d",GetName(),i+1);
605
606 if (fDchambers && gAlice->TreeD()) {
607 gAlice->TreeD()->Branch(branchname,&((*fDchambers)[i]), kBufferSize);
608 printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
609 }
610 }
611
612 printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
613
a897a37a 614// one branch for raw clusters per chamber
f665c1ea 615 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
616 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
617
618 if (fRawClusters && gAlice->TreeR()) {
619 gAlice->TreeR()->Branch(branchname,&((*fRawClusters)[i]), kBufferSize);
620 printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1);
621 }
622 }
623
a9e2aefa 624// one branch for global trigger
f665c1ea 625 sprintf(branchname,"%sGlobalTrigger",GetName());
626 if (fGlobalTrigger && gAlice->TreeR()) {
627 gAlice->TreeR()->Branch(branchname,&fGlobalTrigger,kBufferSize);
628 printf("Making Branch %s for Global Trigger\n",branchname);
629 }
a9e2aefa 630// one branch for local trigger
f665c1ea 631 sprintf(branchname,"%sLocalTrigger",GetName());
632 if (fLocalTrigger && gAlice->TreeR()) {
633 gAlice->TreeR()->Branch(branchname,&fLocalTrigger,kBufferSize);
634 printf("Making Branch %s for Local Trigger\n",branchname);
635 }
636
fe4da5cc 637}
638
639//___________________________________________
640void AliMUON::SetTreeAddress()
641{
642 // Set branch address for the Hits and Digits Tree.
a897a37a 643 char branchname[30];
fe4da5cc 644 AliDetector::SetTreeAddress();
645
646 TBranch *branch;
647 TTree *treeH = gAlice->TreeH();
648 TTree *treeD = gAlice->TreeD();
a897a37a 649 TTree *treeR = gAlice->TreeR();
fe4da5cc 650
651 if (treeH) {
a9e2aefa 652 if (fPadHits) {
fe4da5cc 653 branch = treeH->GetBranch("MUONCluster");
a9e2aefa 654 if (branch) branch->SetAddress(&fPadHits);
fe4da5cc 655 }
656 }
657
658 if (treeD) {
f665c1ea 659 for (int i=0; i<AliMUONConstants::NCh(); i++) {
fe4da5cc 660 sprintf(branchname,"%sDigits%d",GetName(),i+1);
661 if (fDchambers) {
662 branch = treeD->GetBranch(branchname);
663 if (branch) branch->SetAddress(&((*fDchambers)[i]));
664 }
665 }
666 }
a897a37a 667
668 // printf("SetTreeAddress --- treeR address %p \n",treeR);
669
670 if (treeR) {
f665c1ea 671 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
a897a37a 672 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
673 if (fRawClusters) {
674 branch = treeR->GetBranch(branchname);
675 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
676 }
677 }
a897a37a 678
a9e2aefa 679 if (fLocalTrigger) {
680 branch = treeR->GetBranch("MUONLocalTrigger");
681 if (branch) branch->SetAddress(&fLocalTrigger);
682 }
683 if (fGlobalTrigger) {
684 branch = treeR->GetBranch("MUONGlobalTrigger");
685 if (branch) branch->SetAddress(&fGlobalTrigger);
686 }
687 }
fe4da5cc 688}
689//___________________________________________
690void AliMUON::ResetHits()
691{
692 // Reset number of clusters and the cluster array for this detector
693 AliDetector::ResetHits();
a9e2aefa 694 fNPadHits = 0;
695 if (fPadHits) fPadHits->Clear();
fe4da5cc 696}
697
698//____________________________________________
699void AliMUON::ResetDigits()
700{
701 //
702 // Reset number of digits and the digits array for this detector
703 //
f665c1ea 704 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
a897a37a 705 if ((*fDchambers)[i]) ((TClonesArray*)(*fDchambers)[i])->Clear();
fe4da5cc 706 if (fNdch) fNdch[i]=0;
707 }
708}
a897a37a 709//____________________________________________
710void AliMUON::ResetRawClusters()
711{
712 //
713 // Reset number of raw clusters and the raw clust array for this detector
714 //
f665c1ea 715 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
a897a37a 716 if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
717 if (fNrawch) fNrawch[i]=0;
718 }
719}
a9e2aefa 720
a897a37a 721//____________________________________________
a9e2aefa 722void AliMUON::ResetTrigger()
a897a37a 723{
a9e2aefa 724 // Reset Local and Global Trigger
725 fNGlobalTrigger = 0;
726 if (fGlobalTrigger) fGlobalTrigger->Clear();
727 fNLocalTrigger = 0;
728 if (fLocalTrigger) fLocalTrigger->Clear();
729}
730
731//____________________________________________
732void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2)
733{
734 Int_t i=2*(id-1);
735 ((AliMUONChamber*) (*fChambers)[i]) ->SetPadSize(isec,p1,p2);
736 ((AliMUONChamber*) (*fChambers)[i+1])->SetPadSize(isec,p1,p2);
a897a37a 737}
738
fe4da5cc 739//___________________________________________
a9e2aefa 740void AliMUON::SetChambersZ(const Float_t *Z)
741{
742 // Set Z values for all chambers (tracking and trigger)
743 // from the array pointed to by "Z"
f665c1ea 744 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
745 ((AliMUONChamber*) ((*fChambers)[ch]))->SetZ(Z[ch]);
746 return;
a9e2aefa 747}
fe4da5cc 748
a9e2aefa 749//___________________________________________
750void AliMUON::SetChambersZToDefault()
fe4da5cc 751{
a9e2aefa 752 // Set Z values for all chambers (tracking and trigger)
753 // to default values
f665c1ea 754 SetChambersZ(AliMUONConstants::DefaultChamberZ());
a9e2aefa 755 return;
fe4da5cc 756}
757
758//___________________________________________
a897a37a 759void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
fe4da5cc 760{
761 Int_t i=2*(id-1);
a9e2aefa 762 ((AliMUONChamber*) (*fChambers)[i])->SetChargeSlope(p1);
763 ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSlope(p1);
fe4da5cc 764}
765
766//___________________________________________
a897a37a 767void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
fe4da5cc 768{
769 Int_t i=2*(id-1);
a9e2aefa 770 ((AliMUONChamber*) (*fChambers)[i])->SetChargeSpread(p1,p2);
771 ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSpread(p1,p2);
fe4da5cc 772}
773
774//___________________________________________
a897a37a 775void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
fe4da5cc 776{
777 Int_t i=2*(id-1);
a9e2aefa 778 ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
779 ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
fe4da5cc 780}
781
782//___________________________________________
d09fafb0 783void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
fe4da5cc 784{
785 Int_t i=2*(id-1);
a9e2aefa 786 ((AliMUONChamber*) (*fChambers)[i])->SetMaxAdc(p1);
787 ((AliMUONChamber*) (*fChambers)[i+1])->SetMaxAdc(p1);
fe4da5cc 788}
789
790//___________________________________________
a897a37a 791void AliMUON::SetMaxStepGas(Float_t p1)
fe4da5cc 792{
793 fMaxStepGas=p1;
794}
795
796//___________________________________________
a897a37a 797void AliMUON::SetMaxStepAlu(Float_t p1)
fe4da5cc 798{
799 fMaxStepAlu=p1;
800}
801
802//___________________________________________
a897a37a 803void AliMUON::SetMaxDestepGas(Float_t p1)
fe4da5cc 804{
805 fMaxDestepGas=p1;
806}
807
808//___________________________________________
a897a37a 809void AliMUON::SetMaxDestepAlu(Float_t p1)
fe4da5cc 810{
811 fMaxDestepAlu=p1;
812}
813//___________________________________________
5c1f55c5 814void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
fe4da5cc 815{
816 fAccCut=acc;
5c1f55c5 817 fAccMin=angmin*TMath::Pi()/180;
818 fAccMax=angmax*TMath::Pi()/180;
819 Int_t ch;
820 if (acc) {
821 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
822 // Loop over 2 chambers in the station
823 for (Int_t stCH = 0; stCH < 2; stCH++) {
824 ch = 2 * st + stCH;
825// Set chamber inner and outer radius according to acceptance cuts
826 Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin));
827 Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax));
828 } // chamber loop
829 } // station loop
830 }
fe4da5cc 831}
832//___________________________________________
a30a000f 833void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
fe4da5cc 834{
a9e2aefa 835 ((AliMUONChamber*) (*fChambers)[id])->SetSegmentationModel(isec, segmentation);
fe4da5cc 836
837}
838//___________________________________________
a9e2aefa 839void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
fe4da5cc 840{
a9e2aefa 841 ((AliMUONChamber*) (*fChambers)[id])->SetResponseModel(response);
fe4da5cc 842}
843
30aaba74 844void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
a897a37a 845{
a9e2aefa 846 ((AliMUONChamber*) (*fChambers)[id])->SetReconstructionModel(reconst);
a897a37a 847}
848
fe4da5cc 849void AliMUON::SetNsec(Int_t id, Int_t nsec)
850{
a9e2aefa 851 ((AliMUONChamber*) (*fChambers)[id])->SetNsec(nsec);
fe4da5cc 852}
853
854
855//___________________________________________
856
a897a37a 857
a9e2aefa 858
802a864d 859void AliMUON::MakePadHits(Float_t xhit,Float_t yhit, Float_t zhit,
a9e2aefa 860 Float_t eloss, Float_t tof, Int_t idvol)
fe4da5cc 861{
862//
a897a37a 863// Calls the charge disintegration method of the current chamber and adds
864// the simulated cluster to the root treee
fe4da5cc 865//
a897a37a 866 Int_t clhits[7];
867 Float_t newclust[6][500];
868 Int_t nnew;
869
870
fe4da5cc 871//
a897a37a 872// Integrated pulse height on chamber
873
874
875 clhits[0]=fNhits+1;
fe4da5cc 876//
a897a37a 877//
a9e2aefa 878 ((AliMUONChamber*) (*fChambers)[idvol])
802a864d 879 ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust);
a897a37a 880 Int_t ic=0;
881
882//
883// Add new clusters
884 for (Int_t i=0; i<nnew; i++) {
885 if (Int_t(newclust[3][i]) > 0) {
886 ic++;
887// Cathode plane
888 clhits[1] = Int_t(newclust[5][i]);
889// Cluster Charge
890 clhits[2] = Int_t(newclust[0][i]);
891// Pad: ix
892 clhits[3] = Int_t(newclust[1][i]);
893// Pad: iy
894 clhits[4] = Int_t(newclust[2][i]);
895// Pad: charge
896 clhits[5] = Int_t(newclust[3][i]);
897// Pad: chamber sector
898 clhits[6] = Int_t(newclust[4][i]);
899
a9e2aefa 900 AddPadHit(clhits);
a897a37a 901 }
902 }
a897a37a 903}
904
a9e2aefa 905//----------------------------------------------------------------------
906
907void AliMUON::Digitise(Int_t nev,Int_t bgrEvent,Option_t *option,Option_t *opt,Text_t *filename)
a897a37a 908{
909 // keep galice.root for signal and name differently the file for
910 // background when add! otherwise the track info for signal will be lost !
911
a6f39961 912 static Bool_t first=kTRUE;
a9e2aefa 913 static TFile *file;
914 char *addBackground = strstr(option,"Add");
a897a37a 915
f665c1ea 916
a30a000f 917 AliMUONChamber* iChamber;
918 AliSegmentation* segmentation;
a897a37a 919
920
921 Int_t trk[50];
922 Int_t chtrk[50];
923 TObjArray *list=new TObjArray;
a9e2aefa 924 static TClonesArray *pAddress=0;
925 if(!pAddress) pAddress=new TClonesArray("TVector",1000);
a897a37a 926 Int_t digits[5];
927
a9e2aefa 928 AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON");
a30a000f 929 AliHitMap** hitMap= new AliHitMap* [AliMUONConstants::NCh()];
f665c1ea 930 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {hitMap[i]=0;}
a9e2aefa 931 if (addBackground ) {
a897a37a 932 if(first) {
933 fFileName=filename;
934 cout<<"filename"<<fFileName<<endl;
a9e2aefa 935 file=new TFile(fFileName);
a897a37a 936 cout<<"I have opened "<<fFileName<<" file "<<endl;
a9e2aefa 937 fHits2 = new TClonesArray("AliMUONHit",1000 );
938 fPadHits2 = new TClonesArray("AliMUONPadHit",10000);
a897a37a 939 }
a6f39961 940 first=kFALSE;
a9e2aefa 941 file->cd();
942 //file->ls();
a897a37a 943 // Get Hits Tree header from file
944 if(fHits2) fHits2->Clear();
a9e2aefa 945 if(fPadHits2) fPadHits2->Clear();
946 if(fTrH1) delete fTrH1;
947 fTrH1=0;
a897a37a 948
949 char treeName[20];
a9e2aefa 950 sprintf(treeName,"TreeH%d",bgrEvent);
951 fTrH1 = (TTree*)gDirectory->Get(treeName);
952 //printf("fTrH1 %p of treename %s for event %d \n",fTrH1,treeName,bgrEvent);
a897a37a 953
a9e2aefa 954 if (!fTrH1) {
955 printf("ERROR: cannot find Hits Tree for event:%d\n",bgrEvent);
a897a37a 956 }
957 // Set branch addresses
958 TBranch *branch;
959 char branchname[20];
960 sprintf(branchname,"%s",GetName());
a9e2aefa 961 if (fTrH1 && fHits2) {
962 branch = fTrH1->GetBranch(branchname);
a897a37a 963 if (branch) branch->SetAddress(&fHits2);
964 }
a9e2aefa 965 if (fTrH1 && fPadHits2) {
966 branch = fTrH1->GetBranch("MUONCluster");
967 if (branch) branch->SetAddress(&fPadHits2);
a897a37a 968 }
969// test
a9e2aefa 970 //Int_t ntracks1 =(Int_t)fTrH1->GetEntries();
a897a37a 971 //printf("background - ntracks1 - %d\n",ntracks1);
972 }
973 //
974 // loop over cathodes
975 //
a30a000f 976 AliHitMap* hm;
a897a37a 977 Int_t countadr=0;
978 for (int icat=0; icat<2; icat++) {
a897a37a 979 Int_t counter=0;
d09fafb0 980 Int_t * nmuon = new Int_t [AliMUONConstants::NCh()];
f665c1ea 981 for (Int_t i =0; i<AliMUONConstants::NCh(); i++) {
a9e2aefa 982 iChamber=(AliMUONChamber*) (*fChambers)[i];
a897a37a 983 if (iChamber->Nsec()==1 && icat==1) {
fe4da5cc 984 continue;
a897a37a 985 } else {
a9e2aefa 986 segmentation=iChamber->SegmentationModel(icat+1);
fe4da5cc 987 }
a9e2aefa 988 hitMap[i] = new AliMUONHitMapA1(segmentation, list);
f665c1ea 989 nmuon[i]=0;
a897a37a 990 }
991 //printf("Start loop over tracks \n");
992//
993// Loop over tracks
994//
995
a9e2aefa 996 TTree *treeH = gAlice->TreeH();
997 Int_t ntracks =(Int_t) treeH->GetEntries();
d09fafb0 998 Int_t jj;
6b18d06a 999
1000 Float_t ** xhit = new Float_t * [AliMUONConstants::NCh()];
1001 for (jj=0; jj<AliMUONConstants::NCh(); jj++) xhit[jj] = new Float_t[2];
45085cb9 1002 Float_t ** yhit = new Float_t * [AliMUONConstants::NCh()];
6b18d06a 1003 for (jj=0; jj<AliMUONConstants::NCh(); jj++) yhit[jj] = new Float_t[2];
1004
a897a37a 1005 for (Int_t track=0; track<ntracks; track++) {
1006 gAlice->ResetHits();
a9e2aefa 1007 treeH->GetEvent(track);
a897a37a 1008//
1009// Loop over hits
a9e2aefa 1010 for(AliMUONHit* mHit=(AliMUONHit*)pMUON->FirstHit(-1);
a897a37a 1011 mHit;
a9e2aefa 1012 mHit=(AliMUONHit*)pMUON->NextHit())
a897a37a 1013 {
1014 Int_t nch = mHit->fChamber-1; // chamber number
f665c1ea 1015 if (nch > AliMUONConstants::NCh()-1) continue;
a9e2aefa 1016 iChamber = &(pMUON->Chamber(nch));
a897a37a 1017 // new 17.07.99
a9e2aefa 1018 if (addBackground) {
1019
1020 if (mHit->fParticle == kMuonPlus
1021 || mHit->fParticle == kMuonMinus) {
1022 xhit[nch][nmuon[nch]]=mHit->fX;
1023 yhit[nch][nmuon[nch]]=mHit->fY;
1024 nmuon[nch]++;
1025 if (nmuon[nch] >2) printf("nmuon %d\n",nmuon[nch]);
1026 }
fe4da5cc 1027 }
a9e2aefa 1028
a897a37a 1029
1030
1031
1032//
1033// Loop over pad hits
a9e2aefa 1034 for (AliMUONPadHit* mPad=
1035 (AliMUONPadHit*)pMUON->FirstPad(mHit,fPadHits);
a897a37a 1036 mPad;
a9e2aefa 1037 mPad=(AliMUONPadHit*)pMUON->NextPad(fPadHits))
a897a37a 1038 {
1039 Int_t cathode = mPad->fCathode; // cathode number
1040 Int_t ipx = mPad->fPadX; // pad number on X
1041 Int_t ipy = mPad->fPadY; // pad number on Y
a9e2aefa 1042 Int_t iqpad = Int_t(mPad->fQpad);// charge per pad
a897a37a 1043//
1044//
1045
1046 if (cathode != (icat+1)) continue;
1047 // fill the info array
802a864d 1048 Float_t thex, they, thez;
a9e2aefa 1049 segmentation=iChamber->SegmentationModel(cathode);
a30a000f 1050 segmentation->GetPadC(ipx,ipy,thex,they,thez);
a9e2aefa 1051// Float_t rpad=TMath::Sqrt(thex*thex+they*they);
1052// if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
a897a37a 1053
a9e2aefa 1054 new((*pAddress)[countadr++]) TVector(2);
1055 TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
a897a37a 1056 trinfo(0)=(Float_t)track;
1057 trinfo(1)=(Float_t)iqpad;
1058
1059 digits[0]=ipx;
1060 digits[1]=ipy;
1061 digits[2]=iqpad;
1062 digits[3]=iqpad;
a9e2aefa 1063 if (mHit->fParticle == kMuonPlus ||
1064 mHit->fParticle == kMuonMinus) {
1065 digits[4]=mPad->fHitNumber;
a897a37a 1066 } else digits[4]=-1;
1067
a9e2aefa 1068 AliMUONTransientDigit* pdigit;
a897a37a 1069 // build the list of fired pads and update the info
a9e2aefa 1070 if (!hitMap[nch]->TestHit(ipx, ipy)) {
a897a37a 1071
1072 list->AddAtAndExpand(
a9e2aefa 1073 new AliMUONTransientDigit(nch,digits),counter);
a897a37a 1074
a9e2aefa 1075 hitMap[nch]->SetHit(ipx, ipy, counter);
a897a37a 1076 counter++;
a9e2aefa 1077 pdigit=(AliMUONTransientDigit*)list->At(list->GetLast());
a897a37a 1078 // list of tracks
1079 TObjArray *trlist=(TObjArray*)pdigit->TrackList();
1080 trlist->Add(&trinfo);
1081 } else {
a9e2aefa 1082 pdigit=(AliMUONTransientDigit*) hitMap[nch]->GetHit(ipx, ipy);
a897a37a 1083 // update charge
1084 (*pdigit).fSignal+=iqpad;
1085 (*pdigit).fPhysics+=iqpad;
1086 // update list of tracks
1087 TObjArray* trlist=(TObjArray*)pdigit->TrackList();
a9e2aefa 1088 Int_t lastEntry=trlist->GetLast();
1089 TVector *pTrack=(TVector*)trlist->At(lastEntry);
1090 TVector &ptrk=*pTrack;
1091 Int_t lastTrack=Int_t(ptrk(0));
1092 Int_t lastCharge=Int_t(ptrk(1));
1093 if (lastTrack==track) {
1094 lastCharge+=iqpad;
1095 trlist->RemoveAt(lastEntry);
1096 trinfo(0)=lastTrack;
1097 trinfo(1)=lastCharge;
1098 trlist->AddAt(&trinfo,lastEntry);
a897a37a 1099 } else {
1100 trlist->Add(&trinfo);
1101 }
1102 // check the track list
1103 Int_t nptracks=trlist->GetEntriesFast();
1104 if (nptracks > 2) {
1105 for (Int_t tr=0;tr<nptracks;tr++) {
a9e2aefa 1106 TVector *ppTrack=(TVector*)trlist->At(tr);
1107 TVector &pptrk=*ppTrack;
a897a37a 1108 trk[tr]=Int_t(pptrk(0));
1109 chtrk[tr]=Int_t(pptrk(1));
1110 }
1111 } // end if nptracks
1112 } // end if pdigit
1113 } //end loop over clusters
1114 } // hit loop
1115 } // track loop
a897a37a 1116
1117 // open the file with background
1118
a9e2aefa 1119 if (addBackground) {
1120 ntracks =(Int_t)fTrH1->GetEntries();
a897a37a 1121//
1122// Loop over tracks
1123//
1124 for (Int_t track=0; track<ntracks; track++) {
1125
1126 if (fHits2) fHits2->Clear();
a9e2aefa 1127 if (fPadHits2) fPadHits2->Clear();
a897a37a 1128
a9e2aefa 1129 fTrH1->GetEvent(track);
a897a37a 1130//
1131// Loop over hits
a9e2aefa 1132 AliMUONHit* mHit;
a897a37a 1133 for(int i=0;i<fHits2->GetEntriesFast();++i)
a9e2aefa 1134 {
1135 mHit=(AliMUONHit*) (*fHits2)[i];
a897a37a 1136 Int_t nch = mHit->fChamber-1; // chamber number
1137 if (nch >9) continue;
a9e2aefa 1138 iChamber = &(pMUON->Chamber(nch));
a897a37a 1139 Int_t rmin = (Int_t)iChamber->RInner();
1140 Int_t rmax = (Int_t)iChamber->ROuter();
1141 Float_t xbgr=mHit->fX;
1142 Float_t ybgr=mHit->fY;
a6f39961 1143 Bool_t cond=kFALSE;
a897a37a 1144
1145 for (Int_t imuon =0; imuon < nmuon[nch]; imuon++) {
1146 Float_t dist= (xbgr-xhit[nch][imuon])*(xbgr-xhit[nch][imuon])
1147 +(ybgr-yhit[nch][imuon])*(ybgr-yhit[nch][imuon]);
a6f39961 1148 if (dist<100) cond=kTRUE;
a897a37a 1149 }
1150 if (!cond) continue;
1151
1152//
1153// Loop over pad hits
a9e2aefa 1154 for (AliMUONPadHit* mPad=
1155 (AliMUONPadHit*)pMUON->FirstPad(mHit,fPadHits2);
a897a37a 1156 mPad;
a9e2aefa 1157 mPad=(AliMUONPadHit*)pMUON->NextPad(fPadHits2))
a897a37a 1158 {
a9e2aefa 1159 // mPad = (AliMUONPadHit*) (*fPadHits2)[j];
a897a37a 1160 Int_t cathode = mPad->fCathode; // cathode number
1161 Int_t ipx = mPad->fPadX; // pad number on X
1162 Int_t ipy = mPad->fPadY; // pad number on Y
a9e2aefa 1163 Int_t iqpad = Int_t(mPad->fQpad);// charge per pad
a897a37a 1164
1165 if (cathode != (icat+1)) continue;
802a864d 1166 Float_t thex, they, thez;
a9e2aefa 1167 segmentation=iChamber->SegmentationModel(cathode);
a30a000f 1168 segmentation->GetPadC(ipx,ipy,thex,they,thez);
a897a37a 1169 Float_t rpad=TMath::Sqrt(thex*thex+they*they);
1170 if (rpad < rmin || iqpad ==0 || rpad > rmax) continue;
a9e2aefa 1171 new((*pAddress)[countadr++]) TVector(2);
1172 TVector &trinfo=*((TVector*) (*pAddress)[countadr-1]);
1173 trinfo(0)=-1; // tag background
1174 trinfo(1)=-1;
1175
a897a37a 1176 digits[0]=ipx;
1177 digits[1]=ipy;
1178 digits[2]=iqpad;
1179 digits[3]=0;
1180 digits[4]=-1;
a897a37a 1181
a9e2aefa 1182 AliMUONTransientDigit* pdigit;
1183 // build the list of fired pads and update the info
1184 if (!hitMap[nch]->TestHit(ipx, ipy)) {
1185 list->AddAtAndExpand(new AliMUONTransientDigit(nch,digits),counter);
1186
1187 hitMap[nch]->SetHit(ipx, ipy, counter);
a897a37a 1188 counter++;
1189
a9e2aefa 1190 pdigit=(AliMUONTransientDigit*)list->At(list->GetLast());
a897a37a 1191 // list of tracks
a9e2aefa 1192 TObjArray *trlist=(TObjArray*)pdigit->
1193 TrackList();
1194 trlist->Add(&trinfo);
a897a37a 1195 } else {
a9e2aefa 1196 pdigit=(AliMUONTransientDigit*) hitMap[nch]->GetHit(ipx, ipy);
a897a37a 1197 // update charge
1198 (*pdigit).fSignal+=iqpad;
a9e2aefa 1199
a897a37a 1200 // update list of tracks
a9e2aefa 1201 TObjArray* trlist=(TObjArray*)pdigit->
1202 TrackList();
1203 Int_t lastEntry=trlist->GetLast();
1204 TVector *pTrack=(TVector*)trlist->
1205 At(lastEntry);
1206 TVector &ptrk=*pTrack;
1207 Int_t lastTrack=Int_t(ptrk(0));
1208 if (lastTrack==-1) {
1209 continue;
1210 } else {
1211 trlist->Add(&trinfo);
1212 }
a897a37a 1213 // check the track list
a9e2aefa 1214 Int_t nptracks=trlist->GetEntriesFast();
1215 if (nptracks > 0) {
1216 for (Int_t tr=0;tr<nptracks;tr++) {
1217 TVector *ppTrack=(TVector*)trlist->At(tr);
1218 TVector &pptrk=*ppTrack;
1219 trk[tr]=Int_t(pptrk(0));
1220 chtrk[tr]=Int_t(pptrk(1));
1221 }
1222 } // end if nptracks
a897a37a 1223 } // end if pdigit
1224 } //end loop over clusters
1225 } // hit loop
1226 } // track loop
1227 //Int_t nentr2=list->GetEntriesFast();
1228 //printf(" \n counter2, nentr2 %d %d \n",counter,nentr2);
1229 TTree *fAli=gAlice->TreeK();
a9e2aefa 1230 TFile *file=NULL;
a897a37a 1231
1232 if (fAli) file =fAli->GetCurrentFile();
1233 file->cd();
d09fafb0 1234 } // if addBackground
1235 delete [] xhit;
1236 delete [] yhit;
1237
a897a37a 1238 Int_t tracks[10];
1239 Int_t charges[10];
a897a37a 1240 Int_t nentries=list->GetEntriesFast();
a897a37a 1241
1242 for (Int_t nent=0;nent<nentries;nent++) {
a9e2aefa 1243 AliMUONTransientDigit *address=(AliMUONTransientDigit*)list->At(nent);
a897a37a 1244 if (address==0) continue;
1245 Int_t ich=address->fChamber;
1246 Int_t q=address->fSignal;
a9e2aefa 1247 iChamber=(AliMUONChamber*) (*fChambers)[ich];
1248//
1249// Digit Response (noise, threshold, saturation, ...)
1250// if (address->fPhysics !=0 ) address->fPhysics+=(Int_t)Noise;
1251 AliMUONResponse * response=iChamber->ResponseModel();
1252 q=response->DigitResponse(q);
1253
1254 if (!q) continue;
1255
a897a37a 1256 digits[0]=address->fPadX;
1257 digits[1]=address->fPadY;
1258 digits[2]=q;
1259 digits[3]=address->fPhysics;
1260 digits[4]=address->fHit;
a897a37a 1261
1262 TObjArray* trlist=(TObjArray*)address->TrackList();
1263 Int_t nptracks=trlist->GetEntriesFast();
1264 //printf("nptracks, trlist %d %p\n",nptracks,trlist);
1265
a9e2aefa 1266 // this was changed to accomodate the real number of tracks
1267 if (nptracks > 10) {
1268 cout<<"Attention - nptracks > 10 "<<nptracks<<endl;
1269 nptracks=10;
1270 }
1271 if (nptracks > 2) {
1272 printf("Attention - nptracks > 2 %d \n",nptracks);
1273 printf("cat,ich,ix,iy,q %d %d %d %d %d \n",icat,ich,digits[0],digits[1],q);
1274 }
1275 for (Int_t tr=0;tr<nptracks;tr++) {
1276 TVector *ppP=(TVector*)trlist->At(tr);
1277 if(!ppP ) printf("ppP - %p\n",ppP);
1278 TVector &pp =*ppP;
1279 tracks[tr]=Int_t(pp(0));
1280 charges[tr]=Int_t(pp(1));
a897a37a 1281 //printf("tracks, charges - %d %d\n",tracks[tr],charges[tr]);
a9e2aefa 1282 } //end loop over list of tracks for one pad
a897a37a 1283 // Sort list of tracks according to charge
a9e2aefa 1284 if (nptracks > 1) {
1285 SortTracks(tracks,charges,nptracks);
1286 }
1287 if (nptracks < 10 ) {
1288 for (Int_t i=nptracks; i<10; i++) {
1289 tracks[i]=0;
1290 charges[i]=0;
a897a37a 1291 }
a9e2aefa 1292 }
1293
a897a37a 1294 // fill digits
a9e2aefa 1295 pMUON->AddDigits(ich,tracks,charges,digits);
1296 // delete trlist;
a897a37a 1297 }
1298 //cout<<"I'm out of the loops for digitisation"<<endl;
a9e2aefa 1299 // gAlice->GetEvent(nev);
a897a37a 1300 gAlice->TreeD()->Fill();
a9e2aefa 1301 pMUON->ResetDigits();
a897a37a 1302 list->Delete();
d09fafb0 1303
a9e2aefa 1304
f665c1ea 1305 for(Int_t ii=0;ii<AliMUONConstants::NCh();++ii) {
a9e2aefa 1306 if (hitMap[ii]) {
1307 hm=hitMap[ii];
a897a37a 1308 delete hm;
a9e2aefa 1309 hitMap[ii]=0;
fe4da5cc 1310 }
a897a37a 1311 }
d09fafb0 1312 delete [] nmuon;
a897a37a 1313 } //end loop over cathodes
d09fafb0 1314 delete [] hitMap;
a9e2aefa 1315 char hname[30];
1316 sprintf(hname,"TreeD%d",nev);
1317 gAlice->TreeD()->Write(hname);
1318 // reset tree
1319 gAlice->TreeD()->Reset();
1320 delete list;
1321
1322 pAddress->Delete();
1323 // gObjectTable->Print();
a897a37a 1324}
1325
1326void AliMUON::SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr)
1327{
1328 //
1329 // Sort the list of tracks contributing to a given digit
1330 // Only the 3 most significant tracks are acctually sorted
1331 //
1332
1333 //
1334 // Loop over signals, only 3 times
1335 //
1336
1337 Int_t qmax;
1338 Int_t jmax;
1339 Int_t idx[3] = {-2,-2,-2};
1340 Int_t jch[3] = {-2,-2,-2};
1341 Int_t jtr[3] = {-2,-2,-2};
1342 Int_t i,j,imax;
1343
1344 if (ntr<3) imax=ntr;
1345 else imax=3;
1346 for(i=0;i<imax;i++){
1347 qmax=0;
1348 jmax=0;
1349
1350 for(j=0;j<ntr;j++){
1351
1352 if((i == 1 && j == idx[i-1])
1353 ||(i == 2 && (j == idx[i-1] || j == idx[i-2]))) continue;
1354
1355 if(charges[j] > qmax) {
1356 qmax = charges[j];
1357 jmax=j;
1358 }
1359 }
1360
1361 if(qmax > 0) {
1362 idx[i]=jmax;
1363 jch[i]=charges[jmax];
1364 jtr[i]=tracks[jmax];
1365 }
1366
1367 }
1368
1369 for(i=0;i<3;i++){
1370 if (jtr[i] == -2) {
1371 charges[i]=0;
1372 tracks[i]=0;
1373 } else {
1374 charges[i]=jch[i];
1375 tracks[i]=jtr[i];
1376 }
1377 }
1378
fe4da5cc 1379}
1380
a9e2aefa 1381//___________________________________________
1382void AliMUON::Trigger(Int_t nev){
1383// call the Trigger Algorithm and fill TreeR
1384
1385 Int_t singlePlus[3] = {0,0,0};
1386 Int_t singleMinus[3] = {0,0,0};
1387 Int_t singleUndef[3] = {0,0,0};
1388 Int_t pairUnlike[3] = {0,0,0};
1389 Int_t pairLike[3] = {0,0,0};
1390
1391 ResetTrigger();
a9e2aefa 1392 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
1393 decision->Trigger();
1394 decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef,
1395 pairUnlike, pairLike);
1396// add a local trigger in the list
1397 AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
9ae15266 1398 Int_t i;
a9e2aefa 1399
f665c1ea 1400 for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) {
9ae15266 1401 if(decision->GetITrigger(icirc)==1) {
1402 Int_t localtr[7]={0,0,0,0,0,0,0};
1403 Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0};
1404 decision->GetLutOutput(icirc, loLpt, loHpt, loApt);
1405 localtr[0] = icirc;
1406 localtr[1] = decision->GetStripX11(icirc);
1407 localtr[2] = decision->GetDev(icirc);
1408 localtr[3] = decision->GetStripY11(icirc);
1409 for (i=0; i<2; i++) { // convert the Lut output in 1 digit
1410 localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i));
1411 localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i));
1412 localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i));
1413 }
1414 AddLocalTrigger(localtr); // add a local trigger in the list
a897a37a 1415 }
a9e2aefa 1416 }
1417 delete decision;
a897a37a 1418
a9e2aefa 1419 gAlice->TreeR()->Fill();
1420 ResetTrigger();
a897a37a 1421 char hname[30];
1422 sprintf(hname,"TreeR%d",nev);
1423 gAlice->TreeR()->Write(hname);
1424 gAlice->TreeR()->Reset();
a9e2aefa 1425 printf("\n End of trigger for event %d", nev);
a897a37a 1426}
a897a37a 1427
a897a37a 1428
a9e2aefa 1429//____________________________________________
1430void AliMUON::FindClusters(Int_t nev,Int_t lastEntry)
1431{
1432 TClonesArray *dig1, *dig2;
1433 Int_t ndig, k;
1434 dig1 = new TClonesArray("AliMUONDigit",1000);
1435 dig2 = new TClonesArray("AliMUONDigit",1000);
1436 AliMUONDigit *digit;
a897a37a 1437//
a9e2aefa 1438// Loop on chambers and on cathode planes
a897a37a 1439//
a897a37a 1440
a9e2aefa 1441 for (Int_t ich=0;ich<10;ich++) {
1442 AliMUONChamber* iChamber=(AliMUONChamber*) (*fChambers)[ich];
30aaba74 1443 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
a9e2aefa 1444 gAlice->ResetDigits();
1445 gAlice->TreeD()->GetEvent(lastEntry);
1446 TClonesArray *muonDigits = this->DigitsAddress(ich);
1447 ndig=muonDigits->GetEntriesFast();
1448 printf("\n 1 Found %d digits in %p %d", ndig, muonDigits,ich);
1449 TClonesArray &lhits1 = *dig1;
1450 Int_t n=0;
1451 for (k=0; k<ndig; k++) {
1452 digit=(AliMUONDigit*) muonDigits->UncheckedAt(k);
1453 if (rec->TestTrack(digit->fTracks[0]))
1454 new(lhits1[n++]) AliMUONDigit(*digit);
1455 }
1456 gAlice->ResetDigits();
1457 gAlice->TreeD()->GetEvent(lastEntry+1);
1458 muonDigits = this->DigitsAddress(ich);
1459 ndig=muonDigits->GetEntriesFast();
1460 printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich);
1461 TClonesArray &lhits2 = *dig2;
1462 n=0;
1463
1464 for (k=0; k<ndig; k++) {
1465 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
1466 if (rec->TestTrack(digit->fTracks[0]))
1467 new(lhits2[n++]) AliMUONDigit(*digit);
a897a37a 1468 }
a897a37a 1469
9825400f 1470 if (rec) {
1471 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
a9e2aefa 1472 rec->FindRawClusters();
1473 }
1474 dig1->Delete();
1475 dig2->Delete();
1476 } // for ich
1477 gAlice->TreeR()->Fill();
1478 ResetRawClusters();
1479 char hname[30];
1480 sprintf(hname,"TreeR%d",nev);
1481 gAlice->TreeR()->Write(hname);
1482 gAlice->TreeR()->Reset();
1483 printf("\n End of cluster finding for event %d", nev);
1484
1485 delete dig1;
1486 delete dig2;
1487 //gObjectTable->Print();
a897a37a 1488}
a9e2aefa 1489
a897a37a 1490
fe4da5cc 1491void AliMUON::Streamer(TBuffer &R__b)
1492{
1493 // Stream an object of class AliMUON.
a30a000f 1494 AliMUONChamber *iChamber;
a9e2aefa 1495 AliMUONTriggerCircuit *iTriggerCircuit;
a30a000f 1496 AliSegmentation *segmentation;
1497 AliMUONResponse *response;
1498 TClonesArray *digitsaddress;
1499 TClonesArray *rawcladdress;
9ae15266 1500 Int_t i;
9ae15266 1501 if (R__b.IsReading()) {
1502 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
1503 AliDetector::Streamer(R__b);
1504 R__b >> fNPadHits;
1505 R__b >> fPadHits; // diff
1506 R__b >> fNLocalTrigger;
1507 R__b >> fLocalTrigger;
1508 R__b >> fNGlobalTrigger;
1509 R__b >> fGlobalTrigger;
1510 R__b >> fDchambers;
1511 R__b >> fRawClusters;
1512 R__b.ReadArray(fNdch);
1513 R__b.ReadArray(fNrawch);
1514 R__b >> fAccCut;
1515 R__b >> fAccMin;
1516 R__b >> fAccMax;
1517 R__b >> fChambers;
1518 R__b >> fTriggerCircuits;
f665c1ea 1519 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 1520 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
1521 iTriggerCircuit->Streamer(R__b);
fe4da5cc 1522 }
9ae15266 1523// Stream chamber related information
f665c1ea 1524 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 1525 iChamber=(AliMUONChamber*) (*fChambers)[i];
1526 iChamber->Streamer(R__b);
1527 if (iChamber->Nsec()==1) {
1528 segmentation=iChamber->SegmentationModel(1);
1529 if (segmentation)
1530 segmentation->Streamer(R__b);
1531 } else {
1532 segmentation=iChamber->SegmentationModel(1);
1533 if (segmentation)
1534 segmentation->Streamer(R__b);
1535 if (segmentation)
1536 segmentation=iChamber->SegmentationModel(2);
1537 segmentation->Streamer(R__b);
1538 }
1539 response=iChamber->ResponseModel();
1540 if (response)
1541 response->Streamer(R__b);
1542 digitsaddress=(TClonesArray*) (*fDchambers)[i];
1543 digitsaddress->Streamer(R__b);
f665c1ea 1544 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 1545 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
1546 rawcladdress->Streamer(R__b);
1547 }
a9e2aefa 1548 }
9ae15266 1549
1550 } else {
1551 R__b.WriteVersion(AliMUON::IsA());
1552 AliDetector::Streamer(R__b);
1553 R__b << fNPadHits;
1554 R__b << fPadHits; // diff
1555 R__b << fNLocalTrigger;
1556 R__b << fLocalTrigger;
1557 R__b << fNGlobalTrigger;
1558 R__b << fGlobalTrigger;
1559 R__b << fDchambers;
1560 R__b << fRawClusters;
f665c1ea 1561 R__b.WriteArray(fNdch, AliMUONConstants::NCh());
1562 R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh());
9ae15266 1563
1564 R__b << fAccCut;
1565 R__b << fAccMin;
1566 R__b << fAccMax;
1567
1568 R__b << fChambers;
1569 R__b << fTriggerCircuits;
f665c1ea 1570 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 1571 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
1572 iTriggerCircuit->Streamer(R__b);
fe4da5cc 1573 }
f665c1ea 1574 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 1575 iChamber=(AliMUONChamber*) (*fChambers)[i];
1576 iChamber->Streamer(R__b);
1577 if (iChamber->Nsec()==1) {
1578 segmentation=iChamber->SegmentationModel(1);
1579 if (segmentation)
1580 segmentation->Streamer(R__b);
1581 } else {
1582 segmentation=iChamber->SegmentationModel(1);
1583 if (segmentation)
1584 segmentation->Streamer(R__b);
1585 segmentation=iChamber->SegmentationModel(2);
1586 if (segmentation)
1587 segmentation->Streamer(R__b);
1588 }
1589 response=iChamber->ResponseModel();
1590 if (response)
1591 response->Streamer(R__b);
1592 digitsaddress=(TClonesArray*) (*fDchambers)[i];
1593 digitsaddress->Streamer(R__b);
f665c1ea 1594 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 1595 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
1596 rawcladdress->Streamer(R__b);
1597 }
a9e2aefa 1598 }
fe4da5cc 1599 }
fe4da5cc 1600}
a9e2aefa 1601AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters)
fe4da5cc 1602{
1603//
1604 // Initialise the pad iterator
1605 // Return the address of the first padhit for hit
a897a37a 1606 TClonesArray *theClusters = clusters;
fe4da5cc 1607 Int_t nclust = theClusters->GetEntriesFast();
1608 if (nclust && hit->fPHlast > 0) {
a9e2aefa 1609 AliMUON::fMaxIterPad=hit->fPHlast;
1610 AliMUON::fCurIterPad=hit->fPHfirst;
1611 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 1612 } else {
1613 return 0;
1614 }
1615}
1616
a9e2aefa 1617AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters)
fe4da5cc 1618{
a9e2aefa 1619 AliMUON::fCurIterPad++;
1620 if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
1621 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 1622 } else {
1623 return 0;
1624 }
1625}
1626
a897a37a 1627
1628AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
1629{
a9e2aefa 1630 TClonesArray *muonRawCluster = RawClustAddress(ichamber);
a897a37a 1631 ResetRawClusters();
a9e2aefa 1632 TTree *treeR = gAlice->TreeR();
1633 Int_t nent=(Int_t)treeR->GetEntries();
1634 treeR->GetEvent(nent-2+icathod-1);
1635 //treeR->GetEvent(icathod);
1636 //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
a897a37a 1637
a9e2aefa 1638 AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
a897a37a 1639 //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
1640
1641 return mRaw;
1642}
1643
a9e2aefa 1644AliMUON& AliMUON::operator = (const AliMUON& rhs)
a897a37a 1645{
a9e2aefa 1646// copy operator
1647// dummy version
1648 return *this;
a897a37a 1649}
1650
1651
1652
a897a37a 1653
1654
fe4da5cc 1655
fe4da5cc 1656
fe4da5cc 1657
fe4da5cc 1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668