]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONChamber.cxx
New classes for shuttle (Laurent)
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
CommitLineData
a9e2aefa 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
2682e810 15
88cb7938 16/* $Id$ */
a9e2aefa 17
d19b6003 18// -----------------------
19// Class AliMUONChamber
20// -----------------------
21// MUON tracking chamber class
22// now only providing DisIntegration function
23
30178c30 24// --- ROOT includes ---
25#include <TRandom.h>
26#include <TMath.h>
a713db22 27#include "AliRun.h"
28
30178c30 29
681d067b 30// --- MUON includes ---
a713db22 31#include "AliMUON.h"
a9e2aefa 32#include "AliMUONChamber.h"
cbf9f933 33#include "AliMUONSegmentation.h"
a713db22 34#include "AliMUONHit.h"
8c343c7c 35#include "AliLog.h"
a9e2aefa 36
5398f946 37/// \cond CLASSIMP
a9e2aefa 38ClassImp(AliMUONChamber)
5398f946 39/// \endcond
a9e2aefa 40
5398f946 41//_______________________________________________________
30178c30 42AliMUONChamber::AliMUONChamber()
43 : TObject(),
44 fId(0),
30178c30 45 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
30178c30 46 fResponse(0),
a713db22 47 fMUON(0)
d81db581 48{
d19b6003 49/// Default constructor
cbf9f933 50
51 AliDebug(1, Form("default (empty) ctor this = %p", this));
d81db581 52}
53
a713db22 54//_______________________________________________________
30178c30 55AliMUONChamber::AliMUONChamber(Int_t id)
56 : TObject(),
57 fId(id),
30178c30 58 fCurrentCorrel(1), // to avoid mistakes if ChargeCorrelInit is not called
30178c30 59 fResponse(0),
a713db22 60 fMUON(0)
a9e2aefa 61{
d19b6003 62/// Standard constructor
a713db22 63
64 // muon
65 fMUON = (AliMUON*)gAlice->GetModule("MUON");
66 if (!fMUON) {
67 AliFatal("MUON detector not defined.");
68 return;
69 }
002920d1 70
cbf9f933 71 AliDebug(1, Form("ctor this = %p", this) );
30178c30 72}
73
a713db22 74//_______________________________________________________
a9e2aefa 75AliMUONChamber::~AliMUONChamber()
76{
d19b6003 77/// Destructor
002920d1 78
cbf9f933 79 AliDebug(1, Form("dtor this = %p", this));
a9e2aefa 80}
81
a713db22 82//_____________________________________________________
d19b6003 83void AliMUONChamber::ChargeCorrelationInit()
84{
85/// Initialisation of charge correlation for current hit
86/// the value is stored, and then used by Disintegration
953daa5a 87
88 // exponential is here to avoid eventual problems in 0
89 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
16d57990 90 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
681d067b 91}
92
a713db22 93//_______________________________________________________
94void AliMUONChamber::DisIntegration(AliMUONHit *hit,
95 Int_t& nnew,Float_t newclust[6][500])
96{
d19b6003 97/// Generates pad hits (simulated cluster)
98/// using the segmentation and the response model
99
a713db22 100 Float_t dx, dy;
101
102 Float_t xhit = hit->X();
103 Float_t yhit = hit->Y();
104 Float_t zhit = hit->Z();
105 Int_t id = hit->DetElemId();
106 Float_t eloss = hit->Eloss();
a9e2aefa 107
a713db22 108 //
109 // Width of the integration area
110 //
111 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
112 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
113 //
114 // Get pulse height from energy loss
115 Float_t qtot = fResponse->IntPH(eloss);
116 //
117 // Loop Over Pads
118
119 Float_t qp;
120 nnew=0;
121
122 // Cathode plane loop
953daa5a 123 for (Int_t i = 1; i <= 2; i++) {
a713db22 124 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
cbf9f933 125
a713db22 126 AliMUONGeometrySegmentation* segmentation=
c2a43efa 127 fMUON->GetSegmentation()->GetModuleSegmentationByDEId(id, i-1);
a713db22 128
129 for (segmentation->FirstPad(id, xhit, yhit, zhit, dx, dy);
130 segmentation->MorePads(id);
131 segmentation->NextPad(id))
132 {
133 qp=fResponse->IntXY(id, segmentation);
134 qp=TMath::Abs(qp);
135 //
136 //
137 if (qp > 1.e-4)
138 {
139 if (nnew >= 500) // Perform a bounds check on nnew since it is assumed
140 // newclust only contains 500 elements.
141 {
142 AliError("Limit of 500 pad responses reached.");
143 return;
144 };
145 //
146 // --- store signal information
147 newclust[0][nnew]=qcath; // total charge
148 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
149 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
150 newclust[3][nnew]=qp * qcath; // charge on pad
151 newclust[4][nnew]=segmentation->ISector(); // sector id
152 newclust[5][nnew]=(Float_t) i; // counter
153 nnew++;
154
155 }
156 } // Pad loop
157 } // Cathode plane loop
158}