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