Go to the documentation of this file.00001 #include "PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.h"
00002
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004
00005 #include "DataFormats/Common/interface/Handle.h"
00006 #include "DataFormats/Common/interface/View.h"
00007
00008 #include "PhysicsTools/CandUtils/interface/EventShapeVariables.h"
00009 #include "PhysicsTools/CandUtils/interface/Thrust.h"
00010
00011 EventShapeVarsProducer::EventShapeVarsProducer(const edm::ParameterSet& cfg)
00012 {
00013 src_ = cfg.getParameter<edm::InputTag>("src");
00014 r_ = cfg.exists("r") ? cfg.getParameter<double>("r") : 2.;
00015
00016 produces<double>("thrust");
00017
00018 produces<double>("isotropy");
00019 produces<double>("circularity");
00020 produces<double>("sphericity");
00021 produces<double>("aplanarity");
00022 produces<double>("C");
00023 produces<double>("D");
00024
00025 }
00026
00027 void put(edm::Event& evt, double value, const char* instanceName)
00028 {
00029 std::auto_ptr<double> eventShapeVarPtr(new double(value));
00030 evt.put(eventShapeVarPtr, instanceName);
00031 }
00032
00033 void EventShapeVarsProducer::produce(edm::Event& evt, const edm::EventSetup&)
00034 {
00035
00036
00037 edm::Handle<edm::View<reco::Candidate> > objects;
00038 evt.getByLabel(src_, objects);
00039
00040 Thrust thrustAlgo(objects->begin(), objects->end());
00041 put(evt, thrustAlgo.thrust(), "thrust");
00042
00043
00044 EventShapeVariables eventShapeVarsAlgo(*objects);
00045 put(evt, eventShapeVarsAlgo.isotropy(), "isotropy");
00046 put(evt, eventShapeVarsAlgo.circularity(), "circularity");
00047 put(evt, eventShapeVarsAlgo.sphericity(r_), "sphericity");
00048 put(evt, eventShapeVarsAlgo.aplanarity(r_), "aplanarity");
00049 put(evt, eventShapeVarsAlgo.C(r_), "C");
00050 put(evt, eventShapeVarsAlgo.D(r_), "D");
00051 }
00052
00053 #include "FWCore/Framework/interface/MakerMacros.h"
00054
00055 DEFINE_FWK_MODULE(EventShapeVarsProducer);