]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONDigitizer.cxx
- Updated for modifying AliMUONHitMapA1 constructor
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitizer.cxx
index 4de7cb2e1fdc5d95fdcb21f870ba5a01fcb5876e..39a156728f447d5a0ad51bcfd6482f6541e64d5a 100644 (file)
 
 /* $Id$ */
 
-#include <assert.h>
-
-#include "AliRun.h"
-#include "AliRunDigitizer.h"
-#include "AliRunLoader.h"
-
 #include "AliMUONDigitizer.h"
 #include "AliMUONConstants.h"
-#include "AliMUONChamber.h"
+#include "AliMUONSegmentation.h"
 #include "AliMUONHitMapA1.h"
 #include "AliMUON.h"
 #include "AliMUONLoader.h"
 #include "AliMUONTransientDigit.h"
 #include "AliMUONTriggerDecision.h"
 #include "AliLog.h"
+#include "AliMUONGeometryTransformer.h"
 #include "AliMUONGeometryModule.h"
 #include "AliMUONGeometryStore.h"
 
+#include "AliRun.h"
+#include "AliRunDigitizer.h"
+#include "AliRunLoader.h"
+
 /////////////////////////////////////////////////////////////////////////////////////
 //
 // AliMUONDigitizer should be base abstract class of all digitisers in the MUON 
@@ -54,8 +53,7 @@ AliMUONDigitizer::AliMUONDigitizer() :
        fTDList(0),
        fTDCounter(0),
        fMask(0),
-       fSignal(0),
-       fDebug(0)
+       fSignal(0)
 {
 // Default constructor.
 // Initializes all pointers to NULL.
@@ -74,8 +72,7 @@ AliMUONDigitizer::AliMUONDigitizer(AliRunDigitizer* manager) :
        fTDList(0),
        fTDCounter(0),
        fMask(0),
-       fSignal(0),
-       fDebug(0)
+       fSignal(0)
 {
 // Constructor which should be used rather than the default constructor.
 // Initializes all pointers to NULL.
@@ -128,7 +125,7 @@ Bool_t AliMUONDigitizer::Init()
 }
 
 //------------------------------------------------------------------------
-void AliMUONDigitizer::Exec(Option_t* option)
+void AliMUONDigitizer::Exec(Option_t* /*option*/)
 {
 // The main work loop starts here. 
 // The digitization process is broken up into two steps: 
@@ -138,7 +135,6 @@ void AliMUONDigitizer::Exec(Option_t* option)
 //    stream. Done in CreateDigits()
 
        AliDebug(1, "Running digitiser.");
-       ParseOptions(option);
 
        if (fManager->GetNinputs() == 0)
        {
@@ -300,8 +296,13 @@ void AliMUONDigitizer::CreateDigits()
            AliDebug(3,Form( "Creating digit from transient digit 0x%X", (void*)td));
 
            Int_t q = GetSignalFrom(td);
-            assert( 0 <= td->Chamber() && td->Chamber() <= 13 );
-           if (q > 0) AddDigit(td, q, digitindex[td->Chamber()]++);
+           if (q > 0) {
+             Int_t chamber = td->Chamber();
+             if (0 <= chamber && chamber <= 13 )
+               AddDigit(td, q, digitindex[chamber]++);
+             else
+               AliError(Form("Invalid chamber %d\n",chamber));
+           }
          }
          FillOutputData();
          //    }
@@ -469,26 +470,6 @@ Bool_t  AliMUONDigitizer::FetchTriggerPointer(AliMUONLoader* loader)
   
   return kTRUE;
 }
-//------------------------------------------------------------------------
-void AliMUONDigitizer::ParseOptions(Option_t* options)
-{
-// Called by the Exec method. ParseOptions should parse the option string given to the Exec method.
-// 
-// The following options are defined:
-//     "debug" - Sets the debug level to 99, which will show all debug messages.
-//     "deb"   - Same as "debug", implemented for backward comparability.
-//
-// If an invalid option is specified it is simply ignored.
-
-       TString optionString = options;
-       if (optionString.Data() == "debug" || 
-               optionString.Data() == "deb"   // maintained for compatability.
-          )
-       {
-               AliInfo("Called with option \"debug\".");
-               SetDebug(99);
-       }
-}
 
 //------------------------------------------------------------------------
 void AliMUONDigitizer::InitArrays()
@@ -516,13 +497,18 @@ void AliMUONDigitizer::InitArrays()
 
 
       AliDebug(4,Form( "Creating hit map for chamber %d, cathode 1.", i+1));
-      AliMUONChamber* chamber = &(fMUON->Chamber(i));
-      AliMUONGeometrySegmentation* c1Segmentation = chamber->SegmentationModel2(1); // Cathode plane 1
+      AliMUONSegmentation* segmentation = fMUON->GetSegmentation();
+      AliMUONGeometrySegmentation* c1Segmentation 
+        = segmentation->GetModuleSegmentation(i, 0); // Cathode plane 1
       AliDebug(4,Form( "Creating hit map for chamber %d, cathode 2.", i+1));
-      AliMUONGeometrySegmentation* c2Segmentation = chamber->SegmentationModel2(2); // Cathode plane 2
-
-      AliMUONGeometryModule* geometry    = fMUON->Chamber(i).GetGeometry();
-      AliMUONGeometryStore*  detElements = geometry->GetDetElementStore();
+      AliMUONGeometrySegmentation* c2Segmentation 
+        = segmentation->GetModuleSegmentation(i, 1); // Cathode plane 2
+
+      const AliMUONGeometryTransformer* kGeometryTransformer 
+        = fMUON->GetGeometryTransformer();
+      AliMUONGeometryStore* detElements 
+        = kGeometryTransformer->GetModuleTransformer(i)->GetDetElementStore();
     
 
     // Loop over detection elements
@@ -531,9 +517,13 @@ void AliMUONDigitizer::InitArrays()
        idDE = detElements->GetEntry(j)->GetUniqueID();
        fNDetElemId[idDE] = k;
 
-       fHitMap[k] = new AliMUONHitMapA1(idDE,c1Segmentation, fTDList); 
+        Int_t npx1 = c1Segmentation->Npx(idDE)+1;
+        Int_t npy1 = c1Segmentation->Npy(idDE)+1;
+       fHitMap[k] = new AliMUONHitMapA1(npx1, npy1, fTDList); 
      
-       fHitMap[k+AliMUONConstants::NDetElem()] = new AliMUONHitMapA1(idDE,c2Segmentation, fTDList);
+        Int_t npx2 = c2Segmentation->Npx(idDE)+1;
+        Int_t npy2 = c2Segmentation->Npy(idDE)+1;
+       fHitMap[k+AliMUONConstants::NDetElem()] = new AliMUONHitMapA1(npx2, npy2, fTDList);
        k++;
       }
     }