CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
SingleEleCalibSelector Class Reference

#include <SingleEleCalibSelector.h>

Public Types

typedef reco::GsfElectronCollection collection
 
typedef container::const_iterator const_iterator
 
typedef std::vector< const reco::GsfElectron * > container
 
typedef reco::GsfElectronRef electron
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
void select (edm::Handle< collection >, const edm::Event &, const edm::EventSetup &)
 
 SingleEleCalibSelector (const edm::ParameterSet &iConfig)
 ctor More...
 
 ~SingleEleCalibSelector ()
 dtor More...
 

Private Member Functions

double EnergyNxN (const std::vector< DetId > &vNxN, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits)
 
DetId findMaxHit (const std::vector< std::pair< DetId, float > > &v1, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits)
 

Private Attributes

double E3x3OE5x5Max_
 
double E3x3OE5x5Min_
 
double E3x3OPinMax_
 
double E3x3OPinMin_
 
double E5x5OPoutMax_
 
double E5x5OPoutMin_
 
edm::InputTag EBrecHitLabel_
 
edm::InputTag EErecHitLabel_
 
double ESCOPinMax_
 
double ESCOPinMin_
 
double ESeedOPoutMax_
 
double ESeedOPoutMin_
 
double PinMPoutOPinMax_
 
double PinMPoutOPinMin_
 
container selected_
 
edm::ESHandle< CaloTopologytheCaloTopology
 the selected collection More...
 

Detailed Description

Definition at line 19 of file SingleEleCalibSelector.h.

Member Typedef Documentation

Definition at line 23 of file SingleEleCalibSelector.h.

typedef container::const_iterator SingleEleCalibSelector::const_iterator

Definition at line 26 of file SingleEleCalibSelector.h.

Definition at line 25 of file SingleEleCalibSelector.h.

Definition at line 24 of file SingleEleCalibSelector.h.

Constructor & Destructor Documentation

SingleEleCalibSelector::SingleEleCalibSelector ( const edm::ParameterSet iConfig)

ctor

Definition at line 27 of file SingleEleCalibSelector.cc.

References E3x3OE5x5Max_, E3x3OE5x5Min_, E3x3OPinMax_, E3x3OPinMin_, E5x5OPoutMax_, E5x5OPoutMin_, EBrecHitLabel_, EErecHitLabel_, ESCOPinMax_, ESCOPinMin_, ESeedOPoutMax_, ESeedOPoutMin_, edm::ParameterSet::getParameter(), PinMPoutOPinMax_, and PinMPoutOPinMin_.

28  {
29  ESCOPinMin_ = iConfig.getParameter<double>("ESCOPinMin");
30  ESCOPinMax_ = iConfig.getParameter<double>("ESCOPinMax");
31  ESeedOPoutMin_ = iConfig.getParameter<double>("ESeedOPoutMin");
32  ESeedOPoutMax_ = iConfig.getParameter<double>("ESeedOPoutMax");
33  PinMPoutOPinMin_ = iConfig.getParameter<double>("PinMPoutOPinMin");
34  PinMPoutOPinMax_ = iConfig.getParameter<double>("PinMPoutOPinMax");
35  E5x5OPoutMin_ = iConfig.getParameter<double>("E5x5OPoutMin");
36  E5x5OPoutMax_ = iConfig.getParameter<double>("E5x5OPoutMax");
37  E3x3OPinMin_ = iConfig.getParameter<double>("E3x3OPinMin");
38  E3x3OPinMax_ = iConfig.getParameter<double>("E3x3OPinMax");
39  E3x3OE5x5Min_ = iConfig.getParameter<double>("E3x3OE5x5Min");
40  E3x3OE5x5Max_ = iConfig.getParameter<double>("E3x3OE5x5Max");
41  EBrecHitLabel_ = iConfig.getParameter<edm::InputTag> ("alcaBarrelHitCollection");
42  EErecHitLabel_ = iConfig.getParameter<edm::InputTag> ("alcaEndcapHitCollection");
43  }
T getParameter(std::string const &) const
SingleEleCalibSelector::~SingleEleCalibSelector ( )

dtor

Definition at line 115 of file SingleEleCalibSelector.cc.

116 {}

Member Function Documentation

const_iterator SingleEleCalibSelector::begin ( ) const
inline

Definition at line 33 of file SingleEleCalibSelector.h.

References selected_.

33 { return selected_.begin(); }
const_iterator SingleEleCalibSelector::end ( ) const
inline

Definition at line 34 of file SingleEleCalibSelector.h.

References select(), and selected_.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

34 { return selected_.end(); }
double SingleEleCalibSelector::EnergyNxN ( const std::vector< DetId > &  vNxN,
const EBRecHitCollection EBhits,
const EERecHitCollection EEhits 
)
private

Definition at line 170 of file SingleEleCalibSelector.cc.

References EcalBarrel, and edm::SortedCollection< T, SORT >::find().

Referenced by select().

173 {
174  double dummy = 0.;
175  int window_size = vNxN.size();
176  for (int ixtal = 0; ixtal < window_size; ixtal++){
177  if (vNxN[ixtal].subdetId() == EcalBarrel)
178  {
180  it_rechit = EBhits->find(vNxN[ixtal]);
181  dummy+= it_rechit->energy();
182  }
183  else
184  {
186  it_rechit = EEhits->find(vNxN[ixtal]);
187  dummy+= it_rechit->energy();
188  }
189  }
190 
191  return dummy;
192 }
std::vector< EcalRecHit >::const_iterator const_iterator
iterator find(key_type k)
DetId SingleEleCalibSelector::findMaxHit ( const std::vector< std::pair< DetId, float > > &  v1,
const EBRecHitCollection EBhits,
const EERecHitCollection EEhits 
)
private

Definition at line 123 of file SingleEleCalibSelector.cc.

References EcalBarrel, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), and MuonTrackValidator_cfi::maxHit.

Referenced by select().

126 {
127  double currEnergy = 0. ;
128  DetId maxHit ;
129  for (std::vector<std::pair<DetId,float> >::const_iterator idsIt = v1.begin () ;
130  idsIt != v1.end () ; ++idsIt)
131  {
132  if (idsIt->first.subdetId () == EcalBarrel)
133  {
135  itrechit = EBhits->find ((*idsIt).first) ;
136  if (itrechit == EBhits->end () )
137  {
138  edm::LogInfo ("reading") << "[findMaxHit] rechit not found! " ;
139  continue ;
140  }
141 //FIXME: use fraction ??
142  if (itrechit->energy () > currEnergy)
143  {
144  currEnergy = itrechit->energy () ;
145  maxHit= (*idsIt).first ;
146  }
147  }
148  else
149  {
151  itrechit = EEhits->find ((*idsIt).first) ;
152  if (itrechit == EEhits->end () )
153  {
154  edm::LogInfo ("reading")<< "[findMaxHit] rechit not found! " ;
155  continue ;
156  }
157 
158  if (itrechit->energy () > currEnergy)
159  {
160  currEnergy=itrechit->energy () ;
161  maxHit= (*idsIt).first ;
162  }
163  }
164  }
165  return maxHit ;
166 }
std::vector< EcalRecHit >::const_iterator const_iterator
container::const_iterator const_iterator
const_iterator end() const
Definition: DetId.h:18
iterator find(key_type k)
void SingleEleCalibSelector::select ( edm::Handle< collection inputHandle,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 51 of file SingleEleCalibSelector.cc.

References gather_cfg::cout, E3x3OE5x5Max_, E3x3OE5x5Min_, E3x3OPinMax_, E3x3OPinMin_, E5x5OPoutMax_, E5x5OPoutMin_, EBrecHitLabel_, DetId::Ecal, EErecHitLabel_, EnergyNxN(), ESCOPinMax_, ESCOPinMin_, ESeedOPoutMax_, ESeedOPoutMin_, findMaxHit(), edm::EventSetup::get(), edm::Event::getByLabel(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), DetId::null(), PinMPoutOPinMax_, PinMPoutOPinMin_, edm::Handle< T >::product(), reco::return(), selected_, DetId::subdetId(), theCaloTopology, and ecaldqm::topology().

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), end(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

53 {
54  selected_.clear();
55 
56  //Get the EB rechit collection
57  edm::Handle<EBRecHitCollection> barrelRecHitsHandle ;
58  iEvent.getByLabel (EBrecHitLabel_, barrelRecHitsHandle) ;
59  const EBRecHitCollection* EBHitsColl = barrelRecHitsHandle.product () ;
60 
61  //Get the EE rechit collection
62  edm::Handle<EERecHitCollection> endcapRecHitsHandle ;
63  iEvent.getByLabel (EErecHitLabel_, endcapRecHitsHandle) ;
64  const EERecHitCollection* EEHitsColl = endcapRecHitsHandle.product () ;
65 
66  //To deal with Geometry
67  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
68 
69  //Loop over electrons
70  for( collection::const_iterator ele = (*inputHandle).begin(); ele != (*inputHandle).end(); ++ ele ){
71 
72  //Find DetID max hit
73  DetId maxHitId = findMaxHit((*ele).superCluster()->hitsAndFractions(),EBHitsColl,EEHitsColl);
74 
75  if(maxHitId.null()){std::cout<<" Null Id"<<std::endl; continue;}
76 
77  // Find 3x3 and 5x5 windows around xtal max and compute E3x3,E5x5
78  double E5x5 = 0.;
79  double E3x3 = 0.;
80 
82  int WindowSize = 5;
83  std::vector<DetId> m5x5aroundMax = topology->getWindow(maxHitId,WindowSize,WindowSize);
84  E5x5 = EnergyNxN(m5x5aroundMax,EBHitsColl,EEHitsColl);
85  WindowSize = 3;
86  std::vector<DetId> m3x3aroundMax = topology->getWindow(maxHitId,WindowSize,WindowSize);
87  E3x3 = EnergyNxN(m3x3aroundMax,EBHitsColl,EEHitsColl);
88 
89  double pin = ele->trackMomentumAtVtx ().R () ;
90  double piMpoOpi = (pin - ele->trackMomentumOut ().R ()) / pin ;
91  double E5x5OPout = E5x5/ele->trackMomentumOut ().R () ;
92  double E3x3OPin = E3x3/pin;
93  double E3x3OE5x5 = E3x3/E5x5;
94  double EseedOPout = ele->eSeedClusterOverPout () ;
95  double EoPin = ele->eSuperClusterOverP () ;
96 
97  if ( piMpoOpi > PinMPoutOPinMin_ && piMpoOpi < PinMPoutOPinMax_ &&
98  EseedOPout > ESeedOPoutMin_ && EseedOPout < ESeedOPoutMax_ &&
99  EoPin > ESCOPinMin_ && EoPin < ESCOPinMax_ &&
100  E5x5OPout > E5x5OPoutMin_ && E5x5OPout < E5x5OPoutMax_ &&
101  E3x3OPin > E3x3OPinMin_ && E3x3OPin < E3x3OPinMax_ &&
102  E3x3OE5x5 > E3x3OE5x5Min_ && E3x3OE5x5 < E3x3OE5x5Max_)
103  {
104  selected_.push_back( & (*ele) );
105  }
106  }
107 
108  return ;
109 }
edm::ESHandle< CaloTopology > theCaloTopology
the selected collection
DetId findMaxHit(const std::vector< std::pair< DetId, float > > &v1, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits)
CaloTopology const * topology(0)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
double EnergyNxN(const std::vector< DetId > &vNxN, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits)
Definition: DetId.h:18
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:56
bool null() const
is this a null id ?
Definition: DetId.h:45
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
return(e1-e2)*(e1-e2)+dp *dp

Member Data Documentation

double SingleEleCalibSelector::E3x3OE5x5Max_
private

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::E3x3OE5x5Min_
private

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::E3x3OPinMax_
private

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::E3x3OPinMin_
private

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::E5x5OPoutMax_
private

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::E5x5OPoutMin_
private

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

edm::InputTag SingleEleCalibSelector::EBrecHitLabel_
private

Definition at line 54 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

edm::InputTag SingleEleCalibSelector::EErecHitLabel_
private

Definition at line 55 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::ESCOPinMax_
private

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::ESCOPinMin_
private

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::ESeedOPoutMax_
private

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::ESeedOPoutMin_
private

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::PinMPoutOPinMax_
private

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

double SingleEleCalibSelector::PinMPoutOPinMin_
private

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

container SingleEleCalibSelector::selected_
private

Definition at line 40 of file SingleEleCalibSelector.h.

Referenced by begin(), end(), and select().

edm::ESHandle<CaloTopology> SingleEleCalibSelector::theCaloTopology
private

the selected collection

Definition at line 42 of file SingleEleCalibSelector.h.

Referenced by select().