40 LogDebug(
"BTVHLTOfflineSource") <<
"constructor....";
47 triggerSummaryToken = consumes <trigger::TriggerEvent> (triggerSummaryLabel_);
48 triggerResultsToken = consumes <edm::TriggerResults> (triggerResultsLabel_);
49 triggerSummaryFUToken = consumes <trigger::TriggerEvent> (
edm::InputTag(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(),
std::string(
"FU")));
51 csvCaloTagsToken_ = consumes<reco::JetTagCollection> (
edm::InputTag(
"hltCombinedSecondaryVertexBJetTagsCalo"));
52 csvPfTagsToken_ = consumes<reco::JetTagCollection> (
edm::InputTag(
"hltCombinedSecondaryVertexBJetTagsPF"));
60 std::vector<edm::ParameterSet> paths = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"pathPairs");
61 for(
auto &
path : paths) {
62 custompathnamepairs_.push_back(make_pair(
73 if (!hltConfig_.init(run, c, processname_, changed)) {
74 LogDebug(
"BTVHLTOfflineSource") <<
"HLTConfigProvider failed to initialize.";
77 const unsigned int numberOfPaths(hltConfig_.size());
78 for(
unsigned int i=0;
i!=numberOfPaths; ++
i){
79 pathname_ = hltConfig_.triggerName(
i);
80 filtername_ =
"dummy";
81 unsigned int usedPrescale = 1;
82 unsigned int objectType = 0;
84 bool trigSelected =
false;
86 for (
auto & custompathnamepair : custompathnamepairs_){
87 if(pathname_.find(custompathnamepair.first)!=std::string::npos) { trigSelected =
true; triggerType = custompathnamepair.second;}
90 if (!trigSelected)
continue;
92 hltPathsAll_.push_back(
PathInfo(usedPrescale, pathname_,
"dummy", processname_, objectType, triggerType));
101 iEvent.
getByToken(triggerResultsToken, triggerResults_);
102 if(!triggerResults_.isValid()) {
103 iEvent.
getByToken(triggerResultsFUToken,triggerResults_);
104 if(!triggerResults_.isValid()) {
105 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerResults not found, " 113 iEvent.
getByToken(triggerSummaryToken,triggerObj_);
114 if(!triggerObj_.isValid()) {
115 iEvent.
getByToken(triggerSummaryFUToken,triggerObj_);
116 if(!triggerObj_.isValid()) {
117 edm::LogInfo(
"BTVHLTOfflineSource") <<
"TriggerEvent not found, " 123 iEvent.
getByToken(csvCaloTagsToken_, csvCaloTags);
124 iEvent.
getByToken(csvPfTagsToken_, csvPfTags);
129 iEvent.
getByToken(offlineCSVTokenPF_, offlineJetTagHandlerPF);
132 iEvent.
getByToken(offlineCSVTokenCalo_, offlineJetTagHandlerCalo);
135 iEvent.
getByToken(offlinePVToken_, offlineVertexHandler);
137 if(verbose_ && iEvent.
id().
event()%10000==0)
140 if(!triggerResults_.isValid())
return;
142 for(
auto &
v : hltPathsAll_){
143 unsigned index = triggerNames_.triggerIndex(
v.getPath());
144 if (index < triggerNames_.size() ){
146 if (csvPfTags.isValid() &&
v.getTriggerType() ==
"PF")
148 auto iter = csvPfTags->begin();
150 float CSV_online = iter->second;
151 if (CSV_online<0) CSV_online = -0.05;
153 v.getMEhisto_CSV()->Fill(CSV_online);
154 v.getMEhisto_Pt()->Fill(iter->first->pt());
155 v.getMEhisto_Eta()->Fill(iter->first->eta());
158 if(offlineJetTagHandlerPF.
isValid()){
159 for (
auto const & iterO : *offlineJetTagHandlerPF){
160 float CSV_offline = iterO.second;
161 if (CSV_offline<0) CSV_offline = -0.05;
162 DR =
reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi());
164 v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online);
continue;
169 iEvent.
getByToken(hltPFPVToken_, VertexHandler);
172 v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z());
173 if (offlineVertexHandler.
isValid())
v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z());
177 if (csvCaloTags.isValid() &&
v.getTriggerType() ==
"Calo" && !csvCaloTags->empty())
179 auto iter = csvCaloTags->begin();
181 float CSV_online = iter->second;
182 if (CSV_online<0) CSV_online = -0.05;
184 v.getMEhisto_CSV()->Fill(CSV_online);
185 v.getMEhisto_Pt()->Fill(iter->first->pt());
186 v.getMEhisto_Eta()->Fill(iter->first->eta());
189 if(offlineJetTagHandlerCalo.
isValid()){
190 for (
auto const & iterO : *offlineJetTagHandlerCalo)
192 float CSV_offline = iterO.second;
193 if (CSV_offline<0) CSV_offline = -0.05;
194 DR =
reco::deltaR(iterO.first->eta(),iterO.first->phi(),iter->first->eta(),iter->first->phi());
197 v.getMEhisto_CSV_RECOvsHLT()->Fill(CSV_offline,CSV_online);
continue;
202 iEvent.
getByToken(hltFastPVToken_, VertexHandler);
205 v.getMEhisto_PVz()->Fill(VertexHandler->begin()->z());
206 if (offlineVertexHandler.
isValid())
v.getMEhisto_fastPVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z());
209 iEvent.
getByToken(hltCaloPVToken_, VertexHandler);
212 v.getMEhisto_fastPVz()->Fill(VertexHandler->begin()->z());
213 if (offlineVertexHandler.
isValid())
v.getMEhisto_PVz_HLTMinusRECO()->Fill(VertexHandler->begin()->z()-offlineVertexHandler->begin()->z());
228 for(
auto &
v : hltPathsAll_){
231 std::string subdirName = dirname_ +
"/"+ trgPathName;
239 histoname = labelname+
"_CSV";
240 title = labelname+
"_CSV "+trigPath;
243 histoname = labelname+
"_Pt";
244 title = labelname+
"_Pt "+trigPath;
247 histoname = labelname+
"_Eta";
248 title = labelname+
"_Eta "+trigPath;
251 histoname =
"RECOvsHLT_CSV";
252 title =
"offline CSV vs online CSV "+trigPath;
253 MonitorElement * CSV_RECOvsHLT = iBooker.
book2D(histoname.c_str(),title.c_str(),110,-0.1,1,110,-0.1,1);
255 histoname = labelname+
"_PVz";
256 title =
"online z(PV) "+trigPath;
259 histoname = labelname+
"_fastPVz";
260 title =
"online z(fastPV) "+trigPath;
263 histoname =
"HLTMinusRECO_PVz";
264 title =
"online z(PV) - offline z(PV) "+trigPath;
265 MonitorElement * PVz_HLTMinusRECO = iBooker.
book1D(histoname.c_str(),title.c_str(),200,-0.5,0.5);
267 histoname =
"HLTMinusRECO_fastPVz";
268 title =
"online z(fastPV) - offline z(PV) "+trigPath;
269 MonitorElement * fastPVz_HLTMinusRECO = iBooker.
book1D(histoname.c_str(),title.c_str(),100,-2,2);
271 v.setHistos(CSV,Pt,Eta,CSV_RECOvsHLT,PVz,fastPVz,PVz_HLTMinusRECO,fastPVz_HLTMinusRECO);
void analyze(const edm::Event &, const edm::EventSetup &) override
BTVHLTOfflineSource(const edm::ParameterSet &)
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::LuminosityBlockNumber_t luminosityBlock() const
static const std::string removeVersion(const std::string &trigger)
MonitorElement * book1D(Args &&...args)
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
~BTVHLTOfflineSource() override
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
void dqmBeginRun(edm::Run const &run, edm::EventSetup const &c) override
void bookHistograms(DQMStore::IBooker &, edm::Run const &run, edm::EventSetup const &c) override
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override