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_, hcalRecHitTable_cff::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 
52  double ClusterE = 0; //Sum of cluster energies for supercluster.
53  //Holders for position of this supercluster.
54  double posX = 0;
55  double posY = 0;
56  double posZ = 0;
57 
59 
60  // looping on basic clusters within the Supercluster
61  for (reco::CaloCluster_iterator bcIt = scluster.clustersBegin(); bcIt != scluster.clustersEnd(); bcIt++) {
62  // E_seed is an Et selection on 5x1 dominoes (around which BC's are built), see CMS IN-2010/008
63  // here such selection is implemented on the full BC around it
64  if ((*bcIt)->energy() >
65  sqrt(eSeed * eSeed + xi * xi * seedBCEnergy * seedBCEnergy / cosh((*bcIt)->eta()) / cosh((*bcIt)->eta()))) {
66  ;
67  } // the sum only of the BC's that pass the Esee selection
68 
69  // if BC passes dynamic selection, include it in the 'cleaned' supercluster
70  thissc.push_back((*bcIt));
71  // cumulate energy and position of the cleaned supercluster
72  ClusterE += (*bcIt)->energy();
73  posX += (*bcIt)->energy() * (*bcIt)->position().X();
74  posY += (*bcIt)->energy() * (*bcIt)->position().Y();
75  posZ += (*bcIt)->energy() * (*bcIt)->position().Z();
76 
77  } // loop on basic clusters of the original SC
78 
79  posX /= ClusterE;
80  posY /= ClusterE;
81  posZ /= ClusterE;
82 
83  // make temporary 'cleaned' supercluster in oder to compute the covariances
84  double Epreshower = scluster.preshowerEnergy();
85  double phiWidth = 0.;
86  double etaWidth = 0.;
87  reco::SuperCluster suCltmp(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
88 
89  // construct cluster shape to compute ieta and iphi covariances of the SC
90  const CaloSubdetectorGeometry *geometry_p = nullptr;
91  if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalBarrel) {
92  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
93  SuperClusterShapeAlgo SCShape(ebRecHits_, geometry_p);
94  SCShape.Calculate_Covariances(suCltmp);
95  phiWidth = SCShape.phiWidth();
96  etaWidth = SCShape.etaWidth();
97  } else if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalEndcap) {
98  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
99  SuperClusterShapeAlgo SCShape(eeRecHits_, geometry_p);
100  SCShape.Calculate_Covariances(suCltmp);
101  phiWidth = SCShape.phiWidth();
102  etaWidth = SCShape.etaWidth();
103  } else {
104  edm::LogError("SeedError")
105  << "The seed crystal of this SC is neither in EB nor in EE. This is a problem. Bailing out";
106  assert(-1);
107  }
108 
109  // return the cleaned supercluster SCluster, with covariances updated
110  return reco::SuperCluster(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
111 }
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:152
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().