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
SimpleSystematicsAnalyzer Class Reference
Inheritance diagram for SimpleSystematicsAnalyzer:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 
 SimpleSystematicsAnalyzer (const edm::ParameterSet &pset)
 
virtual ~SimpleSystematicsAnalyzer ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

unsigned int originalEvents_
 
unsigned int selectedEvents_
 
std::string selectorPath_
 
std::vector< double > weighted2SelectedEvents_
 
std::vector< double > weightedEvents_
 
std::vector< double > weightedSelectedEvents_
 
std::vector< edm::InputTagweightTags_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 5 of file SimpleSystematicsAnalyzer.cc.

Constructor & Destructor Documentation

SimpleSystematicsAnalyzer::SimpleSystematicsAnalyzer ( const edm::ParameterSet pset)

Definition at line 34 of file SimpleSystematicsAnalyzer.cc.

34  :
35  selectorPath_(pset.getUntrackedParameter<std::string> ("SelectorPath","")),
36  weightTags_(pset.getUntrackedParameter<std::vector<edm::InputTag> > ("WeightTags")) {
37 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< edm::InputTag > weightTags_
SimpleSystematicsAnalyzer::~SimpleSystematicsAnalyzer ( )
virtual

Definition at line 40 of file SimpleSystematicsAnalyzer.cc.

40 {}

Member Function Documentation

void SimpleSystematicsAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDFilter.

Definition at line 43 of file SimpleSystematicsAnalyzer.cc.

References i, originalEvents_, selectedEvents_, weighted2SelectedEvents_, weightedEvents_, weightedSelectedEvents_, and weightTags_.

43  {
44  originalEvents_ = 0;
45  selectedEvents_ = 0;
46  edm::LogVerbatim("SimpleSystematicsAnalysis") << "Uncertainties will be determined for the following tags: ";
47  for (unsigned int i=0; i<weightTags_.size(); ++i) {
48  edm::LogVerbatim("SimpleSystematicsAnalysis") << "\t" << weightTags_[i].encode();
49  weightedEvents_.push_back(0.);
50  weightedSelectedEvents_.push_back(0.);
51  weighted2SelectedEvents_.push_back(0.);
52  }
53 }
int i
Definition: DBlmapReader.cc:9
std::vector< double > weightedEvents_
std::vector< double > weighted2SelectedEvents_
std::vector< double > weightedSelectedEvents_
std::vector< edm::InputTag > weightTags_
void SimpleSystematicsAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDFilter.

Definition at line 56 of file SimpleSystematicsAnalyzer.cc.

References i, originalEvents_, selectedEvents_, mathSSE::sqrt(), weighted2SelectedEvents_, weightedEvents_, weightedSelectedEvents_, and weightTags_.

56  {
57  if (originalEvents_==0) {
58  edm::LogVerbatim("SimpleSystematicsAnalysis") << "NO EVENTS => NO RESULTS";
59  return;
60  }
61  if (selectedEvents_==0) {
62  edm::LogVerbatim("SimpleSystematicsAnalysis") << "NO SELECTED EVENTS => NO RESULTS";
63  return;
64  }
65 
66  edm::LogVerbatim("SimpleSystematicsAnalysis") << "\n>>>> Begin of Weight systematics summary >>>>";
67  edm::LogVerbatim("SimpleSystematicsAnalysis") << "Total number of analyzed data: " << originalEvents_ << " [events]";
68  double originalAcceptance = double(selectedEvents_)/originalEvents_;
69  edm::LogVerbatim("SimpleSystematicsAnalysis") << "Total number of selected data: " << selectedEvents_ << " [events], corresponding to acceptance: [" << originalAcceptance*100 << " +- " << 100*sqrt( originalAcceptance*(1.-originalAcceptance)/originalEvents_) << "] %";
70 
71  for (unsigned int i=0; i<weightTags_.size(); ++i) {
72  edm::LogVerbatim("SimpleSystematicsAnalysis") << "Results for Weight Tag: " << weightTags_[i].encode() << " ---->";
73 
74  double acc_central = 0.;
75  double acc2_central = 0.;
76  if (weightedEvents_[i]>0) {
77  acc_central = weightedSelectedEvents_[i]/weightedEvents_[i];
78  acc2_central = weighted2SelectedEvents_[i]/weightedEvents_[i];
79  }
80  double waverage = weightedEvents_[i]/originalEvents_;
81  edm::LogVerbatim("SimpleSystematicsAnalysis") << "\tTotal Events after reweighting: " << weightedEvents_[i] << " [events]";
82  edm::LogVerbatim("SimpleSystematicsAnalysis") << "\tEvents selected after reweighting: " << weightedSelectedEvents_[i] << " [events]";
83  edm::LogVerbatim("SimpleSystematicsAnalysis") << "\tAcceptance after reweighting: [" << acc_central*100 << " +- " <<
84  100*sqrt((acc2_central/waverage-acc_central*acc_central)/originalEvents_)
85  << "] %";
86  double xi = acc_central-originalAcceptance;
87  double deltaxi = (acc2_central-(originalAcceptance+2*xi+xi*xi))/originalEvents_;
88  if (deltaxi>0) deltaxi = sqrt(deltaxi); else deltaxi = 0.;
89  edm::LogVerbatim("SimpleSystematicsAnalysis") << "\ti.e. [" << std::setprecision(4) << 100*xi/originalAcceptance << " +- " << std::setprecision(4) << 100*deltaxi/originalAcceptance << "] % relative variation with respect to the original acceptance";
90 
91  }
92  edm::LogVerbatim("SimpleSystematicsAnalysis") << ">>>> End of Weight systematics summary >>>>";
93 
94 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< double > weightedEvents_
std::vector< double > weighted2SelectedEvents_
std::vector< double > weightedSelectedEvents_
std::vector< edm::InputTag > weightTags_
bool SimpleSystematicsAnalyzer::filter ( edm::Event ev,
const edm::EventSetup  
)
virtual

Implements edm::EDFilter.

Definition at line 97 of file SimpleSystematicsAnalyzer.cc.

References edm::Event::getByLabel(), i, originalEvents_, funct::pow(), selectedEvents_, selectorPath_, edm::TriggerNames::size(), edm::TriggerNames::triggerIndex(), edm::Event::triggerNames(), patRefSel_triggerSelection_cff::triggerResults, trigNames, weighted2SelectedEvents_, weightedEvents_, weightedSelectedEvents_, and weightTags_.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

97  {
99 
100  bool selectedEvent = false;
102  if (!ev.getByLabel(edm::InputTag("TriggerResults"), triggerResults)) {
103  edm::LogError("SimpleSystematicsAnalysis") << ">>> TRIGGER collection does not exist !!!";
104  return false;
105  }
106 
107  const edm::TriggerNames & trigNames = ev.triggerNames(*triggerResults);
108  unsigned int pathIndex = trigNames.triggerIndex(selectorPath_);
109  bool pathFound = (pathIndex<trigNames.size()); // pathIndex >= 0, since pathIndex is unsigned
110  if (pathFound) {
111  if (triggerResults->accept(pathIndex)) selectedEvent = true;
112  }
113  //edm::LogVerbatim("SimpleSystematicsAnalysis") << ">>>> Path Name: " << selectorPath_ << ", selected? " << selectedEvent;
114 
115  if (selectedEvent) selectedEvents_++;
116 
117  for (unsigned int i=0; i<weightTags_.size(); ++i) {
118  edm::Handle<double> weightHandle;
119  ev.getByLabel(weightTags_[i], weightHandle);
120  weightedEvents_[i] += (*weightHandle);
121  if (selectedEvent) {
122  weightedSelectedEvents_[i] += (*weightHandle);
123  weighted2SelectedEvents_[i] += pow((*weightHandle),2);
124  }
125  }
126 
127  return true;
128 }
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:199
Strings::size_type size() const
Definition: TriggerNames.cc:39
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
std::vector< double > weightedEvents_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:75
std::vector< double > weighted2SelectedEvents_
std::vector< double > weightedSelectedEvents_
std::vector< edm::InputTag > weightTags_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

unsigned int SimpleSystematicsAnalyzer::originalEvents_
private

Definition at line 15 of file SimpleSystematicsAnalyzer.cc.

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

unsigned int SimpleSystematicsAnalyzer::selectedEvents_
private

Definition at line 17 of file SimpleSystematicsAnalyzer.cc.

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

std::string SimpleSystematicsAnalyzer::selectorPath_
private

Definition at line 13 of file SimpleSystematicsAnalyzer.cc.

Referenced by filter().

std::vector<double> SimpleSystematicsAnalyzer::weighted2SelectedEvents_
private

Definition at line 19 of file SimpleSystematicsAnalyzer.cc.

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

std::vector<double> SimpleSystematicsAnalyzer::weightedEvents_
private

Definition at line 16 of file SimpleSystematicsAnalyzer.cc.

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

std::vector<double> SimpleSystematicsAnalyzer::weightedSelectedEvents_
private

Definition at line 18 of file SimpleSystematicsAnalyzer.cc.

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

std::vector<edm::InputTag> SimpleSystematicsAnalyzer::weightTags_
private

Definition at line 14 of file SimpleSystematicsAnalyzer.cc.

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