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 Attributes
BaselinePFSCRegression Class Reference

#include <BaselinePFSCRegression.h>

Public Member Functions

 BaselinePFSCRegression ()
 
void set (const reco::SuperCluster &, std::vector< float > &) const
 
void setEvent (const edm::Event &)
 
void setTokens (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
void update (const edm::EventSetup &)
 

Private Attributes

edm::ESHandle< CaloGeometrycalogeom
 
edm::ESHandle< CaloTopologycalotopo
 
EcalClusterLocal ecl_
 
const CaloGeometryRecordgeom_record
 
edm::EDGetTokenT
< EcalRecHitCollection
inputTagEBRecHits_
 
edm::EDGetTokenT
< EcalRecHitCollection
inputTagEERecHits_
 
edm::EDGetTokenT
< reco::VertexCollection
inputTagVertices_
 
edm::Handle< EcalRecHitCollectionrechitsEB
 
edm::Handle< EcalRecHitCollectionrechitsEE
 
const CaloTopologyRecordtopo_record
 
edm::Handle
< reco::VertexCollection
vertices
 

Detailed Description

Definition at line 30 of file BaselinePFSCRegression.h.

Constructor & Destructor Documentation

BaselinePFSCRegression::BaselinePFSCRegression ( )
inline

Definition at line 32 of file BaselinePFSCRegression.h.

#define NULL
Definition: scimark2.h:8
const CaloTopologyRecord * topo_record
const CaloGeometryRecord * geom_record

Member Function Documentation

void BaselinePFSCRegression::set ( const reco::SuperCluster sc,
std::vector< float > &  vars 
) const

Definition at line 23 of file BaselinePFSCRegression.cc.

References calogeom, calotopo, reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), reco::SuperCluster::clustersSize(), reco::CaloCluster::correctedEnergy(), EcalClusterTools::e2nd(), EcalClusterTools::e3x3(), EcalClusterTools::eBottom(), EcalBarrel, EcalEndcap, ecl_, EcalClusterTools::eLeft(), jptDQMConfig_cff::eMax, EcalClusterTools::eMax(), EcalClusterTools::eRight(), reco::CaloCluster::eta(), reco::SuperCluster::etaWidth(), EcalClusterTools::eTop(), edm::hlt::Exception, f, edm::detail::isnan(), EcalClusterLocal::localCoordsEB(), EcalClusterTools::localCovariances(), reco::CaloCluster::phi(), Phi_mpi_pi(), reco::SuperCluster::phiWidth(), reco::SuperCluster::preshowerEnergy(), reco::SuperCluster::rawEnergy(), rechitsEB, rechitsEE, reco::SuperCluster::seed(), mathSSE::sqrt(), and vertices.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

24  {
25  vars.clear();
26  vars.resize(33);
27  const double rawEnergy = sc.rawEnergy(), calibEnergy = sc.correctedEnergy();
28  const edm::Ptr<reco::CaloCluster> &seed = sc.seed();
29  const size_t nVtx = vertices->size();
30  float maxDR=999., maxDRDPhi=999., maxDRDEta=999., maxDRRawEnergy=0.;
31  float subClusRawE[3], subClusDPhi[3], subClusDEta[3];
32  memset(subClusRawE,0,3*sizeof(float));
33  memset(subClusDPhi,0,3*sizeof(float));
34  memset(subClusDEta,0,3*sizeof(float));
35  size_t iclus=0;
36  for( auto clus = sc.clustersBegin()+1; clus != sc.clustersEnd(); ++clus ) {
37  const float this_deta = (*clus)->eta() - seed->eta();
38  const float this_dphi = TVector2::Phi_mpi_pi((*clus)->phi() - seed->phi());
39  const float this_dr = std::hypot(this_deta,this_dphi);
40  if(this_dr > maxDR || maxDR == 999.0f) {
41  maxDR = this_dr;
42  maxDRDEta = this_deta;
43  maxDRDPhi = this_dphi;
44  maxDRRawEnergy = (*clus)->energy();
45  }
46  if( iclus++ < 3 ) {
47  subClusRawE[iclus] = (*clus)->energy();
48  subClusDEta[iclus] = this_deta;
49  subClusDPhi[iclus] = this_dphi;
50  }
51  }
52  float scPreshowerSum = sc.preshowerEnergy();
53  switch( seed->hitsAndFractions().at(0).first.subdetId() ) {
54  case EcalBarrel:
55  {
56  const float eMax = EcalClusterTools::eMax( *seed, &*rechitsEB );
57  const float e2nd = EcalClusterTools::e2nd( *seed, &*rechitsEB );
58  const float e3x3 = EcalClusterTools::e3x3( *seed,
59  &*rechitsEB,
60  &*calotopo );
61  const float eTop = EcalClusterTools::eTop( *seed,
62  &*rechitsEB,
63  &*calotopo );
64  const float eBottom = EcalClusterTools::eBottom( *seed,
65  &*rechitsEB,
66  &*calotopo );
67  const float eLeft = EcalClusterTools::eLeft( *seed,
68  &*rechitsEB,
69  &*calotopo );
70  const float eRight = EcalClusterTools::eRight( *seed,
71  &*rechitsEB,
72  &*calotopo );
73  const float eLpeR = eLeft + eRight;
74  const float eTpeB = eTop + eBottom;
75  const float eLmeR = eLeft - eRight;
76  const float eTmeB = eTop - eBottom;
77  std::vector<float> vCov =
79  const float see = (isnan(vCov[0]) ? 0. : sqrt(vCov[0]));
80  const float spp = (isnan(vCov[2]) ? 0. : sqrt(vCov[2]));
81  float sep = 0.;
82  if (see*spp > 0)
83  sep = vCov[1] / (see * spp);
84  else if (vCov[1] > 0)
85  sep = 1.0;
86  else
87  sep = -1.0;
88  float cryPhi, cryEta, thetatilt, phitilt;
89  int ieta, iphi;
90  ecl_.localCoordsEB(*seed, *calogeom, cryEta, cryPhi,
91  ieta, iphi, thetatilt, phitilt);
92  vars[0] = nVtx; //nVtx
93  vars[1] = sc.eta(); //scEta
94  vars[2] = sc.phi(); //scPhi
95  vars[3] = sc.etaWidth(); //scEtaWidth
96  vars[4] = sc.phiWidth(); //scPhiWidth
97  vars[5] = e3x3/rawEnergy; //scSeedR9
98  vars[6] = sc.seed()->energy()/rawEnergy; //scSeedRawEnergy/scRawEnergy
99  vars[7] = eMax/rawEnergy; //scSeedEmax/scRawEnergy
100  vars[8] = e2nd/rawEnergy; //scSeedE2nd/scRawEnergy
101  vars[9] = (eLpeR!=0. ? eLmeR/eLpeR : 0.);//scSeedLeftRightAsym
102  vars[10] = (eTpeB!=0.? eTmeB/eTpeB : 0.);//scSeedTopBottomAsym
103  vars[11] = see; //scSeedSigmaIetaIeta
104  vars[12] = sep; //scSeedSigmaIetaIphi
105  vars[13] = spp; //scSeedSigmaIphiIphi
106  vars[14] = sc.clustersSize()-1; //N_ECALClusters
107  vars[15] = maxDR; //clusterMaxDR
108  vars[16] = maxDRDPhi; //clusterMaxDRDPhi
109  vars[17] = maxDRDEta; //clusterMaxDRDEta
110  vars[18] = maxDRRawEnergy/rawEnergy; //clusMaxDRRawEnergy/scRawEnergy
111  vars[19] = subClusRawE[0]/rawEnergy; //clusterRawEnergy[0]/scRawEnergy
112  vars[20] = subClusRawE[1]/rawEnergy; //clusterRawEnergy[1]/scRawEnergy
113  vars[21] = subClusRawE[2]/rawEnergy; //clusterRawEnergy[2]/scRawEnergy
114  vars[22] = subClusDPhi[0]; //clusterDPhiToSeed[0]
115  vars[23] = subClusDPhi[1]; //clusterDPhiToSeed[1]
116  vars[24] = subClusDPhi[2]; //clusterDPhiToSeed[2]
117  vars[25] = subClusDEta[0]; //clusterDEtaToSeed[0]
118  vars[26] = subClusDEta[1]; //clusterDEtaToSeed[1]
119  vars[27] = subClusDEta[2]; //clusterDEtaToSeed[2]
120  vars[28] = cryEta; //scSeedCryEta
121  vars[29] = cryPhi; //scSeedCryPhi
122  vars[30] = ieta; //scSeedCryIeta
123  vars[31] = iphi; //scSeedCryIphi
124  vars[32] = calibEnergy; //scCalibratedEnergy
125  }
126  break;
127  case EcalEndcap:
128  {
129  const float eMax = EcalClusterTools::eMax( *seed, &*rechitsEE );
130  const float e2nd = EcalClusterTools::e2nd( *seed, &*rechitsEE );
131  const float e3x3 = EcalClusterTools::e3x3( *seed,
132  &*rechitsEE,
133  &*calotopo );
134  const float eTop = EcalClusterTools::eTop( *seed,
135  &*rechitsEE,
136  &*calotopo );
137  const float eBottom = EcalClusterTools::eBottom( *seed,
138  &*rechitsEE,
139  &*calotopo );
140  const float eLeft = EcalClusterTools::eLeft( *seed,
141  &*rechitsEE,
142  &*calotopo );
143  const float eRight = EcalClusterTools::eRight( *seed,
144  &*rechitsEE,
145  &*calotopo );
146  const float eLpeR = eLeft + eRight;
147  const float eTpeB = eTop + eBottom;
148  const float eLmeR = eLeft - eRight;
149  const float eTmeB = eTop - eBottom;
150  std::vector<float> vCov =
152  const float see = (isnan(vCov[0]) ? 0. : sqrt(vCov[0]));
153  const float spp = (isnan(vCov[2]) ? 0. : sqrt(vCov[2]));
154  float sep = 0.;
155  if (see*spp > 0)
156  sep = vCov[1] / (see * spp);
157  else if (vCov[1] > 0)
158  sep = 1.0;
159  else
160  sep = -1.0;
161  vars[0] = nVtx; //nVtx
162  vars[1] = sc.eta(); //scEta
163  vars[2] = sc.phi(); //scPhi
164  vars[3] = sc.etaWidth(); //scEtaWidth
165  vars[4] = sc.phiWidth(); //scPhiWidth
166  vars[5] = e3x3/rawEnergy; //scSeedR9
167  vars[6] = sc.seed()->energy()/rawEnergy; //scSeedRawEnergy/scRawEnergy
168  vars[7] = eMax/rawEnergy; //scSeedEmax/scRawEnergy
169  vars[8] = e2nd/rawEnergy; //scSeedE2nd/scRawEnergy
170  vars[9] = (eLpeR!=0. ? eLmeR/eLpeR : 0.);//scSeedLeftRightAsym
171  vars[10] = (eTpeB!=0.? eTmeB/eTpeB : 0.);//scSeedTopBottomAsym
172  vars[11] = see; //scSeedSigmaIetaIeta
173  vars[12] = sep; //scSeedSigmaIetaIphi
174  vars[13] = spp; //scSeedSigmaIphiIphi
175  vars[14] = sc.clustersSize()-1; //N_ECALClusters
176  vars[15] = maxDR; //clusterMaxDR
177  vars[16] = maxDRDPhi; //clusterMaxDRDPhi
178  vars[17] = maxDRDEta; //clusterMaxDRDEta
179  vars[18] = maxDRRawEnergy/rawEnergy; //clusMaxDRRawEnergy/scRawEnergy
180  vars[19] = subClusRawE[0]/rawEnergy; //clusterRawEnergy[0]/scRawEnergy
181  vars[20] = subClusRawE[1]/rawEnergy; //clusterRawEnergy[1]/scRawEnergy
182  vars[21] = subClusRawE[2]/rawEnergy; //clusterRawEnergy[2]/scRawEnergy
183  vars[22] = subClusDPhi[0]; //clusterDPhiToSeed[0]
184  vars[23] = subClusDPhi[1]; //clusterDPhiToSeed[1]
185  vars[24] = subClusDPhi[2]; //clusterDPhiToSeed[2]
186  vars[25] = subClusDEta[0]; //clusterDEtaToSeed[0]
187  vars[26] = subClusDEta[1]; //clusterDEtaToSeed[1]
188  vars[27] = subClusDEta[2]; //clusterDEtaToSeed[2]
189  vars[28] = scPreshowerSum/rawEnergy; //scPreshowerEnergy/scRawEnergy
190  vars[29] = calibEnergy; //scCalibratedEnergy
191  }
192  break;
193  default:
194  throw cms::Exception("PFECALSuperClusterProducer::calculateRegressedEnergy")
195  << "Supercluster seed is either EB nor EE!" << std::endl;
196  }
197 }
static float eBottom(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double correctedEnergy() const
Definition: CaloCluster.h:121
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:55
edm::Handle< reco::VertexCollection > vertices
edm::Handle< EcalRecHitCollection > rechitsEB
double Phi_mpi_pi(double x)
Definition: JetUtil.h:24
static float e2nd(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:161
double etaWidth() const
Definition: SuperCluster.h:56
static std::vector< float > localCovariances(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:48
edm::ESHandle< CaloTopology > calotopo
static float e3x3(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double f[11][100]
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:47
edm::ESHandle< CaloGeometry > calogeom
static float eRight(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float eTop(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
size_t clustersSize() const
number of BasicCluster constituents
Definition: SuperCluster.h:87
static float eMax(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:50
static float eLeft(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:164
edm::Handle< EcalRecHitCollection > rechitsEE
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78
void BaselinePFSCRegression::setEvent ( const edm::Event ev)

Definition at line 209 of file BaselinePFSCRegression.cc.

References edm::Event::getByToken(), inputTagEBRecHits_, inputTagEERecHits_, inputTagVertices_, rechitsEB, rechitsEE, and vertices.

209  {
213 }
edm::EDGetTokenT< EcalRecHitCollection > inputTagEERecHits_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::Handle< reco::VertexCollection > vertices
edm::Handle< EcalRecHitCollection > rechitsEB
edm::EDGetTokenT< EcalRecHitCollection > inputTagEBRecHits_
edm::EDGetTokenT< reco::VertexCollection > inputTagVertices_
edm::Handle< EcalRecHitCollection > rechitsEE
void BaselinePFSCRegression::setTokens ( const edm::ParameterSet ps,
edm::ConsumesCollector &&  cc 
)

Definition at line 200 of file BaselinePFSCRegression.cc.

References edm::ParameterSet::getParameter(), inputTagEBRecHits_, inputTagEERecHits_, and inputTagVertices_.

200  {
201  const edm::InputTag rceb = ps.getParameter<edm::InputTag>("ecalRecHitsEB");
202  const edm::InputTag rcee = ps.getParameter<edm::InputTag>("ecalRecHitsEE");
203  const edm::InputTag vtx = ps.getParameter<edm::InputTag>("vertexCollection");
207 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > inputTagEERecHits_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< EcalRecHitCollection > inputTagEBRecHits_
edm::EDGetTokenT< reco::VertexCollection > inputTagVertices_
void BaselinePFSCRegression::update ( const edm::EventSetup es)

Definition at line 8 of file BaselinePFSCRegression.cc.

References edm::eventsetup::EventSetupRecord::cacheIdentifier(), calogeom, calotopo, geom_record, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), and topo_record.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

8  {
9  const CaloTopologyRecord& topofrom_es = es.get<CaloTopologyRecord>();
10  if( !topo_record ||
11  topofrom_es.cacheIdentifier() != topo_record->cacheIdentifier() ) {
12  topo_record = &topofrom_es;
14  }
15  const CaloGeometryRecord& geomfrom_es = es.get<CaloGeometryRecord>();
16  if( !geom_record ||
17  geomfrom_es.cacheIdentifier() != geom_record->cacheIdentifier() ) {
18  geom_record = &geomfrom_es;
20  }
21 }
unsigned long long cacheIdentifier() const
void get(HolderT &iHolder) const
edm::ESHandle< CaloTopology > calotopo
const CaloTopologyRecord * topo_record
edm::ESHandle< CaloGeometry > calogeom
const T & get() const
Definition: EventSetup.h:55
const CaloGeometryRecord * geom_record

Member Data Documentation

edm::ESHandle<CaloGeometry> BaselinePFSCRegression::calogeom
private

Definition at line 43 of file BaselinePFSCRegression.h.

Referenced by set(), and update().

edm::ESHandle<CaloTopology> BaselinePFSCRegression::calotopo
private

Definition at line 42 of file BaselinePFSCRegression.h.

Referenced by set(), and update().

EcalClusterLocal BaselinePFSCRegression::ecl_
private

Definition at line 41 of file BaselinePFSCRegression.h.

Referenced by set().

const CaloGeometryRecord* BaselinePFSCRegression::geom_record
private

Definition at line 40 of file BaselinePFSCRegression.h.

Referenced by update().

edm::EDGetTokenT<EcalRecHitCollection> BaselinePFSCRegression::inputTagEBRecHits_
private

Definition at line 44 of file BaselinePFSCRegression.h.

Referenced by setEvent(), and setTokens().

edm::EDGetTokenT<EcalRecHitCollection> BaselinePFSCRegression::inputTagEERecHits_
private

Definition at line 45 of file BaselinePFSCRegression.h.

Referenced by setEvent(), and setTokens().

edm::EDGetTokenT<reco::VertexCollection> BaselinePFSCRegression::inputTagVertices_
private

Definition at line 46 of file BaselinePFSCRegression.h.

Referenced by setEvent(), and setTokens().

edm::Handle<EcalRecHitCollection> BaselinePFSCRegression::rechitsEB
private

Definition at line 48 of file BaselinePFSCRegression.h.

Referenced by set(), and setEvent().

edm::Handle<EcalRecHitCollection> BaselinePFSCRegression::rechitsEE
private

Definition at line 48 of file BaselinePFSCRegression.h.

Referenced by set(), and setEvent().

const CaloTopologyRecord* BaselinePFSCRegression::topo_record
private

Definition at line 39 of file BaselinePFSCRegression.h.

Referenced by update().

edm::Handle<reco::VertexCollection> BaselinePFSCRegression::vertices
private

Definition at line 47 of file BaselinePFSCRegression.h.

Referenced by set(), and setEvent().