]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONChamber.cxx
Make the Scan method public
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
index 29b3a4734f8ff45927a017a15300970499faa355..c55631ef1b56efd9bda5f49c9b023f00e8096e17 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/*
-$Log$
-Revision 1.1.2.5  2000/06/09 21:27:01  morsch
-Most coding rule violations corrected.
 
-Revision 1.1.2.4  2000/05/05 11:34:12  morsch
-Log inside comments.
+/* $Id$ */
 
-Revision 1.1.2.3  2000/05/05 10:09:52  morsch
-Log messages included
-*/
+//-----------------------------------------------------------------------------
+// Class AliMUONChamber
+// -----------------------
+// MUON tracking chamber class
+// now only providing DisIntegration function
+//-----------------------------------------------------------------------------
 
+// --- ROOT includes ---
+#include <TRandom.h>
+#include <TMath.h>
+#include "AliRun.h"
+
+
+// --- MUON includes ---
+#include "AliMUON.h"
 #include "AliMUONChamber.h"
-#include "AliMUONSegmentation.h"
-#include "AliMUONResponse.h"
+#include "AliMUONHit.h"
+#include "AliLog.h"
 
-#include "TMath.h"
+/// \cond CLASSIMP
 ClassImp(AliMUONChamber)       
-
-    AliMUONChamber::AliMUONChamber() 
+/// \endcond
+
+//_______________________________________________________
+AliMUONChamber::AliMUONChamber()
+  : TObject(), 
+    fId(0),
+    fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
+    fResponse(0),
+    fMUON(0)
 {
-    fSegmentation = new TObjArray(2);
-    (*fSegmentation)[0] = 0;
-    (*fSegmentation)[1] = 0;    
-    fResponse=0;
-    fnsec=1;
-    fReconstruction=0;
-}
+/// Default constructor
 
-AliMUONChamber::~AliMUONChamber() 
-{
-    if (fSegmentation) delete fSegmentation;
+  AliDebug(1, Form("default (empty) ctor this = %p", this));
 }
 
-AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
+//_______________________________________________________
+AliMUONChamber::AliMUONChamber(Int_t id) 
+  : TObject(), 
+    fId(id),
+    fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
+    fResponse(0),
+    fMUON(0)
 {
-// Dummy copy constructor
-    ;
-}
+/// Standard constructor
 
+    // muon
+    fMUON = (AliMUON*)gAlice->GetModule("MUON");
+    if (!fMUON) {
+      AliFatal("MUON detector not defined.");
+      return;
+    }  
 
-void AliMUONChamber::Init()
-{
-// Initalisation ..
-//
-// ... for chamber segmentation
-    if ((*fSegmentation)[0]) 
-    ((AliMUONSegmentation *) (*fSegmentation)[0])->Init(this);
-
-    if (fnsec==2) {
-       if ((*fSegmentation)[1])
-       ((AliMUONSegmentation *) (*fSegmentation)[1])->Init(this);
-    }
+  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) {
-       return ((AliMUONSegmentation*) (*fSegmentation)[0])
-           ->SigGenCond(x, y, z) ;
-    } else {
-       return (((AliMUONSegmentation*) (*fSegmentation)[0])
-               ->SigGenCond(x, y, z)) ||
-           (((AliMUONSegmentation*) (*fSegmentation)[1])
-            ->SigGenCond(x, y, z)) ;
-    }
-}
-
+/// Destructor
 
-void    AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
-{
-//
-// Initialisation of segmentation for hit
-//  
-    if (fnsec==1) {
-       ((AliMUONSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
-    } else {
-       ((AliMUONSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
-       ((AliMUONSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
-    }
+  AliDebug(1, Form("dtor this = %p", this));
+  delete fResponse;
 }
 
-void AliMUONChamber::DisIntegration(Float_t eloss, Float_t tof, 
-                                   Float_t xhit, Float_t yhit,
-                                   Int_t& nnew,Float_t newclust[6][500]) 
+//_____________________________________________________
+void AliMUONChamber::ChargeCorrelationInit() 
 {
-//    
-//  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
-    
-    Float_t qcheck=0, qp;
-    nnew=0;
-    for (Int_t i=1; i<=fnsec; i++) {
-       qcheck=0;
-       AliMUONSegmentation * segmentation=
-           (AliMUONSegmentation *) (*fSegmentation)[i-1];
-       for (segmentation->FirstPad(xhit, yhit, dx, dy); 
-            segmentation->MorePads(); 
-            segmentation->NextPad()) 
-       {
-           qp=fResponse->IntXY(segmentation);
-           qp=TMath::Abs(qp);
-           
-//
-//
-           if (qp > 1.e-4) {
-               qcheck+=qp;
-           //
-           // --- store signal information
-               newclust[0][nnew]=qtot;                     // total charge
-               newclust[1][nnew]=segmentation->Ix();       // ix-position of pad
-               newclust[2][nnew]=segmentation->Iy();       // iy-position of pad
-               newclust[3][nnew]=qp * qtot;                // charge on pad
-               newclust[4][nnew]=segmentation->ISector();  // sector id
-               newclust[5][nnew]=(Float_t) i;              // counter
-               nnew++;
-           }
-       } // Pad loop
-    } // Cathode plane loop
-}
-
+/// Initialisation of charge correlation for current hit
+/// the value is stored, and then used by Disintegration
 
-
-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;
+  // 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));
 }
 
-
-AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
+//_____________________________________________________________________________
+void
+AliMUONChamber::SetResponseModel(const AliMUONResponse& thisResponse)
 {
-// Dummy assignment operator
-    return *this;
+  delete fResponse;
+  fResponse = static_cast<AliMUONResponse*>(thisResponse.Clone());
 }
+