CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void afterAlignment (const edm::EventSetup &)
 
 AlignmentMonitorGeneric (const edm::ParameterSet &)
 
virtual void book ()
 Book or retrieve histograms; MUST be reimplemented. More...
 
virtual void event (const edm::Event &, const edm::EventSetup &, const ConstTrajTrackPairCollection &)
 Called for each event (by "run()"): may be reimplemented. More...
 
- Public Member Functions inherited from AlignmentMonitorBase
 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 (const edm::EventSetup &iSetup)
 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
*, Hist1Ds
m_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
< ConstTrajTrackPair
ConstTrajTrackPairCollection
 
- 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 ()
 

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 10 of file AlignmentMonitorGeneric.cc.

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

Member Function Documentation

virtual void AlignmentMonitorGeneric::afterAlignment ( const edm::EventSetup iSetup)
inlinevirtual

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

Reimplemented from AlignmentMonitorBase.

Definition at line 46 of file AlignmentMonitorGeneric.h.

48  {}
void AlignmentMonitorGeneric::book ( )
virtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 15 of file AlignmentMonitorGeneric.cc.

References Alignable::alignableObjectId(), AlignmentParameterStore::alignables(), AlignmentMonitorBase::book1D(), i, Alignable::id(), ExpressReco_HICollisions_FallBack::id, M_PI, m_resHists, m_trkHists, n, AlCaRecoCosmics_cfg::name, nBin_, AlignmentMonitorBase::pStore(), DetId::subdetId(), and AlignableObjectId::typeToName().

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

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

Reimplemented from AlignmentMonitorBase.

Definition at line 70 of file AlignmentMonitorGeneric.cc.

References AlignableNavigator::alignableFromDetId(), TrajectoryMeasurement::backwardPredictedState(), DeDxDiscriminatorTools::charge(), reco::TrackBase::d0(), reco::TrackBase::dz(), reco::TrackBase::eta(), TrajectoryMeasurement::forwardPredictedState(), TrackingRecHit::geographicalId(), h, TrackingRecHit::isValid(), TrajectoryStateOnSurface::localError(), TrackingRecHit::localPosition(), TrajectoryStateOnSurface::localPosition(), TrackingRecHit::localPositionError(), m, m_resHists, m_trkHists, Alignable::mother(), reco::TrackBase::normalizedChi2(), reco::TrackBase::phi(), AlignmentMonitorBase::pNavigator(), LocalTrajectoryError::positionError(), reco::TrackBase::pt(), TrajectoryMeasurement::recHit(), mathSSE::sqrt(), matplotRender::t, ExpressReco_HICollisions_FallBack::track, LocalError::xx(), and LocalError::yy().

73 {
74  static TrajectoryStateCombiner tsoscomb;
75 
76  for (unsigned int t = 0; t < tracks.size(); ++t)
77  {
78  const reco::Track* track = tracks[t].second;
79 
80  float charge = tracks[t].second->charge();
81 
82  const std::vector<TrajectoryMeasurement>& meass
83  = tracks[t].first->measurements();
84 
85  for (unsigned int m = 0; m < meass.size(); ++m)
86  {
87  const TrajectoryMeasurement& meas = meass[m];
88  const TransientTrackingRecHit& hit = *meas.recHit();
89 
90  if ( hit.isValid() )
91  {
92  const Alignable* ali = pNavigator()->alignableFromDetId( hit.geographicalId() );
93 
94  while (ali) {
95  std::map<const Alignable*, Hist1Ds>::iterator h = m_resHists.find(ali);
96  if ( h != m_resHists.end() )
97  {
99 
100  align::LocalVector res = tsos.localPosition() - hit.localPosition();
101  LocalError err1 = tsos.localError().positionError();
102  LocalError err2 = hit.localPositionError();
103 
104  float errX = std::sqrt( err1.xx() + err2.xx() );
105  float errY = std::sqrt( err1.yy() + err2.yy() );
106 
107  h->second[charge > 0 ? 0 : 1]->Fill(res.x() / errX);
108  h->second[charge > 0 ? 2 : 3]->Fill(res.y() / errY);
109  }
110  ali = ali->mother();
111  }
112  }
113  }
114 
115  m_trkHists[0]->Fill( track->pt() );
116  m_trkHists[1]->Fill( track->eta() );
117  m_trkHists[2]->Fill( track->phi() );
118  m_trkHists[3]->Fill( track->d0() );
119  m_trkHists[4]->Fill( track->dz() );
120  m_trkHists[5]->Fill( track->normalizedChi2() );
121  }
122 }
float xx() const
Definition: LocalError.h:19
AlignableNavigator * pNavigator()
double d0() const
dxy parameter in perigee convention (d0 = - dxy)
Definition: TrackBase.h:122
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:110
TrajectoryStateOnSurface forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:138
ConstRecHitPointer recHit() const
double charge(const std::vector< uint8_t > &Ampls)
LocalError positionError() const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:140
float yy() const
Definition: LocalError.h:21
T sqrt(T t)
Definition: SSEVec.h:28
double pt() const
track transverse momentum
Definition: TrackBase.h:130
const LocalTrajectoryError & localError() const
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:126
tuple tracks
Definition: testEve_cfg.py:39
virtual LocalError localPositionError() const =0
bool isValid() const
DetId geographicalId() const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
virtual LocalPoint localPosition() 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:85
TrajectoryStateOnSurface backwardPredictedState() const
Access to backward predicted state (from smoother)

Member Data Documentation

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

Definition at line 56 of file AlignmentMonitorGeneric.h.

Referenced by book(), and event().

Hist1Ds AlignmentMonitorGeneric::m_trkHists
private

Definition at line 54 of file AlignmentMonitorGeneric.h.

Referenced by book(), and event().

const unsigned int AlignmentMonitorGeneric::nBin_ = 50
staticprivate

Definition at line 52 of file AlignmentMonitorGeneric.h.

Referenced by book().