Hit-by-hit matching


  • find the best purity/efficiency/quality cut that gives the correct/stable MC correction for muon reconstruction.


  • CMSSW_3_7_0 the working version:RelVal_official
  • generate several samples with
    • simple Z/Jpsi/upsilon->mumu data samples:
    • different combinations of the cuts for the Purity (which can be done only in the configuration level, as in the map is stored the quality of the amtch, which is done fct simHits) and other switches in the configuration of the the muon matcher
    • for globalMuons, standAloneMuon:UpdatedAtVertex, and generalTracks
    • using hi-tracking and pp-tracking for the silicon part
  • look how pT resolution, efficiency vary
  • calculate correction (1/Eff), correct the reconstructed spectra, and compare then with the input, initial spectra. (if the correction is correct, the corrected reco spectra and the sim spectra should coincide)

Dissection of the muon MCTruth software


  • purity: x_purity = x_shared/n_x_selected_reco_hits (x=STA, GLB, TRK) , where the selected are the valid of the recoTrack
  • efficiency/matching_quality(written in the sim2reco map): x_quality = x_shared/n_x_selected_sim_hits , where selected are the recounted sim hits, subdetector, by subdetector
  • Hit types:
    • valid = valid hit
    • missing = detector is good, but no rec hit found
    • inactive = detector is off, so there was no hope
    • bad = there were many bad strips within the ellipse (in Tracker)
    • = hit is compatible with the trajectory, but chi2 is too large (in Muon System)

Methods for hit counting

    for(std::vector<PSimHit>::const_iterator simHit = simTrack.pSimHit_begin();
          simHit!= simTrack.pSimHit_end(); simHit++)
          const DetId detId = DetId(simHit->detUnitId());
          DetId::Detector detector = detId.det();
          int subdetId = static_cast<int>(detId.subdetId());
          if(detector == DetId::Tracker && (subdetId==PixelSubdetector::PixelBarrel || subdetId==PixelSubdetector::PixelEndcap) ) simpixelhits++;
          if (detector == DetId::Tracker && 
          subdetId==SiStripDetId::TID||subdetId==SiStripDetId::TEC) ) simstriphits++;
          if(detector == DetId::Muon && subdetId == MuonSubdetId::DT) simdthits++;
          if(detector == DetId::Muon && subdetId == MuonSubdetId::CSC) simcschits++;
          if(detector == DetId::Muon && subdetId == MuonSubdetId::RPC) simrpchits++;

  •  const reco::HitPattern& hp = trkRef.get()->hitPattern();

Key steps:

  • getMatchedIds:
    • Input: the XHitAssociators, all hits of a recoTrack
    • Output: valid and invalid, matched (and all) hits from: tracker, muon_total, rpc, dt,csc.
    • How:
      • loop over all reco hits and:
        • 1. count/get hits in each subdetector X (tracker, muon pieces)
        • 2. for each hit, call the corresponding XHitAssociator:valid, valid_matched, invalid, invalid_matched

  • getShared:
    • Input: map of matched Ids (indexed over the rechits of the reco::Track, no double-counting allowed), and TrackingPArticleCollection
    • Output: number of hits that are shared/matched between recoTrack and simTrack
    • How:
      • 1. loope over the map, and for each recoHit, get the vector of associated simhits
      • 2. count all the matches/shares

  • Matching decision
    • sim2reco (x_quality_cut = Efficiency_cut in the config file)
      • 1) X=STA, TRK: X_quality<= X_quality_cut -> XOk=false (1st criteria: the stub has to pass the quality/efficiency_cut)
      • 2) X_purity <= PurityCut_X (set in the configuration file) XOk = false;
      • 3) GLB=OK if TRK_OK && STA_OK (2st criteria, both stubs, have to pass the purity cut)
      • 4) add to the sim2Reco collection, with the (outputCollection[tpindex].push_back(IndexMatch(tindex,global_quality));) global_quality the sorting criteria

Problems and open questions:

  • SimHits (too many-pixel, RPC, or outside the detector coverage (DT)
    • Understood (Thanks to Phillip for the idea): the subDetector id-s, are just some enumerations <-> numbers ==> can have double counting

Hence, if you don't check also on the detector part (f(detector == DetId::Tracker && (subdetId==PixelSubdetector::PixelBarrel || subdetId==PixelSubdetector::PixelEndcap) ) simpixelhits++;), to the pixel count you'll add the dt's and rpc's hits (same subDetId, 1 and 2)! Duh!

This is done correctly in the matching code, hence all the efficiency, resolutions, corrections, etc plots, still stand. The corrected plots for my loop, are int he Summary slide.

  • number of RecHits (validHits) for CSC : 3\% cases in which the total number of CSC valid hits on the track is >24 (maximum possible)
    • from back-2-back in phi muons, with pT ~=: csc.pdf



  • matching decision based only on x_purity and fracHitMatch>0/0.5 and <0.75 are giving the right results ....
  • in HI, the fake rate will be higher--> in case one wants to present it separately, should chose a working point (purity,fracHitMatch) for which this rate is small
  • (purity_X=75%, and quality>0.5) suggested working point
mport SimMuon.MCTruth.MuonAssociatorByHits_cfi
process.glbMuonAssociatorByHits = SimMuon.MCTruth.MuonAssociatorByHits_cfi.muonAssociatorByHits.clone()
process.glbMuonAssociatorByHits.tracksTag                     = 'globalMuons'
process.glbMuonAssociatorByHits.UseTracker                    = True
process.glbMuonAssociatorByHits.UseMuon                       = True
process.glbMuonAssociatorByHits.PurityCut_track             = 0.75
process.glbMuonAssociatorByHits.EfficiencyCut_track      = 0.
process.glbMuonAssociatorByHits.PurityCut_muon           = 0.75
process.glbMuonAssociatorByHits.EfficiencyCut_muon    = 0.
process.glbMuonAssociatorByHits.includeZeroHitMuons  = False
process.glbMuonAssociatorByHits.acceptOneStubMatchings  = False

  • Note: corrections wrt pT_gen: correct up to resolution effects (best seen in the sTA plots)

-- CameliaMironov - 12-Oct-2010

Topic attachments
I Attachment History Action Size Date Who CommentSorted ascending
PDFpdf csc.pdf r1 manage 154.2 K 2010-10-13 - 17:09 CameliaMironov csc_hits>24
PDFpdf summaryHbHm.pdf r1 manage 585.6 K 2010-10-13 - 20:07 CameliaMironov summary
Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r10 - 2010-11-25 - CameliaMironov
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback