CMS 3D CMS Logo

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

Public Member Functions

void afterAlignment ()
 
 AlignmentMonitorTracksFromTrajectories (const edm::ParameterSet &cfg, edm::ConsumesCollector iC)
 
void book ()
 Book or retrieve histograms; MUST be reimplemented. More...
 
void event (const edm::Event &iEvent, const edm::EventSetup &iSetup, const ConstTrajTrackPairCollection &iTrajTracks)
 Called for each event (by "run()"): may be reimplemented. More...
 
 ~AlignmentMonitorTracksFromTrajectories ()
 
- 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 Attributes

edm::InputTag m_beamSpot
 
TH1F * m_chi2_100
 
TH1F * m_chi2_10000
 
TH1F * m_chi2_1000000
 
TH1F * m_chi2_improvement
 
TH1F * m_chi2_log
 
TH1F * m_chi2DOF_100
 
TH1F * m_chi2DOF_1000
 
TH1F * m_chi2DOF_5
 
TH1F * m_chi2DOF_improvement
 
TH1F * m_chi2DOF_log
 
TH1F * m_diMuon_Jpsi
 
TH1F * m_diMuon_log
 
TH1F * m_diMuon_Ups
 
TH1F * m_diMuon_Z
 
TH1F * m_diMuon_Zbackward
 
TH1F * m_diMuon_Zbarrel
 
TH1F * m_diMuon_Zforward
 
TH1F * m_pt [36]
 
bool m_vertexConstraint
 
MuonServiceProxytheMuonServiceProxy
 
MuonUpdatorAtVertextheMuonUpdatorAtVertex
 

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 AlignmentMonitorTracksFromTrajectories.cc.

Constructor & Destructor Documentation

◆ AlignmentMonitorTracksFromTrajectories()

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

Definition at line 99 of file AlignmentMonitorTracksFromTrajectories.cc.

References looper::cfg, MuonServiceProxy_cff::MuonServiceProxy, MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex, theMuonServiceProxy, and theMuonUpdatorAtVertex.

101  : AlignmentMonitorBase(cfg, iC, "AlignmentMonitorTracksFromTrajectories"),
102  m_vertexConstraint(cfg.getParameter<bool>("vertexConstraint")),
103  m_beamSpot(cfg.getParameter<edm::InputTag>("beamSpot")) {
104  theMuonServiceProxy = new MuonServiceProxy(cfg.getParameter<edm::ParameterSet>("ServiceParameters"));
105  theMuonUpdatorAtVertex = new MuonUpdatorAtVertex(cfg.getParameter<edm::ParameterSet>("MuonUpdatorAtVertexParameters"),
107 }
AlignmentMonitorBase(const edm::ParameterSet &cfg, const edm::ConsumesCollector &iC, std::string name)
Constructor.

◆ ~AlignmentMonitorTracksFromTrajectories()

AlignmentMonitorTracksFromTrajectories::~AlignmentMonitorTracksFromTrajectories ( )
inline

Definition at line 38 of file AlignmentMonitorTracksFromTrajectories.cc.

38 {};

Member Function Documentation

◆ afterAlignment()

void AlignmentMonitorTracksFromTrajectories::afterAlignment ( )
virtual

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

Reimplemented from AlignmentMonitorBase.

Definition at line 272 of file AlignmentMonitorTracksFromTrajectories.cc.

272 {}

◆ book()

void AlignmentMonitorTracksFromTrajectories::book ( )
virtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 117 of file AlignmentMonitorTracksFromTrajectories.cc.

References AlignmentMonitorBase::book1D(), mps_fire::i, m_chi2_100, m_chi2_10000, m_chi2_1000000, m_chi2_improvement, m_chi2_log, m_chi2DOF_100, m_chi2DOF_1000, m_chi2DOF_5, m_chi2DOF_improvement, m_chi2DOF_log, m_diMuon_Jpsi, m_diMuon_log, m_diMuon_Ups, m_diMuon_Z, m_diMuon_Zbackward, m_diMuon_Zbarrel, m_diMuon_Zforward, m_pt, Skims_PA_cff::name, and runGCPTkAlMap::title.

117  {
118  m_diMuon_Z = book1D("/iterN/", "diMuon_Z", "Di-muon mass (GeV)", 200, 90. - 50., 90. + 50.);
119  m_diMuon_Zforward = book1D("/iterN/", "diMuon_Zforward", "Di-muon mass (GeV) eta > 1.4", 200, 90. - 50., 90. + 50.);
121  book1D("/iterN/", "diMuon_Zbarrel", "Di-muon mass (GeV) -1.4 < eta < 1.4", 200, 90. - 50., 90. + 50.);
123  book1D("/iterN/", "diMuon_Zbackward", "Di-muon mass (GeV) eta < -1.4", 200, 90. - 50., 90. + 50.);
124  m_diMuon_Ups = book1D("/iterN/", "diMuon_Ups", "Di-muon mass (GeV)", 200, 9. - 3., 9. + 3.);
125  m_diMuon_Jpsi = book1D("/iterN/", "diMuon_Jpsi", "Di-muon mass (GeV)", 200, 3. - 1., 3. + 1.);
126  m_diMuon_log = book1D("/iterN/", "diMuon_log", "Di-muon mass (log GeV)", 300, 0, 3);
127  m_chi2_100 = book1D("/iterN/", "m_chi2_100", "Track chi^2", 100, 0, 100);
128  m_chi2_10000 = book1D("/iterN/", "m_chi2_10000", "Track chi^2", 100, 0, 10000);
129  m_chi2_1000000 = book1D("/iterN/", "m_chi2_1000000", "Track chi^2", 100, 1, 1000000);
130  m_chi2_log = book1D("/iterN/", "m_chi2_log", "Log track chi^2", 100, -3, 7);
131  m_chi2DOF_5 = book1D("/iterN/", "m_chi2DOF_5", "Track chi^2/nDOF", 100, 0, 5);
132  m_chi2DOF_100 = book1D("/iterN/", "m_chi2DOF_100", "Track chi^2/nDOF", 100, 0, 100);
133  m_chi2DOF_1000 = book1D("/iterN/", "m_chi2DOF_1000", "Track chi^2/nDOF", 100, 0, 1000);
134  m_chi2DOF_log = book1D("/iterN/", "m_chi2DOF_log", "Log track chi^2/nDOF", 100, -3, 7);
135  m_chi2_improvement = book1D("/iterN/", "m_chi2_improvement", "Track-by-track chi^2/original chi^2", 100, 0., 10.);
137  "/iterN/", "m_chi2DOF_improvement", "Track-by-track (chi^2/DOF)/(original chi^2/original DOF)", 100, 0., 10.);
138  for (int i = 0; i < 36; i++) {
139  char name[100], title[100];
140  snprintf(name, sizeof(name), "m_pt_phi%d", i);
141  snprintf(title, sizeof(title), "Track pt (GeV) in phi bin %d/36", i);
142  m_pt[i] = book1D("/iterN/", name, title, 100, 0, 100);
143  }
144 }
TH1F * book1D(std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)

◆ event()

void AlignmentMonitorTracksFromTrajectories::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 150 of file AlignmentMonitorTracksFromTrajectories.cc.

References TrajectoryMeasurement::backwardPredictedState(), pwdgSkimBPark_cfi::beamSpot, hltPixelTracks_cff::chi2, Trajectory::chiSquared(), StorageManager_cfg::e1, HCALHighEnergyHPDFilter_cfi::energy, PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), mps_fire::i, iEvent, m_beamSpot, m_chi2_100, m_chi2_10000, m_chi2_1000000, m_chi2_improvement, m_chi2_log, m_chi2DOF_100, m_chi2DOF_1000, m_chi2DOF_5, m_chi2DOF_improvement, m_chi2DOF_log, m_diMuon_Jpsi, m_diMuon_log, m_diMuon_Ups, m_diMuon_Z, m_diMuon_Zbackward, m_diMuon_Zbarrel, m_diMuon_Zforward, M_PI, m_pt, m_vertexConstraint, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::mag2(), EgHLTOffHistBins_cfi::mass, Trajectory::measurements(), LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), MuonUpdatorAtVertex::propagate(), MuonUpdatorAtVertex::propagateWithUpdate(), DiDispStaMuonMonitor_cfi::pt, TrajectoryMeasurement::recHit(), mathSSE::sqrt(), TrajectoryStateOnSurface::surface(), theMuonServiceProxy, theMuonUpdatorAtVertex, Surface::toGlobal(), HLT_2022v14_cff::track, tracks, and MuonServiceProxy::update().

Referenced by Types.EventID::cppID().

152  {
153  theMuonServiceProxy->update(iSetup);
154 
156  iEvent.getByLabel(m_beamSpot, beamSpot);
157 
158  GlobalVector p1, p2;
159  double e1 = 0.;
160  double e2 = 0.;
161 
162  for (ConstTrajTrackPairCollection::const_iterator it = tracks.begin(); it != tracks.end(); ++it) {
163  const Trajectory *traj = it->first;
164  const reco::Track *track = it->second;
165 
166  int nDOF = 0;
167  TrajectoryStateOnSurface closestTSOS;
168  double closest = 10000.;
169 
170  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
171  for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
172  const TrajectoryMeasurement meas = *im;
173  const TransientTrackingRecHit *hit = &(*meas.recHit());
174  // const DetId id = hit->geographicalId();
175 
176  nDOF += hit->dimension();
177 
179  GlobalPoint where = TSOS.surface().toGlobal(LocalPoint(0, 0, 0));
180 
181  if (where.mag() < closest) {
182  closest = where.mag();
183  closestTSOS = TSOS;
184  }
185 
186  } // end loop over measurements
187  nDOF -= 5;
188 
189  if (closest != 10000.) {
190  std::pair<bool, FreeTrajectoryState> state;
191 
192  if (m_vertexConstraint) {
194  // add in chi^2 contribution from vertex contratint?
195  } else {
197  }
198 
199  if (state.first) {
200  double chi2 = traj->chiSquared();
201  double chi2DOF = chi2 / double(nDOF);
202 
203  m_chi2_100->Fill(chi2);
204  m_chi2_10000->Fill(chi2);
205  m_chi2_1000000->Fill(chi2);
206  m_chi2_log->Fill(log10(chi2));
207 
208  m_chi2DOF_5->Fill(chi2DOF);
209  m_chi2DOF_100->Fill(chi2DOF);
210  m_chi2DOF_1000->Fill(chi2DOF);
211  m_chi2DOF_log->Fill(log10(chi2DOF));
212  m_chi2_improvement->Fill(chi2 / track->chi2());
213  m_chi2DOF_improvement->Fill(chi2DOF / track->normalizedChi2());
214 
215  GlobalVector momentum = state.second.momentum();
216  double energy = momentum.mag();
217 
218  if (energy > e1) {
219  e2 = e1;
220  e1 = energy;
221  p2 = p1;
222  p1 = momentum;
223  } else if (energy > e2) {
224  e2 = energy;
225  p2 = momentum;
226  }
227 
228  double pt = momentum.perp();
229  double phi = momentum.phi();
230  while (phi < -M_PI)
231  phi += 2. * M_PI;
232  while (phi > M_PI)
233  phi -= 2. * M_PI;
234 
235  double phibin = (phi + M_PI) / (2. * M_PI) * 36.;
236 
237  for (int i = 0; i < 36; i++) {
238  if (phibin < i + 1) {
239  m_pt[i]->Fill(pt);
240  break;
241  }
242  }
243 
244  } // end if propagate was successful
245  } // end if we have a closest TSOS
246  } // end loop over tracks
247 
248  if (e1 > 0. && e2 > 0.) {
249  double energy_tot = e1 + e2;
250  GlobalVector momentum_tot = p1 + p2;
251  double mass = sqrt(energy_tot * energy_tot - momentum_tot.mag2());
252  double eta = momentum_tot.eta();
253 
254  m_diMuon_Z->Fill(mass);
255  if (eta > 1.4)
256  m_diMuon_Zforward->Fill(mass);
257  else if (eta > -1.4)
258  m_diMuon_Zbarrel->Fill(mass);
259  else
260  m_diMuon_Zbackward->Fill(mass);
261 
262  m_diMuon_Ups->Fill(mass);
263  m_diMuon_Jpsi->Fill(mass);
264  m_diMuon_log->Fill(log10(mass));
265  } // end if we have two tracks
266 }
T perp() const
Definition: PV3DBase.h:69
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T eta() const
Definition: PV3DBase.h:73
float chiSquared() const
Definition: Trajectory.h:241
T mag2() const
Definition: PV3DBase.h:63
const SurfaceType & surface() const
DataContainer const & measurements() const
Definition: Trajectory.h:178
std::pair< bool, FreeTrajectoryState > propagateWithUpdate(const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
Propagate to the 2D-PCA and apply the vertex constraint.
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:19
T mag() const
Definition: PV3DBase.h:64
TrajectoryStateOnSurface const & backwardPredictedState() const
Access to backward predicted state (from smoother)
std::pair< bool, FreeTrajectoryState > propagate(const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
Propagate the state to the 2D-PCA.
#define M_PI
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
TrajectoryStateOnSurface TSOS
Definition: TestHits.cc:19
auto const & tracks
cannot be loose
void update(const edm::EventSetup &setup, bool duringEvent=true)
update the services each event
ConstRecHitPointer const & recHit() const

Member Data Documentation

◆ m_beamSpot

edm::InputTag AlignmentMonitorTracksFromTrajectories::m_beamSpot
private

Definition at line 48 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by event().

◆ m_chi2_100

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2_100
private

Definition at line 57 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2_10000

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2_10000
private

Definition at line 58 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2_1000000

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2_1000000
private

Definition at line 59 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2_improvement

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2_improvement
private

Definition at line 65 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2_log

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2_log
private

Definition at line 60 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2DOF_100

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2DOF_100
private

Definition at line 62 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2DOF_1000

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2DOF_1000
private

Definition at line 63 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2DOF_5

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2DOF_5
private

Definition at line 61 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2DOF_improvement

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2DOF_improvement
private

Definition at line 66 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_chi2DOF_log

TH1F* AlignmentMonitorTracksFromTrajectories::m_chi2DOF_log
private

Definition at line 64 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_Jpsi

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_Jpsi
private

Definition at line 55 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_log

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_log
private

Definition at line 56 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_Ups

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_Ups
private

Definition at line 54 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_Z

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_Z
private

Definition at line 50 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_Zbackward

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_Zbackward
private

Definition at line 53 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_Zbarrel

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_Zbarrel
private

Definition at line 52 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_diMuon_Zforward

TH1F* AlignmentMonitorTracksFromTrajectories::m_diMuon_Zforward
private

Definition at line 51 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_pt

TH1F* AlignmentMonitorTracksFromTrajectories::m_pt[36]
private

Definition at line 67 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by book(), and event().

◆ m_vertexConstraint

bool AlignmentMonitorTracksFromTrajectories::m_vertexConstraint
private

Definition at line 47 of file AlignmentMonitorTracksFromTrajectories.cc.

Referenced by event().

◆ theMuonServiceProxy

MuonServiceProxy* AlignmentMonitorTracksFromTrajectories::theMuonServiceProxy
private

◆ theMuonUpdatorAtVertex

MuonUpdatorAtVertex* AlignmentMonitorTracksFromTrajectories::theMuonUpdatorAtVertex
private