Skip to content

Commit

Permalink
code checks
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlange6 committed Sep 2, 2020
1 parent 9e9ede0 commit d328dc5
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 100 deletions.
8 changes: 4 additions & 4 deletions OnlineDB/EcalCondDB/interface/IRunIOV.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ typedef int run_t;
class IIOV;

class IRunIOV {
public:
public:
virtual ~IRunIOV() {}

virtual void fetchAt(IIOV* fillIOV, const run_t run, ITag* tag) const noexcept(false) =0;
virtual void fetchAt(IIOV* fillIOV, const run_t run, ITag* tag) const noexcept(false) = 0;

virtual void fetchWithin(std::vector<IIOV>* fillVec, const run_t beginRun, const run_t endRun, ITag* tag) const noexcept(false) =0;

virtual void fetchWithin(std::vector<IIOV>* fillVec, const run_t beginRun, const run_t endRun, ITag* tag) const
noexcept(false) = 0;
};

#endif
58 changes: 26 additions & 32 deletions PhysicsTools/PatAlgos/test/fwlite/testSelection_electron.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,44 @@ This example creates a histogram of Electron Pt, using Electrons with Pt above 3
#include "TCanvas.h"
#include "TLegend.h"


#if !defined(__CINT__) && !defined(__MAKECINT__)
#include "DataFormats/PatCandidates/interface/Electron.h"
#include "PhysicsTools/SelectorUtils/interface/ElectronVPlusJetsIDSelectionFunctor.h"
#endif

#include <iostream>
#include <cmath> //necessary for absolute function fabs()
#include <cmath> //necessary for absolute function fabs()

using namespace std;

void sk_fwlitecuts()
{
ElectronVPlusJetsIDSelectionFunctor muId( ElectronVPlusJetsIDSelectionFunctor::SUMMER08 );

void sk_fwlitecuts() {
ElectronVPlusJetsIDSelectionFunctor muId(ElectronVPlusJetsIDSelectionFunctor::SUMMER08);

TFile * file = new TFile("PATLayer1_Output.fromAOD_full.root");
TH1D * hist_ePt = new TH1D("hist_ePt", "Electron p_{T}", 20, 0, 100 );
TFile* file = new TFile("PATLayer1_Output.fromAOD_full.root");
TH1D* hist_ePt = new TH1D("hist_ePt", "Electron p_{T}", 20, 0, 100);
fwlite::Event ev(file);

//loop through each event
for( ev.toBegin();
! ev.atEnd();
++ev) {
for (ev.toBegin(); !ev.atEnd(); ++ev) {
fwlite::Handle<std::vector<pat::Electron> > h_mu;
h_mu.getByLabel(ev,"cleanLayer1Electrons");
if (!h_mu.isValid() ) continue;
vector<pat::Electron> const & electrons = *h_mu;

//loop through each Electron
vector<pat::Electron>::const_iterator iter;
for ( iter = electrons.begin(); iter != electrons.end() ; ++iter) {

if ( (iter->pt() > 30 ) && ( fabs(iter->eta() ) < 2.1) ) {
cout << "Passed kin" << endl;
if ( muId( *iter ) ) {
cout << "Passed ID" << endl;
hist_ePt->Fill( iter->pt() );
}
}


} //end Electron loop
} //end event loop

hist_ePt->Draw();
h_mu.getByLabel(ev, "cleanLayer1Electrons");
if (!h_mu.isValid())
continue;
vector<pat::Electron> const& electrons = *h_mu;

//loop through each Electron
vector<pat::Electron>::const_iterator iter;
for (iter = electrons.begin(); iter != electrons.end(); ++iter) {
if ((iter->pt() > 30) && (fabs(iter->eta()) < 2.1)) {
cout << "Passed kin" << endl;
if (muId(*iter)) {
cout << "Passed ID" << endl;
hist_ePt->Fill(iter->pt());
}
}

} //end Electron loop
} //end event loop

hist_ePt->Draw();
}
58 changes: 26 additions & 32 deletions PhysicsTools/PatAlgos/test/fwlite/testSelection_jet.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,44 @@ This example creates a histogram of Jet Pt, using Jets with Pt above 30 and ETA
#include "TCanvas.h"
#include "TLegend.h"


#if !defined(__CINT__) && !defined(__MAKECINT__)
#include "DataFormats/PatCandidates/interface/Jet.h"
#include "PhysicsTools/SelectorUtils/interface/JetIDSelectionFunctor.h"
#endif

#include <iostream>
#include <cmath> //necessary for absolute function fabs()
#include <cmath> //necessary for absolute function fabs()

using namespace std;

void sk_fwlitecuts()
{
JetIDSelectionFunctor jetId( JetIDSelectionFunctor::CRAFT08, JetIDSelectionFunctor::TIGHT );

void sk_fwlitecuts() {
JetIDSelectionFunctor jetId(JetIDSelectionFunctor::CRAFT08, JetIDSelectionFunctor::TIGHT);

TFile * file = new TFile("PATLayer1_Output.fromAOD_full.root");
TH1D * hist_jetPt = new TH1D("hist_jetPt", "Jet p_{T}", 20, 0, 100 );
TFile* file = new TFile("PATLayer1_Output.fromAOD_full.root");
TH1D* hist_jetPt = new TH1D("hist_jetPt", "Jet p_{T}", 20, 0, 100);
fwlite::Event ev(file);

//loop through each event
for( ev.toBegin();
! ev.atEnd();
++ev) {
for (ev.toBegin(); !ev.atEnd(); ++ev) {
fwlite::Handle<std::vector<pat::Jet> > h_mu;
h_mu.getByLabel(ev,"cleanLayer1Jets");
if (!h_mu.isValid() ) continue;
vector<pat::Jet> const & jets = *h_mu;

//loop through each Jet
vector<pat::Jet>::const_iterator iter;
for ( iter = jets.begin(); iter != jets.end() ; ++iter) {

if ( (iter->pt() > 30 ) && ( fabs(iter->eta() ) < 2.1) ) {
cout << "Passed kin" << endl;
if ( jetId( *iter ) ) {
cout << "Passed ID" << endl;
hist_jetPt->Fill( iter->pt() );
}
}


} //end Jet loop
} //end event loop

hist_jetPt->Draw();
h_mu.getByLabel(ev, "cleanLayer1Jets");
if (!h_mu.isValid())
continue;
vector<pat::Jet> const& jets = *h_mu;

//loop through each Jet
vector<pat::Jet>::const_iterator iter;
for (iter = jets.begin(); iter != jets.end(); ++iter) {
if ((iter->pt() > 30) && (fabs(iter->eta()) < 2.1)) {
cout << "Passed kin" << endl;
if (jetId(*iter)) {
cout << "Passed ID" << endl;
hist_jetPt->Fill(iter->pt());
}
}

} //end Jet loop
} //end event loop

hist_jetPt->Draw();
}
58 changes: 26 additions & 32 deletions PhysicsTools/PatAlgos/test/fwlite/testSelection_muon.C
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,44 @@ This example creates a histogram of Muon Pt, using Muons with Pt above 30 and ET
#include "TCanvas.h"
#include "TLegend.h"


#if !defined(__CINT__) && !defined(__MAKECINT__)
#include "DataFormats/PatCandidates/interface/Muon.h"
#include "PhysicsTools/SelectorUtils/interface/MuonVPlusJetsIDSelectionFunctor.h"
#endif

#include <iostream>
#include <cmath> //necessary for absolute function fabs()
#include <cmath> //necessary for absolute function fabs()

using namespace std;

void sk_fwlitecuts()
{
MuonVPlusJetsIDSelectionFunctor muId( MuonVPlusJetsIDSelectionFunctor::SUMMER08 );

void sk_fwlitecuts() {
MuonVPlusJetsIDSelectionFunctor muId(MuonVPlusJetsIDSelectionFunctor::SUMMER08);

TFile * file = new TFile("PATLayer1_Output.fromAOD_full.root");
TH1D * hist_muPt = new TH1D("hist_muPt", "Muon p_{T}", 20, 0, 100 );
TFile* file = new TFile("PATLayer1_Output.fromAOD_full.root");
TH1D* hist_muPt = new TH1D("hist_muPt", "Muon p_{T}", 20, 0, 100);
fwlite::Event ev(file);

//loop through each event
for( ev.toBegin();
! ev.atEnd();
++ev) {
for (ev.toBegin(); !ev.atEnd(); ++ev) {
fwlite::Handle<std::vector<pat::Muon> > h_mu;
h_mu.getByLabel(ev,"cleanLayer1Muons");
if (!h_mu.isValid() ) continue;
vector<pat::Muon> const & muons = *h_mu;

//loop through each Muon
vector<pat::Muon>::const_iterator iter;
for ( iter = muons.begin(); iter != muons.end() ; ++iter) {

if ( (iter->pt() > 30 ) && ( fabs(iter->eta() ) < 2.1) ) {
cout << "Passed kin" << endl;
if ( muId( *iter ) ) {
cout << "Passed ID" << endl;
hist_muPt->Fill( iter->pt() );
}
}


} //end Muon loop
} //end event loop

hist_muPt->Draw();
h_mu.getByLabel(ev, "cleanLayer1Muons");
if (!h_mu.isValid())
continue;
vector<pat::Muon> const& muons = *h_mu;

//loop through each Muon
vector<pat::Muon>::const_iterator iter;
for (iter = muons.begin(); iter != muons.end(); ++iter) {
if ((iter->pt() > 30) && (fabs(iter->eta()) < 2.1)) {
cout << "Passed kin" << endl;
if (muId(*iter)) {
cout << "Passed ID" << endl;
hist_muPt->Fill(iter->pt());
}
}

} //end Muon loop
} //end event loop

hist_muPt->Draw();
}

0 comments on commit d328dc5

Please sign in to comment.