CMS 3D CMS Logo

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 
36 
37 
39  outputFileName_ ( cfg.getUntrackedParameter<std::string>("histoutputFile") ),
40  PropagatorSource_ ( cfg.getParameter<std::string>("propagator")),
41  muons_ ( cfg.getParameter<edm::InputTag>( "muons" ) ),
42  muonsRemake_ ( cfg.getParameter<edm::InputTag>("muonsRemake" ) ), //This Feels Misalignment
43  muonsNoStation1_ ( cfg.getParameter<edm::InputTag>("muonsNoStation1") ),
44  muonsNoStation2_ ( cfg.getParameter<edm::InputTag>("muonsNoStation2") ),
45  muonsNoStation3_ ( cfg.getParameter<edm::InputTag>("muonsNoStation3") ),
46  muonsNoStation4_ ( cfg.getParameter<edm::InputTag>("muonsNoStation4") ),
47 
48 /*
49  muonsNoPXBLayer1_ ( cfg.getParameter<edm::InputTag>("muonsNoPXBLayer1" ) ),
50  muonsNoPXBLayer2_ ( cfg.getParameter<edm::InputTag>("muonsNoPXBLayer1" ) ),
51  muonsNoPXBLayer3_ ( cfg.getParameter<edm::InputTag>("muonsNoPXBLayer1" ) ),
52 
53  muonsNoTIBLayer1_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer1" ) ),
54  muonsNoTIBLayer2_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer2" ) ),
55  muonsNoTIBLayer3_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer3" ) ),
56  muonsNoTIBLayer4_ ( cfg.getParameter<edm::InputTag>("muonsNoTIBLayer4" ) ),
57 
58  muonsNoTOBLayer1_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer1" ) ),
59  muonsNoTOBLayer2_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer2" ) ),
60  muonsNoTOBLayer3_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer3" ) ),
61  muonsNoTOBLayer4_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer4" ) ),
62  muonsNoTOBLayer5_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer5" ) ),
63  muonsNoTOBLayer6_ ( cfg.getParameter<edm::InputTag>("muonsNoTOBLayer6" ) ),*/
64  debug_ ( cfg.getUntrackedParameter<bool>("doDebug" ) ),
65  outputFile_(nullptr),
66  outputTree_(nullptr),
67  outputBranch_(nullptr),
68  theField(nullptr)
69 {
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);
78 
79 } //The constructor
80 
82 
83  if(debug_) 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 
100  event.getByLabel(muons_ , muons ); //set label to muons
101  event.getByLabel(muonsRemake_ , muonTracks);
102  event.getByLabel(muonsNoStation1_ , muonsNoSt1);
103  event.getByLabel(muonsNoStation2_ , muonsNoSt2);
104  event.getByLabel(muonsNoStation3_ , muonsNoSt3);
105  event.getByLabel(muonsNoStation4_ , muonsNoSt4);
106 
107 
108 /*
109 // std::cout<<"Muon Collection No PXB "<<std::endl;
110 //Tracker Barrel Pixel Refits
111  edm::Handle<MuonCollection> muonsNoPXBLayer1Coll;
112  event.getByLabel(muonsNoPXBLayer1_, muonsNoPXBLayer1Coll);
113  edm::Handle<MuonCollection> muonsNoPXBLayer2Coll;
114  event.getByLabel(muonsNoPXBLayer2_, muonsNoPXBLayer2Coll);
115  edm::Handle<MuonCollection> muonsNoPXBLayer3Coll;
116  event.getByLabel(muonsNoPXBLayer3_, muonsNoPXBLayer3Coll);
117 // std::cout<<"Muon Collection No TIB "<<std::endl;
118 // Tracker Inner Barrel Refits
119  edm::Handle<MuonCollection> muonsNoTIBLayer1Coll;
120  event.getByLabel(muonsNoTIBLayer1_, muonsNoTIBLayer1Coll);
121  edm::Handle<MuonCollection> muonsNoTIBLayer2Coll;
122  event.getByLabel(muonsNoTIBLayer2_, muonsNoTIBLayer2Coll);
123  edm::Handle<MuonCollection> muonsNoTIBLayer3Coll;
124  event.getByLabel(muonsNoTIBLayer3_, muonsNoTIBLayer3Coll);
125  edm::Handle<MuonCollection> muonsNoTIBLayer4Coll;
126  event.getByLabel(muonsNoTIBLayer4_, muonsNoTIBLayer4Coll);
127 
128 // std::cout<<"Muon Collection No TOB "<<std::endl;
129 
130 //Tracker outer barrel refits
131  edm::Handle<MuonCollection> muonsNoTOBLayer1Coll;
132  event.getByLabel(muonsNoTOBLayer1_, muonsNoTOBLayer1Coll);
133  edm::Handle<MuonCollection> muonsNoTOBLayer2Coll;
134  event.getByLabel(muonsNoTOBLayer2_, muonsNoTOBLayer2Coll);
135  edm::Handle<MuonCollection> muonsNoTOBLayer3Coll;
136  event.getByLabel(muonsNoTOBLayer3_, muonsNoTOBLayer3Coll);
137  edm::Handle<MuonCollection> muonsNoTOBLayer4Coll;
138  event.getByLabel(muonsNoTOBLayer4_, muonsNoTOBLayer4Coll);
139  edm::Handle<MuonCollection> muonsNoTOBLayer5Coll;
140  event.getByLabel(muonsNoTOBLayer5_, muonsNoTOBLayer5Coll);
141  edm::Handle<MuonCollection> muonsNoTOBLayer6Coll;
142  event.getByLabel(muonsNoTOBLayer6_, muonsNoTOBLayer6Coll);
143 */
144  //magnetic field information
146  edm::ESHandle<GlobalTrackingGeometry> globalTrackingGeometry;
147  eventSetup.get<IdealMagneticFieldRecord>().get(field);
148  eventSetup.get<GlobalTrackingGeometryRecord>().get(globalTrackingGeometry);
150  theField = &*field;
151 
152 
153  theService->update(eventSetup);
154 
155 //Zero storage
156  zero_storage();
157 
158 
159 //Do the Gmr Muons from the unModified Collection
160 
161 /*
162  int iGmr = 0;
163  if ( (muons->end() - muons->begin()) > 0) printf("Data Dump:: Original GMR Muons\n");
164  for ( MuonCollection::const_iterator muon = muons->begin(); muon!=muons->end(); muon++, iGmr++) {
165  if ( iGmr >= ResidualRefitting::N_MAX_STORED) break; // error checking
166  if (!debug
167 
168  dumpTrackRef(muon->combinedMuon(), "cmb");
169  dumpTrackRef(muon->standAloneMuon(), "sam");
170  dumpTrackRef(muon->track(), "trk");
171 
172 
173  }
174  storageGmrOld_.n_ = iGmr;
175  storageSamNew_.n_ = iGmr;
176 */
177 
178 //Refitted muons
179  if (debug_) printf("Data Dump:: Rebuilt GMR Muon Track With TeV refitter default\n");
180  int iGmrRemake = 0;
181  for ( reco::TrackCollection::const_iterator muon = muonTracks->begin(); muon!=muonTracks->end(); muon++, iGmrRemake++) {
182  if ( iGmrRemake >= ResidualRefitting::N_MAX_STORED) break; // error checking
183  // from TrackInfoProducer/test/TrackInfoAnalyzerExample.cc
184  reco::TrackRef trackref=reco::TrackRef(muonTracks,iGmrRemake);
185 
186  if (debug_) dumpTrackRef(trackref, "gmr");
187  muonInfo(storageGmrNew_,trackref,iGmrRemake);
188 
189  }
190  storageGmrNew_.n_ = iGmrRemake;
191 
192 
193 
194  if (debug_) printf("muons Remake");
195  if (debug_) printf("-----------------------------------------\n");
196  CollectTrackHits(muonTracks, storageTrackExtrapRec_, eventSetup);
197 
198 
199  if (true) {
200  printf("muons No Station 1");
201  printf("-----------------------------------------\n");
202  }
203  NewTrackMeasurements(muonTracks, muonsNoSt1, storageTrackExtrapRecNoSt1_);
204 
205  if (true) {
206  printf("muons No Station 2");
207  printf("-----------------------------------------\n");
208  }
209  NewTrackMeasurements(muonTracks, muonsNoSt2, storageTrackExtrapRecNoSt2_);
210 
211  if (true) {
212  printf("muons No Station 3");
213  printf("-----------------------------------------\n");
214  }
215  NewTrackMeasurements(muonTracks, muonsNoSt3, storageTrackExtrapRecNoSt3_);
216 
217  if (true) {
218  printf("muons No Station 4");
219  printf("-----------------------------------------\n");
220  }
221  NewTrackMeasurements(muonTracks, muonsNoSt4, storageTrackExtrapRecNoSt4_);
222 
223 
224 // dumpMuonRecHits(storageRecMuon_);
225 
226 /****************************************************************************************************************************************/
227 
228 
229 /*
230  * extrapolates track to a cylinder.
231  * commented for cosmic runs with no tracker in reco muons!!
232  *
233 */
234 
235 
236  int iGmrCyl = 0;
237  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); muon++, iGmrCyl++) {
238 
239  dumpTrackRef(muon->combinedMuon(), "cmb");
240  dumpTrackRef(muon->standAloneMuon(), "sam");
241  dumpTrackRef(muon->track(), "trk");
242 
243  cylExtrapTrkSam(iGmrCyl, muon->standAloneMuon() , samExtrap120_ , 120.);
244  cylExtrapTrkSam(iGmrCyl, muon->track() , trackExtrap120_ , 120.);
245 
246  }
247  samExtrap120_.n_ = iGmrCyl;
248  trackExtrap120_.n_ = iGmrCyl;
249 
250 
251  if (iGmrRemake > 0 || iGmrCyl > 0) {
252  outputTree_ -> Fill();
253  std::cout << "FILLING NTUPLE!" << std::endl;
254  std::cout << "Entries Recorded: " << outputTree_ -> GetEntries() << " Branch :: " << outputBranch_ -> GetEntries() << std::endl<<std::endl;
255  } else std::cout<<"no tracks -- no fill!\n"<<std::endl<<std::endl;
256 
257 // /*************************************************************************************************************/
258 // //END OF ntuple dumper
259 // //END OF ntuple dumper
260 // /***********************************************************************************************************/
261 }
262 //end Analyze() main function
263 
264 //------------------------------------------------------------------------------
265 //
266 // Destructor
267 //
269  delete outputFile_;
270  delete theService;
271 }
272 //
273 // Track Collection Analysis
274 //
277  const edm::EventSetup& eventSetup) {
278 
279  //Retrieve tracker topology from geometry
280  edm::ESHandle<TrackerTopology> tTopoHandle;
281  eventSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
282  const TrackerTopology* const tTopo = tTopoHandle.product();
283 
284  int iMuonHit = 0;
285  int iTrackHit= 0;
286  int numTracks= 0;
287 
288  for ( reco::TrackCollection::const_iterator muon = trackColl->begin(); muon!=trackColl->end(); muon++) {
289 
290  int iTrack = muon - trackColl->begin();
291  reco::TrackRef trackref=reco::TrackRef(trackColl,iTrack);
293 
294  if (debug_) dumpTrackRef(trackref, "CollectTrackHits Track");
295 
296  for (trackingRecHit_iterator rec = muon->recHitsBegin(); rec != muon->recHitsEnd(); rec++) {
297 
298  int iRec = rec - muon->recHitsBegin();
299  DetId detid = (*rec)->geographicalId();
300 
301  if (detid.det() != DetId::Muon && detid.det() != DetId::Tracker) {
302  if (debug_) printf("Rec Hit not from muon system or tracker... continuing...\n");
303  continue;
304  }
305 // numTracks++;
306 // Get Local and Global Position of Hits
307 
308  LocalPoint lp = (*rec)->localPosition();
309  float lpX = lp.x();
310  float lpY = lp.y();
311  float lpZ = lp.z();
312 
315  ,&(**rec));
316 
317  GlobalPoint gp = mrhp->globalPosition();
318  float gpRecX = gp.x();
319  float gpRecY = gp.y();
320  float gpRecZ = gp.z();
321  float gpRecEta = gp.eta();
322  float gpRecPhi = gp.phi();
323 
324  if (detid.det() == DetId::Muon) {
325 
326  int systemMuon = detid.subdetId(); // 1 DT; 2 CSC; 3 RPC
327  int endcap = -999;
328  int station = -999;
329  int ring = -999;
330  int chamber = -999;
331  int layer = -999;
332  int superLayer = -999;
333  int wheel = -999;
334  int sector = -999;
335  if ( systemMuon == MuonSubdetId::CSC) {
336  CSCDetId id(detid.rawId());
337  endcap = id.endcap();
338  station = id.station();
339  ring = id.ring();
340  chamber = id.chamber();
341  layer = id.layer();
342  if (debug_)printf("CSC\t[endcap][station][ringN][chamber][layer]:[%d][%d][%d][%d][%d]\t",
343  endcap, station, ring, chamber, layer);
344 
345  }
346  else if ( systemMuon == MuonSubdetId::DT ) {
347  DTWireId id(detid.rawId());
348  station = id.station();
349  layer = id.layer();
350  superLayer = id.superLayer();
351  wheel = id.wheel();
352  sector = id.sector();
353  if (debug_) printf("DT \t[station][layer][superlayer]:[%d][%d][%d]\n", station,layer,superLayer);
354 
355  }
356  else if ( systemMuon == MuonSubdetId::RPC) {
357  RPCDetId id(detid.rawId());
358  station = id.station();
359  if (debug_) printf("RPC\t[station]:[%d]\n", station);
360  }
361 
362 
363  storageRecMuon_.muonLink_ [iMuonHit] = iTrack;
364  storageRecMuon_.system_ [iMuonHit] = systemMuon;
365  storageRecMuon_.endcap_ [iMuonHit] = endcap;
366  storageRecMuon_.station_ [iMuonHit] = station;
367  storageRecMuon_.ring_ [iMuonHit] = ring;
368  storageRecMuon_.chamber_ [iMuonHit] = chamber;
369  storageRecMuon_.layer_ [iMuonHit] = layer;
370  storageRecMuon_.superLayer_ [iMuonHit] = superLayer;
371  storageRecMuon_.wheel_ [iMuonHit] = wheel;
372  storageRecMuon_.sector_ [iMuonHit] = sector;
373 
374  storageRecMuon_.gpX_ [iMuonHit] = gpRecX;
375  storageRecMuon_.gpY_ [iMuonHit] = gpRecY;
376  storageRecMuon_.gpZ_ [iMuonHit] = gpRecZ;
377  storageRecMuon_.gpEta_ [iMuonHit] = gpRecEta;
378  storageRecMuon_.gpPhi_ [iMuonHit] = gpRecPhi;
379  storageRecMuon_.lpX_ [iMuonHit] = lpX;
380  storageRecMuon_.lpY_ [iMuonHit] = lpY;
381  storageRecMuon_.lpZ_ [iMuonHit] = lpZ;
382  iMuonHit++;
383 
384  }
385  else if (detid.det() == DetId::Tracker) {
386 
387  if (debug_) printf("Tracker\n");
388 
389  StoreTrackerRecHits(detid, tTopo, iTrack, iTrackHit);
390 
391  storageTrackHit_.gpX_ [iTrackHit] = gpRecX;
392  storageTrackHit_.gpY_ [iTrackHit] = gpRecY;
393  storageTrackHit_.gpZ_ [iTrackHit] = gpRecZ;
394  storageTrackHit_.gpEta_ [iTrackHit] = gpRecEta;
395  storageTrackHit_.gpPhi_ [iTrackHit] = gpRecPhi;
396  storageTrackHit_.lpX_ [iTrackHit] = lpX;
397  storageTrackHit_.lpY_ [iTrackHit] = lpY;
398  storageTrackHit_.lpZ_ [iTrackHit] = lpZ;
399  iTrackHit++;
400  }
401  else printf("THIS CAN NOT HAPPEN\n");
402 
403  trkExtrap(detid, numTracks, iTrack, iRec, recoStart, lp, trackExtrap);
404  numTracks++;
405 
406  if (debug_) printf("\tLocal Positon: \tx = %2.2f\ty = %2.2f\tz = %2.2f\n",lpX, lpY, lpZ);
407  if (debug_) printf("\tGlobal Position: \tx = %6.2f\ty = %6.2f\tz = %6.2f\teta = %4.2f\tphi = %3.2f\n",
408  gpRecX,gpRecY,gpRecZ,gpRecEta,gpRecPhi);
409 
410 
411  }
412 
413  }
414 
415  storageRecMuon_ .n_ = iMuonHit;
416  storageTrackHit_.n_ = iTrackHit;
417  trackExtrap .n_ = numTracks;
418 
419 }
420 //
421 // Deal with Re-Fitted Track with some station omitted.
422 //
423 // This should take the new track, match it to its track before refitting with the hits dumped, and extrapolate out to the
424 // rec hits that were removed from the fit.
425 //
426 //
427 
430 
431  int numTracks = 0;
432  int recCounter = 0;
433 
434  for ( reco::TrackCollection::const_iterator muon = trackColl->begin(); muon!=trackColl->end(); muon++) {
435 
436  int iTrack = muon - trackColl->begin();
437 
438  reco::TrackRef trackref=reco::TrackRef(trackColl,iTrack);
440 
441  int iTrackLink = MatchTrackWithRecHits(muon,trackCollOrig);
442  reco::TrackRef ref = reco::TrackRef(trackCollOrig, iTrackLink);
443 
444  for (trackingRecHit_iterator rec1 = ref->recHitsBegin(); rec1!= ref->recHitsEnd(); rec1++, recCounter++) {
445 
446  //int iRec = rec1 - ref->recHitsBegin();
447 
448  bool unbiasedRec = true;
449 
450  for ( trackingRecHit_iterator rec2 = muon->recHitsBegin(); rec2!=muon->recHitsEnd();rec2++) {
451 
452  if (IsSameHit(rec1,rec2)) {
453  unbiasedRec = false;
454  break;
455  }
456  }
457  if (!unbiasedRec) continue;
458 
459  DetId detid = (*rec1)->geographicalId();
460 
463  ,&(**rec1));
464 
465  trkExtrap(detid, numTracks, iTrackLink, recCounter, recoStart, (*rec1)->localPosition(), trackExtrap);
466  numTracks++;
467 
468  }
469 
470  }
471 
472  trackExtrap.n_ = numTracks;
473 
474 }
475 //
476 // Find the original track that corresponds to the re-fitted track
477 //
478 int ResidualRefitting::MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt,
480 
481  if (debug_) printf("Matching a re-fitted track to the original track.\n");
482 
483  int TrackMatch = -1;
484 
485  for (trackingRecHit_iterator rec = trackIt->recHitsBegin(); rec!=trackIt->recHitsEnd(); rec++) {
486 
487  bool foundMatch = false;
488  for (reco::TrackCollection::const_iterator refIt = ref->begin(); refIt!=ref->end(); refIt++) {
489 
490  int iTrackMatch = refIt - ref->begin();
491  if (foundMatch && TrackMatch !=iTrackMatch) break;
492  for (trackingRecHit_iterator recRef = refIt->recHitsBegin(); recRef!=refIt->recHitsEnd(); recRef++) {
493 
494  if (!IsSameHit(rec,recRef)) continue;
495 
496  foundMatch = true;
497  TrackMatch = iTrackMatch;
498  // printf("Rec hit match for original track %d\n", iTrackMatch);
499 
500  }
501  }
502  if (!foundMatch) {
503  printf("SOMETHING WENT WRONG! Could not match Track with original track!");
504  exit(1);
505  }
506 
507  }
508  if (debug_) printf("Rec hit match for original track %d\n", TrackMatch);
509 
510 // reco::TrackRef trackref=reco::TrackRef(ref,TrackMatch);
511  return TrackMatch;
512 }
513 /*
514 //
515 // Match two tracks to see if one is a subset of the other
516 //
517 
518 bool ResidualRefitting::TrackSubset(reco::TrackRef trackSub, reco::TrackRef trackTop) {
519 
520 
521  bool matchAll = true;
522 
523  for (trackingRecHit_iterator recSub = trackSub->recHitsBegin(); recSub!=trackSub->recHitsEnd(); recSub++) {
524 
525  bool matchSub = false;
526 
527 
528  for (trackingRecHit_iterator recTop = trackTop->recHitsBegin(); recTop!=trackTop->recHitsEnd(); recTop++) {
529 
530  if ( recSub == recTop ) matchSub = true;
531  if (matchSub) break;
532 
533  }
534  if (!matchSub) return false;
535 
536  }
537 
538  return matchAll;
539 
540 }
541 */
542 
543 //
544 // Check to see if the rec hits are the same
545 //
547 
548 
549  double lpx1 = (*hit1)->localPosition().x();
550  double lpy1 = (*hit1)->localPosition().y();
551  double lpz1 = (*hit1)->localPosition().z();
552 
553  double lpx2 = (*hit2)->localPosition().x();
554  double lpy2 = (*hit2)->localPosition().y();
555  double lpz2 = (*hit2)->localPosition().z();
556  if ( fabs( lpx1 - lpx2) > 1e-3) return false;
557 // printf("Match lpx...\n");
558  if ( fabs( lpy1 - lpy2) > 1e-3) return false;
559 // printf("Match lpy...\n");
560  if ( fabs( lpz1 - lpz2) > 1e-3) return false;
561 // printf("Match lpz...\n");
562 
563  return true;
564 
565 }
566 
567 //
568 // Store Tracker Rec Hits
569 //
570 void ResidualRefitting::StoreTrackerRecHits(DetId detid, const TrackerTopology* tTopo, int iTrack, int iRec) {
571 
572 
573  int detector = -1;
574  int subdetector = -1;
575  int blade = -1;
576  int disk = -1;
577  int ladder = -1;
578  int layer = -1;
579  int module = -1;
580  int panel = -1;
581  int ring = -1;
582  int side = -1;
583  int wheel = -1;
584 
585 //Detector Info
586 
587  detector = detid.det();
588  subdetector = detid.subdetId();
589 
590  if (detector != DetId::Tracker) {
591  std::cout<<"OMFG NOT THE TRACKER\n"<<std::endl;
592  return;
593  }
594 
595  if (debug_) std::cout<<"Tracker:: ";
596  if (subdetector == ResidualRefitting::PXB) {
597  layer = tTopo->pxbLayer(detid.rawId());
598  ladder = tTopo->pxbLadder(detid.rawId());
599  module = tTopo->pxbModule(detid.rawId());
600  if (debug_) std::cout << "PXB"
601  << "\tlayer = " << layer
602  << "\tladder = " << ladder
603  << "\tmodule = " << module;
604 
605  }
606  else if (subdetector == ResidualRefitting::PXF) {
607  side = tTopo->pxfSide(detid.rawId());
608  disk = tTopo->pxfDisk(detid.rawId());
609  blade = tTopo->pxfBlade(detid.rawId());
610  panel = tTopo->pxfPanel(detid.rawId());
611  module = tTopo->pxfModule(detid.rawId());
612  if (debug_) std::cout << "PXF"
613  << "\tside = " << side
614  << "\tdisk = " << disk
615  << "\tblade = " << blade
616  << "\tpanel = " << panel
617  << "\tmodule = " << module;
618 
619  }
620  else if (subdetector == ResidualRefitting::TIB) {
621  layer = tTopo->tibLayer(detid.rawId());
622  module = tTopo->tibModule(detid.rawId());
623  if (debug_) std::cout << "TIB"
624  << "\tlayer = " << layer
625  << "\tmodule = "<< module;
626  }
627  else if (subdetector == ResidualRefitting::TID) {
628  side = tTopo->tidSide(detid.rawId());
629  wheel = tTopo->tidWheel(detid.rawId());
630  ring = tTopo->tidRing(detid.rawId());
631  if (debug_) std::cout <<"TID"
632  << "\tside = " << side
633  << "\twheel = " << wheel
634  << "\tring = " << ring;
635 
636  }
637  else if (subdetector == ResidualRefitting::TOB) {
638  layer = tTopo->tobLayer(detid.rawId());
639  module = tTopo->tobModule(detid.rawId());
640  if (debug_) std::cout <<"TOB"
641  <<"\tlayer = " << layer
642  <<"\tmodule = " << module;
643 
644  }
645  else if (subdetector == ResidualRefitting::TEC) {
646  ring = tTopo->tecRing(detid.rawId());
647  module = tTopo->tecModule(detid.rawId());
648  if (debug_) std::cout <<"TEC"
649  << "\tring = " << ring
650  << "\tmodule = "<< module;
651  }
652 
653 
654 //Do Storage
655 
656  storageTrackHit_.muonLink_ [iRec] =iTrack ;
659  storageTrackHit_.blade_ [iRec] =blade ;
660  storageTrackHit_.disk_ [iRec] =disk ;
662  storageTrackHit_.layer_ [iRec] =layer ;
663  storageTrackHit_.module_ [iRec] =module ;
664  storageTrackHit_.panel_ [iRec] =panel ;
665  storageTrackHit_.ring_ [iRec] =ring ;
666  storageTrackHit_.side_ [iRec] =side ;
667  storageTrackHit_.wheel_ [iRec] =wheel ;
668 
669 }
670 
671 //
672 // Store Muon info on P, Pt, eta, phi
673 //
675 
676 
677  storeMuon.pt_ [val] = muon->pt();
678  storeMuon.p_ [val] = muon->p();
679  storeMuon.eta_[val] = muon->eta();
680  storeMuon.phi_[val] = muon->phi();
681  storeMuon.charge_[val] = muon->charge();
682  storeMuon.numRecHits_[val] = muon->numberOfValidHits();
683  storeMuon.chiSq_[val] = muon->chi2();
684  storeMuon.ndf_[val] = muon->ndof();
685  storeMuon.chiSqOvrNdf_[val] = muon->normalizedChi2();
686 
687 }
688 //
689 // Fill a track extrapolation
690 //
691 void ResidualRefitting::trkExtrap(const DetId& detid, int iTrk, int iTrkLink, int iRec,
692  const FreeTrajectoryState& freeTrajState,
693  const LocalPoint& recPoint,
694  storage_trackExtrap& storeTemp){
695 
696  bool dump_ = debug_;
697 
698  if (dump_) std::cout<< "In the trkExtrap function"<<std::endl;
699 
700  float gpExtrapX = -99999;
701  float gpExtrapY = -99999;
702  float gpExtrapZ = -99999;
703  float gpExtrapEta = -99999;
704  float gpExtrapPhi = -99999;
705 
706  float lpX = -99999;
707  float lpY = -99999;
708  float lpZ = -99999;
709 
710  //
711  // Get the local positions for the recHits
712  //
713 
714  float recLpX = recPoint.x();
715  float recLpY = recPoint.y();
716  float recLpZ = recPoint.z();
717 
718  float resX = -9999;
719  float resY = -9999;
720  float resZ = -9999;
721 
722  const GeomDet* gdet = theService->trackingGeometry()->idToDet(detid);
723 
724 // TrajectoryStateOnSurface surfTest = prop.propagate(freeTrajState, gdet->surface());
725  TrajectoryStateOnSurface surfTest = thePropagator->propagate(freeTrajState, gdet->surface());
726 
727  if (surfTest.isValid()) {
728 
729  GlobalPoint globTest = surfTest.globalPosition();
730  gpExtrapX = globTest.x();
731  gpExtrapY = globTest.y();
732  gpExtrapZ = globTest.z();
733  gpExtrapEta = globTest.eta();
734  gpExtrapPhi = globTest.phi();
735  LocalPoint loc = surfTest.localPosition();
736  if (detid.det() == DetId::Muon || detid.det() == DetId::Tracker) {
737  lpX = loc.x();
738  lpY = loc.y();
739  lpZ = loc.z();
740 
741  resX = lpX - recLpX;
742  resY = lpY - recLpY;
743  resZ = lpZ - recLpZ;
744 
745  }
746 
747  }
748  storeTemp.muonLink_ [iTrk] = iTrkLink ;
749  storeTemp.recLink_ [iTrk] = iRec ;
750  storeTemp.gpX_ [iTrk] = gpExtrapX ;
751  storeTemp.gpY_ [iTrk] = gpExtrapY ;
752  storeTemp.gpZ_ [iTrk] = gpExtrapZ ;
753  storeTemp.gpEta_ [iTrk] = gpExtrapEta;
754  storeTemp.gpPhi_ [iTrk] = gpExtrapPhi;
755  storeTemp.lpX_ [iTrk] = lpX ;
756  storeTemp.lpY_ [iTrk] = lpY ;
757  storeTemp.lpZ_ [iTrk] = lpZ ;
758  storeTemp.resX_ [iTrk] = resX ;
759  storeTemp.resY_ [iTrk] = resY ;
760  storeTemp.resZ_ [iTrk] = resZ ;
761 
762  printf("station: %d\tsector: %d\tresX storage: %4.2f\n", ReturnStation(detid), ReturnSector(detid), resX);
763 
764 }
765 //
766 // Return the station
767 //
769 
770  int station = -999;
771 
772  if (detid.det() == DetId::Muon) {
773 
774  int systemMuon = detid.subdetId(); // 1 DT; 2 CSC; 3 RPC
775  if ( systemMuon == MuonSubdetId::CSC) {
776  CSCDetId id(detid.rawId());
777  station = id.station();
778 
779  }
780  else if ( systemMuon == MuonSubdetId::DT ) {
781  DTWireId id(detid.rawId());
782  station = id.station();
783 
784  }
785  else if ( systemMuon == MuonSubdetId::RPC) {
786  RPCDetId id(detid.rawId());
787  station = id.station();
788  }
789 
790  }
791 
792  return station;
793 }
794 //
795 // Return the sector
796 //
798 
799  int sector = -999;
800 
801  if (detid.det() == DetId::Muon) {
802 
803  int systemMuon = detid.subdetId(); // 1 DT; 2 CSC; 3 RPC
804  if ( systemMuon == MuonSubdetId::DT ) {
805  DTWireId id(detid.rawId());
806  sector = id.sector();
807 
808  }
809 
810  }
811 
812  return sector;
813 }
814 
815 //
816 // Store the SAM and Track position info at a particular rho
817 //
819 
822 
823  Cylinder::CylinderPointer myCylinder = Cylinder::build(pos, rot, rho);
824 // SteppingHelixPropagator inwardProp ( theField, oppositeToMomentum );
825 // SteppingHelixPropagator outwardProp ( theField, alongMomentum );
826  FreeTrajectoryState recoStart = freeTrajStateMuon(track);
827 // TrajectoryStateOnSurface recoProp = outwardProp.propagate(recoStart, *myCylinder);
828  TrajectoryStateOnSurface recoProp = thePropagator->propagate(recoStart, *myCylinder);
829 
830  double xVal = -9999;
831  double yVal = -9999;
832  double zVal = -9999;
833  double phiVal = -9999;
834  double etaVal = -9999;
835 
836  if(recoProp.isValid()) {
837  GlobalPoint recoPoint = recoProp.globalPosition();
838  xVal = recoPoint.x();
839  yVal = recoPoint.y();
840  zVal = recoPoint.z();
841  phiVal = recoPoint.phi();
842  etaVal = recoPoint.eta();
843  }
844  storage.muonLink_[recNum] = recNum;
845  storage.gpX_ [recNum] = xVal;
846  storage.gpY_ [recNum] = yVal;
847  storage.gpZ_ [recNum] = zVal;
848  storage.gpEta_ [recNum] = etaVal;
849  storage.gpPhi_ [recNum] = phiVal;
850 
851  float rhoVal = sqrt( xVal*xVal + yVal*yVal);
852 
853  printf("Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
854  if (debug_) printf("Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
855 
856 
857 }
859 //Pre-Job junk
861 
862 //
863 // zero storage
864 //
866  if (debug_) printf("zero_storage\n");
867 
880 //zero out the tracker
884 
886 
891 
893 
900 
902 
906 
908 
913 
915 
922 
924 
931 
933 
935 
939 
941 
946 
953 
955 
957 
958  storageRecMuon_ .n_ = 0;
959  storageTrackHit_ .n_ = 0;
960 
961 }
962 //
963 // Zero out a muon reference
964 //
966 
967  str->n_ = 0;
968 
969  for (int i = 0; i < ResidualRefitting::N_MAX_STORED; i++) {
970 
971  str->pt_ [i] = -9999;
972  str->eta_ [i] = -9999;
973  str->p_ [i] = -9999;
974  str->phi_ [i] = -9999;
975  str->numRecHits_ [i] = -9999;
976  str->chiSq_ [i] = -9999;
977  str->ndf_ [i] = -9999;
978  str->chiSqOvrNdf_ [i] = -9999;
979  }
980 
981 }
982 //
983 // Zero track extrapolation
984 //
986 
987  str->n_ = 0;
988  for (int i = 0; i < ResidualRefitting::N_MAX_STORED_HIT; i++) {
989 
990  str->muonLink_ [i] = -9999;
991  str->recLink_ [i] = -9999;
992  str->gpX_ [i] = -9999;
993  str->gpY_ [i] = -9999;
994  str->gpZ_ [i] = -9999;
995  str->gpEta_ [i] = -9999;
996  str->gpPhi_ [i] = -9999;
997  str->lpX_ [i] = -9999;
998  str->lpY_ [i] = -9999;
999  str->lpZ_ [i] = -9999;
1000  str->resX_ [i] = -9999;
1001  str->resY_ [i] = -9999;
1002  str->resZ_ [i] = -9999;
1003  }
1004 
1005 }
1006 //
1007 // Begin Job
1008 //
1010 
1011  std::cout<<"Creating file "<< outputFileName_.c_str()<<std::endl;
1012 
1013  outputFile_ = new TFile( outputFileName_.c_str(), "RECREATE" ) ;
1014 
1015  outputTree_ = new TTree("outputTree","outputTree");
1016 
1017  outputTree_->Branch("eventInfo",&eventInfo_,
1018  "evtNum_/I:"
1019  "runNum_/I"
1020  );
1021 
1022 
1029 
1035 
1053 
1070 
1071  outputBranch_ = outputTree_ -> Branch("recHitsNew", &storageRecMuon_,
1072 
1073  "n_/I:"
1074  "muonLink_[1000]/I:"
1075 
1076  "system_[1000]/I:"
1077  "endcap_[1000]/I:"
1078  "station_[1000]/I:"
1079  "ring_[1000]/I:"
1080  "chamber_[1000]/I:"
1081  "layer_[1000]/I:"
1082  "superLayer_[1000]/I:"
1083  "wheel_[1000]/I:"
1084  "sector_[1000]/I:"
1085 
1086 
1087  "gpX_[1000]/F:"
1088  "gpY_[1000]/F:"
1089  "gpZ_[1000]/F:"
1090  "gpEta_[1000]/F:"
1091  "gpPhi_[1000]/F:"
1092  "lpX_[1000]/F:"
1093  "lpY_[1000]/F:"
1094  "lpZ_[1000]/F"
1095  );
1096 
1097 
1098  outputBranch_ = outputTree_ -> Branch("recHitsTracker", &storageTrackHit_,
1099 
1100  "n_/I:"
1101 
1102  "muonLink_[1000]/I:"
1103  "detector_[1000]/I:"
1104  "subdetector_[1000]/I:"
1105  "blade_[1000]/I:"
1106  "disk_[1000]/I:"
1107  "ladder_[1000]/I:"
1108  "layer_[1000]/I:"
1109  "module_[1000]/I:"
1110  "panel_[1000]/I:"
1111  "ring_[1000]/I:"
1112  "side_[1000]/I:"
1113  "wheel_[1000]/I:"
1114 
1115  "gpX_[1000]/F:"
1116  "gpY_[1000]/F:"
1117  "gpZ_[1000]/F:"
1118  "gpEta_[1000]/F:"
1119  "gpPhi_[1000]/F:"
1120  "lpX_[1000]/F:"
1121  "lpY_[1000]/F:"
1122  "lpZ_[1000]/F"
1123  );
1124 
1125 
1131 
1149 
1152 
1153 }
1154 //
1155 // Set the Muon Branches
1156 //
1158 
1159  outputBranch_ = outputTree_ -> Branch(branchName.c_str(), &storageTmp,
1160  "n_/I:"
1161  "charge_[10]/I:"
1162  "pt_[10]/F:"
1163  "eta_[10]/F:"
1164  "p_[10]/F:"
1165  "phi_[10]/F:"
1166  "numRecHits_[10]/I:"
1167  "chiSq_[10]/F:"
1168  "ndf_[10]/F:"
1169  "chiSqOvrNdf_[10]/F"
1170 
1171  );
1172 
1173 }
1174 //
1175 // Set the Branches for Track Extrapolations
1176 //
1178 
1179  outputBranch_ = outputTree_ -> Branch(branchName.c_str(), &storageTmp,
1180  "n_/I:"
1181  "muonLink_[1000]/I:"
1182  "recLink_[1000]/I:"
1183  "gpX_[1000]/F:"
1184  "gpY_[1000]/F:"
1185  "gpZ_[1000]/F:"
1186  "gpEta_[1000]/F:"
1187  "gpPhi_[1000]/F:"
1188  "lpX_[1000]/F:"
1189  "lpY_[1000]/F:"
1190  "lpZ_[1000]/F:"
1191  "resX_[1000]/F:"
1192  "resY_[1000]/F:"
1193  "resZ_[1000]/F"
1194 
1195  );
1196 
1197 }
1198 //
1199 // End Job
1200 //
1202 
1203 
1204  outputFile_ -> Write();
1205 
1206  outputFile_ -> Close() ;
1207 
1208 }
1209 //
1210 // Return a Free Trajectory state for a muon track
1211 //
1213 
1214  math::XYZPoint innerPos = muon -> referencePoint();
1215  math::XYZVector innerMom = muon -> momentum();
1216  if (debug_) std::cout << "Inner Pos: "
1217  << "\tx = " << innerPos.X()
1218  << "\ty = " << innerPos.Y()
1219  << "\tz = " << innerPos.Z()
1220  << std::endl;
1221 
1222  GlobalPoint innerPoint( innerPos.X(), innerPos.Y(), innerPos.Z());
1223  GlobalVector innerVec ( innerMom.X(), innerMom.Y(), innerMom.Z());
1224 
1225  FreeTrajectoryState recoStart( innerPoint, innerVec, muon ->charge(), theField );
1226  return recoStart;
1227 
1228 }
1229 
1231 // nTuple value Dumps
1233 
1234 //
1235 // dump Track Extrapolation
1236 //
1238  std::cout<<"\n\nExtrapolation Dump:\n";
1239  for (unsigned int i = 0; i < (unsigned int)track.n_; i++) {
1240 
1241 // double rho = sqrt( (float)track.gpX_[i] * (float)track.gpX_[i] + (float)track.gpY_[i] * (float)track.gpY_[i] );
1242 
1243  printf ("%d\tmuonLink= %d",i, (int)track.muonLink_[i]);
1244  printf ("\trecLink = %d", (int)track.recLink_[i] );
1245 // printf ("\tGlobal\tx = %0.3f" , (float)track.gpX_[i] );
1246 // printf ("\ty = %0.3f" , (float)track.gpY_[i] );
1247 // printf ("\tz = %0.3f" , (float)track.gpZ_[i] );
1248 // printf ("\trho =%0.3f" , rho );
1249 // printf ("\teta = %0.3f" , (float)track.gpEta_[i] );
1250 // printf ("\tphi = %0.3f" , (float)track.gpPhi_[i] );
1251  printf ("\t\tLocal\tx = %0.3f" , (float)track.lpX_[i] );
1252  printf ("\ty = %0.3f" , (float)track.lpY_[i] );
1253  printf ("\tz = %0.3f\n" , (float)track.lpZ_[i] );
1254 
1255  }
1256 
1257 }
1258 //
1259 // dump Muon Rec Hits
1260 //
1262  std::cout<<"Muon Rec Hits Dump:\n";
1263  for (unsigned int i = 0; i < (unsigned int)hit.n_; i++) {
1264 
1265 // double rho = sqrt( (float)hit.gpX_[i] * (float)hit.gpX_[i] + (float)hit.gpY_[i] * (float)hit.gpY_[i] );
1266 
1267  printf ("%d\tsubdetector = %d\t superLayer =%d" , i, (int)hit.system_[i], (int)hit.superLayer_[i] );
1268 // printf ("\tGlobal\tx = %0.3f" , (float)hit.gpX_[i] );
1269 // printf ("\ty = %0.3f" , (float)hit.gpY_[i] );
1270 // printf ("\tz = %0.3f" , (float)hit.gpZ_[i] );
1271 // printf ("\trho =%0.3f" , rho );
1272 // printf ("\teta = %0.3f" , (float)hit.gpEta_[i] );
1273 // printf ("\tphi = %0.3f\n" , (float)hit.gpPhi_[i] );
1274  printf ("\t\tLocal\tx = %0.3f" , (float)hit.lpX_[i] );
1275  printf ("\ty = %0.3f" , (float)hit.lpY_[i] );
1276  printf ("\tz = %0.3f\n" , (float)hit.lpZ_[i] );
1277 
1278  }
1279 
1280 }
1281 //
1282 // dump Tracker Rec Hits
1283 //
1285  std::cout<<"Tracker Rec Hits Dump:\n";
1286  for (unsigned int i = 0; i < (unsigned int)hit.n_; i++) {
1287 
1288 // double rho = sqrt( (float)hit.gpX_[i] * (float)hit.gpX_[i] + (float)hit.gpY_[i] * (float)hit.gpY_[i] );
1289 
1290  printf ("%d\tsubdetector = %d" , i, (int)hit.subdetector_[i] );
1291  printf ("\tlayer = %d" , (int)hit.layer_[i] );
1292 // printf ("\tGlobal\tx = %0.3f" , (float)hit.gpX_[i] );
1293 // printf ("\ty = %0.3f" , (float)hit.gpY_[i] );
1294 // printf ("\tz = %0.3f" , (float)hit.gpZ_[i] );
1295 // printf ("\trho =%0.3f" , rho );
1296 // printf ("\teta = %0.3f" , (float)hit.gpEta_[i] );
1297 // printf ("\tphi = %0.3f\n" , (float)hit.gpPhi_[i] );
1298  printf ("\t\tLocal\tx = %0.3f" , (float)hit.lpX_[i] );
1299  printf ("\ty = %0.3f" , (float)hit.lpY_[i] );
1300  printf ("\tz = %0.3f\n" , (float)hit.lpZ_[i] );
1301 
1302  }
1303 
1304 }
1305 //
1306 //Dump a TrackRef
1307 //
1309 
1310  float pt = muon->pt();
1311  float p = muon->p ();
1312  float eta = muon->eta();
1313  float phi = muon->phi();
1314  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);
1315 
1316 }
1317 
1319 
1320 
1322 //Deprecated
void update(const edm::EventSetup &setup)
update the services each event
void CollectTrackHits(edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap, const edm::EventSetup &eventSetup)
RunNumber_t run() const
Definition: EventID.h:39
ResidualRefitting::storage_muon storageGmrNoTIBLayer4
int endcap_[N_MAX_STORED_HIT]
static const int TIB
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:41
ResidualRefitting::storage_muon storageTrkNoTOBLayer4
void zero_muon(ResidualRefitting::storage_muon *str)
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
void dumpMuonRecHits(const ResidualRefitting::storage_hit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTEC
ResidualRefitting::storage_muon storageGmrNoPXBLayer1
float lpZ_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer1
ResidualRefitting::storage_muon storageGmrNoTID
ResidualRefitting::storage_muon storageTrkNoTOBLayer6
TString subdetector
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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_
std::string PropagatorSource_
const MagneticField * theField
void zero_trackExtrap(ResidualRefitting::storage_trackExtrap *str)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
T y() const
Definition: PV3DBase.h:63
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
#define nullptr
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:42
int muonLink_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNew_
static const int TEC
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer4
float gpEta_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTID
ResidualRefitting::storage_trackExtrap storageTrackExtrapTracker_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRec_
static const int TID
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
ResidualRefitting::storage_muon storageGmrNoSt4_
edm::InputTag muonsNoStation2_
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt4_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer2
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)
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt2_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
T sqrt(T t)
Definition: SSEVec.h:18
ResidualRefitting::storage_muon storageTrkNoPXBLayer2
T z() const
Definition: PV3DBase.h:64
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:41
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_
Definition: DetId.h:18
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)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
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:21
static constexpr int RPC
Definition: MuonSubdetId.h:14
static const int PXF
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
edm::InputTag muons_
ResidualRefitting::storage_trackExtrap storageTrackNoTID
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
unsigned int tobModule(const DetId &id) const
bool IsSameHit(trackingRecHit_iterator hit1, trackingRecHit_iterator hit2)
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer5
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
T eta() const
Definition: PV3DBase.h:76
ResidualRefitting::storage_muon storageSamNoSt2_
void dumpTrackHits(const ResidualRefitting::storage_trackHit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer3
edm::EventID id() const
Definition: EventBase.h:60
ResidualRefitting::storage_muon storageTrkNoTOBLayer1
HLT enums.
float chiSqOvrNdf_[N_MAX_STORED]
ResidualRefitting::storage_muon storageGmrNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTEC
ResidualRefitting::storage_muon storageSamNoSt3_
T get() const
Definition: EventSetup.h:63
const GeomDet * idToDet(DetId) const override
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_
ResidualRefitting::storage_muon storageTrkNoTOBLayer3
edm::ESHandle< Propagator > thePropagator
void StoreTrackerRecHits(DetId detid, const TrackerTopology *tTopo, int iTrack, int iRec)
static constexpr int DT
Definition: MuonSubdetId.h:12
ResidualRefitting::storage_muon storageTrkNew_
ResidualRefitting::storage_trackExtrap storageTrackNoPXF
ResidualRefitting::storage_muon storageSamNoSt1_
#define str(s)
static constexpr int CSC
Definition: MuonSubdetId.h:13
T x() const
Definition: PV3DBase.h:62
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
T const * product() const
Definition: ESHandle.h:86
Definition: vlib.h:208
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
edm::InputTag muonsNoStation4_
void beginJob() override
int system_[N_MAX_STORED_HIT]
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
Definition: event.py:1
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
ResidualRefitting::storage_trackExtrap samExtrap120_