本文整理汇总了C++中JetPointer::partonFlavour方法的典型用法代码示例。如果您正苦于以下问题:C++ JetPointer::partonFlavour方法的具体用法?C++ JetPointer::partonFlavour怎么用?C++ JetPointer::partonFlavour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JetPointer
的用法示例。
在下文中一共展示了JetPointer::partonFlavour方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: passesEventSelection
bool PseudoTopAnalyser::passesEventSelection( const MCParticlePointer pseudoLepton, const ParticlePointer pseudoNeutrino, const JetCollection pseudoJets, const MCParticleCollection pseudoBs, const ParticleCollection allPseudoLeptons, const ParticlePointer pseudoMET ) {
// Event selection taken from here : https://twiki.cern.ch/twiki/bin/view/LHCPhysics/ParticleLevelTopDefinitions
unsigned int numberGoodLeptons = 0;
unsigned int numberVetoLeptons = 0;
ParticlePointer leadingLepton;
for ( unsigned int leptonIndex = 0; leptonIndex < allPseudoLeptons.size(); ++ leptonIndex ) {
const ParticlePointer lepton = allPseudoLeptons.at(leptonIndex);
// Check if this is a good signal type lepton
if ( lepton->pt() > minLeptonPt_ && fabs(lepton->eta()) < maxLeptonAbsEta_ ) {
++numberGoodLeptons;
if ( leadingLepton == 0 ) leadingLepton = lepton;
}
// Check if this is a veto lepton
if ( lepton->pt() > minVetoLeptonPt_ && fabs(lepton->eta()) < maxVetoLeptonAbsEta_ ) {
++numberVetoLeptons;
}
}
// Neutrino pt sum
bool passesNeutrinoSumPt = false;
if ( pseudoMET != 0 ) {
if ( pseudoMET->pt() > minNeutrinoSumPt_ ) passesNeutrinoSumPt = true;
}
// W MT
bool passesWMT = false;
if ( leadingLepton != 0 && pseudoMET != 0 ) {
double genMT = sqrt( 2 * leadingLepton->pt() * pseudoMET->pt() * ( 1 - cos(leadingLepton->phi() - pseudoMET->phi() ) ) );
if (genMT > minWMt_) passesWMT = true;
}
// Jets
unsigned int numberGoodJets = 0;
unsigned int numberGoodBJets = 0;
for ( unsigned int jetIndex = 0; jetIndex < pseudoJets.size(); ++ jetIndex ) {
const JetPointer jet = pseudoJets.at(jetIndex);
// Check if this is a good jet
if ( jet->pt() > minJetPt_ && fabs(jet->eta()) < maxJetAbsEta_ ) {
++numberGoodJets;
// Check if this is also a good b jet
if ( fabs( jet->partonFlavour() ) == 5 ) {
++numberGoodBJets;
}
}
}
if ( numberGoodLeptons == 1 && numberVetoLeptons <= 1 && passesNeutrinoSumPt && passesWMT && numberGoodJets >= minNJets_ && numberGoodBJets >= minNBJets_ ) {
return true;
}
else return false;
}
示例2: analyse
void BTagEff::analyse(const EventPtr event) {
histMan_->setCurrentHistogramFolder(histogramFolder_);
treeMan_->setCurrentFolder(histogramFolder_);
int NJets = 0;
const JetCollection allJets = event->Jets();
for (unsigned int jetIndex = 0; jetIndex < allJets.size(); ++jetIndex) {
const JetPointer jet(allJets.at(jetIndex));
bool isLoose = false;
bool isMedium = false;
bool isTight = false;
double jetPt = jet->pt();
double jetEta = jet->eta();
if (jetPt < 25 || abs(jetEta) > 2.4) continue;
// double jetCSV = jet->getBTagDiscriminator(BtagAlgorithm::CombinedSecondaryVertexV2, BtagAlgorithm::MEDIUM);
double jetCSV = jet->getBTagDiscriminator(BAT::BtagAlgorithm::value::CombinedSecondaryVertexV2);
// https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagRecommendation74X50ns
if (jetCSV > 0.605) isLoose = true;
if (jetCSV > 0.890) isMedium = true;
if (jetCSV > 0.970) isTight = true;
unsigned int partonFlavour = abs(jet->partonFlavour());
// const bool isBTagged = jet->isBJet(BtagAlgorithm::CombinedSecondaryVertexV2, BtagAlgorithm::MEDIUM);
// cout << jet->isBJet(BtagAlgorithm::CombinedSecondaryVertexV2, BtagAlgorithm::MEDIUM) << endl;
treeMan_->Fill("pt", jetPt);
treeMan_->Fill("eta", jetEta);
treeMan_->Fill("CSV", jetCSV);
treeMan_->Fill("partonFlavour", partonFlavour);
treeMan_->Fill("isLoose", isLoose);
treeMan_->Fill("isMedium", isMedium);
treeMan_->Fill("isTight", isTight);
++NJets;
}
treeMan_->Fill("NJets", NJets);
}
示例3: analyse
void BTagEff::analyse(const EventPtr event) {
treeMan_->setCurrentFolder(histogramFolder_);
int NJets = 0;
int NBJets = 0; // How many medium b jets
const JetCollection cleanedJets = event->CleanedJets();
int selectionCriteria = -1;
if ( event->PassesElectronTriggerAndSelectionNoB() ) selectionCriteria = SelectionCriteria::ElectronPlusJetsReference;
else if ( event->PassesMuonTriggerAndSelectionNoB() ) selectionCriteria = SelectionCriteria::MuonPlusJetsReference;
const LeptonPointer signalLepton = event->getSignalLepton( selectionCriteria );
// unsigned int nParton = 0;
for (unsigned int jetIndex = 0; jetIndex < cleanedJets.size(); ++jetIndex) {
const JetPointer jet(cleanedJets.at(jetIndex));
bool isLoose = false;
bool isMedium = false;
bool isTight = false;
double jetPt = jet->pt();
double jetEta = jet->eta();
if (jetPt < 25 || fabs(jetEta) > 2.4) continue;
double jetCSV = jet->getBTagDiscriminator(BAT::BtagAlgorithm::value::CombinedSecondaryVertexV2);
// https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagRecommendation76X
if (jetCSV > 0.460) {
isLoose = true;
}
if (jetCSV > 0.800) {
isMedium = true;
++NBJets;
}
if (jetCSV > 0.935) {
isTight = true;
}
unsigned int partonFlavour = abs(jet->partonFlavour());
unsigned int hadronFlavour = abs(jet->hadronFlavour());
treeMan_->Fill("pt", jetPt);
treeMan_->Fill("eta", jetEta);
treeMan_->Fill("CSV", jetCSV);
treeMan_->Fill("partonFlavour", partonFlavour);
treeMan_->Fill("hadronFlavour", hadronFlavour);
treeMan_->Fill("isLoose", isLoose);
treeMan_->Fill("isMedium", isMedium);
treeMan_->Fill("isTight", isTight);
++NJets;
}
treeMan_->Fill("NJets", NJets);
treeMan_->Fill("NBJets", NBJets);
treeMan_->Fill("EventWeight", event->weight());
treeMan_->Fill("PUWeight", event->PileUpWeight());
if ( selectionCriteria == SelectionCriteria::ElectronPlusJetsReference ) {
double electronEfficiencyCorrection = 1;
if ( !event->isRealData() ) {
const ElectronPointer signalElectron(boost::static_pointer_cast<Electron>(signalLepton));
electronEfficiencyCorrection = signalElectron->getEfficiencyCorrection( 0 );
}
treeMan_->Fill("ElectronEfficiencyCorrection",electronEfficiencyCorrection);
}
else if ( selectionCriteria == SelectionCriteria::MuonPlusJetsReference ) {
double muonEfficiencyCorrection = 1;
if ( !event->isRealData() ) {
const MuonPointer signalMuon(boost::static_pointer_cast<Muon>(signalLepton));
muonEfficiencyCorrection = signalMuon->getEfficiencyCorrection( 0 );
}
treeMan_->Fill("MuonEfficiencyCorrection",muonEfficiencyCorrection);
}
}
示例4: weight
double BTagWeight::weight(const JetCollection jets, const int systematic) const {
float bTaggedMCJet = 1.0;
float nonBTaggedMCJet = 1.0;
float bTaggedDataJet = 1.0;
float nonBTaggedDataJet = 1.0;
for (unsigned int index = 0; index < jets.size(); ++index) {
// Info on this jet
const JetPointer jet(jets.at(index));
double jetPt = jet->pt();
if ( jetPt < 25 ) continue;
// If the pt of the jet is outside the pt range of the SFs,
// use the pt at the upper/lower edge and double the uncertainty.
bool ptOutOfRange = false;
if ( jetPt <= 30 || jet->pt() >= 670 ) {
ptOutOfRange = true;
}
const unsigned int partonFlavour = abs( jet->partonFlavour() );
const bool isBTagged = jet->isBJet();
// Get scale factor for this jet
const double sf = jet->getBTagSF( 0 );
double sf_up = jet->getBTagSF( 1 );
double sf_down = jet->getBTagSF( -1 );
if ( ptOutOfRange ) {
sf_up = sf + 2 * ( sf_up - sf );
sf_down = sf - 2 * ( sf - sf_down );
if ( sf_up < 0 ) sf_up = 0;
if ( sf_down < 0 ) sf_down = 0;
}
// Get efficiency for this jet
const double eff = getEfficiency( partonFlavour, jet );
double sfToUse = sf;
if ( systematic == 1 ) {
sfToUse = sf_up;
}
else if ( systematic == -1 ) {
sfToUse = sf_down;
}
if ( isBTagged ) {
bTaggedMCJet *= eff;
if ( eff*sfToUse > 1 ) {
bTaggedDataJet *= 1;
}
else if ( eff*sfToUse < 0 ) {
bTaggedDataJet *= 0;
}
else {
bTaggedDataJet *= eff*sfToUse;
}
}
else {
nonBTaggedMCJet *= ( 1 - eff );
if ( eff*sfToUse > 1 ) {
nonBTaggedDataJet *= 0;
}
else if ( eff*sfToUse < 0 ) {
nonBTaggedDataJet *= 1;
}
else {
bTaggedDataJet *= ( 1 - eff*sfToUse );
}
}
// if ( nonBTaggedMCJet < 0 || nonBTaggedDataJet < 0 ) {
// cout << nonBTaggedMCJet << " " << nonBTaggedDataJet << endl;
// cout << eff << " " << sfToUse << endl;
// }
}
double bTagWeight = (nonBTaggedDataJet * bTaggedDataJet) / (nonBTaggedMCJet * bTaggedMCJet);
return bTagWeight;
}