CMS 3D CMS Logo

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

#include <EcalClusterLazyTools.h>

Inheritance diagram for EcalClusterLazyToolsBase:
EcalClusterLazyToolsT< EcalClusterToolsImpl >

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)
 
const EcalRecHitCollectiongetEcalEBRecHitCollection (void)
 
const EcalRecHitCollectiongetEcalEERecHitCollection (void)
 
const EcalRecHitCollectiongetEcalESRecHitCollection (void)
 
const EcalIntercalibConstantsgetEcalIntercalibConstants (void)
 
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)
 
const edm::ESHandle< EcalLaserDbService > & getLaserHandle (void)
 
float SuperClusterSeedTime (const reco::SuperCluster &cluster)
 
float SuperClusterTime (const reco::SuperCluster &cluster, const edm::Event &ev)
 
 ~EcalClusterLazyToolsBase ()
 

Public Attributes

std::map< DetId, EcalRecHitrechits_map_
 

Protected Member Functions

void getADCToGeV (const edm::EventSetup &es)
 
void getEBRecHits (const edm::Event &ev)
 
const EcalRecHitCollectiongetEcalRecHitCollection (const reco::BasicCluster &cluster)
 
void getEERecHits (const edm::Event &ev)
 
void getESRecHits (const edm::Event &ev)
 
void getGeometry (const edm::EventSetup &es, bool doES=true)
 
void getIntercalibConstants (const edm::EventSetup &es)
 
void getLaserDbService (const edm::EventSetup &es)
 
void getTopology (const edm::EventSetup &es)
 

Protected Attributes

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

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 ebRHToken_, eeRHToken_, getADCToGeV(), getEBRecHits(), getEERecHits(), getGeometry(), getIntercalibConstants(), getLaserDbService(), and getTopology().

25  {
26 
27  ebRHToken_ = token1;
28  eeRHToken_ = token2;
29 
30  getGeometry( es , false );
31  getTopology( es );
32  getEBRecHits( ev );
33  getEERecHits( ev );
35  getADCToGeV ( es );
36  getLaserDbService ( es );
37 }
edm::EDGetTokenT< EcalRecHitCollection > eeRHToken_
void getADCToGeV(const edm::EventSetup &es)
void getIntercalibConstants(const edm::EventSetup &es)
void getTopology(const edm::EventSetup &es)
void getEBRecHits(const edm::Event &ev)
edm::EDGetTokenT< EcalRecHitCollection > ebRHToken_
void getLaserDbService(const edm::EventSetup &es)
void getEERecHits(const edm::Event &ev)
void getGeometry(const edm::EventSetup &es, bool doES=true)
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 39 of file EcalClusterLazyTools.cc.

References ebRHToken_, eeRHToken_, esRHToken_, getADCToGeV(), getEBRecHits(), getEERecHits(), getESRecHits(), getGeometry(), getIntercalibConstants(), getLaserDbService(), and getTopology().

39  {
40 
41  ebRHToken_ = token1;
42  eeRHToken_ = token2;
43  esRHToken_ = token3;
44 
45  getGeometry( es );
46  getTopology( es );
47  getEBRecHits( ev );
48  getEERecHits( ev );
49  getESRecHits( ev );
51  getADCToGeV ( es );
52  getLaserDbService ( es );
53 }
edm::EDGetTokenT< EcalRecHitCollection > eeRHToken_
void getADCToGeV(const edm::EventSetup &es)
void getIntercalibConstants(const edm::EventSetup &es)
void getESRecHits(const edm::Event &ev)
edm::EDGetTokenT< EcalRecHitCollection > esRHToken_
void getTopology(const edm::EventSetup &es)
void getEBRecHits(const edm::Event &ev)
edm::EDGetTokenT< EcalRecHitCollection > ebRHToken_
void getLaserDbService(const edm::EventSetup &es)
void getEERecHits(const edm::Event &ev)
void getGeometry(const edm::EventSetup &es, bool doES=true)
EcalClusterLazyToolsBase::~EcalClusterLazyToolsBase ( )

Definition at line 55 of file EcalClusterLazyTools.cc.

56 {}

Member Function Documentation

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

Definition at line 169 of file EcalClusterLazyTools.cc.

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

Referenced by SuperClusterSeedTime().

170 {
171 
172  const EcalRecHitCollection *recHits = getEcalRecHitCollection( cluster );
173 
174  DetId id = cluster.seed();
175  EcalRecHitCollection::const_iterator theSeedHit = recHits->find (id);
176  // std::cout << "the seed of the BC has time: "
177  //<< (*theSeedHit).time()
178  //<< "and energy: " << (*theSeedHit).energy() << " collection size: " << recHits->size()
179  //<< "\n" <<std::endl; // GF debug
180 
181  return (*theSeedHit).time();
182 }
const EcalRecHitCollection * getEcalRecHitCollection(const reco::BasicCluster &cluster)
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: DetId.h:18
iterator find(key_type k)
float EcalClusterLazyToolsBase::BasicClusterTime ( const reco::BasicCluster cluster,
const edm::Event ev 
)

Definition at line 186 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().

187 {
188 
189  std::vector<std::pair<DetId, float> > clusterComponents = (cluster).hitsAndFractions() ;
190  //std::cout << "BC has this many components: " << clusterComponents.size() << std::endl; // GF debug
191 
192  const EcalRecHitCollection *recHits = getEcalRecHitCollection( cluster );
193  //std::cout << "BasicClusterClusterTime - rechits are this many: " << recHits->size() << std::endl; // GF debug
194 
195 
196  float weightedTsum = 0;
197  float sumOfWeights = 0;
198 
199  for (std::vector<std::pair<DetId, float> >::const_iterator detitr = clusterComponents.begin(); detitr != clusterComponents.end(); detitr++ )
200  {
201  // EcalRecHitCollection::const_iterator theSeedHit = recHits->find (id); // trash this
202  EcalRecHitCollection::const_iterator oneHit = recHits->find( (detitr -> first) ) ;
203 
204  // in order to get back the ADC counts from the recHit energy, three ingredients are necessary:
205  // 1) get laser correction coefficient
206  float lasercalib = 1.;
207  lasercalib = laser->getLaserCorrection( detitr->first, ev.time());
208  // 2) get intercalibration
209  EcalIntercalibConstantMap::const_iterator icalit = icalMap->find(detitr->first);
210  EcalIntercalibConstant icalconst = 1.;
211  if( icalit!=icalMap->end() ) {
212  icalconst = (*icalit);
213  // std::cout << "icalconst set to: " << icalconst << std::endl;
214  } else {
215  edm::LogError("EcalClusterLazyTools") << "No intercalib const found for xtal " << (detitr->first).rawId() << "bailing out";
216  assert(0);
217  }
218  // 3) get adc2GeV
219  float adcToGeV = 1.;
220  if ( (detitr -> first).subdetId() == EcalBarrel ) adcToGeV = float(agc->getEBValue());
221  else if ( (detitr -> first).subdetId() == EcalEndcap ) adcToGeV = float(agc->getEEValue());
222  float adc = 2.;
223  if (icalconst>0 && lasercalib>0 && adcToGeV>0) adc= (*oneHit).energy()/(icalconst*lasercalib*adcToGeV);
224 
225  // don't consider recHits with too little amplitude; take sigma_noise_total into account
226  if( (detitr -> first).subdetId() == EcalBarrel && adc< (1.1*20) ) continue;
227  if( (detitr -> first).subdetId() == EcalEndcap && adc< (2.2*20) ) continue;
228 
229  // count only on rechits whose error is trusted by the method (ratio)
230  if(! (*oneHit).isTimeErrorValid()) continue;
231 
232  float timeError = (*oneHit).timeError();
233  // the constant used to build timeError is largely over-estimated ; remove in quadrature 0.6 and add 0.15 back.
234  // could be prettier if value of constant term was changed at recHit production level
235  if (timeError>0.6) timeError = sqrt( timeError*timeError - 0.6*0.6 + 0.15*0.15);
236  else timeError = sqrt( timeError*timeError + 0.15*0.15);
237 
238  // do the error weighting
239  weightedTsum += (*oneHit).time() / (timeError*timeError);
240  sumOfWeights += 1. / (timeError*timeError);
241 
242  }
243 
244  // what if no crytal is available for weighted average?
245  if ( sumOfWeights ==0 ) return -999;
246  else return ( weightedTsum / sumOfWeights);
247 
248 }
int adc(sample_type sample)
get the ADC sample (12 bits)
const EcalRecHitCollection * getEcalRecHitCollection(const reco::BasicCluster &cluster)
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
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:59
float EcalIntercalibConstant
float EcalClusterLazyToolsBase::eseffsirir ( const reco::SuperCluster cluster)

Definition at line 268 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().

269 {
270  if (!(fabs(cluster.eta()) > 1.6 && fabs(cluster.eta()) < 3.)) return 0.;
271 
272  if (!ecalPS_topology_) return 0.;
273 
274  std::vector<float> phoESHitsIXIX = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 1);
275  std::vector<float> phoESHitsIYIY = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 2);
276  float phoESShapeIXIX = getESShape(phoESHitsIXIX);
277  float phoESShapeIYIY = getESShape(phoESHitsIYIY);
278 
279  return sqrt(phoESShapeIXIX*phoESShapeIXIX + phoESShapeIYIY*phoESShapeIYIY);
280 }
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:163
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:166
T sqrt(T t)
Definition: SSEVec.h:18
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:157
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:160
std::map< DetId, EcalRecHit > rechits_map_
float EcalClusterLazyToolsBase::eseffsixix ( const reco::SuperCluster cluster)

Definition at line 283 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().

284 {
285  if (!(fabs(cluster.eta()) > 1.6 && fabs(cluster.eta()) < 3.)) return 0.;
286 
287  if (!ecalPS_topology_) return 0.;
288 
289  std::vector<float> phoESHitsIXIX = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 1);
290  float phoESShapeIXIX = getESShape(phoESHitsIXIX);
291 
292  return phoESShapeIXIX;
293 }
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:163
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:166
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:157
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:160
std::map< DetId, EcalRecHit > rechits_map_
float EcalClusterLazyToolsBase::eseffsiyiy ( const reco::SuperCluster cluster)

Definition at line 296 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().

297 {
298  if (!(fabs(cluster.eta()) > 1.6 && fabs(cluster.eta()) < 3.)) return 0.;
299 
300  if (!ecalPS_topology_) return 0.;
301 
302  std::vector<float> phoESHitsIYIY = getESHits(cluster.x(), cluster.y(), cluster.z(), rechits_map_, geometry_, ecalPS_topology_.get(), 0, 2);
303  float phoESShapeIYIY = getESShape(phoESHitsIYIY);
304 
305  return phoESShapeIYIY;
306 }
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:163
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:166
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:157
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:160
std::map< DetId, EcalRecHit > rechits_map_
void EcalClusterLazyToolsBase::getADCToGeV ( const edm::EventSetup es)
protected

Definition at line 136 of file EcalClusterLazyTools.cc.

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

Referenced by EcalClusterLazyToolsBase().

137 {
138  // get ADCtoGeV
139  es.get<EcalADCToGeVConstantRcd>().get(agc);
140 }
edm::ESHandle< EcalADCToGeVConstant > agc
const T & get() const
Definition: EventSetup.h:56
void EcalClusterLazyToolsBase::getEBRecHits ( const edm::Event ev)
protected

Definition at line 83 of file EcalClusterLazyTools.cc.

References ebRecHits_, ebRHToken_, edm::Event::getByToken(), and edm::Handle< T >::product().

Referenced by EcalClusterLazyToolsBase().

83  {
85  ev.getByToken( ebRHToken_, pEBRecHits );
86  ebRecHits_ = pEBRecHits.product();
87 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const EcalRecHitCollection * ebRecHits_
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< EcalRecHitCollection > ebRHToken_
const EcalRecHitCollection* EcalClusterLazyToolsBase::getEcalEBRecHitCollection ( void  )
inline

Definition at line 96 of file EcalClusterLazyTools.h.

References ebRecHits_.

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

Definition at line 97 of file EcalClusterLazyTools.h.

References eeRecHits_.

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

Definition at line 98 of file EcalClusterLazyTools.h.

References esRecHits_.

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

Definition at line 99 of file EcalClusterLazyTools.h.

References icalMap.

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

Definition at line 150 of file EcalClusterLazyTools.cc.

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

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

151 {
152  if ( cluster.size() == 0 ) {
153  throw cms::Exception("InvalidCluster") << "The cluster has no crystals!";
154  }
155  DetId id = (cluster.hitsAndFractions()[0]).first; // size is by definition > 0 -- FIXME??
156  const EcalRecHitCollection *recHits = 0;
157  if ( id.subdetId() == EcalBarrel ) {
158  recHits = ebRecHits_;
159  } else if ( id.subdetId() == EcalEndcap ) {
160  recHits = eeRecHits_;
161  } else {
162  throw cms::Exception("InvalidSubdetector") << "The subdetId() " << id.subdetId() << " does not correspond to EcalBarrel neither EcalEndcap";
163  }
164  return recHits;
165 }
const EcalRecHitCollection * ebRecHits_
Definition: DetId.h:18
const EcalRecHitCollection * eeRecHits_
void EcalClusterLazyToolsBase::getEERecHits ( const edm::Event ev)
protected

Definition at line 89 of file EcalClusterLazyTools.cc.

References eeRecHits_, eeRHToken_, edm::Event::getByToken(), and edm::Handle< T >::product().

Referenced by EcalClusterLazyToolsBase().

89  {
91  ev.getByToken( eeRHToken_, pEERecHits );
92  eeRecHits_ = pEERecHits.product();
93 }
edm::EDGetTokenT< EcalRecHitCollection > eeRHToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
T const * product() const
Definition: Handle.h:81
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 309 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(), digi_MixPreMix_cfi::strip, and CaloNavigator< T, TOPO >::west().

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

310 {
311  std::map<DetId, EcalRecHit> rechits_map = _rechits_map;
312  std::vector<float> esHits;
313 
314  const GlobalPoint point(X,Y,Z);
315 
316  const CaloSubdetectorGeometry *geometry_p ;
317  geometry_p = geometry->getSubdetectorGeometry (DetId::Ecal,EcalPreshower) ;
318 
319  DetId esId = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(point, plane);
320  ESDetId esDetId = (esId == DetId(0)) ? ESDetId(0) : ESDetId(esId);
321 
322  std::map<DetId, EcalRecHit>::iterator it;
323  ESDetId next;
324  ESDetId strip;
325  strip = esDetId;
326 
327  EcalPreshowerNavigator theESNav(strip, topology_p);
328  theESNav.setHome(strip);
329 
330  if (row == 1) {
331  if (plane==1 && strip != ESDetId(0)) strip = theESNav.north();
332  if (plane==2 && strip != ESDetId(0)) strip = theESNav.east();
333  } else if (row == -1) {
334  if (plane==1 && strip != ESDetId(0)) strip = theESNav.south();
335  if (plane==2 && strip != ESDetId(0)) strip = theESNav.west();
336  }
337 
338 
339  if (strip == ESDetId(0)) {
340  for (int i=0; i<31; ++i) esHits.push_back(0);
341  } else {
342  it = rechits_map.find(strip);
343  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
344  else esHits.push_back(0);
345  //cout<<"center : "<<strip<<" "<<it->second.energy()<<endl;
346 
347  // Front Plane
348  if (plane==1) {
349  // east road
350  for (int i=0; i<15; ++i) {
351  next = theESNav.east();
352  if (next != ESDetId(0)) {
353  it = rechits_map.find(next);
354  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
355  else esHits.push_back(0);
356  //cout<<"east "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
357  } else {
358  for (int j=i; j<15; j++) esHits.push_back(0);
359  break;
360  //cout<<"east "<<i<<" : "<<next<<" "<<0<<endl;
361  }
362  }
363 
364  // west road
365  theESNav.setHome(strip);
366  theESNav.home();
367  for (int i=0; i<15; ++i) {
368  next = theESNav.west();
369  if (next != ESDetId(0)) {
370  it = rechits_map.find(next);
371  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
372  else esHits.push_back(0);
373  //cout<<"west "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
374  } else {
375  for (int j=i; j<15; j++) esHits.push_back(0);
376  break;
377  //cout<<"west "<<i<<" : "<<next<<" "<<0<<endl;
378  }
379  }
380  } // End of Front Plane
381 
382  // Rear Plane
383  if (plane==2) {
384  // north road
385  for (int i=0; i<15; ++i) {
386  next = theESNav.north();
387  if (next != ESDetId(0)) {
388  it = rechits_map.find(next);
389  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
390  else esHits.push_back(0);
391  //cout<<"north "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
392  } else {
393  for (int j=i; j<15; j++) esHits.push_back(0);
394  break;
395  //cout<<"north "<<i<<" : "<<next<<" "<<0<<endl;
396  }
397  }
398 
399  // south road
400  theESNav.setHome(strip);
401  theESNav.home();
402  for (int i=0; i<15; ++i) {
403  next = theESNav.south();
404  if (next != ESDetId(0)) {
405  it = rechits_map.find(next);
406  if (it != rechits_map.end() && it->second.energy() > 1.0e-10) esHits.push_back(it->second.energy());
407  else esHits.push_back(0);
408  //cout<<"south "<<i<<" : "<<next<<" "<<it->second.energy()<<endl;
409  } else {
410  for (int j=i; j<15; j++) esHits.push_back(0);
411  break;
412  //cout<<"south "<<i<<" : "<<next<<" "<<0<<endl;
413  }
414  }
415  } // End of Rear Plane
416  } // Fill ES RecHits
417 
418  return esHits;
419 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
#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)
protected

Definition at line 95 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().

95  {
97  ev.getByToken( esRHToken_, pESRecHits );
98  esRecHits_ = pESRecHits.product();
99  // make the map of rechits
100  rechits_map_.clear();
101  if (pESRecHits.isValid()) {
103  for (it = pESRecHits->begin(); it != pESRecHits->end(); ++it) {
104  // remove bad ES rechits
105  std::vector<int> badf = {
106  EcalRecHit::ESFlags::kESDead, // 1
107  EcalRecHit::ESFlags::kESTwoGoodRatios,
108  EcalRecHit::ESFlags::kESBadRatioFor12, // 5
109  EcalRecHit::ESFlags::kESBadRatioFor23Upper,
110  EcalRecHit::ESFlags::kESBadRatioFor23Lower,
111  EcalRecHit::ESFlags::kESTS1Largest,
112  EcalRecHit::ESFlags::kESTS3Largest,
113  EcalRecHit::ESFlags::kESTS3Negative, // 10
114  EcalRecHit::ESFlags::kESTS13Sigmas, // 14
115  };
116 
117  if (it->checkFlags(badf)) continue;
118 
119  //Make the map of DetID, EcalRecHit pairs
120  rechits_map_.insert(std::make_pair(it->id(), *it));
121  }
122  }
123 }
const EcalRecHitCollection * esRecHits_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
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:81
std::map< DetId, EcalRecHit > rechits_map_
const_iterator begin() const
float EcalClusterLazyToolsBase::getESShape ( const std::vector< float > &  ESHits0)

Definition at line 423 of file EcalClusterLazyTools.cc.

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

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

424 {
425  const int nBIN = 21;
426  float esRH[nBIN];
427  for (int idx=0; idx<nBIN; idx++) {
428  esRH[idx] = 0.;
429  }
430 
431  for(int ibin=0; ibin<((nBIN+1)/2); ibin++) {
432  if (ibin==0) {
433  esRH[(nBIN-1)/2] = ESHits0[ibin];
434  } else {
435  esRH[(nBIN-1)/2+ibin] = ESHits0[ibin];
436  esRH[(nBIN-1)/2-ibin] = ESHits0[ibin+15];
437  }
438  }
439 
440  // ---- Effective Energy Deposit Width ---- //
441  double EffWidthSigmaISIS = 0.;
442  double totalEnergyISIS = 0.;
443  double EffStatsISIS = 0.;
444  for (int id_X=0; id_X<21; id_X++) {
445  totalEnergyISIS += esRH[id_X];
446  EffStatsISIS += esRH[id_X]*(id_X-10)*(id_X-10);
447  }
448  EffWidthSigmaISIS = (totalEnergyISIS>0.) ? sqrt(fabs(EffStatsISIS / totalEnergyISIS)) : 0.;
449 
450  return EffWidthSigmaISIS;
451 }
T sqrt(T t)
Definition: SSEVec.h:18
void EcalClusterLazyToolsBase::getGeometry ( const edm::EventSetup es,
bool  doES = true 
)
protected

Definition at line 58 of file EcalClusterLazyTools.cc.

References DetId::Ecal, EcalPreshower, ecalPS_topology_, geometry_, edm::EventSetup::get(), CaloGeometry::getSubdetectorGeometry(), and edm::ESHandle< T >::product().

Referenced by EcalClusterLazyToolsBase().

58  {
60  es.get<CaloGeometryRecord>().get(pGeometry);
61  geometry_ = pGeometry.product();
62 
63  if(doES){
65  if (geometryES) {
67  } else {
68  ecalPS_topology_.reset();
69  edm::LogInfo("subdetector geometry not available") << "EcalPreshower geometry is missing" << std::endl;
70  }
71  }
72  else {
73  ecalPS_topology_.reset();
74  }
75 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
const CaloGeometry * geometry_
std::shared_ptr< CaloSubdetectorTopology const > ecalPS_topology_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void EcalClusterLazyToolsBase::getIntercalibConstants ( const edm::EventSetup es)
protected

Definition at line 127 of file EcalClusterLazyTools.cc.

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

Referenced by EcalClusterLazyToolsBase().

128 {
129  // get IC's
131  icalMap = &ical->getMap();
132 }
edm::ESHandle< EcalIntercalibConstants > ical
const EcalIntercalibConstantMap * icalMap
const T & get() const
Definition: EventSetup.h:56
void EcalClusterLazyToolsBase::getLaserDbService ( const edm::EventSetup es)
protected

Definition at line 144 of file EcalClusterLazyTools.cc.

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

Referenced by EcalClusterLazyToolsBase().

144  {
145  // transp corrections
146  es.get<EcalLaserDbRecord>().get(laser);
147 }
const T & get() const
Definition: EventSetup.h:56
edm::ESHandle< EcalLaserDbService > laser
const edm::ESHandle<EcalLaserDbService>& EcalClusterLazyToolsBase::getLaserHandle ( void  )
inline

Definition at line 100 of file EcalClusterLazyTools.h.

References laser.

100 {return laser;};
edm::ESHandle< EcalLaserDbService > laser
void EcalClusterLazyToolsBase::getTopology ( const edm::EventSetup es)
protected

Definition at line 77 of file EcalClusterLazyTools.cc.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and topology_.

Referenced by EcalClusterLazyToolsBase().

77  {
79  es.get<CaloTopologyRecord>().get(pTopology);
80  topology_ = pTopology.product();
81 }
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
const CaloTopology * topology_
float EcalClusterLazyToolsBase::SuperClusterSeedTime ( const reco::SuperCluster cluster)

Definition at line 252 of file EcalClusterLazyTools.cc.

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

252  {
253 
254  return BasicClusterSeedTime ( (*cluster.seed()) );
255 
256 }
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 260 of file EcalClusterLazyTools.cc.

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

260  {
261 
262  return BasicClusterTime ( (*cluster.seed()) , ev);
263 
264 }
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 86 of file EcalClusterLazyTools.h.

Referenced by BasicClusterTime(), and getADCToGeV().

const EcalRecHitCollection* EcalClusterLazyToolsBase::ebRecHits_
protected
edm::EDGetTokenT<EcalRecHitCollection> EcalClusterLazyToolsBase::ebRHToken_
protected

Definition at line 79 of file EcalClusterLazyTools.h.

Referenced by EcalClusterLazyToolsBase(), and getEBRecHits().

std::shared_ptr<CaloSubdetectorTopology const> EcalClusterLazyToolsBase::ecalPS_topology_
protected

Definition at line 81 of file EcalClusterLazyTools.h.

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

const EcalRecHitCollection* EcalClusterLazyToolsBase::eeRecHits_
protected
edm::EDGetTokenT<EcalRecHitCollection> EcalClusterLazyToolsBase::eeRHToken_
protected

Definition at line 79 of file EcalClusterLazyTools.h.

Referenced by EcalClusterLazyToolsBase(), and getEERecHits().

const EcalRecHitCollection* EcalClusterLazyToolsBase::esRecHits_
protected

Definition at line 77 of file EcalClusterLazyTools.h.

Referenced by getEcalESRecHitCollection(), and getESRecHits().

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

Definition at line 79 of file EcalClusterLazyTools.h.

Referenced by EcalClusterLazyToolsBase(), and getESRecHits().

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

Definition at line 84 of file EcalClusterLazyTools.h.

Referenced by getIntercalibConstants().

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

Definition at line 87 of file EcalClusterLazyTools.h.

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

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

Definition at line 51 of file EcalClusterLazyTools.h.

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

const CaloTopology* EcalClusterLazyToolsBase::topology_
protected