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 (const G4ThreeVector &point, int depth, int fromEndAbs=0)
 
double zShift (const 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 19 of file HFFibre.cc.

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

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

Definition at line 112 of file HFFibre.cc.

112 {}

Member Function Documentation

double HFFibre::attLength ( double  lambda)

Definition at line 114 of file HFFibre.cc.

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

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

114  {
115 
116  int i = int(nBinAtt*(lambda - lambLim[0])/(lambLim[1]-lambLim[0]));
117 
118  int j =i;
119  if (i >= nBinAtt)
120  j = nBinAtt-1;
121  else if (i < 0)
122  j = 0;
123  double att = attL[j];
124 #ifdef DebugLog
125  edm::LogInfo("HFShower") << "HFFibre::attLength for Lambda " << lambda
126  << " index " << i << " " << j << " Att. Length "
127  << att;
128 #endif
129  return att;
130 }
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 181 of file HFFibre.cc.

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

Referenced by HFFibre().

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

Definition at line 132 of file HFFibre.cc.

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

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

132  {
133 
134  double zFibre = zShift(point, depth, fromEndAbs);
135  double time = zFibre/cFibre;
136 #ifdef DebugLog
137  edm::LogInfo("HFShower") << "HFFibre::tShift for point " << point
138  << " ( depth = " << depth <<", traversed length = "
139  << zFibre/cm << " cm) = " << time/ns << " ns";
140 #endif
141  return time;
142 }
double zShift(const G4ThreeVector &point, int depth, int fromEndAbs=0)
Definition: HFFibre.cc:144
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 ( const G4ThreeVector &  point,
int  depth,
int  fromEndAbs = 0 
)

Definition at line 144 of file HFFibre.cc.

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

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

144  { // point is z-local
145 
146  double zFibre = 0;
147  double hR = sqrt((point.x())*(point.x())+(point.y())*(point.y()));
148  int ieta = 0;
149  double length = 250*cm;
150  if (fromEndAbs < 0) {
151  zFibre = 0.5*gpar[1] - point.z(); // Never, as fromEndAbs=0 (?)
152  } else {
153  // Defines the Radius bin by radial subdivision
154  for (int i = nBinR-1; i > 0; --i) if (hR < radius[i]) ieta = nBinR - i - 1;
155  // define the length of the fibre
156  if (depth == 2) {
157  if ((int)(shortFL.size()) > ieta) length = shortFL[ieta];
158  } else {
159  if ((int)(longFL.size()) > ieta) length = longFL[ieta];
160  }
161  zFibre = length;
162  if (fromEndAbs > 0) {
163  zFibre -= gpar[1]; // Never, as fromEndAbs=0 (M.K. ?)
164  } else {
165  double zz = 0.5*gpar[1] + point.z();
166  zFibre -= zz;
167  }
168  if (depth == 2) zFibre += gpar[0]; // here zFibre is reduced for Short
169  }
170 
171 #ifdef DebugLog
172  edm::LogInfo("HFShower") << "HFFibre::zShift for point " << point
173  << " (R = " << hR/cm << " cm, Index = " << ieta
174  << ", depth = " << depth << ", Fibre Length = "
175  << length/cm << " cm = " << zFibre/cm
176  << " cm)";
177 #endif
178  return zFibre;
179 }
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:48
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().