CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
EcalClusterLazyToolsBase Class Reference

#include <EcalClusterLazyTools.h>

Inheritance diagram for EcalClusterLazyToolsBase:
EcalClusterLazyToolsT< ClusterTools >

Public Member Functions

float BasicClusterSeedTime (const reco::BasicCluster &cluster)
 
float BasicClusterTime (const reco::BasicCluster &cluster, const edm::Event &ev)
 
 EcalClusterLazyToolsBase (const edm::Event &ev, const edm::EventSetup &es, edm::EDGetTokenT< EcalRecHitCollection > token1, edm::EDGetTokenT< EcalRecHitCollection > token2)
 
 EcalClusterLazyToolsBase (const edm::Event &ev, const edm::EventSetup &es, edm::EDGetTokenT< EcalRecHitCollection > token1, edm::EDGetTokenT< EcalRecHitCollection > token2, edm::EDGetTokenT< EcalRecHitCollection > token3)
 
float eseffsirir (const reco::SuperCluster &cluster)
 
float eseffsixix (const reco::SuperCluster &cluster)
 
float eseffsiyiy (const reco::SuperCluster &cluster)
 
EcalRecHitCollection const * getEcalEBRecHitCollection () const
 
EcalRecHitCollection const * getEcalEERecHitCollection () const
 
EcalRecHitCollection const * getEcalESRecHitCollection () const
 
EcalIntercalibConstants const & getEcalIntercalibConstants () const
 
std::vector< float > getESHits (double X, double Y, double Z, const std::map< DetId, EcalRecHit > &rechits_map, const CaloGeometry *geometry, CaloSubdetectorTopology const *topology_p, int row=0, int plane=1)
 
float getESShape (const std::vector< float > &ESHits0)
 
edm::ESHandle< EcalLaserDbService > const & getLaserHandle () const
 
float SuperClusterSeedTime (const reco::SuperCluster &cluster)
 
float SuperClusterTime (const reco::SuperCluster &cluster, const edm::Event &ev)
 

Public Attributes

std::map< DetId, EcalRecHitrechits_map_
 

Protected Member Functions

void getADCToGeV (const edm::EventSetup &es)
 
EcalRecHitCollection const * getEcalRecHitCollection (const reco::BasicCluster &cluster) const
 
void getIntercalibConstants (const edm::EventSetup &es)
 
void getLaserDbService (const edm::EventSetup &es)
 

Protected Attributes

edm::ESHandle< EcalADCToGeVConstantagc
 
const EcalRecHitCollectionebRecHits_
 
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
 
const EcalRecHitCollectioneeRecHits_
 
const EcalRecHitCollectionesRecHits_
 
edm::EDGetTokenT< EcalRecHitCollectionesRHToken_
 
const CaloGeometrygeometry_
 
edm::ESHandle< EcalIntercalibConstantsical
 
const EcalIntercalibConstantMapicalMap
 
edm::ESHandle< EcalLaserDbServicelaser
 
const CaloTopologytopology_
 

Private Member Functions

void getESRecHits (const edm::Event &ev)
 

Detailed Description

Definition at line 34 of file EcalClusterLazyTools.h.

Constructor & Destructor Documentation

EcalClusterLazyToolsBase::EcalClusterLazyToolsBase ( const edm::Event ev,
const edm::EventSetup es,
edm::EDGetTokenT< EcalRecHitCollection token1,
edm::EDGetTokenT< EcalRecHitCollection token2 
)

Definition at line 25 of file EcalClusterLazyTools.cc.

References getADCToGeV(), getIntercalibConstants(), and getLaserDbService().

26  : geometry_(&edm::get<CaloGeometry,CaloGeometryRecord>(es))
27  , topology_(&edm::get<CaloTopology,CaloTopologyRecord>(es))
28  , ebRecHits_(&edm::get(ev, token1))
29  , eeRecHits_(&edm::get(ev, token2))
30 {
32  getADCToGeV ( es );
33  getLaserDbService ( es );
34 }
const CaloGeometry * geometry_
void getADCToGeV(const edm::EventSetup &es)
const EcalRecHitCollection * ebRecHits_
void getIntercalibConstants(const edm::EventSetup &es)
T const & get(Event const &event, InputTag const &tag)(false)
Definition: Event.h:658
void getLaserDbService(const edm::EventSetup &es)
const EcalRecHitCollection * eeRecHits_
const CaloTopology * topology_
EcalClusterLazyToolsBase::EcalClusterLazyToolsBase ( const edm::Event ev,
const edm::EventSetup es,
edm::EDGetTokenT< EcalRecHitCollection token1,
edm::EDGetTokenT< EcalRecHitCollection token2,
edm::EDGetTokenT< EcalRecHitCollection token3 
)

Definition at line 36 of file EcalClusterLazyTools.cc.

References DetId::Ecal, EcalPreshower, ecalPS_topology_, esRHToken_, geometry_, getADCToGeV(), getESRecHits(), getIntercalibConstants(), getLaserDbService(), and CaloGeometry::getSubdetectorGeometry().

37  : geometry_(&edm::get<CaloGeometry,CaloGeometryRecord>(es))
38  , topology_(&edm::get<CaloTopology,CaloTopologyRecord>(es))
39  , ebRecHits_(&edm::get(ev, token1))
40  , eeRecHits_(&edm::get(ev, token2))
41 {
43  if (geometryES) {
44  ecalPS_topology_ = std::make_shared<EcalPreshowerTopology>();
45  } else {
46  edm::LogInfo("subdetector geometry not available") << "EcalPreshower geometry is missing" << std::endl;
47  }
48 
49  esRHToken_ = token3;
50  getESRecHits( ev );
51 
53  getADCToGeV ( es );
54  getLaserDbService ( es );
55 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
const CaloGeometry * geometry_
void getADCToGeV(const edm::EventSetup &es)
const EcalRecHitCollection * ebRecHits_
void getIntercalibConstants(const edm::EventSetup &es)
void getESRecHits(const edm::Event &ev)
edm::EDGetTokenT< EcalRecHitCollection > esRHToken_
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
T const & get(Event const &event, InputTag const &tag)(false)
Definition: Event.h:658
void getLaserDbService(const edm::EventSetup &es)
const EcalRecHitCollection * eeRecHits_
const CaloTopology * topology_

Member Function Documentation

float EcalClusterLazyToolsBase::BasicClusterSeedTime ( const reco::BasicCluster cluster)

Definition at line 131 of file EcalClusterLazyTools.cc.

References edm::SortedCollection< T, SORT >::find(), and getEcalRecHitCollection().

Referenced by SuperClusterSeedTime().

132 {
133 
134  const EcalRecHitCollection *recHits = getEcalRecHitCollection( cluster );
135 
136  DetId id = cluster.seed();
137  EcalRecHitCollection::const_iterator theSeedHit = recHits->find (id);
138  // std::cout << "the seed of the BC has time: "
139  //<< (*theSeedHit).time()
140  //<< "and energy: " << (*theSeedHit).energy() << " collection size: " << recHits->size()
141  //<< "\n" <<std::endl; // GF debug
142 
143  return (*theSeedHit).time();
144 }
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: DetId.h:18
EcalRecHitCollection const * getEcalRecHitCollection(const reco::BasicCluster &cluster) const
iterator find(key_type k)
float EcalClusterLazyToolsBase::BasicClusterTime ( const reco::BasicCluster cluster,
const edm::Event ev 
)

Definition at line 148 of file EcalClusterLazyTools.cc.

References ecalMGPA::adc(), agc, EcalBarrel, EcalEndcap, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), edm::SortedCollection< T, SORT >::find(), plotBeamSpotDB::first, objects.autophobj::float, EcalADCToGeVConstant::getEBValue(), getEcalRecHitCollection(), EcalADCToGeVConstant::getEEValue(), EcalLaserDbService::getLaserCorrection(), icalMap, laser, mathSSE::sqrt(), and edm::EventBase::time().

Referenced by SuperClusterTime().

149 {
150 
151  std::vector<std::pair<DetId, float> > clusterComponents = (cluster).hitsAndFractions() ;
152  //std::cout << "BC has this many components: " << clusterComponents.size() << std::endl; // GF debug
153 
154  const EcalRecHitCollection *recHits = getEcalRecHitCollection( cluster );
155  //std::cout << "BasicClusterClusterTime - rechits are this many: " << recHits->size() << std::endl; // GF debug
156 
157 
158  float weightedTsum = 0;
159  float sumOfWeights = 0;
160 
161  for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterComponents.begin(); detitr != clusterComponents.end(); detitr++ )
162  {
163  // EcalRecHitCollection::const_iterator theSeedHit = recHits->find (id); // trash this
164  EcalRecHitCollection::const_iterator oneHit = recHits->find( (detitr -> first) ) ;
165 
166  // in order to get back the ADC counts from the recHit energy, three ingredients are necessary:
167  // 1) get laser correction coefficient
168  float lasercalib = 1.;
169  lasercalib = laser->getLaserCorrection( detitr->first, ev.time());
170  // 2) get intercalibration
171  EcalIntercalibConstantMap::const_iterator icalit = icalMap->find(detitr->first);
172  EcalIntercalibConstant icalconst = 1.;
173  if( icalit!=icalMap->end() ) {
174  icalconst = (*icalit);
175  // std::cout << "icalconst set to: " << icalconst << std::endl;
176  } else {
177  edm::LogError("EcalClusterLazyTools") << "No intercalib const found for xtal " << (detitr->first).rawId() << "bailing out";
178  assert(false);
179  }
180  // 3) get adc2GeV
181  float adcToGeV = 1.;
182  if ( (detitr -> first).subdetId() == EcalBarrel ) adcToGeV = float(agc->getEBValue());
183  else if ( (detitr -> first).subdetId() == EcalEndcap ) adcToGeV = float(agc->getEEValue());
184  float adc = 2.;
185  if (icalconst>0 && lasercalib>0 && adcToGeV>0) adc= (*oneHit).energy()/(icalconst*lasercalib*adcToGeV);
186 
187  // don't consider recHits with too little amplitude; take sigma_noise_total into account
188  if( (detitr -> first).subdetId() == EcalBarrel && adc< (1.1*20) ) continue;
189  if( (detitr -> first).subdetId() == EcalEndcap && adc< (2.2*20) ) continue;
190 
191  // count only on rechits whose error is trusted by the method (ratio)
192  if(! (*oneHit).isTimeErrorValid()) continue;
193 
194  float timeError = (*oneHit).timeError();
195  // the constant used to build timeError is largely over-estimated ; remove in quadrature 0.6 and add 0.15 back.
196  // could be prettier if value of constant term was changed at recHit production level
197  if (timeError>0.6) timeError = sqrt( timeError*timeError - 0.6*0.6 + 0.15*0.15);
198  else timeError = sqrt( timeError*timeError + 0.15*0.15);
199 
200  // do the error weighting
201  weightedTsum += (*oneHit).time() / (timeError*timeError);
202  sumOfWeights += 1. / (timeError*timeError);
203 
204  }
205 
206  // what if no crytal is available for weighted average?
207  if ( sumOfWeights ==0 ) return -999;
208  else return ( weightedTsum / sumOfWeights);
209 
210 }
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
std::vector< EcalRecHit >::const_iterator const_iterator
const EcalIntercalibConstantMap * icalMap
edm::ESHandle< EcalADCToGeVConstant > agc
T sqrt(T t)
Definition: SSEVec.h:18
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
EcalRecHitCollection const * getEcalRecHitCollection(const reco::BasicCluster &cluster) const
std::vector< Item >::const_iterator const_iterator
iterator find(key_type k)
const_iterator find(uint32_t rawId) const
const_iterator end() const
edm::ESHandle< EcalLaserDbService > laser
edm::Timestamp time() const
Definition: EventBase.h:60
float EcalIntercalibConstant
float EcalClusterLazyToolsBase::eseffsirir ( const reco::SuperCluster cluster)

Definition at line 230 of file EcalClusterLazyTools.cc.

References ecalPS_topology_, reco::CaloCluster::eta(), geometry_, getESHits(), getESShape(), rechits_map_, mathSSE::sqrt(), reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

231 {
232  if (!(fabs(cluster.eta()) > 1.6 && fabs(cluster.eta()) < 3.)) return 0.;
233 
234  if (!ecalPS_topology_) return 0.;
235 
236  std::vector<float> phoESHitsIXIX = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 1);
237  std::vector<float> phoESHitsIYIY = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 2);
238  float phoESShapeIXIX = getESShape(phoESHitsIXIX);
239  float phoESShapeIYIY = getESShape(phoESHitsIYIY);
240 
241  return sqrt(phoESShapeIXIX*phoESShapeIXIX + phoESShapeIYIY*phoESShapeIYIY);
242 }
const CaloGeometry * geometry_
std::vector< float > getESHits(double X, double Y, double Z, const std::map< DetId, EcalRecHit > &rechits_map, const CaloGeometry *geometry, CaloSubdetectorTopology const *topology_p, int row=0, int plane=1)
float getESShape(const std::vector< float > &ESHits0)
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:165
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:168
T sqrt(T t)
Definition: SSEVec.h:18
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:159
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:162
std::map< DetId, EcalRecHit > rechits_map_
float EcalClusterLazyToolsBase::eseffsixix ( const reco::SuperCluster cluster)

Definition at line 245 of file EcalClusterLazyTools.cc.

References ecalPS_topology_, reco::CaloCluster::eta(), geometry_, getESHits(), getESShape(), rechits_map_, reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

246 {
247  if (!(fabs(cluster.eta()) > 1.6 && fabs(cluster.eta()) < 3.)) return 0.;
248 
249  if (!ecalPS_topology_) return 0.;
250 
251  std::vector<float> phoESHitsIXIX = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 1);
252  float phoESShapeIXIX = getESShape(phoESHitsIXIX);
253 
254  return phoESShapeIXIX;
255 }
const CaloGeometry * geometry_
std::vector< float > getESHits(double X, double Y, double Z, const std::map< DetId, EcalRecHit > &rechits_map, const CaloGeometry *geometry, CaloSubdetectorTopology const *topology_p, int row=0, int plane=1)
float getESShape(const std::vector< float > &ESHits0)
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:165
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:168
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:159
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:162
std::map< DetId, EcalRecHit > rechits_map_
float EcalClusterLazyToolsBase::eseffsiyiy ( const reco::SuperCluster cluster)

Definition at line 258 of file EcalClusterLazyTools.cc.

References ecalPS_topology_, reco::CaloCluster::eta(), geometry_, getESHits(), getESShape(), rechits_map_, reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

259 {
260  if (!(fabs(cluster.eta()) > 1.6 && fabs(cluster.eta()) < 3.)) return 0.;
261 
262  if (!ecalPS_topology_) return 0.;
263 
264  std::vector<float> phoESHitsIYIY = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 2);
265  float phoESShapeIYIY = getESShape(phoESHitsIYIY);
266 
267  return phoESShapeIYIY;
268 }
const CaloGeometry * geometry_
std::vector< float > getESHits(double X, double Y, double Z, const std::map< DetId, EcalRecHit > &rechits_map, const CaloGeometry *geometry, CaloSubdetectorTopology const *topology_p, int row=0, int plane=1)
float getESShape(const std::vector< float > &ESHits0)
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:165
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:168
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:159
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:162
std::map< DetId, EcalRecHit > rechits_map_
void EcalClusterLazyToolsBase::getADCToGeV ( const edm::EventSetup es)
protected

Definition at line 98 of file EcalClusterLazyTools.cc.

References agc, and edm::EventSetup::get().

Referenced by EcalClusterLazyToolsBase().

99 {
100  // get ADCtoGeV
101  es.get<EcalADCToGeVConstantRcd>().get(agc);
102 }
edm::ESHandle< EcalADCToGeVConstant > agc
T get() const
Definition: EventSetup.h:71
EcalRecHitCollection const* EcalClusterLazyToolsBase::getEcalEBRecHitCollection ( ) const
inline

Definition at line 59 of file EcalClusterLazyTools.h.

References ebRecHits_.

59 { return ebRecHits_; }
const EcalRecHitCollection * ebRecHits_
EcalRecHitCollection const* EcalClusterLazyToolsBase::getEcalEERecHitCollection ( ) const
inline

Definition at line 60 of file EcalClusterLazyTools.h.

References eeRecHits_.

60 { return eeRecHits_; }
const EcalRecHitCollection * eeRecHits_
EcalRecHitCollection const* EcalClusterLazyToolsBase::getEcalESRecHitCollection ( ) const
inline

Definition at line 61 of file EcalClusterLazyTools.h.

References esRecHits_.

61 { return esRecHits_; }
const EcalRecHitCollection * esRecHits_
EcalIntercalibConstants const& EcalClusterLazyToolsBase::getEcalIntercalibConstants ( ) const
inline

Definition at line 62 of file EcalClusterLazyTools.h.

References icalMap.

62 { return *icalMap; }
const EcalIntercalibConstantMap * icalMap
const EcalRecHitCollection * EcalClusterLazyToolsBase::getEcalRecHitCollection ( const reco::BasicCluster cluster) const
protected

Definition at line 112 of file EcalClusterLazyTools.cc.

References ebRecHits_, EcalBarrel, EcalEndcap, eeRecHits_, Exception, and plotBeamSpotDB::first.

Referenced by BasicClusterSeedTime(), BasicClusterTime(), EcalClusterLazyToolsT< ClusterTools >::covariances(), EcalClusterLazyToolsT< ClusterTools >::e1x3(), EcalClusterLazyToolsT< ClusterTools >::e1x5(), EcalClusterLazyToolsT< ClusterTools >::e2nd(), EcalClusterLazyToolsT< ClusterTools >::e2x2(), EcalClusterLazyToolsT< ClusterTools >::e2x5Bottom(), EcalClusterLazyToolsT< ClusterTools >::e2x5Left(), EcalClusterLazyToolsT< ClusterTools >::e2x5Max(), EcalClusterLazyToolsT< ClusterTools >::e2x5Right(), EcalClusterLazyToolsT< ClusterTools >::e2x5Top(), EcalClusterLazyToolsT< ClusterTools >::e3x1(), EcalClusterLazyToolsT< ClusterTools >::e3x2(), EcalClusterLazyToolsT< ClusterTools >::e3x3(), EcalClusterLazyToolsT< ClusterTools >::e4x4(), EcalClusterLazyToolsT< ClusterTools >::e5x1(), EcalClusterLazyToolsT< ClusterTools >::e5x5(), EcalClusterLazyToolsT< ClusterTools >::eBottom(), EcalClusterLazyToolsT< ClusterTools >::eLeft(), EcalClusterLazyToolsT< ClusterTools >::eMax(), EcalClusterLazyToolsT< ClusterTools >::energyBasketFractionEta(), EcalClusterLazyToolsT< ClusterTools >::energyBasketFractionPhi(), EcalClusterLazyToolsT< ClusterTools >::energyMatrix(), EcalClusterLazyToolsT< ClusterTools >::eRight(), EcalClusterLazyToolsT< ClusterTools >::eTop(), getLaserHandle(), EcalClusterLazyToolsT< ClusterTools >::getMaximum(), EcalClusterLazyToolsT< ClusterTools >::lat(), EcalClusterLazyToolsT< ClusterTools >::localCovariances(), EcalClusterLazyToolsT< ClusterTools >::n5x5(), EcalClusterLazyToolsT< ClusterTools >::scLocalCovariances(), EcalClusterLazyToolsT< ClusterTools >::zernike20(), and EcalClusterLazyToolsT< ClusterTools >::zernike42().

113 {
114  if ( cluster.size() == 0 ) {
115  throw cms::Exception("InvalidCluster") << "The cluster has no crystals!";
116  }
117  DetId id = (cluster.hitsAndFractions()[0]).first; // size is by definition > 0 -- FIXME??
118  const EcalRecHitCollection *recHits = nullptr;
119  if ( id.subdetId() == EcalBarrel ) {
120  recHits = ebRecHits_;
121  } else if ( id.subdetId() == EcalEndcap ) {
122  recHits = eeRecHits_;
123  } else {
124  throw cms::Exception("InvalidSubdetector") << "The subdetId() " << id.subdetId() << " does not correspond to EcalBarrel neither EcalEndcap";
125  }
126  return recHits;
127 }
const EcalRecHitCollection * ebRecHits_
Definition: DetId.h:18
const EcalRecHitCollection * eeRecHits_
std::vector< float > EcalClusterLazyToolsBase::getESHits ( double  X,
double  Y,
double  Z,
const std::map< DetId, EcalRecHit > &  rechits_map,
const CaloGeometry geometry,
CaloSubdetectorTopology const *  topology_p,
int  row = 0,
int  plane = 1 
)

Definition at line 271 of file EcalClusterLazyTools.cc.

References CaloNavigator< T, TOPO >::east(), DetId::Ecal, EcalPreshower, CaloGeometry::getSubdetectorGeometry(), CaloNavigator< T, TOPO >::home(), mps_fire::i, GetRecoTauVFromDQM_MC_cff::next, CaloNavigator< T, TOPO >::north(), point, CaloNavigator< T, TOPO >::setHome(), CaloNavigator< T, TOPO >::south(), digitizers_cfi::strip, and CaloNavigator< T, TOPO >::west().

Referenced by eseffsirir(), eseffsixix(), and eseffsiyiy().

272 {
273  std::map<DetId, EcalRecHit> rechits_map = _rechits_map;
274  std::vector<float> esHits;
275 
276  const GlobalPoint point(X,Y,Z);
277 
279 
280  DetId esId = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(point, plane);
281  ESDetId esDetId = (esId == DetId(0)) ? ESDetId(0) : ESDetId(esId);
282 
283  std::map<DetId, EcalRecHit>::iterator it;
284  ESDetId next;
285  ESDetId strip;
286  strip = esDetId;
287 
288  EcalPreshowerNavigator theESNav(strip, topology_p);
289  theESNav.setHome(strip);
290 
291  if (row == 1) {
292  if (plane==1 && strip != ESDetId(0)) strip = theESNav.north();
293  if (plane==2 && strip != ESDetId(0)) strip = theESNav.east();
294  } else if (row == -1) {
295  if (plane==1 && strip != ESDetId(0)) strip = theESNav.south();
296  if (plane==2 && strip != ESDetId(0)) strip = theESNav.west();
297  }
298 
299 
300  if (strip == ESDetId(0)) {
301  for (int i=0; i<31; ++i) esHits.push_back(0);
302  } else {
303  it = rechits_map.find(strip);
304  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
305  else esHits.push_back(0);
306  //cout<<"center : "<<strip<<" "<<it->second.energy()<<endl;
307 
308  // Front Plane
309  if (plane==1) {
310  // east road
311  for (int i=0; i<15; ++i) {
312  next = theESNav.east();
313  if (next != ESDetId(0)) {
314  it = rechits_map.find(next);
315  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
316  else esHits.push_back(0);
317  //cout<<"east "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
318  } else {
319  for (int j=i; j<15; j++) esHits.push_back(0);
320  break;
321  //cout<<"east "<<i<<" : "<<next<<" "<<0<<endl;
322  }
323  }
324 
325  // west road
326  theESNav.setHome(strip);
327  theESNav.home();
328  for (int i=0; i<15; ++i) {
329  next = theESNav.west();
330  if (next != ESDetId(0)) {
331  it = rechits_map.find(next);
332  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
333  else esHits.push_back(0);
334  //cout<<"west "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
335  } else {
336  for (int j=i; j<15; j++) esHits.push_back(0);
337  break;
338  //cout<<"west "<<i<<" : "<<next<<" "<<0<<endl;
339  }
340  }
341  } // End of Front Plane
342 
343  // Rear Plane
344  if (plane==2) {
345  // north road
346  for (int i=0; i<15; ++i) {
347  next = theESNav.north();
348  if (next != ESDetId(0)) {
349  it = rechits_map.find(next);
350  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
351  else esHits.push_back(0);
352  //cout<<"north "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
353  } else {
354  for (int j=i; j<15; j++) esHits.push_back(0);
355  break;
356  //cout<<"north "<<i<<" : "<<next<<" "<<0<<endl;
357  }
358  }
359 
360  // south road
361  theESNav.setHome(strip);
362  theESNav.home();
363  for (int i=0; i<15; ++i) {
364  next = theESNav.south();
365  if (next != ESDetId(0)) {
366  it = rechits_map.find(next);
367  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
368  else esHits.push_back(0);
369  //cout<<"south "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
370  } else {
371  for (int j=i; j<15; j++) esHits.push_back(0);
372  break;
373  //cout<<"south "<<i<<" : "<<next<<" "<<0<<endl;
374  }
375  }
376  } // End of Rear Plane
377  } // Fill ES RecHits
378 
379  return esHits;
380 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
#define X(str)
Definition: MuonsGrabber.cc:48
Definition: DetId.h:18
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
void EcalClusterLazyToolsBase::getESRecHits ( const edm::Event ev)
private

Definition at line 57 of file EcalClusterLazyTools.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), esRecHits_, esRHToken_, edm::Event::getByToken(), edm::HandleBase::isValid(), edm::Handle< T >::product(), and rechits_map_.

Referenced by EcalClusterLazyToolsBase().

57  {
59  ev.getByToken( esRHToken_, pESRecHits );
60  esRecHits_ = pESRecHits.product();
61  // make the map of rechits
62  rechits_map_.clear();
63  if (pESRecHits.isValid()) {
65  for (it = pESRecHits->begin(); it != pESRecHits->end(); ++it) {
66  // remove bad ES rechits
67  std::vector<int> badf = {
68  EcalRecHit::ESFlags::kESDead, // 1
69  EcalRecHit::ESFlags::kESTwoGoodRatios,
70  EcalRecHit::ESFlags::kESBadRatioFor12, // 5
71  EcalRecHit::ESFlags::kESBadRatioFor23Upper,
72  EcalRecHit::ESFlags::kESBadRatioFor23Lower,
73  EcalRecHit::ESFlags::kESTS1Largest,
74  EcalRecHit::ESFlags::kESTS3Largest,
75  EcalRecHit::ESFlags::kESTS3Negative, // 10
76  EcalRecHit::ESFlags::kESTS13Sigmas, // 14
77  };
78 
79  if (it->checkFlags(badf)) continue;
80 
81  //Make the map of DetID, EcalRecHit pairs
82  rechits_map_.insert(std::make_pair(it->id(), *it));
83  }
84  }
85 }
const EcalRecHitCollection * esRecHits_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::vector< EcalRecHit >::const_iterator const_iterator
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< EcalRecHitCollection > esRHToken_
const_iterator end() const
T const * product() const
Definition: Handle.h:74
std::map< DetId, EcalRecHit > rechits_map_
const_iterator begin() const
float EcalClusterLazyToolsBase::getESShape ( const std::vector< float > &  ESHits0)

Definition at line 384 of file EcalClusterLazyTools.cc.

References training_settings::idx, and mathSSE::sqrt().

Referenced by eseffsirir(), eseffsixix(), and eseffsiyiy().

385 {
386  const int nBIN = 21;
387  float esRH[nBIN];
388  for (int idx=0; idx<nBIN; idx++) {
389  esRH[idx] = 0.;
390  }
391 
392  for(int ibin=0; ibin<((nBIN+1)/2); ibin++) {
393  if (ibin==0) {
394  esRH[(nBIN-1)/2] = ESHits0[ibin];
395  } else {
396  esRH[(nBIN-1)/2+ibin] = ESHits0[ibin];
397  esRH[(nBIN-1)/2-ibin] = ESHits0[ibin+15];
398  }
399  }
400 
401  // ---- Effective Energy Deposit Width ---- //
402  double EffWidthSigmaISIS = 0.;
403  double totalEnergyISIS = 0.;
404  double EffStatsISIS = 0.;
405  for (int id_X=0; id_X<21; id_X++) {
406  totalEnergyISIS += esRH[id_X];
407  EffStatsISIS += esRH[id_X]*(id_X-10)*(id_X-10);
408  }
409  EffWidthSigmaISIS = (totalEnergyISIS>0.) ? sqrt(fabs(EffStatsISIS / totalEnergyISIS)) : 0.;
410 
411  return EffWidthSigmaISIS;
412 }
T sqrt(T t)
Definition: SSEVec.h:18
void EcalClusterLazyToolsBase::getIntercalibConstants ( const edm::EventSetup es)
protected

Definition at line 89 of file EcalClusterLazyTools.cc.

References edm::EventSetup::get(), ical, and icalMap.

Referenced by EcalClusterLazyToolsBase().

90 {
91  // get IC's
93  icalMap = &ical->getMap();
94 }
edm::ESHandle< EcalIntercalibConstants > ical
const EcalIntercalibConstantMap * icalMap
T get() const
Definition: EventSetup.h:71
void EcalClusterLazyToolsBase::getLaserDbService ( const edm::EventSetup es)
protected

Definition at line 106 of file EcalClusterLazyTools.cc.

References edm::EventSetup::get(), and laser.

Referenced by EcalClusterLazyToolsBase().

106  {
107  // transp corrections
108  es.get<EcalLaserDbRecord>().get(laser);
109 }
T get() const
Definition: EventSetup.h:71
edm::ESHandle< EcalLaserDbService > laser
edm::ESHandle<EcalLaserDbService> const& EcalClusterLazyToolsBase::getLaserHandle ( ) const
inline

Definition at line 63 of file EcalClusterLazyTools.h.

References getEcalRecHitCollection(), and laser.

63 { return laser; }
edm::ESHandle< EcalLaserDbService > laser
float EcalClusterLazyToolsBase::SuperClusterSeedTime ( const reco::SuperCluster cluster)

Definition at line 214 of file EcalClusterLazyTools.cc.

References BasicClusterSeedTime(), and reco::SuperCluster::seed().

214  {
215 
216  return BasicClusterSeedTime ( (*cluster.seed()) );
217 
218 }
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
float BasicClusterSeedTime(const reco::BasicCluster &cluster)
float EcalClusterLazyToolsBase::SuperClusterTime ( const reco::SuperCluster cluster,
const edm::Event ev 
)

Definition at line 222 of file EcalClusterLazyTools.cc.

References BasicClusterTime(), and reco::SuperCluster::seed().

222  {
223 
224  return BasicClusterTime ( (*cluster.seed()) , ev);
225 
226 }
float BasicClusterTime(const reco::BasicCluster &cluster, const edm::Event &ev)
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66

Member Data Documentation

edm::ESHandle<EcalADCToGeVConstant> EcalClusterLazyToolsBase::agc
protected

Definition at line 80 of file EcalClusterLazyTools.h.

Referenced by BasicClusterTime(), and getADCToGeV().

const EcalRecHitCollection* EcalClusterLazyToolsBase::ebRecHits_
protected

Definition at line 70 of file EcalClusterLazyTools.h.

Referenced by getEcalEBRecHitCollection(), and getEcalRecHitCollection().

std::shared_ptr<CaloSubdetectorTopology const> EcalClusterLazyToolsBase::ecalPS_topology_
protected
const EcalRecHitCollection* EcalClusterLazyToolsBase::eeRecHits_
protected

Definition at line 71 of file EcalClusterLazyTools.h.

Referenced by getEcalEERecHitCollection(), and getEcalRecHitCollection().

const EcalRecHitCollection* EcalClusterLazyToolsBase::esRecHits_
protected

Definition at line 72 of file EcalClusterLazyTools.h.

Referenced by getEcalESRecHitCollection(), and getESRecHits().

edm::EDGetTokenT<EcalRecHitCollection> EcalClusterLazyToolsBase::esRHToken_
protected

Definition at line 74 of file EcalClusterLazyTools.h.

Referenced by EcalClusterLazyToolsBase(), and getESRecHits().

const CaloGeometry* EcalClusterLazyToolsBase::geometry_
protected
edm::ESHandle<EcalIntercalibConstants> EcalClusterLazyToolsBase::ical
protected

Definition at line 78 of file EcalClusterLazyTools.h.

Referenced by getIntercalibConstants().

const EcalIntercalibConstantMap* EcalClusterLazyToolsBase::icalMap
protected
edm::ESHandle<EcalLaserDbService> EcalClusterLazyToolsBase::laser
protected

Definition at line 81 of file EcalClusterLazyTools.h.

Referenced by BasicClusterTime(), getLaserDbService(), and getLaserHandle().

std::map<DetId, EcalRecHit> EcalClusterLazyToolsBase::rechits_map_

Definition at line 49 of file EcalClusterLazyTools.h.

Referenced by eseffsirir(), eseffsixix(), eseffsiyiy(), and getESRecHits().

const CaloTopology* EcalClusterLazyToolsBase::topology_
protected