Medium array is now private for each module
[u/mrichter/AliRoot.git] / PMD / AliPMD.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
6edc06da 2//
fe4da5cc 3// //
4// Photon Multiplicity Detector //
5// This class contains the basic functions for the Photon Multiplicity //
6// Detector. Functions specific to one particular geometry are //
7// contained in the derived classes //
8// //
9//Begin_Html
10/*
1439f98e 11<img src="picts/AliPMDClass.gif">
fe4da5cc 12</pre>
13<br clear=left>
14<font size=+2 color=red>
15<p>The responsible person for this module is
16<a href="mailto:sub@vecdec.veccal.ernet.in">Subhasis Chattopadhyay</a>.
17</font>
18<pre>
19*/
20//End_Html
21// //
22///////////////////////////////////////////////////////////////////////////////
23
24#include <TBRIK.h>
25#include <TNode.h>
26#include "AliPMD.h"
27#include "AliRun.h"
6edc06da 28#include "AliMC.h"
fe4da5cc 29#include "AliConst.h"
30
fe4da5cc 31ClassImp(AliPMD)
32
33//_____________________________________________________________________________
34AliPMD::AliPMD()
35{
36 //
37 // Default constructor
38 //
39 fIshunt = 0;
40}
41
42//_____________________________________________________________________________
43AliPMD::AliPMD(const char *name, const char *title)
44 : AliDetector(name,title)
45{
46 //
47 // Default constructor
48 //
49
50 //
51 // Allocate the array of hits
52 fHits = new TClonesArray("AliPMDhit", 405);
53
54 fIshunt = 1;
55
56 fPar[0] = 1;
57 fPar[1] = 1;
58 fPar[2] = 0.8;
59 fPar[3] = 0.02;
60 fIn[0] = 6;
61 fIn[1] = 20;
62 fIn[2] = 600;
63 fIn[3] = 27;
64 fIn[4] = 27;
65 fGeo[0] = 0;
66 fGeo[1] = 0.2;
67 fGeo[2] = 4;
68 fPadSize[0] = 0.8;
69 fPadSize[1] = 1.0;
70 fPadSize[2] = 1.2;
71 fPadSize[3] = 1.5;
72}
73
74//_____________________________________________________________________________
75void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
76{
77 //
78 // Add a PMD hit
79 //
80 TClonesArray &lhits = *fHits;
81 AliPMDhit *newcell, *curcell;
6edc06da 82// printf("PMD++ Adding energy %f, prim %d, vol %d %d %d %d\n",
83// hits[3],gAlice->GetPrimary(track-1),vol[0],vol[1],vol[2],vol[3]);
fe4da5cc 84 newcell = new AliPMDhit(fIshunt, track, vol, hits);
85 Int_t i;
86 for (i=0; i<fNhits; i++) {
87 //
88 // See if this cell has already been hit
89 curcell=(AliPMDhit*) lhits[i];
90 if (*curcell==*newcell) {
6edc06da 91// printf("Cell with same numbers found\n") ; curcell->Print();
fe4da5cc 92 *curcell = *curcell+*newcell;
6edc06da 93// printf("Cell after addition\n") ; curcell->Print();
fe4da5cc 94 delete newcell;
95 return;
96 }
97 }
98 new(lhits[fNhits++]) AliPMDhit(newcell);
99 delete newcell;
100}
101
102//_____________________________________________________________________________
103void AliPMD::BuildGeometry()
104{
105 //
106 // Build simple ROOT TNode geometry for event display
107 //
108
109 TNode *Node, *Top;
110 const int kColorPMD = kRed;
111
112 //
113 Top=gAlice->GetGeometry()->GetNode("alice");
114
115 // PMD
116 new TBRIK("S_PMD","PMD box","void",300,300,5);
117 Top->cd();
118 Node = new TNode("PMD","PMD","S_PMD",0,0,600,"");
119 Node->SetLineColor(kColorPMD);
120 fNodes->Add(Node);
121}
122
123//_____________________________________________________________________________
124Int_t AliPMD::DistancetoPrimitive(Int_t , Int_t )
125{
126 //
127 // Distance from mouse to detector on the screen
128 // dummy routine
129 //
130 return 9999;
131}
132
133//_____________________________________________________________________________
134void AliPMD::SetPAR(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
135{
136 //
137 // Set PMD parameters
138 //
139 fPar[0] = p1;
140 fPar[1] = p2;
141 fPar[2] = p3;
142 fPar[3] = p4;
143}
144
145//_____________________________________________________________________________
146void AliPMD::SetIN(Float_t p1, Float_t p2, Float_t p3,Float_t p4,Float_t p5)
147{
148 //
149 // Set PMD parameters
150 //
151 fIn[0] = p1;
152 fIn[1] = p2;
153 fIn[2] = p3;
154 fIn[3] = p4;
155 fIn[4] = p5;
156}
157
158//_____________________________________________________________________________
159void AliPMD::SetGEO(Float_t p1, Float_t p2, Float_t p3)
160{
161 //
162 // Set geometry parameters
163 //
164 fGeo[0] = p1;
165 fGeo[1] = p2;
166 fGeo[2] = p3;
167}
168
169//_____________________________________________________________________________
170void AliPMD::SetPadSize(Float_t p1, Float_t p2, Float_t p3,Float_t p4)
171{
172 //
173 // Set pad size
174 //
175 fPadSize[0] = p1;
176 fPadSize[1] = p2;
177 fPadSize[2] = p3;
178 fPadSize[3] = p4;
179}
180
181//_____________________________________________________________________________
182void AliPMD::StepManager()
183{
184 //
185 // Called at every step in PMD
186 //
187}
188
fe4da5cc 189///////////////////////////////////////////////////////////////////////////////
190// //
191// Photon Multiplicity Detector Version 1 //
192// //
193//Begin_Html
194/*
1439f98e 195<img src="picts/AliPMDv1Class.gif">
fe4da5cc 196*/
197//End_Html
198// //
199///////////////////////////////////////////////////////////////////////////////
200
fe4da5cc 201ClassImp(AliPMDhit)
202
203//_____________________________________________________________________________
6edc06da 204AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
fe4da5cc 205 AliHit(shunt, track)
206{
207 //
208 // Add a PMD hit
209 //
210 Int_t i;
6edc06da 211 for (i=0;i<5;i++) fVolume[i] = vol[i];
fe4da5cc 212 fX=hits[0];
213 fY=hits[1];
214 fZ=hits[2];
215 fEnergy=hits[3];
216}
6edc06da 217