]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMD.cxx
Obsolete - removed
[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 //
383238cf 23// Detector consists of 5 Si volumes covered pseudorapidity interval //
24// from 1.7 to 5.1. //
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"
5d12ce38 66#include "AliMC.h"
b9a2d5e4 67
dc8af42e 68ClassImp (AliFMD)
b9a2d5e4 69 //_____________________________________________________________________________
dc8af42e 70AliFMD::AliFMD ():AliDetector ()
fe4da5cc 71{
72 //
73 // Default constructor for class AliFMD
74 //
dc8af42e 75 fIshunt = 0;
76 fHits = 0;
77 fDigits = 0;
cccf369e 78 fReconParticles=0;
fe4da5cc 79}
dc8af42e 80
fe4da5cc 81//_____________________________________________________________________________
dc8af42e 82AliFMD::AliFMD (const char *name, const char *title):
83AliDetector (name, title)
fe4da5cc 84{
85 //
86 // Standard constructor for Forward Multiplicity Detector
87 //
dc8af42e 88
fe4da5cc 89 //
90 // Initialise Hit array
dc8af42e 91 fHits = new TClonesArray ("AliFMDhit", 1000);
b9a2d5e4 92 // Digits for each Si disk
dc8af42e 93 fDigits = new TClonesArray ("AliFMDdigit", 1000);
37c55dc0 94 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
5d12ce38 95 gAlice->GetMCApp()->AddHitList (fHits);
d1280e40 96
dc8af42e 97 fIshunt = 0;
4110645f 98 // fMerger = 0;
dc8af42e 99 SetMarkerColor (kRed);
fe4da5cc 100}
d28dcc0d 101
dc8af42e 102//-----------------------------------------------------------------------------
103AliFMD::~AliFMD ()
d28dcc0d 104{
dc8af42e 105 if (fHits)
106 {
107 fHits->Delete ();
b9a2d5e4 108 delete fHits;
cae27883 109 fHits = 0;
dc8af42e 110 }
111 if (fDigits)
112 {
113 fDigits->Delete ();
cae27883 114 delete fDigits;
115 fDigits = 0;
dc8af42e 116 }
88cb7938 117 if (fReconParticles)
dc8af42e 118 {
119 fReconParticles->Delete ();
120 delete fReconParticles;
121 fReconParticles = 0;
122 }
123
d28dcc0d 124}
dc8af42e 125
fe4da5cc 126//_____________________________________________________________________________
dc8af42e 127void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
fe4da5cc 128{
129 //
d28dcc0d 130 // Add a hit to the list
fe4da5cc 131 //
dc8af42e 132 TClonesArray & lhits = *fHits;
133 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
fe4da5cc 134}
dc8af42e 135
fe4da5cc 136//_____________________________________________________________________________
dc8af42e 137void AliFMD::AddDigit (Int_t * digits)
b9a2d5e4 138{
139 // add a real digit - as coming from data
140
88cb7938 141 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
dc8af42e 142 TClonesArray & ldigits = *fDigits;
143 new (ldigits[fNdigits++]) AliFMDdigit (digits);
37c55dc0 144}
88cb7938 145
b9a2d5e4 146//_____________________________________________________________________________
dc8af42e 147void AliFMD::BuildGeometry ()
fe4da5cc 148{
149 //
150 // Build simple ROOT TNode geometry for event display
151 //
d28dcc0d 152 TNode *node, *top;
37c55dc0 153 const int kColorFMD = 5;
fe4da5cc 154 //
dc8af42e 155 top = gAlice->GetGeometry ()->GetNode ("alice");
fe4da5cc 156
157 // FMD define the different volumes
dc8af42e 158 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
159
4110645f 160 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
dc8af42e 161 top->cd ();
1663993c 162 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, -62.8, "");
dc8af42e 163 node->SetLineColor (kColorFMD);
164 fNodes->Add (node);
165
4110645f 166 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
dc8af42e 167 top->cd ();
1663993c 168 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, -75.2, "");
dc8af42e 169 node->SetLineColor (kColorFMD);
170 fNodes->Add (node);
171
4110645f 172 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
dc8af42e 173 top->cd ();
1663993c 174 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, 83.2, "");
dc8af42e 175 node->SetLineColor (kColorFMD);
176 fNodes->Add (node);
177
4110645f 178 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
dc8af42e 179 top->cd ();
1663993c 180 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, 75.2, "");
dc8af42e 181 node->SetLineColor (kColorFMD);
182 fNodes->Add (node);
183
4110645f 184 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
dc8af42e 185 top->cd ();
1663993c 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//_____________________________________________________________________________
46501dfb 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//-------------------------------------------------------------------------
dc8af42e 218void AliFMD::Init ()
fe4da5cc 219{
220 //
221 // Initialis the FMD after it has been built
222 Int_t i;
223 //
dc8af42e 224 if (fDebug)
225 {
226 printf ("\n%s: ", ClassName ());
227 for (i = 0; i < 35; i++)
228 printf ("*");
229 printf (" FMD_INIT ");
230 for (i = 0; i < 35; i++)
231 printf ("*");
232 printf ("\n%s: ", ClassName ());
233 //
234 // Here the FMD initialisation code (if any!)
235 for (i = 0; i < 80; i++)
236 printf ("*");
237 printf ("\n");
238 }
b9a2d5e4 239 //
240 //
46501dfb 241
fe4da5cc 242}
d28dcc0d 243//---------------------------------------------------------------------
88cb7938 244void AliFMD::MakeBranch (Option_t * option)
d28dcc0d 245{
246 // Create Tree branches for the FMD.
d28dcc0d 247 char branchname[10];
dc8af42e 248 const Int_t kBufferSize = 16000;
249 sprintf (branchname, "%s", GetName ());
250
88cb7938 251 const char *cH = strstr(option,"H");
dc8af42e 252 const char *cD = strstr(option,"D");
253 const char *cR = strstr(option,"R");
dc8af42e 254
88cb7938 255 if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
b9a2d5e4 256
88cb7938 257 AliDetector::MakeBranch (option);
258
259 if (cD){
260 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
261 MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
dc8af42e 262 }
88cb7938 263
dc8af42e 264 if (cR){
88cb7938 265 if (fReconParticles == 0x0)
266 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
267 MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0);
d28dcc0d 268 }
dc8af42e 269
d28dcc0d 270}
dc8af42e 271
b9a2d5e4 272//_____________________________________________________________________________
dc8af42e 273void AliFMD::SetTreeAddress ()
b9a2d5e4 274{
275 // Set branch address for the Hits and Digits Tree.
276 char branchname[30];
88cb7938 277
278 if (fLoader->TreeH() && (fHits == 0x0))
279 fHits = new TClonesArray ("AliFMDhit", 1000);
280
dc8af42e 281 AliDetector::SetTreeAddress ();
b9a2d5e4 282
283 TBranch *branch;
88cb7938 284 TTree *treeD = fLoader->TreeD();
b9a2d5e4 285
dc8af42e 286 if (treeD)
287 {
88cb7938 288 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
289 branch = treeD->GetBranch (branchname);
290 if (branch)
291 branch->SetAddress (&fDigits);
dc8af42e 292 }
88cb7938 293
294 if (fLoader->TreeR() && fReconParticles)
dc8af42e 295 {
88cb7938 296 if (fReconParticles == 0x0)
297 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
298 branch = fLoader->TreeR()->GetBranch("FMD");
dc8af42e 299 if (branch) branch->SetAddress(&fReconParticles) ;
37c55dc0 300 }
b9a2d5e4 301}
302
b9a2d5e4 303
304
dc8af42e 305void
306AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
fe4da5cc 307{
dc8af42e 308 Float_t expEta = TMath::Exp (-eta);
309 Float_t theta = TMath::ATan (expEta);
310 theta = 2. * theta;
311 Float_t rad = zDisk * (TMath::Tan (theta));
312 *radius = rad;
313
314 if (fDebug)
315 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
fe4da5cc 316}
d28dcc0d 317
88cb7938 318//---------------------------------------------------------------------
319
dc8af42e 320
321void AliFMD::Digits2Reco()
322{
88cb7938 323 AliFMDReconstruction * reconstruction = new AliFMDReconstruction(fLoader->GetRunLoader());
324 cout<<" AliFMD::Digits2Reco >> "<<reconstruction<<endl;
46501dfb 325 reconstruction->Exec();
dc8af42e 326 delete reconstruction;
327}
4110645f 328//-----------------------------------------------------------------------
329
330void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
331{
332 //
88cb7938 333 // Create TreeD branches for the FMD
4110645f 334 //
4110645f 335 const Int_t kBufferSize = 4000;
336 char branchname[20];
4110645f 337 sprintf(branchname,"%s",GetName());
88cb7938 338 if(treeD)
339 {
340 MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file);
341 }
4110645f 342}
37c55dc0 343