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 (const 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 23 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.

24  : cherenkov(nullptr) {
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;
42  ifib = index % 10;
43  }
44  pmtR1.push_back(ir);
45  pmtFib1.push_back(ifib);
46  }
47  neta = getDDDArray("indexPMTL", sv1);
48  for (unsigned int ii = 0; ii < neta.size(); ii++) {
49  int index = static_cast<int>(neta[ii]);
50  int ir = -1, ifib = -1;
51  if (index >= 0) {
52  ir = index / 10;
53  ifib = index % 10;
54  }
55  pmtR2.push_back(ir);
56  pmtFib2.push_back(ifib);
57  }
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("HFShower") << "HFShowerPMT: gets the Index matches for " << neta.size() << " PMTs";
60  for (unsigned int ii = 0; ii < neta.size(); ii++) {
61  edm::LogVerbatim("HFShower") << "HFShowerPMT: rIndexR[" << ii << "] = " << pmtR1[ii] << " fibreR[" << ii
62  << "] = " << pmtFib1[ii] << " rIndexL[" << ii << "] = " << pmtR2[ii] << " fibreL["
63  << ii << "] = " << pmtFib2[ii];
64  }
65 #endif
66  } else {
67  edm::LogWarning("HFShower") << "HFShowerPMT: cannot get filtered "
68  << " view for " << attribute << " matching " << value;
69  }
70 
71  cherenkov = new HFCherenkov(m_HF);
72 }
T getParameter(std::string const &) const
std::vector< int > pmtFib1
Definition: HFShowerPMT.h:36
double pePerGeV
Definition: HFShowerPMT.h:33
std::vector< int > pmtR2
Definition: HFShowerPMT.h:37
Definition: value.py:1
ii
Definition: cuy.py:590
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
Definition: HFShowerPMT.cc:147
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
HFCherenkov * cherenkov
Definition: HFShowerPMT.h:32
std::vector< int > pmtFib2
Definition: HFShowerPMT.h:37
std::vector< int > pmtR1
Definition: HFShowerPMT.h:36
HFShowerPMT::~HFShowerPMT ( )
virtual

Definition at line 74 of file HFShowerPMT.cc.

References cherenkov.

74  {
75  if (cherenkov)
76  delete cherenkov;
77 }
HFCherenkov * cherenkov
Definition: HFShowerPMT.h:32

Member Function Documentation

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

Definition at line 147 of file HFShowerPMT.cc.

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

Referenced by HFShowerPMT().

147  {
148 #ifdef EDM_ML_DEBUG
149  edm::LogVerbatim("HFShower") << "HFShowerPMT:getDDDArray called for " << str;
150 #endif
151  DDValue value(str);
152  if (DDfetch(&sv, value)) {
153 #ifdef EDM_ML_DEBUG
154  edm::LogVerbatim("HFShower") << value;
155 #endif
156  const std::vector<double>& fvec = value.doubles();
157  int nval = fvec.size();
158  if (nval < 2) {
159  edm::LogError("HFShower") << "HFShowerPMT: # of " << str << " bins " << nval << " < 2 ==> illegal";
160  throw cms::Exception("Unknown", "HFShowerPMT") << "nval < 2 for array " << str << "\n";
161  }
162 
163  return fvec;
164  } else {
165  edm::LogError("HFShower") << "HFShowerPMT: cannot get array " << str;
166  throw cms::Exception("Unknown", "HFShowerPMT") << "cannot get array " << str << "\n";
167  }
168 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)
double HFShowerPMT::getHits ( const G4Step *  aStep)

Definition at line 92 of file HFShowerPMT.cc.

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

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

Definition at line 131 of file HFShowerPMT.cc.

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

131  {
132  double r = 0.;
133  if (indexR >= 0 && indexR + 1 < (int)(rTable.size()))
134  r = 0.5 * (rTable[indexR] + rTable[indexR + 1]);
135 #ifdef EDM_ML_DEBUG
136  else
137  edm::LogVerbatim("HFShower") << "HFShowerPMT::getRadius: R " << indexR << " F " << indexF;
138 #endif
139  if (indexF == 2)
140  r = -r;
141 #ifdef EDM_ML_DEBUG
142  edm::LogVerbatim("HFShower") << "HFShowerPMT: Radius (" << indexR << "/" << indexF << ") " << r;
143 #endif
144  return r;
145 }
std::vector< double > rTable
Definition: HFShowerPMT.h:35
void HFShowerPMT::initRun ( const HcalDDDSimConstants hcons)

Definition at line 79 of file HFShowerPMT.cc.

References HcalDDDSimConstants::getRTableHF(), and rTable.

79  {
80  // Special Geometry parameters
81  rTable = hcons->getRTableHF();
82  std::stringstream sss;
83  for (unsigned int ig = 0; ig < rTable.size(); ++ig) {
84  if (ig / 10 * 10 == ig) {
85  sss << "\n";
86  }
87  sss << " " << rTable[ig] / cm;
88  }
89  edm::LogVerbatim("HFShowerPMT") << "HFShowerPMT: " << rTable.size() << " rTable(cm):" << sss.str();
90 }
std::vector< double > rTable
Definition: HFShowerPMT.h:35
const std::vector< double > & getRTableHF() const

Member Data Documentation

HFCherenkov* HFShowerPMT::cherenkov
private

Definition at line 32 of file HFShowerPMT.h.

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

int HFShowerPMT::indexF
private

Definition at line 34 of file HFShowerPMT.h.

Referenced by getHits(), and getRadius().

int HFShowerPMT::indexR
private

Definition at line 34 of file HFShowerPMT.h.

Referenced by getHits(), and getRadius().

double HFShowerPMT::pePerGeV
private

Definition at line 33 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

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

Definition at line 36 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

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

Definition at line 37 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

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

Definition at line 36 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

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

Definition at line 37 of file HFShowerPMT.h.

Referenced by getHits(), and HFShowerPMT().

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

Definition at line 35 of file HFShowerPMT.h.

Referenced by getRadius(), and initRun().