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