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