]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONChamber.cxx
Correction of phi range for generators: 0 < phi < 360
[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
681d067b 18// --- MUON includes ---
a9e2aefa 19#include "AliMUONChamber.h"
a9e2aefa 20
681d067b 21// --- ROOT includes ---
22
23#include "TRandom.h"
a9e2aefa 24#include "TMath.h"
681d067b 25
a9e2aefa 26ClassImp(AliMUONChamber)
27
d81db581 28 AliMUONChamber::AliMUONChamber()
29{
30// Default constructor
0e9bce78 31 fSegmentation = 0;
d81db581 32 fResponse=0;
33 fnsec=1;
34 fReconstruction=0;
35 fId=0;
681d067b 36 // to avoid mistakes if ChargeCorrelInit is not called
681d067b 37 fCurrentCorrel =1;
d81db581 38}
39
40 AliMUONChamber::AliMUONChamber(Int_t id)
a9e2aefa 41{
d81db581 42// Construtor with chamber id
a9e2aefa 43 fSegmentation = new TObjArray(2);
cd4df77b 44 fSegmentation->AddAt(0,0);
45 fSegmentation->AddAt(0,1);
a9e2aefa 46 fResponse=0;
47 fnsec=1;
48 fReconstruction=0;
d81db581 49 fId=id;
681d067b 50 // to avoid mistakes if ChargeCorrelInit is not called
681d067b 51 fCurrentCorrel =1;
a9e2aefa 52}
53
54AliMUONChamber::~AliMUONChamber()
55{
d81db581 56// Destructor
c2c0190f 57 if (fSegmentation) {
58 fSegmentation->Delete();
59 delete fSegmentation;
60 }
a9e2aefa 61}
62
390151b8 63AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber):TObject(rChamber)
64{
65 // Dummy copy constructor
66 ;
67}
a9e2aefa 68
69
70void AliMUONChamber::Init()
71{
72// Initalisation ..
73//
74// ... for chamber segmentation
2682e810 75 //PH if ((*fSegmentation)[0])
76 //PH ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
77 if (fSegmentation->At(0))
78 ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
a9e2aefa 79
80 if (fnsec==2) {
2682e810 81 //PH if ((*fSegmentation)[1])
82 //PH ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
83 if (fSegmentation->At(1))
84 ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
a9e2aefa 85 }
86}
87
88Int_t AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
89{
90// Ask segmentation if signal should be generated
91 if (fnsec==1) {
2682e810 92 //PH return ((AliSegmentation*) (*fSegmentation)[0])
93 return ((AliSegmentation*) fSegmentation->At(0))
a9e2aefa 94 ->SigGenCond(x, y, z) ;
95 } else {
2682e810 96 //PH return (((AliSegmentation*) (*fSegmentation)[0])
97 return (((AliSegmentation*) fSegmentation->At(0))
a9e2aefa 98 ->SigGenCond(x, y, z)) ||
2682e810 99 //PH (((AliSegmentation*) (*fSegmentation)[1])
100 (((AliSegmentation*) fSegmentation->At(1))
a9e2aefa 101 ->SigGenCond(x, y, z)) ;
102 }
103}
104
105
106void AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
107{
108//
109// Initialisation of segmentation for hit
110//
111 if (fnsec==1) {
2682e810 112 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
113 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
a9e2aefa 114 } else {
2682e810 115 //PH ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
116 //PH ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
117 ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
118 ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
a9e2aefa 119 }
120}
121
681d067b 122void AliMUONChamber::ChargeCorrelationInit() {
123// Initialisation of charge correlation for current hit
124// the value is stored, and then used by Disintegration
125if (fnsec==1)
126 fCurrentCorrel =1;
127else
128 // exponential is here to avoid eventual problems in 0
16d57990 129 // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
130 fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
681d067b 131}
132
24fe6002 133void AliMUONChamber::DisIntegration(Float_t eloss, Float_t /*tof*/,
802a864d 134 Float_t xhit, Float_t yhit, Float_t zhit,
a9e2aefa 135 Int_t& nnew,Float_t newclust[6][500])
136{
137//
138// Generates pad hits (simulated cluster)
139// using the segmentation and the response model
140 Float_t dx, dy;
141 //
142 // Width of the integration area
143 //
144 dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
145 dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
146 //
147 // Get pulse height from energy loss
148 Float_t qtot = fResponse->IntPH(eloss);
149 //
150 // Loop Over Pads
151
152 Float_t qcheck=0, qp;
153 nnew=0;
ef495f13 154
681d067b 155 // Cathode plane loop
a9e2aefa 156 for (Int_t i=1; i<=fnsec; i++) {
157 qcheck=0;
681d067b 158 Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
a30a000f 159 AliSegmentation * segmentation=
2682e810 160 //PH (AliSegmentation *) (*fSegmentation)[i-1];
161 (AliSegmentation *) fSegmentation->At(i-1);
802a864d 162 for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy);
a9e2aefa 163 segmentation->MorePads();
164 segmentation->NextPad())
165 {
166 qp=fResponse->IntXY(segmentation);
167 qp=TMath::Abs(qp);
a9e2aefa 168//
169//
170 if (qp > 1.e-4) {
681d067b 171 qcheck+=qp*qcath;
a9e2aefa 172 //
173 // --- store signal information
681d067b 174 newclust[0][nnew]=qcath; // total charge
a9e2aefa 175 newclust[1][nnew]=segmentation->Ix(); // ix-position of pad
176 newclust[2][nnew]=segmentation->Iy(); // iy-position of pad
681d067b 177 newclust[3][nnew]=qp * qcath; // charge on pad
a9e2aefa 178 newclust[4][nnew]=segmentation->ISector(); // sector id
179 newclust[5][nnew]=(Float_t) i; // counter
180 nnew++;
681d067b 181// if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
ef495f13 182
a9e2aefa 183 }
184 } // Pad loop
ef495f13 185
a9e2aefa 186 } // Cathode plane loop
187}
188
189
190
24fe6002 191void AliMUONChamber::InitGeo(Float_t /*zpos*/)
a9e2aefa 192{
193// sensitive gas gap
194 fdGas= 0.5;
195// 3% radiation length of aluminum (X0=8.9 cm)
196 fdAlu= 3.0/100*8.9;
197}
198
199
24fe6002 200AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& /*rhs*/)
a9e2aefa 201{
202// Dummy assignment operator
203 return *this;
204}