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