CMS 3D CMS Logo

List of all members | Public 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

double getEnergyDeposit (G4Step *) override
 
 HcalTB06BeamSD (const G4String &, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
uint32_t setDetUnitId (G4Step *step) override
 
 ~HcalTB06BeamSD () override
 
- 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)
 
void clear () override
 
void DrawAll () override
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
void fillHits (edm::PCaloHitContainer &, std::string n) override
 
void Initialize (G4HCofThisEvent *HCE) override
 
void PrintAll () override
 
bool ProcessHits (G4Step *step, G4TouchableHistory *tHistory) override
 
bool ProcessHits (G4GFlashSpot *aSpot, G4TouchableHistory *) override
 
 ~CaloSD () override
 
- 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)
 
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual std::vector< std::string > getNames ()
 
void Initialize (G4HCofThisEvent *eventHC) override
 
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)
 
 ~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 ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Member Functions inherited from CaloSD
G4bool checkHit ()
 
void clearHits () override
 
CaloG4HitcreateNewHit ()
 
virtual bool filterHit (CaloG4Hit *, double)
 
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 ()
 
virtual void initRun ()
 
void resetForNewPrimary (const G4ThreeVector &, double)
 
G4ThreeVector setToGlobal (const G4ThreeVector &, const G4VTouchable *)
 
G4ThreeVector setToLocal (const G4ThreeVector &, const G4VTouchable *)
 
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 Observer< const EndOfEvent * >
virtual void update (const EndOfEvent *)=0
 This routine will be called when the appropriate signal arrives. More...
 
- 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 20 of file HcalTB06BeamSD.h.

Constructor & Destructor Documentation

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

Definition at line 23 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.

26  :
27  CaloSD(name, cpv, clg, p, manager) {
28 
29  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
30  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HcalTB06BeamSD");
31  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
32  birk1 = m_HC.getParameter<double>("BirkC1")*(g/(MeV*cm2));
33  birk2 = m_HC.getParameter<double>("BirkC2");
34  birk3 = m_HC.getParameter<double>("BirkC3");
35 
36  edm::LogInfo("HcalTB06BeamSD") << "HcalTB06BeamSD:: Use of Birks law is set to "
37  << useBirk << " with three constants kB = "
38  << birk1 << ", C1 = " <<birk2 << ", C2 = " <<birk3;
39 
40  std::string attribute, value;
41 
42  // Wire Chamber volume names
43  attribute = "Volume";
44  value = "WireChamber";
45  DDSpecificsMatchesValueFilter filter1{DDValue(attribute,value,0)};
46  DDFilteredView fv1(cpv,filter1);
47  wcNames = getNames(fv1);
48  edm::LogInfo("HcalTB06BeamSD")
49  << "HcalTB06BeamSD:: Names to be tested for "
50  << attribute << " = " << value << ": " << wcNames.size() << " paths";
51  for (unsigned int i=0; i<wcNames.size(); i++)
52  edm::LogInfo("HcalTB06BeamSD") << "HcalTB06BeamSD:: (" << i << ") "
53  << wcNames[i];
54 
55  //Material list for scintillator detector
56  attribute = "ReadOutName";
57  DDSpecificsMatchesValueFilter filter2{DDValue(attribute,name,0)};
58  DDFilteredView fv2(cpv,filter2);
59  bool dodet = fv2.firstChild();
60 
61  std::vector<G4String> matNames;
62  std::vector<int> nocc;
63  while (dodet) {
64  const DDLogicalPart & log = fv2.logicalPart();
65  matName = log.material().name().name();
66  bool notIn = true;
67  for (unsigned int i=0; i<matNames.size(); i++) {
68  if (matName == matNames[i]) {notIn = false; nocc[i]++;}
69  }
70  if (notIn) {
71  matNames.push_back(matName);
72  nocc.push_back(0);
73  }
74  dodet = fv2.next();
75  }
76  if (!matNames.empty()) {
77  matName = matNames[0];
78  int occ = nocc[0];
79  for (unsigned int i = 0; i < matNames.size(); i++) {
80  if (nocc[i] > occ) {
81  occ = nocc[i];
82  matName = matNames[i];
83  }
84  }
85  } else {
86  matName = "Not Found";
87  }
88 
89  edm::LogInfo("HcalTB06BeamSD")
90  << "HcalTB06BeamSD: Material name for "
91  << attribute << " = " << name << ":" << matName;
92 }
T getParameter(std::string const &) const
std::vector< G4String > wcNames
const N & name() const
Definition: DDBase.h:78
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
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
const double MeV
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
virtual std::vector< std::string > getNames()
G4String matName
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
HcalTB06BeamSD::~HcalTB06BeamSD ( )
override

Definition at line 94 of file HcalTB06BeamSD.cc.

94 {}

Member Function Documentation

double HcalTB06BeamSD::getEnergyDeposit ( G4Step *  aStep)
overridevirtual

Reimplemented from CaloSD.

Definition at line 96 of file HcalTB06BeamSD.cc.

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

96  {
97 
98  double destep = aStep->GetTotalEnergyDeposit();
99  double weight = 1;
100  if (useBirk && matName == aStep->GetPreStepPoint()->GetMaterial()->GetName()) {
101  weight *= getAttenuation(aStep, birk1, birk2, birk3);
102  }
103  LogDebug("HcalTB06BeamSD")
104  << "HcalTB06BeamSD: Detector "
105  << aStep->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName()
106  << " weight " << weight;
107  return weight*destep;
108 }
#define LogDebug(id)
Definition: weight.py:1
double getAttenuation(G4Step *aStep, double birk1, double birk2, double birk3)
Definition: CaloSD.cc:465
G4String matName
std::vector< G4String > HcalTB06BeamSD::getNames ( DDFilteredView fv)
private

Definition at line 131 of file HcalTB06BeamSD.cc.

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

131  {
132 
133  std::vector<G4String> tmp;
134  bool dodet = fv.firstChild();
135  while (dodet) {
136  const DDLogicalPart & log = fv.logicalPart();
137  G4String name = log.name().name();
138  bool ok = true;
139  for (unsigned int i=0; i<tmp.size(); i++)
140  if (name == tmp[i]) ok = false;
141  if (ok) tmp.push_back(name);
142  dodet = fv.next();
143  }
144  return tmp;
145 }
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:78
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:92
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:90
bool HcalTB06BeamSD::isItWireChamber ( G4String  name)
private

Definition at line 147 of file HcalTB06BeamSD.cc.

References wcNames.

Referenced by setDetUnitId().

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

Implements CaloSD.

Definition at line 110 of file HcalTB06BeamSD.cc.

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

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

Member Data Documentation

double HcalTB06BeamSD::birk1
private

Definition at line 37 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

double HcalTB06BeamSD::birk2
private

Definition at line 37 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

double HcalTB06BeamSD::birk3
private

Definition at line 37 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

G4String HcalTB06BeamSD::matName
private

Definition at line 39 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

bool HcalTB06BeamSD::useBirk
private

Definition at line 36 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

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

Definition at line 38 of file HcalTB06BeamSD.h.

Referenced by HcalTB06BeamSD(), and isItWireChamber().