VMC Examples Version 6.6
Loading...
Searching...
No Matches
VMC::ExGarfield::SensitiveDetector Class Reference

The calorimeter sensitive detector. More...

#include <SensitiveDetector.h>

Inheritance diagram for VMC::ExGarfield::SensitiveDetector:

Public Member Functions

 SensitiveDetector (const char *name)
 
 SensitiveDetector (const SensitiveDetector &origin)
 
 SensitiveDetector ()
 
virtual ~SensitiveDetector ()
 
void Initialize ()
 
Bool_t ProcessHits ()
 
Bool_t UpdateFromGarfield ()
 
void EndOfEvent ()
 
void Register ()
 
virtual void Print (Option_t *option="") const
 
void SetVerboseLevel (Int_t level)
 
HitGetHit () const
 Return the hits collection.
 

Private Attributes

HitfHit
 The detector hit.
 
Int_t fAbsorberVolId
 The absorber volume Id.
 
Int_t fGasVolId
 The gas volume Id.
 
Int_t fVerboseLevel
 Verbosity level.
 

Detailed Description

The calorimeter sensitive detector.

Garfield garfieldpp example adapted to Virtual Monte Carlo.

Date
28/10/2015
Author
I. Hrivnacova; IPN, Orsay

Definition at line 38 of file SensitiveDetector.h.

Constructor & Destructor Documentation

◆ SensitiveDetector() [1/3]

VMC::ExGarfield::SensitiveDetector::SensitiveDetector ( const char * name)

Standard constructor. Create hits collection.

Parameters
nameThe calorimeter hits collection name

Definition at line 39 of file SensitiveDetector.cxx.

40 : TNamed(name, ""), fHit(0), fAbsorberVolId(), fGasVolId(), fVerboseLevel(1)
41 {
42 /// Standard constructor.
43 /// Create hits collection.
44 /// \param name The calorimeter hits collection name
45
46 fHit = new Hit();
47 }
Int_t fAbsorberVolId
The absorber volume Id.

◆ SensitiveDetector() [2/3]

VMC::ExGarfield::SensitiveDetector::SensitiveDetector ( const SensitiveDetector & origin)

Copy constructor (for cloning on worker thread in MT mode). Create hits collection.

Parameters
originThe source object (on master).

Definition at line 50 of file SensitiveDetector.cxx.

51 : TNamed(origin),
52 fHit(0),
54 fGasVolId(),
55 fVerboseLevel(origin.fVerboseLevel)
56 {
57 /// Copy constructor (for cloning on worker thread in MT mode).
58 /// Create hits collection.
59 /// \param origin The source object (on master).
60
61 fHit = new Hit();
62 }

◆ SensitiveDetector() [3/3]

VMC::ExGarfield::SensitiveDetector::SensitiveDetector ( )

Default constructor

Definition at line 65 of file SensitiveDetector.cxx.

67 {
68 /// Default constructor
69 }

◆ ~SensitiveDetector()

VMC::ExGarfield::SensitiveDetector::~SensitiveDetector ( )
virtual

Destructor

Definition at line 72 of file SensitiveDetector.cxx.

73 {
74 /// Destructor
75
76 delete fHit;
77 }

Member Function Documentation

◆ Initialize()

void VMC::ExGarfield::SensitiveDetector::Initialize ( )

Register hits collection in the Root manager; set sensitive volumes.

Definition at line 84 of file SensitiveDetector.cxx.

85 {
86 /// Register hits collection in the Root manager;
87 /// set sensitive volumes.
88
89 if (TMCRootManager::Instance()) Register();
90 fAbsorberVolId = gMC->VolId("Absorber");
91 fGasVolId = gMC->VolId("Gas");
92 }

◆ ProcessHits()

Bool_t VMC::ExGarfield::SensitiveDetector::ProcessHits ( )

Account energy deposit and track lengths for each layer in its hit.

Definition at line 95 of file SensitiveDetector.cxx.

96 {
97 /// Account energy deposit and track lengths for each layer in its hit.
98
99 Int_t copyNo;
100 Int_t id = gMC->CurrentVolID(copyNo);
101
102 if (id != fAbsorberVolId && id != fGasVolId) return false;
103
104 Double_t edep = gMC->Edep();
105 Double_t step = 0.;
106 if (gMC->TrackCharge() != 0.) step = gMC->TrackStep();
107
108 if (id == fAbsorberVolId) {
109 fHit->AddEdepAbs(edep);
110 fHit->AddTrackLengthAbs(step);
111 }
112
113 if (id == fGasVolId) {
114 fHit->AddEdepGas(edep);
115 }
116
117 return true;
118 }
void AddTrackLengthAbs(Double_t dl)
Definition Hit.h:56
void AddEdepGas(Double_t de)
Definition Hit.h:52
void AddEdepAbs(Double_t de)
Definition Hit.h:48

◆ UpdateFromGarfield()

Bool_t VMC::ExGarfield::SensitiveDetector::UpdateFromGarfield ( )

Update the collected hit information from Garfield interface

Definition at line 121 of file SensitiveDetector.cxx.

122 {
123 /// Update the collected hit information from Garfield interface
124
126
127 // get energy deposit from Garfield, convert it in GeV
128 Double_t edep = garfieldPhysics->GetEnergyDeposit_MeV() * 1e-03;
129 Double_t avalancheSize = garfieldPhysics->GetAvalancheSize();
130 Double_t gain = garfieldPhysics->GetGain();
131
132 // update hit
133 fHit->AddEdepGas(edep);
134 fHit->AddAvalancheSize(avalancheSize);
135 fHit->AddGain(gain);
136
137 return true;
138 }
static GarfieldPhysics * GetInstance()
double GetEnergyDeposit_MeV()
double GetAvalancheSize()
void AddAvalancheSize(Double_t das)
Definition Hit.h:60
void AddGain(Double_t dg)
Definition Hit.h:64

◆ EndOfEvent()

void VMC::ExGarfield::SensitiveDetector::EndOfEvent ( )

Print hits collection (if verbose) and reset hits afterwards.

Definition at line 141 of file SensitiveDetector.cxx.

142 {
143 /// Print hits collection (if verbose) and reset hits afterwards.
144
145 if (fVerboseLevel > 0) Print();
146
147 // Reset hits collection
148 fHit->Reset();
149
150 // Reset data collected in Garfield
152 garfieldPhysics->Clear();
153 }
virtual void Print(Option_t *option="") const

◆ Register()

void VMC::ExGarfield::SensitiveDetector::Register ( )

Register the hits collection in Root manager.

Definition at line 156 of file SensitiveDetector.cxx.

157 {
158 /// Register the hits collection in Root manager.
159
160 TMCRootManager::Instance()->Register("hit", "VMC::ExGarfield::Hit", &fHit);
161 }

◆ Print()

void VMC::ExGarfield::SensitiveDetector::Print ( Option_t * option = "") const
virtual

Print the hit.

Definition at line 164 of file SensitiveDetector.cxx.

165 {
166 /// Print the hit.
167
168 fHit->Print();
169 }
virtual void Print(Option_t *option="") const
Definition Hit.cxx:52

◆ SetVerboseLevel()

void VMC::ExGarfield::SensitiveDetector::SetVerboseLevel ( Int_t level)
inline

Set verbose level

Parameters
levelThe new verbose level value

Definition at line 72 of file SensitiveDetector.h.

73{
74 fVerboseLevel = level;
75}

◆ GetHit()

Hit * VMC::ExGarfield::SensitiveDetector::GetHit ( ) const
inline

Return the hits collection.

Definition at line 78 of file SensitiveDetector.h.

78{ return fHit; }

Member Data Documentation

◆ fHit

Hit* VMC::ExGarfield::SensitiveDetector::fHit
private

The detector hit.

Definition at line 62 of file SensitiveDetector.h.

◆ fAbsorberVolId

Int_t VMC::ExGarfield::SensitiveDetector::fAbsorberVolId
private

The absorber volume Id.

Definition at line 63 of file SensitiveDetector.h.

◆ fGasVolId

Int_t VMC::ExGarfield::SensitiveDetector::fGasVolId
private

The gas volume Id.

Definition at line 64 of file SensitiveDetector.h.

◆ fVerboseLevel

Int_t VMC::ExGarfield::SensitiveDetector::fVerboseLevel
private

Verbosity level.

Definition at line 65 of file SensitiveDetector.h.


The documentation for this class was generated from the following files: