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>
50 #include <TLorentzVector.h>
55 #include <TVirtualMC.h>
57 #include "AliDetector.h"
58 #include "AliFMDReconstParticles.h"
59 #include "AliFMDReconstruction.h"
60 #include "AliFMDdigit.h"
61 #include "AliFMDhit.h"
63 #include "AliLoader.h"
69 //_____________________________________________________________________________
70 AliFMD::AliFMD ():AliDetector ()
73 // Default constructor for class AliFMD
81 //_____________________________________________________________________________
82 AliFMD::AliFMD (const char *name, const char *title):
83 AliDetector (name, title)
86 // Standard constructor for Forward Multiplicity Detector
90 // Initialise Hit array
91 fHits = new TClonesArray ("AliFMDhit", 1000);
92 // Digits for each Si disk
93 fDigits = new TClonesArray ("AliFMDdigit", 1000);
94 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
95 gAlice->GetMCApp()->AddHitList (fHits);
99 SetMarkerColor (kRed);
102 //-----------------------------------------------------------------------------
119 fReconParticles->Delete ();
120 delete fReconParticles;
126 //_____________________________________________________________________________
127 void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
130 // Add a hit to the list
132 TClonesArray & lhits = *fHits;
133 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
136 //_____________________________________________________________________________
137 void AliFMD::AddDigit (Int_t * digits)
139 // add a real digit - as coming from data
141 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
142 TClonesArray & ldigits = *fDigits;
143 new (ldigits[fNdigits++]) AliFMDdigit (digits);
146 //_____________________________________________________________________________
147 void AliFMD::BuildGeometry ()
150 // Build simple ROOT TNode geometry for event display
153 const int kColorFMD = 5;
155 top = gAlice->GetGeometry ()->GetNode ("alice");
157 // FMD define the different volumes
158 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
160 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
162 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, -62.8, "");
163 node->SetLineColor (kColorFMD);
166 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
168 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, -75.2, "");
169 node->SetLineColor (kColorFMD);
172 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
174 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, 83.2, "");
175 node->SetLineColor (kColorFMD);
178 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
180 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, 75.2, "");
181 node->SetLineColor (kColorFMD);
184 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
186 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, 340, "");
187 node->SetLineColor (kColorFMD);
191 //_____________________________________________________________________________
192 Int_t AliFMD::DistanceToPrimitive (Int_t /*px*/, Int_t /*py*/)
195 // Calculate the distance from the mouse to the FMD on the screen
201 //___________________________________________
202 void AliFMD::ResetHits ()
204 // Reset number of clusters and the cluster array for this detector
205 AliDetector::ResetHits ();
208 //____________________________________________
209 void AliFMD::ResetDigits ()
212 // Reset number of digits and the digits array for this detector
213 AliDetector::ResetDigits ();
217 //-------------------------------------------------------------------------
221 // Initialis the FMD after it has been built
226 printf ("\n%s: ", ClassName ());
227 for (i = 0; i < 35; i++)
229 printf (" FMD_INIT ");
230 for (i = 0; i < 35; i++)
232 printf ("\n%s: ", ClassName ());
234 // Here the FMD initialisation code (if any!)
235 for (i = 0; i < 80; i++)
243 //---------------------------------------------------------------------
244 void AliFMD::MakeBranch (Option_t * option)
246 // Create Tree branches for the FMD.
248 const Int_t kBufferSize = 16000;
249 sprintf (branchname, "%s", GetName ());
251 const char *cH = strstr(option,"H");
252 const char *cD = strstr(option,"D");
253 const char *cR = strstr(option,"R");
255 if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
257 AliDetector::MakeBranch (option);
260 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
261 MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
265 if (fReconParticles == 0x0)
266 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
267 MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0);
272 //_____________________________________________________________________________
273 void AliFMD::SetTreeAddress ()
275 // Set branch address for the Hits and Digits Tree.
278 if (fLoader->TreeH() && (fHits == 0x0))
279 fHits = new TClonesArray ("AliFMDhit", 1000);
281 AliDetector::SetTreeAddress ();
284 TTree *treeD = fLoader->TreeD();
288 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
289 branch = treeD->GetBranch (branchname);
291 branch->SetAddress (&fDigits);
294 if (fLoader->TreeR() && fReconParticles)
296 if (fReconParticles == 0x0)
297 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
298 branch = fLoader->TreeR()->GetBranch("FMD");
299 if (branch) branch->SetAddress(&fReconParticles) ;
306 AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
308 Float_t expEta = TMath::Exp (-eta);
309 Float_t theta = TMath::ATan (expEta);
311 Float_t rad = zDisk * (TMath::Tan (theta));
315 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
318 //---------------------------------------------------------------------
321 void AliFMD::Digits2Reco()
323 AliFMDReconstruction * reconstruction = new AliFMDReconstruction(fLoader->GetRunLoader());
324 cout<<" AliFMD::Digits2Reco >> "<<reconstruction<<endl;
325 reconstruction->Exec();
326 delete reconstruction;
328 //-----------------------------------------------------------------------
330 void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
333 // Create TreeD branches for the FMD
335 const Int_t kBufferSize = 4000;
337 sprintf(branchname,"%s",GetName());
340 MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file);