CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
AlignmentMonitorGeneric Class Reference

#include <AlignmentMonitorGeneric.h>

Inheritance diagram for AlignmentMonitorGeneric:
AlignmentMonitorBase

Public Member Functions

 AlignmentMonitorGeneric (const edm::ParameterSet &)
 
void book () override
 Book or retrieve histograms; MUST be reimplemented. More...
 
void event (const edm::Event &, const edm::EventSetup &, const ConstTrajTrackPairCollection &) override
 Called for each event (by "run()"): may be reimplemented. More...
 
- Public Member Functions inherited from AlignmentMonitorBase
virtual void afterAlignment ()
 
 AlignmentMonitorBase (const edm::ParameterSet &cfg, std::string name)
 Constructor. More...
 
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...
 
void startingNewLoop ()
 Called at beginning of loop: don't reimplement. More...
 
virtual ~AlignmentMonitorBase ()
 Destructor. More...
 

Private Types

typedef std::vector< TH1F * > Hist1Ds
 

Private Attributes

std::map< const Alignable *, Hist1Dsm_resHists
 
Hist1Ds m_trkHists
 

Static Private Attributes

static const unsigned int nBin_ = 50
 

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 28 of file AlignmentMonitorGeneric.h.

Member Typedef Documentation

◆ Hist1Ds

typedef std::vector<TH1F*> AlignmentMonitorGeneric::Hist1Ds
private

Definition at line 29 of file AlignmentMonitorGeneric.h.

Constructor & Destructor Documentation

◆ AlignmentMonitorGeneric()

AlignmentMonitorGeneric::AlignmentMonitorGeneric ( const edm::ParameterSet cfg)

Definition at line 11 of file AlignmentMonitorGeneric.cc.

12  : AlignmentMonitorBase(cfg, "AlignmentMonitorGeneric") {}

Member Function Documentation

◆ book()

void AlignmentMonitorGeneric::book ( )
overridevirtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 14 of file AlignmentMonitorGeneric.cc.

14  {
15  std::vector<std::string> residNames; // names of residual histograms
16 
17  residNames.push_back("x hit residuals pos track");
18  residNames.push_back("x hit residuals neg track");
19  residNames.push_back("y hit residuals pos track");
20  residNames.push_back("y hit residuals neg track");
21 
22  auto alignableObjectId = AlignableObjectId::commonObjectIdProvider(pTracker(), pMuon());
23 
24  const auto& alignables = pStore()->alignables();
25 
26  unsigned int nAlignable = alignables.size();
27  unsigned int nResidName = residNames.size();
28 
29  for (unsigned int i = 0; i < nAlignable; ++i) {
30  const Alignable* ali = alignables[i];
31 
32  Hist1Ds& hists = m_resHists[ali];
33 
34  hists.resize(nResidName, nullptr);
35 
36  align::ID id = ali->id();
38 
39  for (unsigned int n = 0; n < nResidName; ++n) {
40  const std::string& name = residNames[n];
41 
42  TString histName(name.c_str());
43  histName += Form("_%s_%d", alignableObjectId.idToString(type), id);
44  histName.ReplaceAll(" ", "");
45 
46  TString histTitle(name.c_str());
47  histTitle += Form(" for %s with ID %d (subdet %d)", alignableObjectId.idToString(type), id, DetId(id).subdetId());
48 
49  hists[n] = book1D(std::string("/iterN/") + std::string(name) + std::string("/"),
50  std::string(histName.Data()),
51  std::string(histTitle.Data()),
52  nBin_,
53  -5.,
54  5.);
55  }
56  }
57 
58  m_trkHists.resize(6, nullptr);
59 
60  m_trkHists[0] = book1D("/iterN/", "pt", "track p_{t} (GeV)", nBin_, 0.0, 100.0);
61  m_trkHists[1] = book1D("/iterN/", "eta", "track #eta", nBin_, -3.0, 3.0);
62  m_trkHists[2] = book1D("/iterN/", "phi", "track #phi", nBin_, -M_PI, M_PI);
63  m_trkHists[3] = book1D("/iterN/", "d0", "track d0 (cm)", nBin_, -0.02, 0.02);
64  m_trkHists[4] = book1D("/iterN/", "dz", "track dz (cm)", nBin_, -20.0, 20.0);
65  m_trkHists[5] = book1D("/iterN/", "chi2", "track #chi^{2}/dof", nBin_, 0.0, 20.0);
66 }

References Alignable::alignableObjectId(), AlignmentParameterStore::alignables(), AlignmentMonitorBase::book1D(), AlignableObjectId::commonObjectIdProvider(), compare::hists, B2GTnPMonitor_cfi::histTitle, mps_fire::i, triggerObjects_cff::id, Alignable::id(), M_PI, m_resHists, m_trkHists, dqmiodumpmetadata::n, Skims_PA_cff::name, nBin_, AlignmentMonitorBase::pMuon(), AlignmentMonitorBase::pStore(), AlignmentMonitorBase::pTracker(), AlCaHLTBitMon_QueryRunRegistry::string, and DetId::subdetId().

◆ event()

void AlignmentMonitorGeneric::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 68 of file AlignmentMonitorGeneric.cc.

70  {
71  TrajectoryStateCombiner tsoscomb;
72 
73  for (unsigned int t = 0; t < tracks.size(); ++t) {
74  const reco::Track* track = tracks[t].second;
75 
76  float charge = tracks[t].second->charge();
77 
78  const std::vector<TrajectoryMeasurement>& meass = tracks[t].first->measurements();
79 
80  for (unsigned int m = 0; m < meass.size(); ++m) {
81  const TrajectoryMeasurement& meas = meass[m];
82  const TransientTrackingRecHit& hit = *meas.recHit();
83 
84  if (hit.isValid()) {
85  const Alignable* ali = pNavigator()->alignableFromDetId(hit.geographicalId());
86 
87  while (ali) {
88  std::map<const Alignable*, Hist1Ds>::iterator h = m_resHists.find(ali);
89  if (h != m_resHists.end()) {
91 
92  align::LocalVector res = tsos.localPosition() - hit.localPosition();
93  LocalError err1 = tsos.localError().positionError();
94  LocalError err2 = hit.localPositionError(); // CPE+APE
95 
96  // subtract APEs from err2 (if existing) from covariance matrix
97  auto det = static_cast<const TrackerGeomDet*>(hit.det());
98  const auto localAPE = det->localAlignmentError();
99  if (localAPE.valid()) {
100  err2 = LocalError(err2.xx() - localAPE.xx(), err2.xy() - localAPE.xy(), err2.yy() - localAPE.yy());
101  }
102 
103  float errX = std::sqrt(err1.xx() + err2.xx());
104  float errY = std::sqrt(err1.yy() + err2.yy());
105 
106  h->second[charge > 0 ? 0 : 1]->Fill(res.x() / errX);
107  h->second[charge > 0 ? 2 : 3]->Fill(res.y() / errY);
108  }
109  ali = ali->mother();
110  }
111  }
112  }
113 
114  m_trkHists[0]->Fill(track->pt());
115  m_trkHists[1]->Fill(track->eta());
116  m_trkHists[2]->Fill(track->phi());
117  m_trkHists[3]->Fill(track->d0());
118  m_trkHists[4]->Fill(track->dz());
119  m_trkHists[5]->Fill(track->normalizedChi2());
120  }
121 }

References AlignableNavigator::alignableFromDetId(), TrajectoryMeasurement::backwardPredictedState(), ALCARECOTkAlJpsiMuMu_cff::charge, fftjetvertexadder_cfi::errX, fftjetvertexadder_cfi::errY, TrajectoryMeasurement::forwardPredictedState(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), visualization-live-secondInstance_cfg::m, m_resHists, m_trkHists, Alignable::mother(), AlignmentMonitorBase::pNavigator(), LocalTrajectoryError::positionError(), TrajectoryMeasurement::recHit(), mathSSE::sqrt(), submitPVValidationJobs::t, HLT_FULL_cff::track, PDWG_EXOHSCP_cff::tracks, LocalError::xx(), LocalError::xy(), and LocalError::yy().

Referenced by Types.EventID::cppID().

Member Data Documentation

◆ m_resHists

std::map<const Alignable*, Hist1Ds> AlignmentMonitorGeneric::m_resHists
private

Definition at line 43 of file AlignmentMonitorGeneric.h.

Referenced by book(), and event().

◆ m_trkHists

Hist1Ds AlignmentMonitorGeneric::m_trkHists
private

Definition at line 41 of file AlignmentMonitorGeneric.h.

Referenced by book(), and event().

◆ nBin_

const unsigned int AlignmentMonitorGeneric::nBin_ = 50
staticprivate

Definition at line 39 of file AlignmentMonitorGeneric.h.

Referenced by book().

Vector3DBase
Definition: Vector3DBase.h:8
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
AlignmentMonitorBase::AlignmentMonitorBase
AlignmentMonitorBase(const edm::ParameterSet &cfg, std::string name)
Constructor.
Definition: AlignmentMonitorBase.cc:20
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
AlignmentMonitorGeneric::nBin_
static const unsigned int nBin_
Definition: AlignmentMonitorGeneric.h:39
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
AlignmentParameterStore::alignables
const align::Alignables & alignables(void) const
get all alignables
Definition: AlignmentParameterStore.h:47
LocalTrajectoryError::positionError
LocalError positionError() const
Definition: LocalTrajectoryError.h:81
LocalError::xy
float xy() const
Definition: LocalError.h:23
fftjetvertexadder_cfi.errY
errY
Definition: fftjetvertexadder_cfi.py:38
AlignmentMonitorBase::pTracker
AlignableTracker * pTracker()
Definition: AlignmentMonitorBase.h:111
Alignable
Definition: Alignable.h:27
AlignableObjectId::commonObjectIdProvider
static AlignableObjectId commonObjectIdProvider(const AlignableObjectId &, const AlignableObjectId &)
Definition: AlignableObjectId.cc:320
AlignmentMonitorBase::pStore
AlignmentParameterStore * pStore()
Definition: AlignmentMonitorBase.h:113
AlignmentMonitorGeneric::m_trkHists
Hist1Ds m_trkHists
Definition: AlignmentMonitorGeneric.h:41
compare.hists
hists
Definition: compare.py:319
AlignmentMonitorBase::pNavigator
AlignableNavigator * pNavigator()
Definition: AlignmentMonitorBase.h:114
DetId
Definition: DetId.h:17
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrajectoryMeasurement::backwardPredictedState
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
Definition: TrajectoryMeasurement.h:179
LocalError::xx
float xx() const
Definition: LocalError.h:22
Alignable::alignableObjectId
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
TrajectoryMeasurement::forwardPredictedState
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
Definition: TrajectoryMeasurement.h:177
AlignmentMonitorGeneric::Hist1Ds
std::vector< TH1F * > Hist1Ds
Definition: AlignmentMonitorGeneric.h:29
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
h
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
align::StructureType
StructureType
Definition: StructureType.h:16
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
TrajectoryStateCombiner
Definition: TrajectoryStateCombiner.h:13
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
align::ID
uint32_t ID
Definition: Definitions.h:24
B2GTnPMonitor_cfi.histTitle
histTitle
Definition: B2GTnPMonitor_cfi.py:112
LocalError
Definition: LocalError.h:12
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
Alignable::id
align::ID id() const
Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit).
Definition: Alignable.h:180
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
res
Definition: Electron.h:6
looper.cfg
cfg
Definition: looper.py:297
TrackingRecHit
Definition: TrackingRecHit.h:21
AlignmentMonitorBase::book1D
TH1F * book1D(std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)
Definition: AlignmentMonitorBase.cc:107
TrajectoryMeasurement::recHit
ConstRecHitPointer const & recHit() const
Definition: TrajectoryMeasurement.h:190
AlignableNavigator::alignableFromDetId
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
Definition: AlignableNavigator.cc:91
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
TrajectoryStateOnSurface::localError
const LocalTrajectoryError & localError() const
Definition: TrajectoryStateOnSurface.h:77
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
fftjetvertexadder_cfi.errX
errX
Definition: fftjetvertexadder_cfi.py:37
LocalError::yy
float yy() const
Definition: LocalError.h:24
AlignmentMonitorBase::pMuon
AlignableMuon * pMuon()
Definition: AlignmentMonitorBase.h:112
AlignmentMonitorGeneric::m_resHists
std::map< const Alignable *, Hist1Ds > m_resHists
Definition: AlignmentMonitorGeneric.h:43
hit
Definition: SiStripHitEffFromCalibTree.cc:88
Alignable::mother
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91