]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMD.cxx
Correcting some ripple from recent cleanup
[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 <TNode.h>
b9a2d5e4 51#include <TTUBE.h>
d28dcc0d 52#include <TTree.h>
88cb7938 53#include <TVirtualMC.h>
b9a2d5e4 54
dc8af42e 55#include "AliDetector.h"
37c55dc0 56#include "AliFMDReconstParticles.h"
88cb7938 57#include "AliFMDdigit.h"
58#include "AliFMDhit.h"
59#include "AliFMDv1.h"
60#include "AliLoader.h"
88cb7938 61#include "AliRun.h"
5d12ce38 62#include "AliMC.h"
85a5290f 63#include "AliFMDDigitizer.h"
b9a2d5e4 64
dc8af42e 65ClassImp (AliFMD)
b9a2d5e4 66 //_____________________________________________________________________________
dc8af42e 67AliFMD::AliFMD ():AliDetector ()
fe4da5cc 68{
69 //
70 // Default constructor for class AliFMD
71 //
dc8af42e 72 fIshunt = 0;
73 fHits = 0;
74 fDigits = 0;
cccf369e 75 fReconParticles=0;
fe4da5cc 76}
dc8af42e 77
fe4da5cc 78//_____________________________________________________________________________
dc8af42e 79AliFMD::AliFMD (const char *name, const char *title):
80AliDetector (name, title)
fe4da5cc 81{
82 //
83 // Standard constructor for Forward Multiplicity Detector
84 //
dc8af42e 85
fe4da5cc 86 //
87 // Initialise Hit array
dc8af42e 88 fHits = new TClonesArray ("AliFMDhit", 1000);
b9a2d5e4 89 // Digits for each Si disk
dc8af42e 90 fDigits = new TClonesArray ("AliFMDdigit", 1000);
37c55dc0 91 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
5d12ce38 92 gAlice->GetMCApp()->AddHitList (fHits);
d1280e40 93
dc8af42e 94 fIshunt = 0;
4110645f 95 // fMerger = 0;
dc8af42e 96 SetMarkerColor (kRed);
fe4da5cc 97}
d28dcc0d 98
dc8af42e 99//-----------------------------------------------------------------------------
100AliFMD::~AliFMD ()
d28dcc0d 101{
58d6a713 102 //destructor for base class AliFMD
dc8af42e 103 if (fHits)
104 {
105 fHits->Delete ();
b9a2d5e4 106 delete fHits;
cae27883 107 fHits = 0;
dc8af42e 108 }
109 if (fDigits)
110 {
111 fDigits->Delete ();
cae27883 112 delete fDigits;
113 fDigits = 0;
dc8af42e 114 }
88cb7938 115 if (fReconParticles)
dc8af42e 116 {
117 fReconParticles->Delete ();
118 delete fReconParticles;
119 fReconParticles = 0;
120 }
121
d28dcc0d 122}
dc8af42e 123
fe4da5cc 124//_____________________________________________________________________________
dc8af42e 125void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
fe4da5cc 126{
127 //
d28dcc0d 128 // Add a hit to the list
fe4da5cc 129 //
dc8af42e 130 TClonesArray & lhits = *fHits;
131 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
fe4da5cc 132}
dc8af42e 133
fe4da5cc 134//_____________________________________________________________________________
dc8af42e 135void AliFMD::AddDigit (Int_t * digits)
b9a2d5e4 136{
137 // add a real digit - as coming from data
138
88cb7938 139 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
dc8af42e 140 TClonesArray & ldigits = *fDigits;
141 new (ldigits[fNdigits++]) AliFMDdigit (digits);
37c55dc0 142}
88cb7938 143
b9a2d5e4 144//_____________________________________________________________________________
dc8af42e 145void AliFMD::BuildGeometry ()
fe4da5cc 146{
147 //
148 // Build simple ROOT TNode geometry for event display
149 //
d28dcc0d 150 TNode *node, *top;
37c55dc0 151 const int kColorFMD = 5;
fe4da5cc 152 //
dc8af42e 153 top = gAlice->GetGeometry ()->GetNode ("alice");
fe4da5cc 154
155 // FMD define the different volumes
dc8af42e 156 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
157
4110645f 158 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
dc8af42e 159 top->cd ();
1663993c 160 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, -62.8, "");
dc8af42e 161 node->SetLineColor (kColorFMD);
162 fNodes->Add (node);
163
4110645f 164 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
dc8af42e 165 top->cd ();
1663993c 166 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, -75.2, "");
dc8af42e 167 node->SetLineColor (kColorFMD);
168 fNodes->Add (node);
169
4110645f 170 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
dc8af42e 171 top->cd ();
1663993c 172 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, 83.2, "");
dc8af42e 173 node->SetLineColor (kColorFMD);
174 fNodes->Add (node);
175
4110645f 176 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
dc8af42e 177 top->cd ();
1663993c 178 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, 75.2, "");
dc8af42e 179 node->SetLineColor (kColorFMD);
180 fNodes->Add (node);
181
4110645f 182 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
dc8af42e 183 top->cd ();
1663993c 184 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, 340, "");
dc8af42e 185 node->SetLineColor (kColorFMD);
186 fNodes->Add (node);
fe4da5cc 187}
dc8af42e 188
fe4da5cc 189//_____________________________________________________________________________
58d6a713 190const Int_t AliFMD::DistanceToPrimitive (Int_t /*px*/, Int_t /*py*/)
fe4da5cc 191{
192 //
193 // Calculate the distance from the mouse to the FMD on the screen
194 // Dummy routine
195 //
196 return 9999;
197}
dc8af42e 198
b9a2d5e4 199//___________________________________________
dc8af42e 200void AliFMD::ResetHits ()
b9a2d5e4 201{
202 // Reset number of clusters and the cluster array for this detector
dc8af42e 203 AliDetector::ResetHits ();
b9a2d5e4 204}
205
206//____________________________________________
dc8af42e 207void AliFMD::ResetDigits ()
b9a2d5e4 208{
dc8af42e 209 //
210 // Reset number of digits and the digits array for this detector
37c55dc0 211 AliDetector::ResetDigits ();
dc8af42e 212 //
b9a2d5e4 213}
fe4da5cc 214
d28dcc0d 215//-------------------------------------------------------------------------
dc8af42e 216void AliFMD::Init ()
fe4da5cc 217{
218 //
219 // Initialis the FMD after it has been built
220 Int_t i;
221 //
dc8af42e 222 if (fDebug)
223 {
224 printf ("\n%s: ", ClassName ());
225 for (i = 0; i < 35; i++)
226 printf ("*");
227 printf (" FMD_INIT ");
228 for (i = 0; i < 35; i++)
229 printf ("*");
230 printf ("\n%s: ", ClassName ());
231 //
232 // Here the FMD initialisation code (if any!)
233 for (i = 0; i < 80; i++)
234 printf ("*");
235 printf ("\n");
236 }
b9a2d5e4 237 //
238 //
46501dfb 239
fe4da5cc 240}
d28dcc0d 241//---------------------------------------------------------------------
88cb7938 242void AliFMD::MakeBranch (Option_t * option)
d28dcc0d 243{
244 // Create Tree branches for the FMD.
d28dcc0d 245 char branchname[10];
dc8af42e 246 const Int_t kBufferSize = 16000;
247 sprintf (branchname, "%s", GetName ());
248
88cb7938 249 const char *cH = strstr(option,"H");
dc8af42e 250 const char *cD = strstr(option,"D");
251 const char *cR = strstr(option,"R");
dc8af42e 252
88cb7938 253 if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
b9a2d5e4 254
88cb7938 255 AliDetector::MakeBranch (option);
256
257 if (cD){
258 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
259 MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
dc8af42e 260 }
88cb7938 261
dc8af42e 262 if (cR){
88cb7938 263 if (fReconParticles == 0x0)
264 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
265 MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0);
d28dcc0d 266 }
dc8af42e 267
d28dcc0d 268}
dc8af42e 269
b9a2d5e4 270//_____________________________________________________________________________
dc8af42e 271void AliFMD::SetTreeAddress ()
b9a2d5e4 272{
273 // Set branch address for the Hits and Digits Tree.
274 char branchname[30];
88cb7938 275
276 if (fLoader->TreeH() && (fHits == 0x0))
277 fHits = new TClonesArray ("AliFMDhit", 1000);
278
dc8af42e 279 AliDetector::SetTreeAddress ();
b9a2d5e4 280
281 TBranch *branch;
88cb7938 282 TTree *treeD = fLoader->TreeD();
b9a2d5e4 283
dc8af42e 284 if (treeD)
285 {
88cb7938 286 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
287 branch = treeD->GetBranch (branchname);
288 if (branch)
289 branch->SetAddress (&fDigits);
dc8af42e 290 }
88cb7938 291
292 if (fLoader->TreeR() && fReconParticles)
dc8af42e 293 {
88cb7938 294 if (fReconParticles == 0x0)
295 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
296 branch = fLoader->TreeR()->GetBranch("FMD");
dc8af42e 297 if (branch) branch->SetAddress(&fReconParticles) ;
37c55dc0 298 }
b9a2d5e4 299}
300
b9a2d5e4 301
302
4110645f 303//-----------------------------------------------------------------------
304
305void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
306{
307 //
88cb7938 308 // Create TreeD branches for the FMD
4110645f 309 //
4110645f 310 const Int_t kBufferSize = 4000;
311 char branchname[20];
4110645f 312 sprintf(branchname,"%s",GetName());
88cb7938 313 if(treeD)
314 {
315 MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file);
316 }
4110645f 317}
37c55dc0 318
85a5290f 319//____________________________________________________________________________
c92eb8ad 320AliDigitizer* AliFMD::CreateDigitizer(AliRunDigitizer* manager) const
85a5290f 321{
322 return new AliFMDDigitizer(manager);
323}