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
78 //_____________________________________________________________________________
79 AliFMD::AliFMD (const char *name, const char *title):
80 AliDetector (name, title)
83 // Standard constructor for Forward Multiplicity Detector
87 // Initialise Hit array
88 fHits = new TClonesArray ("AliFMDhit", 1000);
89 // Digits for each Si disk
90 fDigits = new TClonesArray ("AliFMDdigit", 1000);
91 fSDigits = new TClonesArray ("AliFMDdigit", 1000);
92 fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
93 gAlice->AddHitList (fHits);
102 SetMarkerColor (kRed);
105 //-----------------------------------------------------------------------------
128 fReconParticles->Delete ();
129 delete fReconParticles;
135 //_____________________________________________________________________________
136 void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
139 // Add a hit to the list
141 TClonesArray & lhits = *fHits;
142 new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
145 //_____________________________________________________________________________
146 void AliFMD::AddDigit (Int_t * digits)
148 // add a real digit - as coming from data
151 TClonesArray & ldigits = *fDigits;
152 new (ldigits[fNdigits++]) AliFMDdigit (digits);
155 //_____________________________________________________________________________
156 void AliFMD::AddSDigit (Int_t * digits)
158 // add a real digit - as coming from data
160 TClonesArray & ldigits = *fSDigits;
161 new (ldigits[fNdigits++]) AliFMDdigit (digits);
164 //_____________________________________________________________________________
165 void AliFMD::BuildGeometry ()
168 // Build simple ROOT TNode geometry for event display
171 const int kColorFMD = 5;
173 top = gAlice->GetGeometry ()->GetNode ("alice");
175 // FMD define the different volumes
176 new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
178 new TTUBE ("S_FMD0", "FMD volume 0", "void", 3.5, 16.8, 1.5);
180 node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
181 node->SetLineColor (kColorFMD);
184 new TTUBE ("S_FMD1", "FMD volume 1", "void", 22., 34.9, 1.5);
186 node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.1, "");
187 node->SetLineColor (kColorFMD);
190 new TTUBE ("S_FMD2", "FMD volume 2", "void", 3.5, 16.8, 1.5);
192 node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -62.8, "");
193 node->SetLineColor (kColorFMD);
196 new TTUBE ("S_FMD3", "FMD volume 3", "void", 22., 34.9, 1.5);
198 node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.1, "");
199 node->SetLineColor (kColorFMD);
202 new TTUBE ("S_FMD4", "FMD volume 4", "void", 3.5, 16.8, 1.5);
204 // node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
205 node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -345, "");
206 node->SetLineColor (kColorFMD);
210 //_____________________________________________________________________________
211 Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py)
214 // Calculate the distance from the mouse to the FMD on the screen
220 //___________________________________________
221 void AliFMD::ResetHits ()
223 // Reset number of clusters and the cluster array for this detector
224 AliDetector::ResetHits ();
227 //____________________________________________
228 void AliFMD::ResetDigits ()
231 // Reset number of digits and the digits array for this detector
232 AliDetector::ResetDigits ();
236 //-------------------------------------------------------------------------
240 // Initialis the FMD after it has been built
242 AliMC *pMC = AliMC::GetMC ();
246 printf ("\n%s: ", ClassName ());
247 for (i = 0; i < 35; i++)
249 printf (" FMD_INIT ");
250 for (i = 0; i < 35; i++)
252 printf ("\n%s: ", ClassName ());
254 // Here the FMD initialisation code (if any!)
255 for (i = 0; i < 80; i++)
261 fIdSens1 = pMC->VolId ("GRN1"); //Si sensetive volume
262 fIdSens2 = pMC->VolId ("GRN2"); //Si sensetive volume
263 fIdSens3 = pMC->VolId ("GRN3"); //Si sensetive volume
264 fIdSens4 = pMC->VolId ("GRN4"); //Si sensetive volume
267 //---------------------------------------------------------------------
268 void AliFMD::MakeBranch (Option_t * option, const char *file)
270 // Create Tree branches for the FMD.
272 const Int_t kBufferSize = 16000;
273 sprintf (branchname, "%s", GetName ());
275 AliDetector::MakeBranch (option, file);
276 const char *cD = strstr(option,"D");
277 const char *cR = strstr(option,"R");
278 const char *cS = strstr(option,"S");
282 MakeBranchInTree(gAlice->TreeS(),
283 branchname,&fSDigits,
288 MakeBranchInTree(gAlice->TreeD(),
293 MakeBranchInTree(gAlice->TreeR(),
294 branchname,&fReconParticles,
300 //_____________________________________________________________________________
301 void AliFMD::SetTreeAddress ()
303 // Set branch address for the Hits and Digits Tree.
305 AliDetector::SetTreeAddress ();
308 TTree *treeD = gAlice->TreeD ();
315 branch = treeD->GetBranch (branchname);
317 branch->SetAddress (&fDigits);
322 // fSDigits->Clear ();
324 if (gAlice->TreeS () && fSDigits)
326 branch = gAlice->TreeS ()->GetBranch ("FMD");
328 branch->SetAddress (&fSDigits);
331 if (gAlice->TreeR() && fReconParticles)
333 branch = gAlice->TreeR()->GetBranch("FMD");
334 if (branch) branch->SetAddress(&fReconParticles) ;
338 //---------------------------------------------------------------------
339 void AliFMD::SetRingsSi1(Int_t ringsSi1)
343 void AliFMD::SetSectorsSi1(Int_t sectorsSi1)
345 fSectorsSi1=sectorsSi1;
347 void AliFMD::SetRingsSi2(Int_t ringsSi2)
351 void AliFMD::SetSectorsSi2(Int_t sectorsSi2)
353 fSectorsSi2=sectorsSi2;
355 //---------------------------------------------------------------------
357 void AliFMD::SDigits2Digits()
359 cout<<"AliFMD::SDigits2Digits"<<endl;
361 fMerger ->SetRingsSi1(fRingsSi1);
362 fMerger->SetRingsSi2(fRingsSi2);
363 fMerger ->SetSectorsSi1(fSectorsSi1);
364 fMerger ->SetSectorsSi2(fSectorsSi2);
366 cout<<"AliFMD::SDigits2Digits Init"<<endl;
368 cout<<"AliFMD::SDigits2Digits Digitise() "<<endl;
372 //---------------------------------------------------------------------
373 void AliFMD::SetMerger(AliFMDMerger* merger)
375 // Set pointer to merger
379 AliFMDMerger* AliFMD::Merger()
381 // Return pointer to merger
385 //---------------------------------------------------------------------
390 AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
392 Float_t expEta = TMath::Exp (-eta);
393 Float_t theta = TMath::ATan (expEta);
395 Float_t rad = zDisk * (TMath::Tan (theta));
399 printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
402 //---------------------------------------------------------------------
404 void AliFMD::Hits2SDigits ()
408 cout<<"ALiFMD::Hits2SDigits> start...\n";
411 char * fileSDigits = 0 ;
412 char * fileHeader = 0;
413 AliFMDSDigitizer * sd = new AliFMDSDigitizer(fileHeader,fileSDigits) ;
414 sd->SetRingsSi1(fRingsSi1);
415 sd->SetRingsSi2(fRingsSi2);
416 sd->SetSectorsSi1(fSectorsSi1);
417 sd->SetSectorsSi2(fSectorsSi2);
426 //-----------------------------------------------------------------------
428 void AliFMD::Digits2Reco()
430 char * fileReconParticles=0;
432 AliFMDReconstruction * reconstruction =
433 new AliFMDReconstruction(fileHeader,fileReconParticles) ;
434 // fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
435 reconstruction->Exec("");
436 delete reconstruction;