]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONChamber.cxx
switch to activate ResponseTriggerV1 from Config
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
index f50e80bfe6db72919470dcfdde8ad66adf6e4cbc..c3f94d440cc1222ee87ddd01db5c787010a9d28e 100644 (file)
 
 /* $Id$ */
 
-// --- MUON includes ---
-#include "AliMUONChamber.h"
-#include "AliMUONChamberGeometry.h"
+// -----------------------
+// Class AliMUONChamber
+// -----------------------
+// MUON tracking chamber class
+// now only providing DisIntegration function
 
 // --- ROOT includes ---
+#include <TRandom.h>
+#include <TMath.h>
+#include "AliRun.h"
 
-#include "TRandom.h"
-#include "TMath.h"
-
-ClassImp(AliMUONChamber)       
-
-    AliMUONChamber::AliMUONChamber()
-{
-// Default constructor
-    fSegmentation = 0;
-    fResponse=0;
-    fnsec=1;
-    fReconstruction=0;
-    fGeometry = 0;
-    
-    fId=0;
-    // to avoid mistakes if ChargeCorrelInit is not called
-    fCurrentCorrel =1;
-}
 
-    AliMUONChamber::AliMUONChamber(Int_t id) 
-{
-// Construtor with chamber id 
-    fSegmentation = new TObjArray(2);
-    fSegmentation->AddAt(0,0);
-    fSegmentation->AddAt(0,1);
-    fResponse=0;
-    fnsec=1;
-    fReconstruction=0;
-    fId=id;
-    fGeometry = new AliMUONChamberGeometry(fId);
-    // to avoid mistakes if ChargeCorrelInit is not called
-    fCurrentCorrel =1;
-}
+// --- MUON includes ---
+#include "AliMUON.h"
+#include "AliMUONChamber.h"
+#include "AliMUONSegmentation.h"
+#include "AliMUONHit.h"
+#include "AliLog.h"
 
-AliMUONChamber::~AliMUONChamber() 
+/// \cond CLASSIMP
+ClassImp(AliMUONChamber)       
+/// \endcond
+
+//_______________________________________________________
+AliMUONChamber::AliMUONChamber()
+  : TObject(), 
+    fId(0),
+    fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
+    fResponse(0),
+    fMUON(0)
 {
-// Destructor
-  if (fSegmentation) {
-    fSegmentation->Delete();
-    delete fSegmentation;
-  }
-  delete fGeometry;
-}
+/// Default constructor
 
-AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber):TObject(rChamber)
-{
- // Dummy copy constructor
-     ;
+  AliDebug(1, Form("default (empty) ctor this = %p", this));
 }
 
-
-Bool_t  AliMUONChamber::IsSensId(Int_t volId) const 
+//_______________________________________________________
+AliMUONChamber::AliMUONChamber(Int_t id) 
+  : TObject(), 
+    fId(id),
+    fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
+    fResponse(0),
+    fMUON(0)
 {
-// Returns true if the volume specified by volId is in the list
-// of sesitive volumes for this chamber
+/// Standard constructor
 
-  return fGeometry->IsSensitiveVolume(volId);
-}  
+    // muon
+    fMUON = (AliMUON*)gAlice->GetModule("MUON");
+    if (!fMUON) {
+      AliFatal("MUON detector not defined.");
+      return;
+    }  
 
-void AliMUONChamber::Init()
-{
-// Initalisation ..
-//
-// ... for chamber segmentation
-  //PH    if ((*fSegmentation)[0]) 
-  //PH    ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
-    if (fSegmentation->At(0)) 
-    ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
-
-    if (fnsec==2) {
-      //PH     if ((*fSegmentation)[1])
-      //PH     ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
-       if (fSegmentation->At(1))
-       ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
-    }
+  AliDebug(1, Form("ctor this = %p", this) ); 
 }
 
-Int_t   AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
+//_______________________________________________________
+AliMUONChamber::~AliMUONChamber() 
 {
-// Ask segmentation if signal should be generated 
-    if (fnsec==1) {
-      //PH     return ((AliSegmentation*) (*fSegmentation)[0])
-       return ((AliSegmentation*) fSegmentation->At(0))
-           ->SigGenCond(x, y, z) ;
-    } else {
-      //PH     return (((AliSegmentation*) (*fSegmentation)[0])
-       return (((AliSegmentation*) fSegmentation->At(0))
-               ->SigGenCond(x, y, z)) ||
-      //PH         (((AliSegmentation*) (*fSegmentation)[1])
-           (((AliSegmentation*) fSegmentation->At(1))
-            ->SigGenCond(x, y, z)) ;
-    }
-}
+/// Destructor
 
+  AliDebug(1, Form("dtor this = %p", this));
+}
 
-void    AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
+//_____________________________________________________
+void AliMUONChamber::ChargeCorrelationInit() 
 {
-//
-// Initialisation of segmentation for hit
-//  
-    if (fnsec==1) {
-      //PH     ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
-       ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
-    } else {
-      //PH     ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
-      //PH     ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
-       ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
-       ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
-    }
-}
+/// Initialisation of charge correlation for current hit
+/// the value is stored, and then used by Disintegration
 
-void AliMUONChamber::ChargeCorrelationInit() {
-// Initialisation of charge correlation for current hit
-// the value is stored, and then used by Disintegration
-if (fnsec==1) 
-    fCurrentCorrel =1;
-else 
-    // exponential is here to avoid eventual problems in 0 
-    // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
+  // exponential is here to avoid eventual problems in 0 
+  // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
     fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
 }
 
-void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/, 
-                                   Float_t xhit, Float_t yhit, Float_t zhit,
+//_______________________________________________________
+void AliMUONChamber::DisIntegration(AliMUONHit *hit, 
                                    Int_t& nnew,Float_t newclust[6][500]) 
 {
-//    
-//  Generates pad hits (simulated cluster) 
-//  using the segmentation and the response model 
-    Float_t dx, dy;
-    //
-    // Width of the integration area
-    //
-    dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
-    dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
-    //
-    // Get pulse height from energy loss
-    Float_t qtot = fResponse->IntPH(eloss);
-    //
-    // Loop Over Pads
+///  Generates pad hits (simulated cluster) 
+///  using the segmentation and the response model 
+
+  Float_t dx, dy;
+
+  Float_t  xhit = hit->X();
+  Float_t  yhit = hit->Y();
+  Float_t  zhit = hit->Z();
+  Int_t      id = hit->DetElemId();
+  Float_t eloss = hit->Eloss();
+
+  //
+  // Width of the integration area
+  //
+  dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
+  dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
+  //
+  // Get pulse height from energy loss
+  Float_t qtot = fResponse->IntPH(eloss);
+  //
+  // Loop Over Pads
     
-    Float_t qp; 
-    nnew=0;
+  Float_t qp; 
+  nnew=0;
     
-    // Cathode plane loop
-    for (Int_t i=1; i<=fnsec; i++) {
-       Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
-       AliSegmentation * segmentation=
-      //PH         (AliSegmentation *) (*fSegmentation)[i-1];
-           (AliSegmentation *) fSegmentation->At(i-1);
-       for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy); 
-            segmentation->MorePads(); 
-            segmentation->NextPad()) 
-       {
-           qp=fResponse->IntXY(segmentation);
-           qp=TMath::Abs(qp);
-//
-//
-           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
-               newclust[3][nnew]=qp * qcath;                // charge on pad
-               newclust[4][nnew]=segmentation->ISector();  // sector id
-               newclust[5][nnew]=(Float_t) i;              // counter
-               nnew++;
+  // Cathode plane loop
+  for (Int_t i = 1; i <= 2; i++) {
+    Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
+    
+    AliMUONGeometrySegmentation* segmentation=
+      fMUON->GetSegmentation()->GetModuleSegmentation(fId, i-1); 
+
+    for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy); 
+        segmentation->MorePads(id); 
+        segmentation->NextPad(id)) 
+      {
+       qp=fResponse->IntXY(id, segmentation);
+       qp=TMath::Abs(qp);
+       //
+       //
+       if (qp > 1.e-4) 
+         {
+           if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
+             // newclust only contains 500 elements.
+             {
+               AliError("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
+           newclust[3][nnew]=qp * qcath;                // charge on pad
+           newclust[4][nnew]=segmentation->ISector();  // sector id
+           newclust[5][nnew]=(Float_t) i;              // counter
+           nnew++;
                
-           }
-       } // Pad loop
-       
-    } // Cathode plane loop
-}
-
-
-
-void AliMUONChamber::InitGeo(Float_t /*zpos*/)
-{
-//    sensitive gas gap
-      fdGas= 0.5;
-//    3% radiation length of aluminum (X0=8.9 cm)      
-      fdAlu= 3.0/100*8.9;
-}
-
-
-AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& /*rhs*/)
-{
-// Dummy assignment operator
-    return *this;
+         }
+      } // Pad loop
+  } // Cathode plane loop
 }