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 **************************************************************************/
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Sun Mar 26 17:59:18 2006
19 @brief Implementation of AliFMD base class
21 //____________________________________________________________________
23 // Forward Multiplicity Detector based on Silicon wafers. This class
24 // is the driver for especially simulation.
26 // The Forward Multiplicity Detector consists of 3 sub-detectors FMD1,
27 // FMD2, and FMD3, each of which has 1 or 2 rings of silicon sensors.
29 // This is the base class for all FMD manager classes.
31 // The actual code is done by various separate classes. Below is
32 // diagram showing the relationship between the various FMD classes
33 // that handles the simulation
36 // +----------+ +----------+
37 // | AliFMDv1 | | AliFMDv0 |
38 // +----------+ +----------+
39 // | | +-----------------+
40 // +----+--------------+ +--| AliFMDDigitizer |
41 // | | +-----------------+
42 // | +---------------------+ |
43 // | +--| AliFMDBaseDigitizer |<--+
44 // V 1 | +---------------------+ |
45 // +--------+<>--+ | +------------------+
46 // | AliFMD | +--| AliFMDSDigitizer |
47 // +--------+<>--+ +------------------+
48 // 1 | +---------------------+
49 // +--| AliFMDReconstructor |
50 // +---------------------+
53 // This defines the interface for the various parts of AliROOT that
54 // uses the FMD, like AliFMDSimulator, AliFMDDigitizer,
55 // AliFMDReconstructor, and so on.
58 // This is a concrete implementation of the AliFMD interface.
59 // It is the responsibility of this class to create the FMD
63 // This is a concrete implementation of the AliFMD interface.
64 // It is the responsibility of this class to create the FMD
65 // geometry, process hits in the FMD, and serve hits and digits to
66 // the various clients.
69 // This is the base class for the FMD simulation tasks. The
70 // simulator tasks are responsible to implment the geoemtry, and
73 // * AliFMDReconstructor
74 // This is a concrete implementation of the AliReconstructor that
75 // reconstructs pseudo-inclusive-multiplicities from digits (raw or
78 // Calibration and geometry parameters are managed by separate
79 // singleton managers. These are AliFMDGeometry and
80 // AliFMDParameters. Please refer to these classes for more
81 // information on these.
84 // These files are not in the same directory, so there's no reason to
85 // ask the preprocessor to search in the current directory for these
86 // files by including them with `#include "..."'
87 #include <math.h> // __CMATH__
88 #include <TClonesArray.h> // ROOT_TClonesArray
89 #include <TGeometry.h> // ROOT_TGeomtry
90 #include <TNode.h> // ROOT_TNode
91 #include <TXTRU.h> // ROOT_TXTRU
92 #include <TRotMatrix.h> // ROOT_TRotMatrix
93 #include <TTUBE.h> // ROOT_TTUBE
94 #include <TTree.h> // ROOT_TTree
95 #include <TBrowser.h> // ROOT_TBrowser
96 #include <TMath.h> // ROOT_TMath
97 #include <TVirtualMC.h> // ROOT_TVirtualMC
100 #include <TMarker3DBox.h>
102 #include <AliRunDigitizer.h> // ALIRUNDIGITIZER_H
103 #include <AliLoader.h> // ALILOADER_H
104 #include <AliRun.h> // ALIRUN_H
105 #include <AliMC.h> // ALIMC_H
106 #include "AliMagF.h" // ALIMAGF_H
107 #include <AliLog.h> // ALILOG_H
108 #include "AliFMD.h" // ALIFMD_H
109 #include "AliFMDDigit.h" // ALIFMDDIGIG_H
110 #include "AliFMDHit.h" // ALIFMDHIT_H
111 #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H
112 #include "AliFMDDetector.h" // ALIFMDDETECTOR_H
113 #include "AliFMDRing.h" // ALIFMDRING_H
114 #include "AliFMDDigitizer.h" // ALIFMDDIGITIZER_H
115 #include "AliPoints.h" // ALIPOINTS_H
116 #include "AliFMDGeometryBuilder.h"
117 #include "AliFMDRawWriter.h" // ALIFMDRAWWRITER_H
120 class AliFMDPoints : public AliPoints
124 @param hit Hit to draw
125 @param color Color of hit */
126 AliFMDPoints(AliFMDHit* hit, UInt_t color)
127 : AliPoints(1), fMarker(0)
130 Float_t size = TMath::Min(TMath::Max(hit->Edep() * .1, .1), 1.);
131 TVector3 p(hit->Px(), hit->Py(), hit->Pz());
132 fMarker = new TMarker3DBox(hit->X(), hit->Y(), hit->Z(), size, size, size,
134 fMarker->SetLineColor(color);
135 fMarker->SetRefObject(this);
143 // if (fMarker) delete fMarker;
145 void SetXYZ(Double_t x, Double_t y, Double_t z)
147 if (fMarker) fMarker->SetPosition(x, y, z);
149 Int_t DistancetoPrimitive(Int_t px, Int_t py)
151 return fMarker->DistancetoPrimitive(px, py);
153 void Draw(Option_t* option)
155 if (fMarker) fMarker->Draw(option);
157 void Paint(Option_t* option)
159 if (fMarker) fMarker->Paint(option);
161 void SetMarkerColor(Color_t colour)
163 if (fMarker) fMarker->SetLineColor(colour);
166 TMarker3DBox* fMarker;
170 //____________________________________________________________________
173 ; // This is to keep Emacs from indenting the next line
176 //____________________________________________________________________
185 // Default constructor for class AliFMD
187 AliDebug(10, "\tDefault CTOR");
192 fUseAssembly = kTRUE;
193 fBad = new TClonesArray("AliFMDHit");
196 //____________________________________________________________________
197 AliFMD::AliFMD(const AliFMD& other)
198 : AliDetector(other),
199 fSDigits(other.fSDigits),
200 fNsdigits(other.fNsdigits),
201 fDetailed(other.fDetailed),
205 fUseOld = other.fUseOld;
206 fUseAssembly = other.fUseAssembly;
209 //____________________________________________________________________
210 AliFMD::AliFMD(const char *name, const char *title)
211 : AliDetector (name, title),
218 // Standard constructor for Forward Multiplicity Detector
220 AliDebug(10, "\tStandard CTOR");
222 fUseAssembly = kFALSE;
223 fBad = new TClonesArray("AliFMDHit");
225 // Initialise Hit array
227 gAlice->GetMCApp()->AddHitList(fHits);
229 // (S)Digits for the detectors disk
233 // CHC: What is this?
235 SetMarkerColor(kRed);
236 SetLineColor(kYellow);
239 //____________________________________________________________________
242 // Destructor for base class AliFMD
265 //____________________________________________________________________
267 AliFMD::operator=(const AliFMD& other)
269 // Assignment operator
270 AliDetector::operator=(other);
271 fSDigits = other.fSDigits;
272 fNsdigits = other.fNsdigits;
273 fDetailed = other.fDetailed;
278 //====================================================================
280 // GEometry ANd Traking
282 //____________________________________________________________________
284 AliFMD::CreateGeometry()
287 // Create the geometry of Forward Multiplicity Detector. The actual
288 // construction of the geometry is delegated to the class
289 // AliFMDGeometryBuilder, invoked by the singleton manager
292 AliFMDGeometry* fmd = AliFMDGeometry::Instance();
293 fmd->SetDetailed(fDetailed);
294 fmd->UseAssembly(fUseAssembly);
298 //____________________________________________________________________
299 void AliFMD::CreateMaterials()
301 // Define the materials and tracking mediums needed by the FMD
302 // simulation. These mediums are made by sending the messages
303 // AliMaterial, AliMixture, and AliMedium to the passed AliModule
304 // object module. The defined mediums are
306 // FMD Si$ Silicon (active medium in sensors)
307 // FMD C$ Carbon fibre (support cone for FMD3 and vacuum pipe)
308 // FMD Al$ Aluminium (honeycomb support plates)
309 // FMD PCB$ Printed Circuit Board (FEE board with VA1_3)
310 // FMD Chip$ Electronics chips (currently not used)
311 // FMD Air$ Air (Air in the FMD)
312 // FMD Plastic$ Plastic (Support legs for the hybrid cards)
314 // The geometry builder should really be the one that creates the
315 // materials, but the architecture of AliROOT makes that design
316 // akward. What should happen, was that the AliFMDGeometryBuilder
317 // made the mediums, and that this class retrives pointers from the
318 // TGeoManager, and registers the mediums here. Alas, it's not
321 AliDebug(10, "\tCreating materials");
322 // Get pointer to geometry singleton object.
323 AliFMDGeometry* geometry = AliFMDGeometry::Instance();
326 if (gGeoManager && gGeoManager->GetMedium("FMD Si$")) {
327 // We need to figure out the some stuff about the geometry
328 fmd->ExtractGeomInfo();
335 Double_t density = 0;
336 Double_t radiationLength = 0;
337 Double_t absorbtionLength = 999;
338 Int_t fieldType = gAlice->Field()->Integ(); // Field type
339 Double_t maxField = gAlice->Field()->Max(); // Field max.
340 Double_t maxBending = 0; // Max Angle
341 Double_t maxStepSize = 0.001; // Max step size
342 Double_t maxEnergyLoss = 1; // Max Delta E
343 Double_t precision = 0.001; // Precision
344 Double_t minStepSize = 0.001; // Minimum step size
349 density = geometry->GetSiDensity();
350 radiationLength = 9.36;
356 AliMaterial(id, "Si$", a, z, density, radiationLength, absorbtionLength);
357 AliMedium(kSiId, "Si$", id,1,fieldType,maxField,maxBending,
358 maxStepSize,maxEnergyLoss,precision,minStepSize);
365 radiationLength = 18.8;
371 AliMaterial(id, "Carbon$", a, z, density, radiationLength, absorbtionLength);
372 AliMedium(kCarbonId, "Carbon$", id,0,fieldType,maxField,maxBending,
373 maxStepSize,maxEnergyLoss,precision,minStepSize);
379 radiationLength = 8.9;
381 AliMaterial(id, "Aluminum$",a,z, density, radiationLength, absorbtionLength);
382 AliMedium(kAlId, "Aluminum$", id, 0, fieldType, maxField, maxBending,
383 maxStepSize, maxEnergyLoss, precision, minStepSize);
390 radiationLength = 1.43;
392 AliMaterial(id, "Copper$",
393 a, z, density, radiationLength, absorbtionLength);
394 AliMedium(kCopperId, "Copper$", id, 0, fieldType, maxField, maxBending,
395 maxStepSize, maxEnergyLoss, precision, minStepSize);
400 Float_t as[] = { 12.0107, 14.0067, 15.9994,
401 1.00794, 28.0855, 107.8682 };
402 Float_t zs[] = { 6., 7., 8.,
404 Float_t ws[] = { 0.039730642, 0.001396798, 0.01169634,
405 0.004367771, 0.844665, 0.09814344903 };
412 AliMixture(id, "Si Chip$", as, zs, density, 6, ws);
413 AliMedium(kSiChipId, "Si Chip$", id, 0, fieldType, maxField, maxBending,
414 maxStepSize, maxEnergyLoss, precision, minStepSize);
419 Float_t as[] = { 1.00794, 12.0107, 14.010, 15.9994};
420 Float_t zs[] = { 1., 6., 7., 8.};
421 Float_t ws[] = { 0.026362, 0.69113, 0.07327, 0.209235};
428 AliMixture(id, "Kaption$", as, zs, density, 4, ws);
429 AliMedium(kKaptonId, "Kaption$", id,0,fieldType,maxField,maxBending,
430 maxStepSize,maxEnergyLoss,precision,minStepSize);
435 Float_t as[] = { 12.0107, 14.0067, 15.9994, 39.948 };
436 Float_t zs[] = { 6., 7., 8., 18. };
437 Float_t ws[] = { 0.000124, 0.755267, 0.231781, 0.012827 };
444 AliMixture(id, "Air$", as, zs, density, 4, ws);
445 AliMedium(kAirId, "Air$", id,0,fieldType,maxField,maxBending,
446 maxStepSize,maxEnergyLoss,precision,minStepSize);
451 Float_t zs[] = { 14., 20., 13., 12.,
455 Float_t as[] = { 28.0855, 40.078, 26.981538, 24.305,
456 10.811, 47.867, 22.98977, 39.0983,
457 55.845, 18.9984, 15.9994, 12.0107,
459 Float_t ws[] = { 0.15144894, 0.08147477, 0.04128158, 0.00904554,
460 0.01397570, 0.00287685, 0.00445114, 0.00498089,
461 0.00209828, 0.00420000, 0.36043788, 0.27529426,
462 0.01415852, 0.03427566};
469 AliMixture(id, "PCB$", as, zs, density, 14, ws);
470 AliMedium(kPcbId, "PCB$", id,0,fieldType,maxField,maxBending,
471 maxStepSize,maxEnergyLoss,precision,minStepSize);
476 Float_t as[] = { 1.01, 12.01 };
477 Float_t zs[] = { 1., 6. };
478 Float_t ws[] = { 1., 1. };
485 AliMixture(id, "Plastic$", as, zs, density, -2, ws);
486 AliMedium(kPlasticId, "Plastic$", id,0,fieldType,maxField,maxBending,
487 maxStepSize,maxEnergyLoss,precision,minStepSize);
491 //____________________________________________________________________
495 // Initialize the detector
497 AliDebug(1, "Initialising FMD detector object");
498 // AliFMDGeometry* fmd = AliFMDGeometry::Instance();
499 // fmd->InitTransformations();
502 //____________________________________________________________________
504 AliFMD::FinishEvent()
506 // Called at the end of the an event in simulations. If the debug
507 // level is high enough, then the `bad' hits are printed.
509 if (AliLog::GetDebugLevel("FMD", "AliFMD") < 10) return;
510 if (fBad && fBad->GetEntries() > 0) {
511 AliWarning((Form("EndEvent", "got %d 'bad' hits", fBad->GetEntries())));
514 while ((hit = static_cast<AliFMDHit*>(next()))) hit->Print("D");
520 //====================================================================
522 // Graphics and event display
524 //____________________________________________________________________
526 AliFMD::BuildGeometry()
529 // Build simple ROOT TNode geometry for event display. With the new
530 // geometry modeller, TGeoManager, this seems rather redundant.
531 AliDebug(10, "\tCreating a simplified geometry");
533 AliFMDGeometry* fmd = AliFMDGeometry::Instance();
535 static TXTRU* innerShape = 0;
536 static TXTRU* outerShape = 0;
537 static TObjArray* innerRot = 0;
538 static TObjArray* outerRot = 0;
540 if (!innerShape || !outerShape) {
541 // Make the shapes for the modules
542 for (Int_t i = 0; i < 2; i++) {
545 case 0: r = fmd->GetRing('I'); break;
546 case 1: r = fmd->GetRing('O'); break;
549 AliError(Form("no ring found for i=%d", i));
552 Double_t siThick = r->GetSiThickness();
553 const Int_t nv = r->GetNVerticies();
554 Double_t theta = r->GetTheta();
555 Int_t nmod = r->GetNModules();
557 TXTRU* shape = new TXTRU(r->GetName(), r->GetTitle(), "void", nv, 2);
558 for (Int_t j = 0; j < nv; j++) {
559 TVector2* vv = r->GetVertex(nv - 1 - j);
560 shape->DefineVertex(j, vv->X(), vv->Y());
562 shape->DefineSection(0, -siThick / 2, 1, 0, 0);
563 shape->DefineSection(1, +siThick / 2, 1, 0, 0);
564 shape->SetLineColor(GetLineColor());
566 TObjArray* rots = new TObjArray(nmod);
567 for (Int_t j = 0; j < nmod; j++) {
568 Double_t th = (j + .5) * theta * 2;
569 TString name(Form("FMD_ring_%c_rot_%02d", r->GetId(), j));
570 TString title(Form("FMD Ring %c Rotation # %d", r->GetId(), j));
571 TRotMatrix* rot = new TRotMatrix(name.Data(), title.Data(),
572 90, th, 90, fmod(90+th,360), 0, 0);
576 switch (r->GetId()) {
578 case 'I': innerShape = shape; innerRot = rots; break;
580 case 'O': outerShape = shape; outerRot = rots; break;
585 TNode* top = gAlice->GetGeometry()->GetNode("alice");
587 for (Int_t i = 1; i <= 3; i++) {
588 AliFMDDetector* det = fmd->GetDetector(i);
590 Warning("BuildGeometry", "FMD%d seems to be disabled", i);
594 Double_t rh = det->GetRing('I')->GetHighR();
596 if (det->GetRing('O')) {
597 w = TMath::Abs(det->GetRingZ('O') - det->GetRingZ('I'));
598 id = (TMath::Abs(det->GetRingZ('O'))
599 > TMath::Abs(det->GetRingZ('I')) ? 'O' : 'I');
600 rh = det->GetRing('O')->GetHighR();
602 w += (det->GetRing(id)->GetModuleSpacing() +
603 det->GetRing(id)->GetSiThickness());
604 TShape* shape = new TTUBE(det->GetName(), det->GetTitle(), "void",
605 det->GetRing('I')->GetLowR(), rh, w / 2);
606 Double_t z = (det->GetRingZ('I') - w / 2);
607 if (z > 0) z += det->GetRing(id)->GetModuleSpacing();
609 TNode* node = new TNode(det->GetName(), det->GetTitle(), shape,
613 for (Int_t j = 0; j < 2; j++) {
619 r = det->GetRing('I'); rshape = innerShape; rots = innerRot; break;
621 r = det->GetRing('O'); rshape = outerShape; rots = outerRot; break;
625 Double_t siThick = r->GetSiThickness();
626 Int_t nmod = r->GetNModules();
627 Double_t modspace = r->GetModuleSpacing();
628 Double_t rz = - (z - det->GetRingZ(r->GetId()));
630 for (Int_t k = 0; k < nmod; k++) {
632 Double_t offz = (k % 2 == 1 ? modspace : 0);
633 TRotMatrix* rot = static_cast<TRotMatrix*>(rots->At(k));
634 TString name(Form("%s%c_module_%02d", det->GetName(), r->GetId(),k));
635 TString title(Form("%s%c Module %d", det->GetName(), r->GetId(),k));
636 TNode* mnod = new TNode(name.Data(), title.Data(), rshape,
637 0, 0, rz - siThick / 2
638 + TMath::Sign(offz,z), rot);
639 mnod->SetLineColor(GetLineColor());
641 } // for (Int_t k = 0 ; ...)
642 } // for (Int_t j = 0 ; ...)
643 } // for (Int_t i = 1 ; ...)
646 //____________________________________________________________________
648 AliFMD::LoadPoints(Int_t /* track */)
650 // Store x, y, z of all hits in memory for display.
652 // Normally, the hits are drawn using TPolyMarker3D - however, that
653 // is not very useful for the FMD. Therefor, this member function
654 // is overloaded to make TMarker3D, via the class AliFMDPoints.
655 // AliFMDPoints is a local class.
658 AliError(Form("fHits == 0. Name is %s",GetName()));
661 Int_t nHits = fHits->GetEntriesFast();
665 Int_t tracks = gAlice->GetMCApp()->GetNtrack();
666 if (fPoints == 0) fPoints = new TObjArray(2 * tracks);
669 AliFMDGeometry* geom = AliFMDGeometry::Instance();
671 geom->InitTransformations();
673 // Now make markers for each hit
674 // AliInfo(Form("Drawing %d hits (have %d points) for track %d",
675 // nHits, fPoints->GetEntriesFast(), track));
676 for (Int_t ihit = 0; ihit < nHits; ihit++) {
677 AliFMDHit* hit = static_cast<AliFMDHit*>(fHits->At(ihit));
679 Double_t edep = hit->Edep();
680 Double_t m = hit->M();
681 Double_t poverm = (m == 0 ? 0 : hit->P());
682 Double_t absQ = TMath::Abs(hit->Q());
684 // This `if' is to debug abnormal energy depositions. We trigger on
685 // p/m approx larger than or equal to a MIP, and a large edep - more
686 // than 1 keV - a MIP is 100 eV.
687 if (edep > absQ * absQ && poverm > 1) bad = kTRUE;
689 AliFMDPoints* p1 = new AliFMDPoints(hit, GetMarkerColor());
690 // AliPoints* p1 = new AliPoints();
691 // p1->SetMarkerColor(GetMarkerColor());
692 // p1->SetMarkerSize(GetMarkerSize());
693 // p1->SetPoint(0, hit->X(), hit->Y(), hit->Z());
694 p1->SetDetector(this);
695 p1->SetParticle(hit->GetTrack());
696 fPoints->AddAt(p1, hit->GetTrack());
698 p1->SetMarkerColor(4);
699 // p1->SetMarkerSize(2 * GetMarkerSize());
703 geom->Detector2XYZ(hit->Detector(), hit->Ring(), hit->Sector(),
704 hit->Strip(), x, y, z);
705 AliFMDPoints* p = new AliFMDPoints(hit, 3);
706 // AliPoints* p = new AliPoints();
707 // p->SetMarkerColor(3);
708 // p->SetMarkerSize(GetMarkerSize());
709 // p->SetPoint(0, x, y, z);
710 p->SetDetector(this);
711 p->SetParticle(hit->GetTrack());
713 p->SetMarkerColor(3);
714 fPoints->AddAt(p, tracks+hit->GetTrack());
716 p->SetMarkerColor(5);
717 // p->SetMarkerSize(2 * GetMarkerSize());
719 // AliInfo(Form("Adding point at %d", tracks+hit->GetTrack()));
723 //____________________________________________________________________
725 AliFMD::DrawDetector()
727 // Draw a shaded view of the Forward multiplicity detector. This
728 // isn't really useful anymore.
729 AliDebug(10, "\tDraw detector");
732 //____________________________________________________________________
734 AliFMD::DistanceToPrimitive(Int_t, Int_t)
736 // Calculate the distance from the mouse to the FMD on the screen
742 //====================================================================
744 // Hit and Digit managment
746 //____________________________________________________________________
748 AliFMD::MakeBranch(Option_t * option)
750 // Create Tree branches for the FMD.
754 // H Make a branch of TClonesArray of AliFMDHit's
755 // D Make a branch of TClonesArray of AliFMDDigit's
756 // S Make a branch of TClonesArray of AliFMDSDigit's
758 const Int_t kBufferSize = 16000;
759 TString branchname(GetName());
762 if (opt.Contains("H", TString::kIgnoreCase)) {
764 AliDetector::MakeBranch(option);
766 if (opt.Contains("D", TString::kIgnoreCase)) {
768 MakeBranchInTree(fLoader->TreeD(), branchname.Data(),
769 &fDigits, kBufferSize, 0);
771 if (opt.Contains("S", TString::kIgnoreCase)) {
773 MakeBranchInTree(fLoader->TreeS(), branchname.Data(),
774 &fSDigits, kBufferSize, 0);
778 //____________________________________________________________________
780 AliFMD::SetTreeAddress()
782 // Set branch address for the Hits, Digits, and SDigits Tree.
783 if (fLoader->TreeH()) HitsArray();
784 AliDetector::SetTreeAddress();
786 TTree *treeD = fLoader->TreeD();
789 TBranch* branch = treeD->GetBranch ("FMD");
790 if (branch) branch->SetAddress(&fDigits);
793 TTree *treeS = fLoader->TreeS();
796 TBranch* branch = treeS->GetBranch ("FMD");
797 if (branch) branch->SetAddress(&fSDigits);
801 //____________________________________________________________________
803 AliFMD::SetHitsAddressBranch(TBranch *b)
805 // Set the TClonesArray to read hits into.
806 b->SetAddress(&fHits);
809 //____________________________________________________________________
811 AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
813 // Add a hit to the hits tree
815 // The information of the two arrays are decoded as
819 // ivol[0] [UShort_t ] Detector #
820 // ivol[1] [Char_t ] Ring ID
821 // ivol[2] [UShort_t ] Sector #
822 // ivol[3] [UShort_t ] Strip #
823 // hits[0] [Float_t ] Track's X-coordinate at hit
824 // hits[1] [Float_t ] Track's Y-coordinate at hit
825 // hits[3] [Float_t ] Track's Z-coordinate at hit
826 // hits[4] [Float_t ] X-component of track's momentum
827 // hits[5] [Float_t ] Y-component of track's momentum
828 // hits[6] [Float_t ] Z-component of track's momentum
829 // hits[7] [Float_t ] Energy deposited by track
830 // hits[8] [Int_t ] Track's particle Id #
831 // hits[9] [Float_t ] Time when the track hit
834 AddHitByFields(track,
835 UShort_t(vol[0]), // Detector #
836 Char_t(vol[1]), // Ring ID
837 UShort_t(vol[2]), // Sector #
838 UShort_t(vol[3]), // Strip #
845 hits[6], // Energy loss
846 Int_t(hits[7]), // PDG
850 //____________________________________________________________________
852 AliFMD::AddHitByFields(Int_t track,
869 // Add a hit to the list
874 // detector Detector # (1, 2, or 3)
875 // ring Ring ID ('I' or 'O')
876 // sector Sector # (For inner/outer rings: 0-19/0-39)
877 // strip Strip # (For inner/outer rings: 0-511/0-255)
878 // x Track's X-coordinate at hit
879 // y Track's Y-coordinate at hit
880 // z Track's Z-coordinate at hit
881 // px X-component of track's momentum
882 // py Y-component of track's momentum
883 // pz Z-component of track's momentum
884 // edep Energy deposited by track
885 // pdg Track's particle Id #
886 // t Time when the track hit
887 // l Track length through the material.
888 // stop Whether track was stopped or disappeared
890 TClonesArray& a = *(HitsArray());
891 // Search through the list of already registered hits, and see if we
892 // find a hit with the same parameters. If we do, then don't create
893 // a new hit, but rather update the energy deposited in the hit.
894 // This is done, so that a FLUKA based simulation will get the
895 // number of hits right, not just the enerrgy deposition.
897 for (Int_t i = 0; i < fNhits; i++) {
898 if (!a.At(i)) continue;
899 hit = static_cast<AliFMDHit*>(a.At(i));
900 if (hit->Detector() == detector
901 && hit->Ring() == ring
902 && hit->Sector() == sector
903 && hit->Strip() == strip
904 && hit->Track() == track) {
905 AliDebug(1, Form("already had a hit in FMD%d%c[%2d,%3d] for track # %d,"
906 " adding energy (%f) to that hit (%f) -> %f",
907 detector, ring, sector, strip, track, edep, hit->Edep(),
908 hit->Edep() + edep));
909 hit->SetEdep(hit->Edep() + edep);
913 // If hit wasn't already registered, do so know.
914 hit = new (a[fNhits]) AliFMDHit(fIshunt, track, detector, ring, sector,
915 strip, x, y, z, px, py, pz, edep, pdg, t,
921 //____________________________________________________________________
923 AliFMD::AddDigit(Int_t* digits, Int_t*)
925 // Add a digit to the Digit tree
929 // digits[0] [UShort_t] Detector #
930 // digits[1] [Char_t] Ring ID
931 // digits[2] [UShort_t] Sector #
932 // digits[3] [UShort_t] Strip #
933 // digits[4] [UShort_t] ADC Count
934 // digits[5] [Short_t] ADC Count, -1 if not used
935 // digits[6] [Short_t] ADC Count, -1 if not used
937 AddDigitByFields(UShort_t(digits[0]), // Detector #
938 Char_t(digits[1]), // Ring ID
939 UShort_t(digits[2]), // Sector #
940 UShort_t(digits[3]), // Strip #
941 UShort_t(digits[4]), // ADC Count1
942 Short_t(digits[5]), // ADC Count2
943 Short_t(digits[6])); // ADC Count3
946 //____________________________________________________________________
948 AliFMD::AddDigitByFields(UShort_t detector,
956 // add a real digit - as coming from data
960 // detector Detector # (1, 2, or 3)
961 // ring Ring ID ('I' or 'O')
962 // sector Sector # (For inner/outer rings: 0-19/0-39)
963 // strip Strip # (For inner/outer rings: 0-511/0-255)
964 // count1 ADC count (a 10-bit word)
965 // count2 ADC count (a 10-bit word), or -1 if not used
966 // count3 ADC count (a 10-bit word), or -1 if not used
967 TClonesArray& a = *(DigitsArray());
970 AliFMDDigit(detector, ring, sector, strip, count1, count2, count3);
973 //____________________________________________________________________
975 AliFMD::AddSDigit(Int_t* digits)
977 // Add a digit to the SDigit tree
981 // digits[0] [UShort_t] Detector #
982 // digits[1] [Char_t] Ring ID
983 // digits[2] [UShort_t] Sector #
984 // digits[3] [UShort_t] Strip #
985 // digits[4] [Float_t] Total energy deposited
986 // digits[5] [UShort_t] ADC Count
987 // digits[6] [Short_t] ADC Count, -1 if not used
988 // digits[7] [Short_t] ADC Count, -1 if not used
990 AddSDigitByFields(UShort_t(digits[0]), // Detector #
991 Char_t(digits[1]), // Ring ID
992 UShort_t(digits[2]), // Sector #
993 UShort_t(digits[3]), // Strip #
994 Float_t(digits[4]), // Edep
995 UShort_t(digits[5]), // ADC Count1
996 Short_t(digits[6]), // ADC Count2
997 Short_t(digits[7])); // ADC Count3
1000 //____________________________________________________________________
1002 AliFMD::AddSDigitByFields(UShort_t detector,
1011 // add a summable digit
1015 // detector Detector # (1, 2, or 3)
1016 // ring Ring ID ('I' or 'O')
1017 // sector Sector # (For inner/outer rings: 0-19/0-39)
1018 // strip Strip # (For inner/outer rings: 0-511/0-255)
1019 // edep Total energy deposited
1020 // count1 ADC count (a 10-bit word)
1021 // count2 ADC count (a 10-bit word), or -1 if not used
1022 // count3 ADC count (a 10-bit word), or -1 if not used
1024 TClonesArray& a = *(SDigitsArray());
1026 new (a[fNsdigits++])
1027 AliFMDSDigit(detector, ring, sector, strip, edep, count1, count2, count3);
1030 //____________________________________________________________________
1032 AliFMD::ResetSDigits()
1034 // Reset number of digits and the digits array for this detector.
1037 if (fSDigits) fSDigits->Clear();
1041 //____________________________________________________________________
1045 // Initialize hit array if not already, and return pointer to it.
1047 fHits = new TClonesArray("AliFMDHit", 1000);
1053 //____________________________________________________________________
1055 AliFMD::DigitsArray()
1057 // Initialize digit array if not already, and return pointer to it.
1059 fDigits = new TClonesArray("AliFMDDigit", 1000);
1065 //____________________________________________________________________
1067 AliFMD::SDigitsArray()
1069 // Initialize digit array if not already, and return pointer to it.
1071 fSDigits = new TClonesArray("AliFMDSDigit", 1000);
1077 //====================================================================
1081 //____________________________________________________________________
1083 AliFMD::Hits2Digits()
1085 // Create AliFMDDigit's from AliFMDHit's. This is done by making a
1086 // AliFMDDigitizer, and executing that code.
1088 Warning("Hits2Digits", "Try not to use this method.\n"
1089 "Instead, use AliSimulator");
1090 AliRunDigitizer* manager = new AliRunDigitizer(1, 1);
1091 manager->SetInputStream(0, "galice.root");
1092 manager->SetOutputFile("H2Dfile");
1094 /* AliDigitizer* dig =*/ CreateDigitizer(manager);
1099 //____________________________________________________________________
1101 AliFMD::Hits2SDigits()
1103 // Create AliFMDSDigit's from AliFMDHit's. This is done by creating
1104 // an AliFMDSDigitizer object, and executing it.
1106 AliFMDSDigitizer* digitizer = new AliFMDSDigitizer("galice.root");
1107 digitizer->Exec("");
1112 //____________________________________________________________________
1114 AliFMD::CreateDigitizer(AliRunDigitizer* manager) const
1116 // Create a digitizer object
1117 AliFMDDigitizer* digitizer = new AliFMDDigitizer(manager);
1121 //====================================================================
1123 // Raw data simulation
1125 //__________________________________________________________________
1127 AliFMD::Digits2Raw()
1129 // Turn digits into raw data.
1131 // This uses the class AliFMDRawWriter to do the job. Please refer
1132 // to that class for more information.
1133 AliFMDRawWriter writer(this);
1138 //====================================================================
1142 //__________________________________________________________________
1144 AliFMD::Browse(TBrowser* b)
1146 // Browse this object.
1148 AliDebug(30, "\tBrowsing the FMD");
1149 AliDetector::Browse(b);
1150 b->Add(AliFMDGeometry::Instance());
1153 //___________________________________________________________________