321c68fda9ab46a436aff38089d028830d36914c
[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 //  Forward Multiplicity Detector based on Silicon plates                    //
18 //  This class contains the base procedures for the Forward Multiplicity     //
19 //  detector                                                                 //
20 //  Detector consists of 6 Si volumes covered pseudorapidity interval         //
21 //  from 1.6 to 6.0.                                                         //
22 //                                                                           //
23 //Begin_Html
24 /*
25 <img src="gif/AliFMDClass.gif">
26 </pre>
27 <br clear=left>
28 <font size=+2 color=red>
29 <p>The responsible person for this module is
30 <a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
31 </font>
32 <pre>
33 */
34 //End_Html
35 //                                                                           //
36 //                                                                           //
37 ///////////////////////////////////////////////////////////////////////////////
38
39 #include <TTUBE.h>
40 #include <TNode.h>
41 #include <TGeometry.h>
42 #include <TTree.h>
43 #include "AliRun.h"
44 #include "AliMC.h"
45 #include "AliFMD.h"
46 #include "AliFMDhit.h"
47
48 ClassImp(AliFMD)
49  
50 //_____________________________________________________________________________
51 AliFMD::AliFMD(): AliDetector()
52 {
53   //
54   // Default constructor for class AliFMD
55   //
56   fIshunt   = 0;
57 }
58  
59 //_____________________________________________________________________________
60 AliFMD::AliFMD(const char *name, const char *title)
61        : AliDetector(name,title)
62 {
63   //
64   // Standard constructor for Forward Multiplicity Detector
65   //
66  
67   //
68   // Initialise Hit array
69   fHits     = new TClonesArray("AliFMDhit", 1000);
70   
71   fIshunt     =  0;
72   fIdSens1    =  0;
73
74   SetMarkerColor(kRed);
75 }
76  
77
78 AliFMD::~AliFMD()
79 {
80   delete fHits;
81 }
82 //_____________________________________________________________________________
83 void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
84 {
85   //
86   // Add a hit to the list
87   //
88   TClonesArray &lhits = *fHits;
89   new(lhits[fNhits++]) AliFMDhit(fIshunt,track,vol,hits);
90 }
91 //_____________________________________________________________________________
92 void AliFMD::BuildGeometry()
93 {
94   //
95   // Build simple ROOT TNode geometry for event display
96   //
97   TNode *node, *top;
98   const int kColorFMD  = 7;
99   //
100   top=gAlice->GetGeometry()->GetNode("alice");
101
102   // FMD define the different volumes
103   new TRotMatrix("rot901","rot901",  90, 0, 90, 90, 180, 0);
104
105   new TTUBE("S_FMD0","FMD  volume 0","void",4.73,17.7,1.5);
106   top->cd();
107   node = new TNode("FMD0","FMD0","S_FMD0",0,0,64,"");
108   node->SetLineColor(kColorFMD);
109   fNodes->Add(node);
110
111   new TTUBE("S_FMD1","FMD  volume 1","void",23.4,36.,1.5);
112   top->cd();
113   node = new TNode("FMD1","FMD1","S_FMD1",0,0,85,"");
114   node->SetLineColor(kColorFMD);
115   fNodes->Add(node);
116   
117   new TTUBE("S_FMD2","FMD  volume 2","void",4.73,17.7,1.5);
118   top->cd();
119   node = new TNode("FMD2","FMD2","S_FMD2",0,0,-64,"");
120   node->SetLineColor(kColorFMD);
121   fNodes->Add(node);
122
123   new TTUBE("S_FMD3","FMD  volume 3","void",23.4,36.,1.5);
124   top->cd();
125   node = new TNode("FMD3","FMD3","S_FMD3",0,0,-85,"");
126   node->SetLineColor(kColorFMD);
127   fNodes->Add(node);
128
129   new TTUBE("S_FMD4","FMD  volume 4","void",5,15,0.015);
130   top->cd();
131   node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
132   node->SetLineColor(kColorFMD);
133   fNodes->Add(node);
134   
135   
136   new TTUBE("S_FMD5","FMD  volume 5","void",5,14,0.015);
137   top->cd();
138   node = new TNode("FMD5","FMD5","S_FMD5",0,0,-630,"");
139   node->SetLineColor(kColorFMD);
140   fNodes->Add(node);
141
142 }
143  
144 //_____________________________________________________________________________
145 Int_t AliFMD::DistanceToPrimitive(Int_t px, Int_t py)
146 {
147   //
148   // Calculate the distance from the mouse to the FMD on the screen
149   // Dummy routine
150   //
151   return 9999;
152 }
153  
154 //_____________________________________________________________________________
155
156 //-------------------------------------------------------------------------
157 void AliFMD::Init()
158 {
159   //
160   // Initialis the FMD after it has been built
161   Int_t i;
162   AliMC* pMC = AliMC::GetMC();
163   //
164   printf("\n");
165   for(i=0;i<35;i++) printf("*");
166   printf(" FMD_INIT ");
167   for(i=0;i<35;i++) printf("*");
168   printf("\n");
169   //
170   // Here the FMD initialisation code (if any!)
171   for(i=0;i<80;i++) printf("*");
172   printf("\n");
173  //
174  //
175   fIdSens1=pMC->VolId("GFSI"); //Si sensetive volume
176
177 }
178 //---------------------------------------------------------------------
179 void AliFMD::MakeBranch(Option_t* option)
180 {
181   // Create Tree branches for the FMD.
182   Int_t buffersize = 4000;
183   char branchname[10];
184   sprintf(branchname,"%s",GetName());
185
186   AliDetector::MakeBranch(option);
187
188   if (fDigits   && gAlice->TreeD()) {
189     gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
190     printf("Making Branch %s for digits\n",branchname);
191   }
192 }
193  
194 //---------------------------------------------------------------------
195
196 void AliFMD::Eta2Radius(Float_t eta, Float_t zDisk, Float_t *radius)
197 {
198    Float_t expEta=TMath::Exp(-eta);
199    Float_t theta=TMath::ATan(expEta);
200    theta=2.*theta;
201    Float_t rad=zDisk*(TMath::Tan(theta));
202    *radius=rad;
203    
204    printf(" eta %f radius %f\n", eta, rad);
205 }
206  
207
208  
209     
210