CMS 3D CMS Logo

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

#include <GEMSimTrackMatch.h>

Inheritance diagram for GEMSimTrackMatch:
GEMTrackMatch DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

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 ()
 
- 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)
 
virtual ~GEMTrackMatch ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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_
 

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_25ns10e33_v2_cff::InputTag, GEMTrackMatch::simHitsToken_, GEMTrackMatch::simTracksToken_, GEMTrackMatch::simVerticesToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 71 of file GEMSimTrackMatch.cc.

71  {
72 }

Member Function Documentation

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

Implements GEMTrackMatch.

Definition at line 74 of file GEMSimTrackMatch.cc.

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

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

Implements DQMEDAnalyzer.

Definition at line 24 of file GEMSimTrackMatch.cc.

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

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

Member Data Documentation

bool GEMSimTrackMatch::detailPlot_
private

Definition at line 23 of file GEMSimTrackMatch.h.

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

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

Definition at line 18 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 19 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* GEMSimTrackMatch::track_eta[3]
private

Definition at line 16 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 17 of file GEMSimTrackMatch.h.

Referenced by analyze(), and bookHistograms().