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 &, 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, 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, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (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, 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 (G4ThreeVector, double)
 
G4ThreeVector setToGlobal (G4ThreeVector, const G4VTouchable *)
 
G4ThreeVector setToLocal (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 30 of file HcalTB02SD.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file HcalTB02SD.cc.

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

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

Definition at line 78 of file HcalTB02SD.cc.

References numberingScheme.

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

Member Function Documentation

double HcalTB02SD::crystalLength ( G4String  name)
private

Definition at line 178 of file HcalTB02SD.cc.

References lengthMap.

Referenced by curve_LY().

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

Definition at line 153 of file HcalTB02SD.cc.

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

Referenced by getEnergyDeposit().

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

Reimplemented from CaloSD.

Definition at line 86 of file HcalTB02SD.cc.

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

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

Definition at line 119 of file HcalTB02SD.cc.

References DDFilteredView::addFilter(), ddtrap, DDSpecificsFilter::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().

119  {
120 
121  G4String attribute = "ReadOutName";
123  DDValue ddv(attribute,sd,0);
125  DDFilteredView fv(cpv);
126  fv.addFilter(filter);
127  fv.firstChild();
128 
129  bool dodet=true;
130  while (dodet) {
131  const DDSolid & sol = fv.logicalPart().solid();
132  const std::vector<double> & paras = sol.parameters();
133  G4String name = sol.name().name();
134  LogDebug("HcalTBSim") << "HcalTB02SD::initMap (for " << sd << "): Solid "
135  << name << " Shape " << sol.shape()
136  << " Parameter 0 = " << paras[0];
137  if (sol.shape() == ddtrap) {
138  double dz = 2*paras[0];
139  lengthMap.insert(std::pair<G4String,double>(name,dz));
140  }
141  dodet = fv.next();
142  }
143  LogDebug("HcalTBSim") << "HcalTB02SD: Length Table for " << attribute
144  << " = " << sd << ":";
145  std::map<G4String,double>::const_iterator it = lengthMap.begin();
146  int i=0;
147  for (; it != lengthMap.end(); it++, i++) {
148  LogDebug("HcalTBSim") << " " << i << " " << it->first << " L = "
149  << it->second;
150  }
151 }
#define LogDebug(id)
std::map< G4String, double > lengthMap
Definition: HcalTB02SD.h:52
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:82
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
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
uint32_t HcalTB02SD::setDetUnitId ( G4Step *  step)
virtual

Implements CaloSD.

Definition at line 106 of file HcalTB02SD.cc.

References HcalTB02NumberingScheme::getUnitID(), and numberingScheme.

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

Definition at line 110 of file HcalTB02SD.cc.

References numberingScheme.

Referenced by HcalTB02SD().

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

Member Data Documentation

double HcalTB02SD::birk1
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk2
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

double HcalTB02SD::birk3
private

Definition at line 51 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

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

Definition at line 52 of file HcalTB02SD.h.

Referenced by crystalLength(), and initMap().

HcalTB02NumberingScheme* HcalTB02SD::numberingScheme
private

Definition at line 48 of file HcalTB02SD.h.

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

bool HcalTB02SD::useBirk
private

Definition at line 50 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().

bool HcalTB02SD::useWeight
private

Definition at line 49 of file HcalTB02SD.h.

Referenced by getEnergyDeposit(), and HcalTB02SD().