CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HcalTB06BeamSD Class Reference

#include <HcalTB06BeamSD.h>

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

Public Member Functions

 HcalTB06BeamSD (const std::string &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (const G4Step *step) override
 
 ~HcalTB06BeamSD () override
 
- Public Member Functions inherited from CaloSD
 CaloSD (const std::string &aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
 
void clear () override
 
void clearHits () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
G4bool ProcessHits (G4Step *step, G4TouchableHistory *) override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
 ~CaloSD () override
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
 SensitiveDetector (const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
 ~SensitiveDetector () override
 
- 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

double getEnergyDeposit (const G4Step *) override
 
- Protected Member Functions inherited from CaloSD
bool checkHit ()
 
CaloG4HitcreateNewHit (const G4Step *)
 
virtual void endEvent ()
 
virtual bool filterHit (CaloG4Hit *, double)
 
double getAttenuation (const G4Step *aStep, double birk1, double birk2, double birk3) const
 
virtual uint16_t getDepth (const G4Step *)
 
virtual bool getFromLibrary (const G4Step *step)
 
int getNumberOfHits ()
 
double getResponseWt (const G4Track *)
 
virtual int getTrackID (const G4Track *)
 
bool hitExists (const G4Step *)
 
virtual void initEvent (const BeginOfEvent *)
 
virtual void initRun ()
 
void processHit (const G4Step *step)
 
void resetForNewPrimary (const G4Step *)
 
void setNumberCheckedHits (int val)
 
void setParameterized (bool val)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *) const
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *) const
 
virtual int setTrackID (const G4Step *)
 
void setUseMap (bool val)
 
void update (const BeginOfRun *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfEvent *) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const EndOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const ::EndOfEvent *) override
 
void updateHit (CaloG4Hit *)
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 
- 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

std::vector< G4String > getNames (DDFilteredView &)
 
bool isItWireChamber (const G4String &)
 

Private Attributes

double birk1
 
double birk2
 
double birk3
 
G4String matName
 
bool useBirk
 
std::vector< G4String > wcNames
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Attributes inherited from CaloSD
CaloG4HitcurrentHit
 
CaloHitID currentID
 
float edepositEM
 
float edepositHAD
 
double eminHit
 
double energyCut
 
G4ThreeVector entranceLocal
 
G4ThreeVector entrancePoint
 
bool forceSave
 
float incidentEnergy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 
G4ThreeVector posGlobal
 
CaloHitID previousID
 
bool suppressHeavy
 
double tmaxHit
 

Detailed Description

Definition at line 20 of file HcalTB06BeamSD.h.

Constructor & Destructor Documentation

HcalTB06BeamSD::HcalTB06BeamSD ( const std::string &  name,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 25 of file HcalTB06BeamSD.cc.

References birk1, birk2, birk3, DDFilteredView::firstChild(), g, SensitiveDetector::getNames(), edm::ParameterSet::getParameter(), mps_fire::i, cmsBatch::log, DDFilteredView::logicalPart(), DDLogicalPart::material(), matName, MeV, DDName::name(), DDBase< N, C >::name(), DDFilteredView::next(), AlCaHLTBitMon_QueryRunRegistry::string, useBirk, relativeConstraints::value, and wcNames.

29  :
30  CaloSD(name, cpv, clg, p, manager) {
31 
32  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
33  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HcalTB06BeamSD");
34  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
35  birk1 = m_HC.getParameter<double>("BirkC1")*(g/(MeV*cm2));
36  birk2 = m_HC.getParameter<double>("BirkC2");
37  birk3 = m_HC.getParameter<double>("BirkC3");
38 
39  edm::LogInfo("HcalTB06BeamSD") << "HcalTB06BeamSD:: Use of Birks law is set "
40  << "to " << useBirk << " with three "
41  << "constants kB = " << birk1 << ", C1 = "
42  << birk2 << ", C2 = " << birk3;
43 
44  std::string attribute, value;
45 
46  // Wire Chamber volume names
47  attribute = "Volume";
48  value = "WireChamber";
49  DDSpecificsMatchesValueFilter filter1{DDValue(attribute,value,0)};
50  DDFilteredView fv1(cpv,filter1);
51  wcNames = getNames(fv1);
52  edm::LogInfo("HcalTB06BeamSD") << "HcalTB06BeamSD:: Names to be tested for "
53  << attribute << " = " << value << ": "
54  << wcNames.size() << " paths";
55  for (unsigned int i=0; i<wcNames.size(); i++)
56  edm::LogInfo("HcalTB06BeamSD") << "HcalTB06BeamSD:: (" << i << ") "
57  << wcNames[i];
58 
59  //Material list for scintillator detector
60  attribute = "ReadOutName";
61  DDSpecificsMatchesValueFilter filter2{DDValue(attribute,name,0)};
62  DDFilteredView fv2(cpv,filter2);
63  bool dodet = fv2.firstChild();
64 
65  std::vector<G4String> matNames;
66  std::vector<int> nocc;
67  while (dodet) {
68  const DDLogicalPart & log = fv2.logicalPart();
69  matName = log.material().name().name();
70  bool notIn = true;
71  for (unsigned int i=0; i<matNames.size(); i++) {
72  if (matName == matNames[i]) {notIn = false; nocc[i]++;}
73  }
74  if (notIn) {
75  matNames.push_back(matName);
76  nocc.push_back(0);
77  }
78  dodet = fv2.next();
79  }
80  if (!matNames.empty()) {
81  matName = matNames[0];
82  int occ = nocc[0];
83  for (unsigned int i = 0; i < matNames.size(); i++) {
84  if (nocc[i] > occ) {
85  occ = nocc[i];
86  matName = matNames[i];
87  }
88  }
89  } else {
90  matName = "Not Found";
91  }
92 
93  edm::LogInfo("HcalTB06BeamSD") << "HcalTB06BeamSD: Material name for "
94  << attribute << " = " << name << ":"
95  << matName;
96 }
T getParameter(std::string const &) const
std::vector< G4String > wcNames
const N & name() const
Definition: DDBase.h:74
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
const double MeV
const std::vector< std::string > & getNames() const
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
CaloSD(const std::string &aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, float timeSlice=1., bool ignoreTkID=false)
Definition: CaloSD.cc:28
G4String matName
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
HcalTB06BeamSD::~HcalTB06BeamSD ( )
override

Definition at line 98 of file HcalTB06BeamSD.cc.

98 {}

Member Function Documentation

double HcalTB06BeamSD::getEnergyDeposit ( const G4Step *  aStep)
overrideprotectedvirtual

Reimplemented from CaloSD.

Definition at line 100 of file HcalTB06BeamSD.cc.

References birk1, birk2, birk3, CaloSD::getAttenuation(), matName, useBirk, and mps_merge::weight.

100  {
101 
102  double destep = aStep->GetTotalEnergyDeposit();
103  double weight = 1;
104  if (useBirk && matName == aStep->GetPreStepPoint()->GetMaterial()->GetName())
105  weight *= getAttenuation(aStep, birk1, birk2, birk3);
106 #ifdef EDM_ML_DEBUG
107  edm::LogVerbatim("HcalTB06BeamSD") << "HcalTB06BeamSD: Detector "
108  << aStep->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName()
109  << " weight " << weight;
110 #endif
111  return weight*destep;
112 }
Definition: weight.py:1
double getAttenuation(const G4Step *aStep, double birk1, double birk2, double birk3) const
Definition: CaloSD.cc:462
G4String matName
std::vector< G4String > HcalTB06BeamSD::getNames ( DDFilteredView fv)
private

Definition at line 135 of file HcalTB06BeamSD.cc.

References DDFilteredView::firstChild(), mps_fire::i, cmsBatch::log, DDFilteredView::logicalPart(), DDName::name(), dataset::name, DDBase< N, C >::name(), DDFilteredView::next(), convertSQLiteXML::ok, and tmp.

135  {
136 
137  std::vector<G4String> tmp;
138  bool dodet = fv.firstChild();
139  while (dodet) {
140  const DDLogicalPart & log = fv.logicalPart();
141  G4String name = log.name().name();
142  bool ok = true;
143  for (unsigned int i=0; i<tmp.size(); i++)
144  if (name == tmp[i]) ok = false;
145  if (ok) tmp.push_back(name);
146  dodet = fv.next();
147  }
148  return tmp;
149 }
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:74
bool next()
set current node to the next node in the filtered tree
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:93
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
bool firstChild()
set the current node to the first child ...
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
bool HcalTB06BeamSD::isItWireChamber ( const G4String &  name)
private

Definition at line 151 of file HcalTB06BeamSD.cc.

References wcNames.

Referenced by setDetUnitId().

151  {
152 
153  std::vector<G4String>::const_iterator it = wcNames.begin();
154  for (; it != wcNames.end(); it++)
155  if (name == *it) return true;
156  return false;
157 }
std::vector< G4String > wcNames
uint32_t HcalTB06BeamSD::setDetUnitId ( const G4Step *  step)
overridevirtual

Implements CaloSD.

Definition at line 114 of file HcalTB06BeamSD.cc.

References createfilelist::int, isItWireChamber(), dataset::name, HcalTestBeamNumbering::packIndex(), CaloSD::setToLocal(), x, and y.

114  {
115 
116  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
117  const G4VTouchable* touch = preStepPoint->GetTouchable();
118  G4String name = preStepPoint->GetPhysicalVolume()->GetName();
119 
120  int det = 1;
121  int lay = 0, x = 0, y = 0;
122  if (!isItWireChamber(name)) {
123  lay = (touch->GetReplicaNumber(0));
124  } else {
125  det = 2;
126  lay = (touch->GetReplicaNumber(1));
127  G4ThreeVector localPoint = setToLocal(preStepPoint->GetPosition(), touch);
128  x = (int)(localPoint.x()/(0.2*mm));
129  y = (int)(localPoint.y()/(0.2*mm));
130  }
131 
132  return HcalTestBeamNumbering::packIndex (det, lay, x, y);
133 }
static uint32_t packIndex(int det, int lay, int x, int y)
bool isItWireChamber(const G4String &)
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *) const
Definition: CaloSD.cc:307

Member Data Documentation

double HcalTB06BeamSD::birk1
private

Definition at line 40 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

double HcalTB06BeamSD::birk2
private

Definition at line 40 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

double HcalTB06BeamSD::birk3
private

Definition at line 40 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

G4String HcalTB06BeamSD::matName
private

Definition at line 42 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

bool HcalTB06BeamSD::useBirk
private

Definition at line 39 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

std::vector<G4String> HcalTB06BeamSD::wcNames
private

Definition at line 41 of file HcalTB06BeamSD.h.

Referenced by HcalTB06BeamSD(), and isItWireChamber().