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