CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
 EcalClusterPUCleaningTools (const edm::Event &ev, const edm::EventSetup &es, const edm::InputTag &redEBRecHits, const edm::InputTag &redEERecHits)
 
 ~EcalClusterPUCleaningTools ()
 

Private Member Functions

void getEBRecHits (const edm::Event &ev, const edm::InputTag &redEBRecHits)
 
void getEERecHits (const edm::Event &ev, const edm::InputTag &redEERecHits)
 
void getGeometry (const edm::EventSetup &es)
 

Private Attributes

const EcalRecHitCollectionebRecHits_
 
const EcalRecHitCollectioneeRecHits_
 
const CaloGeometrygeometry_
 

Detailed Description

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

Author
G. Franzoni - UMN
Version
$Id:

Definition at line 22 of file EcalClusterPUCleaningTools.h.

Constructor & Destructor Documentation

EcalClusterPUCleaningTools::EcalClusterPUCleaningTools ( const edm::Event ev,
const edm::EventSetup es,
const edm::InputTag redEBRecHits,
const edm::InputTag redEERecHits 
)

Definition at line 14 of file EcalClusterPUCleaningTools.cc.

References getEBRecHits(), getEERecHits(), and getGeometry().

15 {
16  getGeometry( es );
17  getEBRecHits( ev, redEBRecHits );
18  getEERecHits( ev, redEERecHits );
19 }
void getEBRecHits(const edm::Event &ev, const edm::InputTag &redEBRecHits)
void getEERecHits(const edm::Event &ev, const edm::InputTag &redEERecHits)
void getGeometry(const edm::EventSetup &es)
EcalClusterPUCleaningTools::~EcalClusterPUCleaningTools ( )

Definition at line 23 of file EcalClusterPUCleaningTools.cc.

24 {
25 }

Member Function Documentation

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

Definition at line 52 of file EcalClusterPUCleaningTools.cc.

References assert(), SuperClusterShapeAlgo::Calculate_Covariances(), reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), gather_cfg::cout, ebRecHits_, DetId::Ecal, EcalBarrel, EcalEndcap, eeRecHits_, relval_parameters_module::energy, SuperClusterShapeAlgo::etaWidth(), geometry_, CaloGeometry::getSubdetectorGeometry(), SuperClusterShapeAlgo::phiWidth(), reco::SuperCluster::preshowerEnergy(), edm::PtrVector< T >::push_back(), reco::SuperCluster::seed(), fileCollector::seed, and mathSSE::sqrt().

52  {
53 
54  //std::cout << "\nEcalClusterPUCleaningTools::CleanedSuperCluster called, this will give you back a cleaned supercluster" << std::endl;
55 
56  // seed basic cluster of initial SC: this will remain in the cleaned SC, by construction
57  reco::CaloClusterPtr seed = scluster.seed();
58 
59  float seedBCEnergy = (scluster.seed())->energy(); // this should be replaced by the 5x5 around the seed; a good approx of how E_seed is defined
60  float eSeed = 0.35; // standard eSeed in EB ; see CMS IN-2010/008
61  int numBcRemoved = 0;
62 
63  double ClusterE = 0; //Sum of cluster energies for supercluster.
64  //Holders for position of this supercluster.
65  double posX=0;
66  double posY=0;
67  double posZ=0;
68 
70 
71  // looping on basic clusters within the Supercluster
72  for(reco::CaloCluster_iterator bcIt = scluster.clustersBegin(); bcIt!=scluster.clustersEnd(); bcIt++)
73  {
74  // E_seed is an Et selection on 5x1 dominoes (around which BC's are built), see CMS IN-2010/008
75  // here such selection is implemented on the full BC around it
76  if( (*bcIt)->energy() > sqrt( eSeed*eSeed + xi*xi*seedBCEnergy*seedBCEnergy/cosh((*bcIt)->eta())/cosh((*bcIt)->eta()) ) )
77  {
78  ;
79  }// the sum only of the BC's that pass the Esee selection
80  else{
81  numBcRemoved++;
82  continue;
83  }// count how many basic cluster get removed by the cleaning
84 
85  // if BC passes dynamic selection, include it in the 'cleaned' supercluster
86  thissc.push_back( (*bcIt) );
87  // cumulate energy and position of the cleaned supercluster
88  ClusterE += (*bcIt)->energy();
89  posX += (*bcIt)->energy() * (*bcIt)->position().X();
90  posY += (*bcIt)->energy() * (*bcIt)->position().Y();
91  posZ += (*bcIt)->energy() * (*bcIt)->position().Z();
92 
93  }// loop on basic clusters of the original SC
94 
95  posX /= ClusterE;
96  posY /= ClusterE;
97  posZ /= ClusterE;
98 
99  // make temporary 'cleaned' supercluster in oder to compute the covariances
100  double Epreshower=scluster.preshowerEnergy();
101  double phiWidth=0.;
102  double etaWidth=0.;
103  reco::SuperCluster suCltmp(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
104 
105 
106  // construct cluster shape to compute ieta and iphi covariances of the SC
107  const CaloSubdetectorGeometry *geometry_p=0;
108  if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalBarrel){
110  SuperClusterShapeAlgo SCShape( ebRecHits_ , geometry_p);
111  SCShape.Calculate_Covariances( suCltmp );
112  phiWidth= SCShape.phiWidth();
113  etaWidth= SCShape.etaWidth();
114  }
115  else if (seed->seed().det() == DetId::Ecal && seed->seed().subdetId() == EcalEndcap){
117  SuperClusterShapeAlgo SCShape( eeRecHits_ , geometry_p);
118  SCShape.Calculate_Covariances( suCltmp );
119  phiWidth= SCShape.phiWidth();
120  etaWidth= SCShape.etaWidth();
121  }
122  else {
123  std::cout << "The seed crystal of this SC is neither in EB nor in EE. This is a problem. Bailing out " << std::endl;
124  assert(-1);
125  }
126 
127  // return the cleaned supercluster SCluster, with covariances updated
128  return reco::SuperCluster(ClusterE, math::XYZPoint(posX, posY, posZ), seed, thissc, Epreshower, phiWidth, etaWidth);
129 
130 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
const EcalRecHitCollection * eeRecHits_
void push_back(Ptr< T > const &iPtr)
Definition: PtrVector.h:139
const EcalRecHitCollection * ebRecHits_
assert(m_qm.get())
T sqrt(T t)
Definition: SSEVec.h:48
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
tuple cout
Definition: gather_cfg.py:121
void EcalClusterPUCleaningTools::getEBRecHits ( const edm::Event ev,
const edm::InputTag redEBRecHits 
)
private

Definition at line 35 of file EcalClusterPUCleaningTools.cc.

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

Referenced by EcalClusterPUCleaningTools().

36 {
38  ev.getByLabel( redEBRecHits, pEBRecHits );
39  ebRecHits_ = pEBRecHits.product();
40 }
const EcalRecHitCollection * ebRecHits_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
T const * product() const
Definition: Handle.h:81
void EcalClusterPUCleaningTools::getEERecHits ( const edm::Event ev,
const edm::InputTag redEERecHits 
)
private

Definition at line 44 of file EcalClusterPUCleaningTools.cc.

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

Referenced by EcalClusterPUCleaningTools().

45 {
47  ev.getByLabel( redEERecHits, pEERecHits );
48  eeRecHits_ = pEERecHits.product();
49 }
const EcalRecHitCollection * eeRecHits_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
T const * product() const
Definition: Handle.h:81
void EcalClusterPUCleaningTools::getGeometry ( const edm::EventSetup es)
private

Definition at line 28 of file EcalClusterPUCleaningTools.cc.

References geometry_, edm::EventSetup::get(), and edm::ESHandle< class >::product().

Referenced by EcalClusterPUCleaningTools().

29 {
31  es.get<CaloGeometryRecord>().get(pGeometry);
32  geometry_ = pGeometry.product();
33 }
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const EcalRecHitCollection* EcalClusterPUCleaningTools::ebRecHits_
private

Definition at line 34 of file EcalClusterPUCleaningTools.h.

Referenced by CleanedSuperCluster(), and getEBRecHits().

const EcalRecHitCollection* EcalClusterPUCleaningTools::eeRecHits_
private

Definition at line 35 of file EcalClusterPUCleaningTools.h.

Referenced by CleanedSuperCluster(), and getEERecHits().

const CaloGeometry* EcalClusterPUCleaningTools::geometry_
private

Definition at line 33 of file EcalClusterPUCleaningTools.h.

Referenced by CleanedSuperCluster(), and getGeometry().