6 template <
class T>
T sqr(
T t) {
return t*
t;}
11 float eta = asinh(cotTheta);
12 return theLayersData[idxBin(eta)];
17 {
return (idxBin+0.5-theHalfNBins)*theDeltaEta; }
22 float ieta = eta/theDeltaEta;
23 if ( fabs(ieta) >= theHalfNBins - 1.
e-3)
24 return (eta>0) ?
max(2*theHalfNBins-1,0) : 0;
26 return int(ieta+theHalfNBins);
32 if (isInitialised)
return;
34 const float BIG = 99999.;
40 theDeltaEta = (theHalfNBins!=0) ? etaMax/theHalfNBins : BIG;
42 theLayersData = vector<MSLayersAtAngle>(
max(2*theHalfNBins, 1));
44 for (
int idxbin = 0; idxbin < 2*theHalfNBins; idxbin++) {
45 float etaValue =
eta(idxbin);
46 float cotTheta = sinh(etaValue);
48 vector<MSLayer> layers = layout.detLayers(etaValue,0,iSetup);
49 vector<MSLayer> tmplay = layout.otherLayers(etaValue,iSetup);
50 layers.insert(layers.end(),tmplay.begin(),tmplay.end());
51 sort(layers.begin(), layers.end());
52 setX0(layers, etaValue, msX0data);
56 vector<MSLayer>::iterator it;
57 for (it = layers.begin(); it != layers.end(); it++) {
58 float x0 = getDataX0(*it).x0;
59 float sumX0D = theLayersData[idxbin].sumX0D(zero,
60 it->crossing(line).first);
61 setDataX0(*it,
DataX0(x0, sumX0D, cotTheta));
62 theLayersData[idxbin].update(*it);
68 for (
int idxbin = 0; idxbin < 2*theHalfNBins; idxbin++) {
69 float etaValue =
eta(idxbin);
70 for (
int isign=-1; isign <=1; isign+=2) {
73 vector<MSLayer> candidates = layout.detLayers( etaValue, z,iSetup);
74 vector<MSLayer>::iterator it;
75 for (it = candidates.begin(); it != candidates.end(); it++) {
76 if (layersAtAngle.
findLayer(*it))
continue;
80 bin--;
if (bin < 0)
break;
81 found = theLayersData[
bin].findLayer(*it);
85 bin++;
if (bin > 2*theHalfNBins-1)
break;
86 found = theLayersData[
bin].findLayer(*it);
88 if (found) theLayersData[idxbin].update(*found);
114 vector<MSLayer>& layers,
118 const float BIG = 99999.;
119 float cotTheta = sinh(eta);
120 float sinTheta = 1/
sqrt(1+
sqr(cotTheta));
121 float cosTheta = cotTheta*sinTheta;
123 float sumX0atAngleLast = 0.;
124 vector<MSLayer>::iterator il;
125 for (il = layers.begin(); il != layers.end(); il++) {
127 float rL= (*il).crossing(line).first.r();
128 float rN = (il+1 != layers.end()) ? (il+1)->crossing(line).first.r() : BIG;
129 float rBound = (rL+rN)/2.;
130 float sumX0atAngle = sumX0.
sumX0atEta(eta,rBound);
133 (sumX0atAngle - sumX0atAngleLast)*sinTheta
134 : (sumX0atAngle - sumX0atAngleLast)* fabs(cosTheta);
136 setDataX0(*il,
DataX0(dX0,0,cotTheta) );
137 sumX0atAngleLast = sumX0atAngle;
virtual float sumX0atEta(float eta, float r) const =0
float eta(int idxBin) const
const T & max(const T &a, const T &b)
virtual const MSLayersAtAngle & layers(float cotTheta) const
Square< F >::type sqr(const F &f)
int idxBin(float eta) const
void setX0(std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &) const
virtual void init(const edm::EventSetup &iSetup)
const MSLayer * findLayer(const MSLayer &layer) const