CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
GEMEffByGEMCSCSegmentSource Class Reference

#include <GEMEffByGEMCSCSegmentSource.h>

Inheritance diagram for GEMEffByGEMCSCSegmentSource:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 GEMEffByGEMCSCSegmentSource (const edm::ParameterSet &)
 
 ~GEMEffByGEMCSCSegmentSource () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (edm::ParameterSet const &)
 

Private Types

using MEMap = std::map< GEMDetId, dqm::impl::MonitorElement * >
 

Private Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void analyzeME11GE11Segment (const GEMCSCSegment &)
 
void bookEfficiencyChamber (DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void bookMisc (DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
 
MonitorElementbookNumerator1D (DQMStore::IBooker &, MonitorElement *)
 
void checkCoincidenceGE11 (const GEMRecHit *, const GEMRecHit *, const GEMCSCSegment &)
 
template<typename T >
bool checkRefs (const std::vector< T * > &)
 
void fillME (dqm::impl::MonitorElement *, const double)
 
void fillME (MEMap &me_map, const GEMDetId &key, const double)
 
void fillMEWithinLimits (dqm::impl::MonitorElement *, const double)
 
void fillMEWithinLimits (MEMap &, const GEMDetId &, const double)
 
void findMatchedME11Segments (const reco::MuonCollection *)
 
GEMDetId getReStLaKey (const GEMDetId &)
 
bool hasMEKey (const MEMap &, const GEMDetId &)
 
bool isME11SegmentMatched (const CSCSegment &)
 

Private Attributes

const double kEps_ = std::numeric_limits<double>::epsilon()
 
const std::string kFolder_
 
const edm::EDGetTokenT
< GEMCSCSegmentCollection
kGEMCSCSegmentToken_
 
const edm::ESGetToken
< GEMGeometry,
MuonGeometryRecord
kGEMTokenBeginRun_
 
const std::string kLogCategory_
 
const uint32_t kMinCSCRecHits_
 
const edm::EDGetTokenT
< reco::MuonCollection
kMuonToken_
 
const bool kUseMuon_
 
std::vector< const CSCSegment * > matched_me11_segment_vector_
 
MEMap me_chamber_
 
MEMap me_chamber_matched_
 
MEMap me_csc_chamber_type_
 
MEMap me_csc_chamber_type_matched_
 
MEMap me_muon_chamber_
 
MEMap me_muon_chamber_matched_
 
MEMap me_num_csc_hits_
 
MEMap me_num_csc_hits_matched_
 
MEMap me_reduced_chi2_
 
MEMap me_reduced_chi2_matched_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

GEMEffByGEMCSCSegmentSource measures the efficiency of GE11-L1(2) using GE11-L2(1) and ME11 as trigger detectors. See https://github.com/cms-sw/cmssw/blob/CMSSW_12_3_0_pre5/RecoLocalMuon/GEMCSCSegment/plugins/GEMCSCSegAlgoRR.cc

Author
Seungjin Yang seung.nosp@m.jin..nosp@m.yang@.nosp@m.cern.nosp@m..ch

Definition at line 27 of file GEMEffByGEMCSCSegmentSource.h.

Member Typedef Documentation

Definition at line 35 of file GEMEffByGEMCSCSegmentSource.h.

Constructor & Destructor Documentation

GEMEffByGEMCSCSegmentSource::GEMEffByGEMCSCSegmentSource ( const edm::ParameterSet parameter_set)
explicit

Definition at line 6 of file GEMEffByGEMCSCSegmentSource.cc.

7  : kGEMTokenBeginRun_(esConsumes<edm::Transition::BeginRun>()),
9  consumes<GEMCSCSegmentCollection>(parameter_set.getParameter<edm::InputTag>("gemcscSegmentTag"))),
10  kMuonToken_(consumes<reco::MuonCollection>(parameter_set.getParameter<edm::InputTag>("muonTag"))),
11  kUseMuon_(parameter_set.getUntrackedParameter<bool>("useMuon")),
12  kMinCSCRecHits_(parameter_set.getUntrackedParameter<uint32_t>("minCSCRecHits")),
13  kFolder_(parameter_set.getUntrackedParameter<std::string>("folder")),
14  kLogCategory_(parameter_set.getUntrackedParameter<std::string>("logCategory")) {}
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::MuonCollection > kMuonToken_
const edm::EDGetTokenT< GEMCSCSegmentCollection > kGEMCSCSegmentToken_
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > kGEMTokenBeginRun_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
GEMEffByGEMCSCSegmentSource::~GEMEffByGEMCSCSegmentSource ( )
override

Definition at line 16 of file GEMEffByGEMCSCSegmentSource.cc.

16 {}

Member Function Documentation

void GEMEffByGEMCSCSegmentSource::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overrideprivatevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 152 of file GEMEffByGEMCSCSegmentSource.cc.

References analyzeME11GE11Segment(), GEMCSCSegment::cscDetId(), findMatchedME11Segments(), edm::Event::getHandle(), patZpeak::handle, CSCDetId::isME11(), kGEMCSCSegmentToken_, kLogCategory_, kMuonToken_, kUseMuon_, and LogDebug.

152  {
154  // get data from Event & EventSetup
155  const GEMCSCSegmentCollection* gemcsc_segment_collection = nullptr;
157  gemcsc_segment_collection = handle.product();
158 
159  } else {
160  edm::LogError(kLogCategory_) << "invalid GEMCSCSegmentCollection";
161  return;
162  }
163 
164  const reco::MuonCollection* muon_collection = nullptr;
165  if (kUseMuon_) {
167  muon_collection = handle.product();
168 
169  } else {
170  edm::LogError(kLogCategory_) << "invalid reco::MuonCollection";
171  return;
172  }
173  }
174 
176  // quick check
177  if (gemcsc_segment_collection->size() < 1) {
178  LogDebug(kLogCategory_) << "empty GEMCSCSegment";
179  return;
180  }
181 
183  //
184  if (kUseMuon_) {
185  findMatchedME11Segments(muon_collection);
186  }
187 
189  // main loop
190  for (edm::OwnVector<GEMCSCSegment>::const_iterator iter = gemcsc_segment_collection->begin();
191  iter != gemcsc_segment_collection->end();
192  iter++) {
193  const GEMCSCSegment& gemcsc_segment = *iter;
194 
195  const CSCDetId csc_id = gemcsc_segment.cscDetId();
196  if (csc_id.isME11()) {
197  analyzeME11GE11Segment(gemcsc_segment);
198 
199  } else {
200  LogDebug(kLogCategory_) << "skip " << csc_id;
201  continue;
202  }
203  } // GEMCSCSegment
204 }
const edm::EDGetTokenT< reco::MuonCollection > kMuonToken_
const edm::EDGetTokenT< GEMCSCSegmentCollection > kGEMCSCSegmentToken_
CSCDetId cscDetId() const
Definition: GEMCSCSegment.h:73
Log< level::Error, false > LogError
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
void findMatchedME11Segments(const reco::MuonCollection *)
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
bool isME11() const
Definition: CSCDetId.cc:64
void analyzeME11GE11Segment(const GEMCSCSegment &)
tuple handle
Definition: patZpeak.py:23
#define LogDebug(id)
void GEMEffByGEMCSCSegmentSource::analyzeME11GE11Segment ( const GEMCSCSegment gemcsc_segment)
private

Definition at line 206 of file GEMEffByGEMCSCSegmentSource.cc.

References checkCoincidenceGE11(), GEMCSCSegment::cscDetId(), GEMCSCSegment::gemRecHits(), GEMDetId::isGE11(), kLogCategory_, phase1PixelTopology::layer, and GEMDetId::layer().

Referenced by analyze().

206  {
207  const GEMRecHit* ge11_hit_layer1 = nullptr;
208  const GEMRecHit* ge11_hit_layer2 = nullptr;
209 
210  const CSCDetId csc_id = gemcsc_segment.cscDetId();
211  for (const GEMRecHit& gem_hit : gemcsc_segment.gemRecHits()) {
212  const GEMDetId gem_id = gem_hit.gemId();
213 
214  if (not gem_id.isGE11()) {
215  edm::LogWarning(kLogCategory_) << "CSCSegment is in " << csc_id << " but GEMRecHit is in " << gem_id
216  << ". skip this GEMCSCSegment."
217  << "check if RecoLocalMuon/GEMCSCSegment/plugins/GEMCSCSegAlgoRR.cc has changed.";
218  return;
219  }
220 
221  const int layer = gem_id.layer();
222  if (layer == 1) {
223  ge11_hit_layer1 = &gem_hit;
224 
225  } else if (layer == 2) {
226  ge11_hit_layer2 = &gem_hit;
227 
228  } else {
229  edm::LogError(kLogCategory_) << "isGE11 but got unexpected layer " << gem_id << ". skip this GEMCSCSegment.";
230  return;
231  }
232  } // GEMRecHit
233 
234  checkCoincidenceGE11(ge11_hit_layer1, ge11_hit_layer2, gemcsc_segment);
235  checkCoincidenceGE11(ge11_hit_layer2, ge11_hit_layer1, gemcsc_segment);
236 }
void checkCoincidenceGE11(const GEMRecHit *, const GEMRecHit *, const GEMCSCSegment &)
CSCDetId cscDetId() const
Definition: GEMCSCSegment.h:73
Log< level::Error, false > LogError
const std::vector< GEMRecHit > & gemRecHits() const
Definition: GEMCSCSegment.h:68
constexpr std::array< uint8_t, layerIndexSize > layer
bool isGE11() const
Definition: GEMDetId.cc:9
constexpr int layer() const
Definition: GEMDetId.h:190
Log< level::Warning, false > LogWarning
void GEMEffByGEMCSCSegmentSource::bookEfficiencyChamber ( DQMStore::IBooker ibooker,
const edm::ESHandle< GEMGeometry > &  gem 
)
private

Definition at line 42 of file GEMEffByGEMCSCSegmentSource.cc.

References dqm::implementation::IBooker::book1D(), bookNumerator1D(), checkRefs(), getReStLaKey(), GEMUtils::getSuffixName(), GEMUtils::getSuffixTitle(), submitPVResolutionJobs::key, kFolder_, kLogCategory_, kUseMuon_, LogDebug, me_chamber_, me_chamber_matched_, me_muon_chamber_, me_muon_chamber_matched_, dqm::impl::MonitorElement::setAxisTitle(), dqm::implementation::NavigatorBase::setCurrentFolder(), and relativeConstraints::station.

Referenced by bookHistograms().

43  {
44  ibooker.setCurrentFolder(kFolder_ + "/Efficiency");
45 
46  for (const GEMStation* station : gem->stations()) {
47  const int region_id = station->region();
48  const int station_id = station->station();
49 
50  if (station_id == 1) {
51  // GE11
52  const std::vector<const GEMSuperChamber*> superchambers = station->superChambers();
53  if (not checkRefs(superchambers)) {
54  edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs";
55  return;
56  }
57 
58  const int num_chambers = superchambers.size();
59  for (const GEMChamber* chamber : superchambers.at(0)->chambers()) {
60  const int layer_id = chamber->id().layer();
61 
62  const TString name_suffix = GEMUtils::getSuffixName(region_id, station_id, layer_id);
63  const TString title_suffix = GEMUtils::getSuffixTitle(region_id, station_id, layer_id);
64  const GEMDetId key = getReStLaKey(chamber->id());
65 
66  me_chamber_[key] = ibooker.book1D("chamber" + name_suffix, title_suffix, num_chambers, 0.5, num_chambers + 0.5);
67  me_chamber_[key]->setAxisTitle("Chamber", 1);
68  for (int binx = 1; binx <= num_chambers; binx++) {
69  me_chamber_[key]->setBinLabel(binx, std::to_string(binx), 1);
70  }
71  me_chamber_matched_[key] = bookNumerator1D(ibooker, me_chamber_[key]);
72 
73  if (kUseMuon_) {
75  ibooker.book1D("muon_chamber" + name_suffix, title_suffix, num_chambers, 0.5, num_chambers + 0.5);
76  me_muon_chamber_[key]->setAxisTitle("Chamber", 1);
77  for (int binx = 1; binx <= num_chambers; binx++) {
78  me_muon_chamber_[key]->setBinLabel(binx, std::to_string(binx), 1);
79  }
81  }
82  } // layer
83 
84  } else {
85  LogDebug(kLogCategory_) << "skip " << station->getName();
86  continue;
87  }
88  } // station
89 }
GEMDetId getReStLaKey(const GEMDetId &)
TString getSuffixName(Int_t region_id)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * bookNumerator1D(DQMStore::IBooker &, MonitorElement *)
Log< level::Error, false > LogError
TString getSuffixTitle(Int_t region_id)
tuple key
prepare the HTCondor submission files and eventually submit them
bool checkRefs(const std::vector< T * > &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
#define LogDebug(id)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void GEMEffByGEMCSCSegmentSource::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 29 of file GEMEffByGEMCSCSegmentSource.cc.

References bookEfficiencyChamber(), bookMisc(), edm::EventSetup::getHandle(), edm::ESHandleBase::isValid(), kGEMTokenBeginRun_, and kLogCategory_.

31  {
32  const edm::ESHandle<GEMGeometry>& gem = setup.getHandle(kGEMTokenBeginRun_);
33  if (not gem.isValid()) {
34  edm::LogError(kLogCategory_) << "invalid GEMGeometry";
35  return;
36  }
37 
38  bookEfficiencyChamber(ibooker, gem);
39  bookMisc(ibooker, gem);
40 }
Log< level::Error, false > LogError
const edm::ESGetToken< GEMGeometry, MuonGeometryRecord > kGEMTokenBeginRun_
void bookMisc(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
void bookEfficiencyChamber(DQMStore::IBooker &, const edm::ESHandle< GEMGeometry > &)
bool isValid() const
Definition: ESHandle.h:44
void GEMEffByGEMCSCSegmentSource::bookMisc ( DQMStore::IBooker ibooker,
const edm::ESHandle< GEMGeometry > &  gem 
)
private

Definition at line 91 of file GEMEffByGEMCSCSegmentSource.cc.

References dqm::implementation::IBooker::book1D(), bookNumerator1D(), CSCDetId::chamberName(), checkRefs(), getReStLaKey(), GEMUtils::getSuffixName(), GEMUtils::getSuffixTitle(), submitPVResolutionJobs::key, kFolder_, kLogCategory_, label, LogDebug, me_csc_chamber_type_, me_csc_chamber_type_matched_, me_num_csc_hits_, me_num_csc_hits_matched_, me_reduced_chi2_, me_reduced_chi2_matched_, dqm::impl::MonitorElement::setAxisTitle(), dqm::implementation::NavigatorBase::setCurrentFolder(), relativeConstraints::station, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookHistograms().

91  {
92  ibooker.setCurrentFolder(kFolder_ + "/Misc");
93 
94  for (const GEMStation* station : gem->stations()) {
95  const int region_id = station->region();
96  const int station_id = station->station();
97 
98  if (station_id == 1) {
99  // GE11
100  const std::vector<const GEMSuperChamber*> superchambers = station->superChambers();
101  if (not checkRefs(superchambers)) {
102  edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs";
103  return;
104  }
105 
106  for (const GEMChamber* chamber : superchambers.at(0)->chambers()) {
107  const int layer_id = chamber->id().layer();
108 
109  const TString name_suffix = GEMUtils::getSuffixName(region_id, station_id, layer_id);
110  const TString title_suffix = GEMUtils::getSuffixTitle(region_id, station_id, layer_id);
111  const GEMDetId key = getReStLaKey(chamber->id());
112 
113  // num_csc_hits
114  me_num_csc_hits_[key] = ibooker.book1D("num_csc_hits" + name_suffix, title_suffix, 4, 2.5, 6.5);
115  me_num_csc_hits_[key]->setAxisTitle("Number of CSCRecHits", 1);
116 
117  me_num_csc_hits_matched_[key] = bookNumerator1D(ibooker, me_num_csc_hits_[key]);
118 
119  // reduced_chi2
120  me_reduced_chi2_[key] = ibooker.book1D("reduced_chi2" + name_suffix, title_suffix, 30, 0, 3);
121  me_reduced_chi2_[key]->setAxisTitle("#chi^{2} / dof", 1);
122 
124 
125  // CSC chamber type
126  // https://github.com/cms-sw/cmssw/blob/CMSSW_12_3_0_pre5/DataFormats/MuonDetId/interface/CSCDetId.h#L187-L193
127  me_csc_chamber_type_[key] = ibooker.book1D("csc_chamber_type" + name_suffix, title_suffix, 10, 0.5, 10.5);
128  me_csc_chamber_type_[key]->setAxisTitle("CSC chamber type", 1);
129  for (int chamber_type = 1; chamber_type <= 10; chamber_type++) {
130  const std::string label = CSCDetId::chamberName(chamber_type);
131  me_csc_chamber_type_[key]->setBinLabel(chamber_type, label, 1);
132  }
133 
135 
136  } // layer
137 
138  } else {
139  LogDebug(kLogCategory_) << "skip " << station->getName();
140  continue;
141  }
142  } // region-station
143 }
GEMDetId getReStLaKey(const GEMDetId &)
TString getSuffixName(Int_t region_id)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * bookNumerator1D(DQMStore::IBooker &, MonitorElement *)
Log< level::Error, false > LogError
TString getSuffixTitle(Int_t region_id)
char const * label
tuple key
prepare the HTCondor submission files and eventually submit them
bool checkRefs(const std::vector< T * > &)
std::string chamberName() const
Definition: CSCDetId.cc:92
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
#define LogDebug(id)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
dqm::impl::MonitorElement * GEMEffByGEMCSCSegmentSource::bookNumerator1D ( DQMStore::IBooker ibooker,
MonitorElement me 
)
private

Definition at line 145 of file GEMEffByGEMCSCSegmentSource.cc.

References dqm::implementation::IBooker::book1D(), dqm::impl::MonitorElement::getName(), dqm::impl::MonitorElement::getTH1F(), gpuVertexFinder::hist, mergeVDriftHistosByStation::name, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookEfficiencyChamber(), and bookMisc().

146  {
147  const std::string name = me->getName() + "_matched";
148  TH1F* hist = dynamic_cast<TH1F*>(me->getTH1F()->Clone(name.c_str()));
149  return ibooker.book1D(name, hist);
150 }
virtual TH1F * getTH1F() const
const std::string & getName() const
get name of ME
__shared__ Hist hist
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void GEMEffByGEMCSCSegmentSource::checkCoincidenceGE11 ( const GEMRecHit trigger_layer_hit,
const GEMRecHit detection_layer_hit,
const GEMCSCSegment gemcsc_segment 
)
private

Definition at line 238 of file GEMEffByGEMCSCSegmentSource.cc.

References GEMDetId::chamber(), GEMCSCSegment::chi2(), GEMCSCSegment::cscDetId(), GEMCSCSegment::cscRecHits(), GEMCSCSegment::cscSegment(), GEMCSCSegment::degreesOfFreedom(), fillME(), fillMEWithinLimits(), GEMRecHit::gemId(), CSCDetId::iChamberType(), isME11SegmentMatched(), submitPVResolutionJobs::key, kLogCategory_, kMinCSCRecHits_, kUseMuon_, GEMDetId::layer(), LogDebug, me_chamber_, me_chamber_matched_, me_csc_chamber_type_, me_csc_chamber_type_matched_, me_muon_chamber_, me_muon_chamber_matched_, me_num_csc_hits_, me_num_csc_hits_matched_, me_reduced_chi2_, me_reduced_chi2_matched_, GEMDetId::region(), and GEMDetId::station().

Referenced by analyzeME11GE11Segment().

240  {
241  if (trigger_layer_hit == nullptr) {
242  LogDebug(kLogCategory_) << "trigger_layer_hit is nullptr";
243  return;
244  }
245 
246  const GEMDetId trigger_layer_id = trigger_layer_hit->gemId();
247  const int detection_layer = trigger_layer_id.layer() == 1 ? 2 : 1;
248  // detection layer key
249  // GEMDetId(int region, int ring, int station, int layer, int chamber, int ieta)
250  const GEMDetId key{trigger_layer_id.region(), 1, trigger_layer_id.station(), detection_layer, 0, 0};
251 
252  const int chamber = trigger_layer_id.chamber();
253  const bool is_matched = kUseMuon_ ? isME11SegmentMatched(gemcsc_segment.cscSegment()) : false;
254 
255  const int num_csc_hits = gemcsc_segment.cscRecHits().size();
256  const double reduced_chi2 = gemcsc_segment.chi2() / gemcsc_segment.degreesOfFreedom();
257  const int csc_chamber_type = gemcsc_segment.cscDetId().iChamberType();
258 
259  // TODO add a method
260  const bool is_good = gemcsc_segment.cscRecHits().size() >= kMinCSCRecHits_;
261 
262  fillME(me_num_csc_hits_, key, num_csc_hits);
263  fillMEWithinLimits(me_reduced_chi2_, key, reduced_chi2);
264  fillME(me_csc_chamber_type_, key, csc_chamber_type);
265  if (detection_layer_hit) {
266  fillME(me_num_csc_hits_matched_, key, num_csc_hits);
268  fillME(me_csc_chamber_type_matched_, key, csc_chamber_type);
269  }
270 
271  if (is_good) {
272  // twofold coincidence rate
273  fillME(me_chamber_, key, chamber);
274  if (is_matched) {
275  fillME(me_muon_chamber_, key, chamber);
276  }
277 
278  // threefold coincidence rate
279  if (detection_layer_hit) {
280  fillME(me_chamber_matched_, key, chamber);
281  if (is_matched) {
283  }
284  }
285  }
286 }
void fillME(dqm::impl::MonitorElement *, const double)
CSCDetId cscDetId() const
Definition: GEMCSCSegment.h:73
int degreesOfFreedom() const override
Degrees of freedom of the segment fit.
Definition: GEMCSCSegment.h:62
double chi2() const override
Chi2 of the segment fit.
Definition: GEMCSCSegment.h:58
constexpr int region() const
Definition: GEMDetId.h:171
tuple key
prepare the HTCondor submission files and eventually submit them
unsigned short iChamberType() const
Definition: CSCDetId.h:96
const std::vector< CSCRecHit2D > & cscRecHits() const
Definition: GEMCSCSegment.h:69
constexpr int chamber() const
Definition: GEMDetId.h:183
constexpr int layer() const
Definition: GEMDetId.h:190
constexpr int station() const
Definition: GEMDetId.h:179
bool isME11SegmentMatched(const CSCSegment &)
GEMDetId gemId() const
Return the gemId.
Definition: GEMRecHit.h:65
const CSCSegment cscSegment() const
Definition: GEMCSCSegment.h:67
void fillMEWithinLimits(dqm::impl::MonitorElement *, const double)
#define LogDebug(id)
template<typename T >
bool GEMEffByGEMCSCSegmentSource::checkRefs ( const std::vector< T * > &  refs)
inlineprivate

Definition at line 86 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookEfficiencyChamber(), and bookMisc().

86  {
87  if (refs.empty())
88  return false;
89  if (refs.front() == nullptr)
90  return false;
91  return true;
92 }
void GEMEffByGEMCSCSegmentSource::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 18 of file GEMEffByGEMCSCSegmentSource.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

18  {
20  desc.add<edm::InputTag>("gemcscSegmentTag", edm::InputTag("gemcscSegments"));
21  desc.add<edm::InputTag>("muonTag", edm::InputTag("muons"));
22  desc.addUntracked<bool>("useMuon", false);
23  desc.addUntracked<uint32_t>("minCSCRecHits", 6u);
24  desc.addUntracked<std::string>("folder", "GEM/Efficiency/GEMCSCSegment");
25  desc.addUntracked<std::string>("logCategory", "GEMEffByGEMCSCSegmentSource");
26  descriptions.addWithDefaultLabel(desc);
27 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void GEMEffByGEMCSCSegmentSource::fillME ( dqm::impl::MonitorElement me,
const double  x 
)
private

Definition at line 353 of file GEMEffByGEMCSCSegmentSource.cc.

References dqm::impl::MonitorElement::Fill(), and kLogCategory_.

Referenced by checkCoincidenceGE11().

353  {
354  if (me) {
355  me->Fill(x);
356 
357  } else {
358  edm::LogError(kLogCategory_) << "MonitorElement is nullptr";
359 
360  }
361 }
Log< level::Error, false > LogError
void Fill(long long x)
void GEMEffByGEMCSCSegmentSource::fillME ( MEMap me_map,
const GEMDetId key,
const double  x 
)
private

Definition at line 363 of file GEMEffByGEMCSCSegmentSource.cc.

References hasMEKey(), and submitPVResolutionJobs::key.

363  {
364  if (hasMEKey(me_map, key)) {
365  me_map[key]->Fill(x);
366  }
367 }
bool hasMEKey(const MEMap &, const GEMDetId &)
tuple key
prepare the HTCondor submission files and eventually submit them
void GEMEffByGEMCSCSegmentSource::fillMEWithinLimits ( dqm::impl::MonitorElement me,
const double  x 
)
private

Definition at line 370 of file GEMEffByGEMCSCSegmentSource.cc.

References dqm::impl::MonitorElement::Fill(), dqm::impl::MonitorElement::getAxisMax(), dqm::impl::MonitorElement::getAxisMin(), kEps_, and kLogCategory_.

Referenced by checkCoincidenceGE11(), and fillMEWithinLimits().

370  {
371  if (me) {
372  const double xlow = me->getAxisMin(1);
373  const double xup = me->getAxisMax(1) - kEps_;
374  me->Fill(std::clamp(x, xlow, xup));
375 
376  } else {
377  edm::LogError(kLogCategory_) << "MonitorElement is nullptr";
378 
379  }
380 }
virtual double getAxisMin(int axis=1) const
Log< level::Error, false > LogError
void Fill(long long x)
virtual double getAxisMax(int axis=1) const
void GEMEffByGEMCSCSegmentSource::fillMEWithinLimits ( MEMap me_map,
const GEMDetId key,
const double  x 
)
private

Definition at line 382 of file GEMEffByGEMCSCSegmentSource.cc.

References fillMEWithinLimits(), and hasMEKey().

382  {
383  if (hasMEKey(me_map, key)) {
384  fillMEWithinLimits(me_map[key], x);
385  }
386 }
bool hasMEKey(const MEMap &, const GEMDetId &)
void fillMEWithinLimits(dqm::impl::MonitorElement *, const double)
void GEMEffByGEMCSCSegmentSource::findMatchedME11Segments ( const reco::MuonCollection muon_collection)
private

Definition at line 288 of file GEMEffByGEMCSCSegmentSource.cc.

References reco::MuonSegmentMatch::BestInStationByDR, MuonSubdetId::CSC, reco::MuonSegmentMatch::cscSegmentRef, edm::Ref< C, T, F >::get(), reco::MuonSegmentMatch::isMask(), matched_me11_segment_vector_, reco::Muon::matches(), and HLT_FULL_cff::muon.

Referenced by analyze().

288  {
290  for (unsigned int idx = 0; idx < muon_collection->size(); idx++) {
291  const reco::Muon& muon = muon_collection->at(idx);
292 
293  for (const reco::MuonChamberMatch& chamber_match : muon.matches()) {
294  if (chamber_match.detector() != MuonSubdetId::CSC) {
295  continue;
296  }
297 
298  const CSCDetId csc_id{chamber_match.id};
299  if (not csc_id.isME11()) {
300  continue;
301  }
302 
303  for (const reco::MuonSegmentMatch& segment_match : chamber_match.segmentMatches) {
304  if (not segment_match.isMask(reco::MuonSegmentMatch::BestInStationByDR)) {
305  continue;
306  }
307  matched_me11_segment_vector_.push_back(segment_match.cscSegmentRef.get());
308  } // MuonSegmentMatch
309  } // MuonChamberMatch
310  } // MuonCollection
311 }
CSCSegmentRef cscSegmentRef
static const unsigned int BestInStationByDR
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
bool isMask(unsigned int flag=Arbitrated) const
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:145
std::vector< const CSCSegment * > matched_me11_segment_vector_
static constexpr int CSC
Definition: MuonSubdetId.h:12
GEMDetId GEMEffByGEMCSCSegmentSource::getReStLaKey ( const GEMDetId id)
inlineprivate

Definition at line 94 of file GEMEffByGEMCSCSegmentSource.h.

References GEMDetId::region().

Referenced by bookEfficiencyChamber(), and bookMisc().

94  {
95  return GEMDetId{id.region(), 1, id.station(), id.layer(), 0, 0};
96 }
constexpr int region() const
Definition: GEMDetId.h:171
bool GEMEffByGEMCSCSegmentSource::hasMEKey ( const MEMap me_map,
const GEMDetId key 
)
private

Definition at line 340 of file GEMEffByGEMCSCSegmentSource.cc.

References kLogCategory_, AlCaHLTBitMon_QueryRunRegistry::string, and UNLIKELY.

Referenced by fillME(), and fillMEWithinLimits().

340  {
341  bool has_key = true;
342 
343  if UNLIKELY (me_map.find(key) == me_map.end()) {
344  const std::string hint = me_map.empty() ? "empty" : me_map.begin()->second->getName();
345  edm::LogError(kLogCategory_) << "got an invalid key: " << key << ", hint=" << hint;
346  has_key = false;
347 
348  }
349 
350  return has_key;
351 }
Log< level::Error, false > LogError
#define UNLIKELY(x)
Definition: Likely.h:21
bool GEMEffByGEMCSCSegmentSource::isME11SegmentMatched ( const CSCSegment csc_segment)
private

Definition at line 314 of file GEMEffByGEMCSCSegmentSource.cc.

References CSCSegment::cscDetId(), newFWLiteAna::found, CSCDetId::isME11(), CSCSegment::localPosition(), matched_me11_segment_vector_, CSCSegment::time(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by checkCoincidenceGE11().

314  {
315  bool found = false;
316 
317  const CSCDetId csc_id = csc_segment.cscDetId();
318  if (not csc_id.isME11()) {
319  return false;
320  }
321 
322  for (const CSCSegment* matched_segment : matched_me11_segment_vector_) {
323  if (csc_id != matched_segment->cscDetId())
324  continue;
325  if (csc_segment.localPosition().x() != matched_segment->localPosition().x())
326  continue;
327  if (csc_segment.localPosition().y() != matched_segment->localPosition().y())
328  continue;
329  if (csc_segment.localPosition().z() != matched_segment->localPosition().z())
330  continue;
331  if (csc_segment.time() != matched_segment->time())
332  continue;
333 
334  found = true;
335  }
336 
337  return found;
338 }
LocalPoint localPosition() const override
Definition: CSCSegment.h:39
CSCDetId cscDetId() const
Definition: CSCSegment.h:70
T y() const
Definition: PV3DBase.h:60
bool isME11() const
Definition: CSCDetId.cc:64
T z() const
Definition: PV3DBase.h:61
std::vector< const CSCSegment * > matched_me11_segment_vector_
T x() const
Definition: PV3DBase.h:59
float time() const
Definition: CSCSegment.cc:144

Member Data Documentation

const double GEMEffByGEMCSCSegmentSource::kEps_ = std::numeric_limits<double>::epsilon()
private

Definition at line 44 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by fillMEWithinLimits().

const std::string GEMEffByGEMCSCSegmentSource::kFolder_
private

Definition at line 65 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookEfficiencyChamber(), and bookMisc().

const edm::EDGetTokenT<GEMCSCSegmentCollection> GEMEffByGEMCSCSegmentSource::kGEMCSCSegmentToken_
private

Definition at line 61 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by analyze().

const edm::ESGetToken<GEMGeometry, MuonGeometryRecord> GEMEffByGEMCSCSegmentSource::kGEMTokenBeginRun_
private

Definition at line 60 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookHistograms().

const std::string GEMEffByGEMCSCSegmentSource::kLogCategory_
private
const uint32_t GEMEffByGEMCSCSegmentSource::kMinCSCRecHits_
private

Definition at line 64 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by checkCoincidenceGE11().

const edm::EDGetTokenT<reco::MuonCollection> GEMEffByGEMCSCSegmentSource::kMuonToken_
private

Definition at line 62 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by analyze().

const bool GEMEffByGEMCSCSegmentSource::kUseMuon_
private
std::vector<const CSCSegment *> GEMEffByGEMCSCSegmentSource::matched_me11_segment_vector_
private

Definition at line 69 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by findMatchedME11Segments(), and isME11SegmentMatched().

MEMap GEMEffByGEMCSCSegmentSource::me_chamber_
private

Definition at line 72 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookEfficiencyChamber(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_chamber_matched_
private

Definition at line 73 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookEfficiencyChamber(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_csc_chamber_type_
private

Definition at line 81 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookMisc(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_csc_chamber_type_matched_
private

Definition at line 82 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookMisc(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_muon_chamber_
private

Definition at line 74 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookEfficiencyChamber(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_muon_chamber_matched_
private

Definition at line 75 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookEfficiencyChamber(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_num_csc_hits_
private

Definition at line 77 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookMisc(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_num_csc_hits_matched_
private

Definition at line 78 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookMisc(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_reduced_chi2_
private

Definition at line 79 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookMisc(), and checkCoincidenceGE11().

MEMap GEMEffByGEMCSCSegmentSource::me_reduced_chi2_matched_
private

Definition at line 80 of file GEMEffByGEMCSCSegmentSource.h.

Referenced by bookMisc(), and checkCoincidenceGE11().