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