CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HGCSD Class Reference

#include <HGCSD.h>

Inheritance diagram for HGCSD:
CaloSD SensitiveCaloDetector Observer< const BeginOfRun * > Observer< const BeginOfEvent * > Observer< const BeginOfTrack * > Observer< const EndOfTrack * > Observer< const EndOfEvent * > SensitiveDetector

Public Member Functions

virtual double getEnergyDeposit (G4Step *)
 
 HGCSD (G4String, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *step)
 
virtual ~HGCSD ()
 
- Public Member Functions inherited from CaloSD
 CaloSD (G4String aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
 
virtual void clear ()
 
virtual void DrawAll ()
 
virtual void EndOfEvent (G4HCofThisEvent *eventHC)
 
void fillHits (edm::PCaloHitContainer &, std::string n)
 
virtual void Initialize (G4HCofThisEvent *HCE)
 
virtual void PrintAll ()
 
virtual bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *)
 
virtual ~CaloSD ()
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (const std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual std::vector< std::string > getNames ()
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- Public Member Functions inherited from Observer< const BeginOfRun * >
 Observer ()
 
void slotForUpdate (const BeginOfRun *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack * >
 Observer ()
 
void slotForUpdate (const BeginOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfTrack * >
 Observer ()
 
void slotForUpdate (const EndOfTrack *iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const EndOfEvent * >
 Observer ()
 
void slotForUpdate (const EndOfEvent *iT)
 
virtual ~Observer ()
 

Protected Member Functions

virtual bool filterHit (CaloG4Hit *, double)
 
virtual void initRun ()
 
- Protected Member Functions inherited from CaloSD
G4bool checkHit ()
 
virtual void clearHits ()
 
CaloG4HitcreateNewHit ()
 
double getAttenuation (G4Step *aStep, double birk1, double birk2, double birk3)
 
virtual uint16_t getDepth (G4Step *)
 
int getNumberOfHits ()
 
double getResponseWt (G4Track *)
 
virtual G4bool getStepInfo (G4Step *aStep)
 
virtual int getTrackID (G4Track *)
 
G4bool hitExists ()
 
void resetForNewPrimary (const G4ThreeVector &, double)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *)
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *)
 
virtual void update (const BeginOfRun *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfEvent *)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const BeginOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const EndOfTrack *trk)
 This routine will be called when the appropriate signal arrives. More...
 
virtual void update (const ::EndOfEvent *)
 
void updateHit (CaloG4Hit *)
 
- Protected Member Functions inherited from Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 

Private Member Functions

bool isItinFidVolume (G4ThreeVector &)
 
uint32_t setDetUnitId (ForwardSubdetector &, int &, int &, int &, G4ThreeVector &)
 
int setTrackID (G4Step *step)
 

Private Attributes

double eminHit
 
G4int mumPDG
 
G4int mupPDG
 
ForwardSubdetector myFwdSubdet_
 
HGCNumberingSchemenumberingScheme
 
G4int verbosity
 

Additional Inherited Members

- Public Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Attributes inherited from CaloSD
int checkHits
 
double correctT
 
bool corrTOFBeam
 
CaloG4HitcurrentHit
 
CaloHitID currentID
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double eminHitD
 
G4int emPDG
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
G4int epPDG
 
bool forceSave
 
G4int gammaPDG
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
const SimTrackManagerm_trackManager
 
G4ThreeVector posGlobal
 
G4StepPoint * preStepPoint
 
CaloHitID previousID
 
int primIDSaved
 
bool runInit
 
bool suppressHeavy
 
G4Track * theTrack
 
double tmaxHit
 
bool useMap
 

Detailed Description

Definition at line 24 of file HGCSD.h.

Constructor & Destructor Documentation

HGCSD::HGCSD ( G4String  name,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 31 of file HGCSD.cc.

References eminHit, ForwardEmpty, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HGCEE, HGCHEB, HGCHEF, LogDebug, MeV, myFwdSubdet_, SensitiveDetector::nameOfSD(), numberingScheme, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity.

33  :
34  CaloSD(name, cpv, clg, p, manager,
35  (float)(p.getParameter<edm::ParameterSet>("HGCSD").getParameter<double>("TimeSliceUnit")),
36  p.getParameter<edm::ParameterSet>("HGCSD").getParameter<bool>("IgnoreTrackID")),
37  numberingScheme(0) {
38 
39  edm::ParameterSet m_HGC = p.getParameter<edm::ParameterSet>("HGCSD");
40  eminHit = m_HGC.getParameter<double>("EminHit")*CLHEP::MeV;
41  bool checkID = m_HGC.getUntrackedParameter<bool>("CheckID", false);
42  verbosity = m_HGC.getUntrackedParameter<int>("Verbosity",0);
43 
44  //this is defined in the hgcsens.xml
45  G4String myName(this->nameOfSD());
47  std::string nameX("HGCal");
48  if (myName.find("HitsEE")!=std::string::npos) {
50  nameX = "HGCalEESensitive";
51  } else if (myName.find("HitsHEfront")!=std::string::npos) {
53  nameX = "HGCalHESiliconSensitive";
54  } else if (myName.find("HitsHEback")!=std::string::npos) {
56  nameX = "HGCalHEScintillatorSensitive";
57  }
58 
59 #ifdef DebugLog
60  LogDebug("HGCSim") << "**************************************************"
61  << "\n"
62  << "* *"
63  << "\n"
64  << "* Constructing a HGCSD with name " << name << "\n"
65  << "* *"
66  << "\n"
67  << "**************************************************";
68 #endif
69  edm::LogInfo("HGCSim") << "HGCSD:: Threshold for storing hits: " << eminHit;
70 
71  numberingScheme = new HGCNumberingScheme(cpv,nameX,checkID,verbosity);
72 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string nameOfSD()
HGCNumberingScheme * numberingScheme
Definition: HGCSD.h:46
CaloSD(G4String aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:24
double eminHit
Definition: HGCSD.h:48
const double MeV
G4int verbosity
Definition: HGCSD.h:47
ForwardSubdetector myFwdSubdet_
Definition: HGCSD.h:49
HGCSD::~HGCSD ( )
virtual

Definition at line 74 of file HGCSD.cc.

References numberingScheme.

74  {
75  if (numberingScheme) delete numberingScheme;
76 }
HGCNumberingScheme * numberingScheme
Definition: HGCSD.h:46

Member Function Documentation

bool HGCSD::filterHit ( CaloG4Hit aHit,
double  time 
)
protectedvirtual

Reimplemented from CaloSD.

Definition at line 143 of file HGCSD.cc.

References eminHit, CaloG4Hit::getEnergyDeposit(), and CaloSD::tmaxHit.

143  {
144  return ((time <= tmaxHit) && (aHit->getEnergyDeposit() > eminHit));
145 }
double eminHit
Definition: HGCSD.h:48
double tmaxHit
Definition: CaloSD.h:123
double getEnergyDeposit() const
Definition: CaloG4Hit.h:81
double HGCSD::getEnergyDeposit ( G4Step *  aStep)
virtual

Reimplemented from CaloSD.

Definition at line 103 of file HGCSD.cc.

103  {
104  double destep = aStep->GetTotalEnergyDeposit();
105  return destep;
106 }
void HGCSD::initRun ( void  )
protectedvirtual

Reimplemented from CaloSD.

Definition at line 132 of file HGCSD.cc.

References LogDebug, mumPDG, and mupPDG.

132  {
133  G4ParticleTable * theParticleTable = G4ParticleTable::GetParticleTable();
134  G4String particleName;
135  mumPDG = theParticleTable->FindParticle(particleName="mu-")->GetPDGEncoding();
136  mupPDG = theParticleTable->FindParticle(particleName="mu+")->GetPDGEncoding();
137 #ifdef DebugLog
138  LogDebug("HGCSim") << "HGCSD: Particle code for mu- = " << mumPDG
139  << " for mu+ = " << mupPDG;
140 #endif
141 }
#define LogDebug(id)
G4int mupPDG
Definition: HGCSD.h:47
G4int mumPDG
Definition: HGCSD.h:47
bool HGCSD::isItinFidVolume ( G4ThreeVector &  )
inlineprivate

Definition at line 43 of file HGCSD.h.

43 {return true;}
bool HGCSD::ProcessHits ( G4Step *  aStep,
G4TouchableHistory *   
)
virtual

Reimplemented from CaloSD.

Definition at line 78 of file HGCSD.cc.

References CaloSD::createNewHit(), CaloSD::currentHit, CaloSD::edepositEM, CaloSD::edepositHAD, CaloSD::getStepInfo(), CaloSD::hitExists(), mumPDG, mupPDG, SensitiveDetector::NaNTrap(), and NULL.

78  {
79 
80  NaNTrap( aStep ) ;
81 
82  if (aStep == NULL) {
83  return true;
84  } else {
85 #ifdef DebugLog
86  G4int parCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
87  bool notaMuon = (parCode == mupPDG || parCode == mumPDG ) ? false : true;
88  G4LogicalVolume* lv =
89  aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
90  edm::LogInfo("HGCSim") << "HGCSD: Hit from standard path from "
91  << lv->GetName() << " for Track "
92  << aStep->GetTrack()->GetTrackID() << " ("
93  << aStep->GetTrack()->GetDefinition()->GetParticleName()
94  << ":" << notaMuon << ")";
95 #endif
96  if (getStepInfo(aStep)) {
97  if (hitExists() == false && edepositEM+edepositHAD>0.) currentHit = createNewHit();
98  }
99  return true;
100  }
101 }
float edepositEM
Definition: CaloSD.h:121
#define NULL
Definition: scimark2.h:8
G4int mupPDG
Definition: HGCSD.h:47
float edepositHAD
Definition: CaloSD.h:121
CaloG4Hit * currentHit
Definition: CaloSD.h:128
void NaNTrap(G4Step *step)
virtual G4bool getStepInfo(G4Step *aStep)
Definition: CaloSD.cc:250
G4bool hitExists()
Definition: CaloSD.cc:310
CaloG4Hit * createNewHit()
Definition: CaloSD.cc:363
G4int mumPDG
Definition: HGCSD.h:47
uint32_t HGCSD::setDetUnitId ( G4Step *  step)
virtual

Implements CaloSD.

Definition at line 108 of file HGCSD.cc.

References gather_cfg::cout, myFwdSubdet_, CaloSD::preStepPoint, and verbosity.

108  {
109 
110  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
111  const G4VTouchable* touch = preStepPoint->GetTouchable();
112 
113  //determine the exact position in global coordinates in the mass geometry
114  G4ThreeVector hitPoint = preStepPoint->GetPosition();
115  float globalZ=touch->GetTranslation(0).z();
116  int iz( globalZ>0 ? 1 : -1);
117 
118  //convert to local coordinates (=local to the current volume):
119  G4ThreeVector localpos = touch->GetHistory()->GetTopTransform().TransformPoint(hitPoint);
120 
121  //get the det unit id with
123 
124  int layer = touch->GetReplicaNumber(0);
125  int module = touch->GetReplicaNumber(1);
126  if (verbosity > 0)
127  std::cout << "HGCSD::Global " << hitPoint << " local " << localpos
128  << std::endl;
129  return setDetUnitId (subdet, layer, module, iz, localpos);
130 }
ForwardSubdetector
G4int verbosity
Definition: HGCSD.h:47
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
tuple cout
Definition: gather_cfg.py:121
ForwardSubdetector myFwdSubdet_
Definition: HGCSD.h:49
Definition: vlib.h:208
virtual uint32_t setDetUnitId(G4Step *step)
Definition: HGCSD.cc:108
uint32_t HGCSD::setDetUnitId ( ForwardSubdetector subdet,
int &  layer,
int &  module,
int &  iz,
G4ThreeVector &  pos 
)
private

Definition at line 149 of file HGCSD.cc.

References HGCNumberingScheme::getUnitID(), and numberingScheme.

149  {
150  return (numberingScheme ? numberingScheme->getUnitID(subdet, layer, module, iz, pos) : 0);
151 }
HGCNumberingScheme * numberingScheme
Definition: HGCSD.h:46
virtual uint32_t getUnitID(ForwardSubdetector subdet, int layer, int module, int iz, const G4ThreeVector &pos)
assigns the det id to a hit
Definition: vlib.h:208
int HGCSD::setTrackID ( G4Step *  step)
private

Definition at line 154 of file HGCSD.cc.

References TrackInformation::getIDonCaloSurface(), CaloSD::preStepPoint, CaloSD::previousID, CaloSD::resetForNewPrimary(), CaloSD::theTrack, and CaloHitID::trackID().

154  {
155  theTrack = aStep->GetTrack();
156 
157  double etrack = preStepPoint->GetKineticEnergy();
158  TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
159  int primaryID = trkInfo->getIDonCaloSurface();
160  if (primaryID == 0) {
161 #ifdef DebugLog
162  edm::LogInfo("HGCSim") << "HGCSD: Problem with primaryID **** set by "
163  << "force to TkID **** " <<theTrack->GetTrackID();
164 #endif
165  primaryID = theTrack->GetTrackID();
166  }
167 
168  if (primaryID != previousID.trackID())
169  resetForNewPrimary(preStepPoint->GetPosition(), etrack);
170 
171  return primaryID;
172 }
int getIDonCaloSurface() const
void resetForNewPrimary(const G4ThreeVector &, double)
Definition: CaloSD.cc:454
int trackID() const
Definition: CaloHitID.h:25
CaloHitID previousID
Definition: CaloSD.h:117
G4Track * theTrack
Definition: CaloSD.h:118
G4StepPoint * preStepPoint
Definition: CaloSD.h:120

Member Data Documentation

double HGCSD::eminHit
private

Definition at line 48 of file HGCSD.h.

Referenced by filterHit(), and HGCSD().

G4int HGCSD::mumPDG
private

Definition at line 47 of file HGCSD.h.

Referenced by initRun(), and ProcessHits().

G4int HGCSD::mupPDG
private

Definition at line 47 of file HGCSD.h.

Referenced by initRun(), and ProcessHits().

ForwardSubdetector HGCSD::myFwdSubdet_
private

Definition at line 49 of file HGCSD.h.

Referenced by HGCSD(), and setDetUnitId().

HGCNumberingScheme* HGCSD::numberingScheme
private

Definition at line 46 of file HGCSD.h.

Referenced by HGCSD(), setDetUnitId(), and ~HGCSD().

G4int HGCSD::verbosity
private

Definition at line 47 of file HGCSD.h.

Referenced by HGCSD(), and setDetUnitId().