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

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

Definition at line 31 of file AlignmentMonitorGeneric.h.

Constructor & Destructor Documentation

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

Definition at line 11 of file AlignmentMonitorGeneric.cc.

11  :
12  AlignmentMonitorBase(cfg, "AlignmentMonitorGeneric")
13 {
14 }
AlignmentMonitorBase(const edm::ParameterSet &cfg, std::string name)
Constructor.

Member Function Documentation

void AlignmentMonitorGeneric::book ( )
overridevirtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 16 of file AlignmentMonitorGeneric.cc.

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

17 {
18  std::vector<std::string> residNames; // names of residual histograms
19 
20  residNames.push_back("x hit residuals pos track");
21  residNames.push_back("x hit residuals neg track");
22  residNames.push_back("y hit residuals pos track");
23  residNames.push_back("y hit residuals neg track");
24 
25 
26  auto alignableObjectId =
28 
29  const auto& alignables = pStore()->alignables();
30 
31  unsigned int nAlignable = alignables.size();
32  unsigned int nResidName = residNames.size();
33 
34  for (unsigned int i = 0; i < nAlignable; ++i)
35  {
36  const Alignable* ali = alignables[i];
37 
38  Hist1Ds& hists = m_resHists[ali];
39 
40  hists.resize(nResidName, nullptr);
41 
42  align::ID id = ali->id();
44 
45  for (unsigned int n = 0; n < nResidName; ++n)
46  {
47  const std::string& name = residNames[n];
48 
49  TString histName(name.c_str());
50  histName += Form("_%s_%d", alignableObjectId.idToString(type), id);
51  histName.ReplaceAll(" ", "");
52 
53  TString histTitle(name.c_str());
54  histTitle += Form(" for %s with ID %d (subdet %d)",
55  alignableObjectId.idToString(type),
56  id, DetId(id).subdetId());
57 
58  hists[n] = book1D(std::string("/iterN/") + std::string(name) + std::string("/"), std::string(histName.Data()), std::string(histTitle.Data()), nBin_, -5., 5.);
59  }
60  }
61 
62  m_trkHists.resize(6, nullptr);
63 
64  m_trkHists[0] = book1D("/iterN/", "pt" , "track p_{t} (GeV)" , nBin_, 0.0,100.0);
65  m_trkHists[1] = book1D("/iterN/", "eta" , "track #eta" , nBin_, - 3.0, 3.0);
66  m_trkHists[2] = book1D("/iterN/", "phi" , "track #phi" , nBin_, -M_PI, M_PI);
67  m_trkHists[3] = book1D("/iterN/", "d0" , "track d0 (cm)" , nBin_, -0.02, 0.02);
68  m_trkHists[4] = book1D("/iterN/", "dz" , "track dz (cm)" , nBin_, -20.0, 20.0);
69  m_trkHists[5] = book1D("/iterN/", "chi2", "track #chi^{2}/dof", nBin_, 0.0, 20.0);
70 
71 }
AlignableMuon * pMuon()
type
Definition: HCALResponse.h:21
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
AlignmentParameterStore * pStore()
std::map< const Alignable *, Hist1Ds > m_resHists
static AlignableObjectId commonObjectIdProvider(const AlignableObjectId &, const AlignableObjectId &)
uint32_t ID
Definition: Definitions.h:26
AlignableTracker * pTracker()
std::vector< TH1F * > Hist1Ds
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
TH1F * book1D(std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)
#define M_PI
Definition: DetId.h:18
static const unsigned int nBin_
const align::Alignables & alignables(void) const
get all alignables
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 73 of file AlignmentMonitorGeneric.cc.

References AlignableNavigator::alignableFromDetId(), TrajectoryMeasurement::backwardPredictedState(), ALCARECOTkAlJpsiMuMu_cff::charge, reco::TrackBase::d0(), DEFINE_EDM_PLUGIN, TrackingRecHit::det(), reco::TrackBase::dz(), fftjetvertexadder_cfi::errX, fftjetvertexadder_cfi::errY, reco::TrackBase::eta(), TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), TrackerGeomDet::localAlignmentError(), TrajectoryStateOnSurface::localError(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPosition(), TrackingRecHit::localPositionError(), funct::m, m_resHists, m_trkHists, Alignable::mother(), reco::TrackBase::normalizedChi2(), reco::TrackBase::phi(), AlignmentMonitorBase::pNavigator(), LocalTrajectoryError::positionError(), reco::TrackBase::pt(), TrajectoryMeasurement::recHit(), mathSSE::sqrt(), lumiQTWidget::t, HiIsolationCommonParameters_cff::track, LocalError::xx(), LocalError::xy(), and LocalError::yy().

Referenced by Types.EventID::cppID().

76 {
77  TrajectoryStateCombiner tsoscomb;
78 
79  for (unsigned int t = 0; t < tracks.size(); ++t)
80  {
81  const reco::Track* track = tracks[t].second;
82 
83  float charge = tracks[t].second->charge();
84 
85  const std::vector<TrajectoryMeasurement>& meass
86  = tracks[t].first->measurements();
87 
88  for (unsigned int m = 0; m < meass.size(); ++m)
89  {
90  const TrajectoryMeasurement& meas = meass[m];
91  const TransientTrackingRecHit& hit = *meas.recHit();
92 
93  if ( hit.isValid() )
94  {
95  const Alignable* ali = pNavigator()->alignableFromDetId( hit.geographicalId() );
96 
97  while (ali) {
98  std::map<const Alignable*, Hist1Ds>::iterator h = m_resHists.find(ali);
99  if ( h != m_resHists.end() )
100  {
102 
104  LocalError err1 = tsos.localError().positionError();
105  LocalError err2 = hit.localPositionError(); // CPE+APE
106 
107  // subtract APEs from err2 (if existing) from covariance matrix
108  auto det = static_cast<const TrackerGeomDet*>(hit.det());
109  const auto localAPE = det->localAlignmentError();
110  if (localAPE.valid()) {
111  err2 = LocalError(err2.xx() - localAPE.xx(),
112  err2.xy() - localAPE.xy(),
113  err2.yy() - localAPE.yy());
114  }
115 
116  float errX = std::sqrt( err1.xx() + err2.xx() );
117  float errY = std::sqrt( err1.yy() + err2.yy() );
118 
119  h->second[charge > 0 ? 0 : 1]->Fill(res.x() / errX);
120  h->second[charge > 0 ? 2 : 3]->Fill(res.y() / errY);
121  }
122  ali = ali->mother();
123  }
124  }
125  }
126 
127  m_trkHists[0]->Fill( track->pt() );
128  m_trkHists[1]->Fill( track->eta() );
129  m_trkHists[2]->Fill( track->phi() );
130  m_trkHists[3]->Fill( track->d0() );
131  m_trkHists[4]->Fill( track->dz() );
132  m_trkHists[5]->Fill( track->normalizedChi2() );
133  }
134 }
float xx() const
Definition: LocalError.h:24
AlignableNavigator * pNavigator()
ConstRecHitPointer const & recHit() const
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
Definition: TrackBase.h:597
std::map< const Alignable *, Hist1Ds > m_resHists
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:561
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:645
LocalError positionError() const
Definition: Electron.h:6
float xy() const
Definition: LocalError.h:25
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
float yy() const
Definition: LocalError.h:26
const GeomDet * det() const
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:621
const LocalTrajectoryError & localError() const
virtual LocalPoint localPosition() const =0
TrajectoryStateOnSurface const & forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:609
bool isValid() const
DetId geographicalId() const
virtual LocalError localPositionError() const =0
AlignableDetOrUnitPtr alignableFromDetId(const DetId &detid)
Returns AlignableDetOrUnitPtr corresponding to given DetId.
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:94
LocalError const & localAlignmentError() const
Return local alligment error.
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)

Member Data Documentation

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

Definition at line 52 of file AlignmentMonitorGeneric.h.

Referenced by book(), and event().

Hist1Ds AlignmentMonitorGeneric::m_trkHists
private

Definition at line 50 of file AlignmentMonitorGeneric.h.

Referenced by book(), and event().

const unsigned int AlignmentMonitorGeneric::nBin_ = 50
staticprivate

Definition at line 48 of file AlignmentMonitorGeneric.h.

Referenced by book().