CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
HFFibre Class Reference

#include <HFFibre.h>

Public Member Functions

double attLength (double lambda)
 
 HFFibre (std::string &name, const DDCompactView &cpv, edm::ParameterSet const &p)
 
double tShift (G4ThreeVector point, int depth, int fromEndAbs=0)
 
double zShift (G4ThreeVector point, int depth, int fromEndAbs=0)
 
 ~HFFibre ()
 

Protected Member Functions

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

Private Attributes

std::vector< double > attL
 
double cFibre
 
std::vector< double > gpar
 
double lambLim [2]
 
std::vector< double > longFL
 
int nBinAtt
 
int nBinR
 
std::vector< double > radius
 
std::vector< double > shortFL
 

Detailed Description

Definition at line 19 of file HFFibre.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file HFFibre.cc.

References DDFilteredView::addFilter(), attL, cFibre, DDSpecificsFilter::equals, edm::hlt::Exception, DDFilteredView::firstChild(), getDDDArray(), edm::ParameterSet::getParameter(), gpar, i, lambLim, longFL, DDFilteredView::mergedSpecifics(), mergeVDriftHistosByStation::name, nBinAtt, nBinR, radius, DDSpecificsFilter::setCriteria(), shortFL, and relativeConstraints::value.

19  {
20 
21  edm::ParameterSet m_HF = p.getParameter<edm::ParameterSet>("HFShower");
22  cFibre = c_light*(m_HF.getParameter<double>("CFibre"));
23 
24  edm::LogInfo("HFShower") << "HFFibre:: Speed of light in fibre " << cFibre
25  << " m/ns";
26 
27  std::string attribute = "Volume";
28  std::string value = "HF";
29  DDSpecificsFilter filter1;
30  DDValue ddv1(attribute,value,0);
32  DDFilteredView fv1(cpv);
33  fv1.addFilter(filter1);
34  bool dodet = fv1.firstChild();
35 
36  if (dodet) {
37  DDsvalues_type sv(fv1.mergedSpecifics());
38 
39  // Attenuation length
40  nBinAtt = -1;
41  attL = getDDDArray("attl",sv,nBinAtt);
42  edm::LogInfo("HFShower") << "HFFibre: " << nBinAtt << " attL ";
43  for (int it=0; it<nBinAtt; it++)
44  edm::LogInfo("HFShower") << "HFFibre: attL[" << it << "] = "
45  << attL[it]*cm << "(1/cm)";
46 
47  // Limits on Lambda
48  int nb = 2;
49  std::vector<double> nvec = getDDDArray("lambLim",sv,nb);
50  lambLim[0] = static_cast<int>(nvec[0]);
51  lambLim[1] = static_cast<int>(nvec[1]);
52  edm::LogInfo("HFShower") << "HFFibre: Limits on lambda " << lambLim[0]
53  << " and " << lambLim[1];
54 
55  // Fibre Lengths
56  nb = 0;
57  longFL = getDDDArray("LongFL",sv,nb);
58  edm::LogInfo("HFShower") << "HFFibre: " << nb << " Long Fibre Length";
59  for (int it=0; it<nb; it++)
60  edm::LogInfo("HFShower") << "HFFibre: longFL[" << it << "] = "
61  << longFL[it]/cm << " cm";
62  nb = 0;
63  shortFL = getDDDArray("ShortFL",sv,nb);
64  edm::LogInfo("HFShower") << "HFFibre: " << nb << " Short Fibre Length";
65  for (int it=0; it<nb; it++)
66  edm::LogInfo("HFShower") << "HFFibre: shortFL[" << it << "] = "
67  << shortFL[it]/cm << " cm";
68  } else {
69  edm::LogError("HFShower") << "HFFibre: cannot get filtered "
70  << " view for " << attribute << " matching "
71  << name;
72  throw cms::Exception("Unknown", "HFFibre")
73  << "cannot match " << attribute << " to " << name <<"\n";
74  }
75 
76  // Now geometry parameters
77  attribute = "ReadOutName";
78  value = name;
79  DDSpecificsFilter filter2;
80  DDValue ddv2(attribute,value,0);
82  DDFilteredView fv2(cpv);
83  fv2.addFilter(filter2);
84  dodet = fv2.firstChild();
85  if (dodet) {
86  DDsvalues_type sv(fv2.mergedSpecifics());
87 
88  //Special Geometry parameters
89  int nb = -1;
90  gpar = getDDDArray("gparHF",sv,nb);
91  edm::LogInfo("HFShower") << "HFFibre: " << nb <<" gpar (cm)";
92  for (int i=0; i<nb; i++)
93  edm::LogInfo("HFShower") << "HFFibre: gpar[" << i << "] = "
94  << gpar[i]/cm << " cm";
95 
96  nBinR = -1;
97  radius = getDDDArray("rTable",sv,nBinR);
98  edm::LogInfo("HFShower") << "HFFibre: " << nBinR <<" rTable (cm)";
99  for (int i=0; i<nBinR; i++)
100  edm::LogInfo("HFShower") << "HFFibre: radius[" << i << "] = "
101  << radius[i]/cm << " cm";
102  } else {
103  edm::LogError("HFShower") << "HFFibre: cannot get filtered "
104  << " view for " << attribute << " matching "
105  << name;
106  throw cms::Exception("Unknown", "HFFibre")
107  << "cannot match " << attribute << " to " << name <<"\n";
108  }
109 }
std::vector< double > gpar
Definition: HFFibre.h:42
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, int &)
Definition: HFFibre.cc:180
double lambLim[2]
Definition: HFFibre.h:46
int nBinAtt
Definition: HFFibre.h:45
std::vector< double > radius
Definition: HFFibre.h:42
double cFibre
Definition: HFFibre.h:41
int nBinR
Definition: HFFibre.h:45
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< double > shortFL
Definition: HFFibre.h:43
std::vector< double > attL
Definition: HFFibre.h:44
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
std::vector< double > longFL
Definition: HFFibre.h:43
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
HFFibre::~HFFibre ( )

Definition at line 111 of file HFFibre.cc.

111 {}

Member Function Documentation

double HFFibre::attLength ( double  lambda)

Definition at line 113 of file HFFibre.cc.

References attL, i, j, lambLim, and nBinAtt.

Referenced by HFShower::getHits(), HFShowerLibrary::getHits(), and HFShowerParam::HFShowerParam().

113  {
114 
115  int i = int(nBinAtt*(lambda - lambLim[0])/(lambLim[1]-lambLim[0]));
116 
117  int j =i;
118  if (i >= nBinAtt)
119  j = nBinAtt-1;
120  else if (i < 0)
121  j = 0;
122  double att = attL[j];
123 #ifdef DebugLog
124  edm::LogInfo("HFShower") << "HFFibre::attLength for Lambda " << lambda
125  << " index " << i << " " << j << " Att. Length "
126  << att;
127 #endif
128  return att;
129 }
int i
Definition: DBlmapReader.cc:9
double lambLim[2]
Definition: HFFibre.h:46
int nBinAtt
Definition: HFFibre.h:45
int j
Definition: DBlmapReader.cc:9
std::vector< double > attL
Definition: HFFibre.h:44
std::vector< double > HFFibre::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
int &  nmin 
)
protected

Definition at line 180 of file HFFibre.cc.

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

Referenced by HFFibre().

182  {
183 
184 #ifdef DebugLog
185  LogDebug("HFShower") << "HFFibre:getDDDArray called for " << str
186  << " with nMin " << nmin;
187 #endif
188  DDValue value(str);
189  if (DDfetch(&sv,value)) {
190 #ifdef DebugLog
191  LogDebug("HFShower") << value;
192 #endif
193  const std::vector<double> & fvec = value.doubles();
194  int nval = fvec.size();
195  if (nmin > 0) {
196  if (nval < nmin) {
197  edm::LogError("HFShower") << "HFFibre : # of " << str << " bins "
198  << nval << " < " << nmin << " ==> illegal";
199  throw cms::Exception("Unknown", "HFFibre")
200  << "nval < nmin for array " << str <<"\n";
201  }
202  } else {
203  if (nval < 1 && nmin != 0) {
204  edm::LogError("HFShower") << "HFFibre : # of " << str << " bins "
205  << nval << " < 1 ==> illegal (nmin="
206  << nmin << ")";
207  throw cms::Exception("Unknown", "HFFibre")
208  << "nval < 1 for array " << str <<"\n";
209  }
210  }
211  nmin = nval;
212  return fvec;
213  } else {
214  if (nmin != 0) {
215  edm::LogError("HFShower") << "HFFibre : cannot get array " << str;
216  throw cms::Exception("Unknown", "HFFibre")
217  << "cannot get array " << str <<"\n";
218  } else {
219  std::vector<double> fvec;
220  return fvec;
221  }
222  }
223 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:102
double HFFibre::tShift ( G4ThreeVector  point,
int  depth,
int  fromEndAbs = 0 
)

Definition at line 131 of file HFFibre.cc.

References cFibre, cond::rpcobgas::time, and zShift().

Referenced by HFShower::getHits(), HFShowerParam::getHits(), and HFShowerLibrary::getHits().

131  {
132 
133  double zFibre = zShift(point, depth, fromEndAbs);
134  double time = zFibre/cFibre;
135 #ifdef DebugLog
136  edm::LogInfo("HFShower") << "HFFibre::tShift for point " << point
137  << " ( depth = " << depth <<", traversed length = "
138  << zFibre/cm << " cm) = " << time/ns << " ns";
139 #endif
140  return time;
141 }
double zShift(G4ThreeVector point, int depth, int fromEndAbs=0)
Definition: HFFibre.cc:143
double cFibre
Definition: HFFibre.h:41
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
double HFFibre::zShift ( G4ThreeVector  point,
int  depth,
int  fromEndAbs = 0 
)

Definition at line 143 of file HFFibre.cc.

References gpar, i, longFL, nBinR, radius, shortFL, and mathSSE::sqrt().

Referenced by HFShowerParam::getHits(), HFShowerLibrary::getHits(), and tShift().

143  { // point is z-local
144 
145  double zFibre = 0;
146  double hR = sqrt((point.x())*(point.x())+(point.y())*(point.y()));
147  int ieta = 0;
148  double length = 250*cm;
149  if (fromEndAbs < 0) {
150  zFibre = 0.5*gpar[1] - point.z(); // Never, as fromEndAbs=0 (?)
151  } else {
152  // Defines the Radius bin by radial subdivision
153  for (int i = nBinR-1; i > 0; --i) if (hR < radius[i]) ieta = nBinR - i - 1;
154  // define the length of the fibre
155  if (depth == 2) {
156  if ((int)(shortFL.size()) > ieta) length = shortFL[ieta];
157  } else {
158  if ((int)(longFL.size()) > ieta) length = longFL[ieta];
159  }
160  zFibre = length;
161  if (fromEndAbs > 0) {
162  zFibre -= gpar[1]; // Never, as fromEndAbs=0 (M.K. ?)
163  } else {
164  double zz = 0.5*gpar[1] + point.z();
165  zFibre -= zz;
166  }
167  if (depth == 2) zFibre += gpar[0]; // here zFibre is reduced for Short
168  }
169 
170 #ifdef DebugLog
171  edm::LogInfo("HFShower") << "HFFibre::zShift for point " << point
172  << " (R = " << hR/cm << " cm, Index = " << ieta
173  << ", depth = " << depth << ", Fibre Length = "
174  << length/cm << " cm = " << zFibre/cm
175  << " cm)";
176 #endif
177  return zFibre;
178 }
std::vector< double > gpar
Definition: HFFibre.h:42
int i
Definition: DBlmapReader.cc:9
std::vector< double > radius
Definition: HFFibre.h:42
int nBinR
Definition: HFFibre.h:45
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< double > shortFL
Definition: HFFibre.h:43
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
std::vector< double > longFL
Definition: HFFibre.h:43

Member Data Documentation

std::vector<double> HFFibre::attL
private

Definition at line 44 of file HFFibre.h.

Referenced by attLength(), and HFFibre().

double HFFibre::cFibre
private

Definition at line 41 of file HFFibre.h.

Referenced by HFFibre(), and tShift().

std::vector<double> HFFibre::gpar
private

Definition at line 42 of file HFFibre.h.

Referenced by HFFibre(), and zShift().

double HFFibre::lambLim[2]
private

Definition at line 46 of file HFFibre.h.

Referenced by attLength(), and HFFibre().

std::vector<double> HFFibre::longFL
private

Definition at line 43 of file HFFibre.h.

Referenced by HFFibre(), and zShift().

int HFFibre::nBinAtt
private

Definition at line 45 of file HFFibre.h.

Referenced by attLength(), and HFFibre().

int HFFibre::nBinR
private

Definition at line 45 of file HFFibre.h.

Referenced by HFFibre(), and zShift().

std::vector<double> HFFibre::radius
private

Definition at line 42 of file HFFibre.h.

Referenced by HFFibre(), and zShift().

std::vector<double> HFFibre::shortFL
private

Definition at line 43 of file HFFibre.h.

Referenced by HFFibre(), and zShift().