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