// Access the JetCorrectorParameter via the key k. // key_type is hashed to deal with the three collections JetCorrectorParameters const & JetCorrectorParametersCollection::operator[]( key_type k ) const { collection_type::const_iterator ibegin, iend, i; if ( isL5(k) ) { ibegin = correctionsL5_.begin(); iend = correctionsL5_.end(); i = ibegin; } else if ( isL7(k) ) { ibegin = correctionsL7_.begin(); iend = correctionsL7_.end(); i = ibegin; } else { ibegin = corrections_.begin(); iend = corrections_.end(); i = ibegin; } for ( ; i != iend; ++i ) { if ( k == i->first ) return i->second; } //std::cout << " cannot find key " << static_cast<int>(k) << std::endl; //assert(0); // if we got this far, we didn't have a proper index TString message = Form("[JetCorrectorParameterCollecion::operator[]]: cannot find key %i", static_cast<int>(k)); throw std::out_of_range(message.Data()); }
// Add a JetCorrectorParameter object, possibly with flavor. void JetCorrectorParametersCollection::push_back( key_type i, value_type const & j, label_type const & flav) { std::cout << "i = " << i << std::endl; std::cout << "flav = " << flav << std::endl; if ( isL5(i) ) { std::cout << "This is L5, getL5Bin = " << getL5Bin(flav) << std::endl; correctionsL5_.push_back( pair_type(getL5Bin(flav),j) ); } else if ( isL7(i) ) { std::cout << "This is L7, getL7Bin = " << getL7Bin(flav) << std::endl; correctionsL7_.push_back( pair_type(getL7Bin(flav),j) ); } else if ( flav == "" ) { corrections_.push_back( pair_type(i,j) ); } else { std::cout << "***** NOT ADDING " << flav << ", corresponding position in JetCorrectorParameters is not found." << std::endl; } }
// Access the JetCorrectorParameter via the key k. // key_type is hashed to deal with the three collections JetCorrectorParameters const & JetCorrectorParametersCollection::operator[]( key_type k ) const { collection_type::const_iterator ibegin, iend, i; if ( isL5(k) ) { ibegin = correctionsL5_.begin(); iend = correctionsL5_.end(); i = ibegin; } else if ( isL7(k) ) { ibegin = correctionsL7_.begin(); iend = correctionsL7_.end(); i = ibegin; } else { ibegin = corrections_.begin(); iend = corrections_.end(); i = ibegin; } for ( ; i != iend; ++i ) { if ( k == i->first ) return i->second; } handleError( "InvalidInput",Form("cannot find key %d in JEC payload, this usually means you have to change the GT",static_cast<int>(k) ) ) ; }
std::string JetCorrectorParametersCollection::findLabel( key_type k ){ if ( isL5(k) ) return findL5Flavor(k); else if ( isL7(k) ) return findL7Parton(k); else return labels_[k]; }
static std::string findLabel( key_type k ) { if ( isL5(k) ) return findL5Flavor(k); else if ( isL7(k) ) return findL7Parton(k); else return labels_[k]; }