Belle II Software development
CDCSensitiveDetector Class Reference

The Class for CDC Sensitive Detector. More...

#include <CDCSensitiveDetector.h>

Inheritance diagram for CDCSensitiveDetector:
SensitiveDetectorBase

Public Member Functions

 CDCSensitiveDetector (G4String name, G4double thresholdEnergyDeposit, G4double thresholdKineticEnergy)
 Constructor.
 
 ~CDCSensitiveDetector ()
 Destructor.
 
void Initialize (G4HCofThisEvent *) override
 Register CDC hits collection into G4HCofThisEvent.
 
bool step (G4Step *aStep, G4TouchableHistory *history) override
 Process each step and calculate variables defined in CDCB4VHit.
 
void EndOfEvent (G4HCofThisEvent *) override
 Do what you want to do at the beginning of each event (why this is not called ?)
 
void saveSimHit (const G4int layerId, const G4int wireId, const G4int trackID, const G4int pid, const G4double distance, const G4double tof, const G4double edep, const G4double stepLength, const G4ThreeVector &mom, const G4ThreeVector &posW, const G4ThreeVector &posIn, const G4ThreeVector &posOut, const G4ThreeVector &posTrack, const G4int lr, const G4int NewLrRaw, const G4int NewLr, const G4double speed, const G4double hitWeight)
 Save CDCSimHit into datastore.
 

Static Public Member Functions

static const std::map< std::string, RelationArray::EConsolidationAction > & getMCParticleRelations ()
 Return a list of all registered Relations with MCParticles.
 
static void setActive (bool activeStatus)
 Enable/Disable all Sensitive Detectors.
 
static void registerMCParticleRelation (const std::string &name, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight)
 Register an relation involving MCParticles.
 
static void registerMCParticleRelation (const RelationArray &relation, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight)
 Overload to make it easer to register MCParticle relations.
 

Private Member Functions

G4double ClosestApproach (G4ThreeVector bwp, G4ThreeVector fwp, G4ThreeVector posIn, G4ThreeVector posOut, G4ThreeVector &hitPosition, G4ThreeVector &wirePosition)
 Assume line track to calculate distance between track and wire (drift length).
 
void CellBound (const G4int layerId, const G4int ic1, const G4int ic2, const G4double venter[6], const G4double vexit[6], const G4double s1, const G4double s2, G4double xint[6], G4double &sint, G4int &iflag)
 Calculate intersection of track with cell boundary.
 
void GCUBS (const G4double x, const G4double y, const G4double d1, const G4double d2, G4double a[4])
 
void for_Rotat (const G4double bfld[3])
 Calculates a rotation matrix.
 
void Rotat (G4double &x, G4double &y, G4double &z, const int mode)
 Translation method.
 
void Rotat (G4double x[3], const int mode)
 Overloaded translation method.
 
void HELWIR (const G4double xwb4, const G4double ywb4, const G4double zwb4, const G4double xwf4, const G4double ywf4, const G4double zwf4, const G4double xp, const G4double yp, const G4double zp, const G4double px, const G4double py, const G4double pz, const G4double B_kG[3], const G4double charge, const G4int ntryMax, G4double &distance, G4double q2[3], G4double q1[3], G4double q3[3], G4int &ntry)
 Calculate closest points between helix and wire.
 
void Mvopr (const G4int ndim, const G4double b[3], const G4double m[3][3], const G4double a[3], G4double c[3], const G4int mode)
 Calculate the result of a matrix times vector.
 
std::vector< int > WireId_in_hit_order (int id0, int id1, int nWires)
 Sort wire id.
 
void setModifiedLeftRightFlag ()
 set left/right flag modified for tracking
 
void reAssignLeftRightInfo ()
 Re-assign left/right info.
 
unsigned short areNeighbors (const WireID &wireId, const WireID &otherWireId) const
 Check if neighboring cell in the same super-layer; essentially a copy from cdcLocalTracking/mclookup.
 
unsigned short areNeighbors (unsigned short iCLayer, unsigned short iSuperLayer, unsigned short iLayer, unsigned short iWire, const WireID &otherWireId) const
 Check if neighboring cell in the same super-layer; essentially a copy from cdcLocalTracking/mclookup.
 
virtual bool ProcessHits (G4Step *aStep, G4TouchableHistory *aROhist)
 Check if recording hits is enabled and if so call step() and set the correct MCParticle flag.
 

Private Attributes

StoreArray< MCParticlem_MCParticles
 MC particles.
 
StoreArray< CDCSimHitm_CDCSimHits
 CDC simulation hits.
 
G4int m_magneticField
 Magnetic field is on or off.
 
G4int m_nonUniformField
 Magnetic field is uniform or non-uniform.
 
G4double m_brot [3][3]
 a rotation matrix.
 
CDCGeometryParm_cdcgp
 Pointer to CDCGeometryPar object.
 
G4double m_thresholdEnergyDeposit
 Threshold energy deposit to be stored.
 
G4double m_thresholdKineticEnergy
 Threshold kinetic energy to be stored.
 
G4bool m_wireSag
 Switch to activate wire sag effect.
 
G4bool m_modifiedLeftRightFlag
 Switch for left/right flag modified for tracking.
 
G4double m_minTrackLength
 Min.
 
int m_hitNumber
 The current number of created hits in an event.
 
std::multimap< unsigned short, CDCSimHit * > m_hitWithPosWeight
 Map containing hits with positive weight.
 
std::vector< CDCSimHit * > m_hitWithNegWeight
 Vector containing hits with negative weight.
 
const signed short CCW = 1
 Constant for counterclockwise orientation.
 
const signed short CW = -1
 Constant for clockwise orientation.
 
const signed short CW_OUT_NEIGHBOR = 1
 Constant for clockwise outwards.
 
const signed short CW_NEIGHBOR = 3
 Constant for clockwise.
 
const signed short CW_IN_NEIGHBOR = 5
 Constant for clockwise inwards.
 
const signed short CCW_IN_NEIGHBOR = 7
 Constant for counterclockwise inwards.
 
const signed short CCW_NEIGHBOR = 9
 Constant for counterclockwise.
 
const signed short CCW_OUT_NEIGHBOR = 11
 Constant for counterclockwise outwards.
 
Const::EDetector m_subdetector
 Subdetector the class belongs to.
 

Static Private Attributes

static std::map< std::string, RelationArray::EConsolidationActions_mcRelations
 Static set holding all relations which have to be updated at the end of the Event.
 
static bool s_active
 Static bool which indicates wether recording of hits is enabled.
 

Detailed Description

The Class for CDC Sensitive Detector.

In this class, every variable defined in CDCB4VHit will be calculated. And save CDCB4VHit into hits collection.

Definition at line 38 of file CDCSensitiveDetector.h.

Constructor & Destructor Documentation

◆ ~CDCSensitiveDetector()

~CDCSensitiveDetector ( )
inline

Destructor.

Definition at line 46 of file CDCSensitiveDetector.h.

46{}

Member Function Documentation

◆ getMCParticleRelations()

static const std::map< std::string, RelationArray::EConsolidationAction > & getMCParticleRelations ( )
inlinestaticinherited

Return a list of all registered Relations with MCParticles.

Definition at line 42 of file SensitiveDetectorBase.h.

42{ return s_mcRelations; }
static std::map< std::string, RelationArray::EConsolidationAction > s_mcRelations
Static set holding all relations which have to be updated at the end of the Event.

◆ ProcessHits()

bool ProcessHits ( G4Step *  aStep,
G4TouchableHistory *  aROhist 
)
inlineprivatevirtualinherited

Check if recording hits is enabled and if so call step() and set the correct MCParticle flag.

Called by Geant4 for each step inside the sensitive volumes attached

Definition at line 94 of file SensitiveDetectorBase.h.

95 {
96 if (!s_active) return false;
97 bool result = step(aStep, aROhist);
98 // Do not include hits from invalid detector (beast,teastbeam, etc.)
99 if (result && (m_subdetector != Const::invalidDetector)) TrackInfo::getInfo(*aStep->GetTrack()).addSeenInDetector(m_subdetector);
100 return result;
101 }
virtual bool step(G4Step *step, G4TouchableHistory *ROhist)=0
Process a Geant4 step in any of the sensitive volumes attached to this sensitive detector.
Const::EDetector m_subdetector
Subdetector the class belongs to.
static bool s_active
Static bool which indicates wether recording of hits is enabled.
static Payload getInfo(Carrier &obj)
Static function to just return UserInformation attached to the obj of type Carrier.
Definition: UserInfo.h:100

◆ registerMCParticleRelation() [1/2]

static void registerMCParticleRelation ( const RelationArray relation,
RelationArray::EConsolidationAction  ignoreAction = RelationArray::c_negativeWeight 
)
inlinestaticinherited

Overload to make it easer to register MCParticle relations.

Parameters
relationRelationArray to register
ignoreAction

Definition at line 66 of file SensitiveDetectorBase.h.

67 { registerMCParticleRelation(relation.getName(), ignoreAction); }
static void registerMCParticleRelation(const std::string &name, RelationArray::EConsolidationAction ignoreAction=RelationArray::c_negativeWeight)
Register an relation involving MCParticles.

◆ registerMCParticleRelation() [2/2]

void registerMCParticleRelation ( const std::string &  name,
RelationArray::EConsolidationAction  ignoreAction = RelationArray::c_negativeWeight 
)
staticinherited

Register an relation involving MCParticles.

All Relations which point from an MCParticle to something have to be registered with addMCParticleRelation() because the index of the MCParticles might change at the end of the event. During simulation, the TrackID should be used as index of the MCParticle

Parameters
nameName of the relation to register
ignoreAction

Definition at line 22 of file SensitiveDetectorBase.cc.

23 {
24 std::pair<std::map<std::string, RelationArray::EConsolidationAction>::iterator, bool> insert = s_mcRelations.insert(std::make_pair(
25 name, ignoreAction));
26 //If the relation already exists and the ignoreAction is different we do have a problem
27 if (!insert.second && insert.first->second != ignoreAction) {
28 B2FATAL("MCParticle Relation " << name << " already registered with different ignore action.");
29 }
30 }

◆ setActive()

static void setActive ( bool  activeStatus)
inlinestaticinherited

Enable/Disable all Sensitive Detectors.

By default, all sensitive detectors won't create hits to make it possible to use the Geant4 Navigator for non-simulation purposes. Only during simulation the sensitive detectors will be enabled to record hits

Parameters
activeStatusbool to indicate wether hits should be recorded

Definition at line 50 of file SensitiveDetectorBase.h.

50{ s_active = activeStatus; }

Member Data Documentation

◆ CCW

const signed short CCW = 1
private

Constant for counterclockwise orientation.

Definition at line 290 of file CDCSensitiveDetector.h.

◆ CCW_IN_NEIGHBOR

const signed short CCW_IN_NEIGHBOR = 7
private

Constant for counterclockwise inwards.

Definition at line 295 of file CDCSensitiveDetector.h.

◆ CCW_NEIGHBOR

const signed short CCW_NEIGHBOR = 9
private

Constant for counterclockwise.

Definition at line 296 of file CDCSensitiveDetector.h.

◆ CCW_OUT_NEIGHBOR

const signed short CCW_OUT_NEIGHBOR = 11
private

Constant for counterclockwise outwards.

Definition at line 297 of file CDCSensitiveDetector.h.

◆ CW

const signed short CW = -1
private

Constant for clockwise orientation.

Definition at line 291 of file CDCSensitiveDetector.h.

◆ CW_IN_NEIGHBOR

const signed short CW_IN_NEIGHBOR = 5
private

Constant for clockwise inwards.

Definition at line 294 of file CDCSensitiveDetector.h.

◆ CW_NEIGHBOR

const signed short CW_NEIGHBOR = 3
private

Constant for clockwise.

Definition at line 293 of file CDCSensitiveDetector.h.

◆ CW_OUT_NEIGHBOR

const signed short CW_OUT_NEIGHBOR = 1
private

Constant for clockwise outwards.

Definition at line 292 of file CDCSensitiveDetector.h.

◆ m_brot

G4double m_brot[3][3]
private

a rotation matrix.

Definition at line 256 of file CDCSensitiveDetector.h.

◆ m_cdcgp

CDCGeometryPar* m_cdcgp
private

Pointer to CDCGeometryPar object.

Definition at line 259 of file CDCSensitiveDetector.h.

◆ m_CDCSimHits

StoreArray<CDCSimHit> m_CDCSimHits
private

CDC simulation hits.

Definition at line 243 of file CDCSensitiveDetector.h.

◆ m_hitNumber

int m_hitNumber
private

The current number of created hits in an event.

Used to fill the DataStore CDC array.

Definition at line 277 of file CDCSensitiveDetector.h.

◆ m_hitWithNegWeight

std::vector<CDCSimHit*> m_hitWithNegWeight
private

Vector containing hits with negative weight.

Definition at line 282 of file CDCSensitiveDetector.h.

◆ m_hitWithPosWeight

std::multimap<unsigned short, CDCSimHit*> m_hitWithPosWeight
private

Map containing hits with positive weight.

Map may be replaced by vector, which may make the job speed faster... Try later.

Definition at line 280 of file CDCSensitiveDetector.h.

◆ m_magneticField

G4int m_magneticField
private

Magnetic field is on or off.

Definition at line 248 of file CDCSensitiveDetector.h.

◆ m_MCParticles

StoreArray<MCParticle> m_MCParticles
private

MC particles.

Definition at line 240 of file CDCSensitiveDetector.h.

◆ m_minTrackLength

G4double m_minTrackLength
private

Min.

track length (mm) required for saving in MCParticle.

Definition at line 275 of file CDCSensitiveDetector.h.

◆ m_modifiedLeftRightFlag

G4bool m_modifiedLeftRightFlag
private

Switch for left/right flag modified for tracking.

Definition at line 273 of file CDCSensitiveDetector.h.

◆ m_nonUniformField

G4int m_nonUniformField
private

Magnetic field is uniform or non-uniform.

0: uniform B field (1.5 T), 1: non-uniform B field.

Definition at line 254 of file CDCSensitiveDetector.h.

◆ m_subdetector

Const::EDetector m_subdetector
privateinherited

Subdetector the class belongs to.

Definition at line 91 of file SensitiveDetectorBase.h.

◆ m_thresholdEnergyDeposit

G4double m_thresholdEnergyDeposit
private

Threshold energy deposit to be stored.

Definition at line 264 of file CDCSensitiveDetector.h.

◆ m_thresholdKineticEnergy

G4double m_thresholdKineticEnergy
private

Threshold kinetic energy to be stored.

Definition at line 269 of file CDCSensitiveDetector.h.

◆ m_wireSag

G4bool m_wireSag
private

Switch to activate wire sag effect.

Definition at line 271 of file CDCSensitiveDetector.h.

◆ s_active

bool s_active
staticprivateinherited

Static bool which indicates wether recording of hits is enabled.

Definition at line 89 of file SensitiveDetectorBase.h.

◆ s_mcRelations

map< string, RelationArray::EConsolidationAction > s_mcRelations
staticprivateinherited

Static set holding all relations which have to be updated at the end of the Event.

Definition at line 87 of file SensitiveDetectorBase.h.


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