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