CMS 3D CMS Logo

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

#include <HFShowerFibreBundle.h>

Public Member Functions

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

Private Member Functions

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

Private Attributes

HFCherenkovcherenkov1
 
HFCherenkovcherenkov2
 
double facCone
 
double facTube
 
int indexF
 
int indexR
 
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 HFShowerFibreBundle.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file HFShowerFibreBundle.cc.

References cherenkov1, cherenkov2, facCone, facTube, DDFilteredView::firstChild(), getDDDArray(), edm::ParameterSet::getParameter(), cuy::ii, diffTreeTool::index, DDFilteredView::mergedSpecifics(), pmtFib1, pmtFib2, pmtR1, pmtR2, AlCaHLTBitMon_QueryRunRegistry::string, and relativeConstraints::value.

24  {
25 
26  edm::ParameterSet m_HF1 = p.getParameter<edm::ParameterSet>("HFShowerStraightBundle");
27  facTube = m_HF1.getParameter<double>("FactorBundle");
28  cherenkov1 = new HFCherenkov(m_HF1);
29  edm::ParameterSet m_HF2 = p.getParameter<edm::ParameterSet>("HFShowerConicalBundle");
30  facCone = m_HF2.getParameter<double>("FactorBundle");
31  cherenkov2 = new HFCherenkov(m_HF2);
32  edm::LogInfo("HFShower") << "HFShowerFibreBundle intialized with factors: "
33  << facTube << " for the straight portion and "
34  << facCone << " for the curved portion";
35 
36  //Special Geometry parameters
37  std::string attribute = "Volume";
38  std::string value = "HFPMT";
39  DDSpecificsMatchesValueFilter filter1{DDValue(attribute,value,0)};
40  DDFilteredView fv1(cpv,filter1);
41  if (fv1.firstChild()) {
42  DDsvalues_type sv1(fv1.mergedSpecifics());
43  std::vector<double> neta;
44  neta = getDDDArray("indexPMTR",sv1);
45  for (unsigned int ii=0; ii<neta.size(); ii++) {
46  int index = static_cast<int>(neta[ii]);
47  int ir=-1, ifib=-1;
48  if (index >= 0) {
49  ir = index/10; ifib = index%10;
50  }
51  pmtR1.push_back(ir);
52  pmtFib1.push_back(ifib);
53  }
54  neta = getDDDArray("indexPMTL",sv1);
55  for (unsigned int ii=0; ii<neta.size(); ii++) {
56  int index = static_cast<int>(neta[ii]);
57  int ir=-1, ifib=-1;
58  if (index >= 0) {
59  ir = index/10; ifib = index%10;
60  }
61  pmtR2.push_back(ir);
62  pmtFib2.push_back(ifib);
63  }
64  edm::LogInfo("HFShower") << "HFShowerFibreBundle: gets the Index matches "
65  << "for " << neta.size() << " PMTs";
66  for (unsigned int ii=0; ii<neta.size(); ii++)
67  edm::LogInfo("HFShower") << "HFShowerFibreBundle: rIndexR[" << ii
68  << "] = " << pmtR1[ii] << " fibreR[" << ii
69  << "] = " << pmtFib1[ii] << " rIndexL[" << ii
70  << "] = " << pmtR2[ii] << " fibreL[" << ii
71  << "] = " << pmtFib2[ii];
72  } else {
73  edm::LogWarning("HFShower") << "HFShowerFibreBundle: cannot get filtered "
74  << " view for " << attribute << " matching "
75  << value;
76  }
77 
78 }
T getParameter(std::string const &) const
std::vector< int > pmtFib1
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
std::vector< int > pmtR1
Definition: value.py:1
ii
Definition: cuy.py:588
std::vector< int > pmtR2
std::vector< int > pmtFib2
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
HFShowerFibreBundle::~HFShowerFibreBundle ( )
virtual

Definition at line 80 of file HFShowerFibreBundle.cc.

References cherenkov1, and cherenkov2.

80  {
81  delete cherenkov1;
82  delete cherenkov2;
83 }

Member Function Documentation

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

Definition at line 166 of file HFShowerFibreBundle.cc.

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

Referenced by HFShowerFibreBundle().

167  {
168 
169 #ifdef DebugLog
170  LogDebug("HFShower") << "HFShowerFibreBundle:getDDDArray called for " << str;
171 #endif
172  DDValue value(str);
173  if (DDfetch(&sv,value)) {
174 #ifdef DebugLog
175  LogDebug("HFShower") << value;
176 #endif
177  const std::vector<double> & fvec = value.doubles();
178  int nval = fvec.size();
179  if (nval < 2) {
180  edm::LogError("HFShower") << "HFShowerFibreBundle: # of " << str
181  << " bins " << nval << " < 2 ==> illegal";
182  throw cms::Exception("Unknown", "HFShowerFibreBundle")
183  << "nval < 2 for array " << str << "\n";
184  }
185 
186  return fvec;
187  } else {
188  edm::LogError("HFShower") <<"HFShowerFibreBundle: cannot get array " <<str;
189  throw cms::Exception("Unknown", "HFShowerFibreBundle")
190  << "cannot get array " << str << "\n";
191  }
192 }
#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 HFShowerFibreBundle::getHits ( G4Step *  aStep,
bool  type 
)

Definition at line 96 of file HFShowerFibreBundle.cc.

References beta, cherenkov1, cherenkov2, HFCherenkov::computeNPEinPMT(), facCone, facTube, indexF, indexR, LogDebug, MeV, nano_cff::photons, pmtFib1, pmtFib2, pmtR1, and pmtR2.

Referenced by HCalSD::getHitFibreBundle().

96  {
97 
98  indexR = indexF = -1;
99 
100  G4StepPoint * preStepPoint = aStep->GetPreStepPoint();
101  const G4VTouchable* touch = preStepPoint->GetTouchable();
102  int boxNo = touch->GetReplicaNumber(1);
103  int pmtNo = touch->GetReplicaNumber(0);
104  if (boxNo <= 1) {
105  indexR = pmtR1[pmtNo-1];
106  indexF = pmtFib1[pmtNo-1];
107  } else {
108  indexR = pmtR2[pmtNo-1];
109  indexF = pmtFib2[pmtNo-1];
110  }
111 
112 #ifdef DebugLog
113  double edep = aStep->GetTotalEnergyDeposit();
114  LogDebug("HFShower") << "HFShowerFibreBundle: Box " << boxNo << " PMT "
115  << pmtNo << " Mapped Indices " << indexR << ", "
116  << indexF << " Edeposit " << edep/MeV << " MeV";
117 #endif
118 
119  double photons = 0;
120  if (indexR >= 0 && indexF > 0) {
121  G4Track *aTrack = aStep->GetTrack();
122  G4ParticleDefinition *particleDef = aTrack->GetDefinition();
123  double stepl = aStep->GetStepLength();
124  double beta = preStepPoint->GetBeta();
125  G4ThreeVector pDir = aTrack->GetDynamicParticle()->GetMomentumDirection();
126  G4ThreeVector localMom = preStepPoint->GetTouchable()->GetHistory()->
127  GetTopTransform().TransformAxis(pDir);
128  if (type) {
129  photons = facCone*cherenkov2->computeNPEinPMT(particleDef, beta,
130  localMom.x(), localMom.y(),
131  localMom.z(), stepl);
132  } else {
133  photons = facTube*cherenkov1->computeNPEinPMT(particleDef, beta,
134  localMom.x(), localMom.y(),
135  localMom.z(), stepl);
136  }
137 #ifdef DebugLog
138  LogDebug("HFShower") << "HFShowerFibreBundle::getHits: for particle "
139  << particleDef->GetParticleName() << " Step " << stepl
140  << " Beta " << beta << " Direction " << pDir
141  << " Local " << localMom << " p.e. " << photons;
142 #endif
143 
144  }
145  return photons;
146 }
#define LogDebug(id)
const double beta
type
Definition: HCALResponse.h:21
std::vector< int > pmtFib1
int computeNPEinPMT(G4ParticleDefinition *pDef, double pBeta, double u, double v, double w, double step_length)
Definition: HFCherenkov.cc:229
const double MeV
std::vector< int > pmtR1
std::vector< int > pmtR2
std::vector< int > pmtFib2
double HFShowerFibreBundle::getRadius ( )

Definition at line 148 of file HFShowerFibreBundle.cc.

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

Referenced by HCalSD::getHitFibreBundle().

148  {
149 
150  double r = 0.;
151  if (indexR >= 0 && indexR+1 < (int)(rTable.size()))
152  r = 0.5*(rTable[indexR]+rTable[indexR+1]);
153 #ifdef DebugLog
154  else
155  LogDebug("HFShower") << "HFShowerFibreBundle::getRadius: R " << indexR
156  << " F " << indexF;
157 #endif
158  if (indexF == 2) r =-r;
159 #ifdef DebugLog
160  LogDebug("HFShower") << "HFShowerFibreBundle: Radius (" << indexR << "/"
161  << indexF << ") " << r;
162 #endif
163  return r;
164 }
#define LogDebug(id)
std::vector< double > rTable
void HFShowerFibreBundle::initRun ( G4ParticleTable *  ,
HcalDDDSimConstants hcons 
)

Definition at line 85 of file HFShowerFibreBundle.cc.

References HcalDDDSimConstants::getRTableHF(), and rTable.

Referenced by HCalSD::initRun().

85  {
86 
87  // Special Geometry parameters
88  rTable = hcons->getRTableHF();
89  edm::LogInfo("HFShower") << "HFShowerFibreBundle: " << rTable.size()
90  << " rTable (cm)";
91  for (unsigned int ig=0; ig<rTable.size(); ig++)
92  edm::LogInfo("HFShower") << "HFShowerFibreBundle: rTable[" << ig << "] = "
93  << rTable[ig]/cm << " cm";
94 }
std::vector< double > rTable
const std::vector< double > & getRTableHF() const

Member Data Documentation

HFCherenkov* HFShowerFibreBundle::cherenkov1
private

Definition at line 37 of file HFShowerFibreBundle.h.

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

HFCherenkov * HFShowerFibreBundle::cherenkov2
private

Definition at line 37 of file HFShowerFibreBundle.h.

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

double HFShowerFibreBundle::facCone
private

Definition at line 38 of file HFShowerFibreBundle.h.

Referenced by getHits(), and HFShowerFibreBundle().

double HFShowerFibreBundle::facTube
private

Definition at line 38 of file HFShowerFibreBundle.h.

Referenced by getHits(), and HFShowerFibreBundle().

int HFShowerFibreBundle::indexF
private

Definition at line 39 of file HFShowerFibreBundle.h.

Referenced by getHits(), and getRadius().

int HFShowerFibreBundle::indexR
private

Definition at line 39 of file HFShowerFibreBundle.h.

Referenced by getHits(), and getRadius().

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

Definition at line 41 of file HFShowerFibreBundle.h.

Referenced by getHits(), and HFShowerFibreBundle().

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

Definition at line 42 of file HFShowerFibreBundle.h.

Referenced by getHits(), and HFShowerFibreBundle().

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

Definition at line 41 of file HFShowerFibreBundle.h.

Referenced by getHits(), and HFShowerFibreBundle().

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

Definition at line 42 of file HFShowerFibreBundle.h.

Referenced by getHits(), and HFShowerFibreBundle().

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

Definition at line 40 of file HFShowerFibreBundle.h.

Referenced by getRadius(), and initRun().