4c039060 |
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 | /* |
17 | $Log$ |
0cc62300 |
18 | Revision 1.11 2000/11/17 10:15:24 morsch |
19 | Call to AliDetector::ResetHits() added to method AliPMD::ResetHits() |
20 | |
d3b63a89 |
21 | Revision 1.10 2000/11/06 09:07:13 morsch |
22 | Set fRecPoints to zero in default constructor. |
23 | |
d2c4ec78 |
24 | Revision 1.9 2000/10/30 09:03:59 morsch |
25 | Prototype for PMD reconstructed hits (AliPMDRecPoint) added. |
26 | |
4fa198c6 |
27 | Revision 1.8 2000/10/20 06:24:40 fca |
28 | Put the PMD at the right position in the event display |
29 | |
d651cc98 |
30 | Revision 1.7 2000/10/02 21:28:12 fca |
31 | Removal of useless dependecies via forward declarations |
32 | |
94de3818 |
33 | Revision 1.6 2000/01/19 17:17:06 fca |
34 | Introducing a list of lists of hits -- more hits allowed for detector now |
35 | |
1cedd08a |
36 | Revision 1.5 1999/09/29 09:24:27 fca |
37 | Introduction of the Copyright and cvs Log |
38 | |
4c039060 |
39 | */ |
40 | |
fe4da5cc |
41 | /////////////////////////////////////////////////////////////////////////////// |
6edc06da |
42 | // |
fe4da5cc |
43 | // // |
44 | // Photon Multiplicity Detector // |
45 | // This class contains the basic functions for the Photon Multiplicity // |
46 | // Detector. Functions specific to one particular geometry are // |
47 | // contained in the derived classes // |
48 | // // |
49 | //Begin_Html |
50 | /* |
1439f98e |
51 | <img src="picts/AliPMDClass.gif"> |
fe4da5cc |
52 | </pre> |
53 | <br clear=left> |
54 | <font size=+2 color=red> |
55 | <p>The responsible person for this module is |
56 | <a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>. |
57 | </font> |
58 | <pre> |
59 | */ |
60 | //End_Html |
61 | // // |
62 | /////////////////////////////////////////////////////////////////////////////// |
63 | |
64 | #include <TBRIK.h> |
65 | #include <TNode.h> |
4fa198c6 |
66 | #include <TTree.h> |
94de3818 |
67 | #include <TGeometry.h> |
4fa198c6 |
68 | #include <TClonesArray.h> |
94de3818 |
69 | |
fe4da5cc |
70 | #include "AliPMD.h" |
71 | #include "AliRun.h" |
6edc06da |
72 | #include "AliMC.h" |
fe4da5cc |
73 | #include "AliConst.h" |
4fa198c6 |
74 | #include "AliPMDRecPoint.h" |
75 | |
fe4da5cc |
76 | ClassImp(AliPMD) |
77 | |
78 | //_____________________________________________________________________________ |
79 | AliPMD::AliPMD() |
80 | { |
81 | // |
82 | // Default constructor |
83 | // |
84 | fIshunt = 0; |
0cc62300 |
85 | |
86 | // Always make the TClonesArray, otherwise the automatic streamer gets angry |
87 | fRecPoints = new TClonesArray("AliPMDRecPoint",10000); |
fe4da5cc |
88 | } |
89 | |
90 | //_____________________________________________________________________________ |
91 | AliPMD::AliPMD(const char *name, const char *title) |
92 | : AliDetector(name,title) |
93 | { |
94 | // |
95 | // Default constructor |
96 | // |
97 | |
98 | // |
99 | // Allocate the array of hits |
100 | fHits = new TClonesArray("AliPMDhit", 405); |
1cedd08a |
101 | gAlice->AddHitList(fHits); |
4fa198c6 |
102 | |
103 | fRecPoints = new TClonesArray("AliPMDRecPoint",10000); |
104 | fNRecPoints = 0; |
fe4da5cc |
105 | |
4fa198c6 |
106 | |
fe4da5cc |
107 | fIshunt = 1; |
108 | |
109 | fPar[0] = 1; |
110 | fPar[1] = 1; |
111 | fPar[2] = 0.8; |
112 | fPar[3] = 0.02; |
113 | fIn[0] = 6; |
114 | fIn[1] = 20; |
115 | fIn[2] = 600; |
116 | fIn[3] = 27; |
117 | fIn[4] = 27; |
118 | fGeo[0] = 0; |
119 | fGeo[1] = 0.2; |
120 | fGeo[2] = 4; |
121 | fPadSize[0] = 0.8; |
122 | fPadSize[1] = 1.0; |
123 | fPadSize[2] = 1.2; |
124 | fPadSize[3] = 1.5; |
125 | } |
126 | |
4fa198c6 |
127 | AliPMD::~AliPMD() |
128 | { |
129 | // |
130 | // Default constructor |
131 | // |
132 | delete fRecPoints; |
133 | fNRecPoints=0; |
134 | } |
135 | |
fe4da5cc |
136 | //_____________________________________________________________________________ |
137 | void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits) |
138 | { |
139 | // |
140 | // Add a PMD hit |
141 | // |
142 | TClonesArray &lhits = *fHits; |
143 | AliPMDhit *newcell, *curcell; |
6edc06da |
144 | // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n", |
145 | // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]); |
fe4da5cc |
146 | newcell = new AliPMDhit(fIshunt, track, vol, hits); |
147 | Int_t i; |
148 | for (i=0; i<fNhits; i++) { |
149 | // |
150 | // See if this cell has already been hit |
151 | curcell=(AliPMDhit*) lhits[i]; |
152 | if (*curcell==*newcell) { |
6edc06da |
153 | // printf("Cell with same numbers found\n") ; curcell->Print(); |
fe4da5cc |
154 | *curcell = *curcell+*newcell; |
6edc06da |
155 | // printf("Cell after addition\n") ; curcell->Print(); |
fe4da5cc |
156 | delete newcell; |
157 | return; |
158 | } |
159 | } |
160 | new(lhits[fNhits++]) AliPMDhit(newcell); |
161 | delete newcell; |
162 | } |
163 | |
164 | //_____________________________________________________________________________ |
165 | void AliPMD::BuildGeometry() |
166 | { |
167 | // |
168 | // Build simple ROOT TNode geometry for event display |
169 | // |
170 | |
171 | TNode *Node, *Top; |
172 | const int kColorPMD = kRed; |
173 | |
174 | // |
175 | Top=gAlice->GetGeometry()->GetNode("alice"); |
176 | |
177 | // PMD |
178 | new TBRIK("S_PMD","PMD box","void",300,300,5); |
179 | Top->cd(); |
d651cc98 |
180 | Node = new TNode("PMD","PMD","S_PMD",0,0,-600,""); |
fe4da5cc |
181 | Node->SetLineColor(kColorPMD); |
182 | fNodes->Add(Node); |
183 | } |
184 | |
185 | //_____________________________________________________________________________ |
186 | Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t ) |
187 | { |
188 | // |
189 | // Distance from mouse to detector on the screen |
190 | // dummy routine |
191 | // |
192 | return 9999; |
193 | } |
194 | |
195 | //_____________________________________________________________________________ |
196 | void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4) |
197 | { |
198 | // |
199 | // Set PMD parameters |
200 | // |
201 | fPar[0] = p1; |
202 | fPar[1] = p2; |
203 | fPar[2] = p3; |
204 | fPar[3] = p4; |
205 | } |
206 | |
207 | //_____________________________________________________________________________ |
208 | void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5) |
209 | { |
210 | // |
211 | // Set PMD parameters |
212 | // |
213 | fIn[0] = p1; |
214 | fIn[1] = p2; |
215 | fIn[2] = p3; |
216 | fIn[3] = p4; |
217 | fIn[4] = p5; |
218 | } |
219 | |
220 | //_____________________________________________________________________________ |
221 | void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3) |
222 | { |
223 | // |
224 | // Set geometry parameters |
225 | // |
226 | fGeo[0] = p1; |
227 | fGeo[1] = p2; |
228 | fGeo[2] = p3; |
229 | } |
230 | |
231 | //_____________________________________________________________________________ |
232 | void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4) |
233 | { |
234 | // |
235 | // Set pad size |
236 | // |
237 | fPadSize[0] = p1; |
238 | fPadSize[1] = p2; |
239 | fPadSize[2] = p3; |
240 | fPadSize[3] = p4; |
241 | } |
242 | |
243 | //_____________________________________________________________________________ |
244 | void AliPMD::StepManager() |
245 | { |
246 | // |
247 | // Called at every step in PMD |
248 | // |
249 | } |
250 | |
4fa198c6 |
251 | void AliPMD::AddRecPoint(const AliPMDRecPoint &p) |
252 | { |
253 | // |
254 | // Add a PMD reconstructed hit to the list |
255 | // |
256 | TClonesArray &lrecpoints = *fRecPoints; |
257 | new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p); |
258 | } |
259 | |
260 | void AliPMD::MakeBranch(Option_t* option) |
261 | { |
262 | // Create Tree branches for the PMD |
263 | printf("Make Branch - TreeR address %p\n",gAlice->TreeR()); |
264 | |
265 | const Int_t kBufferSize = 4000; |
266 | char branchname[30]; |
267 | |
268 | AliDetector::MakeBranch(option); |
269 | |
270 | sprintf(branchname,"%sRecPoints",GetName()); |
271 | if (fRecPoints && gAlice->TreeR()) { |
272 | gAlice->TreeR()->Branch(branchname, &fRecPoints, kBufferSize); |
273 | printf("Making Branch %s for reconstructed hits\n",branchname); |
274 | } |
275 | } |
276 | |
277 | |
278 | void AliPMD::SetTreeAddress() |
279 | { |
280 | // Set branch address for the TreeR |
281 | char branchname[30]; |
282 | AliDetector::SetTreeAddress(); |
283 | |
284 | TBranch *branch; |
285 | TTree *treeR = gAlice->TreeR(); |
286 | |
287 | sprintf(branchname,"%s",GetName()); |
288 | if (treeR && fRecPoints) { |
289 | branch = treeR->GetBranch(branchname); |
290 | if (branch) branch->SetAddress(&fRecPoints); |
291 | } |
292 | } |
293 | |
294 | void AliPMD::ResetHits() |
295 | { |
296 | // |
297 | // Reset number of hits and the hits array |
298 | // |
d3b63a89 |
299 | AliDetector::ResetHits(); |
300 | fNRecPoints = 0; |
301 | if (fRecPoints) fRecPoints->Clear(); |
4fa198c6 |
302 | } |
303 | |
fe4da5cc |
304 | /////////////////////////////////////////////////////////////////////////////// |
305 | // // |
306 | // Photon Multiplicity Detector Version 1 // |
307 | // // |
308 | //Begin_Html |
309 | /* |
1439f98e |
310 | <img src="picts/AliPMDv1Class.gif"> |
fe4da5cc |
311 | */ |
312 | //End_Html |
313 | // // |
314 | /////////////////////////////////////////////////////////////////////////////// |
315 | |
4fa198c6 |
316 | |
317 | |
fe4da5cc |
318 | ClassImp(AliPMDhit) |
319 | |
320 | //_____________________________________________________________________________ |
6edc06da |
321 | AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits): |
fe4da5cc |
322 | AliHit(shunt, track) |
323 | { |
324 | // |
325 | // Add a PMD hit |
326 | // |
327 | Int_t i; |
6edc06da |
328 | for (i=0;i<5;i++) fVolume[i] = vol[i]; |
fe4da5cc |
329 | fX=hits[0]; |
330 | fY=hits[1]; |
331 | fZ=hits[2]; |
332 | fEnergy=hits[3]; |
333 | } |
6edc06da |
334 | |