本文整理汇总了C++中JetPointer::getBTagSF方法的典型用法代码示例。如果您正苦于以下问题:C++ JetPointer::getBTagSF方法的具体用法?C++ JetPointer::getBTagSF怎么用?C++ JetPointer::getBTagSF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JetPointer
的用法示例。
在下文中一共展示了JetPointer::getBTagSF方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}