CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
AlignmentMonitorMuonSystemMap1D Class Reference
Inheritance diagram for AlignmentMonitorMuonSystemMap1D:
AlignmentMonitorBase

Classes

class  MuonSystemMapPlot1D
 
struct  MyCSCDetId
 
struct  MyResidual
 
struct  MyTrack
 

Public Member Functions

void afterAlignment () override
 
 AlignmentMonitorMuonSystemMap1D (const edm::ParameterSet &cfg, edm::ConsumesCollector iC)
 
void book () override
 Book or retrieve histograms; MUST be reimplemented. More...
 
void event (const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks) override
 Called for each event (by "run()"): may be reimplemented. More...
 
void processMuonResidualsFromTrack (MuonResidualsFromTrack &mrft, const edm::Event &iEvent)
 
 ~AlignmentMonitorMuonSystemMap1D () override
 
- Public Member Functions inherited from AlignmentMonitorBase
 AlignmentMonitorBase (const edm::ParameterSet &cfg, const edm::ConsumesCollector &iC, std::string name)
 Constructor. More...
 
 AlignmentMonitorBase (const AlignmentMonitorBase &)=delete
 
void beginOfJob (AlignableTracker *pTracker, AlignableMuon *pMuon, AlignmentParameterStore *pStore)
 Called at beginning of job: don't reimplement. More...
 
void duringLoop (const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks)
 Called for each event: don't reimplement. More...
 
void endOfJob ()
 Called at end of processing: don't implement. More...
 
void endOfLoop ()
 Called at end of loop: don't reimplement. More...
 
const AlignmentMonitorBaseoperator= (const AlignmentMonitorBase &)=delete
 
void startingNewLoop ()
 Called at beginning of loop: don't reimplement. More...
 
virtual ~AlignmentMonitorBase ()
 Destructor. More...
 

Private Member Functions

std::string num02d (int num)
 

Private Attributes

bool m_allowTIDTEC
 
long m_counter_13numhits
 
long m_counter_2numhits
 
long m_counter_csc
 
long m_counter_cscnumhits
 
long m_counter_dt
 
long m_counter_event
 
long m_counter_track
 
long m_counter_trackdxy
 
long m_counter_trackmoment
 
long m_counter_trackokay
 
bool m_createNtuple
 
TTree * m_cscnt
 
MuonSystemMapPlot1Dm_CSCvsphi_me [2][4][3]
 
MuonSystemMapPlot1Dm_CSCvsr_me [2][4][36]
 
bool m_doCSC
 
bool m_doDT
 
MuonSystemMapPlot1Dm_DTvsphi_station [4][5]
 
MuonSystemMapPlot1Dm_DTvsz_station [4][14]
 
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder
 
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecordm_esTokenDetId
 
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordm_esTokenGBTGeom
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordm_esTokenMF
 
const edm::ESGetToken< Propagator, TrackingComponentsRecordm_esTokenProp
 
MyCSCDetId m_id
 
double m_maxDxy
 
double m_maxTrackerRedChi2
 
double m_maxTrackP
 
double m_maxTrackPt
 
int m_minCSCHits
 
int m_minDT13Hits
 
int m_minDT2Hits
 
int m_minNCrossedChambers
 
int m_minTrackerHits
 
double m_minTrackP
 
double m_minTrackPt
 
edm::InputTag m_muonCollectionTag
 
std::vector< MuonSystemMapPlot1D * > m_plots
 
MyResidual m_re
 
UInt_t m_run
 
MyTrack m_tr
 
bool m_useStubPosition
 

Additional Inherited Members

- Public Types inherited from AlignmentMonitorBase
typedef std::pair< const Trajectory *, const reco::Track * > ConstTrajTrackPair
 
typedef std::vector< ConstTrajTrackPairConstTrajTrackPairCollection
 
- Protected Member Functions inherited from AlignmentMonitorBase
TH1F * book1D (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)
 
TH2F * book2D (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
 
TProfile * bookProfile (std::string dir, std::string name, std::string title, int nchX, double lowX, double highX, int nchY=1, double lowY=0., double highY=0., const char *option="s")
 
TFileDirectorydirectory (std::string dir)
 
int iteration ()
 
AlignableMuonpMuon ()
 
AlignableNavigatorpNavigator ()
 
AlignmentParameterStorepStore ()
 
AlignableTrackerpTracker ()
 
- Protected Attributes inherited from AlignmentMonitorBase
const edm::InputTag m_beamSpotTag
 

Detailed Description

Definition at line 34 of file AlignmentMonitorMuonSystemMap1D.cc.

Constructor & Destructor Documentation

◆ AlignmentMonitorMuonSystemMap1D()

AlignmentMonitorMuonSystemMap1D::AlignmentMonitorMuonSystemMap1D ( const edm::ParameterSet cfg,
edm::ConsumesCollector  iC 
)

Definition at line 152 of file AlignmentMonitorMuonSystemMap1D.cc.

References AlignmentMonitorMuonSystemMap1D::MyCSCDetId::e, compareTotals::fs, m_createNtuple, m_cscnt, m_id, m_re, m_run, m_tr, AlignmentMonitorMuonSystemMap1D::MyTrack::q, and AlignmentMonitorMuonSystemMap1D::MyResidual::res.

154  : AlignmentMonitorBase(cfg, iC, "AlignmentMonitorMuonSystemMap1D"),
156  m_esTokenDetId(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))),
157  m_esTokenProp(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))),
158  m_esTokenMF(iC.esConsumes()),
160  m_muonCollectionTag(cfg.getParameter<edm::InputTag>("muonCollectionTag")),
161  m_minTrackPt(cfg.getParameter<double>("minTrackPt")),
162  m_maxTrackPt(cfg.getParameter<double>("maxTrackPt")),
163  m_minTrackP(cfg.getParameter<double>("minTrackP")),
164  m_maxTrackP(cfg.getParameter<double>("maxTrackP")),
165  m_maxDxy(cfg.getParameter<double>("maxDxy")),
166  m_minTrackerHits(cfg.getParameter<int>("minTrackerHits")),
167  m_maxTrackerRedChi2(cfg.getParameter<double>("maxTrackerRedChi2")),
168  m_allowTIDTEC(cfg.getParameter<bool>("allowTIDTEC")),
169  m_minNCrossedChambers(cfg.getParameter<int>("minNCrossedChambers")),
170  m_minDT13Hits(cfg.getParameter<int>("minDT13Hits")),
171  m_minDT2Hits(cfg.getParameter<int>("minDT2Hits")),
172  m_minCSCHits(cfg.getParameter<int>("minCSCHits")),
173  m_doDT(cfg.getParameter<bool>("doDT")),
174  m_doCSC(cfg.getParameter<bool>("doCSC")),
175  m_useStubPosition(cfg.getParameter<bool>("useStubPosition")),
176  m_createNtuple(cfg.getParameter<bool>("createNtuple")) {
177  if (m_createNtuple) {
179  m_cscnt = fs->make<TTree>("mualNtuple", "mualNtuple");
180  m_cscnt->Branch("id", &m_id.e, "e/S:s:r:c:t");
181  m_cscnt->Branch("tr", &m_tr.q, "q/I:pt/F:pz");
182  m_cscnt->Branch("re", &m_re.res, "res/F:slope:rho:phi:z");
183  m_cscnt->Branch("run", &m_run, "run/i");
184  }
185 }
AlignmentMonitorBase(const edm::ParameterSet &cfg, const edm::ConsumesCollector &iC, std::string name)
Constructor.
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_esTokenGBTGeom
static edm::ESInputTag builderESInputTag()
const edm::ESGetToken< Propagator, TrackingComponentsRecord > m_esTokenProp
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_esTokenMF
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > m_esTokenDetId

◆ ~AlignmentMonitorMuonSystemMap1D()

AlignmentMonitorMuonSystemMap1D::~AlignmentMonitorMuonSystemMap1D ( )
inlineoverride

Definition at line 37 of file AlignmentMonitorMuonSystemMap1D.cc.

37 {}

Member Function Documentation

◆ afterAlignment()

void AlignmentMonitorMuonSystemMap1D::afterAlignment ( )
overridevirtual

Called after updating AlignableTracker and AlignableMuon (by "endOfLoop()"): may be reimplemented

Reimplemented from AlignmentMonitorBase.

Definition at line 491 of file AlignmentMonitorMuonSystemMap1D.cc.

References gather_cfg::cout, m_counter_13numhits, m_counter_2numhits, m_counter_csc, m_counter_cscnumhits, m_counter_dt, m_counter_event, m_counter_track, m_counter_trackdxy, m_counter_trackmoment, and m_counter_trackokay.

491  {
492  std::cout << "AlignmentMonitorMuonSystemMap1D counters:" << std::endl;
493  std::cout << " monitor m_counter_event = " << m_counter_event << std::endl;
494  std::cout << " monitor m_counter_track = " << m_counter_track << std::endl;
495  std::cout << " monitor m_counter_trackppt = " << m_counter_trackmoment << std::endl;
496  std::cout << " monitor m_counter_trackdxy = " << m_counter_trackdxy << std::endl;
497  std::cout << " monitor m_counter_trackokay = " << m_counter_trackokay << std::endl;
498  std::cout << " monitor m_counter_dt = " << m_counter_dt << std::endl;
499  std::cout << " monitor m_counter_13numhits = " << m_counter_13numhits << std::endl;
500  std::cout << " monitor m_counter_2numhits = " << m_counter_2numhits << std::endl;
501  std::cout << " monitor m_counter_csc = " << m_counter_csc << std::endl;
502  std::cout << " monitor m_counter_cscnumhits = " << m_counter_cscnumhits << std::endl;
503 }

◆ book()

void AlignmentMonitorMuonSystemMap1D::book ( )
overridevirtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 194 of file AlignmentMonitorMuonSystemMap1D.cc.

References relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, m_counter_13numhits, m_counter_2numhits, m_counter_csc, m_counter_cscnumhits, m_counter_dt, m_counter_event, m_counter_track, m_counter_trackdxy, m_counter_trackmoment, m_counter_trackokay, m_CSCvsphi_me, m_CSCvsr_me, m_doCSC, m_doDT, m_DTvsphi_station, m_DTvsz_station, M_PI, m_plots, num02d(), relativeConstraints::ring, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), and makeMuonMisalignmentScenario::wheel.

194  {
195  std::string wheel_label[5] = {"A", "B", "C", "D", "E"};
196 
197  for (unsigned char station = 1; station <= 4; station++) {
198  std::string s_station = std::to_string(station);
199 
200  bool do_y = true;
201  if (station == 4)
202  do_y = false;
203 
204  // *** DT ***
205  if (m_doDT)
206  for (int sector = 1; sector <= 14; sector++) {
207  if ((station < 4 && sector <= 12) || station == 4) {
208  m_DTvsz_station[station - 1][sector - 1] = new MuonSystemMapPlot1D(
209  "DTvsz_st" + s_station + "sec" + num02d(sector), this, 60, -660., 660., do_y, false);
210  m_plots.push_back(m_DTvsz_station[station - 1][sector - 1]);
211  }
212  }
213 
214  if (m_doDT)
215  for (int wheel = -2; wheel <= 2; wheel++) {
216  m_DTvsphi_station[station - 1][wheel + 2] = new MuonSystemMapPlot1D(
217  "DTvsphi_st" + s_station + "wh" + wheel_label[wheel + 2], this, 180, -M_PI, M_PI, do_y, false);
218  m_plots.push_back(m_DTvsphi_station[station - 1][wheel + 2]);
219  }
220 
221  // *** CSC ***
222  if (m_doCSC)
223  for (int endcap = 1; endcap <= 2; endcap++) {
224  std::string s_endcap("m");
225  if (endcap == 1)
226  s_endcap = "p";
227 
228  for (int chamber = 1; chamber <= 36; chamber++) {
229  m_CSCvsr_me[endcap - 1][station - 1][chamber - 1] = new MuonSystemMapPlot1D(
230  "CSCvsr_me" + s_endcap + s_station + "ch" + num02d(chamber), this, 60, 100., 700., false, false);
231  m_plots.push_back(m_CSCvsr_me[endcap - 1][station - 1][chamber - 1]);
232  }
233 
234  for (int ring = 1; ring <= 3; ring++) // the ME1/a (ring4) is not independent from ME1/b (ring1)
235  {
236  std::string s_ring = std::to_string(ring);
237  if ((station > 1 && ring <= 2) || station == 1) {
238  m_CSCvsphi_me[endcap - 1][station - 1][ring - 1] =
239  new MuonSystemMapPlot1D("CSCvsphi_me" + s_endcap + s_station + s_ring,
240  this,
241  180,
242  -M_PI / 180. * 5.,
243  M_PI * (2. - 5. / 180.),
244  false,
245  true);
246  m_plots.push_back(m_CSCvsphi_me[endcap - 1][station - 1][ring - 1]);
247  }
248  }
249  } // endcaps
250  } // stations
251 
252  m_counter_event = 0;
253  m_counter_track = 0;
255  m_counter_trackdxy = 0;
257  m_counter_dt = 0;
259  m_counter_2numhits = 0;
260  m_counter_csc = 0;
262 }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
MuonSystemMapPlot1D * m_CSCvsr_me[2][4][36]
MuonSystemMapPlot1D * m_CSCvsphi_me[2][4][3]
#define M_PI
std::vector< MuonSystemMapPlot1D * > m_plots

◆ event()

void AlignmentMonitorMuonSystemMap1D::event ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const ConstTrajTrackPairCollection iTrajTracks 
)
overridevirtual

Called for each event (by "run()"): may be reimplemented.

Reimplemented from AlignmentMonitorBase.

Definition at line 264 of file AlignmentMonitorMuonSystemMap1D.cc.

References pwdgSkimBPark_cfi::beamSpot, edm::EventSetup::getData(), edm::EventSetup::getHandle(), iEvent, edm::InputTag::label(), AlignmentMonitorBase::m_beamSpotTag, m_counter_event, m_counter_track, m_counter_trackdxy, m_counter_trackmoment, m_esTokenBuilder, m_esTokenDetId, m_esTokenGBTGeom, m_esTokenMF, m_esTokenProp, m_maxDxy, m_maxTrackP, m_maxTrackPt, m_minTrackP, m_muonCollectionTag, HLT_2022v12_cff::magneticField, HLT_2022v12_cff::muon, PDWG_BPHSkim_cff::muons, AlignmentMonitorBase::pNavigator(), processMuonResidualsFromTrack(), DiDispStaMuonMonitor_cfi::pt, and HLT_2022v12_cff::track.

Referenced by Types.EventID::cppID().

266  {
267  m_counter_event++;
268 
270  iEvent.getByLabel(m_beamSpotTag, beamSpot);
271 
272  const GlobalTrackingGeometry *globalGeometry = &iSetup.getData(m_esTokenGBTGeom);
273  const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId);
274  const Propagator *prop = &iSetup.getData(m_esTokenProp);
276  auto builder = iSetup.getHandle(m_esTokenBuilder);
277 
278  if (m_muonCollectionTag.label().empty()) // use trajectories
279  {
280  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end();
281  ++trajtrack) {
282  m_counter_track++;
283  const Trajectory *traj = (*trajtrack).first;
284  const reco::Track *track = (*trajtrack).second;
285 
286  if (m_minTrackPt < track->pt() && track->pt() < m_maxTrackPt && m_minTrackP < track->p() &&
287  track->p() < m_maxTrackP) {
289  if (fabs(track->dxy(beamSpot->position())) < m_maxDxy) {
291 
292  MuonResidualsFromTrack muonResidualsFromTrack(
293  builder, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.);
294  processMuonResidualsFromTrack(muonResidualsFromTrack, iEvent);
295  }
296  } // end if track has acceptable momentum
297  } // end loop over tracks
298  } else {
300  iEvent.getByLabel(m_muonCollectionTag, muons);
301 
302  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
303  if (!(muon->isTrackerMuon() && muon->innerTrack().isNonnull()))
304  continue;
305 
306  m_counter_track++;
307 
308  if (m_minTrackPt < muon->pt() && muon->pt() < m_maxTrackPt && m_minTrackP < muon->p() &&
309  muon->p() < m_maxTrackP) {
311  if (fabs(muon->innerTrack()->dxy(beamSpot->position())) < m_maxDxy) {
313 
314  MuonResidualsFromTrack muonResidualsFromTrack(globalGeometry, &(*muon), pNavigator(), 100.);
315  processMuonResidualsFromTrack(muonResidualsFromTrack, iEvent);
316  }
317  }
318  }
319  }
320 }
AlignableNavigator * pNavigator()
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_esTokenGBTGeom
std::string const & label() const
Definition: InputTag.h:36
const edm::ESGetToken< Propagator, TrackingComponentsRecord > m_esTokenProp
int iEvent
Definition: GenABIO.cc:224
bool getData(T &iHolder) const
Definition: EventSetup.h:122
const edm::InputTag m_beamSpotTag
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_esTokenMF
void processMuonResidualsFromTrack(MuonResidualsFromTrack &mrft, const edm::Event &iEvent)
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > m_esTokenDetId

◆ num02d()

std::string AlignmentMonitorMuonSystemMap1D::num02d ( int  num)
private

Definition at line 187 of file AlignmentMonitorMuonSystemMap1D.cc.

References cms::cuda::assert(), EgammaValidation_cff::num, AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

Referenced by book().

187  {
188  assert(num >= 0 && num < 100);
189  char tmp[4];
190  sprintf(tmp, "%02d", num);
191  return std::string(tmp);
192 }
assert(be >=bs)
tmp
align.sh
Definition: createJobs.py:716

◆ processMuonResidualsFromTrack()

void AlignmentMonitorMuonSystemMap1D::processMuonResidualsFromTrack ( MuonResidualsFromTrack mrft,
const edm::Event iEvent 
)

Definition at line 322 of file AlignmentMonitorMuonSystemMap1D.cc.

References cms::cuda::assert(), relativeConstraints::chamber, MuonResidualsFromTrack::chamberIds(), MuonResidualsFromTrack::chamberResidual(), ALCARECOTkAlJpsiMuMu_cff::charge, reco::TrackBase::charge(), hltPixelTracks_cff::chi2, MuonChamberResidual::chi2(), MuonResidualsFromTrack::contains_TIDTEC(), MuonSubdetId::CSC, MuonSubdetId::DT, makeMuonMisalignmentScenario::endcap, AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::fill_dxdz(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::fill_dydz(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::fill_x(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::fill_x_1d(), AlignmentMonitorMuonSystemMap1D::MuonSystemMapPlot1D::fill_y(), MuonResidualsFromTrack::getTrack(), MuonChamberResidual::global_residual(), MuonChamberResidual::global_resslope(), MuonChamberResidual::global_stubpos(), MuonChamberResidual::global_trackpos(), triggerObjects_cff::id, iEvent, AlignmentMonitorMuonSystemMap1D::MyCSCDetId::init(), MuonChamberResidual::kCSC, MuonChamberResidual::kDT13, MuonChamberResidual::kDT2, m_allowTIDTEC, m_counter_13numhits, m_counter_2numhits, m_counter_csc, m_counter_cscnumhits, m_counter_dt, m_counter_trackokay, m_createNtuple, m_cscnt, m_CSCvsphi_me, m_CSCvsr_me, m_doCSC, m_doDT, m_DTvsphi_station, m_DTvsz_station, m_id, m_maxTrackerRedChi2, m_minCSCHits, m_minDT13Hits, m_minDT2Hits, m_minNCrossedChambers, m_minTrackerHits, M_PI, m_re, m_run, m_tr, m_useStubPosition, DetId::Muon, MuonChamberResidual::ndof(), MuonResidualsFromTrack::normalizedChi2(), MuonChamberResidual::numHits(), phi, AlignmentMonitorMuonSystemMap1D::MyResidual::phi, funct::pow(), AlignmentMonitorMuonSystemMap1D::MyTrack::pt, reco::TrackBase::pt(), AlignmentMonitorMuonSystemMap1D::MyTrack::pz, reco::TrackBase::pz(), AlignmentMonitorMuonSystemMap1D::MyTrack::q, dttmaxenums::R, AlignmentMonitorMuonSystemMap1D::MyResidual::res, AlignmentMonitorMuonSystemMap1D::MyResidual::rho, relativeConstraints::ring, AlignmentMonitorMuonSystemMap1D::MyResidual::slope, mathSSE::sqrt(), relativeConstraints::station, MuonResidualsFromTrack::trackerNumHits(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, PV3DBase< T, PVType, FrameType >::z(), and AlignmentMonitorMuonSystemMap1D::MyResidual::z.

Referenced by event().

323  {
324  if (mrft.trackerNumHits() < m_minTrackerHits)
325  return;
326  if (!m_allowTIDTEC && mrft.contains_TIDTEC())
327  return;
328  if (mrft.normalizedChi2() > m_maxTrackerRedChi2)
329  return;
330 
331  int nMuChambers = 0;
332  std::vector<DetId> chamberIds = mrft.chamberIds();
333  for (unsigned ch = 0; ch < chamberIds.size(); ch++)
334  if (chamberIds[ch].det() == DetId::Muon)
335  nMuChambers++;
336  if (nMuChambers < m_minNCrossedChambers)
337  return;
338 
339  char charge = (mrft.getTrack()->charge() > 0 ? 1 : -1);
340  // double qoverpt = track->charge() / track->pt();
341  // double qoverpz = track->charge() / track->pz();
342 
344 
345  for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end(); ++chamberId) {
346  if (chamberId->det() != DetId::Muon)
347  continue;
348 
349  if (m_doDT && chamberId->subdetId() == MuonSubdetId::DT) {
352  DTChamberId id(chamberId->rawId());
353 
354  m_counter_dt++;
355 
356  if (id.station() < 4 && dt13 != nullptr && dt13->numHits() >= m_minDT13Hits && dt2 != nullptr &&
357  dt2->numHits() >= m_minDT2Hits && (dt2->chi2() / double(dt2->ndof())) < 2.0) {
359 
360  double residual = dt13->global_residual();
361  double resslope = dt13->global_resslope();
362  double chi2 = dt13->chi2();
363  int dof = dt13->ndof();
364 
365  align::GlobalPoint gpos;
366  if (m_useStubPosition)
367  gpos = dt13->global_stubpos();
368  else
369  gpos = dt13->global_trackpos();
370  double phi = atan2(gpos.y(), gpos.x());
371  double z = gpos.z();
372 
373  assert(1 <= id.sector() && id.sector() <= 14);
374 
375  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_x(charge, z, residual, chi2, dof);
376  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_dxdz(charge, z, resslope, chi2, dof);
377  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_x(charge, phi, residual, chi2, dof);
378  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_dxdz(charge, phi, resslope, chi2, dof);
379 
381 
382  residual = dt2->global_residual();
383  resslope = dt2->global_resslope();
384  chi2 = dt2->chi2();
385  dof = dt2->ndof();
386 
387  if (m_useStubPosition)
388  gpos = dt2->global_stubpos();
389  else
390  gpos = dt2->global_trackpos();
391  phi = atan2(gpos.y(), gpos.x());
392  z = gpos.z();
393 
394  assert(1 <= id.sector() && id.sector() <= 14);
395 
396  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_y(charge, z, residual, chi2, dof);
397  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_dydz(charge, z, resslope, chi2, dof);
398  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_y(charge, phi, residual, chi2, dof);
399  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_dydz(charge, phi, resslope, chi2, dof);
400  }
401 
402  if (id.station() == 4 && dt13 != nullptr && dt13->numHits() >= m_minDT13Hits) {
404 
405  double residual = dt13->global_residual();
406  double resslope = dt13->global_resslope();
407  double chi2 = dt13->chi2();
408  int dof = dt13->ndof();
409 
410  align::GlobalPoint gpos;
411  if (m_useStubPosition)
412  gpos = dt13->global_stubpos();
413  else
414  gpos = dt13->global_trackpos();
415  double phi = atan2(gpos.y(), gpos.x());
416  double z = gpos.z();
417 
418  assert(1 <= id.sector() && id.sector() <= 14);
419 
420  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_x(charge, z, residual, chi2, dof);
421  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_dxdz(charge, z, resslope, chi2, dof);
422  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_x(charge, phi, residual, chi2, dof);
423  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_dxdz(charge, phi, resslope, chi2, dof);
424  }
425  }
426 
427  else if (m_doCSC && chamberId->subdetId() == MuonSubdetId::CSC) {
429  CSCDetId id(chamberId->rawId());
430 
431  int ring = id.ring();
432  if (id.ring() == 4)
433  ring = 1; // combine ME1/a + ME1/b
434 
435  m_counter_csc++;
436 
437  if (csc != nullptr && csc->numHits() >= m_minCSCHits) {
439 
440  double residual = csc->global_residual();
441  double resslope = csc->global_resslope();
442  double chi2 = csc->chi2();
443  int dof = csc->ndof();
444 
445  align::GlobalPoint gpos;
446  if (m_useStubPosition)
447  gpos = csc->global_stubpos();
448  else
449  gpos = csc->global_trackpos();
450  double phi = atan2(gpos.y(), gpos.x());
451  // start phi from -5deg
452  if (phi < -M_PI / 180. * 5.)
453  phi += 2. * M_PI;
454  double R = sqrt(pow(gpos.x(), 2) + pow(gpos.y(), 2));
455 
456  int chamber = id.chamber() - 1;
457  if (id.station() > 1 && ring == 1)
458  chamber *= 2;
459 
460  assert(1 <= id.endcap() && id.endcap() <= 2 && 0 <= chamber && chamber <= 35);
461 
462  if (R > 0.)
463  m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_x_1d(residual / R, chi2, dof);
464 
465  m_CSCvsr_me[id.endcap() - 1][id.station() - 1][chamber]->fill_x(charge, R, residual, chi2, dof);
466  m_CSCvsr_me[id.endcap() - 1][id.station() - 1][chamber]->fill_dxdz(charge, R, resslope, chi2, dof);
467  m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_x(charge, phi, residual, chi2, dof);
468  m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_dxdz(charge, phi, resslope, chi2, dof);
469 
470  if (m_createNtuple && chi2 > 0.) // && TMath::Prob(chi2, dof) < 0.95)
471  {
472  m_id.init(id);
473  m_tr.q = charge;
474  m_tr.pt = mrft.getTrack()->pt();
475  m_tr.pz = mrft.getTrack()->pz();
476  m_re.res = residual;
477  m_re.slope = resslope;
478  m_re.rho = R;
479  m_re.phi = phi;
480  m_re.z = gpos.z();
481  m_run = iEvent.id().run();
482  m_cscnt->Fill();
483  }
484  }
485  }
486 
487  //else { assert(false); }
488  } // end loop over chambers
489 }
void fill_x(char charge, double abscissa, double residx, double chi2, int dof)
void fill_dydz(char charge, double abscissa, double slopey, double chi2, int dof)
void fill_y(char charge, double abscissa, double residy, double chi2, int dof)
T z() const
Definition: PV3DBase.h:61
align::GlobalPoint global_trackpos()
MuonSystemMapPlot1D * m_CSCvsr_me[2][4][36]
MuonSystemMapPlot1D * m_CSCvsphi_me[2][4][3]
assert(be >=bs)
double pt() const
track transverse momentum
Definition: TrackBase.h:637
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int charge() const
track electric charge
Definition: TrackBase.h:596
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:19
const reco::Track * getTrack()
Definition: L1Track.h:19
#define M_PI
void fill_dxdz(char charge, double abscissa, double slopex, double chi2, int dof)
double global_residual() const
const std::vector< DetId > chamberIds() const
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:646
align::GlobalPoint global_stubpos()
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
MuonChamberResidual * chamberResidual(DetId chamberId, int type)
double global_resslope() const

Member Data Documentation

◆ m_allowTIDTEC

bool AlignmentMonitorMuonSystemMap1D::m_allowTIDTEC
private

Definition at line 65 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_counter_13numhits

long AlignmentMonitorMuonSystemMap1D::m_counter_13numhits
private

◆ m_counter_2numhits

long AlignmentMonitorMuonSystemMap1D::m_counter_2numhits
private

◆ m_counter_csc

long AlignmentMonitorMuonSystemMap1D::m_counter_csc
private

◆ m_counter_cscnumhits

long AlignmentMonitorMuonSystemMap1D::m_counter_cscnumhits
private

◆ m_counter_dt

long AlignmentMonitorMuonSystemMap1D::m_counter_dt
private

◆ m_counter_event

long AlignmentMonitorMuonSystemMap1D::m_counter_event
private

Definition at line 76 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by afterAlignment(), book(), and event().

◆ m_counter_track

long AlignmentMonitorMuonSystemMap1D::m_counter_track
private

Definition at line 77 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by afterAlignment(), book(), and event().

◆ m_counter_trackdxy

long AlignmentMonitorMuonSystemMap1D::m_counter_trackdxy
private

Definition at line 79 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by afterAlignment(), book(), and event().

◆ m_counter_trackmoment

long AlignmentMonitorMuonSystemMap1D::m_counter_trackmoment
private

Definition at line 78 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by afterAlignment(), book(), and event().

◆ m_counter_trackokay

long AlignmentMonitorMuonSystemMap1D::m_counter_trackokay
private

◆ m_createNtuple

bool AlignmentMonitorMuonSystemMap1D::m_createNtuple
private

◆ m_cscnt

TTree* AlignmentMonitorMuonSystemMap1D::m_cscnt
private

◆ m_CSCvsphi_me

MuonSystemMapPlot1D* AlignmentMonitorMuonSystemMap1D::m_CSCvsphi_me[2][4][3]
private

Definition at line 116 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_CSCvsr_me

MuonSystemMapPlot1D* AlignmentMonitorMuonSystemMap1D::m_CSCvsr_me[2][4][36]
private

Definition at line 114 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_doCSC

bool AlignmentMonitorMuonSystemMap1D::m_doCSC
private

Definition at line 71 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_doDT

bool AlignmentMonitorMuonSystemMap1D::m_doDT
private

Definition at line 70 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_DTvsphi_station

MuonSystemMapPlot1D* AlignmentMonitorMuonSystemMap1D::m_DTvsphi_station[4][5]
private

Definition at line 115 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_DTvsz_station

MuonSystemMapPlot1D* AlignmentMonitorMuonSystemMap1D::m_DTvsz_station[4][14]
private

Definition at line 113 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_esTokenBuilder

const MuonResidualsFromTrack::BuilderToken AlignmentMonitorMuonSystemMap1D::m_esTokenBuilder
private

Definition at line 54 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenDetId

const edm::ESGetToken<DetIdAssociator, DetIdAssociatorRecord> AlignmentMonitorMuonSystemMap1D::m_esTokenDetId
private

Definition at line 51 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenGBTGeom

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> AlignmentMonitorMuonSystemMap1D::m_esTokenGBTGeom
private

Definition at line 50 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenMF

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> AlignmentMonitorMuonSystemMap1D::m_esTokenMF
private

Definition at line 53 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenProp

const edm::ESGetToken<Propagator, TrackingComponentsRecord> AlignmentMonitorMuonSystemMap1D::m_esTokenProp
private

Definition at line 52 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_id

MyCSCDetId AlignmentMonitorMuonSystemMap1D::m_id
private

◆ m_maxDxy

double AlignmentMonitorMuonSystemMap1D::m_maxDxy
private

Definition at line 62 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_maxTrackerRedChi2

double AlignmentMonitorMuonSystemMap1D::m_maxTrackerRedChi2
private

Definition at line 64 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_maxTrackP

double AlignmentMonitorMuonSystemMap1D::m_maxTrackP
private

Definition at line 61 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_maxTrackPt

double AlignmentMonitorMuonSystemMap1D::m_maxTrackPt
private

Definition at line 59 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_minCSCHits

int AlignmentMonitorMuonSystemMap1D::m_minCSCHits
private

Definition at line 69 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minDT13Hits

int AlignmentMonitorMuonSystemMap1D::m_minDT13Hits
private

Definition at line 67 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minDT2Hits

int AlignmentMonitorMuonSystemMap1D::m_minDT2Hits
private

Definition at line 68 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minNCrossedChambers

int AlignmentMonitorMuonSystemMap1D::m_minNCrossedChambers
private

Definition at line 66 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minTrackerHits

int AlignmentMonitorMuonSystemMap1D::m_minTrackerHits
private

Definition at line 63 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minTrackP

double AlignmentMonitorMuonSystemMap1D::m_minTrackP
private

Definition at line 60 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_minTrackPt

double AlignmentMonitorMuonSystemMap1D::m_minTrackPt
private

Definition at line 58 of file AlignmentMonitorMuonSystemMap1D.cc.

◆ m_muonCollectionTag

edm::InputTag AlignmentMonitorMuonSystemMap1D::m_muonCollectionTag
private

Definition at line 57 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_plots

std::vector<MuonSystemMapPlot1D *> AlignmentMonitorMuonSystemMap1D::m_plots
private

Definition at line 118 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book().

◆ m_re

MyResidual AlignmentMonitorMuonSystemMap1D::m_re
private

◆ m_run

UInt_t AlignmentMonitorMuonSystemMap1D::m_run
private

◆ m_tr

MyTrack AlignmentMonitorMuonSystemMap1D::m_tr
private

◆ m_useStubPosition

bool AlignmentMonitorMuonSystemMap1D::m_useStubPosition
private

Definition at line 72 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().