CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
calib::CalibElectron Class Reference

#include <CalibElectron.h>

Public Member Functions

 CalibElectron ()
 
 CalibElectron (const reco::GsfElectron *ele, const EcalRecHitCollection *theHits, const EcalRecHitCollection *theEEHits)
 
std::vector< std::pair< int, float > > getCalibModulesWeights (TString calibtype)
 
const EcalRecHitCollectiongetEERecHits ()
 
const EcalRecHitCollectiongetRecHits ()
 
const reco::GsfElectrongetRecoElectron ()
 
 ~CalibElectron ()
 

Private Attributes

const EcalRecHitCollectiontheEEHits_
 
const reco::GsfElectrontheElectron_
 
const EcalRecHitCollectiontheHits_
 

Detailed Description

Definition at line 16 of file CalibElectron.h.

Constructor & Destructor Documentation

CalibElectron::CalibElectron ( )

Definition at line 15 of file CalibElectron.cc.

15  : theElectron_(0), theHits_(0), theEEHits_(0)
16 {
17 }
const EcalRecHitCollection * theEEHits_
Definition: CalibElectron.h:41
const EcalRecHitCollection * theHits_
Definition: CalibElectron.h:40
const reco::GsfElectron * theElectron_
Definition: CalibElectron.h:38
calib::CalibElectron::CalibElectron ( const reco::GsfElectron ele,
const EcalRecHitCollection theHits,
const EcalRecHitCollection theEEHits 
)
inline

Definition at line 21 of file CalibElectron.h.

21  :
22  theElectron_(ele),
23  theHits_(theHits),
24  theEEHits_(theEEHits)
25  {
26  };
const EcalRecHitCollection * theEEHits_
Definition: CalibElectron.h:41
const EcalRecHitCollection * theHits_
Definition: CalibElectron.h:40
const reco::GsfElectron * theElectron_
Definition: CalibElectron.h:38
calib::CalibElectron::~CalibElectron ( )
inline

Definition at line 28 of file CalibElectron.h.

References getCalibModulesWeights().

28 {};

Member Function Documentation

std::vector< std::pair< int, float > > CalibElectron::getCalibModulesWeights ( TString  calibtype)

Definition at line 20 of file CalibElectron.cc.

References gather_cfg::cout, EcalBarrel, EcalEndcap, EcalRecHit::energy(), stringResolutionProvider_cfi::et, PVValHelper::eta, reco::LeafCandidate::eta(), JetChargeProducer_cfi::exp, edm::SortedCollection< T, SORT >::find(), EcalIndexingTools::getInstance(), EcalRingCalibrationTools::getModuleIndex(), EcalIndexingTools::getNumberOfChannels(), EcalIndexingTools::getProgressiveIndex(), EcalRingCalibrationTools::getRingIndex(), mps_fire::i, recoMuon::in, EcalRingCalibrationTools::N_MODULES_BARREL, EcalRingCalibrationTools::N_RING_TOTAL, funct::sin(), reco::GsfElectron::superCluster(), theEEHits_, theElectron_, theHits_, and theta().

Referenced by ~CalibElectron().

21 {
22  std::vector< std::pair<int,float> > theWeights;
23 
24  if (calibtype == "RING")
25  {
27 
29  w_ring[i]=0.;
30 
31  std::vector<std::pair<DetId,float> > scDetIds = theElectron_->superCluster()->hitsAndFractions();
32 
33 
34  for(std::vector<std::pair<DetId,float> >::const_iterator idIt=scDetIds.begin(); idIt!=scDetIds.end(); ++idIt){
35 
36  const EcalRecHit* rh=0;
37  if ( (*idIt).first.subdetId() == EcalBarrel)
38  rh = &*(theHits_->find((*idIt).first));
39  else if ( (*idIt).first.subdetId() == EcalEndcap)
40  rh = &*(theEEHits_->find((*idIt).first));
41  if (!rh)
42  std::cout << "CalibElectron::BIG ERROR::RecHit NOT FOUND" << std::endl;
43  w_ring[EcalRingCalibrationTools::getRingIndex((*idIt).first)]+=rh->energy();
44 
45  }
46 
48  if (w_ring[i]!=0.)
49  theWeights.push_back(std::pair<int,float>(i,w_ring[i]));
50  // std::cout << " ring " << i << " - energy sum " << w_ring[i] << std::endl;
51  }
52 
53  else if(calibtype == "MODULE")
54  {
55 
57 
59  w_ring[i]=0.;
60 
61  std::vector<std::pair<DetId,float> > scDetIds = theElectron_->superCluster()->hitsAndFractions();
62 
63 
64  for(std::vector<std::pair<DetId,float> >::const_iterator idIt=scDetIds.begin(); idIt!=scDetIds.end(); ++idIt){
65 
66  const EcalRecHit* rh=0;
67  if ( (*idIt).first.subdetId() == EcalBarrel)
68  rh = &*(theHits_->find((*idIt).first));
69  else if ( (*idIt).first.subdetId() == EcalEndcap)
70  rh = &*(theEEHits_->find((*idIt).first));
71  if (!rh)
72  std::cout << "CalibElectron::BIG ERROR::RecHit NOT FOUND" << std::endl;
73  w_ring[EcalRingCalibrationTools::getModuleIndex((*idIt).first)]+=rh->energy();
74 
75  }
76 
78  if (w_ring[i]!=0.)
79  theWeights.push_back(std::pair<int,float>(i,w_ring[i]));
80  // std::cout << " ring " << i << " - energy sum " << w_ring[i] << std::endl;
81 
82  }
83 
84  else if(calibtype == "ABS_SCALE")
85  {
86  std::cout<< "ENTERING CalibElectron, ABS SCALE mode"<<std::endl;
87 
88  float w_ring(0.);
89 
90  std::vector<std::pair<DetId,float> > scDetIds = theElectron_->superCluster()->hitsAndFractions();
91 
92 
93  for(std::vector<std::pair<DetId,float> >::const_iterator idIt=scDetIds.begin(); idIt!=scDetIds.end(); ++idIt){
94 
95  const EcalRecHit* rh=0;
96  if ( (*idIt).first.subdetId() == EcalBarrel)
97  rh = &*(theHits_->find((*idIt).first));
98  else if ( (*idIt).first.subdetId() == EcalEndcap)
99  rh = &*(theEEHits_->find((*idIt).first));
100  if (!rh)
101  std::cout << "CalibElectron::BIG ERROR::RecHit NOT FOUND" << std::endl;
102 
103  w_ring += rh->energy();
104 
105  }
106 
107  if(w_ring != 0.)
108  theWeights.push_back(std::pair<int,float>(0,w_ring));
109  std::cout << " ABS SCALE - energy sum " << w_ring << std::endl;
110 
111  }
112 
113  else if(calibtype == "ETA_ET_MODE")
114  {
115 
116  float w_ring[ 200 ];
117 
119  w_ring[i]=0.;
120 
121  std::vector<std::pair<DetId,float> > scDetIds = theElectron_->superCluster()->hitsAndFractions();
122 
123 
124  for(std::vector<std::pair<DetId,float> >::const_iterator idIt=scDetIds.begin(); idIt!=scDetIds.end(); ++idIt){
125  const EcalRecHit* rh=0;
126  if ( (*idIt).first.subdetId() == EcalBarrel)
127  rh = &*(theHits_->find((*idIt).first));
128  else if ( (*idIt).first.subdetId() == EcalEndcap)
129  rh = &*(theEEHits_->find((*idIt).first));
130  if (!rh)
131  std::cout << "CalibElectron::BIG ERROR::RecHit NOT FOUND" << std::endl;
132 
133  float eta = fabs( theElectron_->eta() );
134  float theta = 2. * atan( exp(- eta) );
135  float et = theElectron_->superCluster()->energy() * sin(theta);
136 
138 
139  w_ring[in]+=rh->energy();
140  //w_ring[in]+=theElectron_->superCluster()->energy();
141 
142  std::cout << "CalibElectron::filling channel " << in << " with value " << theElectron_->superCluster()->energy() << std::endl;
143  }
144 
146  if (w_ring[i]!=0.){
147  theWeights.push_back(std::pair<int,float>(i,w_ring[i]));
148  std::cout << " ring " << i << " - energy sum " << w_ring[i] << std::endl;
149  }
150 
151  }
152 
153  }
154 
155  else
156  {
157  std::cout << "CalibType not yet implemented" << std::endl;
158 
159  }
160 
161  return theWeights;
162 
163 }
static short getModuleIndex(DetId aDetId)
virtual double eta() const final
momentum pseudorapidity
const EcalRecHitCollection * theEEHits_
Definition: CalibElectron.h:41
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
static short getRingIndex(DetId aDetId)
Retrieve the phi-ring index corresponding to a DetId.
const EcalRecHitCollection * theHits_
Definition: CalibElectron.h:40
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:184
static EcalIndexingTools * getInstance()
float energy() const
Definition: EcalRecHit.h:68
int getProgressiveIndex(double, double)
et
define resolution functions of each parameter
iterator find(key_type k)
const reco::GsfElectron * theElectron_
Definition: CalibElectron.h:38
static constexpr short N_RING_TOTAL
static constexpr short N_MODULES_BARREL
const EcalRecHitCollection* calib::CalibElectron::getEERecHits ( )
inline

Definition at line 34 of file CalibElectron.h.

References theEEHits_.

34 { return theEEHits_; }
const EcalRecHitCollection * theEEHits_
Definition: CalibElectron.h:41
const EcalRecHitCollection* calib::CalibElectron::getRecHits ( )
inline

Definition at line 33 of file CalibElectron.h.

References theHits_.

33 { return theHits_; }
const EcalRecHitCollection * theHits_
Definition: CalibElectron.h:40
const reco::GsfElectron* calib::CalibElectron::getRecoElectron ( )
inline

Definition at line 32 of file CalibElectron.h.

References theElectron_.

Referenced by ZIterativeAlgorithmWithFit::addEvent(), ZeePlots::fillEleClassesPlots(), and ZIterativeAlgorithmWithFit::getWeight().

32 { return theElectron_; }
const reco::GsfElectron * theElectron_
Definition: CalibElectron.h:38

Member Data Documentation

const EcalRecHitCollection* calib::CalibElectron::theEEHits_
private

Definition at line 41 of file CalibElectron.h.

Referenced by getCalibModulesWeights(), and getEERecHits().

const reco::GsfElectron* calib::CalibElectron::theElectron_
private

Definition at line 38 of file CalibElectron.h.

Referenced by getCalibModulesWeights(), and getRecoElectron().

const EcalRecHitCollection* calib::CalibElectron::theHits_
private

Definition at line 40 of file CalibElectron.h.

Referenced by getCalibModulesWeights(), and getRecHits().