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>
46 #include <TClonesArray.h>
47 #include <TLorentzVector.h>
54 #include "AliFMDhit.h"
55 #include "AliFMDdigit.h"
61 //_____________________________________________________________________________
62 AliFMD::AliFMD(): AliDetector()
65 // Default constructor for class AliFMD
70 //_____________________________________________________________________________
71 AliFMD::AliFMD(const char *name, const char *title)
72 : AliDetector(name,title)
75 // Standard constructor for Forward Multiplicity Detector
79 // Initialise Hit array
80 fHits = new TClonesArray("AliFMDhit", 1000);
81 // Digits for each Si disk
82 fDigits = new TClonesArray("AliFMDdigit", 1000);
83 fSDigits = new TClonesArray("AliFMDdigit", 1000) ;
84 gAlice->AddHitList(fHits);
112 //_____________________________________________________________________________
113 void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
116 // Add a hit to the list
118 TClonesArray &lhits = *fHits;
119 new(lhits[fNhits++]) AliFMDhit(fIshunt,track,vol,hits);
121 //_____________________________________________________________________________
122 void AliFMD::AddDigit( Int_t *digits)
124 // add a real digit - as coming from data
126 // printf("AddDigit\n");
128 TClonesArray &ldigits = *fDigits;
129 new(ldigits[fNdigits++]) AliFMDdigit(digits);
132 //_____________________________________________________________________________
133 void AliFMD::BuildGeometry()
136 // Build simple ROOT TNode geometry for event display
139 const int kColorFMD = 7;
141 top=gAlice->GetGeometry()->GetNode("alice");
143 // FMD define the different volumes
144 new TRotMatrix("rot901","rot901", 90, 0, 90, 90, 180, 0);
146 new TTUBE("S_FMD0","FMD volume 0","void",4.73,17.7,1.5);
148 node = new TNode("FMD0","FMD0","S_FMD0",0,0,64,"");
149 node->SetLineColor(kColorFMD);
152 new TTUBE("S_FMD1","FMD volume 1","void",23.4,36.,1.5);
154 node = new TNode("FMD1","FMD1","S_FMD1",0,0,85,"");
155 node->SetLineColor(kColorFMD);
158 new TTUBE("S_FMD2","FMD volume 2","void",4.73,17.7,1.5);
160 node = new TNode("FMD2","FMD2","S_FMD2",0,0,-64,"");
161 node->SetLineColor(kColorFMD);
164 new TTUBE("S_FMD3","FMD volume 3","void",23.4,36.,1.5);
166 node = new TNode("FMD3","FMD3","S_FMD3",0,0,-85,"");
167 node->SetLineColor(kColorFMD);
170 new TTUBE("S_FMD4","FMD volume 4","void",5,15,0.015);
172 node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
173 node->SetLineColor(kColorFMD);
177 new TTUBE("S_FMD5","FMD volume 5","void",5,14,0.015);
179 node = new TNode("FMD5","FMD5","S_FMD5",0,0,-630,"");
180 node->SetLineColor(kColorFMD);
185 //_____________________________________________________________________________
186 Int_t AliFMD::DistanceToPrimitive(Int_t px, Int_t py)
189 // Calculate the distance from the mouse to the FMD on the screen
194 //___________________________________________
195 void AliFMD::ResetHits()
197 // Reset number of clusters and the cluster array for this detector
198 AliDetector::ResetHits();
201 //____________________________________________
202 void AliFMD::ResetDigits()
205 // Reset number of digits and the digits array for this detector
206 AliDetector::ResetHits();
210 //-------------------------------------------------------------------------
214 // Initialis the FMD after it has been built
216 AliMC* pMC = AliMC::GetMC();
219 printf("\n%s: ",ClassName());
220 for(i=0;i<35;i++) printf("*");
221 printf(" FMD_INIT ");
222 for(i=0;i<35;i++) printf("*");
223 printf("\n%s: ",ClassName());
225 // Here the FMD initialisation code (if any!)
226 for(i=0;i<80;i++) printf("*");
232 fIdSens1=pMC->VolId("GRIN"); //Si sensetive volume
234 fIdSens1=pMC->VolId("GFSI"); //Si sensetive volume
237 //---------------------------------------------------------------------
238 void AliFMD::MakeBranch(Option_t* option, const char *file)
240 // Create Tree branches for the FMD.
241 const Int_t kBufferSize = 4000;
243 sprintf(branchname,"%s",GetName());
245 AliDetector::MakeBranch(option,file);
247 const char *cD = strstr(option,"D");
251 MakeBranchInTree(gAlice->TreeD(),
252 branchname, &fDigits, kBufferSize, file);
254 printf("Making Branch %s for digits\n",branchname);
255 gAlice->TreeD()->Print();
259 //_____________________________________________________________________________
260 void AliFMD::SetTreeAddress()
262 // Set branch address for the Hits and Digits Tree.
264 AliDetector::SetTreeAddress();
267 TTree *treeD = gAlice->TreeD();
272 branch = treeD->GetBranch(branchname);
273 if (branch) branch->SetAddress(&fDigits);
280 if (gAlice->TreeS() && fSDigits ) {
281 branch = gAlice->TreeS()->GetBranch("FMD");
282 if (branch) branch->SetAddress(&fSDigits) ;
288 //---------------------------------------------------------------------
290 void AliFMD::SDigits2Digits()
296 printf("nbgr_ev %d\n",nbgr_ev);
297 // Hit2Digits(nbgr_ev,"Add"," ","galice_bgr.root");
300 // Hit2Digits(nbgr_ev,"rien","","");
305 //---------------------------------------------------------------------
309 void AliFMD::Eta2Radius(Float_t eta, Float_t zDisk, Float_t *radius)
311 Float_t expEta=TMath::Exp(-eta);
312 Float_t theta=TMath::ATan(expEta);
314 Float_t rad=zDisk*(TMath::Tan(theta));
317 if(fDebug) printf("%s: eta %f radius %f\n", ClassName(), eta, rad);
320 //---------------------------------------------------------------------
322 void AliFMD::Hits2SDigits(){
323 if(fDebug) cout << ClassName() << ": ALiFMD::Hits2SDigits> start...\n";
324 // char * fileSDigits = 0 ;
325 // char * fileHeader=0 ;
326 AliFMDSDigitizer * sd = new AliFMDSDigitizer("mgalice.root","FMD.SDigit.root") ;