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 | Friends
MSLayersKeeperX0AtEta Class Reference

#include <MSLayersKeeperX0AtEta.h>

Inheritance diagram for MSLayersKeeperX0AtEta:
MSLayersKeeper

Public Member Functions

virtual void init (const edm::EventSetup &iSetup)
 
virtual const MSLayersAtAnglelayers (float cotTheta) const
 
 MSLayersKeeperX0AtEta ()
 
virtual ~MSLayersKeeperX0AtEta ()
 
- Public Member Functions inherited from MSLayersKeeper
virtual MSLayer layer (const DetLayer *dl) const
 
virtual ~MSLayersKeeper ()
 

Private Member Functions

float eta (int idxBin) const
 
int idxBin (float eta) const
 
void setX0 (std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &) const
 

Private Attributes

bool isInitialised
 
float theDeltaEta
 
int theHalfNBins
 
std::vector< MSLayersAtAngletheLayersData
 

Friends

class MSLayersKeeperX0Averaged
 

Additional Inherited Members

- Protected Types inherited from MSLayersKeeper
typedef MSLayer::DataX0 DataX0
 
- Protected Member Functions inherited from MSLayersKeeper
const DataX0getDataX0 (const MSLayer &l) const
 
void setDataX0 (MSLayer &l, DataX0 x0Data) const
 

Detailed Description

Definition at line 9 of file MSLayersKeeperX0AtEta.h.

Constructor & Destructor Documentation

MSLayersKeeperX0AtEta::MSLayersKeeperX0AtEta ( )
inline

Definition at line 11 of file MSLayersKeeperX0AtEta.h.

11 : isInitialised(false) { }
virtual MSLayersKeeperX0AtEta::~MSLayersKeeperX0AtEta ( )
inlinevirtual

Definition at line 12 of file MSLayersKeeperX0AtEta.h.

12 { }

Member Function Documentation

float MSLayersKeeperX0AtEta::eta ( int  idxBin) const
private

Definition at line 16 of file MSLayersKeeperX0AtEta.cc.

int MSLayersKeeperX0AtEta::idxBin ( float  eta) const
private

Definition at line 20 of file MSLayersKeeperX0AtEta.cc.

References alignCSCRings::e, and max().

21 {
22  float ieta = eta/theDeltaEta;
23  if ( fabs(ieta) >= theHalfNBins - 1.e-3)
24  return (eta>0) ? max(2*theHalfNBins-1,0) : 0;
25  else
26  return int(ieta+theHalfNBins);
27 }
float eta(int idxBin) const
const T & max(const T &a, const T &b)
void MSLayersKeeperX0AtEta::init ( const edm::EventSetup iSetup)
virtual

Reimplemented from MSLayersKeeper.

Definition at line 30 of file MSLayersKeeperX0AtEta.cc.

References newFWLiteAna::bin, eta(), jptDQMConfig_cff::etaMax, MSLayersAtAngle::findLayer(), newFWLiteAna::found, makeLayoutFileForGui::layout, geometryCSVtoXML::line, max(), MultipleScatteringX0Data::maxEta(), MultipleScatteringX0Data::nBinsEta(), python.multivaluedict::sort(), detailsBasic3DVector::z, and zero.

Referenced by MSLayersKeeperX0Averaged::init().

31 {
32  if (isInitialised) return;
33  isInitialised = true;
34  const float BIG = 99999.;
35 
36  // set size from data file
37  MultipleScatteringX0Data msX0data;
38  theHalfNBins = msX0data.nBinsEta();
39  float etaMax = msX0data.maxEta();
40  theDeltaEta = (theHalfNBins!=0) ? etaMax/theHalfNBins : BIG;
41 
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);
47 
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);
53  theLayersData[idxbin] = MSLayersAtAngle(layers);
54  PixelRecoPointRZ zero(0.,0.);
55  PixelRecoLineRZ line( zero, cotTheta);
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);
63  }
64  }
65 
66  // add layers not seen from nominal vertex but crossed if
67  // vertex seperated from nominal by less than 3 sigma
68  for (int idxbin = 0; idxbin < 2*theHalfNBins; idxbin++) {
69  float etaValue = eta(idxbin);
70  for (int isign=-1; isign <=1; isign+=2) {
71  float z = isign*15.9; //3 sigma from zero
72  const MSLayersAtAngle & layersAtAngle = theLayersData[idxbin];
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;
77  const MSLayer * found = 0;
78  int bin = idxbin;
79  while(!found) {
80  bin--; if (bin < 0) break;
81  found = theLayersData[bin].findLayer(*it);
82  }
83  bin = idxbin;
84  while(!found) {
85  bin++; if (bin > 2*theHalfNBins-1) break;
86  found = theLayersData[bin].findLayer(*it);
87  }
88  if (found) theLayersData[idxbin].update(*found);
89  }
90  }
91  }
92 
93 // cout << "LAYERS, size=: "<<theLayersData.size()<< endl;
94 /*
95  for (int idxbin = 0; idxbin <= theHalfNBins; idxbin+=25) {
96  float etaValue = eta(idxbin);
97  const MSLayersAtAngle & layers= theLayersData[idxbin];
98  cout << "ETA: "<< etaValue <<" (bin:"<<idxbin<<") #layers:"
99  <<layers.size()<<endl;
100  layers.print();
101  }
102  for (int idxbin = 2*theHalfNBins-1; idxbin > theHalfNBins; idxbin-=25) {
103  float etaValue = eta(idxbin);
104  const MSLayersAtAngle & layers= theLayersData[idxbin];
105  cout << "ETA: "<< etaValue <<" (bin:"<<idxbin<<") #layers:"
106  <<layers.size()<<endl;
107  layers.print();
108  }
109 */
110 }
MSLayer::DataX0 DataX0
double double double z
float eta(int idxBin) const
const T & max(const T &a, const T &b)
virtual const MSLayersAtAngle & layers(float cotTheta) const
const DataX0 & getDataX0(const MSLayer &l) const
void setX0(std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &) const
const MSLayer * findLayer(const MSLayer &layer) const
void setDataX0(MSLayer &l, DataX0 x0Data) const
std::vector< MSLayersAtAngle > theLayersData
const MSLayersAtAngle & MSLayersKeeperX0AtEta::layers ( float  cotTheta) const
virtual

Implements MSLayersKeeper.

Definition at line 9 of file MSLayersKeeperX0AtEta.cc.

References eta().

Referenced by MSLayersKeeperX0Averaged::init().

10 {
11  float eta = asinh(cotTheta);
12  return theLayersData[idxBin(eta)];
13 }
float eta(int idxBin) const
int idxBin(float eta) const
std::vector< MSLayersAtAngle > theLayersData
void MSLayersKeeperX0AtEta::setX0 ( std::vector< MSLayer > &  layers,
float  eta,
const SumX0AtEtaDataProvider sumX0 
) const
private

Definition at line 113 of file MSLayersKeeperX0AtEta.cc.

References GeomDetEnumerators::barrel, geometryCSVtoXML::line, funct::sqr(), mathSSE::sqrt(), and SumX0AtEtaDataProvider::sumX0atEta().

117 {
118  const float BIG = 99999.;
119  float cotTheta = sinh(eta);
120  float sinTheta = 1/sqrt(1+sqr(cotTheta));
121  float cosTheta = cotTheta*sinTheta;
122 
123  float sumX0atAngleLast = 0.;
124  vector<MSLayer>::iterator il;
125  for (il = layers.begin(); il != layers.end(); il++) {
126  PixelRecoLineRZ line(PixelRecoPointRZ(0.,0.), cotTheta);
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);
131 
132  float dX0 = (il->face() == GeomDetEnumerators::barrel) ?
133  (sumX0atAngle - sumX0atAngleLast)*sinTheta
134  : (sumX0atAngle - sumX0atAngleLast)* fabs(cosTheta);
135 
136  setDataX0(*il,DataX0(dX0,0,cotTheta) );
137  sumX0atAngleLast = sumX0atAngle;
138  }
139 }
MSLayer::DataX0 DataX0
virtual float sumX0atEta(float eta, float r) const =0
float eta(int idxBin) const
T sqrt(T t)
Definition: SSEVec.h:46
virtual const MSLayersAtAngle & layers(float cotTheta) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13
void setDataX0(MSLayer &l, DataX0 x0Data) const

Friends And Related Function Documentation

friend class MSLayersKeeperX0Averaged
friend

Definition at line 25 of file MSLayersKeeperX0AtEta.h.

Member Data Documentation

bool MSLayersKeeperX0AtEta::isInitialised
private

Definition at line 22 of file MSLayersKeeperX0AtEta.h.

float MSLayersKeeperX0AtEta::theDeltaEta
private

Definition at line 23 of file MSLayersKeeperX0AtEta.h.

int MSLayersKeeperX0AtEta::theHalfNBins
private

Definition at line 23 of file MSLayersKeeperX0AtEta.h.

Referenced by MSLayersKeeperX0Averaged::init().

std::vector<MSLayersAtAngle> MSLayersKeeperX0AtEta::theLayersData
private

Definition at line 24 of file MSLayersKeeperX0AtEta.h.

Referenced by MSLayersKeeperX0Averaged::init().