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