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