CMS 3D CMS Logo

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

#include <SimG4CMS/HcalTestBeam/interface/HcalTB02SD.h>

Inheritance diagram for HcalTB02SD:
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 *)
 
 HcalTB02SD (G4String, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual uint32_t setDetUnitId (G4Step *step)
 
void setNumberingScheme (HcalTB02NumberingScheme *scheme)
 
virtual ~HcalTB02SD ()
 
- Public Member Functions inherited from CaloSD
 CaloSD (G4String aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, int tSlice=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 (G4Step *step, G4TouchableHistory *tHistory)
 
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 ()
 

Private Member Functions

double crystalLength (G4String)
 
double curve_LY (G4String &, G4StepPoint *)
 
void initMap (G4String, const DDCompactView &)
 

Private Attributes

double birk1
 
double birk2
 
double birk3
 
std::map< G4String, double > lengthMap
 
HcalTB02NumberingSchemenumberingScheme
 
bool useBirk
 
bool useWeight
 

Additional Inherited Members

- Public Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Member Functions inherited from CaloSD
G4bool checkHit ()
 
virtual void clearHits ()
 
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 *)
 
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...
 
- 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

Description: Stores hits of Test Beam 2002 calorimeters

Usage: Activation is done using the XML file by choosing HcalTB02SensitiveDetector

Definition at line 29 of file HcalTB02SD.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file HcalTB02SD.cc.

References birk1, birk2, birk3, g, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), initMap(), LogDebug, MeV, setNumberingScheme(), useBirk, and useWeight.

39  :
40  CaloSD(name, cpv, clg, p, manager), numberingScheme(0) {
41 
42  edm::ParameterSet m_SD = p.getParameter<edm::ParameterSet>("HcalTB02SD");
43  useBirk= m_SD.getUntrackedParameter<bool>("UseBirkLaw",false);
44  birk1 = m_SD.getUntrackedParameter<double>("BirkC1",0.013)*(g/(MeV*cm2));
45  birk2 = m_SD.getUntrackedParameter<double>("BirkC2",0.0568);
46  birk3 = m_SD.getUntrackedParameter<double>("BirkC3",1.75);
47  useWeight= true;
48 
49  HcalTB02NumberingScheme* scheme=0;
50  if (name == "EcalHitsEB") {
51  scheme = dynamic_cast<HcalTB02NumberingScheme*>(new HcalTB02XtalNumberingScheme());
52  useBirk = false;
53  } else if (name == "HcalHits") {
54  scheme = dynamic_cast<HcalTB02NumberingScheme*>(new HcalTB02HcalNumberingScheme());
55  useWeight= false;
56  } else {edm::LogWarning("HcalTBSim") << "HcalTB02SD: ReadoutName " << name
57  << " not supported\n";}
58 
59  if (scheme) setNumberingScheme(scheme);
60  LogDebug("HcalTBSim")
61  << "***************************************************"
62  << "\n"
63  << "* *"
64  << "\n"
65  << "* Constructing a HcalTB02SD with name " << GetName()
66  << "\n"
67  << "* *"
68  << "\n"
69  << "***************************************************" ;
70  edm::LogInfo("HcalTBSim") << "HcalTB02SD:: Use of Birks law is set to "
71  << useBirk << " with three constants kB = "
72  << birk1 << ", C1 = " << birk2 << ", C2 = "
73  << birk3;
74 
75  if (useWeight) initMap(name,cpv);
76 
77 }
#define LogDebug(id)
double birk2
Definition: HcalTB02SD.h:50
T getUntrackedParameter(std::string const &, T const &) const
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:47
CaloSD(G4String aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *, int tSlice=1, bool ignoreTkID=false)
Definition: CaloSD.cc:24
bool useWeight
Definition: HcalTB02SD.h:48
bool useBirk
Definition: HcalTB02SD.h:49
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
double birk3
Definition: HcalTB02SD.h:50
void initMap(G4String, const DDCompactView &)
Definition: HcalTB02SD.cc:120
void setNumberingScheme(HcalTB02NumberingScheme *scheme)
Definition: HcalTB02SD.cc:111
double birk1
Definition: HcalTB02SD.h:50
HcalTB02SD::~HcalTB02SD ( )
virtual

Definition at line 79 of file HcalTB02SD.cc.

References numberingScheme.

79  {
80  if (numberingScheme) delete numberingScheme;
81 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:47

Member Function Documentation

double HcalTB02SD::crystalLength ( G4String  name)
private

Definition at line 179 of file HcalTB02SD.cc.

References lengthMap.

Referenced by curve_LY().

179  {
180 
181  double length = 230.;
182  std::map<G4String,double>::const_iterator it = lengthMap.find(name);
183  if (it != lengthMap.end()) length = it->second;
184  return length;
185 }
std::map< G4String, double > lengthMap
Definition: HcalTB02SD.h:51
double HcalTB02SD::curve_LY ( G4String &  nameVolume,
G4StepPoint *  stepPoint 
)
private

Definition at line 154 of file HcalTB02SD.cc.

References crystalLength(), LogDebug, CaloSD::setToLocal(), and histoStyle::weight.

Referenced by getEnergyDeposit().

154  {
155 
156  double weight = 1.;
157  G4ThreeVector localPoint = setToLocal(stepPoint->GetPosition(),
158  stepPoint->GetTouchable());
159  double crlength = crystalLength(nameVolume);
160  double dapd = 0.5 * crlength - localPoint.z();
161  if (dapd >= -0.1 || dapd <= crlength+0.1) {
162  if (dapd <= 100.)
163  weight = 1.05 - dapd * 0.0005;
164  } else {
165  edm::LogWarning("HcalTBSim") << "HcalTB02SD: light coll curve : wrong "
166  << "distance to APD " << dapd <<" crlength = "
167  << crlength << " crystal name = " <<nameVolume
168  << " z of localPoint = " << localPoint.z()
169  << " take weight = " << weight;
170  }
171  LogDebug("HcalTBSim") << "HcalTB02SD, light coll curve : " << dapd
172  << " crlength = " << crlength
173  << " crystal name = " << nameVolume
174  << " z of localPoint = " << localPoint.z()
175  << " take weight = " << weight;
176  return weight;
177 }
#define LogDebug(id)
double crystalLength(G4String)
Definition: HcalTB02SD.cc:179
int weight
Definition: histoStyle.py:50
G4ThreeVector setToLocal(const G4ThreeVector &, const G4VTouchable *)
Definition: CaloSD.cc:296
double HcalTB02SD::getEnergyDeposit ( G4Step *  aStep)
virtual

Reimplemented from CaloSD.

Definition at line 87 of file HcalTB02SD.cc.

References birk1, birk2, birk3, curve_LY(), CaloSD::getAttenuation(), LogDebug, MeV, NULL, CaloSD::preStepPoint, useBirk, useWeight, and histoStyle::weight.

87  {
88 
89  if (aStep == NULL) {
90  return 0;
91  } else {
92  preStepPoint = aStep->GetPreStepPoint();
93  G4String nameVolume = preStepPoint->GetPhysicalVolume()->GetName();
94 
95  // take into account light collection curve for crystals
96  double weight = 1.;
97  if (useWeight) weight *= curve_LY(nameVolume, preStepPoint);
98  if (useBirk) weight *= getAttenuation(aStep, birk1, birk2, birk3);
99  double edep = aStep->GetTotalEnergyDeposit() * weight;
100  LogDebug("HcalTBSim") << "HcalTB02SD:: " << nameVolume
101  <<" Light Collection Efficiency " << weight
102  << " Weighted Energy Deposit " << edep/MeV << " MeV";
103  return edep;
104  }
105 }
#define LogDebug(id)
double birk2
Definition: HcalTB02SD.h:50
#define NULL
Definition: scimark2.h:8
bool useWeight
Definition: HcalTB02SD.h:48
bool useBirk
Definition: HcalTB02SD.h:49
const double MeV
double birk3
Definition: HcalTB02SD.h:50
double getAttenuation(G4Step *aStep, double birk1, double birk2, double birk3)
Definition: CaloSD.cc:465
G4StepPoint * preStepPoint
Definition: CaloSD.h:120
int weight
Definition: histoStyle.py:50
double curve_LY(G4String &, G4StepPoint *)
Definition: HcalTB02SD.cc:154
double birk1
Definition: HcalTB02SD.h:50
void HcalTB02SD::initMap ( G4String  sd,
const DDCompactView cpv 
)
private

Definition at line 120 of file HcalTB02SD.cc.

References DDFilteredView::addFilter(), ddtrap, equals, alcazmumu_cfi::filter, DDFilteredView::firstChild(), i, lengthMap, LogDebug, DDFilteredView::logicalPart(), DDName::name(), SensitiveDetector::name, DDBase< N, C >::name(), DDFilteredView::next(), DDSolid::parameters(), DDSpecificsFilter::setCriteria(), DDSolid::shape(), and DDLogicalPart::solid().

Referenced by HcalTB02SD().

120  {
121 
122  G4String attribute = "ReadOutName";
124  DDValue ddv(attribute,sd,0);
125  filter.setCriteria(ddv,DDCompOp::equals);
126  DDFilteredView fv(cpv);
127  fv.addFilter(filter);
128  fv.firstChild();
129 
130  bool dodet=true;
131  while (dodet) {
132  const DDSolid & sol = fv.logicalPart().solid();
133  const std::vector<double> & paras = sol.parameters();
134  G4String name = sol.name().name();
135  LogDebug("HcalTBSim") << "HcalTB02SD::initMap (for " << sd << "): Solid "
136  << name << " Shape " << sol.shape()
137  << " Parameter 0 = " << paras[0];
138  if (sol.shape() == ddtrap) {
139  double dz = 2*paras[0];
140  lengthMap.insert(std::pair<G4String,double>(name,dz));
141  }
142  dodet = fv.next();
143  }
144  LogDebug("HcalTBSim") << "HcalTB02SD: Length Table for " << attribute
145  << " = " << sd << ":";
146  std::map<G4String,double>::const_iterator it = lengthMap.begin();
147  int i=0;
148  for (; it != lengthMap.end(); it++, i++) {
149  LogDebug("HcalTBSim") << " " << i << " " << it->first << " L = "
150  << it->second;
151  }
152 }
#define LogDebug(id)
std::map< G4String, double > lengthMap
Definition: HcalTB02SD.h:51
int i
Definition: DBlmapReader.cc:9
const std::vector< double > & parameters(void) const
Give the parameters of the solid.
Definition: DDSolid.cc:150
const N & name() const
Definition: DDBase.h:78
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:144
double sd
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
uint32_t HcalTB02SD::setDetUnitId ( G4Step *  step)
virtual

Implements CaloSD.

Definition at line 107 of file HcalTB02SD.cc.

References HcalTB02NumberingScheme::getUnitID(), and numberingScheme.

107  {
108  return (numberingScheme == 0 ? 0 : (uint32_t)(numberingScheme->getUnitID(aStep)));
109 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:47
virtual int getUnitID(const G4Step *aStep) const =0
void HcalTB02SD::setNumberingScheme ( HcalTB02NumberingScheme scheme)

Definition at line 111 of file HcalTB02SD.cc.

References numberingScheme.

Referenced by HcalTB02SD().

111  {
112  if (scheme != 0) {
113  edm::LogInfo("HcalTBSim") << "HcalTB02SD: updates numbering scheme for "
114  << GetName();
115  if (numberingScheme) delete numberingScheme;
116  numberingScheme = scheme;
117  }
118 }
HcalTB02NumberingScheme * numberingScheme
Definition: HcalTB02SD.h:47

Member Data Documentation

double HcalTB02SD::birk1
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk2
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk3
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

std::map<G4String,double> HcalTB02SD::lengthMap
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by crystalLength(), and initMap().

HcalTB02NumberingScheme* HcalTB02SD::numberingScheme
private

Definition at line 47 of file HcalTB02SD.h.

Referenced by setDetUnitId(), setNumberingScheme(), and ~HcalTB02SD().

bool HcalTB02SD::useBirk
private

Definition at line 49 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

bool HcalTB02SD::useWeight
private

Definition at line 48 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().