CMS 3D CMS Logo

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

#include <GEMSimTrackMatch.h>

Inheritance diagram for GEMSimTrackMatch:
GEMTrackMatch DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 GEMSimTrackMatch (const edm::ParameterSet &ps)
 
 ~GEMSimTrackMatch () override
 
- Public Member Functions inherited from GEMTrackMatch
void buildLUT (const int maxChamberId)
 
void FillWithTrigger (MonitorElement *me[3], Float_t eta)
 
void FillWithTrigger (MonitorElement *me[3][3], Float_t eta, Float_t phi, bool odd[3], bool even[3])
 
void FillWithTrigger (MonitorElement *me[4][3], bool array[3][2], Float_t value)
 
void FillWithTrigger (MonitorElement *me[4][3][3], bool array[3][2], Float_t eta, Float_t phi, bool odd[3], bool even[3])
 
 GEMTrackMatch (const edm::ParameterSet &cfg)
 
std::pair< int, int > getClosestChambers (const int maxChamberId, int region, float phi)
 
std::pair< double, double > getEtaRange (int station, int chamber)
 
std::pair< double, double > getEtaRangeForPhi (int station)
 
bool isSimTrackGood (const SimTrack &)
 
void setGeometry (const GEMGeometry &geom)
 
 ~GEMTrackMatch () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () 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)
 

Private Attributes

bool detailPlot_
 
MonitorElementsh_eta [4][3]
 
MonitorElementsh_phi [4][3][3]
 
MonitorElementtrack_eta [3]
 
MonitorElementtrack_phi [3][3]
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase 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
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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)
 
- Protected Attributes inherited from GEMTrackMatch
edm::ParameterSet cfg_
 
float chamberHeight_
 
bool detailPlot_
 
std::vector< double > etaRangeForPhi
 
const GEMGeometrygem_geom_
 
float maxEta_
 
float minEta_
 
float minPt_
 
std::pair< std::vector< float >, std::vector< int > > negativeLUT_
 
unsigned int nstation
 
std::pair< std::vector< float >, std::vector< int > > positiveLUT_
 
float radiusCenter_
 
edm::EDGetToken simHitsToken_
 
edm::EDGetToken simTracksToken_
 
edm::EDGetToken simVerticesToken_
 
int useRoll_
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 7 of file GEMSimTrackMatch.h.

Constructor & Destructor Documentation

GEMSimTrackMatch::GEMSimTrackMatch ( const edm::ParameterSet ps)
explicit

Definition at line 12 of file GEMSimTrackMatch.cc.

References GEMTrackMatch::cfg_, detailPlot_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_2018_cff::InputTag, GEMTrackMatch::simHitsToken_, GEMTrackMatch::simTracksToken_, GEMTrackMatch::simVerticesToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

12  : GEMTrackMatch(ps) {
13  std::string simInputLabel_ = ps.getUntrackedParameter<std::string>("simInputLabel");
14 
15  simHitsToken_ = consumes<edm::PSimHitContainer>(edm::InputTag(simInputLabel_, "MuonGEMHits"));
16  simTracksToken_ = consumes<edm::SimTrackContainer>(ps.getParameter<edm::InputTag>("simTrackCollection"));
17  simVerticesToken_ = consumes<edm::SimVertexContainer>(ps.getParameter<edm::InputTag>("simVertexCollection"));
18  detailPlot_ = ps.getParameter<bool>("detailPlot");
19 
20  cfg_ = ps;
21 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet cfg_
Definition: GEMTrackMatch.h:60
edm::EDGetToken simHitsToken_
Definition: GEMTrackMatch.h:61
edm::EDGetToken simVerticesToken_
Definition: GEMTrackMatch.h:63
edm::EDGetToken simTracksToken_
Definition: GEMTrackMatch.h:62
GEMTrackMatch(const edm::ParameterSet &cfg)
Definition: GEMTrackMatch.cc:5
GEMSimTrackMatch::~GEMSimTrackMatch ( )
override

Definition at line 67 of file GEMSimTrackMatch.cc.

67 {}

Member Function Documentation

void GEMSimTrackMatch::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements GEMTrackMatch.

Definition at line 69 of file GEMSimTrackMatch.cc.

References begin, GEMTrackMatch::cfg_, relativeConstraints::chamber, SimHitMatcher::chamberIdsGEM(), gather_cfg::cout, ztail::d, detailPlot_, end, MySimTrack::eta, ntuplemaker::fill, GEMTrackMatch::FillWithTrigger(), MySimTrack::gem_sh, relativeConstraints::geom, edm::EventSetup::get(), edm::Event::getByToken(), MySimTrack::hitEven, MySimTrack::hitOdd, mps_fire::i, triggerObjects_cff::id, GEMTrackMatch::isSimTrackGood(), edm::HandleBase::isValid(), dqmiolumiharvest::j, MySimTrack::phi, edm::Handle< T >::product(), MySimTrack::pt, sh_eta, sh_phi, HLTBitAnalyser_cfi::simhits, GEMTrackMatch::simHitsToken_, GEMTrackMatch::simTracksToken_, GEMTrackMatch::simVerticesToken_, OrderedSet::t, track_eta, and track_phi.

69  {
71  iSetup.get<MuonGeometryRecord>().get(hGeom);
72  const GEMGeometry& geom = *hGeom;
73 
74  MySimTrack track_;
78 
79  iEvent.getByToken(simHitsToken_, simhits);
80  iEvent.getByToken(simTracksToken_, sim_tracks);
81  iEvent.getByToken(simVerticesToken_, sim_vertices);
82  if (!simhits.isValid() || !sim_tracks.isValid() || !sim_vertices.isValid())
83  return;
84 
85  //const edm::SimVertexContainer & sim_vert = *sim_vertices.product();
86  const edm::SimTrackContainer& sim_trks = *sim_tracks.product();
87 
88  if (detailPlot_) {
89  for (auto& t : sim_trks) {
90  if (!isSimTrackGood(t)) {
91  continue;
92  }
93 
94  track_.pt = t.momentum().pt();
95  track_.phi = t.momentum().phi();
96  track_.eta = t.momentum().eta();
97  std::fill(std::begin(track_.hitOdd), std::end(track_.hitOdd), false);
98  std::fill(std::begin(track_.hitEven), std::end(track_.hitEven), false);
99  for (int i = 0; i < 3; i++) {
100  for (int j = 0; j < 2; j++) {
101  track_.gem_sh[i][j] = false;
102  }
103  }
104 
105  // match hits to this SimTrack
106  const SimHitMatcher match_sh =
108 
109  // check for hit chambers
110  const auto gem_sh_ids_ch = match_sh.chamberIdsGEM();
111 
112  for (auto d : gem_sh_ids_ch) {
113  const GEMDetId id(d);
114  if (id.chamber() % 2 == 0)
115  track_.hitEven[id.station() - 1] = true;
116  else if (id.chamber() % 2 == 1)
117  track_.hitOdd[id.station() - 1] = true;
118  else {
119  std::cout << "Error to get chamber id" << std::endl;
120  }
121  track_.gem_sh[id.station() - 1][(id.layer() - 1)] = true;
122  }
123  FillWithTrigger(track_eta, fabs(track_.eta));
124  FillWithTrigger(track_phi, fabs(track_.eta), track_.phi, track_.hitOdd, track_.hitEven);
125  FillWithTrigger(sh_eta, track_.gem_sh, fabs(track_.eta));
126  FillWithTrigger(sh_phi, track_.gem_sh, fabs(track_.eta), track_.phi, track_.hitOdd, track_.hitEven);
127  }
128  }
129 }
MonitorElement * track_eta[3]
edm::ParameterSet cfg_
Definition: GEMTrackMatch.h:60
std::set< unsigned int > chamberIdsGEM() const
GEM chamber detIds with SimHits.
edm::EDGetToken simHitsToken_
Definition: GEMTrackMatch.h:61
edm::EDGetToken simVerticesToken_
Definition: GEMTrackMatch.h:63
bool hitOdd[3]
Definition: GEMTrackMatch.h:36
Float_t eta
Definition: GEMTrackMatch.h:25
int iEvent
Definition: GenABIO.cc:224
edm::EDGetToken simTracksToken_
Definition: GEMTrackMatch.h:62
#define end
Definition: vmac.h:39
bool isValid() const
Definition: HandleBase.h:70
d
Definition: ztail.py:151
MonitorElement * track_phi[3][3]
bool hitEven[3]
Definition: GEMTrackMatch.h:37
MonitorElement * sh_phi[4][3][3]
Float_t pt
Definition: GEMTrackMatch.h:25
T const * product() const
Definition: Handle.h:69
MonitorElement * sh_eta[4][3]
void FillWithTrigger(MonitorElement *me[3], Float_t eta)
#define begin
Definition: vmac.h:32
T get() const
Definition: EventSetup.h:73
Float_t phi
Definition: GEMTrackMatch.h:25
bool isSimTrackGood(const SimTrack &)
bool gem_sh[3][2]
Definition: GEMTrackMatch.h:32
std::vector< SimTrack > SimTrackContainer
void GEMSimTrackMatch::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 23 of file GEMSimTrackMatch.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), GEMDetLabel::c_suffix, detailPlot_, relativeConstraints::geom, edm::EventSetup::get(), mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, GEMDetLabel::l_suffix, LogDebug, GEMTrackMatch::maxEta_, GEMTrackMatch::minEta_, GEMTrackMatch::nstation, Pi, PI, GEMGeometry::regions(), GEMDetLabel::s_suffix, dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), GEMTrackMatch::setGeometry(), sh_eta, sh_phi, AlCaHLTBitMon_QueryRunRegistry::string, createPayload::suffix, track_eta, and track_phi.

23  {
24  // Mandantory
26  iSetup.get<MuonGeometryRecord>().get(hGeom);
27  const GEMGeometry& geom = *hGeom;
28  setGeometry(geom);
29 
30  ibooker.setCurrentFolder("MuonGEMHitsV/GEMHitsTask");
31  LogDebug("GEMSimTrackMatch") << "ibooker set current folder\n";
32 
33  const float PI = TMath::Pi();
34 
35  nstation = geom.regions()[0]->stations().size();
36  if (detailPlot_) {
37  for (unsigned int j = 0; j < nstation; j++) {
38  string track_eta_name = string("track_eta") + s_suffix[j];
39  string track_eta_title = string("track_eta") + ";SimTrack |#eta|;# of tracks";
40  track_eta[j] = ibooker.book1D(track_eta_name.c_str(), track_eta_title.c_str(), 140, minEta_, maxEta_);
41 
42  for (unsigned int k = 0; k < 3; k++) {
43  string suffix = string(s_suffix[j]) + string(c_suffix[k]);
44  string track_phi_name = string("track_phi") + suffix;
45  string track_phi_title = string("track_phi") + suffix + ";SimTrack #phi;# of tracks";
46  track_phi[j][k] = ibooker.book1D(track_phi_name.c_str(), track_phi_title.c_str(), 200, -PI, PI);
47  }
48 
49  for (unsigned int i = 0; i < 4; i++) {
50  string suffix = string(s_suffix[j]) + l_suffix[i];
51 
52  string sh_eta_name = string("sh_eta") + suffix;
53  string sh_eta_title = sh_eta_name + "; tracks |#eta|; # of tracks";
54  sh_eta[i][j] = ibooker.book1D(sh_eta_name.c_str(), sh_eta_title.c_str(), 140, minEta_, maxEta_);
55 
56  for (unsigned int k = 0; k < 3; k++) {
57  suffix = string(s_suffix[j]) + string(l_suffix[i]) + string(c_suffix[k]);
58  string sh_phi_name = string("sh_phi") + suffix;
59  string sh_phi_title = sh_phi_name + "; tracks #phi; # of tracks";
60  sh_phi[i][j][k] = ibooker.book1D((sh_phi_name).c_str(), sh_phi_title.c_str(), 200, -PI, PI);
61  }
62  }
63  }
64  }
65 }
#define LogDebug(id)
const double Pi
unsigned int nstation
Definition: GEMTrackMatch.h:76
static const std::array< std::string, 4 > l_suffix
Definition: GEMDetLabel.h:4
MonitorElement * track_eta[3]
void setGeometry(const GEMGeometry &geom)
static const std::array< std::string, 2 > s_suffix
Definition: GEMDetLabel.h:5
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Definition: GEMGeometry.cc:30
#define PI
Definition: QcdUeDQM.h:37
MonitorElement * track_phi[3][3]
MonitorElement * sh_phi[4][3][3]
MonitorElement * sh_eta[4][3]
static const std::array< std::string, 3 > c_suffix
Definition: GEMDetLabel.h:6

Member Data Documentation

bool GEMSimTrackMatch::detailPlot_
private

Definition at line 22 of file GEMSimTrackMatch.h.

Referenced by analyze(), bookHistograms(), and GEMSimTrackMatch().

MonitorElement* GEMSimTrackMatch::sh_eta[4][3]
private

Definition at line 17 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMSimTrackMatch::sh_phi[4][3][3]
private

Definition at line 18 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMSimTrackMatch::track_eta[3]
private

Definition at line 15 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMSimTrackMatch::track_phi[3][3]
private

Definition at line 16 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().