10 template <
class T>
inline T sqr(
T t) {
return t*
t;}
12 inline float unsafe_asinhf(
float x) {
return unsafe_logf<3>(x+
std::sqrt(1.
f+x*x)); }
18 float eta = unsafe_asinhf(cotTheta);
19 return theLayersData[idxBin(eta)];
24 {
return (idxBin+0.5-theHalfNBins)*theDeltaEta; }
29 float ieta = eta/theDeltaEta;
30 if (
std::abs(ieta) >= theHalfNBins - 1.
e-3)
31 return (eta>0) ?
max(2*theHalfNBins-1,0) : 0;
33 return int(ieta+theHalfNBins);
39 if (isInitialised)
return;
41 const float BIG = 99999.;
47 theDeltaEta = (theHalfNBins!=0) ? etaMax/theHalfNBins : BIG;
49 theLayersData = vector<MSLayersAtAngle>(
max(2*theHalfNBins, 1));
51 for (
int idxbin = 0; idxbin < 2*theHalfNBins; idxbin++) {
52 float etaValue =
eta(idxbin);
53 float cotTheta = sinh(etaValue);
55 vector<MSLayer>
layers = layout.detLayers(etaValue,0,iSetup);
56 vector<MSLayer> tmplay = layout.otherLayers(etaValue,iSetup);
57 layers.insert(layers.end(),tmplay.begin(),tmplay.end());
58 sort(layers.begin(), layers.end());
59 setX0(layers, etaValue, msX0data);
63 vector<MSLayer>::iterator it;
64 for (it = layers.begin(); it != layers.end(); it++) {
65 float x0 = getDataX0(*it).x0;
66 float sumX0D = theLayersData[idxbin].sumX0D(zero,
67 it->crossing(line).first);
68 setDataX0(*it,
DataX0(x0, sumX0D, cotTheta));
69 theLayersData[idxbin].update(*it);
75 for (
int idxbin = 0; idxbin < 2*theHalfNBins; idxbin++) {
76 float etaValue =
eta(idxbin);
77 for (
int isign=-1; isign <=1; isign+=2) {
80 vector<MSLayer>
candidates = layout.detLayers( etaValue, z,iSetup);
81 vector<MSLayer>::iterator it;
82 for (it = candidates.begin(); it != candidates.end(); it++) {
83 if (layersAtAngle.
findLayer(*it))
continue;
87 bin--;
if (bin < 0)
break;
88 found = theLayersData[
bin].findLayer(*it);
92 bin++;
if (bin > 2*theHalfNBins-1)
break;
93 found = theLayersData[
bin].findLayer(*it);
95 if (found) theLayersData[idxbin].update(*found);
125 const float BIG = 99999.;
126 float cotTheta = sinh(eta);
127 float sinTheta = 1/
sqrt(1+
sqr(cotTheta));
128 float cosTheta = cotTheta*sinTheta;
130 float sumX0atAngleLast = 0.;
131 vector<MSLayer>::iterator il;
132 for (il = layers.begin(); il != layers.end(); il++) {
134 float rL= (*il).crossing(line).first.r();
135 float rN = (il+1 != layers.end()) ? (il+1)->crossing(line).first.r() : BIG;
136 float rBound = (rL+rN)/2.;
137 float sumX0atAngle = sumX0.
sumX0atEta(eta,rBound);
140 (sumX0atAngle - sumX0atAngleLast)*sinTheta
141 : (sumX0atAngle - sumX0atAngleLast)* fabs(cosTheta);
143 setDataX0(*il,
DataX0(dX0,0,cotTheta) );
144 sumX0atAngleLast = sumX0atAngle;
virtual float sumX0atEta(float eta, float r) const =0
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
float eta(int idxBin) const
const MSLayersAtAngle & layers(float cotTheta) const
Abs< T >::type abs(const T &t)
bin
set the eta bin as selection string.
static void setX0(std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &)
Square< F >::type sqr(const F &f)
int idxBin(float eta) const
void init(const edm::EventSetup &iSetup)
const MSLayer * findLayer(const MSLayer &layer) const