39 moduleLabel_(iConfig.getParameter<std::string>(
"@module_label")),
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" ))
85 LogInfo(
"OutputInfo") <<
" TauVisible histograms will NOT be saved";
99 LogInfo(
"OutputInfo") <<
" TauVisiblehistograms will be saved to file:" <<
outPutFile_;
128 double matching_criteria = -1.0;
148 std::cerr <<
" Reference collection: " <<
refCollection_ <<
" not found while running TauTagValidation.cc " << std::endl;
168 pfTauProduct = thePFTauHandle.
product();
172 std::map<std::string, MonitorElement *>::const_iterator element =
plotMap_.end();
174 for (genCandidateCollection::const_iterator RefJet= ReferenceCollection->begin() ; RefJet != ReferenceCollection->end(); RefJet++ ){
185 thePFTauClosest = pfTauProduct->size();
189 if (
algo_->
deltaR(gen_particle, & pfTauProduct->at(iPFTau)) < delta){
190 delta =
algo_->
deltaR(gen_particle, & pfTauProduct->at(iPFTau));
191 thePFTauClosest = iPFTau;
196 if (thePFTauClosest == pfTauProduct->size())
continue;
198 double deltaR =
algo_->
deltaR(gen_particle, & pfTauProduct->at(thePFTauClosest));
201 if (deltaR > matching_criteria && matching_criteria != -1.0)
continue;
208 PFTauRef thePFTau(thePFTauHandle, thePFTauClosest);
214 if(thePFTau->pt() <
TauPtCut_ )
continue;
217 bool pass = selectReco( thePFTau );
218 if( !pass )
continue;
221 pass = selectGen( *gen_particle );
222 if( !pass )
continue;
228 string currentDiscriminatorLabel = it->getParameter<
string>(
"discriminator");
229 iEvent.
getByLabel(currentDiscriminatorLabel, currentDiscriminator);
231 if ((*currentDiscriminator)[thePFTau] >= it->getParameter<
double>(
"selectionCut")){
232 ptTauVisibleMap.find( currentDiscriminatorLabel )->second->Fill(RefJet->pt());
233 etaTauVisibleMap.find( currentDiscriminatorLabel )->second->Fill(RefJet->eta());
242 double tauPtRes = thePFTau->pt()/gen_particle->
pt();
243 plotMap_.find( currentDiscriminatorLabel +
"_pTRatio_allHadronic" )->second->Fill(tauPtRes);
249 element =
plotMap_.find( currentDiscriminatorLabel +
"_pTRatio_" + genTauDecayMode );
250 if( element !=
plotMap_.end() ) element->second->Fill(tauPtRes);
254 LogInfo(
"TauTagValidation") <<
" Failed to cast the MC candidate.";
258 std::string plotType =
"_Size_";
259 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFCands" );
260 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->signalPFCands().size() );
261 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFChargedHadrCands" );
262 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->signalPFChargedHadrCands().size() );
263 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFNeutrHadrCands" );
264 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->signalPFNeutrHadrCands().size() );
265 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFCands" );
266 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFCands().size() );
267 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFChargedHadrCands" );
268 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFChargedHadrCands().size() );
269 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFNeutrHadrCands" );
270 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFNeutrHadrCands().size() );
271 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFGammaCands" );
272 if( element !=
plotMap_.end() ) element->second->Fill( thePFTau->isolationPFGammaCands().size() );
274 plotType =
"_SumPt_";
275 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFCands" );
276 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->signalPFCands() ) );
277 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFChargedHadrCands" );
278 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->signalPFChargedHadrCands() ) );
279 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"signalPFNeutrHadrCands" );
280 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->signalPFNeutrHadrCands() ) );
281 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFCands" );
282 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFCands() ) );
283 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFChargedHadrCands" );
284 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFChargedHadrCands() ) );
285 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFNeutrHadrCands" );
286 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFNeutrHadrCands() ) );
287 element =
plotMap_.find( currentDiscriminatorLabel + plotType +
"isolationPFGammaCands" );
288 if( element !=
plotMap_.end() ) element->second->Fill(
getSumPt( thePFTau->isolationPFGammaCands() ) );
294 if ( currentDiscriminatorLabel.find(
"LeadingTrackPtCut") != string::npos){
302 else if ( currentDiscriminatorLabel.find(
"ByIsolation") != string::npos ){
337 ptTemp =
dbeTau_->
book1D(
"nRef_Taus_vs_ptTauVisible",
"nRef_Taus_vs_ptTauVisible", ptHinfo.
nbins, ptHinfo.
min, ptHinfo.
max);
338 etaTemp =
dbeTau_->
book1D(
"nRef_Taus_vs_etaTauVisible",
"nRef_Taus_vs_etaTauVisible", etaHinfo.
nbins, etaHinfo.
min, etaHinfo.
max );
339 phiTemp =
dbeTau_->
book1D(
"nRef_Taus_vs_phiTauVisible",
"nRef_Taus_vs_phiTauVisible", phiHinfo.
nbins, phiHinfo.
min, phiHinfo.
max);
340 pileupTemp =
dbeTau_->
book1D(
"nRef_Taus_vs_pileupTauVisible",
"nRef_Taus_vs_pileupTauVisible", pileupHinfo.
nbins, pileupHinfo.
min, pileupHinfo.
max);
365 string DiscriminatorLabel = it->getParameter<
string>(
"discriminator");
366 std::string histogramName;
371 ptTemp =
dbeTau_->
book1D(DiscriminatorLabel +
"_vs_ptTauVisible", histogramName +
"_vs_ptTauVisible", ptHinfo.
nbins, ptHinfo.
min, ptHinfo.
max);
372 etaTemp =
dbeTau_->
book1D(DiscriminatorLabel +
"_vs_etaTauVisible", histogramName +
"_vs_etaTauVisible", etaHinfo.
nbins, etaHinfo.
min, etaHinfo.
max );
373 phiTemp =
dbeTau_->
book1D(DiscriminatorLabel +
"_vs_phiTauVisible", histogramName +
"_vs_phiTauVisible", phiHinfo.
nbins, phiHinfo.
min, phiHinfo.
max);
374 pileupTemp =
dbeTau_->
book1D(DiscriminatorLabel +
"_vs_pileupTauVisible", histogramName +
"_vs_pileupTauVisible", pileupHinfo.
nbins, pileupHinfo.
min, pileupHinfo.
max);
389 std::string plotType =
"_pTRatio_";
390 std::string xaxisLabel =
";p_{T}^{reco}/p_{T}^{gen}";
391 std::string yaxislabel =
";Frequency";
392 std::string plotName = plotType +
"allHadronic";
394 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
395 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
396 plotName = plotType +
"oneProng0Pi0";
397 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
398 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
399 plotName = plotType +
"oneProng1Pi0";
400 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
401 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
402 plotName = plotType +
"oneProng2Pi0";
403 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
404 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
405 plotName = plotType +
"threeProng0Pi0";
406 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
407 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
408 plotName = plotType +
"threeProng1Pi0";
409 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 2.);
410 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
416 xaxisLabel =
";size";
417 yaxislabel =
";Frequency";
419 plotName = plotType +
"signalPFCands";
420 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
421 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
422 plotName = plotType +
"signalPFChargedHadrCands";
423 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
424 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
425 plotName = plotType +
"signalPFNeutrHadrCands";
426 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
427 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
429 plotName = plotType +
"isolationPFCands";
430 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
431 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
432 plotName = plotType +
"isolationPFChargedHadrCands";
434 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
435 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
436 plotName = plotType +
"isolationPFNeutrHadrCands";
437 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
438 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
439 plotName = plotType +
"isolationPFGammaCands";
440 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, -0.5, bins-0.5);
441 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
443 plotType =
"_SumPt_";
444 xaxisLabel =
";p_{T}^{sum}/ GeV";
445 yaxislabel =
";Frequency";
447 plotName = plotType +
"signalPFCands";
448 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
449 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
450 plotName = plotType +
"signalPFChargedHadrCands";
451 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
452 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
453 plotName = plotType +
"signalPFNeutrHadrCands";
454 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
455 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
456 plotName = plotType +
"isolationPFCands";
457 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 50.);
458 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
459 plotName = plotType +
"isolationPFChargedHadrCands";
460 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 10.);
461 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
462 plotName = plotType +
"isolationPFNeutrHadrCands";
463 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 30.);
464 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
465 plotName = plotType +
"isolationPFGammaCands";
466 tmpME =
dbeTau_->
book1D(DiscriminatorLabel + plotName, histogramName + plotName + xaxisLabel + yaxislabel, bins, 0., 20.);
467 plotMap_.insert( std::make_pair( DiscriminatorLabel + plotName, tmpME ) );
475 if ( DiscriminatorLabel.find(
"LeadingTrackPtCut") != string::npos){
487 if ( DiscriminatorLabel.find(
"ByIsolationLater") != string::npos ){
498 if ( DiscriminatorLabel.find(
"ByIsolation") != string::npos ){
541 sumPt += (*candidate)->pt();
547 std::string separatorString =
"DiscriminationBy";
549 if(separator==std::string::npos){
550 separatorString =
"Discrimination";
551 separator = discriminatorLabel.find(separatorString);
552 if(separator==std::string::npos){
558 std::string
prefix = discriminatorLabel.substr(0,separator);
559 std::string postfix = discriminatorLabel.substr(separator+separatorString.size());
563 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
double getSumPt(const reco::PFCandidateRefVector &candidates)
sum the transversal momentum of all candidates
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
MonitorElement * nPFJet_LeadingChargedHadron_NeutralHadronsIsolAnnulus_
double matchDeltaR_Leptons_
virtual double pt() const =0
transverse momentum
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::InputTag TauProducerInputTag_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
std::string refCollection_
const_iterator end() const
Termination of iteration.
const_iterator begin() const
Initialize an iterator over the RefVector.
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.
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
static double deltaR(const T *, const U *)
Jets made from MC generator particles.
MonitorElement * nIsolated_NoChargedHadrons_GammasSignal_
MonitorElement * nIsolated_NoChargedHadrons_GammasIsolAnnulus_
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::map< std::string, MonitorElement * > etaTauVisibleMap
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::string getReleaseVersion()
MonitorElement * nIsolated_NoChargedNoGammas_NeutralHadronsSignal_
MonitorElement * nIsolated_NoChargedNoGammas_NeutralHadronsIsolAnnulus_
MonitorElement * nIsolated_NoChargedHadrons_NeutralHadronsSignal_
std::string extensionName_
T const * product() const
MonitorElement * nIsolated_NoChargedHadrons_NeutralHadronsIsolAnnulus_
std::string moduleLabel_
label of the current module
edm::InputTag refCollectionInputTag_
virtual void endRun(edm::Run const &, edm::EventSetup const &)
bool stripDiscriminatorLabel(const std::string &discriminatorLabel, std::string &newLabel)
get rid of redundant parts to shorten the label
bool saveoutputhistograms_
edm::InputTag PrimaryVertexCollection_
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 setCurrentFolder(const std::string &fullpath)