Difference: SWGuidePATSelectors (1 vs. 14)

Revision 142011-03-01 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

PAT Selector Utilities

Line: 12 to 12
  To use this software, start with the version in WorkBookWhichRelease. The software resides in
Changed:
<
<
PhysicsTools/SelectorUtils
>
>
PhysicsTools/SelectorUtils
 
Line: 491 to 491
 

Using Selector in the full framework

Changed:
<
<
There is a class templates to facilitate the usage of the Selector in the full framework, FWLiteFilterWrapper. An instance of this will run the Selector in a sequence, and return "true" if there are any that pass the selection. As with the other Candidate utilities, setting filter = true will actually filter the events.
>
>
There is a class templates to facilitate the usage of the Selector in the full framework, FWLiteFilterWrapper. An instance of this will run the Selector in a sequence, and return "true" if there are any that pass the selection. As with the other Candidate utilities, setting filter = true will actually filter the events.
  An example use case would be, using the same WPlusJetsEventSelector as in the previous example:
Changed:
<
<
#include "PhysicsTools/UtilAlgos/interface/FWLiteFilterWrapper.h"
>
>
#include "CMS.PhysicsTools/UtilAlgos/interface/FWLiteFilterWrapper.h"
  typedef edm::FWLiteFilterWrapper EDWPlusJets;
Line: 527 to 527
  )
Added:
>
>

New! Using Selector to write selected objects

There is a new feature in 4.2.x to write objects that are selected with a Selector into the EDM and filter (optionally) on the presence of non-zero size. The class template is EDFilterObjectWrapper.

An example is shown here to write jets that satisfy the PFJetIDSelectionFunctor. An example python snippet to use this is

from PhysicsTools.SelectorUtils.pfJetIDSelector_cfi import pfJetIDSelector
process.goodPatJetsPFlow = cms.EDFilter("PFJetIDSelectionFunctorFilter",
                                                filterParams = pfJetIDSelector.clone(),
                                                src = cms.InputTag("selectedPatJetsPFlow"),
                                                filter = cms.bool(True)
                                                )

The class T must satisfy

T::T( edm::ParameterSet const &);
T::operator() ( C::value_type const &);

where C is "vector-like" (it needs a dictionary since it writes a copy of the objects that pass).

 -- SalvatoreRoccoRappoccio - 29-Oct-2009 \ No newline at end of file

Revision 132010-10-12 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

PAT Selector Utilities

Line: 489 to 489
 %ENDCODE%
Added:
>
>

Using Selector in the full framework

There is a class templates to facilitate the usage of the Selector in the full framework, FWLiteFilterWrapper. An instance of this will run the Selector in a sequence, and return "true" if there are any that pass the selection. As with the other Candidate utilities, setting filter = true will actually filter the events.

An example use case would be, using the same WPlusJetsEventSelector as in the previous example:

#include "PhysicsTools/UtilAlgos/interface/FWLiteFilterWrapper.h"

typedef edm::FWLiteFilterWrapper<WPlusJetsEventSelector> EDWPlusJets;

DEFINE_FWK_MODULE(EDWPlusJets);

The EDWPlusJets module can then be run as normal in a CMSSW sequence, here shown with several options changed in the WPlusJetsEventSelector for demonstration.

process.topMuPlusJetsCalo = cms.EDFilter( 'EDWPlusJets',
                                    inputwplusjetsAnalysis.clone(
                                        jetPtMin = cms.double(25.0),
                                        muJetDR = cms.double(0.),
                                        cutsToIgnore = cms.vstring( ['MET Cut'        ,
                                                                     'Z Veto'         ,
                                                                     'Conversion Veto',
                                                                     'Cosmic Veto'    ,
                                                                     '>=1 Jets'       ,
                                                                     '>=2 Jets'       ,
                                                                     '>=3 Jets'       ,
                                                                     '>=4 Jets'       ,
                                                                     '>=5 Jets'                                                                     
                                                                     ] ),
                                        muonIdTight = inputwplusjetsAnalysis.muonIdTight.clone(
                                            cutsToIgnore=cms.vstring(options.muonIdIgnoredCuts)
                                            )
                                        )
                                    )
  -- SalvatoreRoccoRappoccio - 29-Oct-2009 \ No newline at end of file

Revision 122010-07-23 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

PAT Selector Utilities

Line: 18 to 18
 

Recipe for the impatient

Changed:
<
<
See the most recent updates here.
>
>
See the most recent updates here.
 
Deleted:
<
<
ssh lxplus5.cern.ch
cmsrel CMSSW_3_5_7
cd CMSSW_3_5_7/src
cmsenv  
addpkg PhysicsTools/SelectorUtils V00-00-13-03
 
Deleted:
<
<
 

Links to Selectors of Interest

Line: 39 to 33
 
Changed:
<
<

Selector

>
>

Selector (UPDATED!)

  The Selector interface is provided to fill the gap present in using "user-level" cuts in an analysis scenario. The Selector interface can be used in the full framework, or in FWLite.
Line: 69 to 63
 
    • This also returns a strbitset with the bits for each cut set, so the user can see what passed and what failed.
  • "Print" the selection criteria to give the user information about what passed and what failed.
Added:
>
>

Accessing via index class (New!)

It is now possible to use a smart index class for strbitset. This allows the user to keep the semantics of the string accessor, while having the speed benefit of an integer access.

The new accessors can be seen here and here.

The example here shows the usage.

Specifically, the user is now able to "cache" the index of a strbitset, and can then use that cached index instead of doing string comparisons.

 

Turning cuts on and off

In order to turn the cuts on and off, the calls are:

Line: 103 to 109
  A concrete simple example can be found here. We will now step through the code in detail.
Changed:
<
<
  • Register the selection criteria and turn all the cuts "on":
>
>
  • Register the selection criteria and turn all the cuts "on".
  • Get cached values of the strbitset indices (muonPtIndex and metIndex).
  %CODE{"cpp"}% WSelector( edm::ParameterSet const & params ) :
Line: 117 to 124
  set("Muon Pt"); set("MET");
Added:
>
>
muonPtIndex_ = index_type(&bits_, std::string("Muon Pt") ); metIndex_ = index_type(&bits_, std::string("MET") );
  wMuon_ = 0; met_ = 0; }
Line: 142 to 153
  // get the MET, require to be > minimum if ( gotMET ) { met_ = &met->at(0);
Changed:
<
<
if ( met_->pt() > cut("MET", double()) || ignoreCut("MET") ) passCut(ret, "MET");
>
>
if ( met_->pt() > cut(metIndex_, double()) || ignoreCut(metIndex_) ) passCut(ret, metIndex_);
  }

// get the highest pt muon, require to have pt > minimum if ( gotMuons ) {

Changed:
<
<
if ( ignoreCut("Muon Pt") ) {
>
>
if ( ignoreCut(muonPtIndex_) ) {
  if ( muons->size() > 0 ) { wMuon_ = &muons->at(0);
Changed:
<
<
if ( wMuon_->pt() > cut("Muon Pt", double()) || ignoreCut("Muon Pt") ) passCut(ret, "Muon Pt");
>
>
if ( wMuon_->pt() > cut(muonPtIndex_, double()) || ignoreCut(muonPtIndex_) ) passCut(ret, muonPtIndex_);
  } } else {
Changed:
<
<
passCut( ret, "Muon Pt");
>
>
passCut( ret, muonPtIndex_);
  } }

Revision 112010-05-03 - RogerWolf

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"
Changed:
<
<

SWGuidePATSelectors

>
>

PAT Selector Utilities

  Object selection in physics analysis is important to structure correctly. The PAT has a great deal of tools available, as well as string-parsed object selectors for single objects. However this can be limited

Revision 102010-04-19 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 25 to 25
 cmsrel CMSSW_3_5_7 cd CMSSW_3_5_7/src cmsenv
Changed:
<
<
addpkg PhysicsTools/SelectorUtils V00-00-13-02
>
>
addpkg PhysicsTools/SelectorUtils V00-00-13-03
 

Links to Selectors of Interest

  • Here are a bunch of selectors used in commissioning:
Changed:
<
<
>
>
 
  • Here are a bunch of selectors from the October Exercise (will be updated soon, most likely):

Revision 92010-04-16 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 25 to 25
 cmsrel CMSSW_3_5_7 cd CMSSW_3_5_7/src cmsenv
Changed:
<
<
addpkg PhysicsTools/SelectorUtils V00-00-13-01
>
>
addpkg PhysicsTools/SelectorUtils V00-00-13-02
 
Line: 98 to 98
 bool result = ret | mask;
Deleted:
<
<

Concrete Selector<pat::Muon> Example

 
Changed:
<
<
For instance, a concrete implementation of this to select =pat::Muon='s based on the Summer 08 V+Jets group selection here is included in PhysicsTools/PatUtils. The source is included here, and the relevant snippets are shown here:
>
>

Concrete Simple Example

A concrete simple example can be found here. We will now step through the code in detail.

 
  • Register the selection criteria and turn all the cuts "on":

%CODE{"cpp"}%

Changed:
<
<
MuonVPlusJetsIDSelectionFunctor( Version_t version, double chi2 = 10.0, double d0 = 0.2, int nhits = 11, double ecaliso = 4.0, double hcaliso = 6.0, double reliso = 0.05 ) : version_(version)
>
>
WSelector( edm::ParameterSet const & params ) : muonSrc_(params.getParameter<edm::InputTag>("muonSrc")), metSrc_ (params.getParameter<edm::InputTag>("metSrc"))
  {
Changed:
<
<
push_back("Chi2", chi2 ); push_back("D0", d0 ); push_back("NHits", nhits ); push_back("ECalVeto", ecaliso); push_back("HCalVeto", hcaliso); push_back("RelIso", reliso );

set("Chi2"); set("D0"); set("NHits"); set("ECalVeto"); set("HCalVeto"); set("RelIso");

>
>
double muonPtMin = params.getParameter("muonPtMin"); double metMin = params.getParameter("metMin"); push_back("Muon Pt", muonPtMin ); push_back("MET", metMin ); set("Muon Pt"); set("MET");
 
Added:
>
>
wMuon_ = 0; met_ = 0;
  }
Deleted:
<
<
 %ENDCODE%

  • Define the selection:
Line: 137 to 125
 
  • Define the selection:

%CODE{"cpp"}%

Changed:
<
<
// Allow for multiple definitions of the cuts. bool operator()( const pat::Muon & muon, std::strbitset & ret ) {
>
>
// Here is where the selection occurs virtual bool operator()( edm::EventBase const & event, std::strbitset & ret){
 
Changed:
<
<
if ( version_ == SUMMER08 ) return summer08Cuts( muon, ret ); else { return false; }
>
>
ret.set(false);

// Handle to the muon collection edm::Handle<std::vector<pat::Muon> > muons; // Handle to the MET collection edm::Handle<std::vector<pat::MET> > met;

// Get the objects from the event bool gotMuons = event.getByLabel(muonSrc_, muons); bool gotMET = event.getByLabel(metSrc_, met);

// get the MET, require to be > minimum if ( gotMET ) { met_ = &met->at(0); if ( met_->pt() > cut("MET", double()) || ignoreCut("MET") ) passCut(ret, "MET");

  }
Changed:
<
<
// cuts based on craft 08 analysis. bool summer08Cuts( const pat::Muon & muon, std::strbitset & ret) { double norm_chi2 = muon.normChi2(); double corr_d0 = muon.dB(); int nhits = static_cast( muon.numberOfValidHits() );

double ecalVeto = muon.isolationR03().emVetoEt; double hcalVeto = muon.isolationR03().hadVetoEt;

double hcalIso = muon.hcalIso(); double ecalIso = muon.ecalIso(); double trkIso = muon.trackIso(); double pt = muon.pt() ;

double relIso = (ecalIso + hcalIso + trkIso) / pt;

if ( norm_chi2 < cut("Chi2", double()) || ignoreCut("Chi2") ) passCut(ret, "Chi2" ); if ( fabs(corr_d0) < cut("D0", double()) || ignoreCut("D0") ) passCut(ret, "D0" ); if ( nhits >= cut("NHits", int() ) || ignoreCut("NHits") ) passCut(ret, "NHits" ); if ( hcalVeto < cut("HCalVeto",double())|| ignoreCut("HCalVeto")) passCut(ret, "HCalVeto"); if ( ecalVeto < cut("ECalVeto",double())|| ignoreCut("ECalVeto")) passCut(ret, "ECalVeto"); if ( relIso < cut("RelIso", double()) || ignoreCut("RelIso") ) passCut(ret, "RelIso" );

>
>
// get the highest pt muon, require to have pt > minimum if ( gotMuons ) { if ( ignoreCut("Muon Pt") ) { if ( muons->size() > 0 ) { wMuon_ = &muons->at(0); if ( wMuon_->pt() > cut("Muon Pt", double()) || ignoreCut("Muon Pt") ) passCut(ret, "Muon Pt"); } } else { passCut( ret, "Muon Pt"); } }
 
Added:
>
>
setIgnored(ret);
  return (bool)ret;
Added:
>
>
  }

%ENDCODE%

Line: 181 to 171
  An example snippet of how to use this is:

%CODE{"cpp"}%

Changed:
<
<
MuonVPlusJetsIDSelectionFunctor muonIdTight( MuonVPlusJetsIDSelectionFunctor::SUMMER08 );
>
>
// Now get the W selector edm::ParameterSet wSelectorParams = fwliteParameters.getParameter<edm::ParameterSet>("wSelectorParams"); WSelector wSelector( wSelectorParams ); std::strbitset wSelectorReturns = wSelector.getBitTemplate();

// book a set of histograms fwlite::TFileService fs = fwlite::TFileService("analyzePatBasics.root"); TFileDirectory theDir = fs.mkdir("analyzeBasicPat"); TH1F* muonPt_ = theDir.make("muonPt", "pt", 100, 0.,300.); TH1F* muonEta_ = theDir.make("muonEta","eta", 100, -3., 3.); TH1F* muonPhi_ = theDir.make("muonPhi","phi", 100, -5., 5.);

// open input file (can be located on castor) TFile* inFile = TFile::Open( "file:PATLayer1_Output.fromAOD_full.root" );

// ---------------------------------------------------------------------- // Second Part: // // * loop the events in the input file // * receive the collections of interest via fwlite::Handle // * fill the histograms // * after the loop close the input file // ----------------------------------------------------------------------

// loop the events unsigned int iEvent=0; fwlite::Event ev(inFile); for(ev.toBegin(); ev.atEnd(); ++ev, ++iEvent){ edm::EventBase const & event = ev;

// break loop after end of file is reached // or after 1000 events have been processed if( iEvent==1000 ) break;

// simple event counter if(iEvent>0 && iEvent%1==0){ std::cout << " processing event: " << iEvent << std::endl; }

if ( wSelector(event, wSelectorReturns ) ) {

 
Deleted:
<
<
// ... // other initialization for your FWLite script here // ...
 
Added:
>
>
pat::Muon const & wMuon = wSelector.wMuon();
 
Added:
>
>
muonPt_ ->Fill( wMuon.pt() ); muonEta_->Fill( wMuon.eta() ); muonPhi_->Fill( wMuon.phi() );
 
Deleted:
<
<
for ( std::vector<pat::Muon>::const_iterator muonBegin = allMuons->begin(), muonEnd = allMuons->end(), imuon = muonBegin; imuon = muonEnd; ++imuon ) { std::strbitset iret = muonIdTight.getBitTemplate(); if ( imuon->pt() > muPtMin_ && muonIdTight(*imuon, iret) ) { selectedMuons_.push_back( *imuon );
  } }

%ENDCODE%

Deleted:
<
<
See here for a guide to FWLite, and see here for examples of FWLite macros.

There is also a nice prescription for creating standalone executables in FWLite using scram described here.

 

Selector<edm::EventBase>

Line: 214 to 235
 This very trivially implements the Selector to a concrete instantiation.
Changed:
<
<

Concrete WPlusJetsEventSelector Example

An example of using this functionality is shown here.
>
>

Concrete Complex Example

Please see here for a complex and realistic example of using selectors in an analysis.

  The same API is used for the event selector as for the object selectors, so the same sequence applies.
Line: 224 to 245
  %CODE{"cpp"}%
Changed:
<
<
WPlusJetsEventSelector::WPlusJetsEventSelector( edm::InputTag const & muonTag, edm::InputTag const & electronTag, edm::InputTag const & jetTag, edm::InputTag const & metTag, edm::InputTag const & trigTag, boost::shared_ptr & muonIdTight, boost::shared_ptr & electronIdTight, boost::shared_ptr & jetIdTight, boost::shared_ptr & muonIdLoose, boost::shared_ptr & electronIdLoose, boost::shared_ptr & jetIdLoose, int minJets, bool muPlusJets, bool ePlusJets, double muPtMin , double muEtaMax, double elePtMin , double eleEtaMax, double muPtMinLoose , double muEtaMaxLoose, double elePtMinLoose , double eleEtaMaxLoose, double jetPtMin , double jetEtaMax ) : muonTag_(muonTag), electronTag_(electronTag), jetTag_(jetTag), metTag_(metTag), trigTag_(trigTag), muonIdTight_(muonIdTight), electronIdTight_(electronIdTight), jetIdTight_(jetIdTight), muonIdLoose_(muonIdLoose), electronIdLoose_(electronIdLoose), jetIdLoose_(jetIdLoose), minJets_(minJets), muPlusJets_(muPlusJets), ePlusJets_(ePlusJets), muPtMin_(muPtMin), muEtaMax_(muEtaMax), elePtMin_(elePtMin), eleEtaMax_(eleEtaMax), muPtMinLoose_(muPtMinLoose), muEtaMaxLoose_(muEtaMaxLoose), elePtMinLoose_(elePtMinLoose), eleEtaMaxLoose_(eleEtaMaxLoose), jetPtMin_(jetPtMin), jetEtaMax_(jetEtaMax)
>
>
WPlusJetsEventSelector::WPlusJetsEventSelector( edm::ParameterSet const & params ) : EventSelector(), muonTag_ (params.getParameter<edm::InputTag>("muonSrc") ), electronTag_ (params.getParameter<edm::InputTag>("electronSrc") ), jetTag_ (params.getParameter<edm::InputTag>("jetSrc") ), metTag_ (params.getParameter<edm::InputTag>("metSrc") ), trigTag_ (params.getParameter<edm::InputTag>("trigSrc") ), muTrig_ (params.getParameter<std::string>("muTrig")), eleTrig_ (params.getParameter<std::string>("eleTrig")), pvSelector_ (params.getParameter<edm::ParameterSet>("pvSelector") ), muonIdTight_ (params.getParameter<edm::ParameterSet>("muonIdTight") ), electronIdTight_ (params.getParameter<edm::ParameterSet>("electronIdTight") ), muonIdLoose_ (params.getParameter<edm::ParameterSet>("muonIdLoose") ), electronIdLoose_ (params.getParameter<edm::ParameterSet>("electronIdLoose") ), jetIdLoose_ (params.getParameter<edm::ParameterSet>("jetIdLoose") ), pfjetIdLoose_ (params.getParameter<edm::ParameterSet>("pfjetIdLoose") ), minJets_ (params.getParameter ("minJets") ), muPlusJets_ (params.getParameter("muPlusJets") ), ePlusJets_ (params.getParameter("ePlusJets") ), muPtMin_ (params.getParameter("muPtMin")), muEtaMax_ (params.getParameter("muEtaMax")), elePtMin_ (params.getParameter("elePtMin")), eleEtaMax_ (params.getParameter("eleEtaMax")), muPtMinLoose_ (params.getParameter("muPtMinLoose")), muEtaMaxLoose_ (params.getParameter("muEtaMaxLoose")), elePtMinLoose_ (params.getParameter("elePtMinLoose")), eleEtaMaxLoose_ (params.getParameter("eleEtaMaxLoose")), jetPtMin_ (params.getParameter("jetPtMin")), jetEtaMax_ (params.getParameter("jetEtaMax")), jetScale_ (params.getParameter("jetScale")), metMin_ (params.getParameter("metMin"))
 { // make the bitset push_back( "Inclusive" ); push_back( "Trigger" );
Added:
>
>
push_back( "PV" );
  push_back( ">= 1 Lepton" ); push_back( "== 1 Lepton" );
Deleted:
<
<
push_back( "Tight Jet Cuts", minJets );
  push_back( "MET Cut" ); push_back( "Z Veto" ); push_back( "Conversion Veto"); push_back( "Cosmic Veto" );
Added:
>
>
push_back( "= 0 Jets" ); push_back( "= 1 Jets" ); push_back( "= 2 Jets" ); push_back( "= 3 Jets" ); push_back( "= 4 Jets" ); push_back( ">=5 Jets" );
  // turn everything on by default set( "Inclusive" ); set( "Trigger" );
Added:
>
>
set( "PV" );
  set( ">= 1 Lepton" ); set( "== 1 Lepton" );
Deleted:
<
<
set( "Tight Jet Cuts" );
  set( "MET Cut" ); set( "Z Veto" ); set( "Conversion Veto"); set( "Cosmic Veto" );
Added:
>
>
set( "= 0 Jets" ); set( "= 1 Jets" ); set( "= 2 Jets" ); set( "= 3 Jets" ); set( "= 4 Jets" ); set( ">=5 Jets" );
  dR_ = 0.3;
Deleted:
<
<
}

%ENDCODE%

  • Define the selection:

%CODE{"cpp"}% //// initialization not shown

pat::TriggerEvent const * trig = &*triggerEvent;

bool passTrig = false;

if ( trig->wasRun() && trig->wasAccept() ) {

pat::TriggerPath const * muPath = trig->path("HLT_Mu9");

 
Changed:
<
<
pat::TriggerPath const * elePath = trig->path("HLT_Ele15_LW_L1R");
>
>
if ( params.exists("cutsToIgnore") ) setIgnoredCuts( params.getParameter<std::vector<std::string> >("cutsToIgnore") );
 
Deleted:
<
<
if ( muPlusJets_ && muPath = 0 && muPath->wasAccept() ) { passTrig = true; }
 
Changed:
<
<
if ( ePlusJets_ && elePath = 0 && elePath->wasAccept() ) { passTrig = true;
>
>
retInternal_ = getBitTemplate();
  }
Deleted:
<
<
if ( ignoreCut("Trigger") || passTrig ) { passCut(ret, "Trigger");

int nleptons = 0; if ( muPlusJets_ ) nleptons += selectedMuons_.size();

if ( ePlusJets_ ) nleptons += selectedElectrons_.size();

if ( ignoreCut(">= 1 Lepton") || ( nleptons > 0 ) ){ passCut( ret, ">= 1 Lepton");

bool oneMuon = ( selectedMuons_.size() == 1 && looseMuons_.size() + selectedElectrons_.size() + looseElectrons_.size() == 0 ); bool oneElectron = ( selectedElectrons_.size() == 1 && selectedMuons_.size() == 0 );

if ( ignoreCut("== 1 Lepton") || ( (muPlusJets_ && oneMuon) ^ (ePlusJets_ && oneElectron ) ) ) { passCut(ret, "== 1 Lepton");

if ( ignoreCut("Tight Jet Cuts") || static_cast(cleanedJets_.size()) >= this->cut("Tight Jet Cuts", int()) ){ passCut(ret,"Tight Jet Cuts");

bool metCut = true; if ( ignoreCut("MET Cut") || metCut ) { passCut( ret, "MET Cut" );

bool zVeto = true; if ( selectedMuons_.size() == 2 ) { } if ( selectedElectrons_.size() == 2 ) { } if ( ignoreCut("Z Veto") || zVeto ){ passCut(ret, "Z Veto");

bool conversionVeto = true; if ( ignoreCut("Conversion Veto") || conversionVeto ) { passCut(ret,"Conversion Veto");

bool cosmicVeto = true; if ( ignoreCut("Cosmic Veto") || cosmicVeto ) { passCut(ret,"Cosmic Veto");

 
Changed:
<
<
} // end if cosmic veto

} // end if conversion veto

} // end if z veto

} // end if met cut

} // end if 1 tight jet

} // end if == 1 lepton

} // end if >= 1 lepton

>
>
%ENDCODE%
 
Changed:
<
<
} // end if trigger
>
>
  • Define the selection. Here is a subset, as this one is quite long:
 
Changed:
<
<
} // end if event triggered
>
>
%CODE{"cpp"}% //// initialization not shown
 
Deleted:
<
<
return (bool)ret;
 
Added:
>
>
if ( ignoreCut("= 0 Jets") || static_cast(cleanedJets_.size()) == 0 ){ passCut(ret,"= 0 Jets"); } // end if 0 tight jets

if ( ignoreCut("= 1 Jets") || static_cast(cleanedJets_.size()) == 1 ){ passCut(ret,"= 1 Jets"); } // end if 1 tight jets

if ( ignoreCut("= 2 Jets") || static_cast(cleanedJets_.size()) == 2 ){ passCut(ret,"= 2 Jets"); } // end if 2 tight jets

if ( ignoreCut("= 3 Jets") || static_cast(cleanedJets_.size()) == 3 ){ passCut(ret,"= 3 Jets"); } // end if 3 tight jets

if ( ignoreCut("= 4 Jets") || static_cast(cleanedJets_.size()) == 4 ){ passCut(ret,"= 4 Jets"); } // end if 4 tight jets

if ( ignoreCut(">=5 Jets") || static_cast(cleanedJets_.size()) >= 5 ){ passCut(ret,">=5 Jets"); } // end if >=5 tight jets

 
Line: 412 to 370
 here.

%CODE{"cpp"}%

Added:
>
>
//cout << "Making event selector" << endl; WPlusJetsEventSelector wPlusJets( shyftParameters ); std::strbitset ret = wPlusJets.getBitTemplate();

  //loop through each event for( ev.toBegin(); ! ev.atEnd(); ++ev) {
Added:
>
>
ret.set(false);
 
Added:
>
>
bool passed = wPlusJets(ev, ret); std::vector<reco::ShallowClonePtrCandidate> const & electrons = wPlusJets.selectedElectrons(); std::vector<reco::ShallowClonePtrCandidate> const & muons = wPlusJets.selectedMuons(); std::vector<reco::ShallowClonePtrCandidate> const & jets = wPlusJets.cleanedJets(); std::vector<reco::ShallowClonePtrCandidate> const & jetsBeforeClean = wPlusJets.selectedJets();

string bit_;

bit_ = "Trigger" ; bool passTrigger = ret[ bit_ ]; bit_ = "== 1 Lepton"; bool passOneLepton = ret[ bit_ ];

bit_ = "Trigger" ; bool passTrigger = ret[ bit_ ]; bit_ = "== 1 Lepton"; bool passOneLepton = ret[ bit_ ]; bit_ = "= 0 Jets"; bool jet0 = ret[bit_]; bit_ = "= 1 Jets"; bool jet1 = ret[bit_]; bit_ = "= 2 Jets"; bool jet2 = ret[bit_]; bit_ = "= 3 Jets"; bool jet3 = ret[bit_]; bit_ = "= 4 Jets"; bool jet4 = ret[bit_]; bit_ = ">=5 Jets"; bool jet5 = ret[bit_];

 
Changed:
<
<
std::strbitset ret = wPlusJets.getBitTemplate();
>
>
bool anyJets = jet1 || jet2 || jet3 || jet4 || jet5;

if ( anyJets && passOneLepton && passTrigger ) { cout << "Nele = " << electrons.size() << ", Nmuo = " << muons.size() << ", Njets_all = " << jets.size() << ", Njets_clean = " jetsBeforeClean.size() << endl; }

 
Deleted:
<
<
bool passed = wPlusJets(ev, ret); vector<pat::Electron> const & electrons = wPlusJets.selectedElectrons(); vector<pat::Muon> const & muons = wPlusJets.selectedMuons(); vector<pat::Jet> const & jets = wPlusJets.cleanedJets();

if ( passed ) { // YOUR PLOTTING CODE GOES HERE } // end if passes event selection

  } //end event loop

Changed:
<
<
cout << "Printing" << endl;
>
>
//cout << "Printing" << endl;
  wPlusJets.print(std::cout);
Added:
>
>
 %ENDCODE%

The printout at the end will give you a cut-flow summary of the cuts, in the order that you specify. In this case, it will look something like this:

Line: 438 to 429
 The printout at the end will give you a cut-flow summary of the cuts, in the order that you specify. In this case, it will look something like this:
Changed:
<
<
0 : Inclusive 5000 1 : Trigger 1395 2 : >= 1 Lepton 553 3 : == 1 Lepton 453 4 : Tight Jet Cuts 179 5 : MET Cut 179 6 : Z Veto 179 7 : Conversion Veto 179 8 : Cosmic Veto 179
>
>
0 : Inclusive 1496 1 : Trigger 1496 2 : PV 1494 3 : >= 1 Lepton 611 4 : == 1 Lepton 512 5 : MET Cut 512 6 : Z Veto 512 7 : Conversion Veto 512 8 : Cosmic Veto 512 9 : = 0 Jets 0 10 : = 1 Jets 3 11 : = 2 Jets 12 12 : = 3 Jets 59 13 : = 4 Jets 135 14 : >=5 Jets 303
 

Example Use Snippet, Masking A Cut

Revision 82010-04-16 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 6 to 6
 available, as well as string-parsed object selectors for single objects. However this can be limited if the user wants to study the cuts being applied. Furthermore, it is difficult to apply these tools in FWLite.
Changed:
<
<
This page refers to using Selectors in the 3.3.1 release. For the 3.1.4 version, please see SWGuidePATSelectors31x.
>
>
This page refers to using Selectors in the 3.3.1 release and later. For the 3.1.4 version, please see SWGuidePATSelectors31x.
 
Changed:
<
<
To use this software, start with CMSSW 3.4.2. The software resides in
>
>
To use this software, start with the version in WorkBookWhichRelease. The software resides in
 
PhysicsTools/SelectorUtils
Deleted:
<
<
To get the latest version of this for 3.4.2 analysis, see here for the latest tags:
 
Changed:
<
<
https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePATRecipes#CMSSW_3_4_X
>
>

Recipe for the impatient

 
Changed:
<
<
in particular,
>
>
See the most recent updates here.
 
Changed:
<
<
addpkg PhysicsTools/SelectorUtils V00-00-05 addpkg PhysicsTools/PatExamples V00-01-11
>
>
ssh lxplus5.cern.ch cmsrel CMSSW_3_5_7 cd CMSSW_3_5_7/src cmsenv addpkg PhysicsTools/SelectorUtils V00-00-13-01
 
Deleted:
<
<
In previous releases (3.3.x and 3.4.1) the software was included here:
V03-09-08-03 PhysicsTools/PatUtils
V07-04-00-01 PhysicsTools/Utilities
 
Added:
>
>

Links to Selectors of Interest

 
Added:
>
>
 

Selector

The Selector interface is provided to fill the gap present in using "user-level" cuts in an analysis scenario. The Selector interface can be used in

Revision 72010-03-29 - AmnonHarel

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 39 to 39
 The Selector interface is provided to fill the gap present in using "user-level" cuts in an analysis scenario. The Selector interface can be used in the full framework, or in FWLite.
Changed:
<
<
The base class is found here
>
>
The base class is found here
 with an interface shown in this snippet:

%CODE{"cpp"}%

Revision 62010-03-02 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 10 to 10
 
Changed:
<
<

Additional tags needed for CMSSW 3.3.x:

>
>
To use this software, start with CMSSW 3.4.2. The software resides in
PhysicsTools/SelectorUtils

To get the latest version of this for 3.4.2 analysis, see here for the latest tags:

 
Changed:
<
<
These tags fix some bugs:
>
>
https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePATRecipes#CMSSW_3_4_X

in particular,

 
Added:
>
>
addpkg PhysicsTools/SelectorUtils V00-00-05 addpkg PhysicsTools/PatExamples V00-01-11

In previous releases (3.3.x and 3.4.1) the software was included here:

 V03-09-08-03 PhysicsTools/PatUtils V07-04-00-01 PhysicsTools/Utilities

Revision 52010-02-02 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 10 to 10
 
Added:
>
>

Additional tags needed for CMSSW 3.3.x:

These tags fix some bugs:

V03-09-08-03 PhysicsTools/PatUtils
V07-04-00-01 PhysicsTools/Utilities
 

Selector

The Selector interface is provided to fill the gap present in using "user-level" cuts in an analysis scenario. The Selector interface can be used in

Line: 58 to 67
 

Masking cuts

Deleted:
<
<
There is a bug in recent versions of PhysicsTools/Utilities with respect to this feature. To use this, check out:

  • 3.3.x
    • PhysicsTools/Utilities V07-02-08-03
 

The std::strbitset can be used like any other bitset, so a "mask" can be selected and used as follows:

Revision 42009-12-15 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 58 to 58
 

Masking cuts

Added:
>
>
There is a bug in recent versions of PhysicsTools/Utilities with respect to this feature. To use this, check out:

  • 3.3.x
    • PhysicsTools/Utilities V07-02-08-03
 The std::strbitset can be used like any other bitset, so a "mask" can be selected and used as follows:

Revision 32009-12-10 - KatiLassilaPerini

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 173 to 173
 here for examples of FWLite macros.

There is also a nice prescription for creating standalone executables in FWLite using scram described

Changed:
<
<
here.
>
>
here.
 

Selector<edm::EventBase>

Revision 22009-10-29 - SalvatoreRRappoccio

Line: 1 to 1
 
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Line: 64 to 64
 std::strbitset ret = selector.getBitTemplate(); std::strbitset mask = selector.getBitTemplate(); mask[string("CutName")] = true;
Changed:
<
<
bool result = ret || mask;
>
>
bool result = ret | mask;
 

Concrete Selector<pat::Muon> Example

Line: 435 to 435
  bool passed = wPlusJets(ev, ret);
Changed:
<
<
if ( ret || mask ) {
>
>
if ( ret | mask ) {
  // PLOTTING CODE BEFORE TRIGGER SELECTION HERE

if ( ret ) {

Revision 12009-10-29 - SalvatoreRRappoccio

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="SWGuidePAT"

SWGuidePATSelectors

Object selection in physics analysis is important to structure correctly. The PAT has a great deal of tools available, as well as string-parsed object selectors for single objects. However this can be limited if the user wants to study the cuts being applied. Furthermore, it is difficult to apply these tools in FWLite.

This page refers to using Selectors in the 3.3.1 release. For the 3.1.4 version, please see SWGuidePATSelectors31x.

Selector

The Selector interface is provided to fill the gap present in using "user-level" cuts in an analysis scenario. The Selector interface can be used in the full framework, or in FWLite.

The base class is found here with an interface shown in this snippet:

<!-- SyntaxHighlightingPlugin -->
template<class T>
class Selector : public std::binary_function<T, std::strbitset, bool>
<!-- end SyntaxHighlightingPlugin -->

The Selector class template is an implementation of the std::binary_function, with arguments of T (the class being operated on), std::strbitset, a string-indexed bitset with source code here, and returns a bool based on whether the object passed the selection.

This interface makes use of the std::strbitset implemented for CMSSW. It performs identically to an ordinary std::bitvector except that the only interface to the information is via std::string keys. Thus, the user can access cuts and values by name rather than by index (which is inherently dangerous and difficult to synchronize).

The Selector class template provides an API as follows:

  • "Declare" the selection in a registry (via the push_back method).
    • This can include selection criteria of doubles, ints, or bools.
    • These selection criteria can also be accessed subsequently via string-index.
  • "Select" the object via an overloaded operator() method.
    • This also returns a strbitset with the bits for each cut set, so the user can see what passed and what failed.
  • "Print" the selection criteria to give the user information about what passed and what failed.

Turning cuts on and off

In order to turn the cuts on and off, the calls are:

  • Turn the cut on:
    set("CutName", true);

  • Turn the cut off:
    set("CutName", false);

This will "auto-pass" events based on this criterion.

Masking cuts

The std::strbitset can be used like any other bitset, so a "mask" can be selected and used as follows:

std::strbitset ret = selector.getBitTemplate();
std::strbitset mask = selector.getBitTemplate();
mask[string("CutName")] = true;
bool result = ret || mask;

Concrete Selector<pat::Muon> Example

For instance, a concrete implementation of this to select =pat::Muon='s based on the Summer 08 V+Jets group selection here is included in PhysicsTools/PatUtils. The source is included here, and the relevant snippets are shown here:

  • Register the selection criteria and turn all the cuts "on":

<!-- SyntaxHighlightingPlugin -->
MuonVPlusJetsIDSelectionFunctor( Version_t version,
				   double chi2 = 10.0,
				   double d0 = 0.2,
				   int nhits = 11,
				   double ecaliso = 4.0,
				   double hcaliso = 6.0,
				   double reliso = 0.05 ) :
  version_(version)
  {
    push_back("Chi2",      chi2   );
    push_back("D0",        d0     );
    push_back("NHits",     nhits  );
    push_back("ECalVeto",   ecaliso);
    push_back("HCalVeto",   hcaliso);
    push_back("RelIso",    reliso );

    set("Chi2");
    set("D0");
    set("NHits");
    set("ECalVeto");
    set("HCalVeto");
    set("RelIso");

  }
<!-- end SyntaxHighlightingPlugin -->

  • Define the selection:

<!-- SyntaxHighlightingPlugin -->
// Allow for multiple definitions of the cuts. 
  bool operator()( const pat::Muon & muon, std::strbitset & ret ) 
  { 

    if ( version_ == SUMMER08 ) return summer08Cuts( muon, ret );
    else {
      return false;
    }
  }

  // cuts based on craft 08 analysis. 
  bool summer08Cuts( const pat::Muon & muon, std::strbitset & ret)
  {
    double norm_chi2 = muon.normChi2();
    double corr_d0 = muon.dB();
    int nhits = static_cast<int>( muon.numberOfValidHits() );
    
    double ecalVeto = muon.isolationR03().emVetoEt;
    double hcalVeto = muon.isolationR03().hadVetoEt;
	
    double hcalIso = muon.hcalIso();
    double ecalIso = muon.ecalIso();
    double trkIso  = muon.trackIso();
    double pt      = muon.pt() ;

    double relIso = (ecalIso + hcalIso + trkIso) / pt;

    if ( norm_chi2     <  cut("Chi2",   double()) || ignoreCut("Chi2")    ) passCut(ret, "Chi2"   );
    if ( fabs(corr_d0) <  cut("D0",     double()) || ignoreCut("D0")      ) passCut(ret, "D0"     );
    if ( nhits         >= cut("NHits",  int()   ) || ignoreCut("NHits")   ) passCut(ret, "NHits"  );
    if ( hcalVeto      <  cut("HCalVeto",double())|| ignoreCut("HCalVeto")) passCut(ret, "HCalVeto");
    if ( ecalVeto      <  cut("ECalVeto",double())|| ignoreCut("ECalVeto")) passCut(ret, "ECalVeto");
    if ( relIso        <  cut("RelIso", double()) || ignoreCut("RelIso")  ) passCut(ret, "RelIso" );

    return (bool)ret;
  }
<!-- end SyntaxHighlightingPlugin -->

Example Use Snippet

An example snippet of how to use this is:

<!-- SyntaxHighlightingPlugin -->
MuonVPlusJetsIDSelectionFunctor muonIdTight( MuonVPlusJetsIDSelectionFunctor::SUMMER08 );

// ...
// other initialization for your FWLite script here
// ...



  for ( std::vector<pat::Muon>::const_iterator muonBegin = allMuons->begin(),
	  muonEnd = allMuons->end(), imuon = muonBegin;
	imuon != muonEnd; ++imuon ) {
    std::strbitset iret = muonIdTight.getBitTemplate();
    if ( imuon->pt() > muPtMin_ && muonIdTight(*imuon, iret) ) {
      selectedMuons_.push_back( *imuon );
    }
  }
<!-- end SyntaxHighlightingPlugin -->

See here for a guide to FWLite, and see here for examples of FWLite macros.

There is also a nice prescription for creating standalone executables in FWLite using scram described here.

Selector<edm::EventBase>

There is also the possibility to create event selectors from the Selector interface. In software releases in the 3.3.x cycle, this can work on the entire event because there was the creation of a common base class for edm::Event and fwlite::Event (edm::EventBase).

This very trivially implements the Selector to a concrete instantiation.

Concrete WPlusJetsEventSelector Example

An example of using this functionality is shown here.

The same API is used for the event selector as for the object selectors, so the same sequence applies.

  • Register the selection criteria:

<!-- SyntaxHighlightingPlugin -->
WPlusJetsEventSelector::WPlusJetsEventSelector( 
    edm::InputTag const & muonTag,
    edm::InputTag const & electronTag,
    edm::InputTag const & jetTag,
    edm::InputTag const & metTag,
    edm::InputTag const & trigTag,
    boost::shared_ptr<MuonVPlusJetsIDSelectionFunctor> & muonIdTight,
    boost::shared_ptr<ElectronVPlusJetsIDSelectionFunctor> & electronIdTight,
    boost::shared_ptr<JetIDSelectionFunctor> & jetIdTight,
    boost::shared_ptr<MuonVPlusJetsIDSelectionFunctor> & muonIdLoose,
    boost::shared_ptr<ElectronVPlusJetsIDSelectionFunctor> & electronIdLoose,
    boost::shared_ptr<JetIDSelectionFunctor> & jetIdLoose,
    int minJets,
    bool muPlusJets,
    bool ePlusJets,
    double muPtMin       , double muEtaMax,
    double elePtMin      , double eleEtaMax,
    double muPtMinLoose  , double muEtaMaxLoose,
    double elePtMinLoose , double eleEtaMaxLoose,
    double jetPtMin      , double jetEtaMax
    ) :
  muonTag_(muonTag),
  electronTag_(electronTag),
  jetTag_(jetTag),
  metTag_(metTag),
  trigTag_(trigTag),
  muonIdTight_(muonIdTight),
  electronIdTight_(electronIdTight),
  jetIdTight_(jetIdTight),
  muonIdLoose_(muonIdLoose),
  electronIdLoose_(electronIdLoose),
  jetIdLoose_(jetIdLoose),
  minJets_(minJets),
  muPlusJets_(muPlusJets),
  ePlusJets_(ePlusJets),
  muPtMin_(muPtMin), muEtaMax_(muEtaMax),
  elePtMin_(elePtMin), eleEtaMax_(eleEtaMax),
  muPtMinLoose_(muPtMinLoose), muEtaMaxLoose_(muEtaMaxLoose),
  elePtMinLoose_(elePtMinLoose), eleEtaMaxLoose_(eleEtaMaxLoose),
  jetPtMin_(jetPtMin), jetEtaMax_(jetEtaMax)
{
  // make the bitset
  push_back( "Inclusive"      );
  push_back( "Trigger"        );
  push_back( ">= 1 Lepton"    );
  push_back( "== 1 Lepton"    );
  push_back( "Tight Jet Cuts", minJets );
  push_back( "MET Cut"        );
  push_back( "Z Veto"         );
  push_back( "Conversion Veto");
  push_back( "Cosmic Veto"    );

  // turn everything on by default
  set( "Inclusive"      );
  set( "Trigger"        );
  set( ">= 1 Lepton"    );
  set( "== 1 Lepton"    );
  set( "Tight Jet Cuts" );
  set( "MET Cut"        );
  set( "Z Veto"         );
  set( "Conversion Veto");
  set( "Cosmic Veto"    );

  dR_ = 0.3;
}


<!-- end SyntaxHighlightingPlugin -->

  • Define the selection:

<!-- SyntaxHighlightingPlugin -->
//// initialization not shown

  pat::TriggerEvent const * trig = &*triggerEvent;

  bool passTrig = false;

  if ( trig->wasRun() && trig->wasAccept() ) {

    pat::TriggerPath const * muPath = trig->path("HLT_Mu9");

    pat::TriggerPath const * elePath = trig->path("HLT_Ele15_LW_L1R");

    if ( muPlusJets_ && muPath != 0 && muPath->wasAccept() ) {
      passTrig = true;    
    }

    if ( ePlusJets_ && elePath != 0 && elePath->wasAccept() ) {
      passTrig = true;
    }

    if ( ignoreCut("Trigger") || 
	 passTrig ) {
      passCut(ret, "Trigger");

      int nleptons = 0;
      if ( muPlusJets_ )
	nleptons += selectedMuons_.size();
      
      if ( ePlusJets_ ) 
	nleptons += selectedElectrons_.size();

      if ( ignoreCut(">= 1 Lepton") || 
	   ( nleptons > 0 ) ){
	passCut( ret, ">= 1 Lepton");

	bool oneMuon = 
	  ( selectedMuons_.size() == 1 && 
	    looseMuons_.size() + selectedElectrons_.size() + looseElectrons_.size() == 0 
	    );
	bool oneElectron = 
	  ( selectedElectrons_.size() == 1 &&
	    selectedMuons_.size() == 0 
	    );

	if ( ignoreCut("== 1 Lepton") || 
	     ( (muPlusJets_ && oneMuon) ^ (ePlusJets_ && oneElectron )  )
	     ) {
	  passCut(ret, "== 1 Lepton");

	  if ( ignoreCut("Tight Jet Cuts") ||
	       static_cast<int>(cleanedJets_.size()) >=  this->cut("Tight Jet Cuts", int()) ){
	    passCut(ret,"Tight Jet Cuts");
	  

	    bool metCut = true;
	    if ( ignoreCut("MET Cut") ||
		 metCut ) {
	      passCut( ret, "MET Cut" );
	  

	      bool zVeto = true;
	      if ( selectedMuons_.size() == 2 ) {
	      }
	      if ( selectedElectrons_.size() == 2 ) {
	      }
	      if ( ignoreCut("Z Veto") ||
		   zVeto ){
		passCut(ret, "Z Veto");
	    
  
		bool conversionVeto = true;
		if ( ignoreCut("Conversion Veto") ||
		     conversionVeto ) {
		  passCut(ret,"Conversion Veto");
		


		  bool cosmicVeto = true;
		  if ( ignoreCut("Cosmic Veto") ||
		       cosmicVeto ) {
		    passCut(ret,"Cosmic Veto");

		  
		  } // end if cosmic veto
		
		} // end if conversion veto

	      } // end if z veto

	    } // end if met cut
      
	  } // end if 1 tight jet 
	
	} // end if == 1 lepton

      } // end if >= 1 lepton
    
    } // end if trigger

  } // end if event triggered

  return (bool)ret;



<!-- end SyntaxHighlightingPlugin -->

Example Use Snippet

An example snippet of how to use this is shown here.

<!-- SyntaxHighlightingPlugin -->
//loop through each event
  for( ev.toBegin();
         ! ev.atEnd();
       ++ev) {

 
    std::strbitset ret = wPlusJets.getBitTemplate();

    bool passed = wPlusJets(ev, ret);
    vector<pat::Electron> const & electrons = wPlusJets.selectedElectrons();
    vector<pat::Muon>     const & muons     = wPlusJets.selectedMuons();
    vector<pat::Jet>      const & jets      = wPlusJets.cleanedJets();

    if ( passed ) {
        // YOUR PLOTTING CODE GOES HERE
    } // end if passes event selection
  } //end event loop
  
  cout << "Printing" << endl;
  wPlusJets.print(std::cout);
<!-- end SyntaxHighlightingPlugin -->

The printout at the end will give you a cut-flow summary of the cuts, in the order that you specify. In this case, it will look something like this:

     0 :            Inclusive       5000
     1 :              Trigger       1395
     2 :          >= 1 Lepton        553
     3 :          == 1 Lepton        453
     4 :       Tight Jet Cuts        179
     5 :              MET Cut        179
     6 :               Z Veto        179
     7 :      Conversion Veto        179
     8 :          Cosmic Veto        179

Example Use Snippet, Masking A Cut

Let's now turn to the use case where you want to study the analysis before and after some event selection (for instance, to study the trigger bias). This is now trivial. The above code becomes:

<!-- SyntaxHighlightingPlugin -->
//loop through each event
  for( ev.toBegin();
         ! ev.atEnd();
       ++ev) {

    std::strbitset ret = wPlusJets.getBitTemplate();
    std::strbitset mask = wPlusJets.getBitTemplate();
    mask[string("Trigger")] = true;    

    bool passed = wPlusJets(ev, ret);

    if ( ret || mask ) {
       // PLOTTING CODE BEFORE TRIGGER SELECTION HERE

       if ( ret ) {
           // PLOTTING CODE AFTER TRIGGER SELECTION HERE
       }
    }
  } //end event loop
  
  cout << "Printing" << endl;
  wPlusJets.print(std::cout);
<!-- end SyntaxHighlightingPlugin -->

-- SalvatoreRoccoRappoccio - 29-Oct-2009

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback