CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ResidualRefitting.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include "ResidualRefitting.h"
3 #include <iomanip>
4 
5 //framework includes
12 
19 
23 
27 
29 
33 
35 
37  : magFieldToken_(esConsumes()),
38  topoToken_(esConsumes()),
39  trackingGeometryToken_(esConsumes()),
40  propagatorToken_(esConsumes(edm::ESInputTag("", cfg.getParameter<std::string>("propagator")))),
41  outputFileName_(cfg.getUntrackedParameter<std::string>("histoutputFile")),
42  muons_(cfg.getParameter<edm::InputTag>("muons")),
43  muonsRemake_(cfg.getParameter<edm::InputTag>("muonsRemake")), //This Feels Misalignment
44  muonsNoStation1_(cfg.getParameter<edm::InputTag>("muonsNoStation1")),
45  muonsNoStation2_(cfg.getParameter<edm::InputTag>("muonsNoStation2")),
46  muonsNoStation3_(cfg.getParameter<edm::InputTag>("muonsNoStation3")),
47  muonsNoStation4_(cfg.getParameter<edm::InputTag>("muonsNoStation4")),
48 
49  /*
50  muonsNoPXBLayer1_ ( cfg.getParameter<edm::InputTag>("muonsNoPXBLayer1" ) ),
51  muonsNoPXBLayer2_ ( cfg.getParameter<edm::InputTag>("muonsNoPXBLayer1" ) ),
52  muonsNoPXBLayer3_ ( cfg.getParameter<edm::InputTag>("muonsNoPXBLayer1" ) ),
53 
54  muonsNoTIBLayer1_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer1" ) ),
55  muonsNoTIBLayer2_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer2" ) ),
56  muonsNoTIBLayer3_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer3" ) ),
57  muonsNoTIBLayer4_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer4" ) ),
58 
59  muonsNoTOBLayer1_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer1" ) ),
60  muonsNoTOBLayer2_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer2" ) ),
61  muonsNoTOBLayer3_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer3" ) ),
62  muonsNoTOBLayer4_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer4" ) ),
63  muonsNoTOBLayer5_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer5" ) ),
64  muonsNoTOBLayer6_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer6" ) ),*/
65  debug_(cfg.getUntrackedParameter<bool>("doDebug")),
66  outputFile_(nullptr),
67  outputTree_(nullptr),
68  outputBranch_(nullptr),
69  theField(nullptr) {
70  eventInfo_.evtNum_ = 0;
71  eventInfo_.evtNum_ = 0;
72 
73  // service parameters
74  edm::ParameterSet serviceParameters = cfg.getParameter<edm::ParameterSet>("ServiceParameters");
75 
76  // the services
77  theService = new MuonServiceProxy(serviceParameters, consumesCollector());
78 
79 } //The constructor
80 
82  if (debug_)
83  printf("STARTING EVENT\n");
84 
85  eventInfo_.evtNum_ = (int)event.id().run();
86  eventInfo_.runNum_ = (int)event.id().event();
87 
88  // Generator Collection
89 
90  // The original muon collection that is sitting in memory
92 
98 
99  event.getByLabel(muons_, muons); //set label to muons
100  event.getByLabel(muonsRemake_, muonTracks);
101  event.getByLabel(muonsNoStation1_, muonsNoSt1);
102  event.getByLabel(muonsNoStation2_, muonsNoSt2);
103  event.getByLabel(muonsNoStation3_, muonsNoSt3);
104  event.getByLabel(muonsNoStation4_, muonsNoSt4);
105 
106  /*
107 // std::cout<<"Muon Collection No PXB "<<std::endl;
108 //Tracker Barrel Pixel Refits
109  edm::Handle<MuonCollection> muonsNoPXBLayer1Coll;
110  event.getByLabel(muonsNoPXBLayer1_, muonsNoPXBLayer1Coll);
111  edm::Handle<MuonCollection> muonsNoPXBLayer2Coll;
112  event.getByLabel(muonsNoPXBLayer2_, muonsNoPXBLayer2Coll);
113  edm::Handle<MuonCollection> muonsNoPXBLayer3Coll;
114  event.getByLabel(muonsNoPXBLayer3_, muonsNoPXBLayer3Coll);
115 // std::cout<<"Muon Collection No TIB "<<std::endl;
116 // Tracker Inner Barrel Refits
117  edm::Handle<MuonCollection> muonsNoTIBLayer1Coll;
118  event.getByLabel(muonsNoTIBLayer1_, muonsNoTIBLayer1Coll);
119  edm::Handle<MuonCollection> muonsNoTIBLayer2Coll;
120  event.getByLabel(muonsNoTIBLayer2_, muonsNoTIBLayer2Coll);
121  edm::Handle<MuonCollection> muonsNoTIBLayer3Coll;
122  event.getByLabel(muonsNoTIBLayer3_, muonsNoTIBLayer3Coll);
123  edm::Handle<MuonCollection> muonsNoTIBLayer4Coll;
124  event.getByLabel(muonsNoTIBLayer4_, muonsNoTIBLayer4Coll);
125 
126 // std::cout<<"Muon Collection No TOB "<<std::endl;
127 
128 //Tracker outer barrel refits
129  edm::Handle<MuonCollection> muonsNoTOBLayer1Coll;
130  event.getByLabel(muonsNoTOBLayer1_, muonsNoTOBLayer1Coll);
131  edm::Handle<MuonCollection> muonsNoTOBLayer2Coll;
132  event.getByLabel(muonsNoTOBLayer2_, muonsNoTOBLayer2Coll);
133  edm::Handle<MuonCollection> muonsNoTOBLayer3Coll;
134  event.getByLabel(muonsNoTOBLayer3_, muonsNoTOBLayer3Coll);
135  edm::Handle<MuonCollection> muonsNoTOBLayer4Coll;
136  event.getByLabel(muonsNoTOBLayer4_, muonsNoTOBLayer4Coll);
137  edm::Handle<MuonCollection> muonsNoTOBLayer5Coll;
138  event.getByLabel(muonsNoTOBLayer5_, muonsNoTOBLayer5Coll);
139  edm::Handle<MuonCollection> muonsNoTOBLayer6Coll;
140  event.getByLabel(muonsNoTOBLayer6_, muonsNoTOBLayer6Coll);
141 */
142  //magnetic field information
143  theField = &eventSetup.getData(magFieldToken_);
144  edm::ESHandle<GlobalTrackingGeometry> globalTrackingGeometry = eventSetup.getHandle(trackingGeometryToken_);
146  theService->update(eventSetup);
147 
148  //Zero storage
149  zero_storage();
150 
151  //Do the Gmr Muons from the unModified Collection
152 
153  /*
154  int iGmr = 0;
155  if ( (muons->end() - muons->begin()) > 0) printf("Data Dump:: Original GMR Muons\n");
156  for ( MuonCollection::const_iterator muon = muons->begin(); muon!=muons->end(); muon++, iGmr++) {
157  if ( iGmr >= ResidualRefitting::N_MAX_STORED) break; // error checking
158  if (!debug
159 
160  dumpTrackRef(muon->combinedMuon(), "cmb");
161  dumpTrackRef(muon->standAloneMuon(), "sam");
162  dumpTrackRef(muon->track(), "trk");
163 
164 
165  }
166  storageGmrOld_.n_ = iGmr;
167  storageSamNew_.n_ = iGmr;
168 */
169 
170  //Refitted muons
171  if (debug_)
172  printf("Data Dump:: Rebuilt GMR Muon Track With TeV refitter default\n");
173  int iGmrRemake = 0;
174  for (reco::TrackCollection::const_iterator muon = muonTracks->begin(); muon != muonTracks->end();
175  muon++, iGmrRemake++) {
176  if (iGmrRemake >= ResidualRefitting::N_MAX_STORED)
177  break; // error checking
178  // from TrackInfoProducer/test/TrackInfoAnalyzerExample.cc
179  reco::TrackRef trackref = reco::TrackRef(muonTracks, iGmrRemake);
180 
181  if (debug_)
182  dumpTrackRef(trackref, "gmr");
183  muonInfo(storageGmrNew_, trackref, iGmrRemake);
184  }
185  storageGmrNew_.n_ = iGmrRemake;
186 
187  if (debug_)
188  printf("muons Remake");
189  if (debug_)
190  printf("-----------------------------------------\n");
191  CollectTrackHits(muonTracks, storageTrackExtrapRec_, eventSetup);
192 
193  if (true) {
194  printf("muons No Station 1");
195  printf("-----------------------------------------\n");
196  }
197  NewTrackMeasurements(muonTracks, muonsNoSt1, storageTrackExtrapRecNoSt1_);
198 
199  if (true) {
200  printf("muons No Station 2");
201  printf("-----------------------------------------\n");
202  }
203  NewTrackMeasurements(muonTracks, muonsNoSt2, storageTrackExtrapRecNoSt2_);
204 
205  if (true) {
206  printf("muons No Station 3");
207  printf("-----------------------------------------\n");
208  }
209  NewTrackMeasurements(muonTracks, muonsNoSt3, storageTrackExtrapRecNoSt3_);
210 
211  if (true) {
212  printf("muons No Station 4");
213  printf("-----------------------------------------\n");
214  }
215  NewTrackMeasurements(muonTracks, muonsNoSt4, storageTrackExtrapRecNoSt4_);
216 
217  // dumpMuonRecHits(storageRecMuon_);
218 
219  /****************************************************************************************************************************************/
220 
221  /*
222  * extrapolates track to a cylinder.
223  * commented for cosmic runs with no tracker in reco muons!!
224  *
225 */
226 
227  int iGmrCyl = 0;
228  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); muon++, iGmrCyl++) {
229  dumpTrackRef(muon->combinedMuon(), "cmb");
230  dumpTrackRef(muon->standAloneMuon(), "sam");
231  dumpTrackRef(muon->track(), "trk");
232 
233  cylExtrapTrkSam(iGmrCyl, muon->standAloneMuon(), samExtrap120_, 120.);
234  cylExtrapTrkSam(iGmrCyl, muon->track(), trackExtrap120_, 120.);
235  }
236  samExtrap120_.n_ = iGmrCyl;
237  trackExtrap120_.n_ = iGmrCyl;
238 
239  if (iGmrRemake > 0 || iGmrCyl > 0) {
240  outputTree_->Fill();
241  std::cout << "FILLING NTUPLE!" << std::endl;
242  std::cout << "Entries Recorded: " << outputTree_->GetEntries() << " Branch :: " << outputBranch_->GetEntries()
243  << std::endl
244  << std::endl;
245  } else
246  std::cout << "no tracks -- no fill!\n" << std::endl << std::endl;
247 
248  // /*************************************************************************************************************/
249  // //END OF ntuple dumper
250  // //END OF ntuple dumper
251  // /***********************************************************************************************************/
252 }
253 //end Analyze() main function
254 
255 //------------------------------------------------------------------------------
256 //
257 // Destructor
258 //
260  delete outputFile_;
261  delete theService;
262 }
263 //
264 // Track Collection Analysis
265 //
268  const edm::EventSetup& eventSetup) {
269  //Retrieve tracker topology from geometry
270  const TrackerTopology* const tTopo = &eventSetup.getData(topoToken_);
271 
272  int iMuonHit = 0;
273  int iTrackHit = 0;
274  int numTracks = 0;
275 
276  for (reco::TrackCollection::const_iterator muon = trackColl->begin(); muon != trackColl->end(); muon++) {
277  int iTrack = muon - trackColl->begin();
278  reco::TrackRef trackref = reco::TrackRef(trackColl, iTrack);
280 
281  if (debug_)
282  dumpTrackRef(trackref, "CollectTrackHits Track");
283 
284  int iRec = 0;
285  for (auto const& rec : muon->recHits()) {
286  DetId detid = rec->geographicalId();
287 
288  if (detid.det() != DetId::Muon && detid.det() != DetId::Tracker) {
289  if (debug_)
290  printf("Rec Hit not from muon system or tracker... continuing...\n");
291  continue;
292  }
293  // numTracks++;
294  // Get Local and Global Position of Hits
295 
296  LocalPoint lp = rec->localPosition();
297  float lpX = lp.x();
298  float lpY = lp.y();
299  float lpZ = lp.z();
300 
302  theService->trackingGeometry()->idToDet(rec->geographicalId()), rec);
303 
304  GlobalPoint gp = mrhp->globalPosition();
305  float gpRecX = gp.x();
306  float gpRecY = gp.y();
307  float gpRecZ = gp.z();
308  float gpRecEta = gp.eta();
309  float gpRecPhi = gp.phi();
310 
311  if (detid.det() == DetId::Muon) {
312  int systemMuon = detid.subdetId(); // 1 DT; 2 CSC; 3 RPC
313  int endcap = -999;
314  int station = -999;
315  int ring = -999;
316  int chamber = -999;
317  int layer = -999;
318  int superLayer = -999;
319  int wheel = -999;
320  int sector = -999;
321  if (systemMuon == MuonSubdetId::CSC) {
322  CSCDetId id(detid.rawId());
323  endcap = id.endcap();
324  station = id.station();
325  ring = id.ring();
326  chamber = id.chamber();
327  layer = id.layer();
328  if (debug_)
329  printf("CSC\t[endcap][station][ringN][chamber][layer]:[%d][%d][%d][%d][%d]\t",
330  endcap,
331  station,
332  ring,
333  chamber,
334  layer);
335 
336  } else if (systemMuon == MuonSubdetId::DT) {
337  DTWireId id(detid.rawId());
338  station = id.station();
339  layer = id.layer();
340  superLayer = id.superLayer();
341  wheel = id.wheel();
342  sector = id.sector();
343  if (debug_)
344  printf("DT \t[station][layer][superlayer]:[%d][%d][%d]\n", station, layer, superLayer);
345 
346  } else if (systemMuon == MuonSubdetId::RPC) {
347  RPCDetId id(detid.rawId());
348  station = id.station();
349  if (debug_)
350  printf("RPC\t[station]:[%d]\n", station);
351  }
352 
353  storageRecMuon_.muonLink_[iMuonHit] = iTrack;
354  storageRecMuon_.system_[iMuonHit] = systemMuon;
355  storageRecMuon_.endcap_[iMuonHit] = endcap;
356  storageRecMuon_.station_[iMuonHit] = station;
357  storageRecMuon_.ring_[iMuonHit] = ring;
358  storageRecMuon_.chamber_[iMuonHit] = chamber;
359  storageRecMuon_.layer_[iMuonHit] = layer;
360  storageRecMuon_.superLayer_[iMuonHit] = superLayer;
361  storageRecMuon_.wheel_[iMuonHit] = wheel;
362  storageRecMuon_.sector_[iMuonHit] = sector;
363 
364  storageRecMuon_.gpX_[iMuonHit] = gpRecX;
365  storageRecMuon_.gpY_[iMuonHit] = gpRecY;
366  storageRecMuon_.gpZ_[iMuonHit] = gpRecZ;
367  storageRecMuon_.gpEta_[iMuonHit] = gpRecEta;
368  storageRecMuon_.gpPhi_[iMuonHit] = gpRecPhi;
369  storageRecMuon_.lpX_[iMuonHit] = lpX;
370  storageRecMuon_.lpY_[iMuonHit] = lpY;
371  storageRecMuon_.lpZ_[iMuonHit] = lpZ;
372  iMuonHit++;
373 
374  } else if (detid.det() == DetId::Tracker) {
375  if (debug_)
376  printf("Tracker\n");
377 
378  StoreTrackerRecHits(detid, tTopo, iTrack, iTrackHit);
379 
380  storageTrackHit_.gpX_[iTrackHit] = gpRecX;
381  storageTrackHit_.gpY_[iTrackHit] = gpRecY;
382  storageTrackHit_.gpZ_[iTrackHit] = gpRecZ;
383  storageTrackHit_.gpEta_[iTrackHit] = gpRecEta;
384  storageTrackHit_.gpPhi_[iTrackHit] = gpRecPhi;
385  storageTrackHit_.lpX_[iTrackHit] = lpX;
386  storageTrackHit_.lpY_[iTrackHit] = lpY;
387  storageTrackHit_.lpZ_[iTrackHit] = lpZ;
388  iTrackHit++;
389  } else
390  printf("THIS CAN NOT HAPPEN\n");
391 
392  trkExtrap(detid, numTracks, iTrack, iRec, recoStart, lp, trackExtrap);
393  numTracks++;
394 
395  if (debug_)
396  printf("\tLocal Positon: \tx = %2.2f\ty = %2.2f\tz = %2.2f\n", lpX, lpY, lpZ);
397  if (debug_)
398  printf("\tGlobal Position: \tx = %6.2f\ty = %6.2f\tz = %6.2f\teta = %4.2f\tphi = %3.2f\n",
399  gpRecX,
400  gpRecY,
401  gpRecZ,
402  gpRecEta,
403  gpRecPhi);
404 
405  ++iRec;
406  }
407  }
408 
409  storageRecMuon_.n_ = iMuonHit;
410  storageTrackHit_.n_ = iTrackHit;
411  trackExtrap.n_ = numTracks;
412 }
413 //
414 // Deal with Re-Fitted Track with some station omitted.
415 //
416 // This should take the new track, match it to its track before refitting with the hits dumped, and extrapolate out to the
417 // rec hits that were removed from the fit.
418 //
419 //
420 
424  int numTracks = 0;
425  int recCounter = 0;
426 
427  for (reco::TrackCollection::const_iterator muon = trackColl->begin(); muon != trackColl->end(); muon++) {
428  int iTrack = muon - trackColl->begin();
429 
430  reco::TrackRef trackref = reco::TrackRef(trackColl, iTrack);
432 
433  int iTrackLink = MatchTrackWithRecHits(muon, trackCollOrig);
434  reco::TrackRef ref = reco::TrackRef(trackCollOrig, iTrackLink);
435 
436  for (auto const& rec1 : ref->recHits()) {
437  bool unbiasedRec = true;
438 
439  for (auto const& rec2 : muon->recHits()) {
440  if (IsSameHit(*rec1, *rec2)) {
441  unbiasedRec = false;
442  break;
443  }
444  }
445  if (!unbiasedRec)
446  continue;
447 
448  DetId detid = rec1->geographicalId();
449 
451  theService->trackingGeometry()->idToDet(rec1->geographicalId()), rec1);
452 
453  trkExtrap(detid, numTracks, iTrackLink, recCounter, recoStart, rec1->localPosition(), trackExtrap);
454  numTracks++;
455  }
456  }
457 
458  trackExtrap.n_ = numTracks;
459 }
460 //
461 // Find the original track that corresponds to the re-fitted track
462 //
463 int ResidualRefitting::MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt,
465  if (debug_)
466  printf("Matching a re-fitted track to the original track.\n");
467 
468  int TrackMatch = -1;
469 
470  for (auto const& rec : trackIt->recHits()) {
471  bool foundMatch = false;
472  for (reco::TrackCollection::const_iterator refIt = ref->begin(); refIt != ref->end(); refIt++) {
473  int iTrackMatch = refIt - ref->begin();
474  if (foundMatch && TrackMatch != iTrackMatch)
475  break;
476  for (auto const& recRef : refIt->recHits()) {
477  if (!IsSameHit(*rec, *recRef))
478  continue;
479 
480  foundMatch = true;
481  TrackMatch = iTrackMatch;
482  // printf("Rec hit match for original track %d\n", iTrackMatch);
483  }
484  }
485  if (!foundMatch) {
486  printf("SOMETHING WENT WRONG! Could not match Track with original track!");
487  exit(1);
488  }
489  }
490  if (debug_)
491  printf("Rec hit match for original track %d\n", TrackMatch);
492 
493  // reco::TrackRef trackref=reco::TrackRef(ref,TrackMatch);
494  return TrackMatch;
495 }
496 /*
497 //
498 // Match two tracks to see if one is a subset of the other
499 //
500 
501 bool ResidualRefitting::TrackSubset(reco::TrackRef trackSub, reco::TrackRef trackTop) {
502 
503 
504  bool matchAll = true;
505 
506  for (trackingRecHit_iterator recSub = trackSub->recHits().begin(); recSub!=trackSub->recHits().end(); recSub++) {
507 
508  bool matchSub = false;
509 
510 
511  for (trackingRecHit_iterator recTop = trackTop->recHits().begin(); recTop!=trackTop->recHits().end(); recTop++) {
512 
513  if ( recSub == recTop ) matchSub = true;
514  if (matchSub) break;
515 
516  }
517  if (!matchSub) return false;
518 
519  }
520 
521  return matchAll;
522 
523 }
524 */
525 
526 //
527 // Check to see if the rec hits are the same
528 //
530  double lpx1 = hit1.localPosition().x();
531  double lpy1 = hit1.localPosition().y();
532  double lpz1 = hit1.localPosition().z();
533 
534  double lpx2 = hit2.localPosition().x();
535  double lpy2 = hit2.localPosition().y();
536  double lpz2 = hit2.localPosition().z();
537  if (fabs(lpx1 - lpx2) > 1e-3)
538  return false;
539  // printf("Match lpx...\n");
540  if (fabs(lpy1 - lpy2) > 1e-3)
541  return false;
542  // printf("Match lpy...\n");
543  if (fabs(lpz1 - lpz2) > 1e-3)
544  return false;
545  // printf("Match lpz...\n");
546 
547  return true;
548 }
549 
550 //
551 // Store Tracker Rec Hits
552 //
553 void ResidualRefitting::StoreTrackerRecHits(DetId detid, const TrackerTopology* tTopo, int iTrack, int iRec) {
554  int detector = -1;
555  int subdetector = -1;
556  int blade = -1;
557  int disk = -1;
558  int ladder = -1;
559  int layer = -1;
560  int module = -1;
561  int panel = -1;
562  int ring = -1;
563  int side = -1;
564  int wheel = -1;
565 
566  //Detector Info
567 
568  detector = detid.det();
569  subdetector = detid.subdetId();
570 
571  if (detector != DetId::Tracker) {
572  std::cout << "OMFG NOT THE TRACKER\n" << std::endl;
573  return;
574  }
575 
576  if (debug_)
577  std::cout << "Tracker:: ";
578  if (subdetector == ResidualRefitting::PXB) {
579  layer = tTopo->pxbLayer(detid.rawId());
580  ladder = tTopo->pxbLadder(detid.rawId());
581  module = tTopo->pxbModule(detid.rawId());
582  if (debug_)
583  std::cout << "PXB"
584  << "\tlayer = " << layer << "\tladder = " << ladder << "\tmodule = " << module;
585 
586  } else if (subdetector == ResidualRefitting::PXF) {
587  side = tTopo->pxfSide(detid.rawId());
588  disk = tTopo->pxfDisk(detid.rawId());
589  blade = tTopo->pxfBlade(detid.rawId());
590  panel = tTopo->pxfPanel(detid.rawId());
591  module = tTopo->pxfModule(detid.rawId());
592  if (debug_)
593  std::cout << "PXF"
594  << "\tside = " << side << "\tdisk = " << disk << "\tblade = " << blade << "\tpanel = " << panel
595  << "\tmodule = " << module;
596 
597  } else if (subdetector == ResidualRefitting::TIB) {
598  layer = tTopo->tibLayer(detid.rawId());
599  module = tTopo->tibModule(detid.rawId());
600  if (debug_)
601  std::cout << "TIB"
602  << "\tlayer = " << layer << "\tmodule = " << module;
603  } else if (subdetector == ResidualRefitting::TID) {
604  side = tTopo->tidSide(detid.rawId());
605  wheel = tTopo->tidWheel(detid.rawId());
606  ring = tTopo->tidRing(detid.rawId());
607  if (debug_)
608  std::cout << "TID"
609  << "\tside = " << side << "\twheel = " << wheel << "\tring = " << ring;
610 
611  } else if (subdetector == ResidualRefitting::TOB) {
612  layer = tTopo->tobLayer(detid.rawId());
613  module = tTopo->tobModule(detid.rawId());
614  if (debug_)
615  std::cout << "TOB"
616  << "\tlayer = " << layer << "\tmodule = " << module;
617 
618  } else if (subdetector == ResidualRefitting::TEC) {
619  ring = tTopo->tecRing(detid.rawId());
620  module = tTopo->tecModule(detid.rawId());
621  if (debug_)
622  std::cout << "TEC"
623  << "\tring = " << ring << "\tmodule = " << module;
624  }
625 
626  //Do Storage
627 
628  storageTrackHit_.muonLink_[iRec] = iTrack;
629  storageTrackHit_.detector_[iRec] = detector;
631  storageTrackHit_.blade_[iRec] = blade;
632  storageTrackHit_.disk_[iRec] = disk;
634  storageTrackHit_.layer_[iRec] = layer;
636  storageTrackHit_.panel_[iRec] = panel;
637  storageTrackHit_.ring_[iRec] = ring;
638  storageTrackHit_.side_[iRec] = side;
639  storageTrackHit_.wheel_[iRec] = wheel;
640 }
641 
642 //
643 // Store Muon info on P, Pt, eta, phi
644 //
646  storeMuon.pt_[val] = muon->pt();
647  storeMuon.p_[val] = muon->p();
648  storeMuon.eta_[val] = muon->eta();
649  storeMuon.phi_[val] = muon->phi();
650  storeMuon.charge_[val] = muon->charge();
651  storeMuon.numRecHits_[val] = muon->numberOfValidHits();
652  storeMuon.chiSq_[val] = muon->chi2();
653  storeMuon.ndf_[val] = muon->ndof();
654  storeMuon.chiSqOvrNdf_[val] = muon->normalizedChi2();
655 }
656 //
657 // Fill a track extrapolation
658 //
660  int iTrk,
661  int iTrkLink,
662  int iRec,
663  const FreeTrajectoryState& freeTrajState,
664  const LocalPoint& recPoint,
665  storage_trackExtrap& storeTemp) {
666  bool dump_ = debug_;
667 
668  if (dump_)
669  std::cout << "In the trkExtrap function" << std::endl;
670 
671  float gpExtrapX = -99999;
672  float gpExtrapY = -99999;
673  float gpExtrapZ = -99999;
674  float gpExtrapEta = -99999;
675  float gpExtrapPhi = -99999;
676 
677  float lpX = -99999;
678  float lpY = -99999;
679  float lpZ = -99999;
680 
681  //
682  // Get the local positions for the recHits
683  //
684 
685  float recLpX = recPoint.x();
686  float recLpY = recPoint.y();
687  float recLpZ = recPoint.z();
688 
689  float resX = -9999;
690  float resY = -9999;
691  float resZ = -9999;
692 
693  const GeomDet* gdet = theService->trackingGeometry()->idToDet(detid);
694 
695  // TrajectoryStateOnSurface surfTest = prop.propagate(freeTrajState, gdet->surface());
696  TrajectoryStateOnSurface surfTest = thePropagator->propagate(freeTrajState, gdet->surface());
697 
698  if (surfTest.isValid()) {
699  GlobalPoint globTest = surfTest.globalPosition();
700  gpExtrapX = globTest.x();
701  gpExtrapY = globTest.y();
702  gpExtrapZ = globTest.z();
703  gpExtrapEta = globTest.eta();
704  gpExtrapPhi = globTest.phi();
705  LocalPoint loc = surfTest.localPosition();
706  if (detid.det() == DetId::Muon || detid.det() == DetId::Tracker) {
707  lpX = loc.x();
708  lpY = loc.y();
709  lpZ = loc.z();
710 
711  resX = lpX - recLpX;
712  resY = lpY - recLpY;
713  resZ = lpZ - recLpZ;
714  }
715  }
716  storeTemp.muonLink_[iTrk] = iTrkLink;
717  storeTemp.recLink_[iTrk] = iRec;
718  storeTemp.gpX_[iTrk] = gpExtrapX;
719  storeTemp.gpY_[iTrk] = gpExtrapY;
720  storeTemp.gpZ_[iTrk] = gpExtrapZ;
721  storeTemp.gpEta_[iTrk] = gpExtrapEta;
722  storeTemp.gpPhi_[iTrk] = gpExtrapPhi;
723  storeTemp.lpX_[iTrk] = lpX;
724  storeTemp.lpY_[iTrk] = lpY;
725  storeTemp.lpZ_[iTrk] = lpZ;
726  storeTemp.resX_[iTrk] = resX;
727  storeTemp.resY_[iTrk] = resY;
728  storeTemp.resZ_[iTrk] = resZ;
729 
730  printf("station: %d\tsector: %d\tresX storage: %4.2f\n", ReturnStation(detid), ReturnSector(detid), resX);
731 }
732 //
733 // Return the station
734 //
736  int station = -999;
737 
738  if (detid.det() == DetId::Muon) {
739  int systemMuon = detid.subdetId(); // 1 DT; 2 CSC; 3 RPC
740  if (systemMuon == MuonSubdetId::CSC) {
741  CSCDetId id(detid.rawId());
742  station = id.station();
743 
744  } else if (systemMuon == MuonSubdetId::DT) {
745  DTWireId id(detid.rawId());
746  station = id.station();
747 
748  } else if (systemMuon == MuonSubdetId::RPC) {
749  RPCDetId id(detid.rawId());
750  station = id.station();
751  }
752  }
753 
754  return station;
755 }
756 //
757 // Return the sector
758 //
760  int sector = -999;
761 
762  if (detid.det() == DetId::Muon) {
763  int systemMuon = detid.subdetId(); // 1 DT; 2 CSC; 3 RPC
764  if (systemMuon == MuonSubdetId::DT) {
765  DTWireId id(detid.rawId());
766  sector = id.sector();
767  }
768  }
769 
770  return sector;
771 }
772 
773 //
774 // Store the SAM and Track position info at a particular rho
775 //
779  double rho) {
780  Cylinder::PositionType pos(0, 0, 0);
782 
783  Cylinder::CylinderPointer myCylinder = Cylinder::build(pos, rot, rho);
784  // SteppingHelixPropagator inwardProp ( theField, oppositeToMomentum );
785  // SteppingHelixPropagator outwardProp ( theField, alongMomentum );
786  FreeTrajectoryState recoStart = freeTrajStateMuon(track);
787  // TrajectoryStateOnSurface recoProp = outwardProp.propagate(recoStart, *myCylinder);
788  TrajectoryStateOnSurface recoProp = thePropagator->propagate(recoStart, *myCylinder);
789 
790  double xVal = -9999;
791  double yVal = -9999;
792  double zVal = -9999;
793  double phiVal = -9999;
794  double etaVal = -9999;
795 
796  if (recoProp.isValid()) {
797  GlobalPoint recoPoint = recoProp.globalPosition();
798  xVal = recoPoint.x();
799  yVal = recoPoint.y();
800  zVal = recoPoint.z();
801  phiVal = recoPoint.phi();
802  etaVal = recoPoint.eta();
803  }
804  storage.muonLink_[recNum] = recNum;
805  storage.gpX_[recNum] = xVal;
806  storage.gpY_[recNum] = yVal;
807  storage.gpZ_[recNum] = zVal;
808  storage.gpEta_[recNum] = etaVal;
809  storage.gpPhi_[recNum] = phiVal;
810 
811  float rhoVal = sqrt(xVal * xVal + yVal * yVal);
812 
813  printf("Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
814  if (debug_)
815  printf("Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
816 }
818 //Pre-Job junk
820 
821 //
822 // zero storage
823 //
825  if (debug_)
826  printf("zero_storage\n");
827 
840  //zero out the tracker
844 
846 
851 
853 
860 
862 
866 
868 
873 
875 
882 
884 
891 
893 
895 
899 
901 
906 
913 
915 
917 
918  storageRecMuon_.n_ = 0;
919  storageTrackHit_.n_ = 0;
920 }
921 //
922 // Zero out a muon reference
923 //
925  str->n_ = 0;
926 
927  for (int i = 0; i < ResidualRefitting::N_MAX_STORED; i++) {
928  str->pt_[i] = -9999;
929  str->eta_[i] = -9999;
930  str->p_[i] = -9999;
931  str->phi_[i] = -9999;
932  str->numRecHits_[i] = -9999;
933  str->chiSq_[i] = -9999;
934  str->ndf_[i] = -9999;
935  str->chiSqOvrNdf_[i] = -9999;
936  }
937 }
938 //
939 // Zero track extrapolation
940 //
942  str->n_ = 0;
943  for (int i = 0; i < ResidualRefitting::N_MAX_STORED_HIT; i++) {
944  str->muonLink_[i] = -9999;
945  str->recLink_[i] = -9999;
946  str->gpX_[i] = -9999;
947  str->gpY_[i] = -9999;
948  str->gpZ_[i] = -9999;
949  str->gpEta_[i] = -9999;
950  str->gpPhi_[i] = -9999;
951  str->lpX_[i] = -9999;
952  str->lpY_[i] = -9999;
953  str->lpZ_[i] = -9999;
954  str->resX_[i] = -9999;
955  str->resY_[i] = -9999;
956  str->resZ_[i] = -9999;
957  }
958 }
959 //
960 // Begin Job
961 //
963  std::cout << "Creating file " << outputFileName_.c_str() << std::endl;
964 
965  outputFile_ = new TFile(outputFileName_.c_str(), "RECREATE");
966 
967  outputTree_ = new TTree("outputTree", "outputTree");
968 
969  outputTree_->Branch("eventInfo",
970  &eventInfo_,
971  "evtNum_/I:"
972  "runNum_/I");
973 
980 
986 
1004 
1021 
1022  outputBranch_ = outputTree_->Branch("recHitsNew",
1023  &storageRecMuon_,
1024 
1025  "n_/I:"
1026  "muonLink_[1000]/I:"
1027 
1028  "system_[1000]/I:"
1029  "endcap_[1000]/I:"
1030  "station_[1000]/I:"
1031  "ring_[1000]/I:"
1032  "chamber_[1000]/I:"
1033  "layer_[1000]/I:"
1034  "superLayer_[1000]/I:"
1035  "wheel_[1000]/I:"
1036  "sector_[1000]/I:"
1037 
1038  "gpX_[1000]/F:"
1039  "gpY_[1000]/F:"
1040  "gpZ_[1000]/F:"
1041  "gpEta_[1000]/F:"
1042  "gpPhi_[1000]/F:"
1043  "lpX_[1000]/F:"
1044  "lpY_[1000]/F:"
1045  "lpZ_[1000]/F");
1046 
1047  outputBranch_ = outputTree_->Branch("recHitsTracker",
1049 
1050  "n_/I:"
1051 
1052  "muonLink_[1000]/I:"
1053  "detector_[1000]/I:"
1054  "subdetector_[1000]/I:"
1055  "blade_[1000]/I:"
1056  "disk_[1000]/I:"
1057  "ladder_[1000]/I:"
1058  "layer_[1000]/I:"
1059  "module_[1000]/I:"
1060  "panel_[1000]/I:"
1061  "ring_[1000]/I:"
1062  "side_[1000]/I:"
1063  "wheel_[1000]/I:"
1064 
1065  "gpX_[1000]/F:"
1066  "gpY_[1000]/F:"
1067  "gpZ_[1000]/F:"
1068  "gpEta_[1000]/F:"
1069  "gpPhi_[1000]/F:"
1070  "lpX_[1000]/F:"
1071  "lpY_[1000]/F:"
1072  "lpZ_[1000]/F");
1073 
1079 
1097 
1100 }
1101 //
1102 // Set the Muon Branches
1103 //
1105  outputBranch_ = outputTree_->Branch(branchName.c_str(),
1106  &storageTmp,
1107  "n_/I:"
1108  "charge_[10]/I:"
1109  "pt_[10]/F:"
1110  "eta_[10]/F:"
1111  "p_[10]/F:"
1112  "phi_[10]/F:"
1113  "numRecHits_[10]/I:"
1114  "chiSq_[10]/F:"
1115  "ndf_[10]/F:"
1116  "chiSqOvrNdf_[10]/F"
1117 
1118  );
1119 }
1120 //
1121 // Set the Branches for Track Extrapolations
1122 //
1124  outputBranch_ = outputTree_->Branch(branchName.c_str(),
1125  &storageTmp,
1126  "n_/I:"
1127  "muonLink_[1000]/I:"
1128  "recLink_[1000]/I:"
1129  "gpX_[1000]/F:"
1130  "gpY_[1000]/F:"
1131  "gpZ_[1000]/F:"
1132  "gpEta_[1000]/F:"
1133  "gpPhi_[1000]/F:"
1134  "lpX_[1000]/F:"
1135  "lpY_[1000]/F:"
1136  "lpZ_[1000]/F:"
1137  "resX_[1000]/F:"
1138  "resY_[1000]/F:"
1139  "resZ_[1000]/F"
1140 
1141  );
1142 }
1143 //
1144 // End Job
1145 //
1147  outputFile_->Write();
1148 
1149  outputFile_->Close();
1150 }
1151 //
1152 // Return a Free Trajectory state for a muon track
1153 //
1155  math::XYZPoint innerPos = muon->referencePoint();
1156  math::XYZVector innerMom = muon->momentum();
1157  if (debug_)
1158  std::cout << "Inner Pos: "
1159  << "\tx = " << innerPos.X() << "\ty = " << innerPos.Y() << "\tz = " << innerPos.Z() << std::endl;
1160 
1161  GlobalPoint innerPoint(innerPos.X(), innerPos.Y(), innerPos.Z());
1162  GlobalVector innerVec(innerMom.X(), innerMom.Y(), innerMom.Z());
1163 
1164  FreeTrajectoryState recoStart(innerPoint, innerVec, muon->charge(), theField);
1165  return recoStart;
1166 }
1167 
1169 // nTuple value Dumps
1171 
1172 //
1173 // dump Track Extrapolation
1174 //
1176  std::cout << "\n\nExtrapolation Dump:\n";
1177  for (unsigned int i = 0; i < (unsigned int)track.n_; i++) {
1178  // double rho = sqrt( (float)track.gpX_[i] * (float)track.gpX_[i] + (float)track.gpY_[i] * (float)track.gpY_[i] );
1179 
1180  printf("%d\tmuonLink= %d", i, (int)track.muonLink_[i]);
1181  printf("\trecLink = %d", (int)track.recLink_[i]);
1182  // printf ("\tGlobal\tx = %0.3f" , (float)track.gpX_[i] );
1183  // printf ("\ty = %0.3f" , (float)track.gpY_[i] );
1184  // printf ("\tz = %0.3f" , (float)track.gpZ_[i] );
1185  // printf ("\trho =%0.3f" , rho );
1186  // printf ("\teta = %0.3f" , (float)track.gpEta_[i] );
1187  // printf ("\tphi = %0.3f" , (float)track.gpPhi_[i] );
1188  printf("\t\tLocal\tx = %0.3f", (float)track.lpX_[i]);
1189  printf("\ty = %0.3f", (float)track.lpY_[i]);
1190  printf("\tz = %0.3f\n", (float)track.lpZ_[i]);
1191  }
1192 }
1193 //
1194 // dump Muon Rec Hits
1195 //
1197  std::cout << "Muon Rec Hits Dump:\n";
1198  for (unsigned int i = 0; i < (unsigned int)hit.n_; i++) {
1199  // double rho = sqrt( (float)hit.gpX_[i] * (float)hit.gpX_[i] + (float)hit.gpY_[i] * (float)hit.gpY_[i] );
1200 
1201  printf("%d\tsubdetector = %d\t superLayer =%d", i, (int)hit.system_[i], (int)hit.superLayer_[i]);
1202  // printf ("\tGlobal\tx = %0.3f" , (float)hit.gpX_[i] );
1203  // printf ("\ty = %0.3f" , (float)hit.gpY_[i] );
1204  // printf ("\tz = %0.3f" , (float)hit.gpZ_[i] );
1205  // printf ("\trho =%0.3f" , rho );
1206  // printf ("\teta = %0.3f" , (float)hit.gpEta_[i] );
1207  // printf ("\tphi = %0.3f\n" , (float)hit.gpPhi_[i] );
1208  printf("\t\tLocal\tx = %0.3f", (float)hit.lpX_[i]);
1209  printf("\ty = %0.3f", (float)hit.lpY_[i]);
1210  printf("\tz = %0.3f\n", (float)hit.lpZ_[i]);
1211  }
1212 }
1213 //
1214 // dump Tracker Rec Hits
1215 //
1217  std::cout << "Tracker Rec Hits Dump:\n";
1218  for (unsigned int i = 0; i < (unsigned int)hit.n_; i++) {
1219  // double rho = sqrt( (float)hit.gpX_[i] * (float)hit.gpX_[i] + (float)hit.gpY_[i] * (float)hit.gpY_[i] );
1220 
1221  printf("%d\tsubdetector = %d", i, (int)hit.subdetector_[i]);
1222  printf("\tlayer = %d", (int)hit.layer_[i]);
1223  // printf ("\tGlobal\tx = %0.3f" , (float)hit.gpX_[i] );
1224  // printf ("\ty = %0.3f" , (float)hit.gpY_[i] );
1225  // printf ("\tz = %0.3f" , (float)hit.gpZ_[i] );
1226  // printf ("\trho =%0.3f" , rho );
1227  // printf ("\teta = %0.3f" , (float)hit.gpEta_[i] );
1228  // printf ("\tphi = %0.3f\n" , (float)hit.gpPhi_[i] );
1229  printf("\t\tLocal\tx = %0.3f", (float)hit.lpX_[i]);
1230  printf("\ty = %0.3f", (float)hit.lpY_[i]);
1231  printf("\tz = %0.3f\n", (float)hit.lpZ_[i]);
1232  }
1233 }
1234 //
1235 //Dump a TrackRef
1236 //
1238  float pt = muon->pt();
1239  float p = muon->p();
1240  float eta = muon->eta();
1241  float phi = muon->phi();
1242  printf("\t%s: \tp = %4.2f \t pt = %4.2f \t eta = %4.2f \t phi = %4.2f\n", str.c_str(), p, pt, eta, phi);
1243 }
1244 
1246 
1248 //Deprecated
void CollectTrackHits(edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap, const edm::EventSetup &eventSetup)
RunNumber_t run() const
Definition: EventID.h:38
ResidualRefitting::storage_muon storageGmrNoTIBLayer4
int endcap_[N_MAX_STORED_HIT]
static const int TIB
EventNumber_t event() const
Definition: EventID.h:40
ResidualRefitting::storage_muon storageTrkNoTOBLayer4
void zero_muon(ResidualRefitting::storage_muon *str)
tuple cfg
Definition: looper.py:296
static const int N_MAX_STORED
unsigned int tibLayer(const DetId &id) const
int ReturnStation(DetId detid)
unsigned int tidRing(const DetId &id) const
void dumpTrackRef(reco::TrackRef muon, std::string str)
ResidualRefitting::storage_muon storageGmrNoTOBLayer1
uint16_t *__restrict__ id
void dumpMuonRecHits(const ResidualRefitting::storage_hit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTEC
ResidualRefitting::storage_muon storageGmrNoPXBLayer1
float lpZ_[N_MAX_STORED_HIT]
bool IsSameHit(TrackingRecHit const &hit1, TrackingRecHit const &hit2)
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer1
ResidualRefitting::storage_muon storageGmrNoTID
ResidualRefitting::storage_muon storageTrkNoTOBLayer6
TString subdetector
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
unsigned int pxfDisk(const DetId &id) const
int ReturnSector(DetId detid)
ResidualRefitting::storage_muon storageGmrNoTIBLayer1
unsigned int tecRing(const DetId &id) const
ring id
static const int PXB
ResidualRefitting::storage_trackHit storageTrackHit_
const MagneticField * theField
void zero_trackExtrap(ResidualRefitting::storage_trackExtrap *str)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
T y() const
Definition: PV3DBase.h:60
void analyze(const edm::Event &, const edm::EventSetup &) override
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt3_
ResidualRefitting::storage_muon storageTrkNoTOBLayer5
GlobalPoint globalPosition() const
static const int TOB
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer2
static const int N_MAX_STORED_HIT
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer4
ResidualRefitting::storage_muon storageTrkNoTIBLayer2
int sector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTOBLayer2
void endJob() override
void NewTrackMeasurements(edm::Handle< reco::TrackCollection > trackCollOrig, edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
ResidualRefitting::storage_muon storageGmrNoSt1_
int layer_[N_MAX_STORED_HIT]
int chamber_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer6
float lpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt1_
void trkExtrap(const DetId &detid, int iTrkLink, int iTrk, int iRec, const FreeTrajectoryState &freeTrajState, const LocalPoint &recPoint, storage_trackExtrap &storeTemp)
ResidualRefitting::storage_muon storageGmrNoTOBLayer6
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
int muonLink_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNew_
static const int TEC
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer4
float gpEta_[N_MAX_STORED_HIT]
constexpr std::array< uint8_t, layerIndexSize > layer
ResidualRefitting::storage_muon storageTrkNoTID
ResidualRefitting::storage_trackExtrap storageTrackExtrapTracker_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRec_
static const int TID
bool getData(T &iHolder) const
Definition: EventSetup.h:128
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
ResidualRefitting::storage_muon storageGmrNoSt4_
edm::InputTag muonsNoStation2_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt4_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer2
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
void branchMuon(ResidualRefitting::storage_muon &storageTmp, std::string branchName)
int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle< reco::TrackCollection > ref)
unsigned int tidSide(const DetId &id) const
float lpX_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNoSt4_
int wheel_[N_MAX_STORED_HIT]
void muonInfo(ResidualRefitting::storage_muon &storeMuon, reco::TrackRef muon, int val)
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt2_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
T sqrt(T t)
Definition: SSEVec.h:19
ResidualRefitting::storage_muon storageTrkNoPXBLayer2
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
T z() const
Definition: PV3DBase.h:61
edm::InputTag muonsNoStation1_
ResidualRefitting::storage_muon storageGmrNoSt2_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
float gpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoSt3_
MuonServiceProxy * theService
ResidualRefitting::storage_muon storageGmrNoPXBLayer2
void dumpTrackExtrap(const ResidualRefitting::storage_trackExtrap &track)
ResidualRefitting(const edm::ParameterSet &)
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon)
~ResidualRefitting() override
ResidualRefitting::storage_muon storageGmrOld_
ResidualRefitting::storage_muon storageTrkNoPXF
ResidualRefitting::storage_muon storageGmrNoTEC
ResidualRefitting::storage_trackExtrap trackExtrap120_
unsigned int tibModule(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
edm::InputTag muonsNoStation3_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Definition: DetId.h:17
ResidualRefitting::storage_muon storageGmrNoTIBLayer3
ResidualRefitting::storage_muon storageGmrNew_
float gpX_[N_MAX_STORED_HIT]
std::string outputFileName_
ResidualRefitting::storage_muon storageGmrNoTIBLayer2
int station_[N_MAX_STORED_HIT]
edm::InputTag muonsRemake_
void cylExtrapTrkSam(int recNum, reco::TrackRef track, ResidualRefitting::storage_trackExtrap &storage, double rho)
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
Definition: Cylinder.h:45
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float gpPhi_[N_MAX_STORED_HIT]
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
static constexpr int RPC
Definition: MuonSubdetId.h:13
static const int PXF
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
int ring_[N_MAX_STORED_HIT]
edm::InputTag muons_
ResidualRefitting::storage_trackExtrap storageTrackNoTID
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
unsigned int tobModule(const DetId &id) const
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer5
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
T eta() const
Definition: PV3DBase.h:73
ResidualRefitting::storage_muon storageSamNoSt2_
void dumpTrackHits(const ResidualRefitting::storage_trackHit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer3
edm::EventID id() const
Definition: EventBase.h:59
ResidualRefitting::storage_muon storageTrkNoTOBLayer1
tuple muons
Definition: patZpeak.py:39
float chiSqOvrNdf_[N_MAX_STORED]
ResidualRefitting::storage_muon storageGmrNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTEC
ResidualRefitting::storage_muon storageSamNoSt3_
ResidualRefitting::storage_muon storageTrkNoPXBLayer1
float gpZ_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTIBLayer1
ResidualRefitting::storage_muon storageGmrNoTOBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer1
unsigned int pxfSide(const DetId &id) const
int superLayer_[N_MAX_STORED_HIT]
ResidualRefitting::storage_event eventInfo_
ResidualRefitting::storage_hit storageRecMuon_
tuple cout
Definition: gather_cfg.py:144
void update(const edm::EventSetup &setup, bool duringEvent=true)
update the services each event
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
ResidualRefitting::storage_muon storageTrkNoTOBLayer3
edm::ESHandle< Propagator > thePropagator
void StoreTrackerRecHits(DetId detid, const TrackerTopology *tTopo, int iTrack, int iRec)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
static constexpr int DT
Definition: MuonSubdetId.h:11
ResidualRefitting::storage_muon storageTrkNew_
ResidualRefitting::storage_trackExtrap storageTrackNoPXF
ResidualRefitting::storage_muon storageSamNoSt1_
#define str(s)
static constexpr int CSC
Definition: MuonSubdetId.h:12
T x() const
Definition: PV3DBase.h:59
virtual LocalPoint localPosition() const =0
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
edm::InputTag muonsNoStation4_
void beginJob() override
int system_[N_MAX_STORED_HIT]
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer1
void branchTrackExtrap(ResidualRefitting::storage_trackExtrap &storageTmp, std::string branchName)
ResidualRefitting::storage_muon storageGmrNoPXF
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer2
unsigned int tobLayer(const DetId &id) const
tuple module
Definition: callgraph.py:69
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
ResidualRefitting::storage_trackExtrap samExtrap120_