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
AlignmentMonitorMuonVsCurvature Class Reference
Inheritance diagram for AlignmentMonitorMuonVsCurvature:
AlignmentMonitorBase

Public Member Functions

void afterAlignment (const edm::EventSetup &iSetup)
 
 AlignmentMonitorMuonVsCurvature (const edm::ParameterSet &cfg)
 
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...
 
 ~AlignmentMonitorMuonVsCurvature ()
 
- 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

enum  {
  kWheelMinus2 = 0, kWheelMinus1, kWheelZero, kWheelPlus1,
  kWheelPlus2, kWheelMEm11, kWheelMEm12, kWheelMEm13,
  kWheelMEm14, kWheelMEp11, kWheelMEp12, kWheelMEp13,
  kWheelMEp14, kNumWheels
}
 
enum  {
  kEndcapMEm11 = 0, kEndcapMEm12, kEndcapMEm13, kEndcapMEm14,
  kEndcapMEp11, kEndcapMEp12, kEndcapMEp13, kEndcapMEp14,
  kNumEndcap
}
 
enum  {
  kDeltaX = 0, kDeltaDxDz, kPtErr, kCurvErr,
  kNumComponents
}
 

Private Attributes

bool m_allowTIDTEC
 
int m_layer
 
double m_maxDxy
 
double m_maxTrackerRedChi2
 
int m_minCSCHits
 
int m_minDT13Hits
 
int m_minDT2Hits
 
int m_minTrackerHits
 
double m_minTrackPt
 
std::string m_propagator
 
TH1F * th1f_trackerRedChi2
 
TH1F * th1f_trackerRedChi2Diff
 
TH2F * th2f_endcap [kNumEndcap][36][kNumComponents]
 
TH2F * th2f_evens [kNumEndcap][kNumComponents]
 
TH2F * th2f_odds [kNumEndcap][kNumComponents]
 
TH2F * th2f_wheelsector [kNumWheels][12][kNumComponents]
 
TProfile * tprofile_endcap [kNumEndcap][36][kNumComponents]
 
TProfile * tprofile_evens [kNumEndcap][kNumComponents]
 
TProfile * tprofile_odds [kNumEndcap][kNumComponents]
 
TProfile * tprofile_wheelsector [kNumWheels][12][kNumComponents]
 

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 43 of file AlignmentMonitorMuonVsCurvature.cc.

Member Enumeration Documentation

anonymous enum
private
Enumerator
kWheelMinus2 
kWheelMinus1 
kWheelZero 
kWheelPlus1 
kWheelPlus2 
kWheelMEm11 
kWheelMEm12 
kWheelMEm13 
kWheelMEm14 
kWheelMEp11 
kWheelMEp12 
kWheelMEp13 
kWheelMEp14 
kNumWheels 

Definition at line 64 of file AlignmentMonitorMuonVsCurvature.cc.

64  {
65  kWheelMinus2 = 0,
67  kWheelZero,
79  };
anonymous enum
private
anonymous enum
private

Constructor & Destructor Documentation

AlignmentMonitorMuonVsCurvature::AlignmentMonitorMuonVsCurvature ( const edm::ParameterSet cfg)

Definition at line 128 of file AlignmentMonitorMuonVsCurvature.cc.

129  : AlignmentMonitorBase(cfg, "AlignmentMonitorMuonVsCurvature")
130  , m_minTrackPt(cfg.getParameter<double>("minTrackPt"))
131  , m_minTrackerHits(cfg.getParameter<int>("minTrackerHits"))
132  , m_maxTrackerRedChi2(cfg.getParameter<double>("maxTrackerRedChi2"))
133  , m_allowTIDTEC(cfg.getParameter<bool>("allowTIDTEC"))
134  , m_maxDxy(cfg.getParameter<double>("maxDxy"))
135  , m_minDT13Hits(cfg.getParameter<int>("minDT13Hits"))
136  , m_minDT2Hits(cfg.getParameter<int>("minDT2Hits"))
137  , m_minCSCHits(cfg.getParameter<int>("minCSCHits"))
138  , m_layer(cfg.getParameter<int>("layer"))
139  , m_propagator(cfg.getParameter<std::string>("propagator"))
140 {}
T getParameter(std::string const &) const
AlignmentMonitorBase(const edm::ParameterSet &cfg, std::string name)
Constructor.
AlignmentMonitorMuonVsCurvature::~AlignmentMonitorMuonVsCurvature ( )
inline

Definition at line 46 of file AlignmentMonitorMuonVsCurvature.cc.

46 {};

Member Function Documentation

void AlignmentMonitorMuonVsCurvature::afterAlignment ( const edm::EventSetup iSetup)
virtual

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

Reimplemented from AlignmentMonitorBase.

Definition at line 561 of file AlignmentMonitorMuonVsCurvature.cc.

561 {}
void AlignmentMonitorMuonVsCurvature::book ( )
virtual

Book or retrieve histograms; MUST be reimplemented.

Implements AlignmentMonitorBase.

Definition at line 142 of file AlignmentMonitorMuonVsCurvature.cc.

References AlignmentMonitorBase::book1D(), AlignmentMonitorBase::book2D(), AlignmentMonitorBase::bookProfile(), Reference_intrackfit_cff::endcap, kCurvErr, kDeltaDxDz, kDeltaX, kEndcapMEm11, kEndcapMEm12, kEndcapMEm13, kEndcapMEm14, kEndcapMEp11, kEndcapMEp12, kEndcapMEp13, kEndcapMEp14, kNumComponents, kNumEndcap, kNumWheels, kPtErr, kWheelMEm11, kWheelMEm12, kWheelMEm13, kWheelMEm14, kWheelMEp11, kWheelMEp12, kWheelMEp13, kWheelMEp14, kWheelMinus1, kWheelMinus2, kWheelPlus1, kWheelPlus2, kWheelZero, th1f_trackerRedChi2, th1f_trackerRedChi2Diff, th2f_endcap, th2f_evens, th2f_odds, th2f_wheelsector, tprofile_endcap, tprofile_evens, tprofile_odds, and tprofile_wheelsector.

142  {
143  for (int wheel = 0; wheel < kNumWheels; wheel++) {
144  std::stringstream wheelname;
145  if (wheel == kWheelMinus2) wheelname << "wheelm2_";
146  else if (wheel == kWheelMinus1) wheelname << "wheelm1_";
147  else if (wheel == kWheelZero) wheelname << "wheelz_";
148  else if (wheel == kWheelPlus1) wheelname << "wheelp1_";
149  else if (wheel == kWheelPlus2) wheelname << "wheelp2_";
150  else if (wheel == kWheelMEm11) wheelname << "wheelmem11_";
151  else if (wheel == kWheelMEm12) wheelname << "wheelmem12_";
152  else if (wheel == kWheelMEm13) wheelname << "wheelmem13_";
153  else if (wheel == kWheelMEm14) wheelname << "wheelmem14_";
154  else if (wheel == kWheelMEp11) wheelname << "wheelmep11_";
155  else if (wheel == kWheelMEp12) wheelname << "wheelmep12_";
156  else if (wheel == kWheelMEp13) wheelname << "wheelmep13_";
157  else if (wheel == kWheelMEp14) wheelname << "wheelmep14_";
158 
159  for (int sector = 0; sector < 12; sector++) {
160  std::stringstream sectorname;
161  if (sector == 0) sectorname << "sector01_";
162  else if (sector == 1) sectorname << "sector02_";
163  else if (sector == 2) sectorname << "sector03_";
164  else if (sector == 3) sectorname << "sector04_";
165  else if (sector == 4) sectorname << "sector05_";
166  else if (sector == 5) sectorname << "sector06_";
167  else if (sector == 6) sectorname << "sector07_";
168  else if (sector == 7) sectorname << "sector08_";
169  else if (sector == 8) sectorname << "sector09_";
170  else if (sector == 9) sectorname << "sector10_";
171  else if (sector == 10) sectorname << "sector11_";
172  else if (sector == 11) sectorname << "sector12_";
173 
174  for (int component = 0; component < kNumComponents; component++) {
175  std::stringstream th2f_name, tprofile_name;
176  th2f_name << "th2f_" << wheelname.str() << sectorname.str();
177  tprofile_name << "tprofile_" << wheelname.str() << sectorname.str();
178 
179  double minmax = 15.;
180  if (component == kDeltaX) {
181  th2f_name << "deltax";
182  tprofile_name << "deltax";
183  minmax = 15.;
184  }
185  else if (component == kDeltaDxDz) {
186  th2f_name << "deltadxdz";
187  tprofile_name << "deltadxdz";
188  minmax = 15.;
189  }
190  else if (component == kPtErr) {
191  th2f_name << "pterr";
192  tprofile_name << "pterr";
193  minmax = 15.;
194  }
195  else if (component == kCurvErr) {
196  th2f_name << "curverr";
197  tprofile_name << "curverr";
198  minmax = 0.0015;
199  }
200 
201  if (component == kPtErr) {
202  th2f_wheelsector[wheel][sector][component] = book2D("/iterN/", th2f_name.str().c_str(), "", 25, -200., 200., 30, -minmax, minmax);
203  tprofile_wheelsector[wheel][sector][component] = bookProfile("/iterN/", tprofile_name.str().c_str(), "", 25, -200., 200.);
204  }
205  else {
206  th2f_wheelsector[wheel][sector][component] = book2D("/iterN/", th2f_name.str().c_str(), "", 25, -0.05, 0.05, 30, -minmax, minmax);
207  tprofile_wheelsector[wheel][sector][component] = bookProfile("/iterN/", tprofile_name.str().c_str(), "", 25, -0.05, 0.05);
208  }
209  }
210  }
211  }
212 
213  for (int endcap = 0; endcap < kNumEndcap; endcap++) {
214  std::stringstream endcapname;
215  if (endcap == kEndcapMEm11) endcapname << "endcapmem11_";
216  else if (endcap == kEndcapMEm12) endcapname << "endcapmem12_";
217  else if (endcap == kEndcapMEm13) endcapname << "endcapmem13_";
218  else if (endcap == kEndcapMEm14) endcapname << "endcapmem14_";
219  else if (endcap == kEndcapMEp11) endcapname << "endcapmep11_";
220  else if (endcap == kEndcapMEp12) endcapname << "endcapmep12_";
221  else if (endcap == kEndcapMEp13) endcapname << "endcapmep13_";
222  else if (endcap == kEndcapMEp14) endcapname << "endcapmep14_";
223 
224  for (int component = 0; component < kNumComponents; component++) {
225  std::stringstream componentname;
226  double minmax = 15.;
227  if (component == kDeltaX) {
228  componentname << "deltax";
229  minmax = 15.;
230  }
231  else if (component == kDeltaDxDz) {
232  componentname << "deltadxdz";
233  minmax = 15.;
234  }
235  else if (component == kPtErr) {
236  componentname << "pterr";
237  minmax = 15.;
238  }
239  else if (component == kCurvErr) {
240  componentname << "curverr";
241  minmax = 0.0015;
242  }
243 
244  std::stringstream th2f_evens_name, th2f_odds_name, tprofile_evens_name, tprofile_odds_name;
245  th2f_evens_name << "th2f_" << endcapname.str() << "evens_" << componentname.str();
246  th2f_odds_name << "th2f_" << endcapname.str() << "odds_" << componentname.str();
247  tprofile_evens_name << "tprofile_" << endcapname.str() << "evens_" << componentname.str();
248  tprofile_odds_name << "tprofile_" << endcapname.str() << "odds_" << componentname.str();
249 
250  if (component == kPtErr) {
251  th2f_evens[endcap][component] = book2D("/iterN/", th2f_evens_name.str().c_str(), "", 25, -200., 200., 30, -minmax, minmax);
252  th2f_odds[endcap][component] = book2D("/iterN/", th2f_odds_name.str().c_str(), "", 25, -200., 200., 30, -minmax, minmax);
253  tprofile_evens[endcap][component] = bookProfile("/iterN/", tprofile_evens_name.str().c_str(), "", 25, -200., 200.);
254  tprofile_odds[endcap][component] = bookProfile("/iterN/", tprofile_odds_name.str().c_str(), "", 25, -200., 200.);
255  }
256  else {
257  th2f_evens[endcap][component] = book2D("/iterN/", th2f_evens_name.str().c_str(), "", 25, -0.05, 0.05, 30, -minmax, minmax);
258  th2f_odds[endcap][component] = book2D("/iterN/", th2f_odds_name.str().c_str(), "", 25, -0.05, 0.05, 30, -minmax, minmax);
259  tprofile_evens[endcap][component] = bookProfile("/iterN/", tprofile_evens_name.str().c_str(), "", 25, -0.05, 0.05);
260  tprofile_odds[endcap][component] = bookProfile("/iterN/", tprofile_odds_name.str().c_str(), "", 25, -0.05, 0.05);
261  }
262 
263  for (int chamber = 0; chamber < 36; chamber++) {
264  std::stringstream chambername;
265  if (chamber == 0) chambername << "chamber01_";
266  else if (chamber == 1) chambername << "chamber02_";
267  else if (chamber == 2) chambername << "chamber03_";
268  else if (chamber == 3) chambername << "chamber04_";
269  else if (chamber == 4) chambername << "chamber05_";
270  else if (chamber == 5) chambername << "chamber06_";
271  else if (chamber == 6) chambername << "chamber07_";
272  else if (chamber == 7) chambername << "chamber08_";
273  else if (chamber == 8) chambername << "chamber09_";
274  else if (chamber == 9) chambername << "chamber10_";
275  else if (chamber == 10) chambername << "chamber11_";
276  else if (chamber == 11) chambername << "chamber12_";
277  else if (chamber == 12) chambername << "chamber13_";
278  else if (chamber == 13) chambername << "chamber14_";
279  else if (chamber == 14) chambername << "chamber15_";
280  else if (chamber == 15) chambername << "chamber16_";
281  else if (chamber == 16) chambername << "chamber17_";
282  else if (chamber == 17) chambername << "chamber18_";
283  else if (chamber == 18) chambername << "chamber19_";
284  else if (chamber == 19) chambername << "chamber20_";
285  else if (chamber == 20) chambername << "chamber21_";
286  else if (chamber == 21) chambername << "chamber22_";
287  else if (chamber == 22) chambername << "chamber23_";
288  else if (chamber == 23) chambername << "chamber24_";
289  else if (chamber == 24) chambername << "chamber25_";
290  else if (chamber == 25) chambername << "chamber26_";
291  else if (chamber == 26) chambername << "chamber27_";
292  else if (chamber == 27) chambername << "chamber28_";
293  else if (chamber == 28) chambername << "chamber29_";
294  else if (chamber == 29) chambername << "chamber30_";
295  else if (chamber == 30) chambername << "chamber31_";
296  else if (chamber == 31) chambername << "chamber32_";
297  else if (chamber == 32) chambername << "chamber33_";
298  else if (chamber == 33) chambername << "chamber34_";
299  else if (chamber == 34) chambername << "chamber35_";
300  else if (chamber == 35) chambername << "chamber36_";
301 
302  std::stringstream th2f_name, tprofile_name;
303  th2f_name << "th2f_" << endcapname.str() << chambername.str() << componentname.str();
304  tprofile_name << "tprofile_" << endcapname.str() << chambername.str() << componentname.str();
305 
306  if (component == kPtErr) {
307  th2f_endcap[endcap][chamber][component] = book2D("/iterN/", th2f_name.str().c_str(), "", 25, -200., 200., 30, -minmax, minmax);
308  tprofile_endcap[endcap][chamber][component] = bookProfile("/iterN/", tprofile_name.str().c_str(), "", 25, -200., 200.);
309  }
310  else {
311  th2f_endcap[endcap][chamber][component] = book2D("/iterN/", th2f_name.str().c_str(), "", 25, -0.05, 0.05, 30, -minmax, minmax);
312  tprofile_endcap[endcap][chamber][component] = bookProfile("/iterN/", tprofile_name.str().c_str(), "", 25, -0.05, 0.05);
313  }
314 
315  }
316  }
317  }
318 
319  th1f_trackerRedChi2 = book1D("/iterN/", "trackerRedChi2", "Refit tracker reduced chi^2", 100, 0., 30.);
320  th1f_trackerRedChi2Diff = book1D("/iterN/", "trackerRedChi2Diff", "Fit-minus-refit tracker reduced chi^2", 100, -5., 5.);
321 }
TH2F * th2f_wheelsector[kNumWheels][12][kNumComponents]
TProfile * tprofile_endcap[kNumEndcap][36][kNumComponents]
TH2F * book2D(std::string dir, std::string name, std::string title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
TH2F * th2f_odds[kNumEndcap][kNumComponents]
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")
TH2F * th2f_endcap[kNumEndcap][36][kNumComponents]
TProfile * tprofile_wheelsector[kNumWheels][12][kNumComponents]
TH1F * book1D(std::string dir, std::string name, std::string title, int nchX, double lowX, double highX)
TH2F * th2f_evens[kNumEndcap][kNumComponents]
TProfile * tprofile_odds[kNumEndcap][kNumComponents]
TProfile * tprofile_evens[kNumEndcap][kNumComponents]
void AlignmentMonitorMuonVsCurvature::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 323 of file AlignmentMonitorMuonVsCurvature.cc.

References MuonResidualsFromTrack::chamberIds(), MuonResidualsFromTrack::chamberResidual(), reco::TrackBase::charge(), TrajectoryStateOnSurface::charge(), MuonResidualsFromTrack::contains_TIDTEC(), MuonSubdetId::CSC, MuonSubdetId::DT, reco::TrackBase::dxy(), Reference_intrackfit_cff::endcap, edm::EventSetup::get(), MuonChamberResidual::global_hitresid(), MuonChamberResidual::global_resslope(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), MuonChamberResidual::hitresid(), TrajectoryStateOnSurface::isValid(), MuonChamberResidual::kCSC, kCurvErr, kDeltaDxDz, kDeltaX, MuonChamberResidual::kDT13, kEndcapMEm11, kEndcapMEm12, kEndcapMEm13, kEndcapMEm14, kEndcapMEp11, kEndcapMEp12, kEndcapMEp13, kEndcapMEp14, kPtErr, kWheelMEm11, kWheelMEm12, kWheelMEm13, kWheelMEm14, kWheelMEp11, kWheelMEp12, kWheelMEp13, kWheelMEp14, kWheelMinus1, kWheelMinus2, kWheelPlus1, kWheelPlus2, kWheelZero, MuonChamberResidual::localid(), TrajectoryStateOnSurface::localPosition(), m_allowTIDTEC, m_layer, m_maxDxy, m_maxTrackerRedChi2, m_minCSCHits, m_minDT13Hits, m_minTrackerHits, m_minTrackPt, m_propagator, PV3DBase< T, PVType, FrameType >::mag(), Trajectory::measurements(), DetId::Muon, reco::TrackBase::normalizedChi2(), NULL, MuonChamberResidual::numHits(), PV3DBase< T, PVType, FrameType >::perp(), AlignmentMonitorBase::pNavigator(), pos, LargeD0_PixelPairStep_cff::propagator, reco::TrackBase::pt(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), MuonChamberResidual::resslope(), mathSSE::sqrt(), th1f_trackerRedChi2, th1f_trackerRedChi2Diff, th2f_endcap, th2f_evens, th2f_odds, th2f_wheelsector, tprofile_endcap, tprofile_evens, tprofile_odds, tprofile_wheelsector, MuonResidualsFromTrack::trackerNumHits(), MuonResidualsFromTrack::trackerRedChi2(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

323  {
325  iSetup.get<GlobalTrackingGeometryRecord>().get(globalGeometry);
326 
328  iSetup.get<TrackingComponentsRecord>().get(m_propagator, propagator);
329 
330  edm::ESHandle<MagneticField> magneticField;
331  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
332 
333  for (ConstTrajTrackPairCollection::const_iterator trajtrack = trajtracks.begin(); trajtrack != trajtracks.end(); ++trajtrack) {
334  const Trajectory* traj = (*trajtrack).first;
335  const reco::Track* track = (*trajtrack).second;
336 
337  if (track->pt() > m_minTrackPt && fabs(track->dxy()) < m_maxDxy) {
338  MuonResidualsFromTrack muonResidualsFromTrack(globalGeometry, traj, pNavigator(), 1000.);
339 
340  if (muonResidualsFromTrack.trackerNumHits() >= m_minTrackerHits && muonResidualsFromTrack.trackerRedChi2() < m_maxTrackerRedChi2 && (m_allowTIDTEC || !muonResidualsFromTrack.contains_TIDTEC())) {
341  std::vector<DetId> chamberIds = muonResidualsFromTrack.chamberIds();
342 
343  double qoverpt = track->charge() / track->pt();
344  double px = track->px();
345  double py = track->py();
346  double pz = track->pz();
347 
348  th1f_trackerRedChi2->Fill(muonResidualsFromTrack.trackerRedChi2());
349  th1f_trackerRedChi2Diff->Fill(track->normalizedChi2() - muonResidualsFromTrack.trackerRedChi2());
350 
351  for (std::vector<DetId>::const_iterator chamberId = chamberIds.begin(); chamberId != chamberIds.end(); ++chamberId) {
352  if (chamberId->det() == DetId::Muon && chamberId->subdetId() == MuonSubdetId::DT) {
353  DTChamberId dtid(chamberId->rawId());
354  if (dtid.station() == 1) {
355 
356  MuonChamberResidual *dt13 = muonResidualsFromTrack.chamberResidual(*chamberId, MuonChamberResidual::kDT13);
357 
358  if (dt13 != NULL && dt13->numHits() >= m_minDT13Hits) {
359  int wheel = -1;
360  if (dtid.wheel() == -2) wheel = kWheelMinus2;
361  else if (dtid.wheel() == -1) wheel = kWheelMinus1;
362  else if (dtid.wheel() == 0) wheel = kWheelZero;
363  else if (dtid.wheel() == 1) wheel = kWheelPlus1;
364  else if (dtid.wheel() == 2) wheel = kWheelPlus2;
365 
366  int sector = dtid.sector() - 1;
367 
368  double resid_x = dt13->global_hitresid(m_layer);
369  double resid_dxdz = dt13->global_resslope();
370 
371  if (fabs(resid_x) < 10.) {
372  th2f_wheelsector[wheel][sector][kDeltaX]->Fill(qoverpt, resid_x*10.);
373  tprofile_wheelsector[wheel][sector][kDeltaX]->Fill(qoverpt, resid_x*10.);
374  th2f_wheelsector[wheel][sector][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
375  tprofile_wheelsector[wheel][sector][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
376  }
377 
378  // derivatives are in local coordinates, so these should be, too
379  resid_x = dt13->hitresid(m_layer);
380  resid_dxdz = dt13->resslope();
381 
382  // calculate derivative
383  TrajectoryStateOnSurface last_tracker_tsos;
384  double last_tracker_R = 0.;
385  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
386  for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
387  TrajectoryStateOnSurface tsos = im->forwardPredictedState();
388  if (tsos.isValid()) {
389  GlobalPoint pos = tsos.globalPosition();
390  if (pos.perp() < 200. && fabs(pos.z()) < 400.) { // if in tracker (cheap, I know...)
391  if (pos.perp() > last_tracker_R) {
392  last_tracker_tsos = tsos;
393  last_tracker_R = pos.perp();
394  }
395  }
396  }
397  }
398  if (last_tracker_R > 0.) {
399  FreeTrajectoryState ts_rebuilt(last_tracker_tsos.globalPosition(),
400  last_tracker_tsos.globalMomentum(),
401  last_tracker_tsos.charge(),
402  &*magneticField);
403 
404  double factor = (last_tracker_tsos.globalMomentum().mag() + 1.) / last_tracker_tsos.globalMomentum().mag();
405  FreeTrajectoryState ts_plus1GeV(last_tracker_tsos.globalPosition(),
406  GlobalVector(factor*last_tracker_tsos.globalMomentum().x(), factor*last_tracker_tsos.globalMomentum().y(), factor*last_tracker_tsos.globalMomentum().z()),
407  last_tracker_tsos.charge(),
408  &*magneticField);
409 
410  TrajectoryStateOnSurface extrapolation_rebuilt = propagator->propagate(ts_rebuilt, globalGeometry->idToDet(dt13->localid(m_layer))->surface());
411  TrajectoryStateOnSurface extrapolation_plus1GeV = propagator->propagate(ts_plus1GeV, globalGeometry->idToDet(dt13->localid(m_layer))->surface());
412 
413  if (extrapolation_rebuilt.isValid() && extrapolation_plus1GeV.isValid()) {
414  double rebuiltx = extrapolation_rebuilt.localPosition().x();
415  double plus1x = extrapolation_plus1GeV.localPosition().x();
416 
417  if (fabs(resid_x) < 10.) {
418  th2f_wheelsector[wheel][sector][kPtErr]->Fill(1./qoverpt, resid_x/(rebuiltx-plus1x)/sqrt(1. + pz*pz/(px*px + py*py))*fabs(qoverpt)*100.);
419  tprofile_wheelsector[wheel][sector][kPtErr]->Fill(1./qoverpt, resid_x/(rebuiltx-plus1x)/sqrt(1. + pz*pz/(px*px + py*py))*fabs(qoverpt)*100.);
420 
421  th2f_wheelsector[wheel][sector][kCurvErr]->Fill(qoverpt, resid_x/(rebuiltx-plus1x)*qoverpt/sqrt(px*px + py*py + pz*pz));
422  tprofile_wheelsector[wheel][sector][kCurvErr]->Fill(qoverpt, resid_x/(rebuiltx-plus1x)*qoverpt/sqrt(px*px + py*py + pz*pz));
423  }
424  }
425  }
426 
427  } // if it's a good segment
428  } // if on our chamber
429  } // if DT
430 
431  if (chamberId->det() == DetId::Muon && chamberId->subdetId() == MuonSubdetId::CSC) {
432  CSCDetId cscid(chamberId->rawId());
433  if (cscid.station() == 1) {
434 
435  MuonChamberResidual *csc = muonResidualsFromTrack.chamberResidual(*chamberId, MuonChamberResidual::kCSC);
436 
437  if (csc != NULL && csc->numHits() >= m_minCSCHits) {
438  int wheel = -1;
439  int endcap = -1;
440  if (cscid.endcap() == 1 && cscid.ring() == 1) { wheel = kWheelMEp11; endcap = kEndcapMEp11; }
441  else if (cscid.endcap() == 1 && cscid.ring() == 2) { wheel = kWheelMEp12; endcap = kEndcapMEp12; }
442  else if (cscid.endcap() == 1 && cscid.ring() == 3) { wheel = kWheelMEp13; endcap = kEndcapMEp13; }
443  else if (cscid.endcap() == 1 && cscid.ring() == 4) { wheel = kWheelMEp14; endcap = kEndcapMEp14; }
444  else if (cscid.endcap() != 1 && cscid.ring() == 1) { wheel = kWheelMEm11; endcap = kEndcapMEm11; }
445  else if (cscid.endcap() != 1 && cscid.ring() == 2) { wheel = kWheelMEm12; endcap = kEndcapMEm12; }
446  else if (cscid.endcap() != 1 && cscid.ring() == 3) { wheel = kWheelMEm13; endcap = kEndcapMEm13; }
447  else if (cscid.endcap() != 1 && cscid.ring() == 4) { wheel = kWheelMEm14; endcap = kEndcapMEm14; }
448 
449  int chamber = cscid.chamber() - 1;
450 
451  int sector = cscid.chamber() / 3;
452  if (cscid.chamber() == 36) sector = 0;
453 
454  double resid_x = csc->global_hitresid(m_layer);
455  double resid_dxdz = csc->global_resslope();
456 
457  if (fabs(resid_x) < 10.) {
458  th2f_wheelsector[wheel][sector][kDeltaX]->Fill(qoverpt, resid_x*10.);
459  tprofile_wheelsector[wheel][sector][kDeltaX]->Fill(qoverpt, resid_x*10.);
460  th2f_wheelsector[wheel][sector][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
461  tprofile_wheelsector[wheel][sector][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
462 
463  th2f_endcap[endcap][chamber][kDeltaX]->Fill(qoverpt, resid_x*10.);
464  tprofile_endcap[endcap][chamber][kDeltaX]->Fill(qoverpt, resid_x*10.);
465  th2f_endcap[endcap][chamber][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
466  tprofile_endcap[endcap][chamber][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
467 
468  if (cscid.chamber() % 2 == 0) {
469  th2f_evens[endcap][kDeltaX]->Fill(qoverpt, resid_x*10.);
470  tprofile_evens[endcap][kDeltaX]->Fill(qoverpt, resid_x*10.);
471  th2f_evens[endcap][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
472  tprofile_evens[endcap][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
473  }
474  else {
475  th2f_odds[endcap][kDeltaX]->Fill(qoverpt, resid_x*10.);
476  tprofile_odds[endcap][kDeltaX]->Fill(qoverpt, resid_x*10.);
477  th2f_odds[endcap][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
478  tprofile_odds[endcap][kDeltaDxDz]->Fill(qoverpt, resid_dxdz*1000.);
479  }
480  }
481 
482  // derivatives are in local coordinates, so these should be, too
483  resid_x = csc->hitresid(m_layer);
484  resid_dxdz = csc->resslope();
485 
486  // calculate derivative
487  TrajectoryStateOnSurface last_tracker_tsos;
488  double last_tracker_absZ = 0.;
489  std::vector<TrajectoryMeasurement> measurements = traj->measurements();
490  for (std::vector<TrajectoryMeasurement>::const_iterator im = measurements.begin(); im != measurements.end(); ++im) {
491  TrajectoryStateOnSurface tsos = im->forwardPredictedState();
492  if (tsos.isValid()) {
493  GlobalPoint pos = tsos.globalPosition();
494  if (pos.perp() < 200. && fabs(pos.z()) < 400.) {
495  if (fabs(pos.z()) > last_tracker_absZ) {
496  last_tracker_tsos = tsos;
497  last_tracker_absZ = fabs(pos.z());
498  }
499  }
500  }
501  }
502  if (last_tracker_absZ > 0.) {
503  FreeTrajectoryState ts_rebuilt(last_tracker_tsos.globalPosition(),
504  last_tracker_tsos.globalMomentum(),
505  last_tracker_tsos.charge(),
506  &*magneticField);
507 
508  double factor = (last_tracker_tsos.globalMomentum().mag() + 1.) / last_tracker_tsos.globalMomentum().mag();
509  FreeTrajectoryState ts_plus1GeV(last_tracker_tsos.globalPosition(),
510  GlobalVector(factor*last_tracker_tsos.globalMomentum().x(), factor*last_tracker_tsos.globalMomentum().y(), factor*last_tracker_tsos.globalMomentum().z()),
511  last_tracker_tsos.charge(),
512  &*magneticField);
513 
514  TrajectoryStateOnSurface extrapolation_rebuilt = propagator->propagate(ts_rebuilt, globalGeometry->idToDet(csc->localid(m_layer))->surface());
515  TrajectoryStateOnSurface extrapolation_plus1GeV = propagator->propagate(ts_plus1GeV, globalGeometry->idToDet(csc->localid(m_layer))->surface());
516 
517  if (extrapolation_rebuilt.isValid() && extrapolation_plus1GeV.isValid()) {
518 
519  double rebuiltx = extrapolation_rebuilt.localPosition().x();
520  double plus1x = extrapolation_plus1GeV.localPosition().x();
521 
522  if (fabs(resid_x) < 10.) {
523  double pterroverpt = resid_x/(rebuiltx-plus1x)/sqrt(1. + pz*pz/(px*px + py*py))*fabs(qoverpt)*100.;
524  double curverror = resid_x/(rebuiltx-plus1x)*qoverpt/sqrt(px*px + py*py + pz*pz);
525 
526  th2f_wheelsector[wheel][sector][kPtErr]->Fill(1./qoverpt, pterroverpt);
527  tprofile_wheelsector[wheel][sector][kPtErr]->Fill(1./qoverpt, pterroverpt);
528  th2f_wheelsector[wheel][sector][kCurvErr]->Fill(qoverpt, curverror);
529  tprofile_wheelsector[wheel][sector][kCurvErr]->Fill(qoverpt, curverror);
530 
531  th2f_endcap[endcap][chamber][kPtErr]->Fill(1./qoverpt, pterroverpt);
532  tprofile_endcap[endcap][chamber][kPtErr]->Fill(1./qoverpt, pterroverpt);
533  th2f_endcap[endcap][chamber][kCurvErr]->Fill(qoverpt, curverror);
534  tprofile_endcap[endcap][chamber][kCurvErr]->Fill(qoverpt, curverror);
535 
536  if (cscid.chamber() % 2 == 0) {
537  th2f_evens[endcap][kPtErr]->Fill(1./qoverpt, pterroverpt);
538  tprofile_evens[endcap][kPtErr]->Fill(1./qoverpt, pterroverpt);
539  th2f_evens[endcap][kCurvErr]->Fill(qoverpt, curverror);
540  tprofile_evens[endcap][kCurvErr]->Fill(qoverpt, curverror);
541  }
542  else {
543  th2f_odds[endcap][kPtErr]->Fill(1./qoverpt, pterroverpt);
544  tprofile_odds[endcap][kPtErr]->Fill(1./qoverpt, pterroverpt);
545  th2f_odds[endcap][kCurvErr]->Fill(qoverpt, curverror);
546  tprofile_odds[endcap][kCurvErr]->Fill(qoverpt, curverror);
547  }
548  }
549  }
550  }
551  } // if it's a good segment
552  } // if on our chamber
553  } // if CSC
554 
555  } // end loop over chamberIds
556  } // end if refit is okay
557  } // end if track pT is within range
558  } // end loop over tracks
559 }
TH2F * th2f_wheelsector[kNumWheels][12][kNumComponents]
TProfile * tprofile_endcap[kNumEndcap][36][kNumComponents]
AlignableNavigator * pNavigator()
T perp() const
Definition: PV3DBase.h:66
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:111
TH2F * th2f_odds[kNumEndcap][kNumComponents]
double global_hitresid(int i) const
T y() const
Definition: PV3DBase.h:57
GlobalPoint globalPosition() const
#define NULL
Definition: scimark2.h:8
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:133
DetId localid(int i) const
TH2F * th2f_endcap[kNumEndcap][36][kNumComponents]
DataContainer const & measurements() const
Definition: Trajectory.h:169
double resslope() const
static const int CSC
Definition: MuonSubdetId.h:15
T mag() const
Definition: PV3DBase.h:61
T sqrt(T t)
Definition: SSEVec.h:28
double pt() const
track transverse momentum
Definition: TrackBase.h:131
T z() const
Definition: PV3DBase.h:58
TProfile * tprofile_wheelsector[kNumWheels][12][kNumComponents]
double pz() const
z coordinate of momentum vector
Definition: TrackBase.h:137
double hitresid(int i) const
const T & get() const
Definition: EventSetup.h:55
TH2F * th2f_evens[kNumEndcap][kNumComponents]
GlobalVector globalMomentum() const
double global_resslope() const
int charge() const
track electric charge
Definition: TrackBase.h:113
static const int DT
Definition: MuonSubdetId.h:14
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:121
T x() const
Definition: PV3DBase.h:56
TProfile * tprofile_odds[kNumEndcap][kNumComponents]
TProfile * tprofile_evens[kNumEndcap][kNumComponents]
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:135
Global3DVector GlobalVector
Definition: GlobalVector.h:10

Member Data Documentation

bool AlignmentMonitorMuonVsCurvature::m_allowTIDTEC
private

Definition at line 56 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

int AlignmentMonitorMuonVsCurvature::m_layer
private

Definition at line 61 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

double AlignmentMonitorMuonVsCurvature::m_maxDxy
private

Definition at line 57 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

double AlignmentMonitorMuonVsCurvature::m_maxTrackerRedChi2
private

Definition at line 55 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

int AlignmentMonitorMuonVsCurvature::m_minCSCHits
private

Definition at line 60 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

int AlignmentMonitorMuonVsCurvature::m_minDT13Hits
private

Definition at line 58 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

int AlignmentMonitorMuonVsCurvature::m_minDT2Hits
private

Definition at line 59 of file AlignmentMonitorMuonVsCurvature.cc.

int AlignmentMonitorMuonVsCurvature::m_minTrackerHits
private

Definition at line 54 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

double AlignmentMonitorMuonVsCurvature::m_minTrackPt
private

Definition at line 53 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

std::string AlignmentMonitorMuonVsCurvature::m_propagator
private

Definition at line 62 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by event().

TH1F* AlignmentMonitorMuonVsCurvature::th1f_trackerRedChi2
private

Definition at line 112 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TH1F* AlignmentMonitorMuonVsCurvature::th1f_trackerRedChi2Diff
private

Definition at line 113 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TH2F* AlignmentMonitorMuonVsCurvature::th2f_endcap[kNumEndcap][36][kNumComponents]
private

Definition at line 109 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TH2F* AlignmentMonitorMuonVsCurvature::th2f_evens[kNumEndcap][kNumComponents]
private

Definition at line 104 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TH2F* AlignmentMonitorMuonVsCurvature::th2f_odds[kNumEndcap][kNumComponents]
private

Definition at line 105 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TH2F* AlignmentMonitorMuonVsCurvature::th2f_wheelsector[kNumWheels][12][kNumComponents]
private

Definition at line 101 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TProfile* AlignmentMonitorMuonVsCurvature::tprofile_endcap[kNumEndcap][36][kNumComponents]
private

Definition at line 110 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TProfile* AlignmentMonitorMuonVsCurvature::tprofile_evens[kNumEndcap][kNumComponents]
private

Definition at line 106 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TProfile* AlignmentMonitorMuonVsCurvature::tprofile_odds[kNumEndcap][kNumComponents]
private

Definition at line 107 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().

TProfile* AlignmentMonitorMuonVsCurvature::tprofile_wheelsector[kNumWheels][12][kNumComponents]
private

Definition at line 102 of file AlignmentMonitorMuonVsCurvature.cc.

Referenced by book(), and event().