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