STAGE_POOL and STAGE_HOST defined
[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$
fe311ef1 17Revision 1.47 2001/03/05 08:38:36 morsch
18Digitization related methods moved to AliMUONMerger.
19
1cae9436 20Revision 1.46 2001/01/26 21:34:59 morsch
21Use access functions for AliMUONHit, AliMUONDigit and AliMUONPadHit data members.
22
1bd28025 23Revision 1.45 2001/01/26 20:00:49 hristov
24Major upgrade of AliRoot code
25
2ab0c725 26Revision 1.44 2001/01/25 17:39:09 morsch
27Pass size of fNdch and fNrawch to CINT.
28
1bd26093 29Revision 1.43 2001/01/23 18:58:19 hristov
30Initialisation of some pointers
31
3f5cf0b3 32Revision 1.42 2001/01/17 20:53:40 hristov
33Destructors corrected to avoid memory leaks
34
c2c0190f 35Revision 1.41 2000/12/21 22:12:40 morsch
36Clean-up of coding rule violations,
37
de05461e 38Revision 1.40 2000/11/29 20:32:26 gosset
39Digitize:
401. correction for array index out of bounds
412. one printout commented
42
48030acd 43Revision 1.39 2000/11/12 17:17:03 pcrochet
44BuildGeometry of AliMUON for trigger chambers delegated to AliMUONSegmentationTriggerX (same strategy as for tracking chambers)
45
5fd73042 46Revision 1.38 2000/11/06 09:20:43 morsch
47AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
48Draw() method. This avoids code and parameter replication.
49
aaf4addd 50Revision 1.37 2000/10/26 09:53:37 pcrochet
51put back trigger chambers in the display (there was a problem in buildgeometry)
52
43b96d92 53Revision 1.36 2000/10/25 19:51:18 morsch
54Correct x-position of chambers.
55
6bc66d8f 56Revision 1.35 2000/10/24 19:46:21 morsch
57BuildGeometry updated for slats in station 3-4.
58
e4fa3d7e 59Revision 1.34 2000/10/18 11:42:06 morsch
60- AliMUONRawCluster contains z-position.
61- Some clean-up of useless print statements during initialisations.
62
3e1872ed 63Revision 1.33 2000/10/09 14:01:57 morsch
64Unused variables removed.
65
0234695f 66Revision 1.32 2000/10/06 09:08:10 morsch
67Built geometry includes slat geometry for event display.
68
7ab910ae 69Revision 1.31 2000/10/02 21:28:08 fca
70Removal of useless dependecies via forward declarations
71
94de3818 72Revision 1.30 2000/10/02 16:58:29 egangler
73Cleaning of the code :
74-> coding conventions
75-> void Streamers
76-> some useless includes removed or replaced by "class" statement
77
ecfa008b 78Revision 1.29 2000/07/28 13:49:38 morsch
79SetAcceptance defines inner and outer chamber radii according to angular acceptance.
80Can be used for simple acceptance studies.
81
5c1f55c5 82Revision 1.28 2000/07/22 16:43:15 morsch
83Same comment as before, but now done correctly I hope (sorry it's Saturday evening)
84
45085cb9 85Revision 1.27 2000/07/22 16:36:50 morsch
86Change order of indices in creation (new) of xhit and yhit
87
6b18d06a 88Revision 1.26 2000/07/03 11:54:57 morsch
89AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
90The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
91
a30a000f 92Revision 1.25 2000/06/29 12:34:09 morsch
93AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
94it usable with any other geometry class. The link to the object to which it belongs is
95established via an index. This assumes that there exists a global geometry manager
96from which the pointer to the parent object can be obtained (in our case gAlice).
97
d81db581 98Revision 1.24 2000/06/28 15:16:35 morsch
99(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
100to allow development of slat-muon chamber simulation and reconstruction code in the MUON
101framework. The changes should have no side effects (mostly dummy arguments).
102(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
103of chambers with overlapping modules (MakePadHits, Disintegration).
104
802a864d 105Revision 1.23 2000/06/28 12:19:17 morsch
106More consequent seperation of global input data services (AliMUONClusterInput singleton) and the
fe311ef1 107cluster and hit reconstruction algorithms in AliMUONClusterFindRawinderVS.
802a864d 108AliMUONClusterFinderVS becomes the base class for clustering and hit reconstruction.
109It requires two cathode planes. Small modifications in the code will make it usable for
110one cathode plane and, hence, more general (for test beam data).
111AliMUONClusterFinder is now obsolete.
112
30aaba74 113Revision 1.22 2000/06/28 08:06:10 morsch
114Avoid global variables in AliMUONClusterFinderVS by seperating the input data for the fit from the
115algorithmic part of the class. Input data resides inside the AliMUONClusterInput singleton.
116It also naturally takes care of the TMinuit instance.
117
9825400f 118Revision 1.21 2000/06/27 08:54:41 morsch
119Problems with on constant array sizes (in hitMap, nmuon, xhit, yhit) corrected.
120
d09fafb0 121Revision 1.20 2000/06/26 14:02:38 morsch
122Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
123
f665c1ea 124Revision 1.19 2000/06/22 13:40:51 morsch
125scope problem on HP, "i" declared once
126pow changed to TMath::Power (PH, AM)
127
9ae15266 128Revision 1.18 2000/06/15 07:58:48 morsch
129Code from MUON-dev joined
130
a9e2aefa 131Revision 1.14.4.17 2000/06/14 14:36:46 morsch
132- add TriggerCircuit (PC)
133- add GlobalTrigger and LocalTrigger and specific methods (PC)
134
135Revision 1.14.4.16 2000/06/09 21:20:28 morsch
136Most coding rule violations corrected
137
138Revision 1.14.4.15 2000/05/02 09:54:32 morsch
139RULE RN17 violations corrected
140
141Revision 1.14.4.12 2000/04/26 12:25:02 morsch
142Code revised by P. Crochet:
143- Z position of TriggerChamber changed according to A.Tournaire Priv.Comm.
144- ToF included in the method MakePadHits
145- inner radius of flange between beam shielding and trigger corrected
146- Trigger global volume updated (according to the new geometry)
147
148Revision 1.14.4.11 2000/04/19 19:42:08 morsch
149Some changes of variable names curing viols and methods concerning
150correlated clusters removed.
151
152Revision 1.14.4.10 2000/03/22 16:44:07 gosset
153Memory leak suppressed in function Digitise:
154p_adr->Delete() instead of Clear (I.Chevrot and A.Baldisseri)
155
156Revision 1.14.4.9 2000/03/20 18:15:25 morsch
157Positions of trigger chambers corrected (P.C.)
dbe37a89 158
a9e2aefa 159Revision 1.14.4.8 2000/02/21 15:38:01 morsch
160Call to AddHitList introduced to make this version compatible with head.
dffd31ef 161
a9e2aefa 162Revision 1.14.4.7 2000/02/20 07:45:53 morsch
163Bugs in Trigger part of BuildGeomemetry corrected (P.C)
1cedd08a 164
a9e2aefa 165Revision 1.14.4.6 2000/02/17 14:28:54 morsch
166Trigger included into initialization and digitization
6a935c13 167
a9e2aefa 168Revision 1.14.4.5 2000/02/15 10:02:58 morsch
169Log messages of previous revisions added
5d84196c 170
a9e2aefa 171Revision 1.14.4.2 2000/02/04 10:57:34 gosset
172Z position of the chambers:
173it was the Z position of the stations;
174it is now really the Z position of the chambers.
175 !!!! WARNING: THE CALLS TO "AliMUONChamber::SetZPOS"
176 !!!! AND "AliMUONChamber::ZPosition"
177 !!!! HAVE TO BE CHANGED TO "AliMUONChamber::"SetZ"
178 !!!! AND "AliMUONChamber::Z"
50f986db 179
a9e2aefa 180Revision 1.14.4.3 2000/02/04 16:19:04 gosset
181Correction for mis-spelling of NCH
0b34885d 182
a9e2aefa 183Revision 1.14.4.4 2000/02/15 09:43:38 morsch
184Log message added
2b86633d 185
4c039060 186*/
187
a9e2aefa 188
189///////////////////////////////////////////////
fe4da5cc 190// Manager and hits classes for set:MUON //
191////////////////////////////////////////////////
192
193#include <TTUBE.h>
a897a37a 194#include <TBRIK.h>
195#include <TRotMatrix.h>
94de3818 196#include <TGeometry.h>
fe4da5cc 197#include <TNode.h>
a897a37a 198#include <TTree.h>
fe4da5cc 199#include <TRandom.h>
200#include <TObject.h>
201#include <TVector.h>
202#include <TObjArray.h>
a897a37a 203#include <TMinuit.h>
204#include <TParticle.h>
205#include <TROOT.h>
206#include <TFile.h>
207#include <TNtuple.h>
208#include <TCanvas.h>
209#include <TPad.h>
210#include <TDirectory.h>
211#include <TObjectTable.h>
212#include <AliPDG.h>
a9e2aefa 213#include <TTUBE.h>
fe4da5cc 214
215#include "AliMUON.h"
a9e2aefa 216#include "AliMUONHit.h"
217#include "AliMUONPadHit.h"
218#include "AliMUONDigit.h"
219#include "AliMUONTransientDigit.h"
220#include "AliMUONRawCluster.h"
221#include "AliMUONLocalTrigger.h"
222#include "AliMUONGlobalTrigger.h"
ecfa008b 223#include "AliMUONTriggerCircuit.h"
a30a000f 224#include "AliHitMap.h"
a9e2aefa 225#include "AliMUONHitMapA1.h"
226#include "AliMUONChamberTrigger.h"
f665c1ea 227#include "AliMUONConstants.h"
30aaba74 228#include "AliMUONClusterFinderVS.h"
a9e2aefa 229#include "AliMUONTriggerDecision.h"
fe4da5cc 230#include "AliRun.h"
231#include "AliMC.h"
9825400f 232#include "AliMUONClusterInput.h"
1cae9436 233#include "AliMUONMerger.h"
fe4da5cc 234#include "iostream.h"
235#include "AliCallf77.h"
a9e2aefa 236#include "AliConst.h"
237
238// Defaults parameters for Z positions of chambers
239// taken from values for "stations" in AliMUON::AliMUON
240// const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.};
241// and from array "dstation" in AliMUONv1::CreateGeometry
242// Float_t dstation[5]={20., 20., 20, 20., 20.};
243// for tracking chambers,
244// according to (Z1 = zch - dstation) and (Z2 = zch + dstation)
245// for the first and second chambers in the station, respectively,
246// and from "DTPLANES" in AliMUONv1::CreateGeometry
247// const Float_t DTPLANES = 15.;
248// for trigger chambers,
249// according to (Z1 = zch) and (Z2 = zch + DTPLANES)
250// for the first and second chambers in the station, respectively
fe4da5cc 251
fe4da5cc 252ClassImp(AliMUON)
fe4da5cc 253//___________________________________________
254AliMUON::AliMUON()
255{
de05461e 256// Default Constructor
257//
1bd28025 258 fNCh = 0;
259 fNTrackingCh = 0;
1bd26093 260 fIshunt = 0;
261 fHits = 0;
262 fPadHits = 0;
263 fNPadHits = 0;
1bd28025 264 fChambers = 0;
1bd26093 265 fDchambers = 0;
1bd28025 266 fTriggerCircuits = 0;
1bd26093 267 fNdch = 0;
268 fRawClusters = 0;
269 fNrawch = 0;
270 fGlobalTrigger = 0;
271 fNLocalTrigger = 0;
272 fLocalTrigger = 0;
273 fNLocalTrigger = 0;
274 fAccMin = 0.;
275 fAccMax = 0.;
276 fAccCut = kFALSE;
1cae9436 277 fMerger = 0;
fe4da5cc 278}
279
280//___________________________________________
281AliMUON::AliMUON(const char *name, const char *title)
282 : AliDetector(name,title)
283{
284//Begin_Html
285/*
a897a37a 286<img src="gif/alimuon.gif">
fe4da5cc 287*/
288//End_Html
f665c1ea 289
a9e2aefa 290 fHits = new TClonesArray("AliMUONHit",1000);
1cedd08a 291 gAlice->AddHitList(fHits);
a9e2aefa 292 fPadHits = new TClonesArray("AliMUONPadHit",10000);
293 fNPadHits = 0;
fe4da5cc 294 fIshunt = 0;
295
1bd28025 296 fNCh = AliMUONConstants::NCh();
1bd26093 297 fNTrackingCh = AliMUONConstants::NTrackingCh();
1bd28025 298 fNdch = new Int_t[fNCh];
fe4da5cc 299
f665c1ea 300 fDchambers = new TObjArray(AliMUONConstants::NCh());
fe4da5cc 301
302 Int_t i;
303
f665c1ea 304 for (i=0; i<AliMUONConstants::NCh() ;i++) {
a9e2aefa 305 (*fDchambers)[i] = new TClonesArray("AliMUONDigit",10000);
fe4da5cc 306 fNdch[i]=0;
307 }
308
1bd28025 309 fNrawch = new Int_t[fNTrackingCh];
a897a37a 310
f665c1ea 311 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
a897a37a 312
f665c1ea 313 for (i=0; i<AliMUONConstants::NTrackingCh();i++) {
a897a37a 314 (*fRawClusters)[i] = new TClonesArray("AliMUONRawCluster",10000);
315 fNrawch[i]=0;
316 }
317
a9e2aefa 318 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
319 fNGlobalTrigger = 0;
320 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
321 fNLocalTrigger = 0;
fe4da5cc 322
fe4da5cc 323 SetMarkerColor(kRed);
a9e2aefa 324//
325//
326//
327//
f665c1ea 328
a9e2aefa 329 Int_t ch;
330
f665c1ea 331 fChambers = new TObjArray(AliMUONConstants::NCh());
a9e2aefa 332
333 // Loop over stations
f665c1ea 334 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
a9e2aefa 335 // Loop over 2 chambers in the station
336 for (Int_t stCH = 0; stCH < 2; stCH++) {
337//
338//
339// Default Parameters for Muon Tracking Stations
340
341
342 ch = 2 * st + stCH;
343//
f665c1ea 344 if (ch < AliMUONConstants::NTrackingCh()) {
d81db581 345 (*fChambers)[ch] = new AliMUONChamber(ch);
a9e2aefa 346 } else {
d81db581 347 (*fChambers)[ch] = new AliMUONChamberTrigger(ch);
a9e2aefa 348 }
349
350 AliMUONChamber* chamber = (AliMUONChamber*) (*fChambers)[ch];
351
352 chamber->SetGid(0);
353 // Default values for Z of chambers
f665c1ea 354 chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
a9e2aefa 355//
f665c1ea 356 chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
5c1f55c5 357// Set chamber inner and outer radius to default
f665c1ea 358 chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
359 chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
a9e2aefa 360//
361 } // Chamber stCH (0, 1) in
362 } // Station st (0...)
363 fMaxStepGas=0.01;
364 fMaxStepAlu=0.1;
365 fMaxDestepGas=-1;
366 fMaxDestepAlu=-1;
367//
368 fMaxIterPad = 0;
369 fCurIterPad = 0;
5c1f55c5 370//
371 fAccMin = 0.;
372 fAccMax = 0.;
373 fAccCut = kFALSE;
a9e2aefa 374
375 // cp new design of AliMUONTriggerDecision
f665c1ea 376 fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
377 for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
a9e2aefa 378 (*fTriggerCircuits)[circ] = new AliMUONTriggerCircuit();
a9e2aefa 379
1cae9436 380 }
381 fMerger = 0;
fe4da5cc 382}
383
384//___________________________________________
a9e2aefa 385AliMUON::AliMUON(const AliMUON& rMUON)
386{
387// Dummy copy constructor
388 ;
389
390}
391
fe4da5cc 392AliMUON::~AliMUON()
393{
de05461e 394// Destructor
a897a37a 395 printf("Calling AliMUON destructor !!!\n");
396
f665c1ea 397 Int_t i;
398 fIshunt = 0;
c2c0190f 399
400 // Delete TObjArrays
401
402 if (fChambers){
403 fChambers->Delete();
404 delete fChambers;
405 }
406
407 if (fTriggerCircuits){
408 fTriggerCircuits->Delete();
409 delete fTriggerCircuits;
410 }
411
412 if (fDchambers){
413 fDchambers->Delete();
414 delete fDchambers;
415 }
416
417 if (fRawClusters){
418 fRawClusters->Delete();
419 delete fRawClusters;
420 }
421 for (i=0;i<AliMUONConstants::NTrackingCh();i++) {
422 fNrawch[i]=0;
423 }
424
425 // Delete TClonesArrays
426
427 if (fPadHits){
428 fPadHits->Delete();
429 delete fPadHits;
430 }
431
432 if (fGlobalTrigger){
433 fGlobalTrigger->Delete();
434 delete fGlobalTrigger;
435 }
f665c1ea 436 fNGlobalTrigger = 0;
437
c2c0190f 438 if (fLocalTrigger){
439 fLocalTrigger->Delete();
440 delete fLocalTrigger;
441 }
f665c1ea 442 fNLocalTrigger = 0;
a897a37a 443
c2c0190f 444 if (fHits2){
445 fHits2->Delete();
446 delete fHits2;
f665c1ea 447 }
c2c0190f 448
449 if (fPadHits2){
450 fPadHits2->Delete();
451 delete fPadHits2;
f665c1ea 452 }
c2c0190f 453
454 if (fHits) {
455 fHits->Delete();
456 delete fHits;
457 }
458
459 // Delete hits tree for background event
460
461 if (fTrH1) {
462 fTrH1->Delete();
463 delete fTrH1;
f665c1ea 464 }
1cae9436 465
466 if (fMerger) delete fMerger;
fe4da5cc 467}
468
469//___________________________________________
470void AliMUON::AddHit(Int_t track, Int_t *vol, Float_t *hits)
471{
472 TClonesArray &lhits = *fHits;
a9e2aefa 473 new(lhits[fNhits++]) AliMUONHit(fIshunt,track,vol,hits);
fe4da5cc 474}
475//___________________________________________
a9e2aefa 476void AliMUON::AddPadHit(Int_t *clhits)
fe4da5cc 477{
a9e2aefa 478 TClonesArray &lclusters = *fPadHits;
479 new(lclusters[fNPadHits++]) AliMUONPadHit(clhits);
fe4da5cc 480}
481//_____________________________________________________________________________
482void AliMUON::AddDigits(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
483{
484 //
485 // Add a MUON digit to the list
486 //
487
488 TClonesArray &ldigits = *((TClonesArray*)(*fDchambers)[id]);
a9e2aefa 489 new(ldigits[fNdch[id]++]) AliMUONDigit(tracks,charges,digits);
fe4da5cc 490}
491
a897a37a 492//_____________________________________________________________________________
493void AliMUON::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
494{
495 //
496 // Add a MUON digit to the list
497 //
498
499 TClonesArray &lrawcl = *((TClonesArray*)(*fRawClusters)[id]);
500 new(lrawcl[fNrawch[id]++]) AliMUONRawCluster(c);
501}
a897a37a 502
a9e2aefa 503//___________________________________________
504void AliMUON::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
505 Int_t *singleUndef,
506 Int_t *pairUnlike, Int_t *pairLike)
507{
508// add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
509 TClonesArray &globalTrigger = *fGlobalTrigger;
510 new(globalTrigger[fNGlobalTrigger++])
511 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike,
512 pairLike);
513}
514//___________________________________________
515void AliMUON::AddLocalTrigger(Int_t *localtr)
516{
517// add a MUON Local Trigger to the list
518 TClonesArray &localTrigger = *fLocalTrigger;
519 new(localTrigger[fNLocalTrigger++]) AliMUONLocalTrigger(localtr);
a897a37a 520}
521
fe4da5cc 522//___________________________________________
523void AliMUON::BuildGeometry()
524{
de05461e 525// Geometry for event display
5fd73042 526 for (Int_t i=0; i<7; i++) {
527 for (Int_t j=0; j<2; j++) {
528 Int_t id=2*i+j+1;
529 this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
a897a37a 530 }
5fd73042 531 }
fe4da5cc 532}
533
534//___________________________________________
535Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
536{
537 return 9999;
538}
539
540//___________________________________________
2ab0c725 541void AliMUON::MakeBranch(Option_t* option, char *file)
fe4da5cc 542{
2ab0c725 543 //
f665c1ea 544 // Create Tree branches for the MUON.
2ab0c725 545 //
f665c1ea 546 const Int_t kBufferSize = 4000;
547 char branchname[30];
548 sprintf(branchname,"%sCluster",GetName());
549
2ab0c725 550 AliDetector::MakeBranch(option,file);
f665c1ea 551
2ab0c725 552 char *cD = strstr(option,"D");
553 char *cR = strstr(option,"R");
554 char *cH = strstr(option,"H");
555
556 if (fPadHits && gAlice->TreeH() && cH) {
557 gAlice->MakeBranchInTree(gAlice->TreeH(),
558 branchname, &fPadHits, kBufferSize, file) ;
559 printf("Making Branch %s for clusters\n",branchname);
f665c1ea 560 }
561
2ab0c725 562 if (cD) {
563 //
564 // one branch for digits per chamber
565 //
566 Int_t i;
f665c1ea 567
2ab0c725 568 for (i=0; i<AliMUONConstants::NCh() ;i++) {
569 sprintf(branchname,"%sDigits%d",GetName(),i+1);
570 if (fDchambers && gAlice->TreeD()) {
571 gAlice->MakeBranchInTree(gAlice->TreeD(),
572 branchname, &((*fDchambers)[i]), kBufferSize, file) ;
573 printf("Making Branch %s for digits in chamber %d\n",branchname,i+1);
574 }
575 }
f665c1ea 576 }
577
2ab0c725 578 if (cR) {
579 //
580 // one branch for raw clusters per chamber
581 //
582 printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
583
584 Int_t i;
585
586 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
587 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
588 if (fRawClusters && gAlice->TreeR()) {
589 gAlice->MakeBranchInTree(gAlice->TreeR(),
590 branchname, &((*fRawClusters)[i]), kBufferSize, file) ;
591 printf("Making Branch %s for raw clusters in chamber %d\n",branchname,i+1);
592 }
593 }
594 //
595 // one branch for global trigger
596 //
597 sprintf(branchname,"%sGlobalTrigger",GetName());
598 if (fGlobalTrigger && gAlice->TreeR()) {
599 gAlice->MakeBranchInTree(gAlice->TreeR(),
600 branchname, &fGlobalTrigger, kBufferSize, file) ;
601 printf("Making Branch %s for Global Trigger\n",branchname);
602 }
603 //
604 // one branch for local trigger
605 //
606 sprintf(branchname,"%sLocalTrigger",GetName());
607 if (fLocalTrigger && gAlice->TreeR()) {
608 gAlice->MakeBranchInTree(gAlice->TreeR(),
609 branchname, &fLocalTrigger, kBufferSize, file) ;
610 printf("Making Branch %s for Local Trigger\n",branchname);
611 }
612 }
fe4da5cc 613}
614
615//___________________________________________
616void AliMUON::SetTreeAddress()
617{
618 // Set branch address for the Hits and Digits Tree.
a897a37a 619 char branchname[30];
fe4da5cc 620 AliDetector::SetTreeAddress();
621
622 TBranch *branch;
623 TTree *treeH = gAlice->TreeH();
624 TTree *treeD = gAlice->TreeD();
a897a37a 625 TTree *treeR = gAlice->TreeR();
fe4da5cc 626
627 if (treeH) {
a9e2aefa 628 if (fPadHits) {
fe4da5cc 629 branch = treeH->GetBranch("MUONCluster");
a9e2aefa 630 if (branch) branch->SetAddress(&fPadHits);
fe4da5cc 631 }
632 }
633
634 if (treeD) {
f665c1ea 635 for (int i=0; i<AliMUONConstants::NCh(); i++) {
fe4da5cc 636 sprintf(branchname,"%sDigits%d",GetName(),i+1);
637 if (fDchambers) {
638 branch = treeD->GetBranch(branchname);
639 if (branch) branch->SetAddress(&((*fDchambers)[i]));
640 }
641 }
642 }
a897a37a 643
644 // printf("SetTreeAddress --- treeR address %p \n",treeR);
645
646 if (treeR) {
f665c1ea 647 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
a897a37a 648 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
649 if (fRawClusters) {
650 branch = treeR->GetBranch(branchname);
651 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
652 }
653 }
a897a37a 654
a9e2aefa 655 if (fLocalTrigger) {
656 branch = treeR->GetBranch("MUONLocalTrigger");
657 if (branch) branch->SetAddress(&fLocalTrigger);
658 }
659 if (fGlobalTrigger) {
660 branch = treeR->GetBranch("MUONGlobalTrigger");
661 if (branch) branch->SetAddress(&fGlobalTrigger);
662 }
663 }
fe4da5cc 664}
665//___________________________________________
666void AliMUON::ResetHits()
667{
668 // Reset number of clusters and the cluster array for this detector
669 AliDetector::ResetHits();
a9e2aefa 670 fNPadHits = 0;
671 if (fPadHits) fPadHits->Clear();
fe4da5cc 672}
673
674//____________________________________________
675void AliMUON::ResetDigits()
676{
677 //
678 // Reset number of digits and the digits array for this detector
679 //
f665c1ea 680 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
a897a37a 681 if ((*fDchambers)[i]) ((TClonesArray*)(*fDchambers)[i])->Clear();
fe4da5cc 682 if (fNdch) fNdch[i]=0;
683 }
684}
685//____________________________________________
a897a37a 686void AliMUON::ResetRawClusters()
687{
688 //
689 // Reset number of raw clusters and the raw clust array for this detector
690 //
f665c1ea 691 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
a897a37a 692 if ((*fRawClusters)[i]) ((TClonesArray*)(*fRawClusters)[i])->Clear();
693 if (fNrawch) fNrawch[i]=0;
694 }
695}
a9e2aefa 696
a897a37a 697//____________________________________________
a9e2aefa 698void AliMUON::ResetTrigger()
a897a37a 699{
a9e2aefa 700 // Reset Local and Global Trigger
701 fNGlobalTrigger = 0;
702 if (fGlobalTrigger) fGlobalTrigger->Clear();
703 fNLocalTrigger = 0;
704 if (fLocalTrigger) fLocalTrigger->Clear();
705}
706
707//____________________________________________
708void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2)
709{
de05461e 710// Set the pad size for chamber id and cathode isec
a9e2aefa 711 Int_t i=2*(id-1);
712 ((AliMUONChamber*) (*fChambers)[i]) ->SetPadSize(isec,p1,p2);
713 ((AliMUONChamber*) (*fChambers)[i+1])->SetPadSize(isec,p1,p2);
a897a37a 714}
715
fe4da5cc 716//___________________________________________
a9e2aefa 717void AliMUON::SetChambersZ(const Float_t *Z)
718{
719 // Set Z values for all chambers (tracking and trigger)
720 // from the array pointed to by "Z"
f665c1ea 721 for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
722 ((AliMUONChamber*) ((*fChambers)[ch]))->SetZ(Z[ch]);
723 return;
a9e2aefa 724}
fe4da5cc 725
a9e2aefa 726//___________________________________________
727void AliMUON::SetChambersZToDefault()
fe4da5cc 728{
a9e2aefa 729 // Set Z values for all chambers (tracking and trigger)
730 // to default values
f665c1ea 731 SetChambersZ(AliMUONConstants::DefaultChamberZ());
a9e2aefa 732 return;
fe4da5cc 733}
734
735//___________________________________________
a897a37a 736void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
fe4da5cc 737{
de05461e 738// Set the inverse charge slope for chamber id
fe4da5cc 739 Int_t i=2*(id-1);
a9e2aefa 740 ((AliMUONChamber*) (*fChambers)[i])->SetChargeSlope(p1);
741 ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSlope(p1);
fe4da5cc 742}
743
744//___________________________________________
a897a37a 745void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
fe4da5cc 746{
de05461e 747// Set sigma of charge spread for chamber id
fe4da5cc 748 Int_t i=2*(id-1);
a9e2aefa 749 ((AliMUONChamber*) (*fChambers)[i])->SetChargeSpread(p1,p2);
750 ((AliMUONChamber*) (*fChambers)[i+1])->SetChargeSpread(p1,p2);
fe4da5cc 751}
752
753//___________________________________________
a897a37a 754void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
fe4da5cc 755{
de05461e 756// Set integration limits for charge spread
fe4da5cc 757 Int_t i=2*(id-1);
a9e2aefa 758 ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
759 ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
fe4da5cc 760}
761
762//___________________________________________
d09fafb0 763void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
fe4da5cc 764{
de05461e 765// Set maximum number for ADCcounts (saturation)
fe4da5cc 766 Int_t i=2*(id-1);
a9e2aefa 767 ((AliMUONChamber*) (*fChambers)[i])->SetMaxAdc(p1);
768 ((AliMUONChamber*) (*fChambers)[i+1])->SetMaxAdc(p1);
fe4da5cc 769}
770
771//___________________________________________
a897a37a 772void AliMUON::SetMaxStepGas(Float_t p1)
fe4da5cc 773{
de05461e 774// Set stepsize in gas
fe4da5cc 775 fMaxStepGas=p1;
776}
777
778//___________________________________________
a897a37a 779void AliMUON::SetMaxStepAlu(Float_t p1)
fe4da5cc 780{
de05461e 781// Set step size in Alu
fe4da5cc 782 fMaxStepAlu=p1;
783}
784
785//___________________________________________
a897a37a 786void AliMUON::SetMaxDestepGas(Float_t p1)
fe4da5cc 787{
de05461e 788// Set maximum step size in Gas
fe4da5cc 789 fMaxDestepGas=p1;
790}
791
792//___________________________________________
a897a37a 793void AliMUON::SetMaxDestepAlu(Float_t p1)
fe4da5cc 794{
de05461e 795// Set maximum step size in Alu
fe4da5cc 796 fMaxDestepAlu=p1;
797}
798//___________________________________________
5c1f55c5 799void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
fe4da5cc 800{
de05461e 801// Set acceptance cuts
fe4da5cc 802 fAccCut=acc;
5c1f55c5 803 fAccMin=angmin*TMath::Pi()/180;
804 fAccMax=angmax*TMath::Pi()/180;
805 Int_t ch;
806 if (acc) {
807 for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
808 // Loop over 2 chambers in the station
809 for (Int_t stCH = 0; stCH < 2; stCH++) {
810 ch = 2 * st + stCH;
811// Set chamber inner and outer radius according to acceptance cuts
812 Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin));
813 Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax));
814 } // chamber loop
815 } // station loop
816 }
fe4da5cc 817}
818//___________________________________________
a30a000f 819void AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
fe4da5cc 820{
de05461e 821// Set the segmentation for chamber id cathode isec
a9e2aefa 822 ((AliMUONChamber*) (*fChambers)[id])->SetSegmentationModel(isec, segmentation);
fe4da5cc 823
824}
825//___________________________________________
a9e2aefa 826void AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
fe4da5cc 827{
de05461e 828// Set the response for chamber id
a9e2aefa 829 ((AliMUONChamber*) (*fChambers)[id])->SetResponseModel(response);
fe4da5cc 830}
831
30aaba74 832void AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
a897a37a 833{
de05461e 834// Set ClusterFinder for chamber id
a9e2aefa 835 ((AliMUONChamber*) (*fChambers)[id])->SetReconstructionModel(reconst);
a897a37a 836}
837
fe4da5cc 838void AliMUON::SetNsec(Int_t id, Int_t nsec)
839{
de05461e 840// Set number of segmented cathods for chamber id
a9e2aefa 841 ((AliMUONChamber*) (*fChambers)[id])->SetNsec(nsec);
fe4da5cc 842}
843
fe4da5cc 844//___________________________________________
2ab0c725 845void AliMUON::SDigits2Digits()
846{
1cae9436 847 if (fMerger) {
848 fMerger->Init();
849 fMerger->Digitise();
2ab0c725 850 }
851}
a9e2aefa 852
2ab0c725 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//
7ab910ae 873// if (idvol == 6) printf("\n ->Disintegration %f %f %f", xhit, yhit, eloss );
874
875
a9e2aefa 876 ((AliMUONChamber*) (*fChambers)[idvol])
802a864d 877 ->DisIntegration(eloss, tof, xhit, yhit, zhit, nnew, newclust);
a897a37a 878 Int_t ic=0;
7ab910ae 879// if (idvol == 6) printf("\n nnew %d \n", nnew);
a897a37a 880//
881// Add new clusters
882 for (Int_t i=0; i<nnew; i++) {
883 if (Int_t(newclust[3][i]) > 0) {
884 ic++;
885// Cathode plane
886 clhits[1] = Int_t(newclust[5][i]);
887// Cluster Charge
888 clhits[2] = Int_t(newclust[0][i]);
889// Pad: ix
890 clhits[3] = Int_t(newclust[1][i]);
891// Pad: iy
892 clhits[4] = Int_t(newclust[2][i]);
893// Pad: charge
894 clhits[5] = Int_t(newclust[3][i]);
895// Pad: chamber sector
896 clhits[6] = Int_t(newclust[4][i]);
897
a9e2aefa 898 AddPadHit(clhits);
a897a37a 899 }
900 }
a897a37a 901}
902
a9e2aefa 903//___________________________________________
904void AliMUON::Trigger(Int_t nev){
905// call the Trigger Algorithm and fill TreeR
906
907 Int_t singlePlus[3] = {0,0,0};
908 Int_t singleMinus[3] = {0,0,0};
909 Int_t singleUndef[3] = {0,0,0};
910 Int_t pairUnlike[3] = {0,0,0};
911 Int_t pairLike[3] = {0,0,0};
912
913 ResetTrigger();
a9e2aefa 914 AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
915 decision->Trigger();
916 decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef,
917 pairUnlike, pairLike);
918// add a local trigger in the list
919 AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
9ae15266 920 Int_t i;
a9e2aefa 921
f665c1ea 922 for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) {
9ae15266 923 if(decision->GetITrigger(icirc)==1) {
924 Int_t localtr[7]={0,0,0,0,0,0,0};
925 Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0};
926 decision->GetLutOutput(icirc, loLpt, loHpt, loApt);
927 localtr[0] = icirc;
928 localtr[1] = decision->GetStripX11(icirc);
929 localtr[2] = decision->GetDev(icirc);
930 localtr[3] = decision->GetStripY11(icirc);
931 for (i=0; i<2; i++) { // convert the Lut output in 1 digit
932 localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i));
933 localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i));
934 localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i));
935 }
936 AddLocalTrigger(localtr); // add a local trigger in the list
a897a37a 937 }
a9e2aefa 938 }
939 delete decision;
a897a37a 940
a9e2aefa 941 gAlice->TreeR()->Fill();
942 ResetTrigger();
a897a37a 943 char hname[30];
944 sprintf(hname,"TreeR%d",nev);
2ab0c725 945 gAlice->TreeR()->Write(hname,TObject::kOverwrite);
a897a37a 946 gAlice->TreeR()->Reset();
a9e2aefa 947 printf("\n End of trigger for event %d", nev);
a897a37a 948}
a897a37a 949
a897a37a 950
a9e2aefa 951//____________________________________________
fe311ef1 952void AliMUON::Digits2Reco()
953{
954 FindClusters();
955}
956
957void AliMUON::FindClusters()
a9e2aefa 958{
de05461e 959//
960// Perform cluster finding
961//
a9e2aefa 962 TClonesArray *dig1, *dig2;
963 Int_t ndig, k;
964 dig1 = new TClonesArray("AliMUONDigit",1000);
965 dig2 = new TClonesArray("AliMUONDigit",1000);
966 AliMUONDigit *digit;
a897a37a 967//
a9e2aefa 968// Loop on chambers and on cathode planes
a897a37a 969//
fe311ef1 970 ResetRawClusters();
1bd28025 971 for (Int_t ich = 0; ich < 10; ich++) {
972 AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich];
fe311ef1 973 AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
974
a9e2aefa 975 gAlice->ResetDigits();
fe311ef1 976 gAlice->TreeD()->GetEvent(0);
1bd28025 977 TClonesArray *muonDigits = this->DigitsAddress(ich);
a9e2aefa 978 ndig=muonDigits->GetEntriesFast();
979 printf("\n 1 Found %d digits in %p %d", ndig, muonDigits,ich);
980 TClonesArray &lhits1 = *dig1;
1bd28025 981 Int_t n = 0;
982 for (k = 0; k < ndig; k++) {
983 digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
984 if (rec->TestTrack(digit->Track(0)))
a9e2aefa 985 new(lhits1[n++]) AliMUONDigit(*digit);
986 }
987 gAlice->ResetDigits();
fe311ef1 988 gAlice->TreeD()->GetEvent(1);
a9e2aefa 989 muonDigits = this->DigitsAddress(ich);
990 ndig=muonDigits->GetEntriesFast();
991 printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich);
992 TClonesArray &lhits2 = *dig2;
993 n=0;
994
995 for (k=0; k<ndig; k++) {
996 digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
1bd28025 997 if (rec->TestTrack(digit->Track(0)))
a9e2aefa 998 new(lhits2[n++]) AliMUONDigit(*digit);
a897a37a 999 }
a897a37a 1000
9825400f 1001 if (rec) {
1002 AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
a9e2aefa 1003 rec->FindRawClusters();
1004 }
1005 dig1->Delete();
1006 dig2->Delete();
1007 } // for ich
a9e2aefa 1008 delete dig1;
1009 delete dig2;
a897a37a 1010}
a9e2aefa 1011
2ab0c725 1012#ifdef never
fe4da5cc 1013void AliMUON::Streamer(TBuffer &R__b)
1014{
1015 // Stream an object of class AliMUON.
a30a000f 1016 AliMUONChamber *iChamber;
a9e2aefa 1017 AliMUONTriggerCircuit *iTriggerCircuit;
a30a000f 1018 AliSegmentation *segmentation;
1019 AliMUONResponse *response;
1020 TClonesArray *digitsaddress;
1021 TClonesArray *rawcladdress;
9ae15266 1022 Int_t i;
9ae15266 1023 if (R__b.IsReading()) {
1024 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
1025 AliDetector::Streamer(R__b);
1026 R__b >> fNPadHits;
1027 R__b >> fPadHits; // diff
1028 R__b >> fNLocalTrigger;
1029 R__b >> fLocalTrigger;
1030 R__b >> fNGlobalTrigger;
1031 R__b >> fGlobalTrigger;
1032 R__b >> fDchambers;
1033 R__b >> fRawClusters;
1034 R__b.ReadArray(fNdch);
1035 R__b.ReadArray(fNrawch);
1036 R__b >> fAccCut;
1037 R__b >> fAccMin;
1038 R__b >> fAccMax;
1039 R__b >> fChambers;
1040 R__b >> fTriggerCircuits;
f665c1ea 1041 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 1042 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
1043 iTriggerCircuit->Streamer(R__b);
fe4da5cc 1044 }
9ae15266 1045// Stream chamber related information
f665c1ea 1046 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 1047 iChamber=(AliMUONChamber*) (*fChambers)[i];
1048 iChamber->Streamer(R__b);
1049 if (iChamber->Nsec()==1) {
1050 segmentation=iChamber->SegmentationModel(1);
1051 if (segmentation)
1052 segmentation->Streamer(R__b);
1053 } else {
1054 segmentation=iChamber->SegmentationModel(1);
1055 if (segmentation)
1056 segmentation->Streamer(R__b);
1057 if (segmentation)
1058 segmentation=iChamber->SegmentationModel(2);
1059 segmentation->Streamer(R__b);
1060 }
1061 response=iChamber->ResponseModel();
1062 if (response)
1063 response->Streamer(R__b);
1064 digitsaddress=(TClonesArray*) (*fDchambers)[i];
1065 digitsaddress->Streamer(R__b);
f665c1ea 1066 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 1067 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
1068 rawcladdress->Streamer(R__b);
1069 }
a9e2aefa 1070 }
9ae15266 1071
1072 } else {
1073 R__b.WriteVersion(AliMUON::IsA());
1074 AliDetector::Streamer(R__b);
1075 R__b << fNPadHits;
1076 R__b << fPadHits; // diff
1077 R__b << fNLocalTrigger;
1078 R__b << fLocalTrigger;
1079 R__b << fNGlobalTrigger;
1080 R__b << fGlobalTrigger;
1081 R__b << fDchambers;
1082 R__b << fRawClusters;
f665c1ea 1083 R__b.WriteArray(fNdch, AliMUONConstants::NCh());
1084 R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh());
9ae15266 1085
1086 R__b << fAccCut;
1087 R__b << fAccMin;
1088 R__b << fAccMax;
1089
1090 R__b << fChambers;
1091 R__b << fTriggerCircuits;
f665c1ea 1092 for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
9ae15266 1093 iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
1094 iTriggerCircuit->Streamer(R__b);
fe4da5cc 1095 }
f665c1ea 1096 for (i =0; i<AliMUONConstants::NCh(); i++) {
9ae15266 1097 iChamber=(AliMUONChamber*) (*fChambers)[i];
1098 iChamber->Streamer(R__b);
1099 if (iChamber->Nsec()==1) {
1100 segmentation=iChamber->SegmentationModel(1);
1101 if (segmentation)
1102 segmentation->Streamer(R__b);
1103 } else {
1104 segmentation=iChamber->SegmentationModel(1);
1105 if (segmentation)
1106 segmentation->Streamer(R__b);
1107 segmentation=iChamber->SegmentationModel(2);
1108 if (segmentation)
1109 segmentation->Streamer(R__b);
1110 }
1111 response=iChamber->ResponseModel();
1112 if (response)
1113 response->Streamer(R__b);
1114 digitsaddress=(TClonesArray*) (*fDchambers)[i];
1115 digitsaddress->Streamer(R__b);
f665c1ea 1116 if (i < AliMUONConstants::NTrackingCh()) {
9ae15266 1117 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
1118 rawcladdress->Streamer(R__b);
1119 }
a9e2aefa 1120 }
fe4da5cc 1121 }
fe4da5cc 1122}
2ab0c725 1123#endif
1124
a9e2aefa 1125AliMUONPadHit* AliMUON::FirstPad(AliMUONHit* hit, TClonesArray *clusters)
fe4da5cc 1126{
1127//
1128 // Initialise the pad iterator
1129 // Return the address of the first padhit for hit
a897a37a 1130 TClonesArray *theClusters = clusters;
fe4da5cc 1131 Int_t nclust = theClusters->GetEntriesFast();
1bd28025 1132 if (nclust && hit->PHlast() > 0) {
1133 AliMUON::fMaxIterPad=hit->PHlast();
1134 AliMUON::fCurIterPad=hit->PHfirst();
a9e2aefa 1135 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 1136 } else {
1137 return 0;
1138 }
1139}
1140
a9e2aefa 1141AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters)
fe4da5cc 1142{
de05461e 1143// Get next pad (in iterator)
1144//
a9e2aefa 1145 AliMUON::fCurIterPad++;
1146 if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
1147 return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
fe4da5cc 1148 } else {
1149 return 0;
1150 }
1151}
1152
a897a37a 1153
1154AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
1155{
de05461e 1156//
1157// Return rawcluster (icluster) for chamber ichamber and cathode icathod
1158// Obsolete ??
a9e2aefa 1159 TClonesArray *muonRawCluster = RawClustAddress(ichamber);
a897a37a 1160 ResetRawClusters();
a9e2aefa 1161 TTree *treeR = gAlice->TreeR();
1162 Int_t nent=(Int_t)treeR->GetEntries();
1163 treeR->GetEvent(nent-2+icathod-1);
1164 //treeR->GetEvent(icathod);
1165 //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
a897a37a 1166
a9e2aefa 1167 AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
a897a37a 1168 //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
1169
1170 return mRaw;
1171}
1cae9436 1172
1173void AliMUON::SetMerger(AliMUONMerger* merger)
1174{
1175// Set pointer to merger
1176 fMerger = merger;
1177}
1178
1179AliMUONMerger* AliMUON::Merger()
1180{
1181// Return pointer to merger
1182 return fMerger;
1183}
1184
1185
a897a37a 1186
a9e2aefa 1187AliMUON& AliMUON::operator = (const AliMUON& rhs)
a897a37a 1188{
a9e2aefa 1189// copy operator
1190// dummy version
1191 return *this;
a897a37a 1192}
1193
1194
1195
a897a37a 1196
1197
fe4da5cc 1198
fe4da5cc 1199
fe4da5cc 1200
fe4da5cc 1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211