CMS 3D CMS Logo

EventShapeVarsProducer.cc
Go to the documentation of this file.
1 
36 
37 #include <memory>
38 #include <vector>
39 
41 public:
44 
45 private:
47  double r_;
48  unsigned fwmax_;
49 
50  void beginJob() override {}
51  void produce(edm::Event&, const edm::EventSetup&) override;
52  void endJob() override {}
53 };
54 
56  srcToken_ = consumes<edm::View<reco::Candidate>>(cfg.getParameter<edm::InputTag>("src"));
57  r_ = cfg.exists("r") ? cfg.getParameter<double>("r") : 2.;
58  fwmax_ = cfg.exists("fwmax") ? cfg.getParameter<unsigned>("fwmax") : 0;
59 
60  produces<double>("thrust");
61  //produces<double>("oblateness");
62  produces<double>("isotropy");
63  produces<double>("circularity");
64  produces<double>("sphericity");
65  produces<double>("aplanarity");
66  produces<double>("C");
67  produces<double>("D");
68  if (fwmax_ > 0)
69  produces<std::vector<double>>("FWmoments");
70 }
71 
72 void put(edm::Event& evt, double value, const char* instanceName) {
73  evt.put(std::make_unique<double>(value), instanceName);
74 }
75 
79 
80  Thrust thrustAlgo(objects->begin(), objects->end());
81  put(evt, thrustAlgo.thrust(), "thrust");
82  //put(evt, thrustAlgo.oblateness(), "oblateness");
83 
84  EventShapeVariables eventShapeVarsAlgo(*objects);
85  eventShapeVarsAlgo.set_r(r_);
86  put(evt, eventShapeVarsAlgo.isotropy(), "isotropy");
87  put(evt, eventShapeVarsAlgo.circularity(), "circularity");
88  put(evt, eventShapeVarsAlgo.sphericity(), "sphericity");
89  put(evt, eventShapeVarsAlgo.aplanarity(), "aplanarity");
90  put(evt, eventShapeVarsAlgo.C(), "C");
91  put(evt, eventShapeVarsAlgo.D(), "D");
92  if (fwmax_ > 0) {
93  eventShapeVarsAlgo.setFWmax(fwmax_);
94  auto vfw = std::make_unique<std::vector<double>>(eventShapeVarsAlgo.getFWmoments());
95  evt.put(std::move(vfw), "FWmoments");
96  }
97 }
98 
100 
EventShapeVariables
Class for the calculation of several event shape variables.
Definition: EventShapeVariables.h:32
put
void put(edm::Event &evt, double value, const char *instanceName)
Definition: EventShapeVarsProducer.cc:72
EventShapeVarsProducer::fwmax_
unsigned fwmax_
Definition: EventShapeVarsProducer.cc:48
MessageLogger.h
EventShapeVarsProducer::endJob
void endJob() override
Definition: EventShapeVarsProducer.cc:52
EDProducer.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
objects
Definition: __init__.py:1
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EventShapeVarsProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EventShapeVarsProducer.cc:76
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
EventShapeVarsProducer
Definition: EventShapeVarsProducer.cc:40
Thrust.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
value
Definition: value.py:1
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup
Definition: EventSetup.h:58
EventShapeVarsProducer::r_
double r_
Definition: EventShapeVarsProducer.cc:47
hgcalPerformanceValidation.objects
objects
Definition: hgcalPerformanceValidation.py:791
EventShapeVariables.h
InputTag.h
looper.cfg
cfg
Definition: looper.py:296
EventShapeVarsProducer::EventShapeVarsProducer
EventShapeVarsProducer(const edm::ParameterSet &)
Definition: EventShapeVarsProducer.cc:55
eostools.move
def move(src, dest)
Definition: eostools.py:511
EventShapeVarsProducer::beginJob
void beginJob() override
Definition: EventShapeVarsProducer.cc:50
EventShapeVarsProducer::srcToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
Definition: EventShapeVarsProducer.cc:46
Thrust
Definition: Thrust.h:38
EventSetup.h
edm::EDProducer
Definition: EDProducer.h:35
ParameterSet.h
edm::Event
Definition: Event.h:73
MuonErrorMatrixAdjuster_cfi.instanceName
instanceName
Definition: MuonErrorMatrixAdjuster_cfi.py:16
EventShapeVarsProducer::~EventShapeVarsProducer
~EventShapeVarsProducer() override
Definition: EventShapeVarsProducer.cc:43
edm::InputTag
Definition: InputTag.h:15