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 ///////////////////////////////////////////////////////////////////////////////
41 #include <TGeometry.h>
47 #include <TClonesArray.h>
48 #include <TLorentzVector.h>
52 #include "AliDetector.h"
56 #include "AliFMDhit.h"
57 #include "AliFMDdigit.h"
58 #include "AliFMDReconstruction.h"
59 #include "AliFMDReconstParticles.h"
64 //_____________________________________________________________________________
65 AliFMD::AliFMD ():AliDetector ()
68 // Default constructor for class AliFMD
77 //_____________________________________________________________________________
78 AliFMD::AliFMD (const char *name, const char *title):
79 AliDetector (name, title)
82 // Standard constructor for Forward Multiplicity Detector
86 // Initialise Hit array
87 fHits = new TClonesArray ("AliFMDhit", 1000);
88 // Digits for each Si disk
89 fDigits = new TClonesArray ("AliFMDdigit", 1000);
90 fSDigits = new TClonesArray ("AliFMDdigit", 1000);
91 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
92 gAlice->AddHitList (fHits);
101 SetMarkerColor (kRed);
104 //-----------------------------------------------------------------------------
127 fReconParticles->Delete ();
128 delete fReconParticles;
134 //_____________________________________________________________________________
135 void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
138 // Add a hit to the list
140 TClonesArray & lhits = *fHits;
141 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
144 //_____________________________________________________________________________
145 void AliFMD::AddDigit (Int_t * digits)
147 // add a real digit - as coming from data
150 TClonesArray & ldigits = *fDigits;
151 new (ldigits[fNdigits++]) AliFMDdigit (digits);
154 //_____________________________________________________________________________
155 void AliFMD::AddSDigit (Int_t * digits)
157 // add a real digit - as coming from data
159 TClonesArray & ldigits = *fSDigits;
160 new (ldigits[fNdigits++]) AliFMDdigit (digits);
163 //_____________________________________________________________________________
164 void AliFMD::BuildGeometry ()
167 // Build simple ROOT TNode geometry for event display
170 const int kColorFMD = 5;
172 top = gAlice->GetGeometry ()->GetNode ("alice");
174 // FMD define the different volumes
175 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
177 new TTUBE ("S_FMD0", "FMD volume 0", "void", 3.5, 16.8, 1.5);
179 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
180 node->SetLineColor (kColorFMD);
183 new TTUBE ("S_FMD1", "FMD volume 1", "void", 22., 34.9, 1.5);
185 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.1, "");
186 node->SetLineColor (kColorFMD);
189 new TTUBE ("S_FMD2", "FMD volume 2", "void", 3.5, 16.8, 1.5);
191 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -62.8, "");
192 node->SetLineColor (kColorFMD);
195 new TTUBE ("S_FMD3", "FMD volume 3", "void", 22., 34.9, 1.5);
197 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.1, "");
198 node->SetLineColor (kColorFMD);
201 new TTUBE ("S_FMD4", "FMD volume 4", "void", 3.5, 16.8, 1.5);
203 // node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
204 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -345, "");
205 node->SetLineColor (kColorFMD);
209 //_____________________________________________________________________________
210 Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py)
213 // Calculate the distance from the mouse to the FMD on the screen
219 //___________________________________________
220 void AliFMD::ResetHits ()
222 // Reset number of clusters and the cluster array for this detector
223 AliDetector::ResetHits ();
226 //____________________________________________
227 void AliFMD::ResetDigits ()
230 // Reset number of digits and the digits array for this detector
231 AliDetector::ResetDigits ();
235 //-------------------------------------------------------------------------
239 // Initialis the FMD after it has been built
241 AliMC *pMC = AliMC::GetMC ();
245 printf ("\n%s: ", ClassName ());
246 for (i = 0; i < 35; i++)
248 printf (" FMD_INIT ");
249 for (i = 0; i < 35; i++)
251 printf ("\n%s: ", ClassName ());
253 // Here the FMD initialisation code (if any!)
254 for (i = 0; i < 80; i++)
260 fIdSens1 = pMC->VolId ("GRN1"); //Si sensetive volume
261 fIdSens2 = pMC->VolId ("GRN2"); //Si sensetive volume
262 fIdSens3 = pMC->VolId ("GRN3"); //Si sensetive volume
263 fIdSens4 = pMC->VolId ("GRN4"); //Si sensetive volume
266 //---------------------------------------------------------------------
267 void AliFMD::MakeBranch (Option_t * option, const char *file)
269 // Create Tree branches for the FMD.
271 const Int_t kBufferSize = 16000;
272 sprintf (branchname, "%s", GetName ());
274 AliDetector::MakeBranch (option, file);
275 const char *cD = strstr(option,"D");
276 const char *cR = strstr(option,"R");
277 const char *cS = strstr(option,"S");
281 MakeBranchInTree(gAlice->TreeS(),
282 branchname,&fSDigits,
287 MakeBranchInTree(gAlice->TreeD(),
292 MakeBranchInTree(gAlice->TreeR(),
293 branchname,&fReconParticles,
299 //_____________________________________________________________________________
300 void AliFMD::SetTreeAddress ()
302 // Set branch address for the Hits and Digits Tree.
304 AliDetector::SetTreeAddress ();
307 TTree *treeD = gAlice->TreeD ();
314 branch = treeD->GetBranch (branchname);
316 branch->SetAddress (&fDigits);
321 // fSDigits->Clear ();
323 if (gAlice->TreeS () && fSDigits)
325 branch = gAlice->TreeS ()->GetBranch ("FMD");
327 branch->SetAddress (&fSDigits);
330 if (gAlice->TreeR() && fReconParticles)
332 branch = gAlice->TreeR()->GetBranch("FMD");
333 if (branch) branch->SetAddress(&fReconParticles) ;
337 //---------------------------------------------------------------------
338 void AliFMD::SetRingsSi1(Int_t ringsSi1)
342 void AliFMD::SetSectorsSi1(Int_t sectorsSi1)
344 fSectorsSi1=sectorsSi1;
346 void AliFMD::SetRingsSi2(Int_t ringsSi2)
350 void AliFMD::SetSectorsSi2(Int_t sectorsSi2)
352 fSectorsSi2=sectorsSi2;
354 //---------------------------------------------------------------------
356 void AliFMD::SDigits2Digits()
358 cout<<"AliFMD::SDigits2Digits"<<endl;
360 fMerger = new AliFMDMerger();
362 fMerger ->SetRingsSi1(fRingsSi1);
363 fMerger->SetRingsSi2(fRingsSi2);
364 fMerger ->SetSectorsSi1(fSectorsSi1);
365 fMerger ->SetSectorsSi2(fSectorsSi2);
367 cout<<"AliFMD::SDigits2Digits Init"<<endl;
369 cout<<"AliFMD::SDigits2Digits Digitise() "<<endl;
373 //---------------------------------------------------------------------
374 void AliFMD::SetMerger(AliFMDMerger* merger)
376 // Set pointer to merger
380 AliFMDMerger* AliFMD::Merger()
382 // Return pointer to merger
386 //---------------------------------------------------------------------
391 AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
393 Float_t expEta = TMath::Exp (-eta);
394 Float_t theta = TMath::ATan (expEta);
396 Float_t rad = zDisk * (TMath::Tan (theta));
400 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
403 //---------------------------------------------------------------------
405 void AliFMD::Hits2SDigits ()
409 cout<<"ALiFMD::Hits2SDigits> start...\n";
412 char * fileSDigits = 0 ;
413 char * fileHeader = 0;
414 AliFMDSDigitizer * sd = new AliFMDSDigitizer(fileHeader,fileSDigits) ;
415 sd->SetRingsSi1(fRingsSi1);
416 sd->SetRingsSi2(fRingsSi2);
417 sd->SetSectorsSi1(fSectorsSi1);
418 sd->SetSectorsSi2(fSectorsSi2);
427 //-----------------------------------------------------------------------
429 void AliFMD::Digits2Reco()
431 char * fileReconParticles=0;
433 AliFMDReconstruction * reconstruction =
434 new AliFMDReconstruction(fileHeader,fileReconParticles) ;
435 // fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
436 reconstruction->Exec("");
437 delete reconstruction;