]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONChamber.cxx
new slow simulation up to RawData
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
index 06a6f01116217b929d9143e8666854f2b02c250e..710005f0166fdb34b6c739eab09ceb515d07862c 100644 (file)
 
 /* $Id$ */
 
-// --- MUON includes ---
-#include "AliMUONChamber.h"
-
 // --- ROOT includes ---
+#include <TRandom.h>
+#include <TMath.h>
 
-#include "TRandom.h"
-#include "TMath.h"
+// --- MUON includes ---
+#include "AliMUONChamber.h"
+#include "AliMUONChamberGeometry.h"
 
 ClassImp(AliMUONChamber)       
 
-    AliMUONChamber::AliMUONChamber()
+AliMUONChamber::AliMUONChamber()
+  : TObject(), 
+    fId(0),
+    fdGas(0.),
+    fdAlu(0.),
+    fZ(0.),
+    fnsec(1),
+    frMin(0.),
+    frMax(0.),
+    fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
+    fSegmentation(0),
+    fReconstruction(0),
+    fResponse(0),
+    fGeometry(0)
 {
 // Default constructor
-    fSegmentation = 0;
-    fResponse=0;
-    fnsec=1;
-    fReconstruction=0;
-    fId=0;
-    // to avoid mistakes if ChargeCorrelInit is not called
-    fCurrentCorrel =1;
 }
 
-    AliMUONChamber::AliMUONChamber(Int_t id) 
+AliMUONChamber::AliMUONChamber(Int_t id) 
+  : TObject(), 
+    fId(id),
+    fdGas(0.),
+    fdAlu(0.),
+    fZ(0.),
+    fnsec(1),
+    frMin(0.),
+    frMax(0.),
+    fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
+    fSegmentation(0),
+    fReconstruction(0),
+    fResponse(0),
+    fGeometry(0)
 {
 // Construtor with chamber id 
     fSegmentation = new TObjArray(2);
     fSegmentation->AddAt(0,0);
     fSegmentation->AddAt(0,1);
-    fResponse=0;
-    fnsec=1;
-    fReconstruction=0;
-    fId=id;
-    // to avoid mistakes if ChargeCorrelInit is not called
-    fCurrentCorrel =1;
+
+    fGeometry = new AliMUONChamberGeometry(fId);
+}
+
+AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
+  : TObject(rChamber)
+{
+// Protected copy constructor
+
+  Fatal("AliMUONMergerModule", "Not implemented.");
+ // Dummy copy constructor
 }
 
 AliMUONChamber::~AliMUONChamber() 
@@ -58,14 +82,27 @@ AliMUONChamber::~AliMUONChamber()
     fSegmentation->Delete();
     delete fSegmentation;
   }
+  delete fGeometry;
+}
+
+AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
+{
+// Protected assignement operator
+
+  if (this == &rhs) return *this;
+
+  Fatal("operator=", "Not implemented.");
+    
+  return *this;  
 }
 
-// AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber):TObject(const AliMUONChamber& rChamber)
-//  {
-//  // Dummy copy constructor
-//      ;
-// // }
+Bool_t  AliMUONChamber::IsSensId(Int_t volId) const 
+{
+// Returns true if the volume specified by volId is in the list
+// of sesitive volumes for this chamber
 
+  return fGeometry->IsSensitiveVolume(volId);
+}  
 
 void AliMUONChamber::Init()
 {
@@ -149,12 +186,11 @@ void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
     //
     // Loop Over Pads
     
-    Float_t qcheck=0, qp;
+    Float_t qp; 
     nnew=0;
     
     // Cathode plane loop
     for (Int_t i=1; i<=fnsec; i++) {
-       qcheck=0;
        Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
        AliSegmentation * segmentation=
       //PH         (AliSegmentation *) (*fSegmentation)[i-1];
@@ -167,10 +203,16 @@ void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
            qp=TMath::Abs(qp);
 //
 //
-           if (qp > 1.e-4) {
-               qcheck+=qp*qcath;
-           //
-           // --- store signal information
+           if (qp > 1.e-4) 
+            {
+               if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
+                                // newclust only contains 500 elements.
+               {
+                       Error("DisIntegration", "Limit of 500 pad responses reached.");
+                       return;
+               };
+               //
+               // --- store signal information
                newclust[0][nnew]=qcath;                     // total charge
                newclust[1][nnew]=segmentation->Ix();       // ix-position of pad
                newclust[2][nnew]=segmentation->Iy();       // iy-position of pad
@@ -178,7 +220,6 @@ void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
                newclust[4][nnew]=segmentation->ISector();  // sector id
                newclust[5][nnew]=(Float_t) i;              // counter
                nnew++;
-//             if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
                
            }
        } // Pad loop
@@ -197,8 +238,3 @@ void AliMUONChamber::InitGeo(Float_t /*zpos*/)
 }
 
 
-AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& /*rhs*/)
-{
-// Dummy assignment operator
-    return *this;
-}