]>
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" |
5d12ce38 | 54 | #include "AliMC.h" |
4fa198c6 | 55 | |
fe4da5cc | 56 | ClassImp(AliPMD) |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliPMD::AliPMD() | |
60 | { | |
61 | // | |
62 | // Default constructor | |
63 | // | |
64 | fIshunt = 0; | |
0cc62300 | 65 | |
427f8f1d | 66 | fRecPoints = 0; |
2ab0c725 | 67 | |
fe4da5cc | 68 | } |
69 | ||
70 | //_____________________________________________________________________________ | |
71 | AliPMD::AliPMD(const char *name, const char *title) | |
72 | : AliDetector(name,title) | |
73 | { | |
74 | // | |
75 | // Default constructor | |
76 | // | |
77 | ||
78 | // | |
79 | // Allocate the array of hits | |
80 | fHits = new TClonesArray("AliPMDhit", 405); | |
5d12ce38 | 81 | gAlice->GetMCApp()->AddHitList(fHits); |
4fa198c6 | 82 | |
83 | fRecPoints = new TClonesArray("AliPMDRecPoint",10000); | |
84 | fNRecPoints = 0; | |
fe4da5cc | 85 | |
4fa198c6 | 86 | |
4187e4de | 87 | fIshunt = 0; |
fe4da5cc | 88 | |
89 | fPar[0] = 1; | |
90 | fPar[1] = 1; | |
91 | fPar[2] = 0.8; | |
92 | fPar[3] = 0.02; | |
93 | fIn[0] = 6; | |
94 | fIn[1] = 20; | |
95 | fIn[2] = 600; | |
96 | fIn[3] = 27; | |
97 | fIn[4] = 27; | |
98 | fGeo[0] = 0; | |
99 | fGeo[1] = 0.2; | |
100 | fGeo[2] = 4; | |
101 | fPadSize[0] = 0.8; | |
102 | fPadSize[1] = 1.0; | |
103 | fPadSize[2] = 1.2; | |
104 | fPadSize[3] = 1.5; | |
105 | } | |
106 | ||
1661e612 | 107 | AliLoader* AliPMD::MakeLoader(const char* topfoldername) |
108 | { | |
109 | cout<<"AliPMD::MakeLoader "; | |
110 | ||
111 | fLoader = new AliPMDLoader(GetName(),topfoldername); | |
112 | ||
113 | if (fLoader) | |
114 | { | |
115 | cout<<"Success"<<endl; | |
116 | } | |
117 | else | |
118 | { | |
119 | cout<<"Failure"<<endl; | |
120 | } | |
121 | ||
122 | return fLoader; | |
123 | } | |
124 | ||
4fa198c6 | 125 | AliPMD::~AliPMD() |
126 | { | |
127 | // | |
128 | // Default constructor | |
129 | // | |
130 | delete fRecPoints; | |
131 | fNRecPoints=0; | |
132 | } | |
133 | ||
fe4da5cc | 134 | //_____________________________________________________________________________ |
135 | void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
136 | { | |
137 | // | |
138 | // Add a PMD hit | |
139 | // | |
140 | TClonesArray &lhits = *fHits; | |
141 | AliPMDhit *newcell, *curcell; | |
41c97e7a | 142 | // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n", |
143 | // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3], | |
144 | // vol[4],vol[5],vol[6],vol[7]); | |
145 | ||
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 | ||
88cb7938 | 260 | void AliPMD::MakeBranch(Option_t* option) |
4fa198c6 | 261 | { |
262 | // Create Tree branches for the PMD | |
4fa198c6 | 263 | |
5cf7bbad | 264 | const char *cR = strstr(option,"R"); |
88cb7938 | 265 | const char *cH = strstr(option,"H"); |
266 | if (cH && fLoader->TreeH() && (fHits == 0x0)) | |
267 | fHits = new TClonesArray("AliPMDhit", 405); | |
2ab0c725 | 268 | |
88cb7938 | 269 | AliDetector::MakeBranch(option); |
4fa198c6 | 270 | |
88cb7938 | 271 | if (cR && fLoader->TreeR()) { |
272 | printf("Make Branch - TreeR address %p\n",fLoader->TreeR()); | |
2ab0c725 | 273 | |
274 | const Int_t kBufferSize = 4000; | |
275 | char branchname[30]; | |
276 | ||
277 | sprintf(branchname,"%sRecPoints",GetName()); | |
88cb7938 | 278 | if (fRecPoints == 0x0) { |
279 | fRecPoints = new TClonesArray("AliPMDRecPoint",10000); | |
2ab0c725 | 280 | } |
88cb7938 | 281 | MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints, kBufferSize,0); |
2ab0c725 | 282 | } |
4fa198c6 | 283 | } |
284 | ||
285 | ||
286 | void AliPMD::SetTreeAddress() | |
287 | { | |
288 | // Set branch address for the TreeR | |
289 | char branchname[30]; | |
88cb7938 | 290 | |
1da4d0d9 | 291 | if (fLoader->TreeH() && fHits==0x0) |
88cb7938 | 292 | fHits = new TClonesArray("AliPMDhit", 405); |
293 | ||
4fa198c6 | 294 | AliDetector::SetTreeAddress(); |
295 | ||
296 | TBranch *branch; | |
88cb7938 | 297 | TTree *treeR = fLoader->TreeR(); |
4fa198c6 | 298 | |
299 | sprintf(branchname,"%s",GetName()); | |
88cb7938 | 300 | if (treeR) { |
301 | branch = treeR->GetBranch(branchname); | |
302 | if (branch) | |
303 | { | |
304 | if (fRecPoints == 0x0) { | |
305 | fRecPoints = new TClonesArray("AliPMDRecPoint",10000); | |
306 | } | |
307 | branch->SetAddress(&fRecPoints); | |
308 | } | |
4fa198c6 | 309 | } |
310 | } | |
311 | ||
312 | void AliPMD::ResetHits() | |
313 | { | |
314 | // | |
315 | // Reset number of hits and the hits array | |
316 | // | |
d3b63a89 | 317 | AliDetector::ResetHits(); |
318 | fNRecPoints = 0; | |
319 | if (fRecPoints) fRecPoints->Clear(); | |
4fa198c6 | 320 | } |
321 | ||
fe4da5cc | 322 | /////////////////////////////////////////////////////////////////////////////// |
323 | // // | |
324 | // Photon Multiplicity Detector Version 1 // | |
325 | // // | |
326 | //Begin_Html | |
327 | /* | |
1439f98e | 328 | <img src="picts/AliPMDv1Class.gif"> |
fe4da5cc | 329 | */ |
330 | //End_Html | |
331 | // // | |
332 | /////////////////////////////////////////////////////////////////////////////// | |
333 | ||
4fa198c6 | 334 | |
335 | ||
fe4da5cc | 336 | ClassImp(AliPMDhit) |
337 | ||
338 | //_____________________________________________________________________________ | |
6edc06da | 339 | AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits): |
fe4da5cc | 340 | AliHit(shunt, track) |
341 | { | |
342 | // | |
343 | // Add a PMD hit | |
344 | // | |
345 | Int_t i; | |
41c97e7a | 346 | for (i=0;i<8;i++) fVolume[i] = vol[i]; |
fe4da5cc | 347 | fX=hits[0]; |
348 | fY=hits[1]; | |
349 | fZ=hits[2]; | |
350 | fEnergy=hits[3]; | |
351 | } | |
6edc06da | 352 |