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 **************************************************************************/
15 //////////////////////////////////////////////////////////////////////////////
17 // Forward Multiplicity Detector based on Silicon plates //
18 // This class contains the base procedures for the Forward Multiplicity //
20 // Detector consists of 6 Si volumes covered pseudorapidity interval //
21 // from 1.6 to 6.0. //
25 <img src="gif/AliFMDClass.gif">
28 <font size=+2 color=red>
29 <p>The responsible person for this module is
30 <a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
37 ///////////////////////////////////////////////////////////////////////////////
42 #include <TGeometry.h>
48 #include <TClonesArray.h>
49 #include <TLorentzVector.h>
52 #include "AliDetector.h"
54 #include <Riostream.h>
56 #include "AliFMDhit.h"
57 #include "AliFMDdigit.h"
58 #include "AliFMDReconstruction.h"
59 #include "AliFMDReconstParticles.h"
63 //_____________________________________________________________________________
64 AliFMD::AliFMD ():AliDetector ()
67 // Default constructor for class AliFMD
75 //_____________________________________________________________________________
76 AliFMD::AliFMD (const char *name, const char *title):
77 AliDetector (name, title)
80 // Standard constructor for Forward Multiplicity Detector
84 // Initialise Hit array
85 fHits = new TClonesArray ("AliFMDhit", 1000);
86 // Digits for each Si disk
87 fDigits = new TClonesArray ("AliFMDdigit", 1000);
88 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
89 gAlice->AddHitList (fHits);
98 SetMarkerColor (kRed);
101 //-----------------------------------------------------------------------------
118 fReconParticles->Delete ();
119 delete fReconParticles;
125 //_____________________________________________________________________________
126 void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
129 // Add a hit to the list
131 TClonesArray & lhits = *fHits;
132 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
135 //_____________________________________________________________________________
136 void AliFMD::AddDigit (Int_t * digits)
138 // add a real digit - as coming from data
141 TClonesArray & ldigits = *fDigits;
142 new (ldigits[fNdigits++]) AliFMDdigit (digits);
145 //_____________________________________________________________________________
146 void AliFMD::BuildGeometry ()
149 // Build simple ROOT TNode geometry for event display
152 const int kColorFMD = 5;
154 top = gAlice->GetGeometry ()->GetNode ("alice");
156 // FMD define the different volumes
157 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
159 new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5);
161 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
162 node->SetLineColor (kColorFMD);
165 new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5);
167 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.2, "");
168 node->SetLineColor (kColorFMD);
171 new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5);
173 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -83.2, "");
174 node->SetLineColor (kColorFMD);
177 new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5);
179 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.2, "");
180 node->SetLineColor (kColorFMD);
183 new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5);
185 // node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
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 //-------------------------------------------------------------------------
222 // Initialis the FMD after it has been built
227 printf ("\n%s: ", ClassName ());
228 for (i = 0; i < 35; i++)
230 printf (" FMD_INIT ");
231 for (i = 0; i < 35; i++)
233 printf ("\n%s: ", ClassName ());
235 // Here the FMD initialisation code (if any!)
236 for (i = 0; i < 80; i++)
242 fIdSens1 = gMC->VolId ("GRN1"); //Si sensetive volume
243 fIdSens2 = gMC->VolId ("GRN2"); //Si sensetive volume
244 fIdSens3 = gMC->VolId ("GRN3"); //Si sensetive volume
245 fIdSens4 = gMC->VolId ("GRN4"); //Si sensetive volume
246 fIdSens5 = gMC->VolId ("GRN5"); //Si sensetive volume
250 //---------------------------------------------------------------------
251 void AliFMD::MakeBranch (Option_t * option, const char *file)
253 // Create Tree branches for the FMD.
255 const Int_t kBufferSize = 16000;
256 sprintf (branchname, "%s", GetName ());
258 AliDetector::MakeBranch (option, file);
259 const char *cD = strstr(option,"D");
260 const char *cR = strstr(option,"R");
264 MakeBranchInTree(gAlice->TreeD(),
267 cout<<" tree "<<gAlice->TreeD()<<" "<<branchname<<" "<<&fDigits<<endl;
270 MakeBranchInTree(gAlice->TreeR(),
271 branchname,&fReconParticles,
277 //_____________________________________________________________________________
278 void AliFMD::SetTreeAddress ()
280 // Set branch address for the Hits and Digits Tree.
282 AliDetector::SetTreeAddress ();
285 TTree *treeD = gAlice->TreeD ();
292 branch = treeD->GetBranch (branchname);
294 branch->SetAddress (&fDigits);
300 if (gAlice->TreeR() && fReconParticles)
302 branch = gAlice->TreeR()->GetBranch("FMD");
303 if (branch) branch->SetAddress(&fReconParticles) ;
307 //---------------------------------------------------------------------
309 void AliFMD::SetRingsSi1(Int_t ringsSi1)
311 // fRingsSi1=ringsSi1;
314 void AliFMD::SetSectorsSi1(Int_t sectorsSi1)
318 void AliFMD::SetRingsSi2(Int_t ringsSi2)
322 void AliFMD::SetSectorsSi2(Int_t sectorsSi2)
327 //---------------------------------------------------------------------
332 AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
334 Float_t expEta = TMath::Exp (-eta);
335 Float_t theta = TMath::ATan (expEta);
337 Float_t rad = zDisk * (TMath::Tan (theta));
341 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
344 //-----------------------------------------------------------------------
346 void AliFMD::Digits2Reco()
348 char * fileReconParticles=0;
350 AliFMDReconstruction * reconstruction =
351 new AliFMDReconstruction(fileHeader,fileReconParticles) ;
352 reconstruction->Exec("");
353 delete reconstruction;
355 //-----------------------------------------------------------------------
357 void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
360 // Create TreeD branches for the MUON.
363 const Int_t kBufferSize = 4000;
367 sprintf(branchname,"%s",GetName());
369 MakeBranchInTree(treeD,