-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from robervalwalsh/develop
Analyser
- Loading branch information
Showing
85 changed files
with
4,450 additions
and
3,034 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#include "Analysis/Tools/interface/Analyser.h" | ||
|
||
// this example is a dijet analysis in which the leading jet | ||
// is required to have a muon, and both of the leading | ||
// jets are btagged | ||
|
||
using namespace std; | ||
using namespace analysis; | ||
using namespace analysis::tools; | ||
|
||
int main(int argc, char ** argv) | ||
{ | ||
TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histograms | ||
|
||
Analyser analyser(argc,argv); | ||
|
||
// you can always get the ususal analysis class | ||
auto analysis = analyser.analysis(); | ||
|
||
// HISTOGRAMS | ||
// create some predefined jet histograms | ||
analyser.jetHistograms(2,"dijet"); | ||
// create some predefined muon histograms | ||
// muon histograms still not available | ||
|
||
// get a map with all TH1F histograms pointers | ||
std::map<std::string, std::shared_ptr<TH1F> > histos = analyser.histograms(); | ||
|
||
for ( int i = 0 ; i < analyser.nEvents() ; ++i ) | ||
{ | ||
if ( ! analyser.event(i) ) continue; | ||
|
||
// TRIGGER selection | ||
if ( ! analyser.selectionHLT() ) continue; | ||
if ( ! analyser.selectionL1 () ) continue; // to be used mainly in case of "OR" of seeds | ||
|
||
// MUONS pre-selection | ||
// muon identification selection | ||
if ( ! analyser.selectionMuonId() ) continue; | ||
if ( ! analyser.selectionNMuons() ) continue; | ||
// if you need the selected muons explicitly - be careful where you use it | ||
std::vector< std::shared_ptr<Muon> > selmuon = analyser.selectedMuons(); | ||
|
||
// JETS pre-selection | ||
// jet identification selection | ||
if ( ! analyser.selectionJetId() ) continue; | ||
if ( ! analyser.selectionJetPileupId() ) continue; | ||
if ( ! analyser.selectionNJets() ) continue; | ||
// if you need the selected jets explicitly - be careful where you use it | ||
std::vector< std::shared_ptr<Jet> > seljets = analyser.selectedJets(); | ||
|
||
// CORRECTIONS to pre-selected jets | ||
// b energy regression | ||
if ( analyser.config()->bRegression() ) | ||
analyser.actionApplyBjetRegression(); | ||
|
||
// MC-only jet corrections | ||
if ( analyser.config()->isMC() ) | ||
{ | ||
// apply btag SF | ||
analyser.actionApplyBtagSF(1); | ||
analyser.actionApplyBtagSF(2); | ||
|
||
// jet energy resolution to all selected jets | ||
analyser.actionApplyJER(); | ||
} | ||
|
||
// MAIN SELECTION | ||
// JETS | ||
// 1st and 2nd jet kinematic selection, pt and eta | ||
if ( ! analyser.selectionJet(1) ) continue; | ||
if ( ! analyser.selectionJet(2) ) continue; | ||
// delta R jet selection | ||
if ( ! analyser.selectionJetDr(1,2) ) continue; | ||
// btag of two leading jets | ||
if ( ! analyser.selectionBJet(1) ) continue; | ||
if ( ! analyser.selectionBJet(2) ) continue; | ||
// jets 1 and 2 matching to online jets | ||
if ( ! analyser.onlineJetMatching(1) ) continue; | ||
if ( ! analyser.onlineJetMatching(2) ) continue; | ||
// dije mass selection | ||
if ( ! analyser.selectionDiJetMass(1,2) ) continue; | ||
|
||
// MUON | ||
// muon kinematic selection | ||
if ( ! analyser.selectionMuons() ) continue; | ||
// muon trigger matching - at least nmin offline muons matched to online objects | ||
if ( ! analyser.onlineMuonMatching() ) continue; | ||
|
||
// MUONJET | ||
if ( ! analyser.muonJet(1) ) continue; | ||
|
||
// HISTOGRAMS | ||
analyser.fillJetHistograms("dijet"); | ||
|
||
} //end event loop | ||
} // end main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "Analysis/Tools/interface/Analyser.h" | ||
|
||
using namespace std; | ||
using namespace analysis; | ||
using namespace analysis::tools; | ||
|
||
int main(int argc, char ** argv) | ||
{ | ||
TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histograms | ||
|
||
Analyser trigger(argc,argv); | ||
|
||
auto analysis = trigger.analysis(); // that's the usual Analysis class | ||
|
||
for ( int i = 0 ; i < trigger.nEvents() ; ++i ) | ||
{ | ||
if ( ! trigger.event(i) ) continue; | ||
// trigger selection | ||
if ( ! trigger.selectionHLT() ) continue; | ||
if ( ! trigger.selectionL1 () ) continue; // to be used in case of "OR" of seeds | ||
|
||
// One can always use the usual Analysis to retrieve some information | ||
auto l1jets_ana = analysis->collection<TriggerObject>(trigger.config()->triggerObjectsL1Jets()); | ||
for ( int j = 0 ; j < l1jets_ana->size() ; ++j ) | ||
{ | ||
TriggerObject l1jet = l1jets_ana->at(j); | ||
std::cout << "L1 Jet (Analysis): pT = " << l1jet.pt() << ", " << l1jet.eta() << ", " << l1jet.phi() << std::endl; | ||
} | ||
std::cout << "----" << std::endl; | ||
|
||
// But sometimes there is a method in the analyser one can use directly | ||
// L1 jets trigger objects | ||
auto l1jets = trigger.triggerObjectsL1Jets(); | ||
for ( auto jet : l1jets ) | ||
{ | ||
std::cout << "L1 Jet (Analyser): pT = " << jet->pt() << ", " << jet->eta() << ", " << jet->phi() << std::endl; | ||
} | ||
std::cout << "====" << std::endl; | ||
} | ||
|
||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.