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
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 DDFilteredView::addFilter(), cherenkov1, cherenkov2, equals, facCone, facTube, DDFilteredView::firstChild(), getDDDArray(), edm::ParameterSet::getParameter(), cuy::ii, cmsHarvester::index, DDFilteredView::mergedSpecifics(), pmtFib1, pmtFib2, pmtR1, pmtR2, DDSpecificsFilter::setCriteria(), 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  DDSpecificsFilter filter1;
40  DDValue ddv1(attribute,value,0);
41  filter1.setCriteria(ddv1,DDCompOp::equals);
42  DDFilteredView fv1(cpv);
43  fv1.addFilter(filter1);
44  if (fv1.firstChild()) {
45  DDsvalues_type sv1(fv1.mergedSpecifics());
46  std::vector<double> neta;
47  neta = getDDDArray("indexPMTR",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; ifib = index%10;
53  }
54  pmtR1.push_back(ir);
55  pmtFib1.push_back(ifib);
56  }
57  neta = getDDDArray("indexPMTL",sv1);
58  for (unsigned int ii=0; ii<neta.size(); ii++) {
59  int index = static_cast<int>(neta[ii]);
60  int ir=-1, ifib=-1;
61  if (index >= 0) {
62  ir = index/10; ifib = index%10;
63  }
64  pmtR2.push_back(ir);
65  pmtFib2.push_back(ifib);
66  }
67  edm::LogInfo("HFShower") << "HFShowerFibreBundle: gets the Index matches "
68  << "for " << neta.size() << " PMTs";
69  for (unsigned int ii=0; ii<neta.size(); ii++)
70  edm::LogInfo("HFShower") << "HFShowerFibreBundle: rIndexR[" << ii
71  << "] = " << pmtR1[ii] << " fibreR[" << ii
72  << "] = " << pmtFib1[ii] << " rIndexL[" << ii
73  << "] = " << pmtR2[ii] << " fibreL[" << ii
74  << "] = " << pmtFib2[ii];
75  } else {
76  edm::LogWarning("HFShower") << "HFShowerFibreBundle: cannot get filtered "
77  << " view for " << attribute << " matching "
78  << value;
79  }
80 
81 }
T getParameter(std::string const &) const
std::vector< int > pmtFib1
int ii
Definition: cuy.py:588
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:19
std::vector< int > pmtR1
std::vector< int > pmtR2
std::vector< int > pmtFib2
void setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:245
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &)
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
HFShowerFibreBundle::~HFShowerFibreBundle ( )
virtual

Definition at line 83 of file HFShowerFibreBundle.cc.

References cherenkov1, and cherenkov2.

83  {
84  delete cherenkov1;
85  delete cherenkov2;
86 }

Member Function Documentation

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

Definition at line 169 of file HFShowerFibreBundle.cc.

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

Referenced by HFShowerFibreBundle().

170  {
171 
172 #ifdef DebugLog
173  LogDebug("HFShower") << "HFShowerFibreBundle:getDDDArray called for " << str;
174 #endif
175  DDValue value(str);
176  if (DDfetch(&sv,value)) {
177 #ifdef DebugLog
178  LogDebug("HFShower") << value;
179 #endif
180  const std::vector<double> & fvec = value.doubles();
181  int nval = fvec.size();
182  if (nval < 2) {
183  edm::LogError("HFShower") << "HFShowerFibreBundle: # of " << str
184  << " bins " << nval << " < 2 ==> illegal";
185  throw cms::Exception("Unknown", "HFShowerFibreBundle")
186  << "nval < 2 for array " << str << "\n";
187  }
188 
189  return fvec;
190  } else {
191  edm::LogError("HFShower") <<"HFShowerFibreBundle: cannot get array " <<str;
192  throw cms::Exception("Unknown", "HFShowerFibreBundle")
193  << "cannot get array " << str << "\n";
194  }
195 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
double HFShowerFibreBundle::getHits ( G4Step *  aStep,
bool  type 
)

Definition at line 99 of file HFShowerFibreBundle.cc.

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

Referenced by HCalSD::getHitFibreBundle().

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

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

Referenced by HCalSD::getHitFibreBundle().

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

Definition at line 88 of file HFShowerFibreBundle.cc.

References HcalDDDSimConstants::getRTableHF(), and rTable.

Referenced by HCalSD::initRun().

88  {
89 
90  // Special Geometry parameters
91  rTable = hcons->getRTableHF();
92  edm::LogInfo("HFShower") << "HFShowerFibreBundle: " << rTable.size()
93  << " rTable (cm)";
94  for (unsigned int ig=0; ig<rTable.size(); ig++)
95  edm::LogInfo("HFShower") << "HFShowerFibreBundle: rTable[" << ig << "] = "
96  << rTable[ig]/cm << " cm";
97 }
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().