]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMD.cxx
volume overlap fixed
[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 **************************************************************************/
d28dcc0d 15 //////////////////////////////////////////////////////////////////////////////
37c55dc0 16// //
d28dcc0d 17// Forward Multiplicity Detector based on Silicon plates //
fe4da5cc 18// This class contains the base procedures for the Forward Multiplicity //
19// detector //
d28dcc0d 20// Detector consists of 6 Si volumes covered pseudorapidity interval //
21// from 1.6 to 6.0. //
fe4da5cc 22// //
23//Begin_Html
24/*
d28dcc0d 25<img src="gif/AliFMDClass.gif">
fe4da5cc 26</pre>
27<br clear=left>
28<font size=+2 color=red>
29<p>The responsible person for this module is
d28dcc0d 30<a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
fe4da5cc 31</font>
32<pre>
33*/
34//End_Html
35// //
36// //
37///////////////////////////////////////////////////////////////////////////////
38
cb1df35e 39
b9a2d5e4 40#define DEBUG
41#include <TMath.h>
94de3818 42#include <TGeometry.h>
b9a2d5e4 43#include <TTUBE.h>
d28dcc0d 44#include <TTree.h>
b9a2d5e4 45#include <TNode.h>
dc8af42e 46#include <TFile.h>
b9a2d5e4 47
48#include <TClonesArray.h>
49#include <TLorentzVector.h>
50#include "AliFMDv1.h"
fe4da5cc 51#include "AliRun.h"
dc8af42e 52#include "AliDetector.h"
ab256e65 53#include <TBranch.h>
93bdec82 54#include <Riostream.h>
b9a2d5e4 55#include "AliMagF.h"
d28dcc0d 56#include "AliFMDhit.h"
b9a2d5e4 57#include "AliFMDdigit.h"
dc8af42e 58#include "AliFMDReconstruction.h"
37c55dc0 59#include "AliFMDReconstParticles.h"
b9a2d5e4 60#include <stdlib.h>
61
dc8af42e 62ClassImp (AliFMD)
b9a2d5e4 63 //_____________________________________________________________________________
dc8af42e 64AliFMD::AliFMD ():AliDetector ()
fe4da5cc 65{
66 //
67 // Default constructor for class AliFMD
68 //
dc8af42e 69 fIshunt = 0;
70 fHits = 0;
71 fDigits = 0;
cccf369e 72 fReconParticles=0;
fe4da5cc 73}
dc8af42e 74
fe4da5cc 75//_____________________________________________________________________________
dc8af42e 76AliFMD::AliFMD (const char *name, const char *title):
77AliDetector (name, title)
fe4da5cc 78{
79 //
80 // Standard constructor for Forward Multiplicity Detector
81 //
dc8af42e 82
fe4da5cc 83 //
84 // Initialise Hit array
dc8af42e 85 fHits = new TClonesArray ("AliFMDhit", 1000);
b9a2d5e4 86 // Digits for each Si disk
dc8af42e 87 fDigits = new TClonesArray ("AliFMDdigit", 1000);
37c55dc0 88 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
dc8af42e 89 gAlice->AddHitList (fHits);
d1280e40 90
dc8af42e 91 fIshunt = 0;
92 fIdSens1 = 0;
37c55dc0 93 fIdSens2 = 0;
94 fIdSens3 = 0;
95 fIdSens4 = 0;
96 fIdSens5 = 0;
4110645f 97 // fMerger = 0;
dc8af42e 98 SetMarkerColor (kRed);
fe4da5cc 99}
d28dcc0d 100
dc8af42e 101//-----------------------------------------------------------------------------
102AliFMD::~AliFMD ()
d28dcc0d 103{
dc8af42e 104 if (fHits)
105 {
106 fHits->Delete ();
b9a2d5e4 107 delete fHits;
cae27883 108 fHits = 0;
dc8af42e 109 }
110 if (fDigits)
111 {
112 fDigits->Delete ();
cae27883 113 delete fDigits;
114 fDigits = 0;
dc8af42e 115 }
dc8af42e 116 if (fReconParticles)
117 {
118 fReconParticles->Delete ();
119 delete fReconParticles;
120 fReconParticles = 0;
121 }
122
d28dcc0d 123}
dc8af42e 124
fe4da5cc 125//_____________________________________________________________________________
dc8af42e 126void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
fe4da5cc 127{
128 //
d28dcc0d 129 // Add a hit to the list
fe4da5cc 130 //
dc8af42e 131 TClonesArray & lhits = *fHits;
132 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
fe4da5cc 133}
dc8af42e 134
fe4da5cc 135//_____________________________________________________________________________
dc8af42e 136void AliFMD::AddDigit (Int_t * digits)
b9a2d5e4 137{
138 // add a real digit - as coming from data
139
b9a2d5e4 140
dc8af42e 141 TClonesArray & ldigits = *fDigits;
142 new (ldigits[fNdigits++]) AliFMDdigit (digits);
b9a2d5e4 143
37c55dc0 144}
b9a2d5e4 145//_____________________________________________________________________________
dc8af42e 146void AliFMD::BuildGeometry ()
fe4da5cc 147{
148 //
149 // Build simple ROOT TNode geometry for event display
150 //
d28dcc0d 151 TNode *node, *top;
37c55dc0 152 const int kColorFMD = 5;
fe4da5cc 153 //
dc8af42e 154 top = gAlice->GetGeometry ()->GetNode ("alice");
fe4da5cc 155
156 // FMD define the different volumes
dc8af42e 157 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
158
4110645f 159 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
dc8af42e 160 top->cd ();
37c55dc0 161 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
dc8af42e 162 node->SetLineColor (kColorFMD);
163 fNodes->Add (node);
164
4110645f 165 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
dc8af42e 166 top->cd ();
4110645f 167 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.2, "");
dc8af42e 168 node->SetLineColor (kColorFMD);
169 fNodes->Add (node);
170
4110645f 171 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
dc8af42e 172 top->cd ();
4110645f 173 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -83.2, "");
dc8af42e 174 node->SetLineColor (kColorFMD);
175 fNodes->Add (node);
176
4110645f 177 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
dc8af42e 178 top->cd ();
4110645f 179 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.2, "");
dc8af42e 180 node->SetLineColor (kColorFMD);
181 fNodes->Add (node);
182
4110645f 183 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
dc8af42e 184 top->cd ();
185 // node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
4110645f 186 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -340, "");
dc8af42e 187 node->SetLineColor (kColorFMD);
188 fNodes->Add (node);
fe4da5cc 189}
dc8af42e 190
fe4da5cc 191//_____________________________________________________________________________
dc8af42e 192Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py)
fe4da5cc 193{
194 //
195 // Calculate the distance from the mouse to the FMD on the screen
196 // Dummy routine
197 //
198 return 9999;
199}
dc8af42e 200
b9a2d5e4 201//___________________________________________
dc8af42e 202void AliFMD::ResetHits ()
b9a2d5e4 203{
204 // Reset number of clusters and the cluster array for this detector
dc8af42e 205 AliDetector::ResetHits ();
b9a2d5e4 206}
207
208//____________________________________________
dc8af42e 209void AliFMD::ResetDigits ()
b9a2d5e4 210{
dc8af42e 211 //
212 // Reset number of digits and the digits array for this detector
37c55dc0 213 AliDetector::ResetDigits ();
dc8af42e 214 //
b9a2d5e4 215}
fe4da5cc 216
d28dcc0d 217//-------------------------------------------------------------------------
cb1df35e 218
dc8af42e 219void AliFMD::Init ()
fe4da5cc 220{
221 //
222 // Initialis the FMD after it has been built
223 Int_t i;
224 //
dc8af42e 225 if (fDebug)
226 {
227 printf ("\n%s: ", ClassName ());
228 for (i = 0; i < 35; i++)
229 printf ("*");
230 printf (" FMD_INIT ");
231 for (i = 0; i < 35; i++)
232 printf ("*");
233 printf ("\n%s: ", ClassName ());
234 //
235 // Here the FMD initialisation code (if any!)
236 for (i = 0; i < 80; i++)
237 printf ("*");
238 printf ("\n");
239 }
b9a2d5e4 240 //
241 //
5d02ea6f 242 fIdSens1 = gMC->VolId ("GRN1"); //Si sensetive volume
243 fIdSens2 = gMC->VolId ("GRN2"); //Si sensetive volume
244 fIdSens3 = gMC->VolId ("GRN3"); //Si sensetive volume
245 fIdSens4 = gMC->VolId ("GRN4"); //Si sensetive volume
cb1df35e 246 fIdSens5 = gMC->VolId ("GRN5"); //Si sensetive volume
d28dcc0d 247
fe4da5cc 248}
cb1df35e 249
d28dcc0d 250//---------------------------------------------------------------------
dc8af42e 251void AliFMD::MakeBranch (Option_t * option, const char *file)
d28dcc0d 252{
253 // Create Tree branches for the FMD.
d28dcc0d 254 char branchname[10];
dc8af42e 255 const Int_t kBufferSize = 16000;
256 sprintf (branchname, "%s", GetName ());
257
258 AliDetector::MakeBranch (option, file);
259 const char *cD = strstr(option,"D");
260 const char *cR = strstr(option,"R");
dc8af42e 261
dc8af42e 262 if (cD){
b9a2d5e4 263
9e1a0ddb 264 MakeBranchInTree(gAlice->TreeD(),
dc8af42e 265 branchname,&fDigits,
266 kBufferSize, file);
4110645f 267 cout<<" tree "<<gAlice->TreeD()<<" "<<branchname<<" "<<&fDigits<<endl;
dc8af42e 268 }
269 if (cR){
270 MakeBranchInTree(gAlice->TreeR(),
271 branchname,&fReconParticles,
272 kBufferSize, file);
d28dcc0d 273 }
dc8af42e 274
d28dcc0d 275}
dc8af42e 276
b9a2d5e4 277//_____________________________________________________________________________
dc8af42e 278void AliFMD::SetTreeAddress ()
b9a2d5e4 279{
280 // Set branch address for the Hits and Digits Tree.
281 char branchname[30];
dc8af42e 282 AliDetector::SetTreeAddress ();
b9a2d5e4 283
284 TBranch *branch;
dc8af42e 285 TTree *treeD = gAlice->TreeD ();
b9a2d5e4 286
287
dc8af42e 288 if (treeD)
289 {
290 if (fDigits)
291 {
292 branch = treeD->GetBranch (branchname);
293 if (branch)
294 branch->SetAddress (&fDigits);
295 }
b9a2d5e4 296
dc8af42e 297 }
b9a2d5e4 298
ab256e65 299
37c55dc0 300 if (gAlice->TreeR() && fReconParticles)
dc8af42e 301 {
302 branch = gAlice->TreeR()->GetBranch("FMD");
303 if (branch) branch->SetAddress(&fReconParticles) ;
37c55dc0 304 }
b9a2d5e4 305}
306
37c55dc0 307//---------------------------------------------------------------------
c45743f9 308
99a0f629 309void AliFMD::SetRingsSi1(Int_t ringsSi1)
37c55dc0 310{
c45743f9 311 // fRingsSi1=ringsSi1;
cb1df35e 312 fRingsSi1=768;
37c55dc0 313}
99a0f629 314void AliFMD::SetSectorsSi1(Int_t sectorsSi1)
37c55dc0 315{
c45743f9 316 fSectorsSi1=20;
37c55dc0 317}
99a0f629 318void AliFMD::SetRingsSi2(Int_t ringsSi2)
37c55dc0 319{
cb1df35e 320 fRingsSi2=384;
37c55dc0 321}
99a0f629 322void AliFMD::SetSectorsSi2(Int_t sectorsSi2)
37c55dc0 323{
c45743f9 324 fSectorsSi2=40;
37c55dc0 325}
c45743f9 326
b9a2d5e4 327//---------------------------------------------------------------------
d28dcc0d 328
b9a2d5e4 329
330
dc8af42e 331void
332AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
fe4da5cc 333{
dc8af42e 334 Float_t expEta = TMath::Exp (-eta);
335 Float_t theta = TMath::ATan (expEta);
336 theta = 2. * theta;
337 Float_t rad = zDisk * (TMath::Tan (theta));
338 *radius = rad;
339
340 if (fDebug)
341 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
fe4da5cc 342}
d28dcc0d 343
dc8af42e 344//-----------------------------------------------------------------------
345
346void AliFMD::Digits2Reco()
347{
dc8af42e 348 char * fileReconParticles=0;
349 char * fileHeader=0;
350 AliFMDReconstruction * reconstruction =
351 new AliFMDReconstruction(fileHeader,fileReconParticles) ;
37c55dc0 352 reconstruction->Exec("");
dc8af42e 353 delete reconstruction;
354}
4110645f 355//-----------------------------------------------------------------------
356
357void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
358{
359 //
360 // Create TreeD branches for the MUON.
361 //
b9a2d5e4 362
4110645f 363 const Int_t kBufferSize = 4000;
364 char branchname[20];
365
366
367 sprintf(branchname,"%s",GetName());
368 if(treeD){
369 MakeBranchInTree(treeD,
370 branchname,&fDigits,
371 kBufferSize, file);
372 }
373}
37c55dc0 374