Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:18

0001 /*
0002  * =====================================================================================
0003  *       Filename:  EvtPlaneFilter.cc
0004  *    Description:  Event plane Q2 filter
0005  *        Created:  05/11/15 14:37:29
0006  *         Author:  Quan Wang
0007  * =====================================================================================
0008  */
0009 
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011 #include "FWCore/Framework/interface/stream/EDFilter.h"
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/Utilities/interface/Exception.h"
0016 
0017 #include "RecoHI/HiEvtPlaneAlgos/interface/HiEvtPlaneList.h"
0018 #include "DataFormats/HeavyIonEvent/interface/EvtPlane.h"
0019 
0020 class EvtPlaneFilter : public edm::stream::EDFilter<> {
0021 public:
0022   explicit EvtPlaneFilter(const edm::ParameterSet&);
0023   ~EvtPlaneFilter() override;
0024 
0025 private:
0026   bool filter(edm::Event&, const edm::EventSetup&) override;
0027 
0028   const double vnlow_;
0029   const double vnhigh_;
0030   const int epidx_;
0031   const int eplvl_;
0032   edm::EDGetTokenT<reco::EvtPlaneCollection> tag_;
0033 };
0034 
0035 EvtPlaneFilter::EvtPlaneFilter(const edm::ParameterSet& ps)
0036     : vnlow_(ps.getParameter<double>("Vnlow")),
0037       vnhigh_(ps.getParameter<double>("Vnhigh")),
0038       epidx_(ps.getParameter<int>("EPidx")),
0039       eplvl_(ps.getParameter<int>("EPlvl")) {
0040   tag_ = consumes<reco::EvtPlaneCollection>(ps.getParameter<edm::InputTag>("EPlabel"));
0041   return;
0042 }
0043 
0044 EvtPlaneFilter::~EvtPlaneFilter() { return; }
0045 
0046 bool EvtPlaneFilter::filter(edm::Event& evt, const edm::EventSetup& es) {
0047   edm::Handle<reco::EvtPlaneCollection> ep_;
0048   evt.getByToken(tag_, ep_);
0049   double qn = (*ep_)[epidx_].vn(eplvl_);
0050   if (qn < vnlow_ || qn > vnhigh_)
0051     return false;
0052   return true;
0053 }
0054 
0055 DEFINE_FWK_MODULE(EvtPlaneFilter);