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