Logging of Debug, Info and Error Messages follwing AliRoot Standard http://aliweb...
[u/mrichter/AliRoot.git] / MUON / AliMUON.cxx
index 3250619..74f787d 100644 (file)
 #include <TVector.h>
 #include <TVirtualMC.h>
 
-#include "AliConst.h" 
-#include "AliHeader.h"
-#include "AliHitMap.h"
+//#include "AliHeader.h"
 #include "AliLoader.h"
-#include "AliMUONLoader.h"
+#include "AliRunDigitizer.h"
+#include "AliMC.h"
+#include "AliRun.h"    
 #include "AliMUON.h"
 #include "AliMUONChamberTrigger.h"
-#include "AliMUONClusterFinderVS.h"
-#include "AliMUONClusterInput.h"
 #include "AliMUONConstants.h"
-#include "AliMUONDigit.h"
-#include "AliMUONGlobalTrigger.h"
 #include "AliMUONHit.h"
-#include "AliMUONHitMapA1.h"
-#include "AliMUONLocalTrigger.h"
 #include "AliMUONMerger.h"     
 #include "AliMUONPadHit.h"
 #include "AliMUONRawCluster.h"
 #include "AliMUONTransientDigit.h"
 #include "AliMUONTriggerCircuit.h"
-#include "AliMUONTriggerDecision.h"
-#include "AliRun.h"    
-
+#include "AliMUONGeometryBuilder.h"
+#include "AliMUONVGeometryBuilder.h"   
+#include "AliMUONDigitizerv2.h"
+#include "AliMUONSDigitizerv1.h"
+#include "AliMUONRawData.h"
+#include "AliLog.h"
 
 // Defaults parameters for Z positions of chambers
 // taken from values for "stations" in AliMUON::AliMUON
 //          for the first and second chambers in the station, respectively
 
 ClassImp(AliMUON)
+
 //__________________________________________________________________
 AliMUON::AliMUON()
+  : AliDetector(),
+    fNCh(0),
+    fNTrackingCh(0),
+    fMUONData(0),
+    fSplitLevel(0),
+    fChambers(0),
+    fTriggerCircuits(0),
+    fGeometryBuilder(0),
+    fAccCut(kFALSE),
+    fAccMin(0.),
+    fAccMax(0.),   
+    fMaxStepGas(0.),
+    fMaxStepAlu(0.),
+    fMaxDestepGas(0.),
+    fMaxDestepAlu(0.),
+    fMaxIterPad(0),
+    fCurIterPad(0),
+    fMerger(0)
 {
 // Default Constructor
 //
-    fNCh             = 0;
-    fNTrackingCh     = 0;
     fIshunt          = 0;
-    fChambers        = 0;
-    fTriggerCircuits = 0;
-    fAccMin          = 0.;
-    fAccMax          = 0.;   
-    fAccCut          = kFALSE;
-    fMerger          = 0;
-    fFileName        = 0;
 }
+
 //__________________________________________________________________
 AliMUON::AliMUON(const char *name, const char *title)
-  : AliDetector(name,title)
+  : AliDetector(name,title),
+    fNCh(AliMUONConstants::NCh()),
+    fNTrackingCh(AliMUONConstants::NTrackingCh()),
+    fMUONData(0),
+    fSplitLevel(0),
+    fChambers(0),
+    fTriggerCircuits(0),
+    fGeometryBuilder(0),
+    fAccCut(kFALSE),
+    fAccMin(0.),
+    fAccMax(0.),   
+    fMaxStepGas(0.1),
+    fMaxStepAlu(0.1),
+    fMaxDestepGas(-1), // Negatives values are ignored by geant3 CONS200 
+    fMaxDestepAlu(-1), // in the calculation of the tracking parameters
+    fMaxIterPad(0),
+    fCurIterPad(0),
+    fMerger(0)
 {
-//Begin_Html
-/*
-<img src="gif/alimuon.gif">
-*/
-//End_Html
-  fMUONData  = 0x0;
-  fIshunt     =  0;
 
-  fNCh             = AliMUONConstants::NCh(); 
-  fNTrackingCh     = AliMUONConstants::NTrackingCh();
+  fIshunt =  0;
 
   SetMarkerColor(kRed);//
 //
 // Creating List of Chambers
     Int_t ch;
     fChambers = new TObjArray(AliMUONConstants::NCh());
+
     // Loop over stations
     for (Int_t st = 0; st < AliMUONConstants::NCh() / 2; st++) {
       // Loop over 2 chambers in the station
@@ -134,7 +152,7 @@ AliMUON::AliMUON(const char *name, const char *title)
          fChambers->AddAt(new AliMUONChamberTrigger(ch),ch);
        }
        AliMUONChamber* chamber = (AliMUONChamber*) fChambers->At(ch);
-       chamber->SetGid(0);
+       //chamber->SetGid(0);
        // Default values for Z of chambers
        chamber->SetZ(AliMUONConstants::DefaultChamberZ(ch));
        //
@@ -146,61 +164,94 @@ AliMUON::AliMUON(const char *name, const char *title)
       } // Chamber stCH (0, 1) in 
     }     // Station st (0...)
     
-    fMaxStepGas=0.01; 
-    fMaxStepAlu=0.1; 
-    fMaxDestepGas=-1;
-    fMaxDestepAlu=-1;
-    
-    fMaxIterPad   = 0;
-    fCurIterPad   = 0;
-    
-    fAccMin          = 0.;
-    fAccMax          = 0.;   
-    fAccCut          = kFALSE;
-    
     // cp new design of AliMUONTriggerDecision
     fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
     for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
       fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);          
     }
-    fMerger = 0;
+    
+    // Geometry builder
+    fGeometryBuilder = new AliMUONGeometryBuilder(this);
 }
+
 //____________________________________________________________________
-AliMUON::AliMUON(const AliMUON& rMUON):AliDetector(rMUON)
+AliMUON::AliMUON(const AliMUON& rMUON)
+ : AliDetector(rMUON)
 {
-// Dummy copy constructor
-    ;
-    
+// Protected copy constructor
+
+  AliFatal("Not implemented.");
 }
+
 //____________________________________________________________________
 AliMUON::~AliMUON()
 {
 // Destructor
-  if(fDebug) printf("%s: Calling AliMUON destructor !!!\n",ClassName());
+  AliDebug(1,"Calling AliMUON destructor");
   fIshunt  = 0;
   if (fMerger) delete fMerger;
+
+  if (fChambers){
+    fChambers->Delete();
+    delete fChambers;
+  }
+  if (fTriggerCircuits){
+    fTriggerCircuits->Delete();
+    delete fTriggerCircuits;
+  }
+  delete fMUONData;
+  delete fGeometryBuilder;
+}
+
+//________________________________________________________________________
+AliMUON& AliMUON::operator = (const AliMUON& rhs)
+{
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  AliFatal("Not implemented.");
+    
+  return *this;  
+}
+
+//_____________________________________________________________________________
+void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder)
+{
+// Adds the geometry builder to the list
+// ---
+
+  fGeometryBuilder->AddBuilder(geomBuilder);
 }
+
 //____________________________________________________________________
 void AliMUON::BuildGeometry()
 {
 // Geometry for event display
-  for (Int_t i=0; i<7; i++) {
-    for (Int_t j=0; j<2; j++) {
-      Int_t id=2*i+j+1;
-      this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
-    }
-  }
-}
-//___________________________________________________________________
-Int_t AliMUON::DistancetoPrimitive(Int_t , Int_t )
-{
-  return 9999;
+
+   for (Int_t i=0; i<7; i++) {
+     for (Int_t j=0; j<2; j++) {
+       Int_t id=2*i+j+1;
+       this->Chamber(id-1).SegmentationModel(1)->Draw("eventdisplay");
+     }
+   }
 }
+
 //__________________________________________________________________
 void  AliMUON::SetTreeAddress()
 {
   GetMUONData()->SetLoader(fLoader); 
-  GetMUONData()->SetTreeAddress("H,D,RC");
+  //  GetMUONData()->MakeBranch("D,S,RC");
+  //  GetMUONData()->SetTreeAddress("H,D,S,RC");
+  GetMUONData()->SetTreeAddress("H");
+  if (fHits !=  GetMUONData()->Hits())  {
+    if ( gAlice->GetMCApp() )
+      if ( gAlice->GetMCApp()->GetHitLists() ) {
+       fHits = GetMUONData()->Hits();
+       gAlice->GetMCApp()->AddHitList(fHits); // For purifyKine, only necessary when Hit list is created in AliMUONData
+      }  
+  }
+  fHits = GetMUONData()->Hits(); // Added by Ivana to use the methods FisrtHit, NextHit of AliDetector    
 }
 
 //____________________________________________________________________
@@ -263,6 +314,7 @@ void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
     ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
     ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
 }
+
 //__________________________________________________________________
 void AliMUON::SetMaxStepGas(Float_t p1)
 {
@@ -287,6 +339,7 @@ void AliMUON::SetMaxDestepAlu(Float_t p1)
 // Set maximum step size in Alu
   fMaxDestepAlu=p1;
 }
+
 //___________________________________________________________________
 void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
 {
@@ -301,12 +354,53 @@ void AliMUON::SetAcceptance(Bool_t acc, Float_t angmin, Float_t angmax)
       for (Int_t stCH = 0; stCH < 2; stCH++) {
        ch = 2 * st + stCH;
        //         Set chamber inner and outer radius according to acceptance cuts
-       Chamber(ch).SetRInner(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin));
-       Chamber(ch).SetROuter(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax));
+       Chamber(ch).SetRInner(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMin)));
+       Chamber(ch).SetROuter(TMath::Abs(AliMUONConstants::DefaultChamberZ(ch)*TMath::Tan(fAccMax)));
       } // chamber loop
     } // station loop
   }
 }
+
+//____________________________________________________________________
+Float_t  AliMUON::GetMaxStepGas() const
+{
+// Return stepsize in gas
+  
+  return fMaxStepGas;
+}  
+
+//____________________________________________________________________
+Float_t  AliMUON::GetMaxStepAlu() const
+{
+// Return step size in Alu
+  
+  return fMaxStepAlu;
+}
+  
+//____________________________________________________________________
+Float_t  AliMUON::GetMaxDestepGas() const
+{
+// Return maximum step size in Gas
+  
+  return fMaxDestepGas;
+}
+  
+//____________________________________________________________________
+Float_t  AliMUON::GetMaxDestepAlu() const
+{
+// Return maximum step size in Gas
+  
+  return fMaxDestepAlu;
+}
+
+//____________________________________________________________________
+ void  AliMUON::SetAlign(Bool_t align)
+ {
+ // Sets option for alignement to geometry builder
+   fGeometryBuilder->SetAlign(align);
+}   
+    
 //____________________________________________________________________
 void   AliMUON::SetSegmentationModel(Int_t id, Int_t isec, AliSegmentation *segmentation)
 {
@@ -321,17 +415,16 @@ void   AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
     ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
 }
 //____________________________________________________________________
-void   AliMUON::SetReconstructionModel(Int_t id, AliMUONClusterFinderVS *reconst)
-{
-// Set ClusterFinder for chamber id
-    ((AliMUONChamber*) fChambers->At(id))->SetReconstructionModel(reconst);
-}
-//____________________________________________________________________
 void   AliMUON::SetNsec(Int_t id, Int_t nsec)
 {
 // Set number of segmented cathods for chamber id
     ((AliMUONChamber*) fChambers->At(id))->SetNsec(nsec);
 }
+//____________________________________________________________________
+AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const
+{
+  return new AliMUONDigitizerv2(manager);
+}
 //_____________________________________________________________________
 void AliMUON::SDigits2Digits()
 {
@@ -339,11 +432,9 @@ void AliMUON::SDigits2Digits()
 // write TreeD here 
 
     if (!fMerger) {
-      if (gAlice->GetDebug()>0) {
-       cerr<<"AliMUON::SDigits2Digits: create default AliMUONMerger "<<endl;
-       cerr<<" no merging, just digitization of 1 event will be done"<<endl;
-      }
-      fMerger = new AliMUONMerger();
+               AliDebug(1,"Create default AliMUONMerger ");
+               AliDebug(1," no merging, just digitization of 1 event will be done");
+       fMerger = new AliMUONMerger();
     }
     fMerger->Init();
     fMerger->Digitise();
@@ -353,254 +444,46 @@ void AliMUON::SDigits2Digits()
     fLoader->TreeD()->Reset();
 }
 
+//_____________________________________________________________________
+void AliMUON::Hits2SDigits()
+{
+  // Adaption of AliMUONSDigitizerv1 to be excuted by the AliSimulation framework
+  AliRunLoader* runLoader = fLoader->GetRunLoader();
+  AliRunDigitizer   * manager = new AliRunDigitizer(1,1);
+  manager->SetInputStream(0,runLoader->GetFileName(),AliConfig::GetDefaultEventFolderName());
+  AliMUONDigitizer * dMUON   = new AliMUONSDigitizerv1(manager);
+  fLoader->LoadHits("READ");
+  for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
+    runLoader->GetEvent(iEvent);
+    dMUON->Exec("");
+  }
+  fLoader->UnloadHits();
+}
+//_____________________________________________________________________
+void AliMUON::Digits2Raw()
+{
+  // convert digits of the current event to raw data
+  AliMUONRawData* rawData;
+
+  rawData = new AliMUONRawData(fLoader);
+  if (!rawData->WriteRawData()) AliInfo("pb writting raw data");
+  delete rawData;
+  return;
+}
 //_______________________________________________________________________
 AliLoader* AliMUON::MakeLoader(const char* topfoldername)
 { 
 //builds standard getter (AliLoader type)
 //if detector wants to use castomized getter, it must overload this method
 
- if (GetDebug())
-   Info("MakeLoader",
-        "Creating standard getter for detector %s. Top folder is %s.",
-         GetName(),topfoldername);
-     
+ AliDebug(1,Form("Creating standard getter for detector %s. Top folder is %s.",
+         GetName(),topfoldername));
  fLoader   = new AliLoader(GetName(),topfoldername);
  fMUONData = new AliMUONData(fLoader,GetName(),GetName()); 
+ fMUONData->SetSplitLevel(fSplitLevel);
  return fLoader;
 }
-
-//_______________________________________________________________________
-void AliMUON::Trigger(Int_t nev){
-// call the Trigger Algorithm and fill TreeR
-
-  Int_t singlePlus[3]  = {0,0,0}; 
-  Int_t singleMinus[3] = {0,0,0}; 
-  Int_t singleUndef[3] = {0,0,0};
-  Int_t pairUnlike[3]  = {0,0,0}; 
-  Int_t pairLike[3]    = {0,0,0};
-  
-  ResetTrigger();
-  AliMUONTriggerDecision* decision= new AliMUONTriggerDecision(1);
-  decision->Trigger();   
-  decision->GetGlobalTrigger(singlePlus, singleMinus, singleUndef,
-                            pairUnlike, pairLike);
-  
-  // add a local trigger in the list 
-  GetMUONData()->AddGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
-  Int_t i;
-  
-  for (Int_t icirc=0; icirc<AliMUONConstants::NTriggerCircuit(); icirc++) { 
-    if(decision->GetITrigger(icirc)==1) {
-      Int_t localtr[7]={0,0,0,0,0,0,0};      
-      Int_t loLpt[2]={0,0}; Int_t loHpt[2]={0,0}; Int_t loApt[2]={0,0};
-      decision->GetLutOutput(icirc, loLpt, loHpt, loApt);
-      localtr[0] = icirc;
-      localtr[1] = decision->GetStripX11(icirc);
-      localtr[2] = decision->GetDev(icirc);
-      localtr[3] = decision->GetStripY11(icirc);
-      for (i=0; i<2; i++) {    // convert the Lut output in 1 digit 
-       localtr[4] = localtr[4]+Int_t(loLpt[i]*TMath::Power(2,i));
-       localtr[5] = localtr[5]+Int_t(loHpt[i]*TMath::Power(2,i));
-       localtr[6] = localtr[6]+Int_t(loApt[i]*TMath::Power(2,i));
-      }
-      GetMUONData()->AddLocalTrigger(localtr);  // add a local trigger in the list
-    }
-  }
-  
-  delete decision;
-
-  //  fLoader->TreeR()->Fill();
-  GetMUONData()->Fill("GLT"); //Filling Global and Local Trigger GLT
-  //  char hname[30];
-  //  sprintf(hname,"TreeR%d",nev);
-  //  fLoader->TreeR()->Write(hname,TObject::kOverwrite);
-    //  fLoader->TreeR()->Reset();
-  fLoader->WriteRecPoints("OVERWRITE");
-  
-  printf("\n End of trigger for event %d", nev);
-}
-
-//____________________________________________________________________
-void AliMUON::Digits2Reco()
-{
-  FindClusters();
-  Int_t nev = gAlice->GetHeader()->GetEvent();
-  GetMUONData()->Fill("RC"); //Filling Reconstructed Cluster
-  fLoader->WriteRecPoints("OVERWRITE");
-  GetMUONData()->ResetRawClusters();        
-  Info("Digits2Reco","End of cluster finding for event %d", nev);
-}
-//____________________________________________________________________
-void AliMUON::FindClusters()
-{
-//
-//  Perform cluster finding
-//
-    TClonesArray *dig1, *dig2;
-    Int_t ndig, k;
-    dig1 = new TClonesArray("AliMUONDigit",1000);
-    dig2 = new TClonesArray("AliMUONDigit",1000);
-    AliMUONDigit *digit;
-// Loop on chambers and on cathode planes
-//
-    ResetRawClusters();        
-    TClonesArray * muonDigits;
-
-    for (Int_t ich = 0; ich < 10; ich++) {
-      //PH     AliMUONChamber* iChamber = (AliMUONChamber*) (*fChambers)[ich];
-       AliMUONChamber* iChamber = (AliMUONChamber*) fChambers->At(ich);
-       AliMUONClusterFinderVS* rec = iChamber->ReconstructionModel();
-    
-       ResetDigits();
-       GetMUONData()->GetCathode(0);
-       //TClonesArray *
-       muonDigits = GetMUONData()->Digits(ich); 
-       ndig=muonDigits->GetEntriesFast();
-       printf("\n 1 Found %d digits in %p chamber %d", ndig, muonDigits,ich);
-       TClonesArray &lhits1 = *dig1;
-       Int_t n = 0;
-       for (k = 0; k < ndig; k++) {
-           digit = (AliMUONDigit*) muonDigits->UncheckedAt(k);
-           if (rec->TestTrack(digit->Track(0)))
-               new(lhits1[n++]) AliMUONDigit(*digit);
-       }
-       GetMUONData()->ResetDigits();
-       GetMUONData()->GetCathode(1);
-       muonDigits =  GetMUONData()->Digits(ich);  
-       ndig=muonDigits->GetEntriesFast();
-       printf("\n 2 Found %d digits in %p %d", ndig, muonDigits, ich);
-       TClonesArray &lhits2 = *dig2;
-       n=0;
-       
-       for (k=0; k<ndig; k++) {
-           digit= (AliMUONDigit*) muonDigits->UncheckedAt(k);
-           if (rec->TestTrack(digit->Track(0)))
-           new(lhits2[n++]) AliMUONDigit(*digit);
-       }
-
-       if (rec) {       
-           AliMUONClusterInput::Instance()->SetDigits(ich, dig1, dig2);
-           rec->FindRawClusters();
-       }
-       dig1->Delete();
-       dig2->Delete();
-    } // for ich
-    delete dig1;
-    delete dig2;
-}
-//______________________________________________________________________
-#ifdef never
-void AliMUON::Streamer(TBuffer &R__b)_
-{
-   // Stream an object of class AliMUON.
-      AliMUONChamber        *iChamber;
-      AliMUONTriggerCircuit *iTriggerCircuit;
-      AliSegmentation       *segmentation;
-      AliMUONResponse       *response;
-      TClonesArray          *digitsaddress;
-      TClonesArray          *rawcladdress;
-      Int_t i;
-      if (R__b.IsReading()) {
-         Version_t R__v = R__b.ReadVersion(); if (R__v) { }
-         AliDetector::Streamer(R__b);
-         R__b >> fNPadHits;
-         R__b >> fPadHits; // diff
-         R__b >> fNLocalTrigger;       
-         R__b >> fLocalTrigger;       
-         R__b >> fNGlobalTrigger;       
-         R__b >> fGlobalTrigger;   
-         R__b >> fDchambers;
-         R__b >> fRawClusters;
-         R__b.ReadArray(fNdch);
-         R__b.ReadArray(fNrawch);
-         R__b >> fAccCut;
-         R__b >> fAccMin;
-         R__b >> fAccMax; 
-         R__b >> fChambers;
-         R__b >> fTriggerCircuits;
-         for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
-             iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
-             iTriggerCircuit->Streamer(R__b);
-         }
-// Stream chamber related information
-         for (i =0; i<AliMUONConstants::NCh(); i++) {
-             iChamber=(AliMUONChamber*) (*fChambers)[i];
-             iChamber->Streamer(R__b);
-             if (iChamber->Nsec()==1) {
-                 segmentation=iChamber->SegmentationModel(1);
-                 if (segmentation)
-                     segmentation->Streamer(R__b);
-             } else {
-                 segmentation=iChamber->SegmentationModel(1);
-                 if (segmentation)
-                     segmentation->Streamer(R__b);
-                 if (segmentation)
-                     segmentation=iChamber->SegmentationModel(2);
-                 segmentation->Streamer(R__b);
-             }
-             response=iChamber->ResponseModel();
-             if (response)
-                 response->Streamer(R__b);       
-             digitsaddress=(TClonesArray*) (*fDchambers)[i];
-             digitsaddress->Streamer(R__b);
-             if (i < AliMUONConstants::NTrackingCh()) {
-                 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
-                 rawcladdress->Streamer(R__b);
-             }
-         }
-         
-      } else {
-         R__b.WriteVersion(AliMUON::IsA());
-         AliDetector::Streamer(R__b);
-         R__b << fNPadHits;
-         R__b << fPadHits; // diff
-         R__b << fNLocalTrigger;       
-         R__b << fLocalTrigger;       
-         R__b << fNGlobalTrigger;       
-         R__b << fGlobalTrigger; 
-         R__b << fDchambers;
-         R__b << fRawClusters;
-         R__b.WriteArray(fNdch, AliMUONConstants::NCh());
-         R__b.WriteArray(fNrawch, AliMUONConstants::NTrackingCh());
-         
-         R__b << fAccCut;
-         R__b << fAccMin;
-         R__b << fAccMax; 
-         
-         R__b << fChambers;
-         R__b << fTriggerCircuits;
-         for (i =0; i<AliMUONConstants::NTriggerCircuit(); i++) {
-             iTriggerCircuit=(AliMUONTriggerCircuit*) (*fTriggerCircuits)[i];
-             iTriggerCircuit->Streamer(R__b);
-         }
-         for (i =0; i<AliMUONConstants::NCh(); i++) {
-             iChamber=(AliMUONChamber*) (*fChambers)[i];
-             iChamber->Streamer(R__b);
-             if (iChamber->Nsec()==1) {
-                 segmentation=iChamber->SegmentationModel(1);
-                 if (segmentation)
-                     segmentation->Streamer(R__b);
-             } else {
-                 segmentation=iChamber->SegmentationModel(1);
-                 if (segmentation)
-                     segmentation->Streamer(R__b);
-                 segmentation=iChamber->SegmentationModel(2);
-                 if (segmentation)
-                     segmentation->Streamer(R__b);
-             }
-             response=iChamber->ResponseModel();
-             if (response)
-                 response->Streamer(R__b);
-             digitsaddress=(TClonesArray*) (*fDchambers)[i];
-             digitsaddress->Streamer(R__b);
-             if (i < AliMUONConstants::NTrackingCh()) {
-                 rawcladdress=(TClonesArray*) (*fRawClusters)[i];
-                 rawcladdress->Streamer(R__b);
-             }
-         }
-      }
-}
-#endif
 //_______________________________________________________________________
 AliMUONPadHit* AliMUON::FirstPad(AliMUONHit*  hit, TClonesArray *clusters) 
 {
@@ -610,9 +493,9 @@ AliMUONPadHit* AliMUON::FirstPad(AliMUONHit*  hit, TClonesArray *clusters)
     TClonesArray *theClusters = clusters;
     Int_t nclust = theClusters->GetEntriesFast();
     if (nclust && hit->PHlast() > 0) {
-       AliMUON::fMaxIterPad=hit->PHlast();
-       AliMUON::fCurIterPad=hit->PHfirst();
-       return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
+       fMaxIterPad=hit->PHlast();
+       fCurIterPad=hit->PHfirst();
+       return (AliMUONPadHit*) clusters->UncheckedAt(fCurIterPad-1);
     } else {
        return 0;
     }
@@ -623,9 +506,9 @@ AliMUONPadHit* AliMUON::NextPad(TClonesArray *clusters)
   // To be removed
 // Get next pad (in iterator) 
 //
-    AliMUON::fCurIterPad++;
-    if (AliMUON::fCurIterPad <= AliMUON::fMaxIterPad) {
-       return (AliMUONPadHit*) clusters->UncheckedAt(AliMUON::fCurIterPad-1);
+    fCurIterPad++;
+    if (fCurIterPad <= fMaxIterPad) {
+       return (AliMUONPadHit*) clusters->UncheckedAt(fCurIterPad-1);
     } else {
        return 0;
     }
@@ -662,11 +545,31 @@ AliMUONMerger*  AliMUON::Merger()
 // Return pointer to merger
     return fMerger;
 }
+/* PH Commented out waiting for correct implementation
 //________________________________________________________________________
-AliMUON& AliMUON::operator = (const AliMUON& /*rhs*/)
+void AliMUON::RemapTrackHitIDs(Int_t* map)
 {
-// copy operator
-// dummy version
-    return *this;
-}
-
+// Remaps the track numbers in the hits arrays, so that they correspond
+// to the entry indices in the Kine tree.
+// The correspondance is not direct. To get the real index into the Kine tree
+// compute the particle index as follows:
+//
+//   num_primaries = AliStack::GetNprimary();
+//   num_tracks = AliStack::GetNtracks();
+//   track = AliMUONHit::Track()
+//
+//   if (track < num_primaries)
+//       particleindex = track + num_tracks - num_primaries;
+//   else
+//       particleindex = track - num_primaries;
+       
+       // Remap the track numbers based on the specified map.
+       AliMUONData* data = GetMUONData();
+       TClonesArray* hits = data->Hits();
+       for (Int_t i = 0; i < hits->GetEntriesFast(); i++)
+       {
+               AliMUONHit* hit = static_cast<AliMUONHit*>( hits->At(i) );
+               hit->SetTrack( map[hit->Track()] );
+       };
+};
+*/