]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/AliPMD.cxx
Put the PMD at the right position in the event display
[u/mrichter/AliRoot.git] / PMD / AliPMD.cxx
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$
18 Revision 1.7  2000/10/02 21:28:12  fca
19 Removal of useless dependecies via forward declarations
20
21 Revision 1.6  2000/01/19 17:17:06  fca
22 Introducing a list of lists of hits -- more hits allowed for detector now
23
24 Revision 1.5  1999/09/29 09:24:27  fca
25 Introduction of the Copyright and cvs Log
26
27 */
28
29 ///////////////////////////////////////////////////////////////////////////////
30 //
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 /*
39 <img src="picts/AliPMDClass.gif">
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>
54 #include <TGeometry.h>
55
56 #include "AliPMD.h"
57 #include "AliRun.h"
58 #include "AliMC.h" 
59 #include "AliConst.h" 
60  
61 ClassImp(AliPMD)
62  
63 //_____________________________________________________________________________
64 AliPMD::AliPMD()
65 {
66   //
67   // Default constructor
68   //
69   fIshunt = 0;
70 }
71  
72 //_____________________________________________________________________________
73 AliPMD::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);
83   gAlice->AddHitList(fHits);
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 //_____________________________________________________________________________
106 void 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;
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]);
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) {
122 //        printf("Cell with same numbers found\n") ; curcell->Print();
123       *curcell = *curcell+*newcell;
124 //        printf("Cell after addition\n") ; curcell->Print();
125       delete newcell;
126       return;
127     }
128   }
129   new(lhits[fNhits++]) AliPMDhit(newcell);
130   delete newcell;
131 }
132  
133 //_____________________________________________________________________________
134 void 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();
149   Node = new TNode("PMD","PMD","S_PMD",0,0,-600,"");
150   Node->SetLineColor(kColorPMD);
151   fNodes->Add(Node);
152 }
153
154 //_____________________________________________________________________________
155 Int_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 //_____________________________________________________________________________
165 void 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 //_____________________________________________________________________________
177 void 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 //_____________________________________________________________________________
190 void 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 //_____________________________________________________________________________
201 void 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 //_____________________________________________________________________________
213 void AliPMD::StepManager()
214 {
215   //
216   // Called at every step in PMD
217   //
218 }
219
220 ///////////////////////////////////////////////////////////////////////////////
221 //                                                                           //
222 //  Photon Multiplicity Detector Version 1                                   //
223 //                                                                           //
224 //Begin_Html
225 /*
226 <img src="picts/AliPMDv1Class.gif">
227 */
228 //End_Html
229 //                                                                           //
230 ///////////////////////////////////////////////////////////////////////////////
231
232 ClassImp(AliPMDhit)
233   
234 //_____________________________________________________________________________
235 AliPMDhit::AliPMDhit(Int_t shunt,Int_t track, Int_t *vol, Float_t *hits):
236   AliHit(shunt, track)
237 {
238   //
239   // Add a PMD hit
240   //
241   Int_t i;
242   for (i=0;i<5;i++) fVolume[i] = vol[i];
243   fX=hits[0];
244   fY=hits[1];
245   fZ=hits[2];
246   fEnergy=hits[3];
247 }
248