CMS 3D CMS Logo

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

#include <HFShowerPMT.h>

Public Member Functions

double getHits (const G4Step *aStep)
 
double getRadius ()
 
 HFShowerPMT (const std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p)
 
void initRun (G4ParticleTable *, HcalDDDSimConstants *)
 
virtual ~HFShowerPMT ()
 

Private Member Functions

std::vector< double > getDDDArray (const std::string &, const DDsvalues_type &)
 

Private Attributes

HFCherenkovcherenkov
 
int indexF
 
int indexR
 
double pePerGeV
 
std::vector< int > pmtFib1
 
std::vector< int > pmtFib2
 
std::vector< int > pmtR1
 
std::vector< int > pmtR2
 
std::vector< double > rTable
 

Detailed Description

Definition at line 20 of file HFShowerPMT.h.

Constructor & Destructor Documentation

HFShowerPMT::HFShowerPMT ( const std::string &  name,
const DDCompactView cpv,
edm::ParameterSet const &  p 
)

Definition at line 22 of file HFShowerPMT.cc.

References cherenkov, DDFilteredView::firstChild(), getDDDArray(), edm::ParameterSet::getParameter(), cuy::ii, DDFilteredView::mergedSpecifics(), pePerGeV, pmtFib1, pmtFib2, pmtR1, pmtR2, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

23  : cherenkov(nullptr) {
24 
25  edm::ParameterSet m_HF = p.getParameter<edm::ParameterSet>("HFShowerPMT");
26  pePerGeV = m_HF.getParameter<double>("PEPerGeVPMT");
27 
28  //Special Geometry parameters
29  std::string attribute = "Volume";
30  std::string value = "HFPMT";
31  DDSpecificsMatchesValueFilter filter1{DDValue(attribute,value,0)};
32  DDFilteredView fv1(cpv,filter1);
33  if (fv1.firstChild()) {
34  DDsvalues_type sv1(fv1.mergedSpecifics());
35  std::vector<double> neta;
36  neta = getDDDArray("indexPMTR",sv1);
37  for (unsigned int ii=0; ii<neta.size(); ii++) {
38  int index = static_cast<int>(neta[ii]);
39  int ir=-1, ifib=-1;
40  if (index >= 0) {
41  ir = index/10; ifib = index%10;
42  }
43  pmtR1.push_back(ir);
44  pmtFib1.push_back(ifib);
45  }
46  neta = getDDDArray("indexPMTL",sv1);
47  for (unsigned int ii=0; ii<neta.size(); ii++) {
48  int index = static_cast<int>(neta[ii]);
49  int ir=-1, ifib=-1;
50  if (index >= 0) {
51  ir = index/10; ifib = index%10;
52  }
53  pmtR2.push_back(ir);
54  pmtFib2.push_back(ifib);
55  }
56  edm::LogInfo("HFShower") << "HFShowerPMT: gets the Index matches for "
57  << neta.size() << " PMTs";
58  for (unsigned int ii=0; ii<neta.size(); ii++)
59  edm::LogInfo("HFShower") << "HFShowerPMT: rIndexR[" << ii << "] = "
60  << pmtR1[ii] << " fibreR[" << ii << "] = "
61  << pmtFib1[ii] << " rIndexL[" << ii << "] = "
62  << pmtR2[ii] << " fibreL[" << ii << "] = "
63  << pmtFib2[ii];
64  } else {
65  edm::LogWarning("HFShower") << "HFShowerPMT: cannot get filtered "
66  << " view for " << attribute << " matching "
67  << value;
68  }
69 
70  cherenkov = new HFCherenkov(m_HF);
71 }
T getParameter(std::string const &) const
std::vector< int > pmtFib1
Definition: HFShowerPMT.h:41
double pePerGeV
Definition: HFShowerPMT.h:38
std::vector< int > pmtR2
Definition: HFShowerPMT.h:42
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
Definition: value.py:1
ii
Definition: cuy.py:588
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: HFShowerPMT.cc:152
HFCherenkov * cherenkov
Definition: HFShowerPMT.h:37
std::vector< int > pmtFib2
Definition: HFShowerPMT.h:42
std::vector< int > pmtR1
Definition: HFShowerPMT.h:41
HFShowerPMT::~HFShowerPMT ( )
virtual

Definition at line 73 of file HFShowerPMT.cc.

References cherenkov.

73  {
74  if (cherenkov) delete cherenkov;
75 }
HFCherenkov * cherenkov
Definition: HFShowerPMT.h:37

Member Function Documentation

std::vector< double > HFShowerPMT::getDDDArray ( const std::string &  str,
const DDsvalues_type sv 
)
private

Definition at line 152 of file HFShowerPMT.cc.

References DDfetch(), DDValue::doubles(), Exception, LogDebug, harvestTrackValidationPlots::str, and relativeConstraints::value.

Referenced by HFShowerPMT().

153  {
154 
155 #ifdef DebugLog
156  LogDebug("HFShower") << "HFShowerPMT:getDDDArray called for " << str;
157 #endif
158  DDValue value(str);
159  if (DDfetch(&sv,value)) {
160 #ifdef DebugLog
161  LogDebug("HFShower") << value;
162 #endif
163  const std::vector<double> & fvec = value.doubles();
164  int nval = fvec.size();
165  if (nval < 2) {
166  edm::LogError("HFShower") << "HFShowerPMT: # of " << str
167  << " bins " << nval << " < 2 ==> illegal";
168  throw cms::Exception("Unknown", "HFShowerPMT")
169  << "nval < 2 for array " << str << "\n";
170  }
171 
172  return fvec;
173  } else {
174  edm::LogError("HFShower") << "HFShowerPMT: cannot get array " << str;
175  throw cms::Exception("Unknown", "HFShowerPMT")
176  << "cannot get array " << str << "\n";
177  }
178 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
double HFShowerPMT::getHits ( const G4Step *  aStep)

Definition at line 88 of file HFShowerPMT.cc.

References beta, cherenkov, HFCherenkov::computeNPEinPMT(), GeV, indexF, indexR, LogDebug, MeV, pePerGeV, nano_cff::photons, pmtFib1, pmtFib2, pmtR1, and pmtR2.

Referenced by HCalSD::getHitPMT().

88  {
89 
90  indexR = indexF = -1;
91 
92  G4StepPoint * preStepPoint = aStep->GetPreStepPoint();
93  const G4VTouchable* touch = preStepPoint->GetTouchable();
94  int boxNo = touch->GetReplicaNumber(2);
95  int pmtNo = touch->GetReplicaNumber(1);
96  if (boxNo <= 1) {
97  indexR = pmtR1[pmtNo-1];
98  indexF = pmtFib1[pmtNo-1];
99  } else {
100  indexR = pmtR2[pmtNo-1];
101  indexF = pmtFib2[pmtNo-1];
102  }
103 
104 #ifdef DebugLog
105  double edep = aStep->GetTotalEnergyDeposit();
106  LogDebug("HFShower") << "HFShowerPMT: Box " << boxNo << " PMT "
107  << pmtNo << " Mapped Indices " << indexR << ", "
108  << indexF << " Edeposit " << edep/MeV << " MeV; PE "
109  << edep*pePerGeV/GeV;
110 #endif
111 
112  double photons = 0;
113  if (indexR >= 0 && indexF > 0) {
114  G4Track *aTrack = aStep->GetTrack();
115  G4ParticleDefinition *particleDef = aTrack->GetDefinition();
116  double stepl = aStep->GetStepLength();
117  double beta = preStepPoint->GetBeta();
118  G4ThreeVector pDir = aTrack->GetDynamicParticle()->GetMomentumDirection();
119  G4ThreeVector localMom = preStepPoint->GetTouchable()->GetHistory()->
120  GetTopTransform().TransformAxis(pDir);
121  photons = cherenkov->computeNPEinPMT(particleDef, beta, localMom.x(),
122  localMom.y(), localMom.z(), stepl);
123 #ifdef DebugLog
124  LogDebug("HFShower") << "HFShowerPMT::getHits: for particle "
125  << particleDef->GetParticleName() << " Step " << stepl
126  << " Beta " << beta << " Direction " << pDir
127  << " Local " << localMom << " p.e. " << photons;
128 #endif
129 
130  }
131  return photons;
132 }
#define LogDebug(id)
const double beta
const double GeV
Definition: MathUtil.h:16
std::vector< int > pmtFib1
Definition: HFShowerPMT.h:41
const double MeV
double pePerGeV
Definition: HFShowerPMT.h:38
std::vector< int > pmtR2
Definition: HFShowerPMT.h:42
HFCherenkov * cherenkov
Definition: HFShowerPMT.h:37
std::vector< int > pmtFib2
Definition: HFShowerPMT.h:42
std::vector< int > pmtR1
Definition: HFShowerPMT.h:41
int computeNPEinPMT(const G4ParticleDefinition *pDef, double pBeta, double u, double v, double w, double step_length)
Definition: HFCherenkov.cc:229
double HFShowerPMT::getRadius ( )

Definition at line 134 of file HFShowerPMT.cc.

References indexF, indexR, LogDebug, alignCSCRings::r, and rTable.

Referenced by HCalSD::getHitPMT().

134  {
135 
136  double r = 0.;
137  if (indexR >= 0 && indexR+1 < (int)(rTable.size()))
138  r = 0.5*(rTable[indexR]+rTable[indexR+1]);
139 #ifdef DebugLog
140  else
141  LogDebug("HFShower") << "HFShowerPMT::getRadius: R " << indexR
142  << " F " << indexF;
143 #endif
144  if (indexF == 2) r =-r;
145 #ifdef DebugLog
146  LogDebug("HFShower") << "HFShowerPMT: Radius (" << indexR << "/" << indexF
147  << ") " << r;
148 #endif
149  return r;
150 }
#define LogDebug(id)
std::vector< double > rTable
Definition: HFShowerPMT.h:40
void HFShowerPMT::initRun ( G4ParticleTable *  ,
HcalDDDSimConstants hcons 
)

Definition at line 77 of file HFShowerPMT.cc.

References HcalDDDSimConstants::getRTableHF(), and rTable.

Referenced by HCalSD::initRun().

77  {
78 
79  // Special Geometry parameters
80  rTable = hcons->getRTableHF();
81  edm::LogInfo("HFShower") << "HFShowerPMT: " << rTable.size()
82  << " rTable (cm)";
83  for (unsigned int ig=0; ig<rTable.size(); ig++)
84  edm::LogInfo("HFShower") << "HFShowerPMT: rTable[" << ig << "] = "
85  << rTable[ig]/cm << " cm";
86 }
std::vector< double > rTable
Definition: HFShowerPMT.h:40
const std::vector< double > & getRTableHF() const

Member Data Documentation

HFCherenkov* HFShowerPMT::cherenkov
private

Definition at line 37 of file HFShowerPMT.h.

Referenced by getHits(), HFShowerPMT(), and ~HFShowerPMT().

int HFShowerPMT::indexF
private

Definition at line 39 of file HFShowerPMT.h.

Referenced by getHits(), and getRadius().

int HFShowerPMT::indexR
private

Definition at line 39 of file HFShowerPMT.h.

Referenced by getHits(), and getRadius().

double HFShowerPMT::pePerGeV
private

Definition at line 38 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtFib1
private

Definition at line 41 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtFib2
private

Definition at line 42 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtR1
private

Definition at line 41 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<int> HFShowerPMT::pmtR2
private

Definition at line 42 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

std::vector<double> HFShowerPMT::rTable
private

Definition at line 40 of file HFShowerPMT.h.

Referenced by getRadius(), and initRun().