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 | Static Private Member Functions | Private Attributes | Friends
MSLayersKeeperX0AtEta Class Reference

#include <MSLayersKeeperX0AtEta.h>

Inheritance diagram for MSLayersKeeperX0AtEta:
MSLayersKeeper

Public Member Functions

void init (const edm::EventSetup &iSetup)
 
const MSLayersAtAnglelayers (float cotTheta) const
 
 MSLayersKeeperX0AtEta ()
 
 ~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
 

Static Private Member Functions

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

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
 
- Static Protected Member Functions inherited from MSLayersKeeper
static const DataX0getDataX0 (const MSLayer &l)
 
static void setDataX0 (MSLayer &l, const DataX0 &x0Data)
 

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) { }
MSLayersKeeperX0AtEta::~MSLayersKeeperX0AtEta ( )
inline

Definition at line 12 of file MSLayersKeeperX0AtEta.h.

12 { }

Member Function Documentation

float MSLayersKeeperX0AtEta::eta ( int  idxBin) const
private
int MSLayersKeeperX0AtEta::idxBin ( float  eta) const
private

Definition at line 27 of file MSLayersKeeperX0AtEta.cc.

References funct::abs(), alignCSCRings::e, and bookConverter::max.

28 {
29  float ieta = eta/theDeltaEta;
30  if ( std::abs(ieta) >= theHalfNBins - 1.e-3)
31  return (eta>0) ? max(2*theHalfNBins-1,0) : 0;
32  else
33  return int(ieta+theHalfNBins);
34 }
float eta(int idxBin) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void MSLayersKeeperX0AtEta::init ( const edm::EventSetup iSetup)
virtual

Reimplemented from MSLayersKeeper.

Definition at line 37 of file MSLayersKeeperX0AtEta.cc.

References newFWLiteAna::bin, objects.IsoTrackAnalyzer::candidates, eta, HLT_25ns14e33_v1_cff::etaMax, MSLayersAtAngle::findLayer(), newFWLiteAna::found, LayerTriplets::layers(), makeLayoutFileForGui::layout, geometryCSVtoXML::line, bookConverter::max, MultipleScatteringX0Data::maxEta(), MultipleScatteringX0Data::nBinsEta(), and python.multivaluedict::sort().

Referenced by MSLayersKeeperX0Averaged::init().

38 {
39  if (isInitialised) return;
40  isInitialised = true;
41  const float BIG = 99999.;
42 
43  // set size from data file
44  MultipleScatteringX0Data msX0data;
45  theHalfNBins = msX0data.nBinsEta();
46  float etaMax = msX0data.maxEta();
47  theDeltaEta = (theHalfNBins!=0) ? etaMax/theHalfNBins : BIG;
48 
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);
54 
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);
60  theLayersData[idxbin] = MSLayersAtAngle(layers);
61  PixelRecoPointRZ zero(0.,0.);
62  PixelRecoLineRZ line( zero, cotTheta);
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);
70  }
71  }
72 
73  // add layers not seen from nominal vertex but crossed if
74  // vertex seperated from nominal by less than 3 sigma
75  for (int idxbin = 0; idxbin < 2*theHalfNBins; idxbin++) {
76  float etaValue = eta(idxbin);
77  for (int isign=-1; isign <=1; isign+=2) {
78  float z = isign*15.9; //3 sigma from zero
79  const MSLayersAtAngle & layersAtAngle = theLayersData[idxbin];
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;
84  const MSLayer * found = 0;
85  int bin = idxbin;
86  while(!found) {
87  bin--; if (bin < 0) break;
88  found = theLayersData[bin].findLayer(*it);
89  }
90  bin = idxbin;
91  while(!found) {
92  bin++; if (bin > 2*theHalfNBins-1) break;
93  found = theLayersData[bin].findLayer(*it);
94  }
95  if (found) theLayersData[idxbin].update(*found);
96  }
97  }
98  }
99 
100 // cout << "LAYERS, size=: "<<theLayersData.size()<< endl;
101 /*
102  for (int idxbin = 0; 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  for (int idxbin = 2*theHalfNBins-1; idxbin > theHalfNBins; idxbin-=25) {
110  float etaValue = eta(idxbin);
111  const MSLayersAtAngle & layers= theLayersData[idxbin];
112  cout << "ETA: "<< etaValue <<" (bin:"<<idxbin<<") #layers:"
113  <<layers.size()<<endl;
114  layers.print();
115  }
116 */
117 }
MSLayer::DataX0 DataX0
static void setDataX0(MSLayer &l, const DataX0 &x0Data)
float eta(int idxBin) const
const MSLayersAtAngle & layers(float cotTheta) const
static const DataX0 & getDataX0(const MSLayer &l)
static void setX0(std::vector< MSLayer > &, float eta, const SumX0AtEtaDataProvider &)
const MSLayer * findLayer(const MSLayer &layer) const
std::vector< MSLayersAtAngle > theLayersData
const MSLayersAtAngle & MSLayersKeeperX0AtEta::layers ( float  cotTheta) const
virtual

Implements MSLayersKeeper.

Definition at line 16 of file MSLayersKeeperX0AtEta.cc.

References eta.

Referenced by MSLayersKeeperX0Averaged::init().

17 {
18  float eta = unsafe_asinhf(cotTheta);
19  return theLayersData[idxBin(eta)];
20 }
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 
)
staticprivate

Definition at line 120 of file MSLayersKeeperX0AtEta.cc.

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

124 {
125  const float BIG = 99999.;
126  float cotTheta = sinh(eta);
127  float sinTheta = 1/sqrt(1+sqr(cotTheta));
128  float cosTheta = cotTheta*sinTheta;
129 
130  float sumX0atAngleLast = 0.;
131  vector<MSLayer>::iterator il;
132  for (il = layers.begin(); il != layers.end(); il++) {
133  PixelRecoLineRZ line(PixelRecoPointRZ(0.,0.), cotTheta);
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);
138 
139  float dX0 = (il->face() == GeomDetEnumerators::barrel) ?
140  (sumX0atAngle - sumX0atAngleLast)*sinTheta
141  : (sumX0atAngle - sumX0atAngleLast)* fabs(cosTheta);
142 
143  setDataX0(*il,DataX0(dX0,0,cotTheta) );
144  sumX0atAngleLast = sumX0atAngle;
145  }
146 }
MSLayer::DataX0 DataX0
virtual float sumX0atEta(float eta, float r) const =0
static void setDataX0(MSLayer &l, const DataX0 &x0Data)
float eta(int idxBin) const
T sqrt(T t)
Definition: SSEVec.h:48
const MSLayersAtAngle & layers(float cotTheta) const
Square< F >::type sqr(const F &f)
Definition: Square.h:13

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().