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 Attributes
MSLayersKeeperX0Averaged Class Reference

#include <MSLayersKeeperX0Averaged.h>

Inheritance diagram for MSLayersKeeperX0Averaged:
MSLayersKeeper

Public Member Functions

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

Private Attributes

bool isInitialised
 
MSLayersAtAngle theLayersData
 

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 6 of file MSLayersKeeperX0Averaged.h.

Constructor & Destructor Documentation

MSLayersKeeperX0Averaged::MSLayersKeeperX0Averaged ( )
inline

Definition at line 8 of file MSLayersKeeperX0Averaged.h.

virtual MSLayersKeeperX0Averaged::~MSLayersKeeperX0Averaged ( )
inlinevirtual

Definition at line 9 of file MSLayersKeeperX0Averaged.h.

9 { }

Member Function Documentation

void MSLayersKeeperX0Averaged::init ( const edm::EventSetup iSetup)
virtual

Reimplemented from MSLayersKeeper.

Definition at line 7 of file MSLayersKeeperX0Averaged.cc.

References GeomDetEnumerators::barrel, MultipleScatteringGeometry::detLayers(), GeomDetEnumerators::endcap, eta(), spr::find(), MSLayersAtAngle::findLayer(), relativeConstraints::geom, i, MSLayersKeeperX0AtEta::init(), MSLayersKeeperX0AtEta::layers(), pileupCalc::nbins, MultipleScatteringGeometry::otherLayers(), funct::sin(), slope, mathSSE::sqrt(), MSLayer::sumX0D(), MSLayersKeeperX0AtEta::theHalfNBins, MSLayersKeeperX0AtEta::theLayersData, and MSLayer::x0().

8 {
9  if (isInitialised) return;
10  isInitialised = true;
11 // cout << "HERE INITIALISATION! MSLayersKeeperX0Averaged"<<endl;
12  MSLayersKeeperX0AtEta layersX0Eta;
13  layersX0Eta.init(iSetup);
15  vector<MSLayer> allLayers = geom.detLayers(iSetup);
16  vector<MSLayer>::iterator it;
17  for (int i=-1;i<=1;i++) {
18  float eta = i*(-1.8);
19  vector<MSLayer> tmpLayers = geom.otherLayers(eta,iSetup);
20  vector<MSLayer>::const_iterator ic;
21  for (ic = tmpLayers.begin(); ic != tmpLayers.end(); ic++) {
22  it = find(allLayers.begin(), allLayers.end(), *ic);
23  if (it == allLayers.end()) allLayers.push_back(*ic);
24  }
25  }
26 
27 
28 
29 for (it = allLayers.begin(); it != allLayers.end(); it++) {
30  float cotTheta = (it->face()==GeomDetEnumerators::barrel) ?
31  it->range().mean()/it->position()
32  : it->position()/it->range().mean();
33 
34  int nbins = 0;
35  float sumX0 = 0.;
36  for (int ibin = 0; ibin < 2*layersX0Eta.theHalfNBins; ibin++) {
37  const MSLayersAtAngle & layers = layersX0Eta.theLayersData[ibin];
38  const MSLayer * aLayer = layers.findLayer(*it);
39  if (aLayer) { nbins++; sumX0 += getDataX0(*aLayer).x0; }
40  }
41  if ( nbins==0) nbins=1;
42 
43  float hrange= (it->range().max()-it->range().min())/2.;
44  DataX0 dataX0;
45  if (it->face()==GeomDetEnumerators::endcap) {
46  float cot1 = it->position()/(it->range().mean()-hrange/2);
47  float cot2 = it->position()/(it->range().mean()+hrange/2);
48  const MSLayer * aLayer1 = layersX0Eta.layers(cot1).findLayer(*it);
49  const MSLayer * aLayer2 = layersX0Eta.layers(cot1).findLayer(*it);
50  float sum1 = aLayer1 ? aLayer1->sumX0D(cot1) : 0.;
51  float sum2 = aLayer2 ? aLayer2->sumX0D(cot2) : 0.;
52  float slope = (sum2-sum1)/(1/cot2-1/cot1);
53  float sumX0D = sum1 + slope*(1/cotTheta-1/cot1);
54  dataX0 = DataX0(sumX0/nbins, sumX0D, cotTheta);
55  dataX0.setForwardSumX0DSlope(slope);
56  } else {
57  float sumX0D = 0;
58  int nb=10;
59  for (int i=0; i<nb; i++) {
60  float cot = (it->range().mean()+(2*i+1-nb)*hrange/nb)/it->position();
61  float sin = 1/sqrt(1+cot*cot);
62  const MSLayer * aLayer = layersX0Eta.layers(cot).findLayer(*it);
63  if (aLayer) sumX0D += aLayer->sumX0D(cot) * sqrt(sin);
64  }
65  dataX0 = DataX0(sumX0/nbins, sumX0D/nb, 0);
66  }
67  setDataX0(*it, dataX0);
68  }
69  theLayersData = MSLayersAtAngle(allLayers);
70 // cout << "MSLayersKeeperX0Averaged - LAYERS:"<<endl;
71 // theLayersData.print();
72 // cout << "END OF LAYERS"<<endl;
73 }
int i
Definition: DBlmapReader.cc:9
float sumX0D(float cotTheta) const
Definition: MSLayer.cc:169
static const double slope[3]
MSLayer::DataX0 DataX0
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
T sqrt(T t)
Definition: SSEVec.h:46
virtual const MSLayersAtAngle & layers(float cotTheta) const
const DataX0 & getDataX0(const MSLayer &l) const
virtual void init(const edm::EventSetup &iSetup)
virtual const MSLayersAtAngle & layers(float cotTheta) const
const MSLayer * findLayer(const MSLayer &layer) const
void setDataX0(MSLayer &l, DataX0 x0Data) const
std::vector< MSLayersAtAngle > theLayersData
virtual MSLayer MSLayersKeeperX0Averaged::layer ( const DetLayer layer) const
inlinevirtual

Reimplemented from MSLayersKeeper.

Definition at line 11 of file MSLayersKeeperX0Averaged.h.

References MSLayersAtAngle::findLayer(), and theLayersData.

Referenced by geometryXMLparser.DTAlignable::index(), and geometryXMLparser.CSCAlignable::index().

12  {return *theLayersData.findLayer(MSLayer(layer)); }
const MSLayer * findLayer(const MSLayer &layer) const
virtual const MSLayersAtAngle& MSLayersKeeperX0Averaged::layers ( float  cotTheta) const
inlinevirtual

Implements MSLayersKeeper.

Definition at line 13 of file MSLayersKeeperX0Averaged.h.

References theLayersData.

14  {return theLayersData;}

Member Data Documentation

bool MSLayersKeeperX0Averaged::isInitialised
private

Definition at line 17 of file MSLayersKeeperX0Averaged.h.

MSLayersAtAngle MSLayersKeeperX0Averaged::theLayersData
private

Definition at line 18 of file MSLayersKeeperX0Averaged.h.

Referenced by layer(), and layers().