]>
Commit | Line | Data |
---|---|---|
4c039060 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
d28dcc0d | 15 | ////////////////////////////////////////////////////////////////////////////// |
37c55dc0 | 16 | // // |
d28dcc0d | 17 | // Forward Multiplicity Detector based on Silicon plates // |
fe4da5cc | 18 | // This class contains the base procedures for the Forward Multiplicity // |
19 | // detector // | |
d28dcc0d | 20 | // Detector consists of 6 Si volumes covered pseudorapidity interval // |
21 | // from 1.6 to 6.0. // | |
fe4da5cc | 22 | // // |
23 | //Begin_Html | |
24 | /* | |
d28dcc0d | 25 | <img src="gif/AliFMDClass.gif"> |
fe4da5cc | 26 | </pre> |
27 | <br clear=left> | |
28 | <font size=+2 color=red> | |
29 | <p>The responsible person for this module is | |
d28dcc0d | 30 | <a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>. |
fe4da5cc | 31 | </font> |
32 | <pre> | |
33 | */ | |
34 | //End_Html | |
35 | // // | |
36 | // // | |
37 | /////////////////////////////////////////////////////////////////////////////// | |
38 | ||
cb1df35e | 39 | |
b9a2d5e4 | 40 | #define DEBUG |
41 | #include <TMath.h> | |
94de3818 | 42 | #include <TGeometry.h> |
b9a2d5e4 | 43 | #include <TTUBE.h> |
d28dcc0d | 44 | #include <TTree.h> |
b9a2d5e4 | 45 | #include <TNode.h> |
dc8af42e | 46 | #include <TFile.h> |
b9a2d5e4 | 47 | |
48 | #include <TClonesArray.h> | |
49 | #include <TLorentzVector.h> | |
50 | #include "AliFMDv1.h" | |
fe4da5cc | 51 | #include "AliRun.h" |
dc8af42e | 52 | #include "AliDetector.h" |
93bdec82 | 53 | #include <Riostream.h> |
b9a2d5e4 | 54 | #include "AliMagF.h" |
d28dcc0d | 55 | #include "AliFMDhit.h" |
b9a2d5e4 | 56 | #include "AliFMDdigit.h" |
dc8af42e | 57 | #include "AliFMDReconstruction.h" |
37c55dc0 | 58 | #include "AliFMDReconstParticles.h" |
b9a2d5e4 | 59 | #include <stdlib.h> |
60 | ||
dc8af42e | 61 | ClassImp (AliFMD) |
b9a2d5e4 | 62 | //_____________________________________________________________________________ |
dc8af42e | 63 | AliFMD::AliFMD ():AliDetector () |
fe4da5cc | 64 | { |
65 | // | |
66 | // Default constructor for class AliFMD | |
67 | // | |
dc8af42e | 68 | fIshunt = 0; |
69 | fHits = 0; | |
70 | fDigits = 0; | |
71 | fSDigits = 0; | |
cccf369e | 72 | fReconParticles=0; |
fe4da5cc | 73 | } |
dc8af42e | 74 | |
fe4da5cc | 75 | //_____________________________________________________________________________ |
dc8af42e | 76 | AliFMD::AliFMD (const char *name, const char *title): |
77 | AliDetector (name, title) | |
fe4da5cc | 78 | { |
79 | // | |
80 | // Standard constructor for Forward Multiplicity Detector | |
81 | // | |
dc8af42e | 82 | |
fe4da5cc | 83 | // |
84 | // Initialise Hit array | |
dc8af42e | 85 | fHits = new TClonesArray ("AliFMDhit", 1000); |
b9a2d5e4 | 86 | // Digits for each Si disk |
dc8af42e | 87 | fDigits = new TClonesArray ("AliFMDdigit", 1000); |
88 | fSDigits = new TClonesArray ("AliFMDdigit", 1000); | |
37c55dc0 | 89 | fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); |
dc8af42e | 90 | gAlice->AddHitList (fHits); |
d1280e40 | 91 | |
dc8af42e | 92 | fIshunt = 0; |
93 | fIdSens1 = 0; | |
37c55dc0 | 94 | fIdSens2 = 0; |
95 | fIdSens3 = 0; | |
96 | fIdSens4 = 0; | |
97 | fIdSens5 = 0; | |
4110645f | 98 | // fMerger = 0; |
dc8af42e | 99 | SetMarkerColor (kRed); |
fe4da5cc | 100 | } |
d28dcc0d | 101 | |
dc8af42e | 102 | //----------------------------------------------------------------------------- |
103 | AliFMD::~AliFMD () | |
d28dcc0d | 104 | { |
dc8af42e | 105 | if (fHits) |
106 | { | |
107 | fHits->Delete (); | |
b9a2d5e4 | 108 | delete fHits; |
cae27883 | 109 | fHits = 0; |
dc8af42e | 110 | } |
111 | if (fDigits) | |
112 | { | |
113 | fDigits->Delete (); | |
cae27883 | 114 | delete fDigits; |
115 | fDigits = 0; | |
dc8af42e | 116 | } |
117 | if (fSDigits) | |
118 | { | |
119 | fSDigits->Delete (); | |
cae27883 | 120 | delete fSDigits; |
121 | fSDigits = 0; | |
dc8af42e | 122 | } |
123 | if (fReconParticles) | |
124 | { | |
125 | fReconParticles->Delete (); | |
126 | delete fReconParticles; | |
127 | fReconParticles = 0; | |
128 | } | |
129 | ||
d28dcc0d | 130 | } |
dc8af42e | 131 | |
fe4da5cc | 132 | //_____________________________________________________________________________ |
dc8af42e | 133 | void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits) |
fe4da5cc | 134 | { |
135 | // | |
d28dcc0d | 136 | // Add a hit to the list |
fe4da5cc | 137 | // |
dc8af42e | 138 | TClonesArray & lhits = *fHits; |
139 | new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits); | |
fe4da5cc | 140 | } |
dc8af42e | 141 | |
fe4da5cc | 142 | //_____________________________________________________________________________ |
dc8af42e | 143 | void AliFMD::AddDigit (Int_t * digits) |
b9a2d5e4 | 144 | { |
145 | // add a real digit - as coming from data | |
146 | ||
b9a2d5e4 | 147 | |
dc8af42e | 148 | TClonesArray & ldigits = *fDigits; |
149 | new (ldigits[fNdigits++]) AliFMDdigit (digits); | |
b9a2d5e4 | 150 | |
151 | } | |
37c55dc0 | 152 | //_____________________________________________________________________________ |
153 | void AliFMD::AddSDigit (Int_t * digits) | |
154 | { | |
155 | // add a real digit - as coming from data | |
dc8af42e | 156 | |
37c55dc0 | 157 | TClonesArray & ldigits = *fSDigits; |
158 | new (ldigits[fNdigits++]) AliFMDdigit (digits); | |
159 | ||
160 | } | |
b9a2d5e4 | 161 | //_____________________________________________________________________________ |
dc8af42e | 162 | void AliFMD::BuildGeometry () |
fe4da5cc | 163 | { |
164 | // | |
165 | // Build simple ROOT TNode geometry for event display | |
166 | // | |
d28dcc0d | 167 | TNode *node, *top; |
37c55dc0 | 168 | const int kColorFMD = 5; |
fe4da5cc | 169 | // |
dc8af42e | 170 | top = gAlice->GetGeometry ()->GetNode ("alice"); |
fe4da5cc | 171 | |
172 | // FMD define the different volumes | |
dc8af42e | 173 | new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0); |
174 | ||
4110645f | 175 | new TTUBE ("S_FMD0", "FMD volume 0", "void", 4.2, 17.2, 1.5); |
dc8af42e | 176 | top->cd (); |
37c55dc0 | 177 | node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, ""); |
dc8af42e | 178 | node->SetLineColor (kColorFMD); |
179 | fNodes->Add (node); | |
180 | ||
4110645f | 181 | new TTUBE ("S_FMD1", "FMD volume 1", "void", 15.4, 28.4, 1.5); |
dc8af42e | 182 | top->cd (); |
4110645f | 183 | node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.2, ""); |
dc8af42e | 184 | node->SetLineColor (kColorFMD); |
185 | fNodes->Add (node); | |
186 | ||
4110645f | 187 | new TTUBE ("S_FMD2", "FMD volume 2", "void", 4.2, 17.2, 1.5); |
dc8af42e | 188 | top->cd (); |
4110645f | 189 | node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -83.2, ""); |
dc8af42e | 190 | node->SetLineColor (kColorFMD); |
191 | fNodes->Add (node); | |
192 | ||
4110645f | 193 | new TTUBE ("S_FMD3", "FMD volume 3", "void", 15.4, 28.4, 1.5); |
dc8af42e | 194 | top->cd (); |
4110645f | 195 | node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.2, ""); |
dc8af42e | 196 | node->SetLineColor (kColorFMD); |
197 | fNodes->Add (node); | |
198 | ||
4110645f | 199 | new TTUBE ("S_FMD4", "FMD volume 4", "void", 4.2, 17.2, 1.5); |
dc8af42e | 200 | top->cd (); |
201 | // node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,""); | |
4110645f | 202 | node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -340, ""); |
dc8af42e | 203 | node->SetLineColor (kColorFMD); |
204 | fNodes->Add (node); | |
fe4da5cc | 205 | } |
dc8af42e | 206 | |
fe4da5cc | 207 | //_____________________________________________________________________________ |
dc8af42e | 208 | Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py) |
fe4da5cc | 209 | { |
210 | // | |
211 | // Calculate the distance from the mouse to the FMD on the screen | |
212 | // Dummy routine | |
213 | // | |
214 | return 9999; | |
215 | } | |
dc8af42e | 216 | |
b9a2d5e4 | 217 | //___________________________________________ |
dc8af42e | 218 | void AliFMD::ResetHits () |
b9a2d5e4 | 219 | { |
220 | // Reset number of clusters and the cluster array for this detector | |
dc8af42e | 221 | AliDetector::ResetHits (); |
b9a2d5e4 | 222 | } |
223 | ||
224 | //____________________________________________ | |
dc8af42e | 225 | void AliFMD::ResetDigits () |
b9a2d5e4 | 226 | { |
dc8af42e | 227 | // |
228 | // Reset number of digits and the digits array for this detector | |
37c55dc0 | 229 | AliDetector::ResetDigits (); |
dc8af42e | 230 | // |
b9a2d5e4 | 231 | } |
fe4da5cc | 232 | |
d28dcc0d | 233 | //------------------------------------------------------------------------- |
cb1df35e | 234 | |
dc8af42e | 235 | void AliFMD::Init () |
fe4da5cc | 236 | { |
237 | // | |
238 | // Initialis the FMD after it has been built | |
239 | Int_t i; | |
240 | // | |
dc8af42e | 241 | if (fDebug) |
242 | { | |
243 | printf ("\n%s: ", ClassName ()); | |
244 | for (i = 0; i < 35; i++) | |
245 | printf ("*"); | |
246 | printf (" FMD_INIT "); | |
247 | for (i = 0; i < 35; i++) | |
248 | printf ("*"); | |
249 | printf ("\n%s: ", ClassName ()); | |
250 | // | |
251 | // Here the FMD initialisation code (if any!) | |
252 | for (i = 0; i < 80; i++) | |
253 | printf ("*"); | |
254 | printf ("\n"); | |
255 | } | |
b9a2d5e4 | 256 | // |
257 | // | |
5d02ea6f | 258 | fIdSens1 = gMC->VolId ("GRN1"); //Si sensetive volume |
259 | fIdSens2 = gMC->VolId ("GRN2"); //Si sensetive volume | |
260 | fIdSens3 = gMC->VolId ("GRN3"); //Si sensetive volume | |
261 | fIdSens4 = gMC->VolId ("GRN4"); //Si sensetive volume | |
cb1df35e | 262 | fIdSens5 = gMC->VolId ("GRN5"); //Si sensetive volume |
d28dcc0d | 263 | |
fe4da5cc | 264 | } |
cb1df35e | 265 | |
d28dcc0d | 266 | //--------------------------------------------------------------------- |
dc8af42e | 267 | void AliFMD::MakeBranch (Option_t * option, const char *file) |
d28dcc0d | 268 | { |
269 | // Create Tree branches for the FMD. | |
d28dcc0d | 270 | char branchname[10]; |
dc8af42e | 271 | const Int_t kBufferSize = 16000; |
272 | sprintf (branchname, "%s", GetName ()); | |
273 | ||
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"); | |
278 | ||
279 | if (cS){ | |
fe4da5cc | 280 | |
dc8af42e | 281 | MakeBranchInTree(gAlice->TreeS(), |
282 | branchname,&fSDigits, | |
283 | kBufferSize, file); | |
284 | } | |
285 | if (cD){ | |
b9a2d5e4 | 286 | |
9e1a0ddb | 287 | MakeBranchInTree(gAlice->TreeD(), |
dc8af42e | 288 | branchname,&fDigits, |
289 | kBufferSize, file); | |
4110645f | 290 | cout<<" tree "<<gAlice->TreeD()<<" "<<branchname<<" "<<&fDigits<<endl; |
dc8af42e | 291 | } |
292 | if (cR){ | |
293 | MakeBranchInTree(gAlice->TreeR(), | |
294 | branchname,&fReconParticles, | |
295 | kBufferSize, file); | |
d28dcc0d | 296 | } |
dc8af42e | 297 | |
d28dcc0d | 298 | } |
dc8af42e | 299 | |
b9a2d5e4 | 300 | //_____________________________________________________________________________ |
dc8af42e | 301 | void AliFMD::SetTreeAddress () |
b9a2d5e4 | 302 | { |
303 | // Set branch address for the Hits and Digits Tree. | |
304 | char branchname[30]; | |
dc8af42e | 305 | AliDetector::SetTreeAddress (); |
b9a2d5e4 | 306 | |
307 | TBranch *branch; | |
dc8af42e | 308 | TTree *treeD = gAlice->TreeD (); |
b9a2d5e4 | 309 | |
310 | ||
dc8af42e | 311 | if (treeD) |
312 | { | |
313 | if (fDigits) | |
314 | { | |
315 | branch = treeD->GetBranch (branchname); | |
316 | if (branch) | |
317 | branch->SetAddress (&fDigits); | |
318 | } | |
b9a2d5e4 | 319 | |
dc8af42e | 320 | } |
321 | if (fSDigits) | |
37c55dc0 | 322 | // fSDigits->Clear (); |
dc8af42e | 323 | |
324 | if (gAlice->TreeS () && fSDigits) | |
325 | { | |
326 | branch = gAlice->TreeS ()->GetBranch ("FMD"); | |
327 | if (branch) | |
328 | branch->SetAddress (&fSDigits); | |
329 | } | |
b9a2d5e4 | 330 | |
37c55dc0 | 331 | if (gAlice->TreeR() && fReconParticles) |
dc8af42e | 332 | { |
333 | branch = gAlice->TreeR()->GetBranch("FMD"); | |
334 | if (branch) branch->SetAddress(&fReconParticles) ; | |
37c55dc0 | 335 | } |
b9a2d5e4 | 336 | } |
337 | ||
37c55dc0 | 338 | //--------------------------------------------------------------------- |
c45743f9 | 339 | |
99a0f629 | 340 | void AliFMD::SetRingsSi1(Int_t ringsSi1) |
37c55dc0 | 341 | { |
c45743f9 | 342 | // fRingsSi1=ringsSi1; |
cb1df35e | 343 | fRingsSi1=768; |
37c55dc0 | 344 | } |
99a0f629 | 345 | void AliFMD::SetSectorsSi1(Int_t sectorsSi1) |
37c55dc0 | 346 | { |
c45743f9 | 347 | fSectorsSi1=20; |
37c55dc0 | 348 | } |
99a0f629 | 349 | void AliFMD::SetRingsSi2(Int_t ringsSi2) |
37c55dc0 | 350 | { |
cb1df35e | 351 | fRingsSi2=384; |
37c55dc0 | 352 | } |
99a0f629 | 353 | void AliFMD::SetSectorsSi2(Int_t sectorsSi2) |
37c55dc0 | 354 | { |
c45743f9 | 355 | fSectorsSi2=40; |
37c55dc0 | 356 | } |
c45743f9 | 357 | |
b9a2d5e4 | 358 | //--------------------------------------------------------------------- |
4110645f | 359 | /* |
b9a2d5e4 | 360 | void AliFMD::SDigits2Digits() |
361 | { | |
dc8af42e | 362 | cout<<"AliFMD::SDigits2Digits"<<endl; |
cccf369e | 363 | if (!fMerger) { |
364 | fMerger = new AliFMDMerger(); | |
365 | } | |
4110645f | 366 | |
cccf369e | 367 | fMerger ->SetRingsSi1(fRingsSi1); |
368 | fMerger->SetRingsSi2(fRingsSi2); | |
369 | fMerger ->SetSectorsSi1(fSectorsSi1); | |
370 | fMerger ->SetSectorsSi2(fSectorsSi2); | |
4110645f | 371 | |
cccf369e | 372 | fMerger->Init(); |
373 | cout<<"AliFMD::SDigits2Digits Init"<<endl; | |
374 | fMerger->Digitise(); | |
375 | cout<<"AliFMD::SDigits2Digits Digitise() "<<endl; | |
c45743f9 | 376 | |
b9a2d5e4 | 377 | |
4110645f | 378 | } |
379 | ||
380 | //--------------------------------------------------------------------- | |
dc8af42e | 381 | void AliFMD::SetMerger(AliFMDMerger* merger) |
382 | { | |
383 | // Set pointer to merger | |
384 | fMerger = merger; | |
385 | } | |
386 | ||
387 | AliFMDMerger* AliFMD::Merger() | |
388 | { | |
389 | // Return pointer to merger | |
390 | return fMerger; | |
391 | } | |
4110645f | 392 | */ |
d28dcc0d | 393 | //--------------------------------------------------------------------- |
394 | ||
b9a2d5e4 | 395 | |
396 | ||
dc8af42e | 397 | void |
398 | AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius) | |
fe4da5cc | 399 | { |
dc8af42e | 400 | Float_t expEta = TMath::Exp (-eta); |
401 | Float_t theta = TMath::ATan (expEta); | |
402 | theta = 2. * theta; | |
403 | Float_t rad = zDisk * (TMath::Tan (theta)); | |
404 | *radius = rad; | |
405 | ||
406 | if (fDebug) | |
407 | printf ("%s: eta %f radius %f\n", ClassName (), eta, rad); | |
fe4da5cc | 408 | } |
d28dcc0d | 409 | |
b9a2d5e4 | 410 | //--------------------------------------------------------------------- |
411 | ||
dc8af42e | 412 | void AliFMD::Hits2SDigits () |
413 | { | |
414 | ||
37c55dc0 | 415 | //#ifdef DEBUG |
416 | cout<<"ALiFMD::Hits2SDigits> start...\n"; | |
417 | //#endif | |
418 | ||
4110645f | 419 | char * fileSDigits = "FMD.SDigits.root"; |
37c55dc0 | 420 | char * fileHeader = 0; |
421 | AliFMDSDigitizer * sd = new AliFMDSDigitizer(fileHeader,fileSDigits) ; | |
422 | sd->SetRingsSi1(fRingsSi1); | |
423 | sd->SetRingsSi2(fRingsSi2); | |
424 | sd->SetSectorsSi1(fSectorsSi1); | |
425 | sd->SetSectorsSi2(fSectorsSi2); | |
4110645f | 426 | // sd->SetEventNumber(fEvNrSig); |
37c55dc0 | 427 | sd->Exec("") ; |
4110645f | 428 | |
37c55dc0 | 429 | delete sd ; |
430 | ||
dc8af42e | 431 | } |
432 | //----------------------------------------------------------------------- | |
433 | ||
434 | void AliFMD::Digits2Reco() | |
435 | { | |
dc8af42e | 436 | char * fileReconParticles=0; |
437 | char * fileHeader=0; | |
438 | AliFMDReconstruction * reconstruction = | |
439 | new AliFMDReconstruction(fileHeader,fileReconParticles) ; | |
37c55dc0 | 440 | reconstruction->Exec(""); |
dc8af42e | 441 | delete reconstruction; |
442 | } | |
4110645f | 443 | //----------------------------------------------------------------------- |
444 | ||
445 | void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file) | |
446 | { | |
447 | // | |
448 | // Create TreeD branches for the MUON. | |
449 | // | |
b9a2d5e4 | 450 | |
4110645f | 451 | const Int_t kBufferSize = 4000; |
452 | char branchname[20]; | |
453 | ||
454 | ||
455 | sprintf(branchname,"%s",GetName()); | |
456 | if(treeD){ | |
457 | MakeBranchInTree(treeD, | |
458 | branchname,&fDigits, | |
459 | kBufferSize, file); | |
460 | } | |
461 | } | |
37c55dc0 | 462 |