CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
HLTCSCOverlapFilter Class Reference

#include <HLTCSCOverlapFilter.h>

Inheritance diagram for HLTCSCOverlapFilter:
HLTFilter edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTCSCOverlapFilter (const edm::ParameterSet &)
 
bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
 
 ~HLTCSCOverlapFilter () override
 
- Public Member Functions inherited from HLTFilter
 HLTFilter (const edm::ParameterSet &config)
 
int module (edm::Event const &) const
 
const std::string * moduleLabel () const
 
int path (edm::Event const &) const
 
const std::string * pathName (edm::Event const &) const
 
std::pair< int, int > pmid (edm::Event const &) const
 
bool saveTags () const
 
 ~HLTFilter () override
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from HLTFilter
static void makeHLTFilterDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::global::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< CSCRecHit2DCollectioncscrechitsToken
 
bool m_fillHists
 
edm::InputTag m_input
 
unsigned int m_minHits
 
TH1F * m_nhitsNoWindowCut
 
TH1F * m_pairsWithWindowCut
 
bool m_ring1
 
bool m_ring2
 
TH1F * m_xdiff
 
double m_xWindow
 
TH1F * m_ydiff
 
double m_yWindow
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file HLTCSCOverlapFilter.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file HLTCSCOverlapFilter.cc.

References cscrechitsToken, m_fillHists, m_input, m_nhitsNoWindowCut, m_pairsWithWindowCut, m_xdiff, m_ydiff, TFileService::make(), compare::tfile, and ~HLTCSCOverlapFilter().

16  : HLTFilter(iConfig)
17  , m_input(iConfig.getParameter<edm::InputTag>("input"))
18  , m_minHits(iConfig.getParameter<unsigned int>("minHits"))
19  , m_xWindow(iConfig.getParameter<double>("xWindow"))
20  , m_yWindow(iConfig.getParameter<double>("yWindow"))
21  , m_ring1(iConfig.getParameter<bool>("ring1"))
22  , m_ring2(iConfig.getParameter<bool>("ring2"))
23  , m_fillHists(iConfig.getParameter<bool>("fillHists"))
24  , m_nhitsNoWindowCut(nullptr)
25  , m_xdiff(nullptr)
26  , m_ydiff(nullptr)
27  , m_pairsWithWindowCut(nullptr)
28 {
29  cscrechitsToken = consumes<CSCRecHit2DCollection>(m_input);
30  if (m_fillHists) {
32  m_nhitsNoWindowCut = tfile->make<TH1F>("nhitsNoWindowCut", "nhitsNoWindowCut", 16, -0.5, 15.5);
33  m_xdiff = tfile->make<TH1F>("xdiff", "xdiff", 200, 0., 10.);
34  m_ydiff = tfile->make<TH1F>("ydiff", "ydiff", 200, 0., 10.);
35  m_pairsWithWindowCut = tfile->make<TH1F>("pairsWithWindowCut", "pairsWithWindowCut", 226, -0.5, 225.5);
36  }
37 }
T getParameter(std::string const &) const
edm::EDGetTokenT< CSCRecHit2DCollection > cscrechitsToken
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
Definition: tfile.py:1
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
HLTCSCOverlapFilter::~HLTCSCOverlapFilter ( )
overridedefault

Referenced by HLTCSCOverlapFilter().

Member Function Documentation

void HLTCSCOverlapFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 42 of file HLTCSCOverlapFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLTFilter::makeHLTFilterDescription().

42  {
45  desc.add<edm::InputTag>("input",edm::InputTag("hltCsc2DRecHits"));
46  desc.add<unsigned int>("minHits",4);
47  desc.add<double>("xWindow",1000.);
48  desc.add<double>("yWindow",1000.);
49  desc.add<bool>("ring1",true);
50  desc.add<bool>("ring2",false);
51  desc.add<bool>("fillHists",false);
52  descriptions.add("hltCSCOverlapFilter",desc);
53 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool HLTCSCOverlapFilter::hltFilter ( edm::Event iEvent,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overridevirtual

Implements HLTFilter.

Definition at line 55 of file HLTCSCOverlapFilter.cc.

References funct::abs(), relativeConstraints::chamber, CSCDetId::chamber(), cscrechitsToken, DEFINE_FWK_MODULE, CSCDetId::endcap(), makeMuonMisalignmentScenario::endcap, edm::EventSetup::get(), edm::Event::getByToken(), hfClusterShapes_cfi::hits, triggerObjects_cff::id, CSCGeometry::idToDet(), keep, m_fillHists, m_minHits, m_nhitsNoWindowCut, m_pairsWithWindowCut, m_ring1, m_ring2, m_xdiff, m_xWindow, m_ydiff, m_yWindow, genParticles_cff::map, GetRecoTauVFromDQM_MC_cff::next, DetId::rawId(), relativeConstraints::ring, CSCDetId::ring(), relativeConstraints::station, CSCDetId::station(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

55  {
57  iEvent.getByToken(cscrechitsToken, hits);
58 
59  edm::ESHandle<CSCGeometry> cscGeometry;
60  bool got_cscGeometry = false;
61 
62  std::map<int, std::vector<const CSCRecHit2D*> > chamber_tohit;
63 
64  for (auto const & hit : *hits) {
65  CSCDetId id(hit.geographicalId());
66  int chamber_id = CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0).rawId();
67 
68  if ((m_ring1 && (id.ring() == 1 || id.ring() == 4)) ||
69  (m_ring2 && id.ring() == 2)) {
70  std::map<int, std::vector<const CSCRecHit2D*> >::const_iterator chamber_iter = chamber_tohit.find(chamber_id);
71  if (chamber_iter == chamber_tohit.end()) {
72  std::vector<const CSCRecHit2D*> newlist;
73  newlist.push_back(&hit);
74  }
75  chamber_tohit[chamber_id].push_back(&hit);
76  } // end if this ring is selected
77  } // end loop over hits
78 
79  bool keep = false;
80  unsigned int minHitsSquared = m_minHits * m_minHits;
81  for (std::map<int, std::vector<const CSCRecHit2D*> >::const_iterator chamber_iter = chamber_tohit.begin();
82  chamber_iter != chamber_tohit.end();
83  ++chamber_iter) {
84 
85  if (m_fillHists) {
86  m_nhitsNoWindowCut->Fill(chamber_iter->second.size());
87  }
88 
89  if (chamber_iter->second.size() >= m_minHits) {
90  CSCDetId chamber_id(chamber_iter->first);
91  int chamber = chamber_id.chamber();
92  int next = chamber + 1;
93 
94  // Some rings have 36 chambers, others have 18. This will still be valid when ME4/2 is added.
95  if (next == 37 && (std::abs(chamber_id.station()) == 1 || chamber_id.ring() == 2)) next = 1;
96  if (next == 19 && (std::abs(chamber_id.station()) != 1 && chamber_id.ring() == 1)) next = 1;
97 
98  int next_id = CSCDetId(chamber_id.endcap(), chamber_id.station(), chamber_id.ring(), next, 0).rawId();
99 
100  std::map<int, std::vector<const CSCRecHit2D*> >::const_iterator chamber_next = chamber_tohit.find(next_id);
101  if (chamber_next != chamber_tohit.end() && chamber_next->second.size() >= m_minHits) {
102  if (!got_cscGeometry) {
103  iSetup.get<MuonGeometryRecord>().get(cscGeometry);
104  got_cscGeometry = true;
105  }
106 
107  unsigned int pairs_in_window = 0;
108  for (auto hit1 = chamber_iter->second.begin(); hit1 != chamber_iter->second.end(); ++hit1) {
109  for (auto hit2 : chamber_next->second) {
110  GlobalPoint pos1 = cscGeometry->idToDet((*hit1)->geographicalId())->surface().toGlobal((*hit1)->localPosition());
111  GlobalPoint pos2 = cscGeometry->idToDet(hit2->geographicalId())->surface().toGlobal(hit2->localPosition());
112 
113  if (m_fillHists) {
114  m_xdiff->Fill(pos1.x() - pos2.x());
115  m_ydiff->Fill(pos1.y() - pos2.y());
116  }
117 
118  if (fabs(pos1.x() - pos2.x()) < m_xWindow && fabs(pos1.y() - pos2.y()) < m_yWindow) pairs_in_window++;
119 
120  if (pairs_in_window >= minHitsSquared) {
121  keep = true;
122  if (!m_fillHists) return true;
123  }
124  } // end loop over hits in chamber 2
125  } // end loop over hits in chamber 1
126 
127  if (m_fillHists) {
128  m_pairsWithWindowCut->Fill(pairs_in_window);
129  }
130 
131  } // end if chamber 2 has enough hits
132  } // end if chamber 1 has enough hits
133  } // end loop over chambers
134 
135  return keep;
136 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const GeomDet * idToDet(DetId) const override
Definition: CSCGeometry.cc:114
edm::EDGetTokenT< CSCRecHit2DCollection > cscrechitsToken
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
T y() const
Definition: PV3DBase.h:63
const int keep
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T get() const
Definition: EventSetup.h:71
T x() const
Definition: PV3DBase.h:62

Member Data Documentation

edm::EDGetTokenT<CSCRecHit2DCollection> HLTCSCOverlapFilter::cscrechitsToken
private

Definition at line 26 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter(), and hltFilter().

bool HLTCSCOverlapFilter::m_fillHists
private

Definition at line 30 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter(), and hltFilter().

edm::InputTag HLTCSCOverlapFilter::m_input
private

Definition at line 25 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter().

unsigned int HLTCSCOverlapFilter::m_minHits
private

Definition at line 27 of file HLTCSCOverlapFilter.h.

Referenced by hltFilter().

TH1F* HLTCSCOverlapFilter::m_nhitsNoWindowCut
private

Definition at line 31 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter(), and hltFilter().

TH1F * HLTCSCOverlapFilter::m_pairsWithWindowCut
private

Definition at line 31 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter(), and hltFilter().

bool HLTCSCOverlapFilter::m_ring1
private

Definition at line 29 of file HLTCSCOverlapFilter.h.

Referenced by hltFilter().

bool HLTCSCOverlapFilter::m_ring2
private

Definition at line 29 of file HLTCSCOverlapFilter.h.

Referenced by hltFilter().

TH1F * HLTCSCOverlapFilter::m_xdiff
private

Definition at line 31 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter(), and hltFilter().

double HLTCSCOverlapFilter::m_xWindow
private

Definition at line 28 of file HLTCSCOverlapFilter.h.

Referenced by hltFilter().

TH1F * HLTCSCOverlapFilter::m_ydiff
private

Definition at line 31 of file HLTCSCOverlapFilter.h.

Referenced by HLTCSCOverlapFilter(), and hltFilter().

double HLTCSCOverlapFilter::m_yWindow
private

Definition at line 28 of file HLTCSCOverlapFilter.h.

Referenced by hltFilter().