]>
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> |
88cb7938 | 43 | #include <TGeometry.h> |
44 | #include <TNode.h> | |
45 | #include <TTree.h> | |
46 | #include <TVirtualMC.h> | |
94de3818 | 47 | |
ecee2a1a | 48 | #include "AliLog.h" |
88cb7938 | 49 | #include "AliLoader.h" |
895a906e | 50 | #include "AliPMDLoader.h" |
88cb7938 | 51 | #include "AliPMD.h" |
88cb7938 | 52 | #include "AliRun.h" |
5d12ce38 | 53 | #include "AliMC.h" |
85a5290f | 54 | #include "AliPMDDigitizer.h" |
895a906e | 55 | #include "AliPMDhit.h" |
c39d2a93 | 56 | #include "AliPMDDDLRawData.h" |
68a330f6 | 57 | #include "AliPMDRawToSDigits.h" |
4fa198c6 | 58 | |
fe4da5cc | 59 | ClassImp(AliPMD) |
60 | ||
61 | //_____________________________________________________________________________ | |
62 | AliPMD::AliPMD() | |
63 | { | |
64 | // | |
65 | // Default constructor | |
66 | // | |
67 | fIshunt = 0; | |
0cc62300 | 68 | |
fe4da5cc | 69 | } |
70 | ||
71 | //_____________________________________________________________________________ | |
72 | AliPMD::AliPMD(const char *name, const char *title) | |
73 | : AliDetector(name,title) | |
74 | { | |
75 | // | |
76 | // Default constructor | |
77 | // | |
78 | ||
79 | // | |
80 | // Allocate the array of hits | |
81 | fHits = new TClonesArray("AliPMDhit", 405); | |
5d12ce38 | 82 | gAlice->GetMCApp()->AddHitList(fHits); |
4fa198c6 | 83 | |
4fa198c6 | 84 | |
4187e4de | 85 | fIshunt = 0; |
fe4da5cc | 86 | |
87 | fPar[0] = 1; | |
88 | fPar[1] = 1; | |
89 | fPar[2] = 0.8; | |
90 | fPar[3] = 0.02; | |
91 | fIn[0] = 6; | |
92 | fIn[1] = 20; | |
93 | fIn[2] = 600; | |
94 | fIn[3] = 27; | |
95 | fIn[4] = 27; | |
96 | fGeo[0] = 0; | |
97 | fGeo[1] = 0.2; | |
98 | fGeo[2] = 4; | |
99 | fPadSize[0] = 0.8; | |
100 | fPadSize[1] = 1.0; | |
101 | fPadSize[2] = 1.2; | |
102 | fPadSize[3] = 1.5; | |
103 | } | |
104 | ||
1661e612 | 105 | AliLoader* AliPMD::MakeLoader(const char* topfoldername) |
106 | { | |
895a906e | 107 | // Makes PMD Loader |
1661e612 | 108 | |
895a906e | 109 | fLoader = new AliPMDLoader(GetName(),topfoldername); |
1661e612 | 110 | |
895a906e | 111 | if (fLoader) |
112 | { | |
2dcb8f31 | 113 | AliDebug(100,"Success"); |
895a906e | 114 | } |
115 | else | |
116 | { | |
ecee2a1a | 117 | AliError("Failure"); |
895a906e | 118 | } |
1661e612 | 119 | |
895a906e | 120 | return fLoader; |
1661e612 | 121 | } |
122 | ||
4fa198c6 | 123 | AliPMD::~AliPMD() |
124 | { | |
125 | // | |
30fdb6d0 | 126 | // Destructor |
4fa198c6 | 127 | // |
4fa198c6 | 128 | } |
129 | ||
fe4da5cc | 130 | //_____________________________________________________________________________ |
131 | void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits) | |
132 | { | |
133 | // | |
134 | // Add a PMD hit | |
135 | // | |
136 | TClonesArray &lhits = *fHits; | |
137 | AliPMDhit *newcell, *curcell; | |
41c97e7a | 138 | // printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d %d %d %d %d\n", |
139 | // hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3], | |
140 | // vol[4],vol[5],vol[6],vol[7]); | |
141 | ||
fe4da5cc | 142 | newcell = new AliPMDhit(fIshunt, track, vol, hits); |
143 | Int_t i; | |
144 | for (i=0; i<fNhits; i++) { | |
145 | // | |
146 | // See if this cell has already been hit | |
147 | curcell=(AliPMDhit*) lhits[i]; | |
148 | if (*curcell==*newcell) { | |
6edc06da | 149 | // printf("Cell with same numbers found\n") ; curcell->Print(); |
fe4da5cc | 150 | *curcell = *curcell+*newcell; |
6edc06da | 151 | // printf("Cell after addition\n") ; curcell->Print(); |
fe4da5cc | 152 | delete newcell; |
153 | return; | |
154 | } | |
155 | } | |
156 | new(lhits[fNhits++]) AliPMDhit(newcell); | |
157 | delete newcell; | |
158 | } | |
159 | ||
160 | //_____________________________________________________________________________ | |
161 | void AliPMD::BuildGeometry() | |
162 | { | |
163 | // | |
164 | // Build simple ROOT TNode geometry for event display | |
165 | // | |
166 | ||
895a906e | 167 | TNode *node, *top; |
fe4da5cc | 168 | const int kColorPMD = kRed; |
169 | ||
170 | // | |
895a906e | 171 | top=gAlice->GetGeometry()->GetNode("alice"); |
fe4da5cc | 172 | |
173 | // PMD | |
174 | new TBRIK("S_PMD","PMD box","void",300,300,5); | |
895a906e | 175 | top->cd(); |
176 | node = new TNode("PMD","PMD","S_PMD",0,0,-600,""); | |
177 | node->SetLineColor(kColorPMD); | |
178 | fNodes->Add(node); | |
fe4da5cc | 179 | } |
180 | ||
fe4da5cc | 181 | //_____________________________________________________________________________ |
182 | void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4) | |
183 | { | |
184 | // | |
185 | // Set PMD parameters | |
186 | // | |
187 | fPar[0] = p1; | |
188 | fPar[1] = p2; | |
189 | fPar[2] = p3; | |
190 | fPar[3] = p4; | |
191 | } | |
192 | ||
193 | //_____________________________________________________________________________ | |
194 | void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5) | |
195 | { | |
196 | // | |
197 | // Set PMD parameters | |
198 | // | |
199 | fIn[0] = p1; | |
200 | fIn[1] = p2; | |
201 | fIn[2] = p3; | |
202 | fIn[3] = p4; | |
203 | fIn[4] = p5; | |
204 | } | |
205 | ||
206 | //_____________________________________________________________________________ | |
207 | void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3) | |
208 | { | |
209 | // | |
210 | // Set geometry parameters | |
211 | // | |
212 | fGeo[0] = p1; | |
213 | fGeo[1] = p2; | |
214 | fGeo[2] = p3; | |
215 | } | |
216 | ||
217 | //_____________________________________________________________________________ | |
218 | void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4) | |
219 | { | |
220 | // | |
221 | // Set pad size | |
222 | // | |
223 | fPadSize[0] = p1; | |
224 | fPadSize[1] = p2; | |
225 | fPadSize[2] = p3; | |
226 | fPadSize[3] = p4; | |
227 | } | |
228 | ||
229 | //_____________________________________________________________________________ | |
230 | void AliPMD::StepManager() | |
231 | { | |
232 | // | |
233 | // Called at every step in PMD | |
234 | // | |
235 | } | |
236 | ||
88cb7938 | 237 | void AliPMD::MakeBranch(Option_t* option) |
4fa198c6 | 238 | { |
239 | // Create Tree branches for the PMD | |
4fa198c6 | 240 | |
88cb7938 | 241 | const char *cH = strstr(option,"H"); |
242 | if (cH && fLoader->TreeH() && (fHits == 0x0)) | |
243 | fHits = new TClonesArray("AliPMDhit", 405); | |
2ab0c725 | 244 | |
88cb7938 | 245 | AliDetector::MakeBranch(option); |
4fa198c6 | 246 | } |
247 | ||
248 | ||
249 | void AliPMD::SetTreeAddress() | |
250 | { | |
30fdb6d0 | 251 | // Set branch address |
252 | ||
1da4d0d9 | 253 | if (fLoader->TreeH() && fHits==0x0) |
88cb7938 | 254 | fHits = new TClonesArray("AliPMDhit", 405); |
255 | ||
4fa198c6 | 256 | AliDetector::SetTreeAddress(); |
4fa198c6 | 257 | } |
258 | ||
85a5290f | 259 | //____________________________________________________________________________ |
260 | void AliPMD::Hits2SDigits() | |
261 | { | |
262 | // create summable digits | |
263 | ||
264 | AliRunLoader* runLoader = fLoader->GetRunLoader(); | |
265 | AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer; | |
266 | pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(), | |
267 | "HS"); | |
40be8527 | 268 | pmdDigitizer->SetZPosition(361.5); |
85a5290f | 269 | |
270 | for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) { | |
271 | pmdDigitizer->Hits2SDigits(iEvent); | |
272 | } | |
273 | fLoader->UnloadHits(); | |
274 | fLoader->UnloadSDigits(); | |
275 | delete pmdDigitizer; | |
276 | } | |
53043784 | 277 | //____________________________________________________________________________ |
278 | void AliPMD::SDigits2Digits() | |
279 | { | |
280 | // creates sdigits to digits | |
281 | } | |
282 | //____________________________________________________________________________ | |
283 | void AliPMD::Hits2Digits() | |
284 | { | |
285 | // create digits | |
286 | ||
287 | AliRunLoader* runLoader = fLoader->GetRunLoader(); | |
288 | AliPMDDigitizer* pmdDigitizer = new AliPMDDigitizer; | |
289 | pmdDigitizer->OpengAliceFile(fLoader->GetRunLoader()->GetFileName().Data(), | |
290 | "HD"); | |
291 | pmdDigitizer->SetZPosition(361.5); | |
292 | ||
293 | for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) { | |
294 | pmdDigitizer->Hits2Digits(iEvent); | |
295 | } | |
296 | fLoader->UnloadHits(); | |
297 | fLoader->UnloadDigits(); | |
298 | delete pmdDigitizer; | |
299 | ||
300 | } | |
fe743527 | 301 | // --------------------------------------------------------------------------- |
dfaeee5f | 302 | AliDigitizer* AliPMD::CreateDigitizer(AliRunDigitizer* manager) const |
53043784 | 303 | { |
304 | return new AliPMDDigitizer(manager); | |
305 | } | |
fe743527 | 306 | // --------------------------------------------------------------------------- |
c39d2a93 | 307 | void AliPMD::Digits2Raw() |
308 | { | |
309 | // convert digits of the current event to raw data | |
310 | ||
311 | fLoader->LoadDigits(); | |
312 | TTree* digits = fLoader->TreeD(); | |
313 | if (!digits) { | |
ecee2a1a | 314 | AliError("No digits tree"); |
c39d2a93 | 315 | return; |
316 | } | |
317 | ||
318 | AliPMDDDLRawData rawWriter; | |
319 | rawWriter.WritePMDRawData(digits); | |
320 | ||
321 | fLoader->UnloadDigits(); | |
322 | } | |
68a330f6 | 323 | |
324 | Bool_t AliPMD::Raw2SDigits(AliRawReader *rawReader) | |
2dcb8f31 | 325 | { |
68a330f6 | 326 | // converts raw to sdigits |
327 | AliRunLoader* runLoader = fLoader->GetRunLoader(); | |
328 | //runLoader->GetEvent(ievt); | |
329 | ||
330 | AliPMDRawToSDigits pmdr2sd; | |
331 | pmdr2sd.Raw2SDigits(runLoader, rawReader); | |
332 | fLoader->UnloadSDigits(); | |
2778698f | 333 | return kTRUE; |
2dcb8f31 | 334 | } |
fe743527 | 335 |