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