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