CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

EGammaCutBasedEleIdAnalyzer Class Reference

#include <EGamma/EGammaCutBasedEleIdAnalyzer/src/EGammaCutBasedEleIdAnalyzer.cc>

Inheritance diagram for EGammaCutBasedEleIdAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EGammaCutBasedEleIdAnalyzer (const edm::ParameterSet &)
 ~EGammaCutBasedEleIdAnalyzer ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob ()
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
virtual void endJob ()
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
virtual void endRun (edm::Run const &, edm::EventSetup const &)

Private Attributes

edm::InputTag beamSpotInputTag_
edm::InputTag conversionsInputTag_
edm::InputTag electronsInputTag_
TH1F * h1_pt_
TH1F * h1_pt_fbremeopin_
TH1F * h1_pt_loose_
TH1F * h1_pt_medium_
TH1F * h1_pt_tight_
TH1F * h1_pt_trig_
TH1F * h1_pt_veto_
std::vector< edm::InputTagisoValInputTags_
edm::InputTag primaryVertexInputTag_
bool printDebug_
edm::InputTag rhoIsoInputTag

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file EGammaCutBasedEleIdAnalyzer.cc.


Constructor & Destructor Documentation

EGammaCutBasedEleIdAnalyzer::EGammaCutBasedEleIdAnalyzer ( const edm::ParameterSet iConfig) [explicit]

Definition at line 104 of file EGammaCutBasedEleIdAnalyzer.cc.

References beamSpotInputTag_, conversionsInputTag_, electronsInputTag_, edm::ParameterSet::getParameter(), h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, isoValInputTags_, primaryVertexInputTag_, printDebug_, and rhoIsoInputTag.

{

    // get input parameters
    electronsInputTag_      = iConfig.getParameter<edm::InputTag>("electronsInputTag");
    conversionsInputTag_    = iConfig.getParameter<edm::InputTag>("conversionsInputTag");
    beamSpotInputTag_       = iConfig.getParameter<edm::InputTag>("beamSpotInputTag");
    rhoIsoInputTag          = iConfig.getParameter<edm::InputTag>("rhoIsoInputTag");
    primaryVertexInputTag_  = iConfig.getParameter<edm::InputTag>("primaryVertexInputTag");
    isoValInputTags_        = iConfig.getParameter<std::vector<edm::InputTag> >("isoValInputTags");

    // debug
    printDebug_             = iConfig.getParameter<bool>("printDebug");

    // output histograms
    edm::Service<TFileService> fs;

    h1_pt_               = fs->make<TH1F>("h1_pt",               "pt",              100, 0.0, 100.0);
    h1_pt_veto_          = fs->make<TH1F>("h1_pt_veto",          "pt (veto)",       100, 0.0, 100.0);
    h1_pt_loose_         = fs->make<TH1F>("h1_pt_loose",         "pt (loose)",      100, 0.0, 100.0);
    h1_pt_medium_        = fs->make<TH1F>("h1_pt_medium",        "pt (medium)",     100, 0.0, 100.0);
    h1_pt_tight_         = fs->make<TH1F>("h1_pt_tight",         "pt (tight)",      100, 0.0, 100.0);
    h1_pt_trig_          = fs->make<TH1F>("h1_pt_trig",          "pt (trig)",       100, 0.0, 100.0); 
    h1_pt_fbremeopin_    = fs->make<TH1F>("h1_pt_fbremeopin",    "pt (fbremeopin)", 100, 0.0, 100.0);

}
EGammaCutBasedEleIdAnalyzer::~EGammaCutBasedEleIdAnalyzer ( )

Definition at line 132 of file EGammaCutBasedEleIdAnalyzer.cc.

{

    // do anything here that needs to be done at desctruction time
    // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void EGammaCutBasedEleIdAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 147 of file EGammaCutBasedEleIdAnalyzer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotInputTag_, conversionsInputTag_, electronsInputTag_, edm::EventID::event(), edm::Event::getByLabel(), h1_pt_, h1_pt_fbremeopin_, h1_pt_loose_, h1_pt_medium_, h1_pt_tight_, h1_pt_trig_, h1_pt_veto_, i, edm::EventBase::id(), isoValInputTags_, j, EgammaCutBasedEleId::LOOSE, edm::EventBase::luminosityBlock(), EgammaCutBasedEleId::MEDIUM, n, EgammaCutBasedEleId::PassEoverPCuts(), EgammaCutBasedEleId::PassTriggerCuts(), EgammaCutBasedEleId::PassWP(), primaryVertexInputTag_, printDebug_, edm::Handle< T >::product(), rhoIsoInputTag, edm::EventID::run(), EgammaCutBasedEleId::TIGHT, EgammaCutBasedEleId::TRIGGERTIGHT, EgammaCutBasedEleId::TRIGGERWP70, and EgammaCutBasedEleId::VETO.

{
    // electrons
    edm::Handle<reco::GsfElectronCollection> els_h;
    iEvent.getByLabel(electronsInputTag_, els_h);

    // conversions
    edm::Handle<reco::ConversionCollection> conversions_h;
    iEvent.getByLabel(conversionsInputTag_, conversions_h);

    // iso deposits
    IsoDepositVals isoVals(isoValInputTags_.size());
    for (size_t j = 0; j < isoValInputTags_.size(); ++j) {
        iEvent.getByLabel(isoValInputTags_[j], isoVals[j]);
    }

    // beam spot
    edm::Handle<reco::BeamSpot> beamspot_h;
    iEvent.getByLabel(beamSpotInputTag_, beamspot_h);
    const reco::BeamSpot &beamSpot = *(beamspot_h.product());

    // vertices
    edm::Handle<reco::VertexCollection> vtx_h;
    iEvent.getByLabel(primaryVertexInputTag_, vtx_h);

    // rho for isolation
    edm::Handle<double> rhoIso_h;
    iEvent.getByLabel(rhoIsoInputTag, rhoIso_h);
    double rhoIso = *(rhoIso_h.product());

    // loop on electrons
    unsigned int n = els_h->size();
    for(unsigned int i = 0; i < n; ++i) {

        // get reference to electron
        reco::GsfElectronRef ele(els_h, i);

        //
        // get particle flow isolation
        //

        double iso_ch =  (*(isoVals)[0])[ele];
        double iso_em = (*(isoVals)[1])[ele];
        double iso_nh = (*(isoVals)[2])[ele];

        //
        // test ID
        //

        // working points
        bool veto       = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::VETO, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso);
        bool loose      = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::LOOSE, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso);
        bool medium     = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::MEDIUM, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso);
        bool tight      = EgammaCutBasedEleId::PassWP(EgammaCutBasedEleId::TIGHT, ele, conversions_h, beamSpot, vtx_h, iso_ch, iso_em, iso_nh, rhoIso);

        // eop/fbrem cuts for extra tight ID
        bool fbremeopin = EgammaCutBasedEleId::PassEoverPCuts(ele);

        // cuts to match tight trigger requirements
        bool trigtight = EgammaCutBasedEleId::PassTriggerCuts(EgammaCutBasedEleId::TRIGGERTIGHT, ele);

        // for 2011 WP70 trigger
        bool trigwp70 = EgammaCutBasedEleId::PassTriggerCuts(EgammaCutBasedEleId::TRIGGERWP70, ele);

        //
        // fill histograms
        //

        h1_pt_->Fill(ele->pt());
        if (veto)       h1_pt_veto_         ->Fill(ele->pt());
        if (loose)      h1_pt_loose_        ->Fill(ele->pt());
        if (medium)     h1_pt_medium_       ->Fill(ele->pt());
        if (tight)      h1_pt_tight_        ->Fill(ele->pt());
        if (trigtight)  h1_pt_trig_         ->Fill(ele->pt());
        if (fbremeopin) h1_pt_fbremeopin_   ->Fill(ele->pt());

        //
        // print decisions
        //

        if (printDebug_) {
            printf("%u %u %u : ",       iEvent.id().run(), iEvent.luminosityBlock(), iEvent.id().event());
            printf("veto(%i), ",        veto);
            printf("loose(%i), ",       loose);
            printf("medium(%i), ",      medium);
            printf("tight(%i), ",       tight);
            printf("trigtight(%i), ",   trigtight);
            printf("trigwp70(%i), ",    trigwp70);
            printf("fbremeopin(%i)\n",  fbremeopin);
        }

    }

}
void EGammaCutBasedEleIdAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 245 of file EGammaCutBasedEleIdAnalyzer.cc.

{
}
void EGammaCutBasedEleIdAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 269 of file EGammaCutBasedEleIdAnalyzer.cc.

{
}
void EGammaCutBasedEleIdAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 257 of file EGammaCutBasedEleIdAnalyzer.cc.

{
}
void EGammaCutBasedEleIdAnalyzer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 251 of file EGammaCutBasedEleIdAnalyzer.cc.

{
}
void EGammaCutBasedEleIdAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 275 of file EGammaCutBasedEleIdAnalyzer.cc.

{
}
void EGammaCutBasedEleIdAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 263 of file EGammaCutBasedEleIdAnalyzer.cc.

{
}
void EGammaCutBasedEleIdAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 281 of file EGammaCutBasedEleIdAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

                                                                                        {
    //The following says we do not know what parameters are allowed so do no validation
    // Please change this to state exactly what you do use, even if it is no parameters
    edm::ParameterSetDescription desc;
    desc.setUnknown();
    descriptions.addDefault(desc);
}

Member Data Documentation

Definition at line 71 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 70 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 69 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 80 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 86 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 82 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 83 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 84 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 85 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 81 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 74 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 73 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 77 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().

Definition at line 72 of file EGammaCutBasedEleIdAnalyzer.cc.

Referenced by analyze(), and EGammaCutBasedEleIdAnalyzer().