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