52a79865cd6c6ae1fb36f386e17082ae89614641
[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   gAlice->AddHitList(fHits);
71
72   fIshunt     =  0;
73   fIdSens1    =  0;
74
75   SetMarkerColor(kRed);
76 }
77  
78
79 AliFMD::~AliFMD()
80 {
81   delete fHits;
82 }
83 //_____________________________________________________________________________
84 void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
85 {
86   //
87   // Add a hit to the list
88   //
89   TClonesArray &lhits = *fHits;
90   new(lhits[fNhits++]) AliFMDhit(fIshunt,track,vol,hits);
91 }
92 //_____________________________________________________________________________
93 void AliFMD::BuildGeometry()
94 {
95   //
96   // Build simple ROOT TNode geometry for event display
97   //
98   TNode *node, *top;
99   const int kColorFMD  = 7;
100   //
101   top=gAlice->GetGeometry()->GetNode("alice");
102
103   // FMD define the different volumes
104   new TRotMatrix("rot901","rot901",  90, 0, 90, 90, 180, 0);
105
106   new TTUBE("S_FMD0","FMD  volume 0","void",4.73,17.7,1.5);
107   top->cd();
108   node = new TNode("FMD0","FMD0","S_FMD0",0,0,64,"");
109   node->SetLineColor(kColorFMD);
110   fNodes->Add(node);
111
112   new TTUBE("S_FMD1","FMD  volume 1","void",23.4,36.,1.5);
113   top->cd();
114   node = new TNode("FMD1","FMD1","S_FMD1",0,0,85,"");
115   node->SetLineColor(kColorFMD);
116   fNodes->Add(node);
117   
118   new TTUBE("S_FMD2","FMD  volume 2","void",4.73,17.7,1.5);
119   top->cd();
120   node = new TNode("FMD2","FMD2","S_FMD2",0,0,-64,"");
121   node->SetLineColor(kColorFMD);
122   fNodes->Add(node);
123
124   new TTUBE("S_FMD3","FMD  volume 3","void",23.4,36.,1.5);
125   top->cd();
126   node = new TNode("FMD3","FMD3","S_FMD3",0,0,-85,"");
127   node->SetLineColor(kColorFMD);
128   fNodes->Add(node);
129
130   new TTUBE("S_FMD4","FMD  volume 4","void",5,15,0.015);
131   top->cd();
132   node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
133   node->SetLineColor(kColorFMD);
134   fNodes->Add(node);
135   
136   
137   new TTUBE("S_FMD5","FMD  volume 5","void",5,14,0.015);
138   top->cd();
139   node = new TNode("FMD5","FMD5","S_FMD5",0,0,-630,"");
140   node->SetLineColor(kColorFMD);
141   fNodes->Add(node);
142
143 }
144  
145 //_____________________________________________________________________________
146 Int_t AliFMD::DistanceToPrimitive(Int_t px, Int_t py)
147 {
148   //
149   // Calculate the distance from the mouse to the FMD on the screen
150   // Dummy routine
151   //
152   return 9999;
153 }
154  
155 //_____________________________________________________________________________
156
157 //-------------------------------------------------------------------------
158 void AliFMD::Init()
159 {
160   //
161   // Initialis the FMD after it has been built
162   Int_t i;
163   AliMC* pMC = AliMC::GetMC();
164   //
165   printf("\n");
166   for(i=0;i<35;i++) printf("*");
167   printf(" FMD_INIT ");
168   for(i=0;i<35;i++) printf("*");
169   printf("\n");
170   //
171   // Here the FMD initialisation code (if any!)
172   for(i=0;i<80;i++) printf("*");
173   printf("\n");
174  //
175  //
176   fIdSens1=pMC->VolId("GFSI"); //Si sensetive volume
177
178 }
179 //---------------------------------------------------------------------
180 void AliFMD::MakeBranch(Option_t* option)
181 {
182   // Create Tree branches for the FMD.
183   Int_t buffersize = 4000;
184   char branchname[10];
185   sprintf(branchname,"%s",GetName());
186
187   AliDetector::MakeBranch(option);
188
189   if (fDigits   && gAlice->TreeD()) {
190     gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
191     printf("Making Branch %s for digits\n",branchname);
192   }
193 }
194  
195 //---------------------------------------------------------------------
196
197 void AliFMD::Eta2Radius(Float_t eta, Float_t zDisk, Float_t *radius)
198 {
199    Float_t expEta=TMath::Exp(-eta);
200    Float_t theta=TMath::ATan(expEta);
201    theta=2.*theta;
202    Float_t rad=zDisk*(TMath::Tan(theta));
203    *radius=rad;
204    
205    printf(" eta %f radius %f\n", eta, rad);
206 }
207  
208
209  
210     
211