4916b1ad780d684628fc648398eff12af190356b
[u/mrichter/AliRoot.git] / FMD / AliFMD.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Forward Multiplicity Detector                                            //
4 //  This class contains the base procedures for the Forward Multiplicity     //
5 //  detector                                                                 //
6 //                                                                           //
7 //Begin_Html
8 /*
9 <img src="picts/AliFMDClass.gif">
10 </pre>
11 <br clear=left>
12 <font size=+2 color=red>
13 <p>The responsible person for this module is
14 <a href="mailto:Valeri.Kondratiev@cern.ch">Valeri Kondratiev</a>.
15 </font>
16 <pre>
17 */
18 //End_Html
19 //                                                                           //
20 //                                                                           //
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #include <TTUBE.h>
24 #include <TNode.h>
25 #include "AliRun.h"
26 #include "AliFMD.h"
27 #include "TGeant3.h"
28  
29 ClassImp(AliFMD)
30  
31 //_____________________________________________________________________________
32 AliFMD::AliFMD(): AliDetector()
33 {
34   //
35   // Default constructor for class AliFMD
36   //
37   fIshunt   = 0;
38 }
39  
40 //_____________________________________________________________________________
41 AliFMD::AliFMD(const char *name, const char *title)
42        : AliDetector(name,title)
43 {
44   //
45   // Standard constructor for Forward Multiplicity Detector
46   //
47  
48   //
49   // Initialise Hit array
50   fHits   = new TClonesArray("AliFMDhit",  405);
51   
52   fIshunt     =  0;
53 }
54  
55 //_____________________________________________________________________________
56 void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
57 {
58   //
59   // Add a FMD hit
60   //
61   TClonesArray &lhits = *fHits;
62   new(lhits[fNhits++]) AliFMDhit(fIshunt,track,vol,hits);
63 }
64  
65 //_____________________________________________________________________________
66 void AliFMD::BuildGeometry()
67 {
68   //
69   // Build simple ROOT TNode geometry for event display
70   //
71   TNode *Node, *Top;
72   const int kColorFMD  = 7;
73   //
74   Top=gAlice->GetGeometry()->GetNode("alice");
75
76   // FMD define the different volumes
77   
78   new TTUBE("S_FMD1","FMD sensitive volume 1","void",4.5,10.5,3);
79   Top->cd();
80   Node = new TNode("FMD1","FMD1","S_FMD1",0,0,86.5,"");
81   Node->SetLineColor(kColorFMD);
82   fNodes->Add(Node);
83   
84   new TTUBE("S_FMD2","FMD sensitive volume 2","void",4.5,10.5,3);
85   Top->cd();
86   Node = new TNode("FMD2","FMD2","S_FMD2",0,0,-86.5,"");
87   Node->SetLineColor(kColorFMD);
88   fNodes->Add(Node);
89   
90   new TTUBE("S_FMD3","FMD sensitive volume 3","void",8,14,3);
91   Top->cd();
92   Node = new TNode("FMD3","FMD3","S_FMD3",0,0,71.2,"");
93   Node->SetLineColor(kColorFMD);
94   fNodes->Add(Node);
95   
96   new TTUBE("S_FMD4","FMD sensitive volume 4","void",8,14,3);
97   Top->cd();
98   Node = new TNode("FMD4","FMD4","S_FMD4",0,0,-71.2,"");
99   fNodes->Add(Node);
100   Node->SetLineColor(kColorFMD);
101   
102   new TTUBE("S_FMD5","FMD sensitive volume 5","void",8,17.5,3);
103   Top->cd();
104   Node = new TNode("FMD5","FMD5","S_FMD5",0,0,44,"");
105   Node->SetLineColor(kColorFMD);
106   fNodes->Add(Node);
107   
108   new TTUBE("S_FMD6","FMD sensitive volume 6","void",8,17.5,3);
109   Top->cd();
110   Node = new TNode("FMD6","FMD6","S_FMD6",0,0,-44,"");
111   Node->SetLineColor(kColorFMD);
112   fNodes->Add(Node);
113   
114   new TTUBE("S_FMD7","FMD sensitive volume 7","void",4.2,13,3);
115   Top->cd();
116   Node = new TNode("FMD7","FMD7","S_FMD7",0,0,-231,"");
117   Node->SetLineColor(kColorFMD);
118   fNodes->Add(Node);
119 }
120  
121 //_____________________________________________________________________________
122 Int_t AliFMD::DistancetoPrimitive(Int_t , Int_t )
123 {
124   //
125   // Calculate the distance from the mouse to the FMD on the screen
126   // Dummy routine
127   //
128   return 9999;
129 }
130  
131 //_____________________________________________________________________________
132 void AliFMD::StepManager()
133 {
134   //
135   // Called for each step in the FMD
136   //
137   
138   Float_t       hits[3];
139   Int_t         copy,vol[1];
140   TClonesArray &lhits = *fHits;
141   AliMC* pMC=AliMC::GetMC();
142   
143   pMC->CurrentVol(0, copy);
144   vol[0] = copy;
145   pMC->TrackPosition(hits);
146   new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
147 }
148
149 //___________________________________________
150 void AliFMD::Init()
151 {
152   //
153   // Initialis the FMD after it has been built
154   Int_t i;
155   //
156   printf("\n");
157   for(i=0;i<35;i++) printf("*");
158   printf(" FMD_INIT ");
159   for(i=0;i<35;i++) printf("*");
160   printf("\n");
161   //
162   // Here the FMD initialisation code (if any!)
163   for(i=0;i<80;i++) printf("*");
164   printf("\n");
165 }
166
167  
168 ClassImp(AliFMDhit)
169  
170 //_____________________________________________________________________________
171 AliFMDhit::AliFMDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
172   AliHit(shunt, track)
173 {
174   //
175   // Add a FMD hit
176   //
177   fVolume = vol[0];
178   fX=hits[0];
179   fY=hits[1];
180   fZ=hits[2];
181 }
182