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