]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PMD/AliPMD.cxx
Vertex truncation settings moved to AliGenMC.
[u/mrichter/AliRoot.git] / PMD / AliPMD.cxx
... / ...
CommitLineData
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$
18Revision 1.14 2001/03/12 17:46:22 hristov
19Changes needed on Sun with CC 5.0
20
21Revision 1.13 2001/01/26 20:02:43 hristov
22Major upgrade of AliRoot code
23
24Revision 1.12 2000/12/04 08:48:18 alibrary
25Fixing problems in the HEAD
26
27Revision 1.11 2000/11/17 10:15:24 morsch
28Call to AliDetector::ResetHits() added to method AliPMD::ResetHits()
29
30Revision 1.10 2000/11/06 09:07:13 morsch
31Set fRecPoints to zero in default constructor.
32
33Revision 1.9 2000/10/30 09:03:59 morsch
34Prototype for PMD reconstructed hits (AliPMDRecPoint) added.
35
36Revision 1.8 2000/10/20 06:24:40 fca
37Put the PMD at the right position in the event display
38
39Revision 1.7 2000/10/02 21:28:12 fca
40Removal of useless dependecies via forward declarations
41
42Revision 1.6 2000/01/19 17:17:06 fca
43Introducing a list of lists of hits -- more hits allowed for detector now
44
45Revision 1.5 1999/09/29 09:24:27 fca
46Introduction of the Copyright and cvs Log
47
48*/
49
50///////////////////////////////////////////////////////////////////////////////
51//
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/*
60<img src="picts/AliPMDClass.gif">
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>
75#include <TTree.h>
76#include <TGeometry.h>
77#include <TClonesArray.h>
78#include <TFile.h>
79
80#include "AliPMD.h"
81#include "AliRun.h"
82#include "AliMC.h"
83#include "AliConst.h"
84#include "AliPMDRecPoint.h"
85
86ClassImp(AliPMD)
87
88//_____________________________________________________________________________
89AliPMD::AliPMD()
90{
91 //
92 // Default constructor
93 //
94 fIshunt = 0;
95
96 // Always make the TClonesArray, otherwise the automatic streamer gets angry
97 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
98
99}
100
101//_____________________________________________________________________________
102AliPMD::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);
112 gAlice->AddHitList(fHits);
113
114 fRecPoints = new TClonesArray("AliPMDRecPoint",10000);
115 fNRecPoints = 0;
116
117
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
138AliPMD::~AliPMD()
139{
140 //
141 // Default constructor
142 //
143 delete fRecPoints;
144 fNRecPoints=0;
145}
146
147//_____________________________________________________________________________
148void 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;
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]);
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) {
164// printf("Cell with same numbers found\n") ; curcell->Print();
165 *curcell = *curcell+*newcell;
166// printf("Cell after addition\n") ; curcell->Print();
167 delete newcell;
168 return;
169 }
170 }
171 new(lhits[fNhits++]) AliPMDhit(newcell);
172 delete newcell;
173}
174
175//_____________________________________________________________________________
176void 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();
191 Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
192 Node->SetLineColor(kColorPMD);
193 fNodes->Add(Node);
194}
195
196//_____________________________________________________________________________
197Int_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//_____________________________________________________________________________
207void 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//_____________________________________________________________________________
219void 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//_____________________________________________________________________________
232void 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//_____________________________________________________________________________
243void 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//_____________________________________________________________________________
255void AliPMD::StepManager()
256{
257 //
258 // Called at every step in PMD
259 //
260}
261
262void 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
271void AliPMD::MakeBranch(Option_t* option, const char *file)
272{
273 // Create Tree branches for the PMD
274
275 const char *cR = strstr(option,"R");
276
277 AliDetector::MakeBranch(option,file);
278
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()) {
287 MakeBranchInTree(gAlice->TreeR(),
288 branchname, &fRecPoints, kBufferSize, file);
289 }
290 }
291}
292
293
294void 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
310void AliPMD::ResetHits()
311{
312 //
313 // Reset number of hits and the hits array
314 //
315 AliDetector::ResetHits();
316 fNRecPoints = 0;
317 if (fRecPoints) fRecPoints->Clear();
318}
319
320///////////////////////////////////////////////////////////////////////////////
321// //
322// Photon Multiplicity Detector Version 1 //
323// //
324//Begin_Html
325/*
326<img src="picts/AliPMDv1Class.gif">
327*/
328//End_Html
329// //
330///////////////////////////////////////////////////////////////////////////////
331
332
333
334ClassImp(AliPMDhit)
335
336//_____________________________________________________________________________
337AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
338 AliHit(shunt, track)
339{
340 //
341 // Add a PMD hit
342 //
343 Int_t i;
344 for (i=0;i<5;i++) fVolume[i] = vol[i];
345 fX=hits[0];
346 fY=hits[1];
347 fZ=hits[2];
348 fEnergy=hits[3];
349}
350