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 6 Si volumes covered pseudorapidity interval //
24 // from 1.6 to 6.0. //
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"
68 //_____________________________________________________________________________
69 AliFMD::AliFMD ():AliDetector ()
72 // Default constructor for class AliFMD
80 //_____________________________________________________________________________
81 AliFMD::AliFMD (const char *name, const char *title):
82 AliDetector (name, title)
85 // Standard constructor for Forward Multiplicity Detector
89 // Initialise Hit array
90 fHits = new TClonesArray ("AliFMDhit", 1000);
91 // Digits for each Si disk
92 fDigits = new TClonesArray ("AliFMDdigit", 1000);
93 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
94 gAlice->AddHitList (fHits);
103 SetMarkerColor (kRed);
106 //-----------------------------------------------------------------------------
123 fReconParticles->Delete ();
124 delete fReconParticles;
130 //_____________________________________________________________________________
131 void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
134 // Add a hit to the list
136 TClonesArray & lhits = *fHits;
137 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
140 //_____________________________________________________________________________
141 void AliFMD::AddDigit (Int_t * digits)
143 // add a real digit - as coming from data
145 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
146 TClonesArray & ldigits = *fDigits;
147 new (ldigits[fNdigits++]) AliFMDdigit (digits);
150 //_____________________________________________________________________________
151 void AliFMD::BuildGeometry ()
154 // Build simple ROOT TNode geometry for event display
157 const int kColorFMD = 5;
159 top = gAlice->GetGeometry ()->GetNode ("alice");
161 // FMD define the different volumes
162 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
164 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
166 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
167 node->SetLineColor (kColorFMD);
170 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
172 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.2, "");
173 node->SetLineColor (kColorFMD);
176 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
178 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -83.2, "");
179 node->SetLineColor (kColorFMD);
182 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
184 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.2, "");
185 node->SetLineColor (kColorFMD);
188 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
190 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -340, "");
191 node->SetLineColor (kColorFMD);
195 //_____________________________________________________________________________
196 Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py)
199 // Calculate the distance from the mouse to the FMD on the screen
205 //___________________________________________
206 void AliFMD::ResetHits ()
208 // Reset number of clusters and the cluster array for this detector
209 AliDetector::ResetHits ();
212 //____________________________________________
213 void AliFMD::ResetDigits ()
216 // Reset number of digits and the digits array for this detector
217 AliDetector::ResetDigits ();
221 //-------------------------------------------------------------------------
225 // Initialis the FMD after it has been built
230 printf ("\n%s: ", ClassName ());
231 for (i = 0; i < 35; i++)
233 printf (" FMD_INIT ");
234 for (i = 0; i < 35; i++)
236 printf ("\n%s: ", ClassName ());
238 // Here the FMD initialisation code (if any!)
239 for (i = 0; i < 80; i++)
245 fIdSens1 = gMC->VolId ("GRN1"); //Si sensetive volume
246 fIdSens2 = gMC->VolId ("GRN2"); //Si sensetive volume
247 fIdSens3 = gMC->VolId ("GRN3"); //Si sensetive volume
248 fIdSens4 = gMC->VolId ("GRN4"); //Si sensetive volume
249 fIdSens5 = gMC->VolId ("GRN5"); //Si sensetive volume
252 //---------------------------------------------------------------------
253 void AliFMD::MakeBranch (Option_t * option)
255 // Create Tree branches for the FMD.
257 const Int_t kBufferSize = 16000;
258 sprintf (branchname, "%s", GetName ());
260 const char *cH = strstr(option,"H");
261 const char *cD = strstr(option,"D");
262 const char *cR = strstr(option,"R");
264 if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
266 AliDetector::MakeBranch (option);
269 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
270 MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
274 if (fReconParticles == 0x0)
275 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
276 MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0);
281 //_____________________________________________________________________________
282 void AliFMD::SetTreeAddress ()
284 // Set branch address for the Hits and Digits Tree.
287 if (fLoader->TreeH() && (fHits == 0x0))
288 fHits = new TClonesArray ("AliFMDhit", 1000);
290 AliDetector::SetTreeAddress ();
293 TTree *treeD = fLoader->TreeD();
297 if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
298 branch = treeD->GetBranch (branchname);
300 branch->SetAddress (&fDigits);
303 if (fLoader->TreeR() && fReconParticles)
305 if (fReconParticles == 0x0)
306 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
307 branch = fLoader->TreeR()->GetBranch("FMD");
308 if (branch) branch->SetAddress(&fReconParticles) ;
312 //---------------------------------------------------------------------
314 void AliFMD::SetRingsSi1(Int_t ringsSi1)
318 void AliFMD::SetSectorsSi1(Int_t sectorsSi1)
322 void AliFMD::SetRingsSi2(Int_t ringsSi2)
326 void AliFMD::SetSectorsSi2(Int_t sectorsSi2)
334 AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
336 Float_t expEta = TMath::Exp (-eta);
337 Float_t theta = TMath::ATan (expEta);
339 Float_t rad = zDisk * (TMath::Tan (theta));
343 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
346 //---------------------------------------------------------------------
349 void AliFMD::Digits2Reco()
351 AliFMDReconstruction * reconstruction = new AliFMDReconstruction(fLoader->GetRunLoader());
352 cout<<" AliFMD::Digits2Reco >> "<<reconstruction<<endl;
353 reconstruction->Exec("");
354 delete reconstruction;
356 //-----------------------------------------------------------------------
358 void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
361 // Create TreeD branches for the FMD
363 const Int_t kBufferSize = 4000;
365 sprintf(branchname,"%s",GetName());
368 MakeBranchInTree(treeD, branchname,&fDigits, kBufferSize, file);