]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONChamber.cxx
Code for MUON Station1 (I.Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / AliMUONChamber.cxx
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  **************************************************************************/
15 /*
16 $Log$
17 Revision 1.11  2001/07/20 10:03:14  morsch
18 Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba)
19
20 Revision 1.10  2001/03/20 13:17:30  egangler
21 fChargeCorrel moved from AliMUONChamber to AliMUONResponse as decided by
22 January meeting.
23 Setters and Getters are modified accordingly.
24 This modification is transparent to the user code
25
26 Revision 1.9  2001/01/26 21:35:54  morsch
27 All pointers set to 0 in default constructor.
28
29 Revision 1.8  2001/01/17 20:53:40  hristov
30 Destructors corrected to avoid memory leaks
31
32 Revision 1.7  2000/12/20 13:00:22  egangler
33
34 Added charge correlation between cathods.
35 In Config_slat.C, use
36  MUON->Chamber(chamber-1).SetChargeCorrel(0.11); to set the RMS of
37  q1/q2 to 11 % (number from Alberto)
38  This is stored in AliMUONChamber fChargeCorrel member.
39  At generation time, when a tracks enters the volume,
40  AliMUONv1::StepManager calls
41  AliMUONChamber::ChargeCorrelationInit() to set the current value of
42  fCurrentCorrel which is then used at Disintegration level to scale
43  appropriately the PadHit charges.
44
45 Revision 1.6  2000/10/09 14:01:12  morsch
46 Double inclusion of AliResponse removed.
47
48 Revision 1.5  2000/07/03 11:54:57  morsch
49 AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER
50 The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC.
51
52 Revision 1.4  2000/06/29 12:34:09  morsch
53 AliMUONSegmentation class has been made independent of AliMUONChamber. This makes
54 it usable with any other geometry class. The link to the object to which it belongs is
55 established via an index. This assumes that there exists a global geometry manager
56 from which the pointer to the parent object can be obtained (in our case gAlice).
57
58 Revision 1.3  2000/06/28 15:16:35  morsch
59 (1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
60 to allow development of slat-muon chamber simulation and reconstruction code in the MUON
61 framework. The changes should have no side effects (mostly dummy arguments).
62 (2) Hit disintegration uses 3-dim hit coordinates to allow simulation
63 of chambers with overlapping modules (MakePadHits, Disintegration).
64
65 Revision 1.2  2000/06/15 07:58:48  morsch
66 Code from MUON-dev joined
67
68 Revision 1.1.2.5  2000/06/09 21:27:01  morsch
69 Most coding rule violations corrected.
70
71 Revision 1.1.2.4  2000/05/05 11:34:12  morsch
72 Log inside comments.
73
74 Revision 1.1.2.3  2000/05/05 10:09:52  morsch
75 Log messages included
76 */
77
78 // --- MUON includes ---
79 #include "AliMUONChamber.h"
80
81 // --- ROOT includes ---
82
83 #include "TRandom.h"
84 #include "TMath.h"
85
86 ClassImp(AliMUONChamber)        
87
88     AliMUONChamber::AliMUONChamber()
89 {
90 // Default constructor
91     fSegmentation = 0;
92     fResponse=0;
93     fnsec=1;
94     fReconstruction=0;
95     fId=0;
96     // to avoid mistakes if ChargeCorrelInit is not called
97     fCurrentCorrel =1;
98 }
99
100     AliMUONChamber::AliMUONChamber(Int_t id) 
101 {
102 // Construtor with chamber id 
103     fSegmentation = new TObjArray(2);
104     fSegmentation->AddAt(0,0);
105     fSegmentation->AddAt(0,1);
106     fResponse=0;
107     fnsec=1;
108     fReconstruction=0;
109     fId=id;
110     // to avoid mistakes if ChargeCorrelInit is not called
111     fCurrentCorrel =1;
112 }
113
114 AliMUONChamber::~AliMUONChamber() 
115 {
116 // Destructor
117   if (fSegmentation) {
118     fSegmentation->Delete();
119     delete fSegmentation;
120   }
121 }
122
123 AliMUONChamber::AliMUONChamber(const AliMUONChamber& rChamber)
124 {
125 // Dummy copy constructor
126     ;
127 }
128
129
130 void AliMUONChamber::Init()
131 {
132 // Initalisation ..
133 //
134 // ... for chamber segmentation
135   //PH    if ((*fSegmentation)[0]) 
136   //PH    ((AliSegmentation *) (*fSegmentation)[0])->Init(fId);
137     if (fSegmentation->At(0)) 
138     ((AliSegmentation *) fSegmentation->At(0))->Init(fId);
139
140     if (fnsec==2) {
141       //PH      if ((*fSegmentation)[1])
142       //PH      ((AliSegmentation *) (*fSegmentation)[1])->Init(fId);
143         if (fSegmentation->At(1))
144         ((AliSegmentation *) fSegmentation->At(1))->Init(fId);
145     }
146 }
147
148 Int_t   AliMUONChamber::SigGenCond(Float_t x, Float_t y, Float_t z)
149 {
150 // Ask segmentation if signal should be generated 
151     if (fnsec==1) {
152       //PH      return ((AliSegmentation*) (*fSegmentation)[0])
153         return ((AliSegmentation*) fSegmentation->At(0))
154             ->SigGenCond(x, y, z) ;
155     } else {
156       //PH      return (((AliSegmentation*) (*fSegmentation)[0])
157         return (((AliSegmentation*) fSegmentation->At(0))
158                 ->SigGenCond(x, y, z)) ||
159       //PH          (((AliSegmentation*) (*fSegmentation)[1])
160             (((AliSegmentation*) fSegmentation->At(1))
161              ->SigGenCond(x, y, z)) ;
162     }
163 }
164
165
166 void    AliMUONChamber::SigGenInit(Float_t x, Float_t y, Float_t z)
167 {
168 //
169 // Initialisation of segmentation for hit
170 //  
171     if (fnsec==1) {
172       //PH      ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
173         ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
174     } else {
175       //PH      ((AliSegmentation*) (*fSegmentation)[0])->SigGenInit(x, y, z) ;
176       //PH      ((AliSegmentation*) (*fSegmentation)[1])->SigGenInit(x, y, z) ;
177         ((AliSegmentation*) fSegmentation->At(0))->SigGenInit(x, y, z) ;
178         ((AliSegmentation*) fSegmentation->At(1))->SigGenInit(x, y, z) ;
179     }
180 }
181
182 void AliMUONChamber::ChargeCorrelationInit() {
183 // Initialisation of charge correlation for current hit
184 // the value is stored, and then used by Disintegration
185 if (fnsec==1) 
186     fCurrentCorrel =1;
187 else 
188     // exponential is here to avoid eventual problems in 0 
189     // factor 2 because chargecorrel is q1/q2 and not q1/qtrue
190     fCurrentCorrel = TMath::Exp(gRandom->Gaus(0,fResponse->ChargeCorrel()/2));
191 }
192
193 void AliMUONChamber::DisIntegration(Float_t eloss, Float_t tof, 
194                                     Float_t xhit, Float_t yhit, Float_t zhit,
195                                     Int_t& nnew,Float_t newclust[6][500]) 
196 {
197 //    
198 //  Generates pad hits (simulated cluster) 
199 //  using the segmentation and the response model 
200     Float_t dx, dy;
201     //
202     // Width of the integration area
203     //
204     dx=fResponse->SigmaIntegration()*fResponse->ChargeSpreadX();
205     dy=fResponse->SigmaIntegration()*fResponse->ChargeSpreadY();
206     //
207     // Get pulse height from energy loss
208     Float_t qtot = fResponse->IntPH(eloss);
209     //
210     // Loop Over Pads
211     
212     Float_t qcheck=0, qp;
213     nnew=0;
214     
215     // Cathode plane loop
216     for (Int_t i=1; i<=fnsec; i++) {
217         qcheck=0;
218         Float_t qcath = qtot * (i==1? fCurrentCorrel : 1/fCurrentCorrel);
219         AliSegmentation * segmentation=
220       //PH          (AliSegmentation *) (*fSegmentation)[i-1];
221             (AliSegmentation *) fSegmentation->At(i-1);
222         for (segmentation->FirstPad(xhit, yhit, zhit, dx, dy); 
223              segmentation->MorePads(); 
224              segmentation->NextPad()) 
225         {
226             qp=fResponse->IntXY(segmentation);
227             qp=TMath::Abs(qp);
228 //
229 //
230             if (qp > 1.e-4) {
231                 qcheck+=qp*qcath;
232             //
233             // --- store signal information
234                 newclust[0][nnew]=qcath;                     // total charge
235                 newclust[1][nnew]=segmentation->Ix();       // ix-position of pad
236                 newclust[2][nnew]=segmentation->Iy();       // iy-position of pad
237                 newclust[3][nnew]=qp * qcath;                // charge on pad
238                 newclust[4][nnew]=segmentation->ISector();  // sector id
239                 newclust[5][nnew]=(Float_t) i;              // counter
240                 nnew++;
241 //              if (i==2) printf("\n i, nnew, q %d %d %f", i, nnew, qp*qcath);
242                 
243             }
244         } // Pad loop
245         
246     } // Cathode plane loop
247 }
248
249
250
251 void AliMUONChamber::InitGeo(Float_t zpos)
252 {
253 //    sensitive gas gap
254       fdGas= 0.5;
255 //    3% radiation length of aluminum (X0=8.9 cm)      
256       fdAlu= 3.0/100*8.9;
257 }
258
259
260 AliMUONChamber & AliMUONChamber::operator =(const AliMUONChamber& rhs)
261 {
262 // Dummy assignment operator
263     return *this;
264 }