1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //////////////////////////////////////////////////////////////////////////////
20 // Forward Multiplicity Detector based on Silicon plates //
21 // This class contains the base procedures for the Forward Multiplicity //
23 // Detector consists of 5 Si volumes covered pseudorapidity interval //
24 // from 1.7 to 5.1. //
28 <img src="gif/AliFMDClass.gif">
31 <font size=+2 color=red>
32 <p>The responsible person for this module is
33 <a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
40 ///////////////////////////////////////////////////////////////////////////////
44 #include <Riostream.h>
47 #include <TClonesArray.h>
49 #include <TGeometry.h>
53 #include <TVirtualMC.h>
55 #include "AliDetector.h"
56 #include "AliFMDdigit.h"
57 #include "AliFMDhit.h"
59 #include "AliLoader.h"
62 #include "AliFMDDigitizer.h"
65 //_____________________________________________________________________________
66 AliFMD::AliFMD ():AliDetector ()
69 // Default constructor for class AliFMD
76 //_____________________________________________________________________________
77 AliFMD::AliFMD (const char *name, const char *title):
78 AliDetector (name, title)
81 // Standard constructor for Forward Multiplicity Detector
85 // Initialise Hit array
86 fHits = new TClonesArray ("AliFMDhit", 1000);
87 // Digits for each Si disk
88 fDigits = new TClonesArray ("AliFMDdigit", 1000);
89 gAlice->GetMCApp()->AddHitList (fHits);
93 SetMarkerColor (kRed);
96 //-----------------------------------------------------------------------------
99 //destructor for base class AliFMD
115 //_____________________________________________________________________________
116 void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
119 // Add a hit to the list
121 TClonesArray & lhits = *fHits;
122 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
125 //_____________________________________________________________________________
126 void AliFMD::AddDigit (Int_t * digits)
128 // add a real digit - as coming from data
130 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
131 TClonesArray & ldigits = *fDigits;
132 new (ldigits[fNdigits++]) AliFMDdigit (digits);
135 //_____________________________________________________________________________
136 void AliFMD::BuildGeometry ()
139 // Build simple ROOT TNode geometry for event display
142 const int kColorFMD = 5;
144 top = gAlice->GetGeometry ()->GetNode ("alice");
146 // FMD define the different volumes
147 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
149 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
151 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, -62.8, "");
152 node->SetLineColor (kColorFMD);
155 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
157 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, -75.2, "");
158 node->SetLineColor (kColorFMD);
161 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
163 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, 83.2, "");
164 node->SetLineColor (kColorFMD);
167 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
169 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, 75.2, "");
170 node->SetLineColor (kColorFMD);
173 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
175 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, 340, "");
176 node->SetLineColor (kColorFMD);
180 //_____________________________________________________________________________
181 const Int_t AliFMD::DistanceToPrimitive (Int_t /*px*/, Int_t /*py*/)
184 // Calculate the distance from the mouse to the FMD on the screen
190 //___________________________________________
191 void AliFMD::ResetHits ()
193 // Reset number of clusters and the cluster array for this detector
194 AliDetector::ResetHits ();
197 //____________________________________________
198 void AliFMD::ResetDigits ()
201 // Reset number of digits and the digits array for this detector
202 AliDetector::ResetDigits ();
206 //-------------------------------------------------------------------------
210 // Initialis the FMD after it has been built
215 printf ("\n%s: ", ClassName ());
216 for (i = 0; i < 35; i++)
218 printf (" FMD_INIT ");
219 for (i = 0; i < 35; i++)
221 printf ("\n%s: ", ClassName ());
223 // Here the FMD initialisation code (if any!)
224 for (i = 0; i < 80; i++)
232 //---------------------------------------------------------------------
233 void AliFMD::MakeBranch (Option_t * option)
235 // Create Tree branches for the FMD.
237 const Int_t kBufferSize = 16000;
238 sprintf (branchname, "%s", GetName ());
240 const char *cH = strstr(option,"H");
241 const char *cD = strstr(option,"D");
243 if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
245 AliDetector::MakeBranch (option);
248 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
249 MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
254 //_____________________________________________________________________________
255 void AliFMD::SetTreeAddress ()
257 // Set branch address for the Hits and Digits Tree.
260 if (fLoader->TreeH() && (fHits == 0x0))
261 fHits = new TClonesArray ("AliFMDhit", 1000);
263 AliDetector::SetTreeAddress ();
266 TTree *treeD = fLoader->TreeD();
270 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
271 branch = treeD->GetBranch (branchname);
273 branch->SetAddress (&fDigits);
279 //-----------------------------------------------------------------------
281 void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
284 // Create TreeD branches for the FMD
286 const Int_t kBufferSize = 4000;
288 sprintf(branchname,"%s",GetName());
291 MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file);
295 //____________________________________________________________________________
296 AliDigitizer* AliFMD::CreateDigitizer(AliRunDigitizer* manager) const
298 return new AliFMDDigitizer(manager);