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