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