41 dataType_( iConfig.getParameter<
string>(
"DataType") ),
43 matchDeltaR_Leptons_( iConfig.getParameter<double>(
"MatchDeltaR_Leptons")),
44 matchDeltaR_Jets_( iConfig.getParameter<double>(
"MatchDeltaR_Jets")),
45 TauPtCut_( iConfig.getParameter<double>(
"TauPtCut")),
47 recoCuts_( iConfig.getParameter<std::
string>(
"recoCuts" )),
48 genCuts_( iConfig.getParameter<std::
string>(
"genCuts" )),
50 saveoutputhistograms_( iConfig.getParameter<bool>(
"SaveOutputHistograms")),
52 refCollectionInputTag_( iConfig.getParameter<
InputTag>(
"RefCollection")),
54 extensionName_( iConfig.getParameter<
string>(
"ExtensionName")),
56 TauProducerInputTag_( iConfig.getParameter<
InputTag>(
"TauProducer")),
58 discriminators_( iConfig.getParameter< std::vector<edm::
ParameterSet> >(
"discriminators" ))
84 LogInfo(
"OutputInfo") <<
" TauVisible histograms will NOT be saved";
97 LogInfo(
"OutputInfo") <<
" TauVisiblehistograms will be saved to file:" <<
outPutFile_;
129 ptTemp = ibooker.
book1D(
"nRef_Taus_vs_ptTauVisible",
"nRef_Taus_vs_ptTauVisible", ptHinfo.
nbins, ptHinfo.
min, ptHinfo.
max);
130 etaTemp = ibooker.
book1D(
"nRef_Taus_vs_etaTauVisible",
"nRef_Taus_vs_etaTauVisible", etaHinfo.
nbins, etaHinfo.
min, etaHinfo.
max );
131 phiTemp = ibooker.
book1D(
"nRef_Taus_vs_phiTauVisible",
"nRef_Taus_vs_phiTauVisible", phiHinfo.
nbins, phiHinfo.
min, phiHinfo.
max);
132 pileupTemp = ibooker.
book1D(
"nRef_Taus_vs_pileupTauVisible",
"nRef_Taus_vs_pileupTauVisible", pileupHinfo.
nbins, pileupHinfo.
min, pileupHinfo.
max);
155 string DiscriminatorLabel = it->getParameter<
string>(
"discriminator");
161 ptTemp = ibooker.
book1D(DiscriminatorLabel +
"_vs_ptTauVisible", histogramName +
"_vs_ptTauVisible", ptHinfo.
nbins, ptHinfo.
min, ptHinfo.
max);
162 etaTemp = ibooker.
book1D(DiscriminatorLabel +
"_vs_etaTauVisible", histogramName +
"_vs_etaTauVisible", etaHinfo.
nbins, etaHinfo.
min, etaHinfo.
max );
163 phiTemp = ibooker.
book1D(DiscriminatorLabel +
"_vs_phiTauVisible", histogramName +
"_vs_phiTauVisible", phiHinfo.
nbins, phiHinfo.
min, phiHinfo.
max);
164 pileupTemp = ibooker.
book1D(DiscriminatorLabel +
"_vs_pileupTauVisible", histogramName +
"_vs_pileupTauVisible", pileupHinfo.
nbins, pileupHinfo.
min, pileupHinfo.
max);
174 std::string xaxisLabel =
";p_{T}^{reco}/p_{T}^{gen}";
178 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
179 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
180 plotName = plotType +
"oneProng0Pi0";
181 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
182 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
183 plotName = plotType +
"oneProng1Pi0";
184 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
185 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
186 plotName = plotType +
"oneProng2Pi0";
187 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
188 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
189 plotName = plotType +
"threeProng0Pi0";
190 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
191 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
192 plotName = plotType +
"threeProng1Pi0";
193 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
194 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
199 xaxisLabel =
";size";
200 yaxislabel =
";Frequency";
202 plotName = plotType +
"signalPFCands";
203 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
204 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
205 plotName = plotType +
"signalPFChargedHadrCands";
206 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
207 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
208 plotName = plotType +
"signalPFNeutrHadrCands";
209 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
210 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
212 plotName = plotType +
"isolationPFCands";
213 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
214 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
215 plotName = plotType +
"isolationPFChargedHadrCands";
217 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
218 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
219 plotName = plotType +
"isolationPFNeutrHadrCands";
220 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
221 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
222 plotName = plotType +
"isolationPFGammaCands";
223 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
224 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
226 plotType =
"_SumPt_";
227 xaxisLabel =
";p_{T}^{sum}/ GeV";
228 yaxislabel =
";Frequency";
230 plotName = plotType +
"signalPFCands";
231 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
232 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
233 plotName = plotType +
"signalPFChargedHadrCands";
234 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
235 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
236 plotName = plotType +
"signalPFNeutrHadrCands";
237 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
238 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
239 plotName = plotType +
"isolationPFCands";
240 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
241 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
242 plotName = plotType +
"isolationPFChargedHadrCands";
243 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 10.);
244 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
245 plotName = plotType +
"isolationPFNeutrHadrCands";
246 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 30.);
247 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
248 plotName = plotType +
"isolationPFGammaCands";
249 tmpME = ibooker.
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 20.);
250 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
254 if ( DiscriminatorLabel.find(
"LeadingTrackPtCut") != string::npos){
266 if ( DiscriminatorLabel.find(
"ByIsolationLater") != string::npos ){
277 if ( DiscriminatorLabel.find(
"ByIsolation") != string::npos ){
303 double matching_criteria = -1.0;
316 std::cerr <<
" Reference collection: " <<
refCollection_ <<
" not found while running TauTagValidation.cc " << std::endl;
336 pfTauProduct = thePFTauHandle.
product();
340 std::map<std::string, MonitorElement *>::const_iterator element =
plotMap_.end();
342 for (genCandidateCollection::const_iterator RefJet= ReferenceCollection->begin() ; RefJet != ReferenceCollection->end(); RefJet++ ){
353 thePFTauClosest = pfTauProduct->size();
357 if (
algo_->
deltaR(gen_particle, & pfTauProduct->at(iPFTau)) < delta){
358 delta =
algo_->
deltaR(gen_particle, & pfTauProduct->at(iPFTau));
359 thePFTauClosest = iPFTau;
364 if (thePFTauClosest == pfTauProduct->size())
continue;
366 double deltaR =
algo_->
deltaR(gen_particle, & pfTauProduct->at(thePFTauClosest));
369 if (deltaR > matching_criteria && matching_criteria != -1.0)
continue;
376 PFTauRef thePFTau(thePFTauHandle, thePFTauClosest);
381 if(thePFTau->pt() <
TauPtCut_ )
continue;
384 bool pass = selectReco( thePFTau );
385 if( !pass )
continue;
388 pass = selectGen( *gen_particle );
389 if( !pass )
continue;
394 string currentDiscriminatorLabel = it->getParameter<
string>(
"discriminator");
397 if ((*currentDiscriminator)[thePFTau] >= it->getParameter<
double>(
"selectionCut")){
398 ptTauVisibleMap.find( currentDiscriminatorLabel )->second->Fill(RefJet->pt());
399 etaTauVisibleMap.find( currentDiscriminatorLabel )->second->Fill(RefJet->eta());
404 double tauPtRes = thePFTau->pt()/gen_particle->
pt();
405 plotMap_.find( currentDiscriminatorLabel +
"_pTRatio_allHadronic" )->second->Fill(tauPtRes);
411 element =
plotMap_.find( currentDiscriminatorLabel +
"_pTRatio_" + genTauDecayMode );
412 if( element !=
plotMap_.end() ) element->second->Fill(tauPtRes);
414 LogInfo(
"TauTagValidation") <<
" Failed to cast the MC candidate.";
419 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFCands" );
420 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->signalPFCands().size() );
421 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFChargedHadrCands" );
422 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->signalPFChargedHadrCands().size() );
423 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFNeutrHadrCands" );
424 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->signalPFNeutrHadrCands().size() );
425 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFCands" );
426 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFCands().size() );
427 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFChargedHadrCands" );
428 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFChargedHadrCands().size() );
429 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFNeutrHadrCands" );
430 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFNeutrHadrCands().size() );
431 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFGammaCands" );
432 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFGammaCands().size() );
434 plotType =
"_SumPt_";
435 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFCands" );
436 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->signalPFCands() ) );
437 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFChargedHadrCands" );
438 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->signalPFChargedHadrCands() ) );
439 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFNeutrHadrCands" );
440 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->signalPFNeutrHadrCands() ) );
441 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFCands" );
442 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFCands() ) );
443 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFChargedHadrCands" );
444 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFChargedHadrCands() ) );
445 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFNeutrHadrCands" );
446 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFNeutrHadrCands() ) );
447 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFGammaCands" );
448 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFGammaCands() ) );
453 if ( currentDiscriminatorLabel.find(
"LeadingTrackPtCut") != string::npos){
461 else if ( currentDiscriminatorLabel.find(
"ByIsolation") != string::npos ){
481 sumPt += (*candidate)->pt();
489 if(separator==std::string::npos){
490 separatorString =
"Discrimination";
491 separator = discriminatorLabel.find(separatorString);
492 if(separator==std::string::npos){
497 std::string postfix = discriminatorLabel.substr(separator+separatorString.size());
498 newLabel = prefix+postfix;
std::map< std::string, MonitorElement * > ptTauVisibleMap
T getParameter(std::string const &) const
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
MonitorElement * nPFJet_LeadingChargedHadron_ChargedHadronsIsolAnnulus_
std::map< std::string, MonitorElement * > plotMap_
std::vector< PFTau > PFTauCollection
collection of PFTau objects
MonitorElement * nPFJet_LeadingChargedHadron_NeutralHadronsIsolAnnulus_
double matchDeltaR_Leptons_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual double pt() const =0
transverse momentum
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::PFTauCollection > tauProducerInputTagToken_
edm::InputTag TauProducerInputTag_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
std::string refCollection_
std::vector< edm::EDGetTokenT< reco::PFTauDiscriminator > > currentDiscriminatorToken_
MonitorElement * nPFJet_LeadingChargedHadron_GammasSignal_
std::vector< edm::ParameterSet > discriminators_
MonitorElement * nPFJet_LeadingChargedHadron_ChargedHadronsSignal_
GenericTriggerEventFlag * genericTriggerEventFlag_
generic access to dynamic trigger table
MonitorElement * nIsolated_NoChargedNoGammas_ChargedHadronsSignal_
std::string dataType_
What's the reference for the Validation Leptons or Jets.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static double deltaR(const T *, const U *)
double getSumPt(const std::vector< edm::Ptr< reco::PFCandidate > > &candidates)
sum the transversal momentum of all candidates
MonitorElement * book1D(Args &&...args)
Jets made from MC generator particles.
MonitorElement * nIsolated_NoChargedHadrons_GammasSignal_
MonitorElement * nIsolated_NoChargedHadrons_GammasIsolAnnulus_
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::map< std::string, MonitorElement * > etaTauVisibleMap
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::string getReleaseVersion()
MonitorElement * nIsolated_NoChargedNoGammas_NeutralHadronsSignal_
MonitorElement * nIsolated_NoChargedNoGammas_NeutralHadronsIsolAnnulus_
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * nIsolated_NoChargedHadrons_NeutralHadronsSignal_
edm::EDGetTokenT< edm::View< reco::Candidate > > refCollectionInputTagToken_
std::string extensionName_
MonitorElement * nIsolated_NoChargedHadrons_NeutralHadronsIsolAnnulus_
std::string moduleLabel_
label of the current module
edm::InputTag refCollectionInputTag_
bool stripDiscriminatorLabel(const std::string &discriminatorLabel, std::string &newLabel)
get rid of redundant parts to shorten the label
bool saveoutputhistograms_
edm::InputTag PrimaryVertexCollection_
void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * nIsolated_NoChargedHadrons_ChargedHadronsSignal_
std::map< std::string, MonitorElement * > phiTauVisibleMap
MonitorElement * nPFJet_LeadingChargedHadron_NeutralHadronsSignal_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
TauTagValidation(const edm::ParameterSet &)
edm::ParameterSet histoSettings_
MonitorElement * nPFJet_LeadingChargedHadron_GammasIsolAnnulus_
std::map< std::string, MonitorElement * > pileupTauVisibleMap
MonitorElement * nIsolated_NoChargedNoGammas_GammasSignal_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< reco::VertexCollection > primaryVertexCollectionToken_