CMS 3D CMS Logo

EcalClusterPUCleaningTools.cc
Go to the documentation of this file.
2 
7 
9 
11 
13 
15  const edm::EventSetup &es,
16  const edm::InputTag &redEBRecHits,
17  const edm::InputTag &redEERecHits) {
18  getGeometry(es);
19  getEBRecHits(ev, redEBRecHits);
20  getEERecHits(ev, redEERecHits);
21 }
22 
24 
27  es.get<CaloGeometryRecord>().get(pGeometry);
28  geometry_ = pGeometry.product();
29 }
30 
33  ev.getByLabel(redEBRecHits, pEBRecHits);
34  ebRecHits_ = pEBRecHits.product();
35 }
36 
39  ev.getByLabel(redEERecHits, pEERecHits);
40  eeRecHits_ = pEERecHits.product();
41 }
42 
44  const reco::SuperCluster &scluster,
45  const edm::Event &ev) {
46  //std::cout << "\nEcalClusterPUCleaningTools::CleanedSuperCluster called, this will give you back a cleaned supercluster" << std::endl;
47 
48  // seed basic cluster of initial SC: this will remain in the cleaned SC, by construction
49  const reco::CaloClusterPtr &seed = scluster.seed();
50 
51  // this should be replaced by the 5x5 around the seed; a good approx of how E_seed is defined
52  float seedBCEnergy = (scluster.seed())->energy();
53  float eSeed = 0.35; // standard eSeed in EB ; see CMS IN-2010/008
54  int numBcRemoved = 0;
55 
56  double ClusterE = 0; //Sum of cluster energies for supercluster.
57  //Holders for position of this supercluster.
58  double posX = 0;
59  double posY = 0;
60  double posZ = 0;
61 
63 
64  // looping on basic clusters within the Supercluster
65  for (reco::CaloCluster_iterator bcIt = scluster.clustersBegin(); bcIt != scluster.clustersEnd(); bcIt++) {
66  // E_seed is an Et selection on 5x1 dominoes (around which BC's are built), see CMS IN-2010/008
67  // here such selection is implemented on the full BC around it
68  if ((*bcIt)->energy() >
69  sqrt(eSeed * eSeed + xi * xi * seedBCEnergy * seedBCEnergy / cosh((*bcIt)->eta()) / cosh((*bcIt)->eta()))) {
70  ;
71  } // the sum only of the BC's that pass the Esee selection
72  else {
73  numBcRemoved++;
74  continue;
75  } // count how many basic cluster get removed by the cleaning
76 
77  // if BC passes dynamic selection, include it in the 'cleaned' supercluster
78  thissc.push_back((*bcIt));
79  // cumulate energy and position of the cleaned supercluster
80  ClusterE += (*bcIt)->energy();
81  posX += (*bcIt)->energy() * (*bcIt)->position().X();
82  posY += (*bcIt)->energy() * (*bcIt)->position().Y();
83  posZ += (*bcIt)->energy() * (*bcIt)->position().Z();
84 
85  } // loop on basic clusters of the original SC
86 
87  posX /= ClusterE;
88  posY /= ClusterE;
89  posZ /= ClusterE;
90 
91  // make temporary 'cleaned' supercluster in oder to compute the covariances
92  double Epreshower = scluster.preshowerEnergy();
93  double phiWidth = 0.;
94  double etaWidth = 0.;
95  reco::SuperCluster suCltmp(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
96 
97  // construct cluster shape to compute ieta and iphi covariances of the SC
98  const CaloSubdetectorGeometry *geometry_p = nullptr;
99  if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalBarrel) {
101  SuperClusterShapeAlgo SCShape(ebRecHits_, geometry_p);
102  SCShape.Calculate_Covariances(suCltmp);
103  phiWidth = SCShape.phiWidth();
104  etaWidth = SCShape.etaWidth();
105  } else if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalEndcap) {
107  SuperClusterShapeAlgo SCShape(eeRecHits_, geometry_p);
108  SCShape.Calculate_Covariances(suCltmp);
109  phiWidth = SCShape.phiWidth();
110  etaWidth = SCShape.etaWidth();
111  } else {
112  std::cout << "The seed crystal of this SC is neither in EB nor in EE. This is a problem. Bailing out " << std::endl;
113  assert(-1);
114  }
115 
116  // return the cleaned supercluster SCluster, with covariances updated
117  return reco::SuperCluster(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
118 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalClusterPUCleaningTools::getGeometry
void getGeometry(const edm::EventSetup &es)
Definition: EcalClusterPUCleaningTools.cc:25
edm::Handle::product
T const * product() const
Definition: Handle.h:70
reco::SuperCluster
Definition: SuperCluster.h:18
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EcalClusterPUCleaningTools::getEERecHits
void getEERecHits(const edm::Event &ev, const edm::InputTag &redEERecHits)
Definition: EcalClusterPUCleaningTools.cc:37
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hybridSuperClusters_cfi.xi
xi
Definition: hybridSuperClusters_cfi.py:10
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
cms::cuda::assert
assert(be >=bs)
edm::PtrVectorItr
Definition: PtrVector.h:51
EcalClusterPUCleaningTools::geometry_
const CaloGeometry * geometry_
Definition: EcalClusterPUCleaningTools.h:36
edm::Handle
Definition: AssociativeIterator.h:50
EcalBarrel
Definition: EcalSubdetector.h:10
EcalClusterPUCleaningTools::getEBRecHits
void getEBRecHits(const edm::Event &ev, const edm::InputTag &redEBRecHits)
Definition: EcalClusterPUCleaningTools.cc:31
EcalClusterPUCleaningTools::EcalClusterPUCleaningTools
EcalClusterPUCleaningTools(const edm::Event &ev, const edm::EventSetup &es, const edm::InputTag &redEBRecHits, const edm::InputTag &redEERecHits)
Definition: EcalClusterPUCleaningTools.cc:14
SuperClusterShapeAlgo.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::PtrVector< CaloCluster >
SuperClusterShapeAlgo::etaWidth
double etaWidth()
Definition: SuperClusterShapeAlgo.h:33
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
EcalClusterPUCleaningTools::eeRecHits_
const EcalRecHitCollection * eeRecHits_
Definition: EcalClusterPUCleaningTools.h:38
edm::ESHandle< CaloGeometry >
RecoTauValidation_cfi.posX
posX
Definition: RecoTauValidation_cfi.py:288
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
EcalClusterPUCleaningTools::ebRecHits_
const EcalRecHitCollection * ebRecHits_
Definition: EcalClusterPUCleaningTools.h:37
CaloGeometryRecord.h
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:149
CaloSubdetectorGeometry.h
SuperClusterShapeAlgo
Definition: SuperClusterShapeAlgo.h:27
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::SuperCluster::seed
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
SuperClusterShapeAlgo::phiWidth
double phiWidth()
Definition: SuperClusterShapeAlgo.h:34
EcalClusterTools.h
reco::SuperCluster::clustersBegin
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
edm::EventSetup
Definition: EventSetup.h:57
DetId::Ecal
Definition: DetId.h:27
get
#define get
EcalClusterPUCleaningTools::CleanedSuperCluster
reco::SuperCluster CleanedSuperCluster(float xi, const reco::SuperCluster &cluster, const edm::Event &ev)
Definition: EcalClusterPUCleaningTools.cc:43
edm::Ptr< CaloCluster >
CaloTopology.h
reco::SuperCluster::preshowerEnergy
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:61
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
CaloGeometry.h
EcalClusterPUCleaningTools::~EcalClusterPUCleaningTools
~EcalClusterPUCleaningTools()
Definition: EcalClusterPUCleaningTools.cc:23
EcalClusterPUCleaningTools.h
SuperClusterShapeAlgo::Calculate_Covariances
void Calculate_Covariances(const reco::SuperCluster &passedCluster)
Definition: SuperClusterShapeAlgo.cc:17
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
reco::SuperCluster::clustersEnd
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
RecoTauValidation_cfi.posY
posY
Definition: RecoTauValidation_cfi.py:289
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295