CMS 3D CMS Logo

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

#include <EcalClusterPUCleaningTools.h>

Public Member Functions

reco::SuperCluster CleanedSuperCluster (float xi, const reco::SuperCluster &cluster, const edm::Event &ev, const edm::EventSetup &es)
 
 EcalClusterPUCleaningTools (edm::ConsumesCollector &cc, const edm::InputTag &redEBRecHits, const edm::InputTag &redEERecHits)
 
 ~EcalClusterPUCleaningTools ()
 

Private Member Functions

void getEBRecHits (const edm::Event &ev)
 
void getEERecHits (const edm::Event &ev)
 

Private Attributes

const EcalRecHitCollectionebRecHits_
 
const EcalRecHitCollectioneeRecHits_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeometryToken_
 
const edm::EDGetTokenT< EcalRecHitCollectionpEBRecHitsToken_
 
const edm::EDGetTokenT< EcalRecHitCollectionpEERecHitsToken_
 

Detailed Description

tool to clean reco::Supercluster from effects of multiple interactions ( PU )

Author
G. Franzoni - UMN
Version
$Id:

Definition at line 24 of file EcalClusterPUCleaningTools.h.

Constructor & Destructor Documentation

◆ EcalClusterPUCleaningTools()

EcalClusterPUCleaningTools::EcalClusterPUCleaningTools ( edm::ConsumesCollector cc,
const edm::InputTag redEBRecHits,
const edm::InputTag redEERecHits 
)

Definition at line 13 of file EcalClusterPUCleaningTools.cc.

16  : pEBRecHitsToken_(cc.consumes<EcalRecHitCollection>(redEBRecHits)),
17  pEERecHitsToken_(cc.consumes<EcalRecHitCollection>(redEERecHits)),
18  geometryToken_(cc.esConsumes()) {}
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
const edm::EDGetTokenT< EcalRecHitCollection > pEERecHitsToken_
const edm::EDGetTokenT< EcalRecHitCollection > pEBRecHitsToken_

◆ ~EcalClusterPUCleaningTools()

EcalClusterPUCleaningTools::~EcalClusterPUCleaningTools ( )

Definition at line 20 of file EcalClusterPUCleaningTools.cc.

20 {}

Member Function Documentation

◆ CleanedSuperCluster()

reco::SuperCluster EcalClusterPUCleaningTools::CleanedSuperCluster ( float  xi,
const reco::SuperCluster cluster,
const edm::Event ev,
const edm::EventSetup es 
)

Definition at line 34 of file EcalClusterPUCleaningTools.cc.

References cms::cuda::assert(), SuperClusterShapeAlgo::Calculate_Covariances(), reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), ebRecHits_, DetId::Ecal, EcalBarrel, EcalEndcap, eeRecHits_, HCALHighEnergyHPDFilter_cfi::energy, SuperClusterShapeAlgo::etaWidth(), photons_cff::etaWidth, makeMEIFBenchmarkPlots::ev, geometryToken_, edm::EventSetup::getData(), getEBRecHits(), getEERecHits(), SuperClusterShapeAlgo::phiWidth(), photons_cff::phiWidth, RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, reco::SuperCluster::preshowerEnergy(), edm::PtrVector< T >::push_back(), reco::SuperCluster::seed(), fileCollector::seed, mathSSE::sqrt(), and protons_cff::xi.

37  {
38  // get the geometry
39  const auto &geometry = es.getData(geometryToken_);
40 
41  // get the RecHits
44 
45  // seed basic cluster of initial SC: this will remain in the cleaned SC, by construction
46  const reco::CaloClusterPtr &seed = scluster.seed();
47 
48  // this should be replaced by the 5x5 around the seed; a good approx of how E_seed is defined
49  float seedBCEnergy = (scluster.seed())->energy();
50  float eSeed = 0.35; // standard eSeed in EB ; see CMS IN-2010/008
51  int numBcRemoved = 0;
52 
53  double ClusterE = 0; //Sum of cluster energies for supercluster.
54  //Holders for position of this supercluster.
55  double posX = 0;
56  double posY = 0;
57  double posZ = 0;
58 
60 
61  // looping on basic clusters within the Supercluster
62  for (reco::CaloCluster_iterator bcIt = scluster.clustersBegin(); bcIt != scluster.clustersEnd(); bcIt++) {
63  // E_seed is an Et selection on 5x1 dominoes (around which BC's are built), see CMS IN-2010/008
64  // here such selection is implemented on the full BC around it
65  if ((*bcIt)->energy() >
66  sqrt(eSeed * eSeed + xi * xi * seedBCEnergy * seedBCEnergy / cosh((*bcIt)->eta()) / cosh((*bcIt)->eta()))) {
67  ;
68  } // the sum only of the BC's that pass the Esee selection
69  else {
70  numBcRemoved++;
71  continue;
72  } // count how many basic cluster get removed by the cleaning
73 
74  // if BC passes dynamic selection, include it in the 'cleaned' supercluster
75  thissc.push_back((*bcIt));
76  // cumulate energy and position of the cleaned supercluster
77  ClusterE += (*bcIt)->energy();
78  posX += (*bcIt)->energy() * (*bcIt)->position().X();
79  posY += (*bcIt)->energy() * (*bcIt)->position().Y();
80  posZ += (*bcIt)->energy() * (*bcIt)->position().Z();
81 
82  } // loop on basic clusters of the original SC
83 
84  posX /= ClusterE;
85  posY /= ClusterE;
86  posZ /= ClusterE;
87 
88  // make temporary 'cleaned' supercluster in oder to compute the covariances
89  double Epreshower = scluster.preshowerEnergy();
90  double phiWidth = 0.;
91  double etaWidth = 0.;
92  reco::SuperCluster suCltmp(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
93 
94  // construct cluster shape to compute ieta and iphi covariances of the SC
95  const CaloSubdetectorGeometry *geometry_p = nullptr;
96  if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalBarrel) {
97  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
98  SuperClusterShapeAlgo SCShape(ebRecHits_, geometry_p);
99  SCShape.Calculate_Covariances(suCltmp);
100  phiWidth = SCShape.phiWidth();
101  etaWidth = SCShape.etaWidth();
102  } else if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalEndcap) {
103  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
104  SuperClusterShapeAlgo SCShape(eeRecHits_, geometry_p);
105  SCShape.Calculate_Covariances(suCltmp);
106  phiWidth = SCShape.phiWidth();
107  etaWidth = SCShape.etaWidth();
108  } else {
109  edm::LogError("SeedError")
110  << "The seed crystal of this SC is neither in EB nor in EE. This is a problem. Bailing out";
111  assert(-1);
112  }
113 
114  // return the cleaned supercluster SCluster, with covariances updated
115  return reco::SuperCluster(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
116 }
const EcalRecHitCollection * eeRecHits_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
const EcalRecHitCollection * ebRecHits_
Log< level::Error, false > LogError
assert(be >=bs)
T sqrt(T t)
Definition: SSEVec.h:19
void getEBRecHits(const edm::Event &ev)
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
void getEERecHits(const edm::Event &ev)

◆ getEBRecHits()

void EcalClusterPUCleaningTools::getEBRecHits ( const edm::Event ev)
private

Definition at line 22 of file EcalClusterPUCleaningTools.cc.

References ebRecHits_, makeMEIFBenchmarkPlots::ev, pEBRecHitsToken_, and edm::Handle< T >::product().

Referenced by CleanedSuperCluster().

22  {
24  ev.getByToken(pEBRecHitsToken_, pEBRecHits);
25  ebRecHits_ = pEBRecHits.product();
26 }
const EcalRecHitCollection * ebRecHits_
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< EcalRecHitCollection > pEBRecHitsToken_

◆ getEERecHits()

void EcalClusterPUCleaningTools::getEERecHits ( const edm::Event ev)
private

Definition at line 28 of file EcalClusterPUCleaningTools.cc.

References eeRecHits_, makeMEIFBenchmarkPlots::ev, pEERecHitsToken_, and edm::Handle< T >::product().

Referenced by CleanedSuperCluster().

28  {
30  ev.getByToken(pEERecHitsToken_, pEERecHits);
31  eeRecHits_ = pEERecHits.product();
32 }
const EcalRecHitCollection * eeRecHits_
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< EcalRecHitCollection > pEERecHitsToken_

Member Data Documentation

◆ ebRecHits_

const EcalRecHitCollection* EcalClusterPUCleaningTools::ebRecHits_
private

Definition at line 43 of file EcalClusterPUCleaningTools.h.

Referenced by CleanedSuperCluster(), and getEBRecHits().

◆ eeRecHits_

const EcalRecHitCollection* EcalClusterPUCleaningTools::eeRecHits_
private

Definition at line 44 of file EcalClusterPUCleaningTools.h.

Referenced by CleanedSuperCluster(), and getEERecHits().

◆ geometryToken_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> EcalClusterPUCleaningTools::geometryToken_
private

Definition at line 41 of file EcalClusterPUCleaningTools.h.

Referenced by CleanedSuperCluster().

◆ pEBRecHitsToken_

const edm::EDGetTokenT<EcalRecHitCollection> EcalClusterPUCleaningTools::pEBRecHitsToken_
private

Definition at line 39 of file EcalClusterPUCleaningTools.h.

Referenced by getEBRecHits().

◆ pEERecHitsToken_

const edm::EDGetTokenT<EcalRecHitCollection> EcalClusterPUCleaningTools::pEERecHitsToken_
private

Definition at line 40 of file EcalClusterPUCleaningTools.h.

Referenced by getEERecHits().