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