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 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
EventShapeVarsProducer(const edm::ParameterSet &)
Class for the calculation of several event shape variables.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void put(edm::Event &evt, double value, const char *instanceName)
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
Definition: value.py:1
Definition: Thrust.h:38
void produce(edm::Event &, const edm::EventSetup &) override
def move(src, dest)
Definition: eostools.py:511