]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUON.cxx
Fixing non initialised data member
[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 /* $Id$ */
17
18
19 ///////////////////////////////////////////////
20 //  Manager and hits classes for set:MUON     //
21 ////////////////////////////////////////////////
22
23 #include "Riostream.h"
24
25 #include <AliPDG.h>
26 #include <TBRIK.h>
27 #include <TCanvas.h>
28 #include <TDirectory.h>
29 #include <TFile.h>
30 #include <TGeometry.h>
31 #include <TMinuit.h>
32 #include <TNode.h> 
33 #include <TNtuple.h>
34 #include <TObjArray.h>
35 #include <TObject.h>
36 #include <TObjectTable.h>
37 #include <TPad.h>
38 #include <TParticle.h>
39 #include <TROOT.h>
40 #include <TRandom.h> 
41 #include <TRotMatrix.h>
42 #include <TTUBE.h>
43 #include <TTUBE.h>
44 #include <TTree.h> 
45 #include <TVector.h>
46 #include <TVirtualMC.h>
47
48 #include "AliConst.h" 
49 #include "AliHeader.h"
50 #include "AliHitMap.h"
51 #include "AliLoader.h"
52 #include "AliMUONLoader.h"
53 #include "AliMUON.h"
54 #include "AliMUONChamberTrigger.h"
55 #include "AliMUONClusterFinderVS.h"
56 #include "AliMUONClusterInput.h"
57 #include "AliMUONConstants.h"
58 #include "AliMUONDigit.h"
59 #include "AliMUONGlobalTrigger.h"
60 #include "AliMUONHit.h"
61 #include "AliMUONHitMapA1.h"
62 #include "AliMUONLocalTrigger.h"
63 #include "AliMUONMerger.h"      
64 #include "AliMUONPadHit.h"
65 #include "AliMUONRawCluster.h"
66 #include "AliMUONTransientDigit.h"
67 #include "AliMUONTriggerCircuit.h"
68 #include "AliMUONTriggerDecision.h"
69 #include "AliRun.h"     
70
71
72 // Defaults parameters for Z positions of chambers
73 // taken from values for "stations" in AliMUON::AliMUON
74 //     const Float_t zch[7]={528, 690., 975., 1249., 1449., 1610, 1710.};
75 // and from array "dstation" in AliMUONv1::CreateGeometry
76 //          Float_t dstation[5]={20., 20., 20, 20., 20.};
77 //     for tracking chambers,
78 //          according to (Z1 = zch - dstation) and  (Z2 = zch + dstation)
79 //          for the first and second chambers in the station, respectively,
80 // and from "DTPLANES" in AliMUONv1::CreateGeometry
81 //           const Float_t DTPLANES = 15.;
82 //     for trigger chambers,
83 //          according to (Z1 = zch) and  (Z2 = zch + DTPLANES)
84 //          for the first and second chambers in the station, respectively
85
86 ClassImp(AliMUON)
87 //__________________________________________________________________
88 AliMUON::AliMUON()
89 {
90 // Default Constructor
91 //
92     fNCh             = 0;
93     fNTrackingCh     = 0;
94     fIshunt          = 0;
95     fChambers        = 0;
96     fTriggerCircuits = 0;
97     fAccMin          = 0.;
98     fAccMax          = 0.;   
99     fAccCut          = kFALSE;
100     fMerger          = 0;
101     fFileName        = 0;
102     fMUONData        = 0;
103 }
104 //__________________________________________________________________
105 AliMUON::AliMUON(const char *name, const char *title)
106   : AliDetector(name,title)
107 {
108 //Begin_Html
109 /*
110 <img src="gif/alimuon.gif">
111 */
112 //End_Html
113   fMUONData  = 0x0;
114   fIshunt     =  0;
115
116   fNCh             = AliMUONConstants::NCh(); 
117   fNTrackingCh     = AliMUONConstants::NTrackingCh();
118
119   SetMarkerColor(kRed);//
120 //
121 // Creating List of Chambers
122     Int_t ch;
123     fChambers = new TObjArray(AliMUONConstants::NCh());
124     // Loop over stations
125     for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
126       // Loop over 2 chambers in the station
127       for (Int_t stCH = 0; stCH < 2; stCH++) {
128         //
129         //    
130         //    Default Parameters for Muon Tracking Stations
131         ch = 2 * st + stCH;
132         if (ch < AliMUONConstants::NTrackingCh()) {
133           fChambers->AddAt(new AliMUONChamber(ch),ch);
134         } else {
135           fChambers->AddAt(new AliMUONChamberTrigger(ch),ch);
136         }
137         AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch);
138         chamber->SetGid(0);
139         // Default values for Z of chambers
140         chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
141         //
142         chamber->InitGeo(AliMUONConstants::DefaultChamberZ(ch));
143         //          Set chamber inner and outer radius to default
144         chamber->SetRInner(AliMUONConstants::Dmin(st)/2);
145         chamber->SetROuter(AliMUONConstants::Dmax(st)/2);
146         //
147       } // Chamber stCH (0, 1) in 
148     }     // Station st (0...)
149     
150     fMaxStepGas=0.01; 
151     fMaxStepAlu=0.1; 
152     fMaxDestepGas=-1;
153     fMaxDestepAlu=-1;
154     
155     fMaxIterPad   = 0;
156     fCurIterPad   = 0;
157     
158     fAccMin          = 0.;
159     fAccMax          = 0.;   
160     fAccCut          = kFALSE;
161     
162     // cp new design of AliMUONTriggerDecision
163     fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
164     for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
165       fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);          
166     }
167     fMerger = 0;
168 }
169 //____________________________________________________________________
170 AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON)
171 {
172 // Dummy copy constructor
173     ;
174     
175 }
176 //____________________________________________________________________
177 AliMUON::~AliMUON()
178 {
179 // Destructor
180   if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName());
181   fIshunt  = 0;
182   if (fMerger) delete fMerger;
183 }
184 //____________________________________________________________________
185 void AliMUON::BuildGeometry()
186 {
187 // Geometry for event display
188   for (Int_t i=0; i<7; i++) {
189     for (Int_t j=0; j<2; j++) {
190       Int_t id=2*i+j+1;
191       this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
192     }
193   }
194 }
195 //___________________________________________________________________
196 Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
197 {
198   return 9999;
199 }
200 //__________________________________________________________________
201 void  AliMUON::SetTreeAddress()
202 {
203   GetMUONData()->SetLoader(fLoader); 
204   GetMUONData()->SetTreeAddress("H,D,RC");
205 }
206
207 //____________________________________________________________________
208 void AliMUON::SetPadSize(Int_t id, Int_t isec, Float_t p1, Float_t p2)
209 {
210 // Set the pad size for chamber id and cathode isec
211     Int_t i=2*(id-1);
212     ((AliMUONChamber*) fChambers->At(i))  ->SetPadSize(isec,p1,p2);
213     ((AliMUONChamber*) fChambers->At(i+1))->SetPadSize(isec,p1,p2);
214 }
215
216 //___________________________________________
217 void AliMUON::SetChambersZ(const Float_t *Z)
218 {
219   // Set Z values for all chambers (tracking and trigger)
220   // from the array pointed to by "Z"
221     for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++)
222         ((AliMUONChamber*) fChambers->At(ch))->SetZ(Z[ch]);
223     return;
224 }
225 //_________________________________________________________________
226 void AliMUON::SetChambersZToDefault()
227 {
228   // Set Z values for all chambers (tracking and trigger)
229   // to default values
230   SetChambersZ(AliMUONConstants::DefaultChamberZ());
231   return;
232 }
233 //_________________________________________________________________
234 void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
235 {
236 // Set the inverse charge slope for chamber id
237     Int_t i=2*(id-1);    //PH    ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
238     //PH    ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
239     ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1);
240     ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSlope(p1);
241 }
242 //__________________________________________________________________
243 void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
244 {
245 // Set sigma of charge spread for chamber id
246     Int_t i=2*(id-1);
247     ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
248     ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2);
249 }
250 //___________________________________________________________________
251 void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
252 {
253 // Set integration limits for charge spread
254     Int_t i=2*(id-1);
255     ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1);
256     ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1);
257 }
258
259 //__________________________________________________________________
260 void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
261 {
262 // Set maximum number for ADCcounts (saturation)
263     Int_t i=2*(id-1);
264     ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
265     ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
266 }
267 //__________________________________________________________________
268 void AliMUON::SetMaxStepGas(Float_t p1)
269 {
270 // Set stepsize in gas
271   fMaxStepGas=p1;
272 }
273 //__________________________________________________________________
274 void AliMUON::SetMaxStepAlu(Float_t p1)
275 {
276 // Set step size in Alu
277     fMaxStepAlu=p1;
278 }
279 //__________________________________________________________________
280 void AliMUON::SetMaxDestepGas(Float_t p1)
281 {
282 // Set maximum step size in Gas
283     fMaxDestepGas=p1;
284 }
285 //__________________________________________________________________
286 void AliMUON::SetMaxDestepAlu(Float_t p1)
287 {
288 // Set maximum step size in Alu
289   fMaxDestepAlu=p1;
290 }
291 //___________________________________________________________________
292 void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
293 {
294 // Set acceptance cuts 
295   fAccCut=acc;
296   fAccMin=angmin*TMath::Pi()/180;
297   fAccMax=angmax*TMath::Pi()/180;
298   Int_t ch;
299   if (acc) {
300     for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
301       // Loop over 2 chambers in the station
302       for (Int_t stCH = 0; stCH < 2; stCH++) {
303         ch = 2 * st + stCH;
304         //         Set chamber inner and outer radius according to acceptance cuts
305         Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin));
306         Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax));
307       } // chamber loop
308     } // station loop
309   }
310 }
311 //____________________________________________________________________
312 void   AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
313 {
314 // Set the segmentation for chamber id cathode isec
315     ((AliMUONChamber*) fChambers->At(id))->SetSegmentationModel(isec, segmentation);
316
317 }
318 //____________________________________________________________________
319 void   AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
320 {
321 // Set the response for chamber id
322     ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
323 }
324 //____________________________________________________________________
325 void   AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
326 {
327 // Set ClusterFinder for chamber id
328     ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
329 }
330 //____________________________________________________________________
331 void   AliMUON::SetNsec(Int_t id, Int_t nsec)
332 {
333 // Set number of segmented cathods for chamber id
334     ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec);
335 }
336 //_____________________________________________________________________
337 void AliMUON::SDigits2Digits()
338 {
339
340 // write TreeD here 
341
342     if (!fMerger) {
343       if (gAlice->GetDebug()>0) {
344         cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl;
345         cerr<<" no merging, just digitization of 1 event will be done"<<endl;
346       }
347       fMerger = new AliMUONMerger();
348     }
349     fMerger->Init();
350     fMerger->Digitise();
351     char hname[30];
352     //    sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent());
353     fLoader->TreeD()->Write(hname,TObject::kOverwrite);
354     fLoader->TreeD()->Reset();
355 }
356
357 //_______________________________________________________________________
358 AliLoader* AliMUON::MakeLoader(const char* topfoldername)
359
360 //builds standard getter (AliLoader type)
361 //if detector wants to use castomized getter, it must overload this method
362
363  if (GetDebug())
364    Info("MakeLoader",
365         "Creating standard getter for detector %s. Top folder is %s.",
366          GetName(),topfoldername);
367      
368  fLoader   = new AliLoader(GetName(),topfoldername);
369  fMUONData = new AliMUONData(fLoader,GetName(),GetName()); 
370  return fLoader;
371 }
372
373 //_______________________________________________________________________
374 void AliMUON::Trigger(Int_t nev){
375 // call the Trigger Algorithm and fill TreeR
376
377   Int_t singlePlus[3]  = {0,0,0}; 
378   Int_t singleMinus[3] = {0,0,0}; 
379   Int_t singleUndef[3] = {0,0,0};
380   Int_t pairUnlike[3]  = {0,0,0}; 
381   Int_t pairLike[3]    = {0,0,0};
382   
383   ResetTrigger();
384   AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
385   decision->Trigger();   
386   decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef,
387                              pairUnlike, pairLike);
388   
389   // add a local trigger in the list 
390   GetMUONData()->AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
391   Int_t i;
392   
393   for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) { 
394     if(decision->GetITrigger(icirc)==1) {
395       Int_t localtr[7]={0,0,0,0,0,0,0};      
396       Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0};
397       decision->GetLutOutput(icirc, loLpt, loHpt, loApt);
398       localtr[0] = icirc;
399       localtr[1] = decision->GetStripX11(icirc);
400       localtr[2] = decision->GetDev(icirc);
401       localtr[3] = decision->GetStripY11(icirc);
402       for (i=0; i<2; i++) {    // convert the Lut output in 1 digit 
403         localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i));
404         localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i));
405         localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i));
406       }
407       GetMUONData()->AddLocalTrigger(localtr);  // add a local trigger in the list
408     }
409   }
410   
411   delete decision;
412
413   //  fLoader->TreeR()->Fill();
414   GetMUONData()->Fill("GLT"); //Filling Global and Local Trigger GLT
415   //  char hname[30];
416   //  sprintf(hname,"TreeR%d",nev);
417   //  fLoader->TreeR()->Write(hname,TObject::kOverwrite);
418     //  fLoader->TreeR()->Reset();
419   fLoader->WriteRecPoints("OVERWRITE");
420   
421   printf("\n End of trigger for event %d", nev);
422 }
423
424 //____________________________________________________________________
425 void AliMUON::Digits2Reco()
426 {
427   FindClusters();
428   Int_t nev = gAlice->GetHeader()->GetEvent();
429   GetMUONData()->Fill("RC"); //Filling Reconstructed Cluster
430   fLoader->WriteRecPoints("OVERWRITE");
431   GetMUONData()->ResetRawClusters();        
432   Info("Digits2Reco","End of cluster finding for event %d", nev);
433 }
434 //____________________________________________________________________
435 void AliMUON::FindClusters()
436 {
437 //
438 //  Perform cluster finding
439 //
440     TClonesArray *dig1, *dig2;
441     Int_t ndig, k;
442     dig1 = new TClonesArray("AliMUONDigit",1000);
443     dig2 = new TClonesArray("AliMUONDigit",1000);
444     AliMUONDigit *digit;
445 // Loop on chambers and on cathode planes
446 //
447     ResetRawClusters();        
448     TClonesArray * muonDigits;
449
450     for (Int_t ich = 0; ich < 10; ich++) {
451       //PH      AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich];
452         AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
453         AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
454     
455         ResetDigits();
456         GetMUONData()->GetCathode(0);
457         //TClonesArray *
458         muonDigits = GetMUONData()->Digits(ich); 
459         ndig=muonDigits->GetEntriesFast();
460         printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich);
461         TClonesArray &lhits1 = *dig1;
462         Int_t n = 0;
463         for (k = 0; k < ndig; k++) {
464             digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
465             if (rec->TestTrack(digit->Track(0)))
466                 new(lhits1[n++]) AliMUONDigit(*digit);
467         }
468         GetMUONData()->ResetDigits();
469         GetMUONData()->GetCathode(1);
470         muonDigits =  GetMUONData()->Digits(ich);  
471         ndig=muonDigits->GetEntriesFast();
472         printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich);
473         TClonesArray &lhits2 = *dig2;
474         n=0;
475         
476         for (k=0; k<ndig; k++) {
477             digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
478             if (rec->TestTrack(digit->Track(0)))
479             new(lhits2[n++]) AliMUONDigit(*digit);
480         }
481
482         if (rec) {       
483             AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
484             rec->FindRawClusters();
485         }
486         dig1->Delete();
487         dig2->Delete();
488     } // for ich
489     delete dig1;
490     delete dig2;
491 }
492 //______________________________________________________________________
493 #ifdef never
494 void AliMUON::Streamer(TBuffer &R__b)_
495 {
496    // Stream an object of class AliMUON.
497       AliMUONChamber        *iChamber;
498       AliMUONTriggerCircuit *iTriggerCircuit;
499       AliSegmentation       *segmentation;
500       AliMUONResponse       *response;
501       TClonesArray          *digitsaddress;
502       TClonesArray          *rawcladdress;
503       Int_t i;
504       if (R__b.IsReading()) {
505           Version_t R__v = R__b.ReadVersion(); if (R__v) { }
506           AliDetector::Streamer(R__b);
507           R__b >> fNPadHits;
508           R__b >> fPadHits; // diff
509           R__b >> fNLocalTrigger;       
510           R__b >> fLocalTrigger;       
511           R__b >> fNGlobalTrigger;       
512           R__b >> fGlobalTrigger;   
513           R__b >> fDchambers;
514           R__b >> fRawClusters;
515           R__b.ReadArray(fNdch);
516           R__b.ReadArray(fNrawch);
517           R__b >> fAccCut;
518           R__b >> fAccMin;
519           R__b >> fAccMax; 
520           R__b >> fChambers;
521           R__b >> fTriggerCircuits;
522           for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
523               iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
524               iTriggerCircuit->Streamer(R__b);
525           }
526 // Stream chamber related information
527           for (i =0; i<AliMUONConstants::NCh(); i++) {
528               iChamber=(AliMUONChamber*) (*fChambers)[i];
529               iChamber->Streamer(R__b);
530               if (iChamber->Nsec()==1) {
531                   segmentation=iChamber->SegmentationModel(1);
532                   if (segmentation)
533                       segmentation->Streamer(R__b);
534               } else {
535                   segmentation=iChamber->SegmentationModel(1);
536                   if (segmentation)
537                       segmentation->Streamer(R__b);
538                   if (segmentation)
539                       segmentation=iChamber->SegmentationModel(2);
540                   segmentation->Streamer(R__b);
541               }
542               response=iChamber->ResponseModel();
543               if (response)
544                   response->Streamer(R__b);       
545               digitsaddress=(TClonesArray*) (*fDchambers)[i];
546               digitsaddress->Streamer(R__b);
547               if (i < AliMUONConstants::NTrackingCh()) {
548                   rawcladdress=(TClonesArray*) (*fRawClusters)[i];
549                   rawcladdress->Streamer(R__b);
550               }
551           }
552           
553       } else {
554           R__b.WriteVersion(AliMUON::IsA());
555           AliDetector::Streamer(R__b);
556           R__b << fNPadHits;
557           R__b << fPadHits; // diff
558           R__b << fNLocalTrigger;       
559           R__b << fLocalTrigger;       
560           R__b << fNGlobalTrigger;       
561           R__b << fGlobalTrigger; 
562           R__b << fDchambers;
563           R__b << fRawClusters;
564           R__b.WriteArray(fNdch, AliMUONConstants::NCh());
565           R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh());
566           
567           R__b << fAccCut;
568           R__b << fAccMin;
569           R__b << fAccMax; 
570           
571           R__b << fChambers;
572           R__b << fTriggerCircuits;
573           for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
574               iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
575               iTriggerCircuit->Streamer(R__b);
576           }
577           for (i =0; i<AliMUONConstants::NCh(); i++) {
578               iChamber=(AliMUONChamber*) (*fChambers)[i];
579               iChamber->Streamer(R__b);
580               if (iChamber->Nsec()==1) {
581                   segmentation=iChamber->SegmentationModel(1);
582                   if (segmentation)
583                       segmentation->Streamer(R__b);
584               } else {
585                   segmentation=iChamber->SegmentationModel(1);
586                   if (segmentation)
587                       segmentation->Streamer(R__b);
588                   segmentation=iChamber->SegmentationModel(2);
589                   if (segmentation)
590                       segmentation->Streamer(R__b);
591               }
592               response=iChamber->ResponseModel();
593               if (response)
594                   response->Streamer(R__b);
595               digitsaddress=(TClonesArray*) (*fDchambers)[i];
596               digitsaddress->Streamer(R__b);
597               if (i < AliMUONConstants::NTrackingCh()) {
598                   rawcladdress=(TClonesArray*) (*fRawClusters)[i];
599                   rawcladdress->Streamer(R__b);
600               }
601           }
602       }
603 }
604 #endif
605 //_______________________________________________________________________
606 AliMUONPadHit* AliMUON::FirstPad(AliMUONHit*  hit, TClonesArray *clusters) 
607 {
608 // to be removed
609     // Initialise the pad iterator
610     // Return the address of the first padhit for hit
611     TClonesArray *theClusters = clusters;
612     Int_t nclust = theClusters->GetEntriesFast();
613     if (nclust && hit->PHlast() > 0) {
614         AliMUON::fMaxIterPad=hit->PHlast();
615         AliMUON::fCurIterPad=hit->PHfirst();
616         return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
617     } else {
618         return 0;
619     }
620 }
621 //_______________________________________________________________________
622 AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters) 
623 {
624   // To be removed
625 // Get next pad (in iterator) 
626 //
627     AliMUON::fCurIterPad++;
628     if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
629         return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
630     } else {
631         return 0;
632     }
633 }
634 //_______________________________________________________________________
635
636 AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
637 {
638 //
639 //  Return rawcluster (icluster) for chamber ichamber and cathode icathod
640 //  Obsolete ??
641     TClonesArray *muonRawCluster  = GetMUONData()->RawClusters(ichamber);
642     ResetRawClusters();
643     TTree *treeR = fLoader->TreeR();
644     Int_t nent=(Int_t)treeR->GetEntries();
645     treeR->GetEvent(nent-2+icathod-1);
646     //treeR->GetEvent(icathod);
647     //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
648
649     AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
650     //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
651     
652     return  mRaw;
653 }
654 //________________________________________________________________________
655 void   AliMUON::SetMerger(AliMUONMerger* merger)
656 {
657 // Set pointer to merger 
658     fMerger = merger;
659 }
660 //________________________________________________________________________
661 AliMUONMerger*  AliMUON::Merger()
662 {
663 // Return pointer to merger
664     return fMerger;
665 }
666 //________________________________________________________________________
667 AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/)
668 {
669 // copy operator
670 // dummy version
671     return *this;
672 }
673