CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes
GEMTrackMatch Class Referenceabstract

#include <GEMTrackMatch.h>

Inheritance diagram for GEMTrackMatch:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... > GEMDigiTrackMatch GEMRecHitTrackMatch GEMSimTrackMatch

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &) override=0
 
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 one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Attributes

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 42 of file GEMTrackMatch.h.

Constructor & Destructor Documentation

GEMTrackMatch::GEMTrackMatch ( const edm::ParameterSet cfg)
explicit

Definition at line 6 of file GEMTrackMatch.cc.

References edm::ParameterSet::getUntrackedParameter(), maxEta_, minEta_, and minPt_.

7 {
8  minPt_ = ps.getUntrackedParameter<double>("gemMinPt",5.0);
9  minEta_ = ps.getUntrackedParameter<double>("gemMinEta",1.55);
10  maxEta_ = ps.getUntrackedParameter<double>("gemMaxEta",2.45);
11 }
GEMTrackMatch::~GEMTrackMatch ( )
override

Definition at line 14 of file GEMTrackMatch.cc.

14  {
15 }

Member Function Documentation

void GEMTrackMatch::analyze ( const edm::Event e,
const edm::EventSetup  
)
overridepure virtual
void GEMTrackMatch::buildLUT ( const int  maxChamberId)

Definition at line 140 of file GEMTrackMatch.cc.

References GEMGeometry::chambers(), gem_geom_, negativeLUT_, and positiveLUT_.

Referenced by setGeometry().

141 {
142  edm::LogInfo("GEMTrackMatch")<<"GEMTrackMatch::buildLUT"<<std::endl;
143  edm::LogInfo("GEMTrackMatch")<<"max chamber "<<maxChamberId<<"\n";
144 
145  std::vector<int> pos_ids, neg_ids;
146  std::vector<float> phis_pos;
147  std::vector<float> phis_neg;
148  LocalPoint lCentre( 0., 0., 0. );
149 
150  for(auto it : gem_geom_->chambers()) {
151  if(it->id().region()>0) {
152  pos_ids.push_back(it->id().rawId());
153  edm::LogInfo("GEMTrackMatch")<<"added id = "<<it->id()<<" = "<<it->id().rawId()<<" to pos ids"<<std::endl;
154  const BoundPlane& bSurface(it->surface());
155  GlobalPoint gCentre(bSurface.toGlobal(lCentre));
156  int cphi(gCentre.phi().degrees());
157  if (cphi < 0) cphi += 360;
158  phis_pos.push_back(cphi);
159  edm::LogInfo("GEMTrackMatch")<<"added phi = "<<cphi<<" to phi pos vector"<<std::endl;
160  }
161  else if(it->id().region()<0) {
162  neg_ids.push_back(it->id().rawId());
163  edm::LogInfo("GEMTrackMatch")<<"added id = "<<it->id()<<" = "<<it->id().rawId()<<" to neg ids"<<std::endl;
164  const BoundPlane& bSurface(it->surface());
165  GlobalPoint gCentre(bSurface.toGlobal(lCentre));
166  int cphi(gCentre.phi().degrees());
167  if (cphi < 0) cphi += 360;
168  phis_neg.push_back(cphi);
169  edm::LogInfo("GEMTrackMatch")<<"added phi = "<<cphi<<" to phi neg vector"<<std::endl;
170  }
171  }
172  positiveLUT_ = std::make_pair(phis_pos,pos_ids);
173  negativeLUT_ = std::make_pair(phis_neg,neg_ids);
174 }
std::pair< std::vector< float >, std::vector< int > > negativeLUT_
Definition: GEMTrackMatch.h:69
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:59
const GEMGeometry * gem_geom_
Definition: GEMTrackMatch.h:79
std::pair< std::vector< float >, std::vector< int > > positiveLUT_
Definition: GEMTrackMatch.h:68
void GEMTrackMatch::FillWithTrigger ( MonitorElement me[3],
Float_t  eta 
)

Definition at line 17 of file GEMTrackMatch.cc.

References MonitorElement::Fill(), mps_fire::i, and nstation.

Referenced by GEMSimTrackMatch::analyze(), GEMDigiTrackMatch::analyze(), and GEMRecHitTrackMatch::analyze().

18 {
19  for( unsigned int i=0 ; i<nstation ; i++) {
20  hist[i]->Fill(eta);
21  }
22  return;
23 }
unsigned int nstation
Definition: GEMTrackMatch.h:80
void GEMTrackMatch::FillWithTrigger ( MonitorElement me[3][3],
Float_t  eta,
Float_t  phi,
bool  odd[3],
bool  even[3] 
)

Definition at line 25 of file GEMTrackMatch.cc.

References MonitorElement::Fill(), plotBeamSpotDB::first, getEtaRange(), mps_fire::i, nstation, edm::second(), and relativeConstraints::station.

26 {
27  for( unsigned int i=0 ; i<nstation ; i++) {
28  int station = i+1;
29  if ( odd[i] && eta > getEtaRange(station,1).first&& eta < getEtaRange(station,1).second ) {
30  hist[i][0]->Fill(phi);
31  if( hist[i][1] != nullptr) hist[i][1]->Fill(phi);
32  }
33  if ( even[i] && eta > getEtaRange(station,2).first&& eta < getEtaRange(station,2).second ) {
34  hist[i][0]->Fill(phi);
35  if( hist[i][2] != nullptr) hist[i][2]->Fill(phi);
36  }
37  }
38  return;
39 }
unsigned int nstation
Definition: GEMTrackMatch.h:80
U second(std::pair< T, U > const &p)
std::pair< double, double > getEtaRange(int station, int chamber)
void GEMTrackMatch::FillWithTrigger ( MonitorElement me[4][3],
bool  array[3][2],
Float_t  value 
)

Definition at line 41 of file GEMTrackMatch.cc.

References MonitorElement::Fill(), mps_fire::i, and nstation.

42 {
43  for( unsigned int i=0 ; i<nstation ; i++) {
44  if ( array[i][0] ) hist[0][i]->Fill(value);
45  if ( array[i][1] ) hist[1][i]->Fill(value);
46  if ( array[i][0] || array[i][1] ) hist[2][i]->Fill(value);
47  if ( array[i][0] && array[i][1] ) hist[3][i]->Fill(value);
48  }
49  return;
50 }
unsigned int nstation
Definition: GEMTrackMatch.h:80
Definition: value.py:1
void GEMTrackMatch::FillWithTrigger ( MonitorElement me[4][3][3],
bool  array[3][2],
Float_t  eta,
Float_t  phi,
bool  odd[3],
bool  even[3] 
)

Definition at line 52 of file GEMTrackMatch.cc.

References MonitorElement::Fill(), plotBeamSpotDB::first, getEtaRange(), mps_fire::i, nstation, edm::second(), and relativeConstraints::station.

53 {
54  for( unsigned int i=0 ; i<nstation ; i++) {
55  int station = i+1;
56  if ( odd[i] && eta > getEtaRange(station,1).first&& eta < getEtaRange(station,1).second ) {
57  if ( array[i][0] ) {
58  hist[0][i][0]->Fill(phi);
59  if ( hist[0][i][1] != nullptr) hist[0][i][1]->Fill(phi);
60  }
61  if ( array[i][1] ) {
62  hist[1][i][0]->Fill(phi);
63  if( hist[1][i][1] != nullptr ) hist[1][i][1]->Fill(phi);
64  }
65  if ( array[i][0] || array[i][1] ) {
66  hist[2][i][0]->Fill(phi);
67  if ( hist[2][i][1] != nullptr) hist[2][i][1]->Fill(phi);
68  }
69  if ( array[i][0] && array[i][1] ) {
70  hist[3][i][0]->Fill(phi);
71  if ( hist[3][i][1] != nullptr) hist[3][i][1]->Fill(phi);
72  }
73  }
74  if ( even[i] && eta > getEtaRange(station,2).first&& eta < getEtaRange(station,2).second ) {
75  if ( array[i][0] ) {
76  hist[0][i][0]->Fill(phi);
77  if ( hist[0][i][2]!=nullptr) hist[0][i][2]->Fill(phi);
78  }
79  if ( array[i][1] ) {
80  hist[1][i][0]->Fill(phi);
81  if( hist[1][i][2]!=nullptr ) hist[1][i][2]->Fill(phi);
82  }
83  if ( array[i][0] || array[i][1] ) {
84  hist[2][i][0]->Fill(phi);
85  if( hist[2][i][2]!=nullptr) hist[2][i][2]->Fill(phi);
86  }
87  if ( array[i][0] && array[i][1] ) {
88  hist[3][i][0]->Fill(phi);
89  if( hist[3][i][2]!=nullptr) hist[3][i][2]->Fill(phi);
90  }
91  }
92  }
93  return;
94 }
unsigned int nstation
Definition: GEMTrackMatch.h:80
U second(std::pair< T, U > const &p)
std::pair< double, double > getEtaRange(int station, int chamber)
std::pair< int, int > GEMTrackMatch::getClosestChambers ( const int  maxChamberId,
int  region,
float  phi 
)

Definition at line 202 of file GEMTrackMatch.cc.

References negativeLUT_, phi, positiveLUT_, and pfDeepBoostedJetPreprocessParams_cfi::upper.

203 {
204  auto& phis(positiveLUT_.first);
205  auto upper = std::upper_bound(phis.begin(), phis.end(), phi);
206  auto& LUT = (region == 1 ? positiveLUT_.second : negativeLUT_.second);
207  return std::make_pair(LUT.at(upper - phis.begin()), (LUT.at((upper - phis.begin() + 1)%maxChamberId)));
208 }
std::pair< std::vector< float >, std::vector< int > > negativeLUT_
Definition: GEMTrackMatch.h:69
std::pair< std::vector< float >, std::vector< int > > positiveLUT_
Definition: GEMTrackMatch.h:68
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
std::pair< double, double > GEMTrackMatch::getEtaRange ( int  station,
int  chamber 
)

Definition at line 96 of file GEMTrackMatch.cc.

References GEMGeometry::chambers(), gather_cfg::cout, and gem_geom_.

Referenced by FillWithTrigger().

97 {
98  if( gem_geom_ != nullptr) {
99  auto& ch = gem_geom_->chambers().front();
100  auto& roll1 = ch->etaPartitions().front(); //.begin();
101  auto& roll2 = ch->etaPartitions()[ch->nEtaPartitions()-1];
102  const BoundPlane& bSurface1(roll1->surface());
103  const BoundPlane& bSurface2(roll2->surface());
104  auto& parameters1( roll1->specs()->parameters());
105  float height1(parameters1[2]);
106  auto& parameters2( roll2->specs()->parameters());
107  float height2(parameters2[2]);
108  LocalPoint lTop1( 0., height1, 0.);
109  GlobalPoint gTop1(bSurface1.toGlobal(lTop1));
110  //LocalPoint lBottom1( 0., -height1, 0.);
111  //GlobalPoint gBottom1(bSurface1.toGlobal(lBottom1));
112  //LocalPoint lTop2( 0., height2, 0.);
113  //GlobalPoint gTop2(bSurface2.toGlobal(lTop2));
114  LocalPoint lBottom2( 0., -height2, 0.);
115  GlobalPoint gBottom2(bSurface2.toGlobal(lBottom2));
116  double eta1 = fabs(gTop1.eta()) - 0.01;
117  double eta2 = fabs(gBottom2.eta()) + 0.01;
118  return std::make_pair(eta1,eta2);
119  }
120  else { std::cout<<"Failed to get geometry information"<<std::endl;
121  return std::make_pair(0,0);
122  }
123 }
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:59
const GEMGeometry * gem_geom_
Definition: GEMTrackMatch.h:79
std::pair< double, double > GEMTrackMatch::getEtaRangeForPhi ( int  station)

Definition at line 210 of file GEMTrackMatch.cc.

References etaRangeForPhi.

211 {
212  std::pair<double, double> range;
213  if( station== 0 ) range = std::make_pair( etaRangeForPhi[0],etaRangeForPhi[1]) ;
214  else if( station== 1 ) range = std::make_pair( etaRangeForPhi[2],etaRangeForPhi[3]) ;
215  else if( station== 2 ) range = std::make_pair( etaRangeForPhi[4],etaRangeForPhi[5]) ;
216 
217  return range;
218 }
std::vector< double > etaRangeForPhi
Definition: GEMTrackMatch.h:71
bool GEMTrackMatch::isSimTrackGood ( const SimTrack t)

Definition at line 126 of file GEMTrackMatch.cc.

References funct::abs(), PVValHelper::eta, maxEta_, minEta_, minPt_, CoreSimTrack::momentum(), SimTrack::noGenpart(), SimTrack::noVertex(), and CoreSimTrack::type().

Referenced by GEMSimTrackMatch::analyze(), GEMDigiTrackMatch::analyze(), and GEMRecHitTrackMatch::analyze().

127 {
128 
129  // SimTrack selection
130  if (t.noVertex()) return false;
131  if (t.noGenpart()) return false;
132  if (std::abs(t.type()) != 13) return false; // only interested in direct muon simtracks
133  if (t.momentum().pt() < minPt_ ) return false;
134  const float eta(std::abs(t.momentum().eta()));
135  if (eta > maxEta_ || eta < minEta_ ) return false; // no GEMs could be in such eta
136  return true;
137 }
bool noGenpart() const
Definition: SimTrack.h:34
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool noVertex() const
Definition: SimTrack.h:30
int type() const
particle type (HEP PDT convension)
Definition: CoreSimTrack.h:25
const math::XYZTLorentzVectorD & momentum() const
Definition: CoreSimTrack.h:22
void GEMTrackMatch::setGeometry ( const GEMGeometry geom)

Definition at line 177 of file GEMTrackMatch.cc.

References buildLUT(), chamberHeight_, GEMGeometry::chambers(), gem_geom_, relativeConstraints::geom, GEMGeometry::idToDetUnit(), PV3DBase< T, PVType, FrameType >::perp(), radiusCenter_, GEMGeometry::regions(), GEMEtaPartitionSpecs::specificTopology(), GEMEtaPartition::specs(), StripTopology::stripLength(), and useRoll_.

Referenced by GEMSimTrackMatch::bookHistograms(), GEMDigiTrackMatch::bookHistograms(), and GEMRecHitTrackMatch::bookHistograms().

178 {
179  edm::LogInfo("GEMTrackMatch")<<"GEMTrackMatch :: setGeometry"<<std::endl;
180  gem_geom_ = &geom;
181  GEMDetId chId(gem_geom_->chambers().front()->id());
182  useRoll_ = 1;
183  const auto top_chamber = static_cast<const GEMEtaPartition*>(geom.idToDetUnit(GEMDetId(chId.region(),chId.ring(),chId.station(),chId.layer(),chId.chamber(),useRoll_)));
184  const int nEtaPartitions(gem_geom_->chambers().front()->nEtaPartitions());
185  const auto bottom_chamber = static_cast<const GEMEtaPartition*>(geom.idToDetUnit(GEMDetId(chId.region(),chId.ring(),chId.station(),chId.layer(),chId.chamber(),nEtaPartitions)));
186  const float top_half_striplength = top_chamber->specs()->specificTopology().stripLength()/2.;
187  const float bottom_half_striplength = bottom_chamber->specs()->specificTopology().stripLength()/2.;
188  const LocalPoint lp_top(0., top_half_striplength, 0.);
189  const LocalPoint lp_bottom(0., -bottom_half_striplength, 0.);
190  const GlobalPoint gp_top = top_chamber->toGlobal(lp_top);
191  const GlobalPoint gp_bottom = bottom_chamber->toGlobal(lp_bottom);
192 
193  radiusCenter_ = (gp_bottom.perp() + gp_top.perp())/2.;
194  chamberHeight_ = gp_top.perp() - gp_bottom.perp();
195 
196  const int maxChamberId = geom.regions()[0]->stations()[0]->superChambers().size();
197  edm::LogInfo("GEMTrackMatch")<<"GEMTrackMatch :: setGeometry --> Calling buildLUT"<<std::endl;
198  buildLUT(maxChamberId);
199 }
float radiusCenter_
Definition: GEMTrackMatch.h:77
virtual float stripLength() const =0
T perp() const
Definition: PV3DBase.h:72
void buildLUT(const int maxChamberId)
float chamberHeight_
Definition: GEMTrackMatch.h:77
const StripTopology & specificTopology() const
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Definition: GEMGeometry.cc:43
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: GEMGeometry.cc:33
const GEMEtaPartitionSpecs * specs() const
const std::vector< const GEMChamber * > & chambers() const
Return a vector of all GEM chambers.
Definition: GEMGeometry.cc:59
const GEMGeometry * gem_geom_
Definition: GEMTrackMatch.h:79

Member Data Documentation

edm::ParameterSet GEMTrackMatch::cfg_
protected
float GEMTrackMatch::chamberHeight_
protected

Definition at line 77 of file GEMTrackMatch.h.

Referenced by setGeometry().

bool GEMTrackMatch::detailPlot_
protected
std::vector< double > GEMTrackMatch::etaRangeForPhi
protected

Definition at line 71 of file GEMTrackMatch.h.

Referenced by getEtaRangeForPhi().

const GEMGeometry* GEMTrackMatch::gem_geom_
protected

Definition at line 79 of file GEMTrackMatch.h.

Referenced by buildLUT(), getEtaRange(), and setGeometry().

float GEMTrackMatch::maxEta_
protected
float GEMTrackMatch::minEta_
protected
float GEMTrackMatch::minPt_
protected

Definition at line 74 of file GEMTrackMatch.h.

Referenced by GEMTrackMatch(), and isSimTrackGood().

std::pair<std::vector<float>,std::vector<int> > GEMTrackMatch::negativeLUT_
protected

Definition at line 69 of file GEMTrackMatch.h.

Referenced by buildLUT(), and getClosestChambers().

unsigned int GEMTrackMatch::nstation
protected
std::pair<std::vector<float>,std::vector<int> > GEMTrackMatch::positiveLUT_
protected

Definition at line 68 of file GEMTrackMatch.h.

Referenced by buildLUT(), and getClosestChambers().

float GEMTrackMatch::radiusCenter_
protected

Definition at line 77 of file GEMTrackMatch.h.

Referenced by setGeometry().

edm::EDGetToken GEMTrackMatch::simHitsToken_
protected
edm::EDGetToken GEMTrackMatch::simTracksToken_
protected
edm::EDGetToken GEMTrackMatch::simVerticesToken_
protected
int GEMTrackMatch::useRoll_
protected

Definition at line 78 of file GEMTrackMatch.h.

Referenced by setGeometry().