CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Attributes
PFClusterTimeSelector Class Reference

#include <PFClusterTimeSelector.h>

Inheritance diagram for PFClusterTimeSelector:
edm::stream::EDProducer<>

Classes

struct  CutInfo
 

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 PFClusterTimeSelector (const edm::ParameterSet &)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PFClusterTimeSelector () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Protected Attributes

edm::EDGetTokenT< reco::PFClusterCollectionclusters_
 
std::vector< CutInfocutInfo_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 18 of file PFClusterTimeSelector.h.

Constructor & Destructor Documentation

PFClusterTimeSelector::PFClusterTimeSelector ( const edm::ParameterSet iConfig)
explicit

Definition at line 11 of file PFClusterTimeSelector.cc.

References TkAlMuonSelectors_cfi::cut, cutInfo_, L1TMuonDQMOffline_cfi::cuts, PFClusterTimeSelector::CutInfo::depth, PFClusterTimeSelector::CutInfo::endcap, edm::ParameterSet::getParameter(), info(), PFClusterTimeSelector::CutInfo::maxE, PFClusterTimeSelector::CutInfo::maxTime, PFClusterTimeSelector::CutInfo::minE, and PFClusterTimeSelector::CutInfo::minTime.

12  : clusters_(consumes<reco::PFClusterCollection>(iConfig.getParameter<edm::InputTag>("src"))) {
13  std::vector<edm::ParameterSet> cuts = iConfig.getParameter<std::vector<edm::ParameterSet> >("cuts");
14  for (const auto& cut : cuts) {
15  CutInfo info;
16  info.depth = cut.getParameter<double>("depth");
17  info.minE = cut.getParameter<double>("minEnergy");
18  info.maxE = cut.getParameter<double>("maxEnergy");
19  info.minTime = cut.getParameter<double>("minTime");
20  info.maxTime = cut.getParameter<double>("maxTime");
21  info.endcap = cut.getParameter<bool>("endcap");
22  cutInfo_.push_back(info);
23  }
24 
25  produces<reco::PFClusterCollection>();
26  produces<reco::PFClusterCollection>("OOT");
27 }
T getParameter(std::string const &) const
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< CutInfo > cutInfo_
edm::EDGetTokenT< reco::PFClusterCollection > clusters_
PFClusterTimeSelector::~PFClusterTimeSelector ( )
overridedefault

Referenced by produce().

Member Function Documentation

void PFClusterTimeSelector::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 66 of file PFClusterTimeSelector.cc.

66 {}
void PFClusterTimeSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 29 of file PFClusterTimeSelector.cc.

References bsc_activity_cfg::clusters, clusters_, cutInfo_, LEDCalibrationChannels::depth, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, HCALHighEnergyHPDFilter_cfi::energy, edm::Event::getByToken(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, info(), eostools::move(), MillePedeFileConverter_cfg::out, edm::Event::put(), ntuplemaker::time, and ~PFClusterTimeSelector().

29  {
31  iEvent.getByToken(clusters_, clusters);
32  auto out = std::make_unique<reco::PFClusterCollection>();
33  auto outOOT = std::make_unique<reco::PFClusterCollection>();
34 
35  for (const auto& cluster : *clusters) {
36  const double energy = cluster.energy();
37  const double time = cluster.time();
38  const double depth = cluster.depth();
39  const PFLayer::Layer layer = cluster.layer();
40  for (const auto& info : cutInfo_) {
41  if (energy < info.minE || energy > info.maxE)
42  continue;
43  if (depth < 0.9 * info.depth || depth > 1.1 * info.depth)
44  continue;
45  if ((info.endcap &&
46  (layer == PFLayer::ECAL_BARREL || layer == PFLayer::HCAL_BARREL1 || layer == PFLayer::HCAL_BARREL2)) ||
47  (((!info.endcap) && (layer == PFLayer::ECAL_ENDCAP || layer == PFLayer::HCAL_ENDCAP))))
48  continue;
49 
50  if (time > info.minTime && time < info.maxTime)
51  out->push_back(cluster);
52  else
53  outOOT->push_back(cluster);
54 
55  break;
56  }
57  }
58 
59  iEvent.put(std::move(out));
60  iEvent.put(std::move(outOOT), "OOT");
61 }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::vector< CutInfo > cutInfo_
Layer
layer definition
Definition: PFLayer.h:29
edm::EDGetTokenT< reco::PFClusterCollection > clusters_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<reco::PFClusterCollection> PFClusterTimeSelector::clusters_
protected

Definition at line 38 of file PFClusterTimeSelector.h.

Referenced by produce().

std::vector<CutInfo> PFClusterTimeSelector::cutInfo_
protected

Definition at line 39 of file PFClusterTimeSelector.h.

Referenced by PFClusterTimeSelector(), and produce().