]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUON.cxx
Updated list of MUON libraries
[u/mrichter/AliRoot.git] / MUON / AliMUON.cxx
index aa2c34dd20a3fcc98d0b1359d957d151e54af417..464df0c95ce8f98cd475bf290cbba4ce7441fcf0 100644 (file)
 
 /* $Id$ */
 
-
-///////////////////////////////////////////////
-//  Manager and hits classes for set:MUON     //
-////////////////////////////////////////////////
+// ------------------
+// Class AliMUON
+// ------------------
+// AliDetector class for MUON subsystem 
+// providing simulation data management 
 
 #include "Riostream.h"
 
 #include "AliMUONChamberTrigger.h"
 #include "AliMUONConstants.h"
 #include "AliMUONHit.h"        
-#include "AliMUONRawCluster.h"
-#include "AliMUONTransientDigit.h"
-#include "AliMUONTriggerCircuit.h"
 #include "AliMUONGeometry.h"
 #include "AliMUONGeometryTransformer.h"
 #include "AliMUONGeometryBuilder.h"
 #include "AliMUONCommonGeometryBuilder.h"
 #include "AliMUONVGeometryBuilder.h"   
 #include "AliMUONGeometrySegmentation.h"
-#include "AliMUONDigitizerv2.h"
-#include "AliMUONSDigitizerv1.h"
 #include "AliMUONRawWriter.h"
 #include "AliMUONSegmentation.h"
 #include "AliLog.h"
 
 #include "AliMUONSDigitizerV2.h"
 #include "AliMUONDigitizerV3.h"
+#include "AliMUONDigitMaker.h"
 
 #include "AliMUONSt1GeometryBuilderV2.h"
 #include "AliMUONSt2GeometryBuilderV2.h"
@@ -91,7 +88,9 @@
 //          according to (Z1 = zch) and  (Z2 = zch + DTPLANES)
 //          for the first and second chambers in the station, respectively
 
-ClassImp(AliMUON)
+/// \cond CLASSIMP
+ClassImp(AliMUON)  
+/// \endcond
 
 //__________________________________________________________________
 AliMUON::AliMUON()
@@ -101,7 +100,6 @@ AliMUON::AliMUON()
     fMUONData(0),
     fSplitLevel(0),
     fChambers(0),
-    fTriggerCircuits(0),
     fGeometryBuilder(0),
     fSegmentation(0),
     fAccCut(kFALSE),
@@ -114,27 +112,28 @@ AliMUON::AliMUON()
     fMaxIterPad(0),
     fCurIterPad(0),
     fTriggerScalerEvent(kFALSE),
-    fSDigitizerType(""),
-    fDigitizerType(""),
-  fRawWriter(0x0)
+    fTriggerResponseV1(kFALSE),
+    fTriggerCoinc44(0),
+    fTriggerEffCells(0),
+    fDigitizerWithNoise(kTRUE),
+    fRawWriter(0x0),
+    fDigitMaker(0x0)
+
 {
-// Default Constructor
-//
-       AliDebug(1,Form("default (empty) ctor this=%p",this));
+/// Default Constructor
+    
+    AliDebug(1,Form("default (empty) ctor this=%p",this));
     fIshunt          = 0;
 }
 
 //__________________________________________________________________
-AliMUON::AliMUON(const char *name, const char *title,
-                 const char* sDigitizerClassName,
-                 const char* digitizerClassName)
-  : AliDetector(name,title),
+AliMUON::AliMUON(const char *name, const char* title)
+  : AliDetector(name, title),
     fNCh(AliMUONConstants::NCh()),
     fNTrackingCh(AliMUONConstants::NTrackingCh()),
     fMUONData(0),
     fSplitLevel(0),
     fChambers(0),
-    fTriggerCircuits(0),
     fGeometryBuilder(0),
     fSegmentation(0),
     fAccCut(kFALSE),
@@ -146,15 +145,20 @@ AliMUON::AliMUON(const char *name, const char *title,
     fMaxDestepAlu(-1), // in the calculation of the tracking parameters
     fMaxIterPad(0),
     fCurIterPad(0),
-         fTriggerScalerEvent(kFALSE),
-    fSDigitizerType(sDigitizerClassName),
-    fDigitizerType(digitizerClassName),
-  fRawWriter(0x0)
-{
-       AliDebug(1,Form("ctor this=%p",this));
+    fTriggerScalerEvent(kFALSE),
+    fTriggerResponseV1(kFALSE),
+    fTriggerCoinc44(0),
+    fTriggerEffCells(0),
+    fDigitizerWithNoise(kTRUE),
+    fRawWriter(0x0),
+    fDigitMaker(new AliMUONDigitMaker(kFALSE)) 
+{
+/// Standard constructor  
+  
+  AliDebug(1,Form("ctor this=%p",this));
   fIshunt =  0;
 
-  SetMarkerColor(kRed);//
+  //PH SetMarkerColor(kRed);//
     
   // Geometry builder
   fGeometryBuilder = new AliMUONGeometryBuilder(this);
@@ -192,27 +196,14 @@ AliMUON::AliMUON(const char *name, const char *title,
        }
       } // Chamber stCH (0, 1) in 
     }     // Station st (0...)
-    
-    // cp new design of AliMUONTriggerDecision
-    fTriggerCircuits = new TObjArray(AliMUONConstants::NTriggerCircuit());
-    for (Int_t circ=0; circ<AliMUONConstants::NTriggerCircuit(); circ++) {
-      fTriggerCircuits->AddAt(new AliMUONTriggerCircuit(),circ);          
-    }
-}
-
-//____________________________________________________________________
-AliMUON::AliMUON(const AliMUON& rMUON)
- : AliDetector(rMUON)
-{
-// Protected copy constructor
 
-  AliFatal("Not implemented.");
 }
 
 //____________________________________________________________________
 AliMUON::~AliMUON()
 {
-// Destructor
+/// Destructor
+
   AliDebug(1,Form("dtor this=%p",this));
   fIshunt  = 0;
 
@@ -220,33 +211,18 @@ AliMUON::~AliMUON()
     fChambers->Delete();
     delete fChambers;
   }
-  if (fTriggerCircuits){
-    fTriggerCircuits->Delete();
-    delete fTriggerCircuits;
-  }
+  
   delete fMUONData;
   delete fGeometryBuilder;
   delete fSegmentation;
   delete fRawWriter;
-}
-
-//________________________________________________________________________
-AliMUON& AliMUON::operator = (const AliMUON& rhs)
-{
-// Protected assignement operator
-
-  if (this == &rhs) return *this;
-
-  AliFatal("Not implemented.");
-    
-  return *this;  
+  delete fDigitMaker;
 }
 
 //_____________________________________________________________________________
 void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder)
 {
-// Adds the geometry builder to the list
-// ---
+/// Add the geometry builder to the list
 
   fGeometryBuilder->AddBuilder(geomBuilder);
 }
@@ -254,7 +230,7 @@ void AliMUON::AddGeometryBuilder(AliMUONVGeometryBuilder* geomBuilder)
 //____________________________________________________________________
 void AliMUON::BuildGeometry()
 {
-// Geometry for event display
+/// Geometry for event display
 
 
 //     for (Int_t i = 0; i < AliMUONConstants::NCh(); i++)     
@@ -266,7 +242,7 @@ void AliMUON::BuildGeometry()
 //____________________________________________________________________
 const AliMUONGeometry*  AliMUON::GetGeometry() const
 {
-// Return geometry parametrisation
+/// Return geometry parametrisation
 
   if ( !fGeometryBuilder) {
     AliWarningStream() << "GeometryBuilder not defined." << std::endl;
@@ -279,7 +255,7 @@ const AliMUONGeometry*  AliMUON::GetGeometry() const
 //____________________________________________________________________
 const AliMUONGeometryTransformer*  AliMUON::GetGeometryTransformer() const
 {
-// Return geometry parametrisation
+/// Return geometry parametrisation
 
   const AliMUONGeometry* kGeometry = GetGeometry();
   
@@ -291,6 +267,8 @@ const AliMUONGeometryTransformer*  AliMUON::GetGeometryTransformer() const
 //__________________________________________________________________
 void  AliMUON::SetTreeAddress()
 {
+/// Set Hits tree address
+
   GetMUONData()->SetLoader(fLoader); 
   //  GetMUONData()->MakeBranch("D,S,RC");
   //  GetMUONData()->SetTreeAddress("H,D,S,RC");
@@ -308,7 +286,8 @@ void  AliMUON::SetTreeAddress()
 //_________________________________________________________________
 void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
 {
-// Set the inverse charge slope for chamber id
+/// Set the inverse charge slope for chamber id
+
     Int_t i=2*(id-1);    //PH    ((AliMUONChamber*) (*fChambers)[i])->SetSigmaIntegration(p1);
     //PH    ((AliMUONChamber*) (*fChambers)[i+1])->SetSigmaIntegration(p1);
     ((AliMUONChamber*) fChambers->At(i))->SetChargeSlope(p1);
@@ -317,7 +296,8 @@ void AliMUON::SetChargeSlope(Int_t id, Float_t p1)
 //__________________________________________________________________
 void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
 {
-// Set sigma of charge spread for chamber id
+/// Set sigma of charge spread for chamber id
+
     Int_t i=2*(id-1);
     ((AliMUONChamber*) fChambers->At(i))->SetChargeSpread(p1,p2);
     ((AliMUONChamber*) fChambers->At(i+1))->SetChargeSpread(p1,p2);
@@ -325,7 +305,7 @@ void AliMUON::SetChargeSpread(Int_t id, Float_t p1, Float_t p2)
 //___________________________________________________________________
 void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
 {
-// Set integration limits for charge spread
+/// Set integration limits for charge spread
     Int_t i=2*(id-1);
     ((AliMUONChamber*) fChambers->At(i))->SetSigmaIntegration(p1);
     ((AliMUONChamber*) fChambers->At(i+1))->SetSigmaIntegration(p1);
@@ -334,7 +314,8 @@ void AliMUON::SetSigmaIntegration(Int_t id, Float_t p1)
 //__________________________________________________________________
 void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
 {
-// Set maximum number for ADCcounts (saturation)
+/// Set maximum number for ADCcounts (saturation)
+
     Int_t i=2*(id-1);
     ((AliMUONChamber*) fChambers->At(i))->SetMaxAdc(p1);
     ((AliMUONChamber*) fChambers->At(i+1))->SetMaxAdc(p1);
@@ -343,32 +324,36 @@ void AliMUON::SetMaxAdc(Int_t id, Int_t p1)
 //__________________________________________________________________
 void AliMUON::SetMaxStepGas(Float_t p1)
 {
-// Set stepsize in gas
+/// Set stepsize in gas
+
   fMaxStepGas=p1;
 }
 //__________________________________________________________________
 void AliMUON::SetMaxStepAlu(Float_t p1)
 {
-// Set step size in Alu
+/// Set step size in Alu
+
     fMaxStepAlu=p1;
 }
 //__________________________________________________________________
 void AliMUON::SetMaxDestepGas(Float_t p1)
 {
-// Set maximum step size in Gas
+/// Set maximum step size in Gas
+
     fMaxDestepGas=p1;
 }
 //__________________________________________________________________
 void AliMUON::SetMaxDestepAlu(Float_t p1)
 {
-// Set maximum step size in Alu
+/// Set maximum step size in Alu
+
   fMaxDestepAlu=p1;
 }
 
 //____________________________________________________________________
 Float_t  AliMUON::GetMaxStepGas() const
 {
-// Return stepsize in gas
+/// Return stepsize in gas
   
   return fMaxStepGas;
 }  
@@ -376,7 +361,7 @@ Float_t  AliMUON::GetMaxStepGas() const
 //____________________________________________________________________
 Float_t  AliMUON::GetMaxStepAlu() const
 {
-// Return step size in Alu
+/// Return step size in Alu
   
   return fMaxStepAlu;
 }
@@ -384,7 +369,7 @@ Float_t  AliMUON::GetMaxStepAlu() const
 //____________________________________________________________________
 Float_t  AliMUON::GetMaxDestepGas() const
 {
-// Return maximum step size in Gas
+/// Return maximum step size in Gas
   
   return fMaxDestepGas;
 }
@@ -392,7 +377,7 @@ Float_t  AliMUON::GetMaxDestepGas() const
 //____________________________________________________________________
 Float_t  AliMUON::GetMaxDestepAlu() const
 {
-// Return maximum step size in Gas
+/// Return maximum step size in Gas
   
   return fMaxDestepAlu;
 }
@@ -400,7 +385,7 @@ Float_t  AliMUON::GetMaxDestepAlu() const
 //____________________________________________________________________
  void  AliMUON::SetAlign(Bool_t align)
 {
- // Sets option for alignement to geometry builder
+/// Set option for alignement to geometry builder
  
    fGeometryBuilder->SetAlign(align);
 }   
@@ -408,7 +393,7 @@ Float_t  AliMUON::GetMaxDestepAlu() const
 //____________________________________________________________________
  void  AliMUON::SetAlign(const TString& fileName, Bool_t align)
 {
- // Sets option for alignement to geometry builder
+/// Set option for alignement to geometry builder
  
    fGeometryBuilder->SetAlign(fileName, align);
 }   
@@ -416,56 +401,22 @@ Float_t  AliMUON::GetMaxDestepAlu() const
 //____________________________________________________________________
 void   AliMUON::SetResponseModel(Int_t id, AliMUONResponse *response)
 {
-// Set the response for chamber id
+/// Set the response for chamber id
     ((AliMUONChamber*) fChambers->At(id))->SetResponseModel(response);
 }
+
 //____________________________________________________________________
 AliDigitizer* AliMUON::CreateDigitizer(AliRunDigitizer* manager) const
 {
-  // FIXME: the selection of the class should be done through a factory
-  // mechanism. (see also Hits2SDigits()).
+/// Return digitizer
   
-  AliInfo(Form("Digitizer used : %s",fDigitizerType.Data()));
-  
-  if ( fDigitizerType == "digitizer:default" )
-  {
-    return new AliMUONDigitizerv2(manager);
-  }
-  else if ( fDigitizerType == "digitizer:NewDigitizerNewTrigger" ) 
-  {
-    return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerElectronics);
-  }
-  else if ( fDigitizerType == "digitizer:NewDigitizerOldTrigger" )
-  {
-    return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerDecision, kFALSE, kFALSE);
-  }
-  else if ( fDigitizerType == "digitizer:NewDigitizerEffTrigger" )
-  {
-    return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerDecision, kTRUE, kFALSE);
-  }  
-  else if ( fDigitizerType == "digitizer:NewDigitizerWithNoiseOldTrigger" )
-  {
-    return new AliMUONDigitizerV3(manager,AliMUONDigitizerV3::kTriggerDecision, kFALSE, kTRUE);
-  }    
-  else
-  {
-    AliFatal(Form("Unknown digitizer type : %s",fDigitizerType.Data()));
-  }
-  return 0x0;
-}
-
-//_____________________________________________________________________
-TString
-AliMUON::SDigitizerType() const
-{
-  return fSDigitizerType;
+  return new AliMUONDigitizerV3(manager, fDigitizerWithNoise);
 }
 
 //_____________________________________________________________________
 void AliMUON::SDigits2Digits()
 {
-
-// write TreeD here 
+/// Write TreeD here only 
 
     char hname[30];
     //    sprintf(hname,"TreeD%d",fLoader->GetHeader()->GetEvent());
@@ -476,53 +427,23 @@ void AliMUON::SDigits2Digits()
 //_____________________________________________________________________
 void AliMUON::Hits2SDigits()
 {
-  // FIXME: the selection of the sdigitizer should be done through a
-  // factory mechanism.
+/// Perform Hits2Digits using SDigitizerV2
   
-  AliInfo(Form("SDigitizer used : %s",fSDigitizerType.Data()));
-
-  if ( fSDigitizerType == "sdigitizer:default" )
-  {
-    // 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();
-  }
-  else if ( fSDigitizerType == "sdigitizer:AliMUONSDigitizerV2" )
-  {
-    TTask* sdigitizer = new AliMUONSDigitizerV2;
-    sdigitizer->ExecuteTask();
-  }
-  else
-  {
-    AliFatal(Form("Unknown sdigitizer classname : %s",fSDigitizerType.Data()));
-  }
-}
-
-//_____________________________________________________________________
-TString
-AliMUON::DigitizerType() const
-{
-  return fDigitizerType;
+  TTask* sdigitizer = new AliMUONSDigitizerV2;
+  sdigitizer->ExecuteTask();
 }
 
 //_____________________________________________________________________
 void AliMUON::Digits2Raw()
 {
-  // convert digits of the current event to raw data
+/// Convert digits of the current event to raw data
+
   if (!fRawWriter)
   {
     fRawWriter = new AliMUONRawWriter(fMUONData);
     if (fTriggerScalerEvent == kTRUE) 
     {
-      fRawWriter->SetScalerEvent();
+      fRawWriter->SetScalersNumbers();
     }
   }
   
@@ -532,52 +453,98 @@ void AliMUON::Digits2Raw()
   }
 }
 
+//_____________________________________________________________________
+Bool_t AliMUON::Raw2SDigits(AliRawReader* rawReader)
+{
+/// Convert  raw data to SDigit
+/// Only for tracking for the moment (ChF) 
+
+  //fLoader->LoadDigits("READ");
+  if (!fLoader->TreeS()) fLoader->MakeSDigitsContainer();
+
+  fMUONData->MakeBranch("S");
+  fMUONData->SetTreeAddress("S");
+  fDigitMaker->Raw2Digits(rawReader);
+  fMUONData->Fill("S");
+
+  fLoader->WriteSDigits("OVERWRITE");
+  fMUONData->ResetSDigits();
+  fLoader->UnloadSDigits();
+
+  return kTRUE;
+
+}
+
 //_______________________________________________________________________
 AliLoader* AliMUON::MakeLoader(const char* topfoldername)
 { 
-//builds standard getter (AliLoader type)
-//if detector wants to use castomized getter, it must overload this method
-
+/// Build standard getter (AliLoader type);
+/// if detector wants to use castomized getter, it must overload this method
  
  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 = new AliMUONSimData(fLoader,GetName(),GetName()); 
  fMUONData->SetSplitLevel(fSplitLevel);
- return fLoader;
-}
-//_______________________________________________________________________
 
-AliMUONRawCluster *AliMUON::RawCluster(Int_t ichamber, Int_t icathod, Int_t icluster)
-{
-//
-//  Return rawcluster (icluster) for chamber ichamber and cathode icathod
-//  Obsolete ??
-    TClonesArray *muonRawCluster  = GetMUONData()->RawClusters(ichamber);
-    ResetRawClusters();
-    TTree *treeR = fLoader->TreeR();
-    Int_t nent=(Int_t)treeR->GetEntries();
-    treeR->GetEvent(nent-2+icathod-1);
-    //treeR->GetEvent(icathod);
-    //Int_t nrawcl = (Int_t)muonRawCluster->GetEntriesFast();
-
-    AliMUONRawCluster * mRaw = (AliMUONRawCluster*)muonRawCluster->UncheckedAt(icluster);
-    //printf("RawCluster _ nent nrawcl icluster mRaw %d %d %d%p\n",nent,nrawcl,icluster,mRaw);
-    
-    return  mRaw;
+ fDigitMaker->SetMUONData(fMUONData);
+
+ return fLoader;
 }
 
 //________________________________________________________________________
 void
 AliMUON::ResetGeometryBuilder()
 {
-  // Only to be used by "experts" wanting to change the geometry builders
-  // to be used. 
-  // As the ctor of AliMUON now defines a default geometrybuilder, this
-  // ResetGeometryBuilder() must be called prior to call the 
-  // AddGeometryBuilder()
+/// Only to be used by "experts" wanting to change the geometry builders
+/// to be used. 
+/// As the ctor of AliMUON now defines a default geometrybuilder, this
+/// ResetGeometryBuilder() must be called prior to call the 
+/// AddGeometryBuilder()
+
   delete fGeometryBuilder;
   fGeometryBuilder = new AliMUONGeometryBuilder(this);
   fGeometryBuilder
     ->AddBuilder(new AliMUONCommonGeometryBuilder(this));
 }
+
+//____________________________________________________________________
+Bool_t  AliMUON::GetTriggerResponseV1() const
+{
+///
+/// Returns fTriggerResponseV1
+///  
+    return fTriggerResponseV1;
+    
+}  
+
+//____________________________________________________________________
+Int_t  AliMUON::GetTriggerCoinc44() const
+{
+///
+/// Returns fTriggerCoinc44
+///  
+    return fTriggerCoinc44;
+    
+}
+
+//____________________________________________________________________
+Bool_t  AliMUON::GetTriggerEffCells() const
+{
+///
+/// Returns fTriggerEffCells
+///  
+    return fTriggerEffCells;
+    
+}  
+
+//____________________________________________________________________
+Bool_t  AliMUON::GetDigitizerWithNoise() const
+{
+///
+/// Returns fDigitizerWithNoise
+///  
+    return fDigitizerWithNoise;
+    
+}  
+