]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMD.cxx
Adding support for HLT code
[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;
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 }
88cb7938 116 if (fReconParticles)
dc8af42e 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
88cb7938 140 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
dc8af42e 141 TClonesArray & ldigits = *fDigits;
142 new (ldigits[fNdigits++]) AliFMDdigit (digits);
37c55dc0 143}
88cb7938 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 ();
4110645f 185 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -340, "");
dc8af42e 186 node->SetLineColor (kColorFMD);
187 fNodes->Add (node);
fe4da5cc 188}
dc8af42e 189
fe4da5cc 190//_____________________________________________________________________________
46501dfb 191Int_t AliFMD::DistanceToPrimitive (Int_t /*px*/, Int_t /*py*/)
fe4da5cc 192{
193 //
194 // Calculate the distance from the mouse to the FMD on the screen
195 // Dummy routine
196 //
197 return 9999;
198}
dc8af42e 199
b9a2d5e4 200//___________________________________________
dc8af42e 201void AliFMD::ResetHits ()
b9a2d5e4 202{
203 // Reset number of clusters and the cluster array for this detector
dc8af42e 204 AliDetector::ResetHits ();
b9a2d5e4 205}
206
207//____________________________________________
dc8af42e 208void AliFMD::ResetDigits ()
b9a2d5e4 209{
dc8af42e 210 //
211 // Reset number of digits and the digits array for this detector
37c55dc0 212 AliDetector::ResetDigits ();
dc8af42e 213 //
b9a2d5e4 214}
fe4da5cc 215
d28dcc0d 216//-------------------------------------------------------------------------
dc8af42e 217void AliFMD::Init ()
fe4da5cc 218{
219 //
220 // Initialis the FMD after it has been built
221 Int_t i;
222 //
dc8af42e 223 if (fDebug)
224 {
225 printf ("\n%s: ", ClassName ());
226 for (i = 0; i < 35; i++)
227 printf ("*");
228 printf (" FMD_INIT ");
229 for (i = 0; i < 35; i++)
230 printf ("*");
231 printf ("\n%s: ", ClassName ());
232 //
233 // Here the FMD initialisation code (if any!)
234 for (i = 0; i < 80; i++)
235 printf ("*");
236 printf ("\n");
237 }
b9a2d5e4 238 //
239 //
46501dfb 240
fe4da5cc 241}
d28dcc0d 242//---------------------------------------------------------------------
88cb7938 243void AliFMD::MakeBranch (Option_t * option)
d28dcc0d 244{
245 // Create Tree branches for the FMD.
d28dcc0d 246 char branchname[10];
dc8af42e 247 const Int_t kBufferSize = 16000;
248 sprintf (branchname, "%s", GetName ());
249
88cb7938 250 const char *cH = strstr(option,"H");
dc8af42e 251 const char *cD = strstr(option,"D");
252 const char *cR = strstr(option,"R");
dc8af42e 253
88cb7938 254 if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
b9a2d5e4 255
88cb7938 256 AliDetector::MakeBranch (option);
257
258 if (cD){
259 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
260 MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
dc8af42e 261 }
88cb7938 262
dc8af42e 263 if (cR){
88cb7938 264 if (fReconParticles == 0x0)
265 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
266 MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0);
d28dcc0d 267 }
dc8af42e 268
d28dcc0d 269}
dc8af42e 270
b9a2d5e4 271//_____________________________________________________________________________
dc8af42e 272void AliFMD::SetTreeAddress ()
b9a2d5e4 273{
274 // Set branch address for the Hits and Digits Tree.
275 char branchname[30];
88cb7938 276
277 if (fLoader->TreeH() && (fHits == 0x0))
278 fHits = new TClonesArray ("AliFMDhit", 1000);
279
dc8af42e 280 AliDetector::SetTreeAddress ();
b9a2d5e4 281
282 TBranch *branch;
88cb7938 283 TTree *treeD = fLoader->TreeD();
b9a2d5e4 284
dc8af42e 285 if (treeD)
286 {
88cb7938 287 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
288 branch = treeD->GetBranch (branchname);
289 if (branch)
290 branch->SetAddress (&fDigits);
dc8af42e 291 }
88cb7938 292
293 if (fLoader->TreeR() && fReconParticles)
dc8af42e 294 {
88cb7938 295 if (fReconParticles == 0x0)
296 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
297 branch = fLoader->TreeR()->GetBranch("FMD");
dc8af42e 298 if (branch) branch->SetAddress(&fReconParticles) ;
37c55dc0 299 }
b9a2d5e4 300}
301
b9a2d5e4 302
303
dc8af42e 304void
305AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
fe4da5cc 306{
dc8af42e 307 Float_t expEta = TMath::Exp (-eta);
308 Float_t theta = TMath::ATan (expEta);
309 theta = 2. * theta;
310 Float_t rad = zDisk * (TMath::Tan (theta));
311 *radius = rad;
312
313 if (fDebug)
314 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
fe4da5cc 315}
d28dcc0d 316
88cb7938 317//---------------------------------------------------------------------
318
dc8af42e 319
320void AliFMD::Digits2Reco()
321{
88cb7938 322 AliFMDReconstruction * reconstruction = new AliFMDReconstruction(fLoader->GetRunLoader());
323 cout<<" AliFMD::Digits2Reco >> "<<reconstruction<<endl;
46501dfb 324 reconstruction->Exec();
dc8af42e 325 delete reconstruction;
326}
4110645f 327//-----------------------------------------------------------------------
328
329void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
330{
331 //
88cb7938 332 // Create TreeD branches for the FMD
4110645f 333 //
4110645f 334 const Int_t kBufferSize = 4000;
335 char branchname[20];
4110645f 336 sprintf(branchname,"%s",GetName());
88cb7938 337 if(treeD)
338 {
339 MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file);
340 }
4110645f 341}
37c55dc0 342