test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RecoTauDifferenceAnalyzer Class Reference
Inheritance diagram for RecoTauDifferenceAnalyzer:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void endJob () override
 
virtual bool filter (edm::Event &evt, const edm::EventSetup &es) override
 
 RecoTauDifferenceAnalyzer (const edm::ParameterSet &pset)
 
virtual ~RecoTauDifferenceAnalyzer ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

size_t allPassed1_
 
size_t allPassed2_
 
size_t differences_
 
edm::InputTag disc1_
 
edm::InputTag disc2_
 
size_t eventsExamined_
 
bool filter_
 
double maxDeltaR_
 
size_t passed1_
 
size_t passed2_
 
edm::InputTag src1_
 
edm::InputTag src2_
 
size_t tausExamined_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 10 of file RecoTauDifferenceAnalyzer.cc.

Constructor & Destructor Documentation

RecoTauDifferenceAnalyzer::RecoTauDifferenceAnalyzer ( const edm::ParameterSet pset)
explicit

Definition at line 32 of file RecoTauDifferenceAnalyzer.cc.

References allPassed1_, allPassed2_, differences_, disc1_, disc2_, eventsExamined_, edm::ParameterSet::exists(), filter_, edm::ParameterSet::getParameter(), passed1_, passed2_, src1_, src2_, and tausExamined_.

33  {
34  src1_ = pset.getParameter<edm::InputTag>("src1");
35  src2_ = pset.getParameter<edm::InputTag>("src2");
36  disc1_ = pset.getParameter<edm::InputTag>("disc1");
37  disc2_ = pset.getParameter<edm::InputTag>("disc2");
38  eventsExamined_ = 0;
39  tausExamined_ = 0;
40  differences_ = 0;
41  passed1_ = 0;
42  passed2_ = 0;
43  allPassed2_ = 0;
44  allPassed1_ = 0;
45  filter_ = pset.exists("filter") ? pset.getParameter<bool>("filter") : false;
46 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
virtual RecoTauDifferenceAnalyzer::~RecoTauDifferenceAnalyzer ( )
inlinevirtual

Definition at line 13 of file RecoTauDifferenceAnalyzer.cc.

13 {}

Member Function Documentation

void RecoTauDifferenceAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDFilter.

Definition at line 120 of file RecoTauDifferenceAnalyzer.cc.

References allPassed1_, allPassed2_, gather_cfg::cout, differences_, disc1_, disc2_, eventsExamined_, passed1_, passed2_, src1_, src2_, and tausExamined_.

120  {
121  std::cout << " RECO TAU DIFFERENCE SUMMARY: " << std::endl;
122  std::cout << " Examined " << tausExamined_ << " taus in "
123  << eventsExamined_ << " events." << std::endl;
124  std::cout << " There were " << differences_ << " differences." << std::endl;
125  std::cout << src1_ << "," << disc1_ << " had "
126  << allPassed1_ << " total passes and "
127  << passed1_ << " exclusive passes." << std::endl;
128  std::cout << src2_ << "," << disc2_ << " had "
129  << allPassed2_ << " total passes and "
130  << passed2_ << " exclusive passes." << std::endl;
131 }
tuple cout
Definition: gather_cfg.py:145
bool RecoTauDifferenceAnalyzer::filter ( edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDFilter.

Definition at line 58 of file RecoTauDifferenceAnalyzer.cc.

References allPassed1_, allPassed2_, deltar::bestMatch(), gather_cfg::cout, deltaR(), differences_, disc1_, disc2_, eventsExamined_, filter_, edm::Event::getByLabel(), edm::Ref< C, T, F >::isNull(), passed1_, passed2_, src1_, src2_, and tausExamined_.

59  {
61  // Get taus
63  evt.getByLabel(src1_, taus1);
65  evt.getByLabel(src2_, taus2);
66 
67  // Get discriminators
69  evt.getByLabel(disc1_, disc1);
71  evt.getByLabel(disc2_, disc2);
72 
73  bool differenceFound = false;
74  // Loop over first collection
75  for (size_t iTau1 = 0; iTau1 < taus1->size(); ++iTau1) {
76  tausExamined_++;
77  reco::PFTauRef tau1(taus1, iTau1);
78  // Find the best match in the other collection
80  double bestDeltaR = -1;
81  for (size_t iTau2 = 0; iTau2 < taus2->size(); ++iTau2) {
82  reco::PFTauRef tau2(taus2, iTau2);
83  reco::PFJetRef jet1 = getJetRef(*tau1);
84  reco::PFJetRef jet2 = getJetRef(*tau2);
85  double deltaRVal = deltaR(jet2->p4(), jet1->p4());
86  if (bestMatch.isNull() || deltaRVal < bestDeltaR) {
87  bestMatch = tau2;
88  bestDeltaR = deltaRVal;
89  }
90  }
91  // See what's up with the discriminators
92  bool result1 = ((*disc1)[tau1] > 0.5);
93  bool result2 = ((*disc2)[bestMatch] > 0.5);
94  allPassed1_ += result1;
95  allPassed2_ += result2;
96  if (result1 ^ result2) {
97  differenceFound = true;
98  passed1_ += result1;
99  passed2_ += result2;
100  differences_++;
101  std::cout << "********* RecoTau difference detected! *************"
102  << std::endl;
103  std::cout << " Tau1 InputTag: " << src1_ << " result: " << result1
104  << std::endl;
105  std::cout << " Tau2 InputTag: " << src2_ << " result: " << result2
106  << std::endl;
107  std::cout << "--------- Tau 1 -------------"
108  << std::endl;
109  std::cout << *tau1 << std::endl;
110  tau1->dump(std::cout);
111  std::cout << "--------- Tau 2 -------------"
112  << std::endl;
113  std::cout << *bestMatch << std::endl;
114  bestMatch->dump(std::cout);
115  }
116  }
117  return (filter_ ? differenceFound : true);
118 }
def bestMatch
Definition: deltar.py:139
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
bool isNull() const
Checks for null.
Definition: Ref.h:249
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

size_t RecoTauDifferenceAnalyzer::allPassed1_
private

Definition at line 27 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

size_t RecoTauDifferenceAnalyzer::allPassed2_
private

Definition at line 28 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

size_t RecoTauDifferenceAnalyzer::differences_
private

Definition at line 24 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

edm::InputTag RecoTauDifferenceAnalyzer::disc1_
private

Definition at line 19 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

edm::InputTag RecoTauDifferenceAnalyzer::disc2_
private

Definition at line 20 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

size_t RecoTauDifferenceAnalyzer::eventsExamined_
private

Definition at line 22 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

bool RecoTauDifferenceAnalyzer::filter_
private

Definition at line 29 of file RecoTauDifferenceAnalyzer.cc.

Referenced by filter(), and RecoTauDifferenceAnalyzer().

double RecoTauDifferenceAnalyzer::maxDeltaR_
private

Definition at line 21 of file RecoTauDifferenceAnalyzer.cc.

size_t RecoTauDifferenceAnalyzer::passed1_
private

Definition at line 25 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

size_t RecoTauDifferenceAnalyzer::passed2_
private

Definition at line 26 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

edm::InputTag RecoTauDifferenceAnalyzer::src1_
private

Definition at line 17 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

edm::InputTag RecoTauDifferenceAnalyzer::src2_
private

Definition at line 18 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().

size_t RecoTauDifferenceAnalyzer::tausExamined_
private

Definition at line 23 of file RecoTauDifferenceAnalyzer.cc.

Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().