CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static 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

virtual double getEnergyDeposit (G4Step *)
 
 HcalTB06BeamSD (G4String, const DDCompactView &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *)
 
virtual uint32_t setDetUnitId (G4Step *step)
 
virtual ~HcalTB06BeamSD ()
 
- 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 (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 ()
 

Static Public Member Functions

static uint32_t packIndex (int det, int lay, int x, int y)
 
static void unpackIndex (const uint32_t &idx, int &det, int &lay, int &x, int &y)
 

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 ()
 
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

Definition at line 20 of file HcalTB06BeamSD.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file HcalTB06BeamSD.cc.

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

24  :
25  CaloSD(name, cpv, clg, p, manager) {
26 
27  // Values from NIM 80 (1970) 239-244: as implemented in Geant3
28  edm::ParameterSet m_HC = p.getParameter<edm::ParameterSet>("HcalTB06BeamSD");
29  useBirk = m_HC.getParameter<bool>("UseBirkLaw");
30  birk1 = m_HC.getParameter<double>("BirkC1")*(g/(MeV*cm2));
31  birk2 = m_HC.getParameter<double>("BirkC2");
32  birk3 = m_HC.getParameter<double>("BirkC3");
33 
34  LogDebug("HcalTBSim") <<"***************************************************"
35  << "\n"
36  <<"* *"
37  << "\n"
38  << "* Constructing a HcalTB06BeamSD with name "
39  << name << "\n"
40  <<"* *"
41  << "\n"
42  <<"***************************************************";
43 
44  edm::LogInfo("HcalTBSim") << "HcalTB06BeamSD:: Use of Birks law is set to "
45  << useBirk << " with three constants kB = "
46  << birk1 << ", C1 = " <<birk2 << ", C2 = " <<birk3;
47 
48  std::string attribute, value;
49 
50  // Wire Chamber volume names
51  attribute = "Volume";
52  value = "WireChamber";
53  DDSpecificsFilter filter1;
54  DDValue ddv1(attribute,value,0);
55  filter1.setCriteria(ddv1,DDCompOp::equals);
56  DDFilteredView fv1(cpv);
57  fv1.addFilter(filter1);
58  wcNames = getNames(fv1);
59  edm::LogInfo("HcalTBSim") << "HcalTB06BeamSD:: Names to be tested for "
60  << attribute << " = " << value << ": "
61  << wcNames.size() << " paths";
62  for (unsigned int i=0; i<wcNames.size(); i++)
63  edm::LogInfo("HcalTBSim") << "HcalTB06BeamSD:: (" << i << ") "
64  << wcNames[i];
65 
66  //Material list for scintillator detector
67  attribute = "ReadOutName";
68  DDSpecificsFilter filter2;
69  DDValue ddv2(attribute,name,0);
70  filter2.setCriteria(ddv2,DDCompOp::equals);
71  DDFilteredView fv2(cpv);
72  fv2.addFilter(filter2);
73  bool dodet = fv2.firstChild();
74 
75  std::vector<G4String> matNames;
76  std::vector<int> nocc;
77  while (dodet) {
78  const DDLogicalPart & log = fv2.logicalPart();
79  matName = log.material().name().name();
80  bool notIn = true;
81  for (unsigned int i=0; i<matNames.size(); i++)
82  if (matName == matNames[i]) {notIn = false; nocc[i]++;}
83  if (notIn) {
84  matNames.push_back(matName);
85  nocc.push_back(0);
86  }
87  dodet = fv2.next();
88  }
89  if (matNames.size() > 0) {
90  matName = matNames[0];
91  int occ = nocc[0];
92  for (unsigned int i = 0; i < matNames.size(); i++) {
93  if (nocc[i] > occ) {
94  occ = nocc[i];
95  matName = matNames[i];
96  }
97  }
98  } else {
99  matName = "Not Found";
100  }
101 
102  edm::LogInfo("HcalTBSim") << "HcalTB06BeamSD: Material name for "
103  << attribute << " = " << name << ":" << matName;
104 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
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:88
virtual std::vector< std::string > getNames()
G4String matName
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
const DDMaterial & material(void) const
Returns a reference object of the material this LogicalPart is made of.
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
tuple log
Definition: cmsBatch.py:341
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
HcalTB06BeamSD::~HcalTB06BeamSD ( )
virtual

Definition at line 106 of file HcalTB06BeamSD.cc.

106 {}

Member Function Documentation

double HcalTB06BeamSD::getEnergyDeposit ( G4Step *  aStep)
virtual

Reimplemented from CaloSD.

Definition at line 108 of file HcalTB06BeamSD.cc.

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

108  {
109 
110  double destep = aStep->GetTotalEnergyDeposit();
111  double weight = 1;
112  if (useBirk) {
113  G4Material* mat = aStep->GetPreStepPoint()->GetMaterial();
114  if (mat->GetName() == matName)
115  weight *= getAttenuation(aStep, birk1, birk2, birk3);
116  }
117  LogDebug("HcalTBSim") << "HcalTB06BeamSD: Detector "
118  << aStep->GetPreStepPoint()->GetTouchable()->GetVolume()->GetName()
119  << " weight " << weight;
120  return weight*destep;
121 }
#define LogDebug(id)
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 175 of file HcalTB06BeamSD.cc.

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

175  {
176 
177  std::vector<G4String> tmp;
178  bool dodet = fv.firstChild();
179  while (dodet) {
180  const DDLogicalPart & log = fv.logicalPart();
181  G4String name = log.name().name();
182  bool ok = true;
183  for (unsigned int i=0; i<tmp.size(); i++)
184  if (name == tmp[i]) ok = false;
185  if (ok) tmp.push_back(name);
186  dodet = fv.next();
187  }
188  return tmp;
189 }
int i
Definition: DBlmapReader.cc:9
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:88
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:87
tuple log
Definition: cmsBatch.py:341
bool HcalTB06BeamSD::isItWireChamber ( G4String  name)
private

Definition at line 191 of file HcalTB06BeamSD.cc.

References wcNames.

Referenced by setDetUnitId().

191  {
192 
193  std::vector<G4String>::const_iterator it = wcNames.begin();
194  for (; it != wcNames.end(); it++)
195  if (name == *it) return true;
196  return false;
197 }
std::vector< G4String > wcNames
uint32_t HcalTB06BeamSD::packIndex ( int  det,
int  lay,
int  x,
int  y 
)
static

Definition at line 145 of file HcalTB06BeamSD.cc.

References TauDecayModes::dec, customizeTrackingMonitorSeedNumber::idx, ixx, iyy, LogDebug, x, and y.

Referenced by setDetUnitId().

145  {
146 
147  int ix = 0, ixx = x;
148  if (x < 0) { ix = 1; ixx =-x;}
149  int iy = 0, iyy = y;
150  if (y < 0) { iy = 1; iyy =-y;}
151  uint32_t idx = (det&15)<<28; //bits 28-31
152  idx += (lay&127)<<21; //bits 21-27
153  idx += (iy&1)<<19; //bit 19
154  idx += (iyy&511)<<10; //bits 10-18
155  idx += (ix&1)<<9; //bit 9
156  idx += (ixx&511); //bits 0-8
157 
158  LogDebug("HcalTBSim") << "HcalTB06BeamSD: Detector " << det << " Layer "
159  << lay << " x " << x << " " << ix << " " << ixx
160  << " y " << y << " " << iy << " " << iyy << " ID "
161  << std::hex << idx << std::dec;
162  return idx;
163 }
#define LogDebug(id)
int iyy[18][41][3]
int ixx[18][41][3]
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
uint32_t HcalTB06BeamSD::setDetUnitId ( G4Step *  step)
virtual

Implements CaloSD.

Definition at line 123 of file HcalTB06BeamSD.cc.

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

123  {
124 
125  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
126  const G4VTouchable* touch = preStepPoint->GetTouchable();
127  G4String name = preStepPoint->GetPhysicalVolume()->GetName();
128 
129  int det = 1;
130  int lay = 0, x = 0, y = 0;
131  if (!isItWireChamber(name)) {
132  lay = (touch->GetReplicaNumber(0));
133  } else {
134  det = 2;
135  lay = (touch->GetReplicaNumber(1));
136  G4ThreeVector hitPoint = preStepPoint->GetPosition();
137  G4ThreeVector localPoint = setToLocal(hitPoint, touch);
138  x = (int)(localPoint.x()/(0.2*mm));
139  y = (int)(localPoint.y()/(0.2*mm));
140  }
141 
142  return packIndex (det, lay, x, y);
143 }
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
void HcalTB06BeamSD::unpackIndex ( const uint32_t &  idx,
int &  det,
int &  lay,
int &  x,
int &  y 
)
static

Definition at line 165 of file HcalTB06BeamSD.cc.

References customizeTrackingMonitorSeedNumber::idx, x, and y.

166  {
167 
168  det = (idx>>28)&15;
169  lay = (idx>>21)&127;
170  y = (idx>>10)&511; if (((idx>>19)&1) == 1) y = -y;
171  x = (idx)&511; if (((idx>>9)&1) == 1) x = -x;
172 
173 }
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...

Member Data Documentation

double HcalTB06BeamSD::birk1
private

Definition at line 39 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

double HcalTB06BeamSD::birk2
private

Definition at line 39 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

double HcalTB06BeamSD::birk3
private

Definition at line 39 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

G4String HcalTB06BeamSD::matName
private

Definition at line 41 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

bool HcalTB06BeamSD::useBirk
private

Definition at line 38 of file HcalTB06BeamSD.h.

Referenced by getEnergyDeposit(), and HcalTB06BeamSD().

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

Definition at line 40 of file HcalTB06BeamSD.h.

Referenced by HcalTB06BeamSD(), and isItWireChamber().