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
PatElectronAnalyzer Class Reference
Inheritance diagram for PatElectronAnalyzer:
edm::EDAnalyzer

Public Member Functions

 PatElectronAnalyzer (const edm::ParameterSet &)
 
 ~PatElectronAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

TH1F * deltaPhi_
 
TH1F * deltaR_
 
std::string electronID_
 
edm::InputTag electronSrc_
 
TH1F * eta_
 
TH1F * genEta_
 
edm::ParameterSet genMatchMode_
 
TH1F * genPhi_
 
TH1F * genPt_
 
TH1F * invMass_
 
TH1F * isoTag_
 
double maxDeltaM_
 
double maxDeltaR_
 
double maxEta_
 
double maxTagIso_
 
double minPt_
 
unsigned int mode_
 
TH1I * nr_
 
edm::InputTag particleSrc_
 
TH1F * phi_
 
TH1F * pt_
 
edm::ParameterSet tagAndProbeMode_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 12 of file PatElectronAnalyzer.cc.

Constructor & Destructor Documentation

PatElectronAnalyzer::PatElectronAnalyzer ( const edm::ParameterSet cfg)
explicit

Definition at line 77 of file PatElectronAnalyzer.cc.

References deltaPhi_, deltaR_, eta_, genEta_, genMatchMode_, genPhi_, genPt_, edm::ParameterSet::getParameter(), invMass_, isoTag_, maxDeltaM_, maxDeltaR_, maxTagIso_, nr_, phi_, pt_, and tagAndProbeMode_.

77  :
78  minPt_ (cfg.getParameter<double>("minPt")),
79  maxEta_ (cfg.getParameter<double>("maxEta")),
80  mode_ (cfg.getParameter<unsigned int>("mode")),
81  electronID_ (cfg.getParameter<std::string>("electronID")),
82  electronSrc_ (cfg.getParameter<edm::InputTag>("electronSrc")),
83  particleSrc_ (cfg.getParameter<edm::InputTag>("particleSrc")),
84  genMatchMode_(cfg.getParameter<edm::ParameterSet>("genMatchMode")),
85  tagAndProbeMode_(cfg.getParameter<edm::ParameterSet>("tagAndProbeMode"))
86 {
87  // complete the configuration of the analyzer
88  maxDeltaR_ = genMatchMode_ .getParameter<double>("maxDeltaR");
89  maxDeltaM_ = tagAndProbeMode_.getParameter<double>("maxDeltaM");
90  maxTagIso_ = tagAndProbeMode_.getParameter<double>("maxTagIso");
91 
92 
93  // register histograms to the TFileService
95  nr_ = fs->make<TH1I>("nr", "nr", 10, 0 , 10 );
96  pt_ = fs->make<TH1F>("pt", "pt", 20, 0., 100.);
97  eta_ = fs->make<TH1F>("eta", "eta", 30, -3., 3.);
98  phi_ = fs->make<TH1F>("phi", "phi", 35, -3.5, 3.5);
99  genPt_ = fs->make<TH1F>("genPt", "pt", 20, 0., 100.);
100  genEta_ = fs->make<TH1F>("genEta", "eta", 30, -3., 3.);
101  genPhi_ = fs->make<TH1F>("genPhi", "phi", 35, -3.5, 3.5);
102  deltaR_ = fs->make<TH1F>("deltaR", "log(dR)", 50, -5., 0.);
103  isoTag_ = fs->make<TH1F>("isoTag", "iso", 50, 0., 10.);
104  invMass_ = fs->make<TH1F>("invMass", "m", 100, 50., 150.);
105  deltaPhi_= fs->make<TH1F>("deltaPhi", "deltaPhi", 100, -3.5, 3.5);
106 }
T getParameter(std::string const &) const
edm::ParameterSet tagAndProbeMode_
edm::ParameterSet genMatchMode_
PatElectronAnalyzer::~PatElectronAnalyzer ( )

Definition at line 108 of file PatElectronAnalyzer.cc.

109 {
110 }

Member Function Documentation

void PatElectronAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 113 of file PatElectronAnalyzer.cc.

References abs, Geom::deltaPhi(), deltaPhi_, deltaR(), deltaR_, electronID_, electronSrc_, eta_, genEta_, genPhi_, genPt_, edm::Event::getByLabel(), invMass_, isoTag_, maxDeltaM_, maxDeltaR_, maxEta_, maxTagIso_, minPt_, mode_, nr_, particleSrc_, phi_, and pt_.

114 {
115  // get electron collection
117  evt.getByLabel(electronSrc_, electrons);
118  // get generator particle collection
120  evt.getByLabel(particleSrc_, particles);
121 
122  nr_->Fill( electrons->size() );
123 
124  // ----------------------------------------------------------------------
125  //
126  // First Part Mode 0: genMatch
127  //
128  // ----------------------------------------------------------------------
129  if( mode_==0 ){
130  // loop generator particles
131  for(reco::GenParticleCollection::const_iterator part=particles->begin();
132  part!=particles->end(); ++part){
133  // only loop stable electrons
134  if( part->status()==1 && abs(part->pdgId())==11 ){
135  if( part->pt()>minPt_ && fabs(part->eta())<maxEta_ ){
136  genPt_ ->Fill( part->pt() );
137  genEta_->Fill( part->eta() );
138  genPhi_->Fill( part->phi() );
139  }
140  }
141  }
142 
143  // loop electrons
144  for( std::vector<pat::Electron>::const_iterator elec=electrons->begin(); elec!=electrons->end(); ++elec ){
145  if( elec->genLepton() ){
146  float deltaR = ROOT::Math::VectorUtil::DeltaR(elec->genLepton()->p4(), elec->p4());
147  deltaR_->Fill(TMath::Log10(deltaR));
148  if( deltaR<maxDeltaR_ ){
149  if( electronID_.compare("none")!=0 ){
150  if( elec->electronID(electronID_)<0.5 )
151  continue;
152  }
153  if( elec->pt()>minPt_ && fabs(elec->eta())<maxEta_ ){
154  pt_ ->Fill( elec->pt() );
155  eta_->Fill( elec->eta() );
156  phi_->Fill( elec->phi() );
157  }
158  }
159  }
160  }
161  }
162 
163  // ----------------------------------------------------------------------
164  //
165  // Second Part Mode 1: tagAndProbe
166  //
167  // ----------------------------------------------------------------------
168  if( mode_==1 ){
169  // loop tag electron
170  for( std::vector<pat::Electron>::const_iterator elec=electrons->begin(); elec!=electrons->end(); ++elec ){
171  isoTag_->Fill(elec->trackIso());
172  if( elec->trackIso()<maxTagIso_ && elec->electronID("eidTight")>0.5 ){
173  // loop probe electron
174  for( std::vector<pat::Electron>::const_iterator probe=electrons->begin(); probe!=electrons->end(); ++probe ){
175  // skip the tag electron itself
176  if( probe==elec ) continue;
177 
178  float zMass = (probe->p4()+elec->p4()).mass();
179  invMass_ ->Fill(zMass);
180  float deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(elec->p4(), probe->p4());
181  deltaPhi_->Fill(deltaPhi);
182 
183  // check for the Z mass
184  if( fabs( zMass-90. )<maxDeltaM_ ){
185  if( electronID_.compare("none")!=0 ){
186  if( probe->electronID(electronID_)<0.5 )
187  continue;
188  }
189  if( probe->pt()>minPt_ && fabs(probe->eta())<maxEta_ ){
190  pt_ ->Fill( probe->pt() );
191  eta_->Fill( probe->eta() );
192  phi_->Fill( probe->phi() );
193  }
194  }
195  }
196  }
197  }
198  }
199 }
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
#define abs(x)
Definition: mlp_lapack.h:159
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
part
Definition: HCALResponse.h:21
void PatElectronAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 201 of file PatElectronAnalyzer.cc.

202 {
203 }
void PatElectronAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 205 of file PatElectronAnalyzer.cc.

206 {
207 }

Member Data Documentation

TH1F* PatElectronAnalyzer::deltaPhi_
private

Definition at line 70 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::deltaR_
private

Definition at line 67 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

std::string PatElectronAnalyzer::electronID_
private

Definition at line 43 of file PatElectronAnalyzer.cc.

Referenced by analyze().

edm::InputTag PatElectronAnalyzer::electronSrc_
private

Definition at line 46 of file PatElectronAnalyzer.cc.

Referenced by analyze().

TH1F* PatElectronAnalyzer::eta_
private

Definition at line 62 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::genEta_
private

Definition at line 65 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

edm::ParameterSet PatElectronAnalyzer::genMatchMode_
private

Definition at line 50 of file PatElectronAnalyzer.cc.

Referenced by PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::genPhi_
private

Definition at line 66 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::genPt_
private

Definition at line 64 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::invMass_
private

Definition at line 69 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::isoTag_
private

Definition at line 68 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

double PatElectronAnalyzer::maxDeltaM_
private

Definition at line 56 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

double PatElectronAnalyzer::maxDeltaR_
private

Definition at line 55 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

double PatElectronAnalyzer::maxEta_
private

Definition at line 28 of file PatElectronAnalyzer.cc.

Referenced by analyze().

double PatElectronAnalyzer::maxTagIso_
private

Definition at line 57 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

double PatElectronAnalyzer::minPt_
private

Definition at line 27 of file PatElectronAnalyzer.cc.

Referenced by analyze().

unsigned int PatElectronAnalyzer::mode_
private

Definition at line 33 of file PatElectronAnalyzer.cc.

Referenced by analyze().

TH1I* PatElectronAnalyzer::nr_
private

Definition at line 60 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

edm::InputTag PatElectronAnalyzer::particleSrc_
private

Definition at line 48 of file PatElectronAnalyzer.cc.

Referenced by analyze().

TH1F* PatElectronAnalyzer::phi_
private

Definition at line 63 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

TH1F* PatElectronAnalyzer::pt_
private

Definition at line 61 of file PatElectronAnalyzer.cc.

Referenced by analyze(), and PatElectronAnalyzer().

edm::ParameterSet PatElectronAnalyzer::tagAndProbeMode_
private

Definition at line 51 of file PatElectronAnalyzer.cc.

Referenced by PatElectronAnalyzer().