8 using namespace RecoBTag;
12 pSet.getParameter<double>(
"etaMin"),
13 pSet.getParameter<double>(
"etaMax"),
14 pSet.getParameter<double>(
"ptRecJetMin"),
15 pSet.getParameter<double>(
"ptRecJetMax"),
17 pSet.getParameter<double>(
"ratioMin"),
18 pSet.getParameter<double>(
"ratioMax"),
19 pSet.getParameter<bool>(
"doJetID" )
21 etaRanges(pSet.getParameter< vector<double> >(
"etaRanges")),
22 ptRanges(pSet.getParameter< vector<double> >(
"ptRanges")),
23 doJEC(pSet.getParameter<bool>(
"doJEC" )),
24 moduleConfig(pSet.getParameter< vector<edm::
ParameterSet> >(
"tagConfig"))
30 for (vector<edm::ParameterSet>::const_iterator iModule =
moduleConfig.begin();
33 const string& dataFormatType = iModule->exists(
"type") ?
34 iModule->getParameter<
string>(
"type") :
36 if (dataFormatType ==
"JetTag") {
40 jetTagToken.push_back(consumes<JetTagCollection>(moduleLabel));
42 else if(dataFormatType ==
"TagCorrelation") {
53 std::vector< edm::EDGetTokenT<edm::View<reco::BaseTagInfo>> > tokens;
54 if(dataFormatType ==
"GenericMVA") {
76 const int iEtaStart = -1 ;
77 const int iEtaEnd =
etaRanges.size() - 1 ;
78 const int iPtStart = -1 ;
79 const int iPtEnd =
ptRanges.size() - 1 ;
83 int iTag = -1;
int iTagCorr = -1;
int iInfoTag = -1;
84 for (vector<edm::ParameterSet>::const_iterator iModule =
moduleConfig.begin();
87 const string& dataFormatType = iModule->exists(
"type") ?
88 iModule->getParameter<
string>(
"type") :
90 if (dataFormatType ==
"JetTag") {
92 const string& folderName = iModule->getParameter<
string>(
"folder");
95 for (
int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta ) {
97 for (
int iPt = iPtStart ; iPt < iPtEnd ; ++iPt ) {
109 }
else if(dataFormatType ==
"TagCorrelation") {
115 for (
int iEta = iEtaStart ; iEta != iEtaEnd ; ++iEta) {
117 for(
int iPt = iPtStart ; iPt != iPtEnd ; ++iPt) {
130 const string& folderName = iModule->getParameter<
string>(
"folder");
133 for (
int iEta = iEtaStart ; iEta < iEtaEnd ; ++iEta ) {
135 for (
int iPt = iPtStart ; iPt < iPtEnd ; ++iPt ) {
157 bool etaActive_ , ptActive_;
158 double etaMin_, etaMax_, ptMin_, ptMax_ ;
181 return EtaPtBin(etaActive_ , etaMin_ , etaMax_ ,
182 ptActive_ , ptMin_ , ptMax_ );
187 for (
unsigned int iJetLabel = 0; iJetLabel !=
binJetTagPlotters.size(); ++iJetLabel) {
189 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
196 for(vector<TagCorrelationPlotter*>::iterator iPlotter = iJetLabel->begin(); iPlotter != iJetLabel->end(); ++iPlotter)
199 for (
unsigned int iJetLabel = 0; iJetLabel !=
binTagInfoPlotters.size(); ++iJetLabel) {
201 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
221 corrector = corrHandle.
product();
227 for (
unsigned int iJetLabel = 0; iJetLabel !=
jetTagInputTags.size(); ++iJetLabel) {
244 tagI != tagColl.
end(); ++tagI) {
249 if(
doJEC && corrector) {
254 if (!
jetSelector(*(tagI->first), -1, infoHandle, jec))
257 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
258 bool inBin =
binJetTagPlotters[iJetLabel][iPlotter]->etaPtBin().inBin(*tagI->first, jec);
264 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
273 iEvent.
getByToken(inputTokens.first, tagHandle1);
277 iEvent.
getByToken(inputTokens.second, tagHandle2);
285 if(
doJEC && corrector) {
290 if (!
jetSelector(*(tagI->first), -1, infoHandle, jec))
293 for(
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
298 double discr2 = tagColl2[tagI->first];
306 for (
unsigned int iJetLabel = 0; iJetLabel !=
tiDataFormatType.size(); ++iJetLabel) {
308 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter)
312 if (inputTags.empty()) {
318 labels.push_back(
"label");
319 for (vector<string>::const_iterator iLabels = labels.begin();
320 iLabels != labels.end(); ++iLabels) {
323 inputTags.push_back(inputTag);
327 unsigned int nInputTags = inputTags.size();
328 vector< edm::Handle< View<BaseTagInfo> > > tagInfoHandles(nInputTags);
330 unsigned int nTagInfos = 0;
331 vector<edm::EDGetTokenT<edm::View<reco::BaseTagInfo>> > & tokens =
tagInfoToken[iJetLabel];
332 if(nInputTags!=tokens.size())
throw cms::Exception(
"Configuration") <<
"Different number of Tag Infos than expected" << endl;
333 for (
unsigned int iInputTags = 0; iInputTags < tokens.size(); ++iInputTags) {
335 iEvent.
getByToken(tokens[iInputTags], tagInfoHandle);
339 if (tagInfoHandle.
isValid() ==
false){
340 edm::LogWarning(
"BTagPerformanceAnalyzerOnData")<<
" Collection "<<inputTags[iInputTags]<<
" not present. Skipping it for this event.";
345 unsigned int size = tagInfoHandle->size();
346 LogDebug(
"Info") <<
"Found " << size <<
" B candidates in collection " << inputTags[iInputTags];
348 if (iInputTags == 0) {
349 jetProductID = thisProductID;
351 }
else if (jetProductID != thisProductID)
352 throw cms::Exception(
"Configuration") <<
"TagInfos are referencing a different jet collection." << endl;
353 else if (nTagInfos != size)
354 throw cms::Exception(
"Configuration") <<
"TagInfo collections are having a different size." << endl;
357 for (
unsigned int iTagInfos = 0; iTagInfos < nTagInfos; ++iTagInfos) {
358 vector<const BaseTagInfo*> baseTagInfos(nInputTags);
360 for (
unsigned int iTagInfo = 0; iTagInfo < nInputTags; iTagInfo++) {
361 const BaseTagInfo &baseTagInfo = (*tagInfoHandles[iTagInfo])[iTagInfos];
363 jetRef = baseTagInfo.
jet();
364 else if (baseTagInfo.
jet() != jetRef)
365 throw cms::Exception(
"Configuration") <<
"TagInfos pointing to different jets." << endl;
366 baseTagInfos[iTagInfo] = &baseTagInfo;
372 if(
doJEC && corrector) {
380 for (
int iPlotter = 0; iPlotter != plotterSize; ++iPlotter) {
T getParameter(std::string const &) const
BaseTagInfoPlotter * buildPlotter(const std::string &dataFormatType, const std::string &tagName, const EtaPtBin &etaPtBin, const edm::ParameterSet &pSet, const std::string &folderName, const unsigned int &mc, const bool &wf, DQMStore::IBooker &ibook)
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
const_iterator end() const
double correction(const LorentzVector &fJet) const
get correction using Jet information only
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
virtual std::vector< std::string > tagInfoRequirements() const
T const * product() const
volatile std::atomic< bool > shutdown_flag false
const_iterator begin() const
tuple size
Write out results.