]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONData.cxx
Coding conventions
[u/mrichter/AliRoot.git] / MUON / AliMUONData.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 /* $Id$ */
17 // AliMUONData classes
18 // Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc ..
19 // The classe makes the lik between the MUON data lists and the event trees from loaders
20 // Gines Martinez, Subatech,  September 2003
21 //
22
23
24 //Root includes
25 #include "TNamed.h"
26 //AliRoot include
27 #include "AliLoader.h" 
28 #include "AliMUONConstants.h"
29 #include "AliMUONData.h"
30 #include "AliMUONDigit.h"
31 #include "AliMUONHit.h"
32 #include "AliMUONLocalTrigger.h"
33 #include "AliMUONGlobalTrigger.h"
34 #include "AliMUONRawCluster.h"
35 #include "AliMUONTrack.h"
36
37 ClassImp(AliMUONData)
38  
39 //_____________________________________________________________________________
40 AliMUONData::AliMUONData():TNamed()
41 {
42   // Default constructor
43   fLoader        = 0x0;
44   fHits          = 0x0;    // One event in treeH per primary track
45   fDigits        = 0x0;  // One event in treeH per detection plane
46   fNdigits       = 0x0;
47   fRawClusters   = 0x0; //One event in TreeR/RawclusterBranch per tracking detection plane
48   fGlobalTrigger = 0x0; //! List of Global Trigger 1st event in TreeR/GlobalTriggerBranch
49   fLocalTrigger  = 0x0;  //! List of Local Trigger, 1st event in TreeR/LocalTriggerBranch
50   fRecTracks     = 0x0;       
51   fSplitLevel    = 0;
52 //default constructor
53 }
54 //_____________________________________________________________________________
55 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
56   TNamed(name,title)
57 {
58   // Constructor for AliMUONData
59   fLoader        = loader;
60   fHits          = 0x0;    // One event in treeH per primary track
61   fDigits        = 0x0;  // One event in treeH per detection plane
62   fNdigits       = 0x0;
63   fRawClusters   = 0x0; //One event in TreeR/RawclusterBranch per tracking detection plane
64   fGlobalTrigger = 0x0; //! List of Global Trigger 1st event in TreeR/GlobalTriggerBranch
65   fLocalTrigger  = 0x0;  //! List of Local Trigger, 1st event in TreeR/LocalTriggerBranch
66   fRecTracks     = 0x0;    
67   fNhits         = 0;
68   fNglobaltrigger =0;
69   fNlocaltrigger = 0;
70   fNrectracks    = 0;  
71   fSplitLevel    = 0;
72 //   fHits          = new TClonesArray("AliMUONHit",1000);
73 //   fNhits         = 0;
74 //   fDigits        = new TObjArray(AliMUONConstants::NCh());
75 //   fNdigits       = new Int_t[AliMUONConstants::NCh()];
76 //   for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
77 //     fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane); 
78 //     fNdigits[iDetectionPlane]=0;
79 //   }
80 //   fRawClusters   = new TObjArray(AliMUONConstants::NTrackingCh());
81 //   fNrawclusters  = new Int_t[AliMUONConstants::NTrackingCh()];
82 //   for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) {
83 //     fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane); 
84 //     fNrawclusters[iDetectionPlane]=0;
85 //   }
86 //   fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);    
87 //   fNglobaltrigger =0;
88 //   fLocalTrigger  = new TClonesArray("AliMUONLocalTrigger",234);   
89 //   fNlocaltrigger = 0;
90 //   fRecTracks     = new TClonesArray("AliMUONTrack", 100);
91 //   fNrectracks    = 0; // really needed or GetEntriesFast sufficient ????
92
93
94   //default constructor
95 }
96 //_____________________________________________________________________________
97 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
98 {
99   // Dummy copy constructor
100   ;
101 }
102 //_____________________________________________________________________________
103 AliMUONData::~AliMUONData()
104 {
105   // Destructor for AliMUONData
106   if (fHits) {
107     fHits->Delete();
108     delete fHits;
109   }
110   if (fDigits) {
111     fDigits->Delete();
112     delete fDigits;
113   }
114   if (fRawClusters) {
115     fRawClusters->Delete();
116     delete fRawClusters;
117   }
118   if (fGlobalTrigger){
119     fGlobalTrigger->Delete();
120     delete fGlobalTrigger;
121   }  
122   if (fLocalTrigger){
123     fLocalTrigger->Delete();
124     delete fLocalTrigger;
125   }
126   if (fRecTracks){
127     fRecTracks->Delete();
128     delete fRecTracks;
129   }
130   //detructor 
131 }
132 //_____________________________________________________________________________
133 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
134 {
135   //
136   // Add a MUON digit to the list of Digits of the detection plane id
137   //
138   TClonesArray &ldigits = * Digits(id) ; 
139   new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
140 }
141 //_____________________________________________________________________________
142 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
143                                    Int_t *singleUndef,
144                                    Int_t *pairUnlike, Int_t *pairLike)
145 {
146   // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
147   TClonesArray &globalTrigger = *fGlobalTrigger;
148   new(globalTrigger[fNglobaltrigger++]) 
149     AliMUONGlobalTrigger(singlePlus, singleMinus,  singleUndef, pairUnlike, pairLike);
150 }
151 //_____________________________________________________________________________
152 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, 
153                          Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
154                          Float_t tof, Float_t momentum, Float_t theta, 
155                          Float_t phi, Float_t length, Float_t destep)
156 {
157   // Add new hit to the hit list
158   TClonesArray &lhits = *fHits;
159   new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, 
160                                   idpart, X, Y, Z, 
161                                   tof, momentum, theta, 
162                                   phi, length, destep);
163 }
164 //____________________________________________________________________________
165 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, 
166                          Int_t idpart, Float_t X, Float_t Y, Float_t Z, 
167                          Float_t tof, Float_t momentum, Float_t theta, 
168                          Float_t phi, Float_t length, Float_t destep,
169                          Float_t Xref,Float_t Yref,Float_t Zref)
170 {
171  // Add new hit to the hit list
172   TClonesArray &lhits = *fHits;
173   new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, 
174                                   idpart, X, Y, Z, 
175                                   tof, momentum, theta, 
176                                   phi, length, destep,
177                                   Xref,Yref,Zref);
178 }
179 //____________________________________________________________________________
180 void AliMUONData::AddLocalTrigger(Int_t *localtr)
181 {
182   // add a MUON Local Trigger to the list
183   TClonesArray &localTrigger = *fLocalTrigger;
184   new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
185 }
186 //_____________________________________________________________________________
187 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
188 {
189   //
190   // Add a MUON rawcluster to the list in the detection plane id
191   //
192   TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
193   new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
194 }
195 //_____________________________________________________________________________
196 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
197 {
198   //
199   // Add a MUON rectrack
200   //
201   TClonesArray &lrectracks = *fRecTracks;
202   new(lrectracks[fNrectracks++]) AliMUONTrack(track);
203 }
204 //____________________________________________________________________________
205 TClonesArray*  AliMUONData::Digits(Int_t DetectionPlane) 
206 {
207   //Getting List of Digits
208   if (fDigits)
209     return ( (TClonesArray*) fDigits->At(DetectionPlane) );
210   else
211     return NULL;
212 }
213 //____________________________________________________________________________
214 Bool_t   AliMUONData::IsRawClusterBranchesInTree()
215 {
216   // Checking if there are RawCluster Branches In TreeR
217   if (TreeR()==0x0) {
218     Error("TreeR","No treeR in memory");
219     return kFALSE;
220   }
221   else {
222      char branchname[30];
223      sprintf(branchname,"%sRawClusters1",GetName());
224      TBranch * branch = 0x0;
225      branch = TreeR()->GetBranch(branchname);
226      if (branch)  return kTRUE;
227      else return kFALSE;    
228   }
229 }
230 //____________________________________________________________________________
231 Bool_t   AliMUONData::IsTriggerBranchesInTree()
232 {
233   // Checking if there are Trigger Branches In TreeR
234  if (TreeR()==0x0) {
235     Error("TreeR","No treeR in memory");
236     return kFALSE;
237   }
238   else {
239      char branchname[30];
240      sprintf(branchname,"%sLocalTrigger",GetName());
241      TBranch * branch = 0x0;
242      branch = TreeR()->GetBranch(branchname);
243      if (branch)  return kTRUE;
244      else return kFALSE;    
245   }
246 }
247 //____________________________________________________________________________
248 void AliMUONData::Fill(Option_t* option)
249 {
250   // Method to fill the trees
251   const char *cH   = strstr(option,"H");
252   const char *cD   = strstr(option,"D");   // Digits branches in TreeD
253   const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
254   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
255   const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
256   //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
257   
258   char branchname[30];
259   TBranch * branch = 0x0;
260
261   //
262   // Filling TreeH
263   if ( TreeH() && cH ) {
264     TreeH()->Fill();
265   }  
266   //
267   // Filling TreeD
268   if ( TreeD() && cD) {
269     TreeD()->Fill();
270   }
271
272   //
273   // filling rawclusters
274   if ( TreeR()  && cRC ) {
275     if ( IsTriggerBranchesInTree() ) {
276       // Branch per branch filling
277       for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
278         sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
279         branch = TreeR()->GetBranch(branchname);
280         branch->Fill();
281       }
282     }
283     else  TreeR()->Fill();
284   }
285   
286  //
287   // filling trigger 
288   if ( TreeR()  && cGLT) {
289     if (IsRawClusterBranchesInTree()) {
290       // Branch per branch filling
291       sprintf(branchname,"%sLocalTrigger",GetName());
292       branch = TreeR()->GetBranch(branchname); 
293       branch->Fill();
294       sprintf(branchname,"%sGlobalTrigger",GetName());
295       branch = TreeR()->GetBranch(branchname);
296       branch->Fill();
297     }
298     else  TreeR()->Fill();
299   }
300   //
301   // filling tracks
302   if ( TreeT() && cRT ) {
303     sprintf(branchname,"%sTrack",GetName());  
304     TreeT()->Fill();
305   }
306 }
307 //_____________________________________________________________________________
308 void AliMUONData::MakeBranch(Option_t* option)
309 {
310   //
311   // Create Tree branches for the MUON.
312   //
313   const Int_t kBufferSize = 4000;
314   char branchname[30];
315   
316   const char *cH   = strstr(option,"H");
317   const char *cD   = strstr(option,"D");   // Digits branches in TreeD
318   const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
319   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
320   const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
321   const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
322   
323   TBranch * branch = 0x0;
324   
325   // Creating Branches for Hits
326   if (TreeH() && cH) {
327     if (fHits == 0x0)  fHits = new TClonesArray("AliMUONHit",1000);
328     fNhits = 0;
329     sprintf(branchname,"%sHits",GetName());  
330     branch = TreeH()->GetBranch(branchname);
331     if (branch) {  
332       Info("MakeBranch","Branch %s is already in tree.",GetName());
333       return ;
334     }
335     branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
336     Info("MakeBranch","Making Branch %s for hits \n",branchname);
337   }  
338   
339   //Creating Branches for Digits
340   if (TreeD() && cD ) {
341     // one branch for digits per chamber
342     if (fDigits  == 0x0) {
343       fDigits  = new TObjArray(AliMUONConstants::NCh());
344       for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
345         fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane); 
346       }
347     }
348     if (fNdigits == 0x0) {
349       fNdigits = new Int_t[AliMUONConstants::NCh()];
350       for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
351         fNdigits[iDetectionPlane]=0;
352       }
353     }
354     for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
355       sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
356       branch = 0x0;
357       branch = TreeD()->GetBranch(branchname);
358       if (branch) {  
359         Info("MakeBranch","Branch %s is already in tree.",GetName());
360         return;
361       }
362       TClonesArray * digits = Digits(iDetectionPlane); 
363       branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
364       Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
365       }
366   }
367   
368   if (TreeR() && cRC ) {
369     //  one branch for raw clusters per tracking detection plane
370     //        
371     Int_t i;
372     if (fRawClusters == 0x0) {
373       fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
374       for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
375         fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",1000),i); 
376       }
377     }
378
379     if (fNrawclusters == 0x0) {
380       fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
381       for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
382         fNrawclusters[i]=0;
383       }
384     }
385     
386     for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
387       sprintf(branchname,"%sRawClusters%d",GetName(),i+1);      
388       branch = 0x0;
389       branch = TreeR()->GetBranch(branchname);
390       if (branch) {  
391         Info("MakeBranch","Branch %s is already in tree.",GetName());
392         return;
393       }
394       branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
395       Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
396     }
397   }
398
399   if (TreeR() && cGLT ) {
400     //
401     // one branch for global trigger
402     //
403     sprintf(branchname,"%sGlobalTrigger",GetName());
404     branch = 0x0;
405     
406     if (fGlobalTrigger == 0x0) {
407       fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger"); 
408       fNglobaltrigger = 0;
409     }
410     branch = TreeR()->GetBranch(branchname);
411     if (branch) {  
412       Info("MakeBranch","Branch %s is already in tree.",GetName());
413       return ;
414     }
415     branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
416     Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
417     
418     //
419     // one branch for local trigger
420     //  
421     sprintf(branchname,"%sLocalTrigger",GetName());
422     branch = 0x0;
423     
424     if (fLocalTrigger == 0x0) {
425       fLocalTrigger  = new TClonesArray("AliMUONLocalTrigger",234);
426       fNlocaltrigger = 0;
427     }
428     branch = TreeR()->GetBranch(branchname);
429     if (branch) {  
430       Info("MakeBranch","Branch %s is already in tree.",GetName());
431       return;
432     }
433     branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
434     Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);  
435   }
436   
437   if (TreeT() && cRT ) {
438     if (fRecTracks == 0x0)  fRecTracks = new TClonesArray("AliMUONTrack",100);
439     fNrectracks = 0;
440     sprintf(branchname,"%sTrack",GetName());  
441     branch = TreeT()->GetBranch(branchname);
442     if (branch) {  
443       Info("MakeBranch","Branch %s is already in tree.",GetName());
444       return ;
445     }
446     branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
447     Info("MakeBranch","Making Branch %s for tracks \n",branchname);
448   }  
449
450   if (TreeP() && cRP ) {
451     Info("MakeBranch","Making Branch for TreeP is not yet ready. \n");
452   }
453 }
454 //____________________________________________________________________________
455 TClonesArray*  AliMUONData::RawClusters(Int_t DetectionPlane)
456 {
457   // Getting Raw Clusters
458   if (fRawClusters) 
459     return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
460   else
461     return NULL;
462 }
463 //____________________________________________________________________________
464 void AliMUONData::ResetDigits()
465 {
466     //
467     // Reset number of digits and the digits array for this detector
468     //
469     if (fDigits == 0x0) return;
470     for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
471       if ((*fDigits)[i])    ((TClonesArray*)fDigits->At(i))->Clear();
472       if (fNdigits)  fNdigits[i]=0;
473     }
474 }
475 //______________________________________________________________________________
476 void AliMUONData::ResetHits()
477 {
478   // Reset number of clusters and the cluster array for this detector
479   fNhits   = 0;
480   if (fHits) fHits->Clear();
481 }
482 //_______________________________________________________________________________
483 void AliMUONData::ResetRawClusters()
484 {
485     // Reset number of raw clusters and the raw clust array for this detector
486     //
487   for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
488     if ((*fRawClusters)[i])    ((TClonesArray*)fRawClusters->At(i))->Clear();
489     if (fNrawclusters)  fNrawclusters[i]=0;
490   }
491 }
492 //_______________________________________________________________________________
493 void AliMUONData::ResetTrigger()
494 {
495   //  Reset Local and Global Trigger 
496   fNglobaltrigger = 0;
497   if (fGlobalTrigger) fGlobalTrigger->Clear();
498   fNlocaltrigger = 0;
499   if (fLocalTrigger) fLocalTrigger->Clear();
500 }
501 //____________________________________________________________________________
502 void AliMUONData::ResetRecTracks()
503 {
504   // Reset tracks information
505   fNrectracks = 0;
506   if (fRecTracks) fRecTracks->Clear();
507 }
508 //_____________________________________________________________________________
509 void AliMUONData::SetTreeAddress(Option_t* option)
510 {
511   //Setting Addresses to the events trees
512   const char *cH   = strstr(option,"H");
513   const char *cD   = strstr(option,"D");   // Digits branches in TreeD
514   const char *cRC  = strstr(option,"RC");  // RawCluster branches in TreeR
515   const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
516   const char *cRT  = strstr(option,"RT");  // Reconstructed Track in TreeT
517   //const char *cRP  = strstr(option,"RP");  // Reconstructed Particle in TreeP
518   
519   // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
520   char branchname[30];
521   TBranch * branch = 0x0;
522
523   //
524   // Branch address for hit tree
525   if ( TreeH() && cH ) {
526     if (fHits == 0x0) fHits     = new TClonesArray("AliMUONHit",1000);
527     fNhits =0;
528   } 
529   if (TreeH() && fHits && cH) {
530     sprintf(branchname,"%sHits",GetName());  
531     branch = TreeH()->GetBranch(branchname);
532     if (branch) {
533       //      Info("SetTreeAddress","(%s) Setting for Hits",GetName());
534       branch->SetAddress(&fHits);
535     }
536     else { //can be invoked before branch creation
537       Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
538     }
539   }
540   
541   //
542   // Branch address for digit tree
543   if ( TreeD() && cD) {
544     if (fDigits == 0x0) { 
545       fDigits = new TObjArray(AliMUONConstants::NCh());
546       fNdigits= new Int_t[AliMUONConstants::NCh()];
547       for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
548         fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i); 
549         fNdigits[i]=0;
550       }
551     }
552   }
553
554   if (TreeD() && fDigits && cD) {
555     for (int i=0; i<AliMUONConstants::NCh(); i++) {
556       sprintf(branchname,"%sDigits%d",GetName(),i+1);
557       if (fDigits) {
558         branch = TreeD()->GetBranch(branchname);
559         TClonesArray * digits = Digits(i);
560         if (branch) branch->SetAddress( &digits );
561         else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
562       }
563     }
564   }
565   
566   //
567   // Branch address for rawclusters, globaltrigger and local trigger tree
568   if (TreeR() ) {
569     if (fRawClusters == 0x0 && cRC) {
570       fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
571       fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
572       for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
573         fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); 
574         fNrawclusters[i]=0;
575       }
576     }
577     if (fLocalTrigger == 0x0 && cGLT) {
578       fLocalTrigger  = new TClonesArray("AliMUONLocalTrigger",234);
579     }
580     if (fGlobalTrigger== 0x0 && cGLT) {
581         fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); 
582     }
583
584   }
585   if ( TreeR()  && fRawClusters && cRC) {
586     for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
587       sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
588       if (fRawClusters) {
589         branch = TreeR()->GetBranch(branchname);
590         if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
591         else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
592       }
593     }
594   }
595   if ( TreeR()  && fLocalTrigger && cGLT) {
596     sprintf(branchname,"%sLocalTrigger",GetName());
597     branch = TreeR()->GetBranch(branchname);
598     if (branch) branch->SetAddress(&fLocalTrigger);
599     else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
600   }
601   if ( TreeR() && fGlobalTrigger && cGLT) {
602     sprintf(branchname,"%sGlobalTrigger",GetName());
603     branch = TreeR()->GetBranch(branchname);
604     if (branch) branch->SetAddress(&fGlobalTrigger);
605     else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
606   }
607
608   if ( TreeT() ) {
609     if (fRecTracks == 0x0 && cRT )  {
610       fRecTracks  = new TClonesArray("AliMUONTrack",100);
611     }
612   }
613   if ( TreeT() && fRecTracks && cRT ) {
614     sprintf(branchname,"%sTrack",GetName());  
615     branch = TreeT()->GetBranch(branchname);
616     if (branch) branch->SetAddress(&fRecTracks);
617     else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
618   }
619 }
620 //_____________________________________________________________________________