CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static 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=default
 
- 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...
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

std::string num02d (int num)
 

Private Attributes

const edm::EDGetTokenT< reco::BeamSpotbsToken_
 
const 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
 
const bool m_createNtuple
 
TTree * m_cscnt
 
MuonSystemMapPlot1Dm_CSCvsphi_me [2][4][3]
 
MuonSystemMapPlot1Dm_CSCvsr_me [2][4][36]
 
const bool m_doCSC
 
const 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
 
const double m_maxDxy
 
const double m_maxTrackerRedChi2
 
const double m_maxTrackP
 
const double m_maxTrackPt
 
const int m_minCSCHits
 
const int m_minDT13Hits
 
const int m_minDT2Hits
 
const int m_minNCrossedChambers
 
const int m_minTrackerHits
 
const double m_minTrackP
 
const double m_minTrackPt
 
const edm::InputTag m_muonCollectionTag
 
std::vector< MuonSystemMapPlot1D * > m_plots
 
MyResidual m_re
 
UInt_t m_run
 
MyTrack m_tr
 
const bool m_useStubPosition
 
const edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 

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 35 of file AlignmentMonitorMuonSystemMap1D.cc.

Constructor & Destructor Documentation

◆ AlignmentMonitorMuonSystemMap1D()

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

Definition at line 156 of file AlignmentMonitorMuonSystemMap1D.cc.

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

158  : AlignmentMonitorBase(cfg, iC, "AlignmentMonitorMuonSystemMap1D"),
160  m_esTokenDetId(iC.esConsumes(edm::ESInputTag("", "MuonDetIdAssociator"))),
161  m_esTokenProp(iC.esConsumes(edm::ESInputTag("", "SteppingHelixPropagatorAny"))),
162  m_esTokenMF(iC.esConsumes()),
164  m_muonCollectionTag(cfg.getParameter<edm::InputTag>("muonCollectionTag")),
165  m_minTrackPt(cfg.getParameter<double>("minTrackPt")),
166  m_maxTrackPt(cfg.getParameter<double>("maxTrackPt")),
167  m_minTrackP(cfg.getParameter<double>("minTrackP")),
168  m_maxTrackP(cfg.getParameter<double>("maxTrackP")),
169  m_maxDxy(cfg.getParameter<double>("maxDxy")),
170  m_minTrackerHits(cfg.getParameter<int>("minTrackerHits")),
171  m_maxTrackerRedChi2(cfg.getParameter<double>("maxTrackerRedChi2")),
172  m_allowTIDTEC(cfg.getParameter<bool>("allowTIDTEC")),
173  m_minNCrossedChambers(cfg.getParameter<int>("minNCrossedChambers")),
174  m_minDT13Hits(cfg.getParameter<int>("minDT13Hits")),
175  m_minDT2Hits(cfg.getParameter<int>("minDT2Hits")),
176  m_minCSCHits(cfg.getParameter<int>("minCSCHits")),
177  m_doDT(cfg.getParameter<bool>("doDT")),
178  m_doCSC(cfg.getParameter<bool>("doCSC")),
179  m_useStubPosition(cfg.getParameter<bool>("useStubPosition")),
180  m_createNtuple(cfg.getParameter<bool>("createNtuple")),
183  if (m_createNtuple) {
185  m_cscnt = fs->make<TTree>("mualNtuple", "mualNtuple");
186  m_cscnt->Branch("id", &m_id.e, "e/S:s:r:c:t");
187  m_cscnt->Branch("tr", &m_tr.q, "q/I:pt/F:pz");
188  m_cscnt->Branch("re", &m_re.res, "res/F:slope:rho:phi:z");
189  m_cscnt->Branch("run", &m_run, "run/i");
190  }
191 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const edm::InputTag m_beamSpotTag
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_esTokenMF
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > m_esTokenDetId

◆ ~AlignmentMonitorMuonSystemMap1D()

AlignmentMonitorMuonSystemMap1D::~AlignmentMonitorMuonSystemMap1D ( )
overridedefault

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 517 of file AlignmentMonitorMuonSystemMap1D.cc.

References 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.

517  {
518  edm::LogVerbatim("AlignmentMuonSystemMap") << "AlignmentMonitorMuonSystemMap1D counters:";
519  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_event = " << m_counter_event;
520  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_track = " << m_counter_track;
521  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_trackppt = " << m_counter_trackmoment;
522  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_trackdxy = " << m_counter_trackdxy;
523  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_trackokay = " << m_counter_trackokay;
524  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_dt = " << m_counter_dt;
525  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_13numhits = " << m_counter_13numhits;
526  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_2numhits = " << m_counter_2numhits;
527  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_csc = " << m_counter_csc;
528  edm::LogVerbatim("AlignmentMuonSystemMap") << " monitor m_counter_cscnumhits = " << m_counter_cscnumhits;
529 }
Log< level::Info, true > LogVerbatim

◆ book()

void AlignmentMonitorMuonSystemMap1D::book ( )
overridevirtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 223 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, nano_mu_digi_cff::sector, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, to_string(), and makeMuonMisalignmentScenario::wheel.

223  {
224  std::string wheel_label[5] = {"A", "B", "C", "D", "E"};
225 
226  for (unsigned char station = 1; station <= 4; station++) {
227  std::string s_station = std::to_string(station);
228 
229  bool do_y = true;
230  if (station == 4)
231  do_y = false;
232 
233  // *** DT ***
234  if (m_doDT)
235  for (int sector = 1; sector <= 14; sector++) {
236  if ((station < 4 && sector <= 12) || station == 4) {
237  m_DTvsz_station[station - 1][sector - 1] = new MuonSystemMapPlot1D(
238  "DTvsz_st" + s_station + "sec" + num02d(sector), this, 60, -660., 660., do_y, false);
239  m_plots.push_back(m_DTvsz_station[station - 1][sector - 1]);
240  }
241  }
242 
243  if (m_doDT)
244  for (int wheel = -2; wheel <= 2; wheel++) {
245  m_DTvsphi_station[station - 1][wheel + 2] = new MuonSystemMapPlot1D(
246  "DTvsphi_st" + s_station + "wh" + wheel_label[wheel + 2], this, 180, -M_PI, M_PI, do_y, false);
247  m_plots.push_back(m_DTvsphi_station[station - 1][wheel + 2]);
248  }
249 
250  // *** CSC ***
251  if (m_doCSC)
252  for (int endcap = 1; endcap <= 2; endcap++) {
253  std::string s_endcap("m");
254  if (endcap == 1)
255  s_endcap = "p";
256 
257  for (int chamber = 1; chamber <= 36; chamber++) {
258  m_CSCvsr_me[endcap - 1][station - 1][chamber - 1] = new MuonSystemMapPlot1D(
259  "CSCvsr_me" + s_endcap + s_station + "ch" + num02d(chamber), this, 60, 100., 700., false, false);
260  m_plots.push_back(m_CSCvsr_me[endcap - 1][station - 1][chamber - 1]);
261  }
262 
263  for (int ring = 1; ring <= 3; ring++) // the ME1/a (ring4) is not independent from ME1/b (ring1)
264  {
265  std::string s_ring = std::to_string(ring);
266  if ((station > 1 && ring <= 2) || station == 1) {
267  m_CSCvsphi_me[endcap - 1][station - 1][ring - 1] =
268  new MuonSystemMapPlot1D("CSCvsphi_me" + s_endcap + s_station + s_ring,
269  this,
270  180,
271  -M_PI / 180. * 5.,
272  M_PI * (2. - 5. / 180.),
273  false,
274  true);
275  m_plots.push_back(m_CSCvsphi_me[endcap - 1][station - 1][ring - 1]);
276  }
277  }
278  } // endcaps
279  } // stations
280 
281  m_counter_event = 0;
282  m_counter_track = 0;
284  m_counter_trackdxy = 0;
286  m_counter_dt = 0;
288  m_counter_2numhits = 0;
289  m_counter_csc = 0;
291 }
MuonSystemMapPlot1D * m_CSCvsr_me[2][4][36]
MuonSystemMapPlot1D * m_CSCvsphi_me[2][4][3]
static std::string to_string(const XMLCh *ch)
#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 293 of file AlignmentMonitorMuonSystemMap1D.cc.

References isoTrack_cff::beamSpot, bsToken_, edm::EventSetup::getData(), edm::EventSetup::getHandle(), iEvent, edm::InputTag::label(), 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_2024v14_cff::magneticField, HLT_2024v14_cff::muon, DiMuonV_cfg::muons, muonToken_, AlignmentMonitorBase::pNavigator(), processMuonResidualsFromTrack(), DiDispStaMuonMonitor_cfi::pt, and HLT_2024v14_cff::track.

Referenced by Types.EventID::cppID().

295  {
296  m_counter_event++;
297 
299 
300  const GlobalTrackingGeometry *globalGeometry = &iSetup.getData(m_esTokenGBTGeom);
301  const DetIdAssociator *muonDetIdAssociator_ = &iSetup.getData(m_esTokenDetId);
302  const Propagator *prop = &iSetup.getData(m_esTokenProp);
304  auto builder = iSetup.getHandle(m_esTokenBuilder);
305 
306  if (m_muonCollectionTag.label().empty()) // use trajectories
307  {
308  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end();
309  ++trajtrack) {
310  m_counter_track++;
311  const Trajectory *traj = (*trajtrack).first;
312  const reco::Track *track = (*trajtrack).second;
313 
314  if (m_minTrackPt < track->pt() && track->pt() < m_maxTrackPt && m_minTrackP < track->p() &&
315  track->p() < m_maxTrackP) {
317  if (fabs(track->dxy(beamSpot->position())) < m_maxDxy) {
319 
320  MuonResidualsFromTrack muonResidualsFromTrack(
321  builder, magneticField, globalGeometry, muonDetIdAssociator_, prop, traj, track, pNavigator(), 1000.);
322  processMuonResidualsFromTrack(muonResidualsFromTrack, iEvent);
323  }
324  } // end if track has acceptable momentum
325  } // end loop over tracks
326  } else {
328 
329  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
330  if (!(muon->isTrackerMuon() && muon->innerTrack().isNonnull()))
331  continue;
332 
333  m_counter_track++;
334 
335  if (m_minTrackPt < muon->pt() && muon->pt() < m_maxTrackPt && m_minTrackP < muon->p() &&
336  muon->p() < m_maxTrackP) {
338  if (fabs(muon->innerTrack()->dxy(beamSpot->position())) < m_maxDxy) {
340 
341  MuonResidualsFromTrack muonResidualsFromTrack(globalGeometry, &(*muon), pNavigator(), 100.);
342  processMuonResidualsFromTrack(muonResidualsFromTrack, iEvent);
343  }
344  }
345  }
346  }
347 }
AlignableNavigator * pNavigator()
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > m_esTokenGBTGeom
std::string const & label() const
Definition: InputTag.h:36
const edm::ESGetToken< Propagator, TrackingComponentsRecord > m_esTokenProp
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
int iEvent
Definition: GenABIO.cc:224
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const MuonResidualsFromTrack::BuilderToken m_esTokenBuilder
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_esTokenMF
void processMuonResidualsFromTrack(MuonResidualsFromTrack &mrft, const edm::Event &iEvent)
const edm::ESGetToken< DetIdAssociator, DetIdAssociatorRecord > m_esTokenDetId

◆ fillDescriptions()

void AlignmentMonitorMuonSystemMap1D::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 193 of file AlignmentMonitorMuonSystemMap1D.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

193  {
195  desc.add<edm::InputTag>("muonCollectionTag", edm::InputTag(""));
196  desc.addUntracked<edm::InputTag>("beamSpotTag", edm::InputTag("offlineBeamSpot"));
197  desc.add<double>("minTrackPt", 100.);
198  desc.add<double>("maxTrackPt", 200.);
199  desc.add<double>("minTrackP", 0.);
200  desc.add<double>("maxTrackP", 99999.);
201  desc.add<double>("maxDxy", 100.);
202  desc.add<int>("minTrackerHits", 15);
203  desc.add<double>("maxTrackerRedChi2", 10.);
204  desc.add<bool>("allowTIDTEC", true);
205  desc.add<int>("minNCrossedChambers", 3);
206  desc.add<int>("minDT13Hits", 8);
207  desc.add<int>("minDT2Hits", 4);
208  desc.add<int>("minCSCHits", 6);
209  desc.add<bool>("doDT", true);
210  desc.add<bool>("doCSC", true);
211  desc.add<bool>("useStubPosition", false);
212  desc.add<bool>("createNtuple", false);
213  descriptions.add("alignmentMonitorMuonSystemMap1D", desc);
214 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ num02d()

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

Definition at line 216 of file AlignmentMonitorMuonSystemMap1D.cc.

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

Referenced by book().

216  {
217  assert(num >= 0 && num < 100);
218  char tmp[4];
219  sprintf(tmp, "%02d", num);
220  return std::string(tmp);
221 }
assert(be >=bs)
tmp
align.sh
Definition: createJobs.py:716

◆ processMuonResidualsFromTrack()

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

Definition at line 349 of file AlignmentMonitorMuonSystemMap1D.cc.

References cms::cuda::assert(), Matriplex::atan2(), relativeConstraints::chamber, dtT0FillChamberFromDBCorrection_cfg::chamberId, MuonResidualsFromTrack::chamberIds(), MuonResidualsFromTrack::chamberResidual(), ALCARECOTkAlJpsiMuMu_cff::charge, reco::TrackBase::charge(), isoTrack_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(), EcalPhiSymFlatTableProducers_cfi::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, nano_mu_digi_cff::sector, 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().

350  {
351  if (mrft.trackerNumHits() < m_minTrackerHits)
352  return;
353  if (!m_allowTIDTEC && mrft.contains_TIDTEC())
354  return;
355  if (mrft.normalizedChi2() > m_maxTrackerRedChi2)
356  return;
357 
358  int nMuChambers = 0;
359  std::vector<DetId> chamberIds = mrft.chamberIds();
360  for (unsigned ch = 0; ch < chamberIds.size(); ch++)
361  if (chamberIds[ch].det() == DetId::Muon)
362  nMuChambers++;
363  if (nMuChambers < m_minNCrossedChambers)
364  return;
365 
366  char charge = (mrft.getTrack()->charge() > 0 ? 1 : -1);
367  // double qoverpt = track->charge() / track->pt();
368  // double qoverpz = track->charge() / track->pz();
369 
371 
372  for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end(); ++chamberId) {
373  if (chamberId->det() != DetId::Muon)
374  continue;
375 
376  if (m_doDT && chamberId->subdetId() == MuonSubdetId::DT) {
379  DTChamberId id(chamberId->rawId());
380 
381  m_counter_dt++;
382 
383  if (id.station() < 4 && dt13 != nullptr && dt13->numHits() >= m_minDT13Hits && dt2 != nullptr &&
384  dt2->numHits() >= m_minDT2Hits && (dt2->chi2() / double(dt2->ndof())) < 2.0) {
386 
387  double residual = dt13->global_residual();
388  double resslope = dt13->global_resslope();
389  double chi2 = dt13->chi2();
390  int dof = dt13->ndof();
391 
392  align::GlobalPoint gpos;
393  if (m_useStubPosition)
394  gpos = dt13->global_stubpos();
395  else
396  gpos = dt13->global_trackpos();
397  double phi = atan2(gpos.y(), gpos.x());
398  double z = gpos.z();
399 
400  assert(1 <= id.sector() && id.sector() <= 14);
401 
402  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_x(charge, z, residual, chi2, dof);
403  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_dxdz(charge, z, resslope, chi2, dof);
404  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_x(charge, phi, residual, chi2, dof);
405  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_dxdz(charge, phi, resslope, chi2, dof);
406 
408 
409  residual = dt2->global_residual();
410  resslope = dt2->global_resslope();
411  chi2 = dt2->chi2();
412  dof = dt2->ndof();
413 
414  if (m_useStubPosition)
415  gpos = dt2->global_stubpos();
416  else
417  gpos = dt2->global_trackpos();
418  phi = atan2(gpos.y(), gpos.x());
419  z = gpos.z();
420 
421  assert(1 <= id.sector() && id.sector() <= 14);
422 
423  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_y(charge, z, residual, chi2, dof);
424  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_dydz(charge, z, resslope, chi2, dof);
425  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_y(charge, phi, residual, chi2, dof);
426  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_dydz(charge, phi, resslope, chi2, dof);
427  }
428 
429  if (id.station() == 4 && dt13 != nullptr && dt13->numHits() >= m_minDT13Hits) {
431 
432  double residual = dt13->global_residual();
433  double resslope = dt13->global_resslope();
434  double chi2 = dt13->chi2();
435  int dof = dt13->ndof();
436 
437  align::GlobalPoint gpos;
438  if (m_useStubPosition)
439  gpos = dt13->global_stubpos();
440  else
441  gpos = dt13->global_trackpos();
442  double phi = atan2(gpos.y(), gpos.x());
443  double z = gpos.z();
444 
445  assert(1 <= id.sector() && id.sector() <= 14);
446 
447  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_x(charge, z, residual, chi2, dof);
448  m_DTvsz_station[id.station() - 1][id.sector() - 1]->fill_dxdz(charge, z, resslope, chi2, dof);
449  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_x(charge, phi, residual, chi2, dof);
450  m_DTvsphi_station[id.station() - 1][id.wheel() + 2]->fill_dxdz(charge, phi, resslope, chi2, dof);
451  }
452  }
453 
454  else if (m_doCSC && chamberId->subdetId() == MuonSubdetId::CSC) {
456  CSCDetId id(chamberId->rawId());
457 
458  int ring = id.ring();
459  if (id.ring() == 4)
460  ring = 1; // combine ME1/a + ME1/b
461 
462  m_counter_csc++;
463 
464  if (csc != nullptr && csc->numHits() >= m_minCSCHits) {
466 
467  double residual = csc->global_residual();
468  double resslope = csc->global_resslope();
469  double chi2 = csc->chi2();
470  int dof = csc->ndof();
471 
472  align::GlobalPoint gpos;
473  if (m_useStubPosition)
474  gpos = csc->global_stubpos();
475  else
476  gpos = csc->global_trackpos();
477  double phi = atan2(gpos.y(), gpos.x());
478  // start phi from -5deg
479  if (phi < -M_PI / 180. * 5.)
480  phi += 2. * M_PI;
481  double R = sqrt(pow(gpos.x(), 2) + pow(gpos.y(), 2));
482 
483  int chamber = id.chamber() - 1;
484  if (id.station() > 1 && ring == 1)
485  chamber *= 2;
486 
487  assert(1 <= id.endcap() && id.endcap() <= 2 && 0 <= chamber && chamber <= 35);
488 
489  if (R > 0.)
490  m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_x_1d(residual / R, chi2, dof);
491 
492  m_CSCvsr_me[id.endcap() - 1][id.station() - 1][chamber]->fill_x(charge, R, residual, chi2, dof);
493  m_CSCvsr_me[id.endcap() - 1][id.station() - 1][chamber]->fill_dxdz(charge, R, resslope, chi2, dof);
494  m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_x(charge, phi, residual, chi2, dof);
495  m_CSCvsphi_me[id.endcap() - 1][id.station() - 1][ring - 1]->fill_dxdz(charge, phi, resslope, chi2, dof);
496 
497  if (m_createNtuple && chi2 > 0.) { // && TMath::Prob(chi2, dof) < 0.95)
498  m_id.init(id);
499  m_tr.q = charge;
500  m_tr.pt = mrft.getTrack()->pt();
501  m_tr.pz = mrft.getTrack()->pz();
502  m_re.res = residual;
503  m_re.slope = resslope;
504  m_re.rho = R;
505  m_re.phi = phi;
506  m_re.z = gpos.z();
507  m_run = iEvent.id().run();
508  m_cscnt->Fill();
509  }
510  }
511  }
512 
513  //else { assert(false); }
514  } // end loop over chambers
515 }
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:23
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
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648
MuonChamberResidual * chamberResidual(DetId chamberId, int type)
double global_resslope() const

Member Data Documentation

◆ bsToken_

const edm::EDGetTokenT<reco::BeamSpot> AlignmentMonitorMuonSystemMap1D::bsToken_
private

Definition at line 76 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_allowTIDTEC

const bool AlignmentMonitorMuonSystemMap1D::m_allowTIDTEC
private

Definition at line 67 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 80 of file AlignmentMonitorMuonSystemMap1D.cc.

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

◆ m_counter_track

long AlignmentMonitorMuonSystemMap1D::m_counter_track
private

Definition at line 81 of file AlignmentMonitorMuonSystemMap1D.cc.

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

◆ m_counter_trackdxy

long AlignmentMonitorMuonSystemMap1D::m_counter_trackdxy
private

Definition at line 83 of file AlignmentMonitorMuonSystemMap1D.cc.

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

◆ m_counter_trackmoment

long AlignmentMonitorMuonSystemMap1D::m_counter_trackmoment
private

Definition at line 82 of file AlignmentMonitorMuonSystemMap1D.cc.

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

◆ m_counter_trackokay

long AlignmentMonitorMuonSystemMap1D::m_counter_trackokay
private

◆ m_createNtuple

const 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 120 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_CSCvsr_me

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

Definition at line 118 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_doCSC

const bool AlignmentMonitorMuonSystemMap1D::m_doCSC
private

Definition at line 73 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_doDT

const bool AlignmentMonitorMuonSystemMap1D::m_doDT
private

Definition at line 72 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_DTvsphi_station

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

Definition at line 119 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_DTvsz_station

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

Definition at line 117 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by book(), and processMuonResidualsFromTrack().

◆ m_esTokenBuilder

const MuonResidualsFromTrack::BuilderToken AlignmentMonitorMuonSystemMap1D::m_esTokenBuilder
private

Definition at line 56 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenDetId

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

Definition at line 53 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenGBTGeom

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

Definition at line 52 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenMF

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

Definition at line 55 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_esTokenProp

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

Definition at line 54 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_id

MyCSCDetId AlignmentMonitorMuonSystemMap1D::m_id
private

◆ m_maxDxy

const double AlignmentMonitorMuonSystemMap1D::m_maxDxy
private

Definition at line 64 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_maxTrackerRedChi2

const double AlignmentMonitorMuonSystemMap1D::m_maxTrackerRedChi2
private

Definition at line 66 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_maxTrackP

const double AlignmentMonitorMuonSystemMap1D::m_maxTrackP
private

Definition at line 63 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_maxTrackPt

const double AlignmentMonitorMuonSystemMap1D::m_maxTrackPt
private

Definition at line 61 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_minCSCHits

const int AlignmentMonitorMuonSystemMap1D::m_minCSCHits
private

Definition at line 71 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minDT13Hits

const int AlignmentMonitorMuonSystemMap1D::m_minDT13Hits
private

Definition at line 69 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minDT2Hits

const int AlignmentMonitorMuonSystemMap1D::m_minDT2Hits
private

Definition at line 70 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minNCrossedChambers

const int AlignmentMonitorMuonSystemMap1D::m_minNCrossedChambers
private

Definition at line 68 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minTrackerHits

const int AlignmentMonitorMuonSystemMap1D::m_minTrackerHits
private

Definition at line 65 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ m_minTrackP

const double AlignmentMonitorMuonSystemMap1D::m_minTrackP
private

Definition at line 62 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_minTrackPt

const double AlignmentMonitorMuonSystemMap1D::m_minTrackPt
private

Definition at line 60 of file AlignmentMonitorMuonSystemMap1D.cc.

◆ m_muonCollectionTag

const edm::InputTag AlignmentMonitorMuonSystemMap1D::m_muonCollectionTag
private

Definition at line 59 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().

◆ m_plots

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

Definition at line 122 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

const bool AlignmentMonitorMuonSystemMap1D::m_useStubPosition
private

Definition at line 74 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by processMuonResidualsFromTrack().

◆ muonToken_

const edm::EDGetTokenT<reco::MuonCollection> AlignmentMonitorMuonSystemMap1D::muonToken_
private

Definition at line 77 of file AlignmentMonitorMuonSystemMap1D.cc.

Referenced by event().