diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc b/DPGAnalysis/MuonTools/plugins/MuCSCTnPFlatTableProducer.cc similarity index 88% rename from DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc rename to DPGAnalysis/MuonTools/plugins/MuCSCTnPFlatTableProducer.cc index 944a6bd45552d..a3c4e8d8164c8 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.cc +++ b/DPGAnalysis/MuonTools/plugins/MuCSCTnPFlatTableProducer.cc @@ -1,4 +1,4 @@ -/** \class MuNtupleCSCTnPFiller MuNtupleCSCTnPFiller.cc MuDPGAnalysis/MuonDPGNtuples/plugins/MuNtupleCSCTnPFiller.cc +/** \class MuCSCTnPFlatTableProducer MuCSCTnPFlatTableProducer.cc MuDPGAnalysis/MuonDPGNtuples/plugins/MuCSCTnPFlatTableProducer.cc * * Helper class : the CSC Tag and probe segment efficiency filler * @@ -8,7 +8,7 @@ */ -#include "DPGAnalysis/MuonTools/plugins/MuNtupleCSCTnPFiller.h" +#include "DPGAnalysis/MuonTools/plugins/MuCSCTnPFlatTableProducer.h" #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/CSCRecHit/interface/CSCSegment.h" @@ -28,14 +28,14 @@ #include #include -MuNtupleCSCTnPFiller::MuNtupleCSCTnPFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), - m_muToken{config, consumesCollector(), "muonTag"}, - m_trackToken{config, consumesCollector(), "trackTag"}, - m_cscSegmentToken{config, consumesCollector(), "cscSegmentTag"}, - m_primaryVerticesToken{config, consumesCollector(), "primaryVerticesTag"}, - m_trigResultsToken{config, consumesCollector(), "trigResultsTag"}, - m_trigEventToken{config, consumesCollector(), "trigEventTag"}, +MuCSCTnPFlatTableProducer::MuCSCTnPFlatTableProducer(const edm::ParameterSet& config) + : MuBaseFlatTableProducer(config), + m_muToken{config, consumesCollector(), "muonSrc"}, + m_trackToken{config, consumesCollector(), "trackSrc"}, + m_cscSegmentToken{config, consumesCollector(), "cscSegmentSrc"}, + m_primaryVerticesToken{config, consumesCollector(), "primaryVerticesSrc"}, + m_trigResultsToken{config, consumesCollector(), "trigResultsSrc"}, + m_trigEventToken{config, consumesCollector(), "trigEventSrc"}, m_trigName{config.getParameter("trigName")}, m_isoTrigName{config.getParameter("isoTrigName")}, m_cscGeometry{consumesCollector()}, @@ -45,18 +45,18 @@ MuNtupleCSCTnPFiller::MuNtupleCSCTnPFiller(const edm::ParameterSet& config) produces(); } -void MuNtupleCSCTnPFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void MuCSCTnPFlatTableProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("label", "cscTnP"); - desc.add("muonTag", edm::InputTag{"muons"}); - desc.add("trackTag", edm::InputTag{"generalTracks"}); - desc.add("cscSegmentTag", edm::InputTag{"cscSegments"}); - desc.add("primaryVerticesTag", edm::InputTag{"offlinePrimaryVertices"}); + desc.add("name", "cscTnP"); + desc.add("muonSrc", edm::InputTag{"muons"}); + desc.add("trackSrc", edm::InputTag{"generalTracks"}); + desc.add("cscSegmentSrc", edm::InputTag{"cscSegments"}); + desc.add("primaryVerticesSrc", edm::InputTag{"offlinePrimaryVertices"}); - desc.add("trigEventTag", edm::InputTag{"hltTriggerSummaryAOD::HLT"}); - desc.add("trigResultsTag", edm::InputTag{"TriggerResults::HLT"}); + desc.add("trigEventSrc", edm::InputTag{"hltTriggerSummaryAOD::HLT"}); + desc.add("trigResultsSrc", edm::InputTag{"TriggerResults::HLT"}); desc.add("trigName", "none"); desc.add("isoTrigName", "HLT_IsoMu2*"); @@ -66,7 +66,7 @@ void MuNtupleCSCTnPFiller::fillDescriptions(edm::ConfigurationDescriptions& desc descriptions.addWithDefaultLabel(desc); } -void MuNtupleCSCTnPFiller::getFromES(const edm::Run& run, const edm::EventSetup& environment) { +void MuCSCTnPFlatTableProducer::getFromES(const edm::Run& run, const edm::EventSetup& environment) { m_cscGeometry.getFromES(environment); @@ -94,12 +94,12 @@ void MuNtupleCSCTnPFiller::getFromES(const edm::Run& run, const edm::EventSetup& } } -void MuNtupleCSCTnPFiller::getFromES(const edm::EventSetup& environment) { +void MuCSCTnPFlatTableProducer::getFromES(const edm::EventSetup& environment) { m_transientTrackBuilder.getFromES(environment); m_muonSP->update(environment); } -void MuNtupleCSCTnPFiller::fill(edm::Event& ev) { +void MuCSCTnPFlatTableProducer::fillTable(edm::Event& ev) { unsigned int m_nZCands = 0; // the # of digis (size of all following vectors) @@ -150,30 +150,30 @@ void MuNtupleCSCTnPFiller::fill(edm::Event& ev) { std::array,4> m_chamberLayer; // Segment layer information // Track intersection variables - std::array,4> m_ttIntLocalX; // track trajector intersection local X on stationas 1-4 - std::array,4> m_ttIntLocalY; // track trajector intersection local Y on stationas 1-4 - std::array,4> m_ttIntLocalErrorX; // track trajector intersection local X on stationas 1-4 - std::array,4> m_ttIntLocalErrorY; // track trajector intersection local Y on stationas 1-4 - std::array,4> m_ttIntLocalW; // track trajector intersection local Wire on stationas 1-4 - std::array,4> m_ttIntLocalS; // track trajector intersection local Strip on stationas 1-4 - std::array,4> m_ttIntEta; // track trajector intersection Eta stationas 1-4 + std::array,4> m_ttIntLocalX; // track trajector intersection local X on stations 1-4 + std::array,4> m_ttIntLocalY; // track trajector intersection local Y on stations 1-4 + std::array,4> m_ttIntLocalErrorX; // track trajector intersection local X on stations 1-4 + std::array,4> m_ttIntLocalErrorY; // track trajector intersection local Y on stations 1-4 + std::array,4> m_ttIntLocalW; // track trajector intersection local Wire on stations 1-4 + std::array,4> m_ttIntLocalS; // track trajector intersection local Strip on stations 1-4 + std::array,4> m_ttIntEta; // track trajector intersection Eta stations 1-4 // Track intersection fiducial information - std::array,4> m_ttDistToEdge; // track trajector intersection distance to edge, neg is with champer, on stationas 1-4 - std::array,4> m_ttDistToHVGap; // track trajector intersection distance to HV GAP on stationas 1-4 + std::array,4> m_ttDistToEdge; // track trajector intersection distance to edge, neg is with chamber, on stations 1-4 + std::array,4> m_ttDistToHVGap; // track trajector intersection distance to HV GAP on stations 1-4 // Segment location variables - std::array,4> m_segLocalX; // segement local X on stationas 1-4 - std::array,4> m_segLocalY; // segement local Y on stationas 1-4 - std::array,4> m_segLocalErrorX; // segement local X error on stationas 1-4 - std::array,4> m_segLocalErrorY; // segement local Y error on stationas 1-4 + std::array,4> m_segLocalX; // segment local X on stations 1-4 + std::array,4> m_segLocalY; // segment local Y on stations 1-4 + std::array,4> m_segLocalErrorX; // segment local X error on stations 1-4 + std::array,4> m_segLocalErrorY; // segment local Y error on stations 1-4 - // track intersection segement residuals variables - std::array,4> m_ttIntSegResidualLocalX; // track trajector intersection Segment residual local X on stationas 1-4 - std::array,4> m_ttIntSegResidualLocalY; // track trajector intersection Segment residuallocal Y on stationas 1-4 + // track intersection segment residuals variables + std::array,4> m_ttIntSegResidualLocalX; // track trajector intersection Segment residual local X on stations 1-4 + std::array,4> m_ttIntSegResidualLocalY; // track trajector intersection Segment residuallocal Y on stations 1-4 auto&& propagator_along = m_muonSP->propagator("SteppingHelixPropagatorAlong"); auto&& propagator_opposite = m_muonSP->propagator("SteppingHelixPropagatorOpposite"); @@ -396,9 +396,9 @@ void MuNtupleCSCTnPFiller::fill(edm::Event& ev) { // if (m_nZCands>0) { - auto table = std::make_unique(m_nZCands, m_label, false, false); + auto table = std::make_unique(m_nZCands, m_name, false, false); - table->setDoc("CSC Tag & Probe segement efficiency information"); + table->setDoc("CSC Tag & Probe segment efficiency information"); addColumn(table,"muonPt",m_muonPt,"muon pt [GeV/c]"); @@ -517,18 +517,18 @@ void MuNtupleCSCTnPFiller::fill(edm::Event& ev) { ev.put(std::move(table)); } -float MuNtupleCSCTnPFiller::computeTrkIso(const reco::MuonIsolation& isolation, float muonPt) { +float MuCSCTnPFlatTableProducer::computeTrkIso(const reco::MuonIsolation& isolation, float muonPt) { return isolation.sumPt / muonPt; } -float MuNtupleCSCTnPFiller::computePFIso(const reco::MuonPFIsolation& pfIsolation, float muonPt) { +float MuCSCTnPFlatTableProducer::computePFIso(const reco::MuonPFIsolation& pfIsolation, float muonPt) { return (pfIsolation.sumChargedHadronPt + std::max(0., pfIsolation.sumNeutralHadronEt + pfIsolation.sumPhotonEt - 0.5 * pfIsolation.sumPUPt)) / muonPt; } -bool MuNtupleCSCTnPFiller::hasTrigger(std::vector& trigIndices, +bool MuCSCTnPFlatTableProducer::hasTrigger(std::vector& trigIndices, const trigger::TriggerObjectCollection& trigObjs, edm::Handle& trigEvent, const reco::Muon& muon) { @@ -557,8 +557,8 @@ bool MuNtupleCSCTnPFiller::hasTrigger(std::vector& trigIndices, } -//bool MuNtupleCSCTnPFiller::muonTagSelection(const reco::Muon & muon,edm::Handle> tracks) -bool MuNtupleCSCTnPFiller::muonTagSelection(const reco::Muon & muon) +//bool MuCSCTnPFlatTableProducer::muonTagSelection(const reco::Muon & muon,edm::Handle> tracks) +bool MuCSCTnPFlatTableProducer::muonTagSelection(const reco::Muon & muon) { float ptCut = 10.0; @@ -585,7 +585,7 @@ bool MuNtupleCSCTnPFiller::muonTagSelection(const reco::Muon & muon) } -bool MuNtupleCSCTnPFiller::trackProbeSelection(const reco::Track & track,edm::Handle> tracks) +bool MuCSCTnPFlatTableProducer::trackProbeSelection(const reco::Track & track,edm::Handle> tracks) { @@ -611,7 +611,7 @@ bool MuNtupleCSCTnPFiller::trackProbeSelection(const reco::Track & track,edm::Ha } -bool MuNtupleCSCTnPFiller::zSelection(const reco::Muon & muon,const reco::Track & track) +bool MuCSCTnPFlatTableProducer::zSelection(const reco::Muon & muon,const reco::Track & track) { bool selected = false; @@ -623,7 +623,7 @@ bool MuNtupleCSCTnPFiller::zSelection(const reco::Muon & muon,const reco::Track } // get track position at a particular (xy) plane given its z -TrajectoryStateOnSurface MuNtupleCSCTnPFiller::surfExtrapTrkSam(const reco::Track & track, double z) +TrajectoryStateOnSurface MuCSCTnPFlatTableProducer::surfExtrapTrkSam(const reco::Track & track, double z) { Plane::PositionType pos(0, 0, z); Plane::RotationType rot; @@ -640,7 +640,7 @@ TrajectoryStateOnSurface MuNtupleCSCTnPFiller::surfExtrapTrkSam(const reco::Trac } -FreeTrajectoryState MuNtupleCSCTnPFiller::freeTrajStateMuon(const reco::Track & track) +FreeTrajectoryState MuCSCTnPFlatTableProducer::freeTrajStateMuon(const reco::Track & track) { //no track extras in nanoaod so directly use vx and p GlobalPoint innerPoint(track.vx(), track.vy(), track.vz()); @@ -656,7 +656,7 @@ FreeTrajectoryState MuNtupleCSCTnPFiller::freeTrajStateMuon(const reco::Track & return (cov.kRows == 6 ? FreeTrajectoryState(gtPars, tCov) : FreeTrajectoryState(gtPars)) ; } -UChar_t MuNtupleCSCTnPFiller::ringCandidate(Int_t iiStation, Int_t station, Float_t feta, Float_t phi){ +UChar_t MuCSCTnPFlatTableProducer::ringCandidate(Int_t iiStation, Int_t station, Float_t feta, Float_t phi){ UChar_t ring = 0; @@ -718,7 +718,7 @@ UChar_t MuNtupleCSCTnPFiller::ringCandidate(Int_t iiStation, Int_t station, Floa } -UChar_t MuNtupleCSCTnPFiller::thisChamberCandidate(UChar_t station, UChar_t ring, Float_t phi){ +UChar_t MuCSCTnPFlatTableProducer::thisChamberCandidate(UChar_t station, UChar_t ring, Float_t phi){ // cout <<"\t\t TPTrackMuonSys::thisChamberCandidate..."<idToDet( (CSCDetId)(*segIt).cscDetId() ); LocalPoint localTTPos = gdet->surface().toLocal(TrajSuf.freeState()->position()); @@ -745,7 +745,7 @@ Float_t MuNtupleCSCTnPFiller::TrajectoryDistToSeg( TrajectoryStateOnSurface Traj } -TrajectoryStateOnSurface* MuNtupleCSCTnPFiller::matchTTwithCSCSeg(const reco::Track & track, edm::Handle cscSegments, CSCSegmentCollection::const_iterator &cscSegOut, CSCDetId & idCSC ) { +TrajectoryStateOnSurface* MuCSCTnPFlatTableProducer::matchTTwithCSCSeg(const reco::Track & track, edm::Handle cscSegments, CSCSegmentCollection::const_iterator &cscSegOut, CSCDetId & idCSC ) { TrajectoryStateOnSurface *TrajSuf=NULL; Float_t deltaCSCR = 9999.; @@ -781,7 +781,7 @@ TrajectoryStateOnSurface* MuNtupleCSCTnPFiller::matchTTwithCSCSeg(const reco::Tr return TrajSuf; } -std::vector MuNtupleCSCTnPFiller::GetEdgeAndDistToGap(const reco::Track & track, CSCDetId & detid) { +std::vector MuCSCTnPFlatTableProducer::GetEdgeAndDistToGap(const reco::Track & track, CSCDetId & detid) { std::vector result(4,9999.); result[3]=-9999; const GeomDet* gdet=m_cscGeometry->idToDet( detid ); @@ -824,7 +824,7 @@ std::vector MuNtupleCSCTnPFiller::GetEdgeAndDistToGap(const reco::Track //deadzone center is according to http://cmssdt.cern.ch/SDT/lxr/source/RecoLocalMuon/CSCEfficiency/src/CSCEfficiency.cc#605 //wire spacing is according to CSCTDR -Float_t MuNtupleCSCTnPFiller::YDistToHVDeadZone(Float_t yLocal, Int_t StationAndRing){ +Float_t MuCSCTnPFlatTableProducer::YDistToHVDeadZone(Float_t yLocal, Int_t StationAndRing){ //the ME11 wires are not parallel to x, but no gap //chamber edges are not included. const Float_t deadZoneCenterME1_2[2] = {-32.88305,32.867423}; @@ -868,7 +868,7 @@ Float_t MuNtupleCSCTnPFiller::YDistToHVDeadZone(Float_t yLocal, Int_t StationAnd return minY; } -double MuNtupleCSCTnPFiller::iso(const reco::Track& track, edm::Handle> tracks) +double MuCSCTnPFlatTableProducer::iso(const reco::Track& track, edm::Handle> tracks) { double isoSum = 0.0; @@ -879,7 +879,7 @@ double MuNtupleCSCTnPFiller::iso(const reco::Track& track, edm::Handle> tracks); - bool trackProbeSelection(const reco::Track & track,edm::Handle> tracks); - bool muonTagSelection(const reco::Muon & muon); + bool trackProbeSelection(const reco::Track & track,edm::Handle>); + bool muonTagSelection(const reco::Muon &); //bool trackProbeSelection(const reco::Track & track); - bool zSelection(const reco::Muon & muon,const reco::Track & track); + bool zSelection(const reco::Muon &,const reco::Track &); // Calculation functions - double zMass(const reco::Track & track,const reco::Muon & muon); - double calcDeltaR(double eta1, double eta2, double phi1, double phi2); - double iso(const reco::Track& track,edm::Handle> tracks); + double zMass(const reco::Track &,const reco::Muon &); + double calcDeltaR(double, double, double, double); + double iso(const reco::Track&,edm::Handle>); // Track extrapolation and segment match functions - TrajectoryStateOnSurface surfExtrapTrkSam(const reco::Track & track, double z); - FreeTrajectoryState freeTrajStateMuon(const reco::Track & track); + TrajectoryStateOnSurface surfExtrapTrkSam(const reco::Track &, double); + FreeTrajectoryState freeTrajStateMuon(const reco::Track &); UChar_t ringCandidate(Int_t iiStation, Int_t station, Float_t feta, Float_t phi); UChar_t thisChamberCandidate(UChar_t station, UChar_t ring, Float_t phi); - TrajectoryStateOnSurface* matchTTwithCSCSeg(const reco::Track & track, edm::Handle cscSegments,CSCSegmentCollection::const_iterator &cscSegOut, CSCDetId & idCSC ); - Float_t TrajectoryDistToSeg( TrajectoryStateOnSurface TrajSuf, CSCSegmentCollection::const_iterator segIt); - std::vector GetEdgeAndDistToGap(const reco::Track & track, CSCDetId & detid); - Float_t YDistToHVDeadZone(Float_t yLocal, Int_t StationAndRing); + TrajectoryStateOnSurface* matchTTwithCSCSeg(const reco::Track &, edm::Handle ,CSCSegmentCollection::const_iterator &, CSCDetId &); + Float_t TrajectoryDistToSeg( TrajectoryStateOnSurface, CSCSegmentCollection::const_iterator); + std::vector GetEdgeAndDistToGap(const reco::Track & , CSCDetId & ); + Float_t YDistToHVDeadZone(Float_t, Int_t); /// The variables holding /// the T&P related information @@ -139,13 +139,13 @@ class MuNtupleCSCTnPFiller : public MuNtupleBaseFiller { double _muonIso; double _zMass; - bool hasTrigger(std::vector &trigIndices, - const trigger::TriggerObjectCollection &trigObjs, - edm::Handle &trigEvent, - const reco::Muon &muon); + bool hasTrigger(std::vector &, + const trigger::TriggerObjectCollection &, + edm::Handle &, + const reco::Muon &); - float computeTrkIso(const reco::MuonIsolation &isolation, float muonPt); - float computePFIso(const reco::MuonPFIsolation &PFisolation, float muonPt); + float computeTrkIso(const reco::MuonIsolation &, float); + float computePFIso(const reco::MuonPFIsolation &, float); }; #endif diff --git a/DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.cc b/DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.cc new file mode 100644 index 0000000000000..0b3dbfb004bd6 --- /dev/null +++ b/DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.cc @@ -0,0 +1,330 @@ +/** \class MuDTMuonExtTableProducer MuDTMuonExtTableProducer.cc DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.cc + * + * Helper class : the muon filler + * + * \author L. Lunerti (INFN BO) + * + * + */ + +#include "DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.h" + +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/MuonDetId/interface/DTChamberId.h" +#include "DataFormats/MuonReco/interface/MuonChamberMatch.h" +#include "DataFormats/MuonReco/interface/MuonSegmentMatch.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" + +#include "DataFormats/DTRecHit/interface/DTRecSegment4D.h" +#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" +#include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" +#include "DataFormats/MuonDetId/interface/DTChamberId.h" + +#include "DataFormats/Math/interface/deltaR.h" + +#include "TString.h" +#include "TRegexp.h" + +#include +#include + +MuDTMuonExtTableProducer::MuDTMuonExtTableProducer(const edm::ParameterSet& config) + : MuBaseFlatTableProducer(config), + m_muToken{config, consumesCollector(), "src"}, + m_dtSegmentToken{config, consumesCollector(), "dtSegmentSrc"}, + m_trigResultsToken{config, consumesCollector(), "trigResultsSrc"}, + m_trigEventToken{config, consumesCollector(), "trigEventSrc"}, + m_fillMatches{config.getParameter("fillMatches")}, + m_trigName{config.getParameter("trigName")}, + m_isoTrigName{config.getParameter("isoTrigName")}, + m_dtGeometry{consumesCollector()} { + produces(); + if (m_fillMatches) { + produces("matches"); + produces("staMatches"); + } +} + +void MuDTMuonExtTableProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + + desc.add("name", "muon"); + desc.add("src", edm::InputTag{"muons"}); + desc.add("dtSegmentSrc", edm::InputTag{"dt4DSegments"}); + desc.add("trigEventSrc", edm::InputTag{"hltTriggerSummaryAOD::HLT"}); + desc.add("trigResultsSrc", edm::InputTag{"TriggerResults::HLT"}); + + desc.add("fillMatches", true); + + desc.add("trigName", "HLT_Mu55*"); + desc.add("isoTrigName", "HLT_IsoMu2*"); + + descriptions.addWithDefaultLabel(desc); +} + +void MuDTMuonExtTableProducer::getFromES(const edm::Run& run, const edm::EventSetup& environment) { + m_dtGeometry.getFromES(environment); + + bool changed{true}; + m_hltConfig.init(run, environment, "HLT", changed); + + const bool enableWildcard{true}; + + TString tName = TString(m_trigName); + TRegexp tNamePattern = TRegexp(tName, enableWildcard); + + for (unsigned iPath = 0; iPath < m_hltConfig.size(); ++iPath) { + TString pathName = TString(m_hltConfig.triggerName(iPath)); + if (pathName.Contains(tNamePattern)) + m_trigIndices.push_back(static_cast(iPath)); + } + + tName = TString(m_isoTrigName); + tNamePattern = TRegexp(tName, enableWildcard); + + for (unsigned iPath = 0; iPath < m_hltConfig.size(); ++iPath) { + TString pathName = TString(m_hltConfig.triggerName(iPath)); + if (pathName.Contains(tNamePattern)) + m_isoTrigIndices.push_back(static_cast(iPath)); + } +} + +void MuDTMuonExtTableProducer::fillTable(edm::Event& ev) { + unsigned int nMuons{0}; + + std::vector firesIsoTrig; + std::vector firesTrig; + + std::vector nMatches; + std::vector staMu_nMatchSeg; + + std::vector matches_begin; + std::vector matches_end; + + std::vector staMatches_begin; + std::vector staMatches_end; + + std::vector matches_wheel; + std::vector matches_sector; + std::vector matches_station; + + std::vector matches_x; + std::vector matches_y; + + std::vector matches_phi; + std::vector matches_eta; + std::vector matches_edgeX; + std::vector matches_edgeY; + + std::vector matches_dXdZ; + std::vector matches_dYdZ; + + std::vector staMatches_MuSegIdx; + + auto muons = m_muToken.conditionalGet(ev); + auto segments = m_dtSegmentToken.conditionalGet(ev); + + auto triggerResults = m_trigResultsToken.conditionalGet(ev); + auto triggerEvent = m_trigEventToken.conditionalGet(ev); + + if (muons.isValid() && segments.isValid()) { + for (const auto& muon : (*muons)) { + + if (triggerResults.isValid() && triggerEvent.isValid()) { + const auto& triggerObjects = triggerEvent->getObjects(); + + bool hasIsoTrig = hasTrigger(m_isoTrigIndices, triggerObjects, triggerEvent, muon); + bool hasTrig = hasTrigger(m_trigIndices, triggerObjects, triggerEvent, muon); + + firesIsoTrig.push_back(hasIsoTrig); + firesTrig.push_back(hasTrig); + + } else { + firesIsoTrig.push_back(false); + firesTrig.push_back(false); + } + + size_t iMatches = 0; + size_t iSegMatches = 0; + + if (m_fillMatches) { + matches_begin.push_back(matches_wheel.size()); + + if (muon.isMatchesValid()) { + for (const auto& match : muon.matches()) { + if (match.id.det() == DetId::Muon && match.id.subdetId() == MuonSubdetId::DT) { + DTChamberId dtId(match.id.rawId()); + const auto chamb = m_dtGeometry->chamber(static_cast(match.id)); + + matches_wheel.push_back(dtId.wheel()); + matches_sector.push_back(dtId.sector()); + matches_station.push_back(dtId.station()); + + matches_x.push_back(match.x); + matches_y.push_back(match.y); + + matches_phi.push_back(chamb->toGlobal(LocalPoint(match.x, match.y, 0.)).phi()); + matches_eta.push_back(chamb->toGlobal(LocalPoint(match.x, match.y, 0.)).eta()); + + matches_edgeX.push_back(match.edgeX); + matches_edgeY.push_back(match.edgeY); + + matches_dXdZ.push_back(match.dXdZ); + matches_dYdZ.push_back(match.dYdZ); + + ++iMatches; + } + } + } + + matches_end.push_back(matches_wheel.size()); + + //SEGMENT MATCHING VARIABLES + + staMatches_begin.push_back(staMatches_MuSegIdx.size()); + + if (!muon.outerTrack().isNull()) { + reco::TrackRef outerTrackRef = muon.outerTrack(); + + auto recHitIt = outerTrackRef->recHitsBegin(); + auto recHitEnd = outerTrackRef->recHitsEnd(); + + for (; recHitIt != recHitEnd; ++recHitIt) { + DetId detId = (*recHitIt)->geographicalId(); + + if (detId.det() == DetId::Muon && detId.subdetId() == MuonSubdetId::DT) { + const auto dtSegmentSta = dynamic_cast((*recHitIt)); + int iSeg = 0; + + for (const auto& segment : (*segments)) { + if (dtSegmentSta && dtSegmentSta->chamberId().station() == segment.chamberId().station() && + dtSegmentSta->chamberId().wheel() == segment.chamberId().wheel() && + dtSegmentSta->chamberId().sector() == segment.chamberId().sector() && + std::abs(dtSegmentSta->localPosition().x() - segment.localPosition().x()) < 0.001 && + std::abs(dtSegmentSta->localPosition().y() - segment.localPosition().y()) < 0.001 && + std::abs(dtSegmentSta->localDirection().x() - segment.localDirection().x()) < 0.001 && + std::abs(dtSegmentSta->localDirection().y() - segment.localDirection().y()) < 0.001) { + staMatches_MuSegIdx.push_back(iSeg); + ++iSegMatches; + } + + ++iSeg; + } //loop over segments + } + + } //loop over recHits + } + + staMatches_end.push_back(staMatches_MuSegIdx.size()); + } + + nMatches.push_back(iMatches); + staMu_nMatchSeg.push_back(iSegMatches); + + ++nMuons; + } + } + + auto table = std::make_unique(nMuons, m_name, false, true); + + addColumn(table, + "firesIsoTrig", + firesIsoTrig, + "True if the muon is matched to an isolated trigger" + "
specified in the ntuple config file"); + + addColumn(table, + "firesTrig", + firesTrig, + "True if the muon is matched to a (non isolated)trigger" + "
specified in the ntuple config file"); + + addColumn(table, "nMatches", nMatches, "Number of muon chamber matches (DT only)"); + addColumn(table, "staMu_nMatchSeg", staMu_nMatchSeg, "Number of segments used in the standalone track (DT only)"); + + addColumn( + table, "matches_begin", matches_begin, "begin() of range of quantities for a given muon in the *_matches_* vectors"); + addColumn(table, "matches_end", matches_end, "end() of range of quantities for a given muon in the *_matches_* vectors"); + + addColumn(table, + "staMatches_begin", + staMatches_begin, + "begin() of range of quantities for a given muon in the matches_staMuSegIdx vector"); + addColumn(table, + "staMatches_end", + staMatches_end, + "end() of range of quantities for a given muon in the matches_staMuSegIdx vector"); + + ev.put(std::move(table)); + + if (m_fillMatches) { + auto sum = [](std::vector v) { return std::accumulate(v.begin(), v.end(), 0); }; + + auto tabMatches = std::make_unique(sum(nMatches), m_name + "_matches", false, false); + + tabMatches->setDoc("RECO muon matches_* vectors"); + + addColumn(tabMatches, "x", matches_x, "x position of the extrapolated track on the matched DT chamber"); + addColumn(tabMatches, "y", matches_y, "x position of the extrapolated track on the matched DT chamber"); + + addColumn(tabMatches, "wheel", matches_wheel, "matched DT chamber wheel"); + addColumn(tabMatches, "sector", matches_sector, "matched DT chamber sector"); + addColumn(tabMatches, "station", matches_station, "matched DT chamber station"); + + addColumn( + tabMatches, "phi", matches_phi, "phi of the (x,y) position on the matched DT chamber (global reference frame)"); + addColumn( + tabMatches, "eta", matches_eta, " eta of the (x,y) position on the matched cDT hamber (global reference frame)"); + + addColumn(tabMatches, "dXdZ", matches_dXdZ, "dXdZ of the extrapolated track on the matched DT chamber"); + addColumn(tabMatches, "dYdZ", matches_dYdZ, "dYdZ of the extrapolated track on the matched DT chamber"); + + ev.put(std::move(tabMatches), "matches"); + + auto tabStaMatches = + std::make_unique(sum(staMu_nMatchSeg), m_name + "_staMatches", false, false); + + tabStaMatches->setDoc("RECO muon staMatches_* vector"); + + addColumn(tabStaMatches, + "MuSegIdx", + staMatches_MuSegIdx, + "Index of DT segments used in the standalone track it corresponds" + "
to the index of a given segment in the ntuple seg_* collection"); + + ev.put(std::move(tabStaMatches), "staMatches"); + } +} + +bool MuDTMuonExtTableProducer::hasTrigger(std::vector& trigIndices, + const trigger::TriggerObjectCollection& trigObjs, + edm::Handle& trigEvent, + const reco::Muon& muon) { + float dRMatch = 999.; + for (int trigIdx : trigIndices) { + const std::vector trigModuleLabels = m_hltConfig.moduleLabels(trigIdx); + + const unsigned trigModuleIndex = + std::find(trigModuleLabels.begin(), trigModuleLabels.end(), "hltBoolEnd") - trigModuleLabels.begin() - 1; + const unsigned hltFilterIndex = trigEvent->filterIndex(edm::InputTag(trigModuleLabels[trigModuleIndex], "", "HLT")); + if (hltFilterIndex < trigEvent->sizeFilters()) { + const trigger::Keys keys = trigEvent->filterKeys(hltFilterIndex); + const trigger::Vids vids = trigEvent->filterIds(hltFilterIndex); + const unsigned nTriggers = vids.size(); + + for (unsigned iTrig = 0; iTrig < nTriggers; ++iTrig) { + trigger::TriggerObject trigObj = trigObjs[keys[iTrig]]; + float dR = deltaR(muon, trigObj); + if (dR < dRMatch) + dRMatch = dR; + } + } + } + + return dRMatch < 0.1; //CB should become programmable +} + +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +DEFINE_FWK_MODULE(MuDTMuonExtTableProducer); \ No newline at end of file diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.h b/DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.h similarity index 63% rename from DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.h rename to DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.h index 93726c49f6ea2..3e9e096489ca7 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.h +++ b/DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.h @@ -1,7 +1,7 @@ -#ifndef MuNtuple_MuNtupleMuonFiller_h -#define MuNtuple_MuNtupleMuonFiller_h +#ifndef MuNtuple_MuDTMuonExtTableProducer_h +#define MuNtuple_MuDTMuonExtTableProducer_h -/** \class MuNtupleMuonFiller MuNtupleMuonFiller.h DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.h +/** \class MuDTMuonExtTableProducer MuDTMuonExtTableProducer.h DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.h * * Helper class : the muon filler * @@ -10,7 +10,7 @@ * */ -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" +#include "DPGAnalysis/MuonTools/src/MuBaseFlatTableProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -27,26 +27,25 @@ #include "DataFormats/HLTReco/interface/TriggerObject.h" #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" -class MuNtupleMuonFiller : public MuNtupleBaseFiller { +class MuDTMuonExtTableProducer : public MuBaseFlatTableProducer { public: /// Constructor - MuNtupleMuonFiller(const edm::ParameterSet &l); + MuDTMuonExtTableProducer(const edm::ParameterSet &); /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions &); protected: /// Fill tree branches for a given events - void fill(edm::Event &ev) final; + void fillTable(edm::Event &) final; /// Get info from the ES by run - void getFromES(const edm::Run &run, const edm::EventSetup &environment) final; + void getFromES(const edm::Run &, const edm::EventSetup &) final; private: /// Tokens nano_mu::EDTokenHandle m_muToken; nano_mu::EDTokenHandle m_dtSegmentToken; - nano_mu::EDTokenHandle> m_primaryVerticesToken; nano_mu::EDTokenHandle m_trigResultsToken; nano_mu::EDTokenHandle m_trigEventToken; @@ -68,13 +67,13 @@ class MuNtupleMuonFiller : public MuNtupleBaseFiller { std::vector m_trigIndices; std::vector m_isoTrigIndices; - bool hasTrigger(std::vector &trigIndices, - const trigger::TriggerObjectCollection &trigObjs, - edm::Handle &trigEvent, - const reco::Muon &muon); + bool hasTrigger(std::vector &, + const trigger::TriggerObjectCollection &, + edm::Handle &, + const reco::Muon &); - float computeTrkIso(const reco::MuonIsolation &isolation, float muonPt); - float computePFIso(const reco::MuonPFIsolation &PFisolation, float muonPt); + float computeTrkIso(const reco::MuonIsolation &, float); + float computePFIso(const reco::MuonPFIsolation &, float); }; #endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.cc b/DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.cc similarity index 57% rename from DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.cc rename to DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.cc index 2331888736445..36add3713df33 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.cc +++ b/DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.cc @@ -1,13 +1,13 @@ -/** \class MuNtupleDTSegmentFiller MuNtupleDTSegmentFiller.cc DTDPGAnalysis/MuonDPGNtuples/src/MuNtupleDTSegmentFiller.cc +/** \class MuDTSegmentExtTableProducer MuDTSegmentExtTableProducer.cc DTDPGAnalysis/MuonDPGNtuples/src/MuDTSegmentExtTableProducer.cc * - * Helper class : the segment filler for Phase-1 / Phase2 segments (the DataFormat is the same) + * Helper class : the segment TableProducer for Phase-1 / Phase2 segments (the DataFormat is the same) * * \author C. Battilana (INFN BO) * * */ -#include "DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.h" +#include "DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.h" #include "TrackingTools/GeomPropagators/interface/StraightLinePlaneCrossing.h" #include "TrackingTools/GeomPropagators/interface/Propagator.h" @@ -15,10 +15,11 @@ #include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" #include +#include -MuNtupleDTSegmentFiller::MuNtupleDTSegmentFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller{config}, - m_token{config, consumesCollector(), "dtSegmentTag"}, +MuDTSegmentExtTableProducer::MuDTSegmentExtTableProducer(const edm::ParameterSet& config) + : MuBaseFlatTableProducer{config}, + m_token{config, consumesCollector(), "src"}, m_fillHits{config.getParameter("fillHits")}, m_fillExtr{config.getParameter("fillExtrapolation")}, m_dtGeometry{consumesCollector()}, @@ -36,11 +37,11 @@ MuNtupleDTSegmentFiller::MuNtupleDTSegmentFiller(const edm::ParameterSet& config consumesCollector()); } -void MuNtupleDTSegmentFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void MuDTSegmentExtTableProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("label", "dtSegments"); - desc.add("dtSegmentTag", edm::InputTag{"dt4DSegments"}); + desc.add("name", "dtSegment"); + desc.add("src", edm::InputTag{"dt4DSegments"}); desc.add("fillExtrapolation", true); desc.add("fillHits", true); @@ -64,52 +65,25 @@ void MuNtupleDTSegmentFiller::fillDescriptions(edm::ConfigurationDescriptions& d descriptions.addWithDefaultLabel(desc); } -void MuNtupleDTSegmentFiller::getFromES(const edm::Run& run, const edm::EventSetup& environment) { +void MuDTSegmentExtTableProducer::getFromES(const edm::Run& run, const edm::EventSetup& environment) { m_dtGeometry.getFromES(environment); } -void MuNtupleDTSegmentFiller::getFromES(const edm::EventSetup& environment) { +void MuDTSegmentExtTableProducer::getFromES(const edm::EventSetup& environment) { m_trackingGeometry.getFromES(environment); m_dtSync->setES(environment); } -void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { +void MuDTSegmentExtTableProducer::fillTable(edm::Event& ev) { unsigned int nSegments{0}; - std::vector seg4D_wheel; - std::vector seg4D_sector; - std::vector seg4D_station; - - std::vector seg4D_hasPhi; - std::vector seg4D_hasZed; - - std::vector seg4D_posLoc_x; - std::vector seg4D_posLoc_y; - std::vector seg4D_posLoc_z; - std::vector seg4D_dirLoc_x; - std::vector seg4D_dirLoc_y; - std::vector seg4D_dirLoc_z; - std::vector seg4D_posLoc_x_SL1; std::vector seg4D_posLoc_x_SL3; std::vector seg4D_posLoc_x_midPlane; - std::vector seg4D_posGlb_phi; - std::vector seg4D_posGlb_eta; - std::vector seg4D_dirGlb_phi; - std::vector seg4D_dirGlb_eta; - std::vector seg4D_extr_begin; std::vector seg4D_extr_end; - std::vector seg2D_phi_t0; - std::vector seg2D_phi_vDrift; - std::vector seg2D_phi_normChi2; - std::vector seg2D_phi_nHits; - - std::vector seg2D_z_normChi2; - std::vector seg2D_z_nHits; - std::vector seg2D_hits_begin; std::vector seg2D_hits_end; @@ -173,33 +147,18 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { const auto& range = segments4D->get(*chambIt); for (auto segment4D = range.first; segment4D != range.second; ++segment4D) { + auto station = (*chambIt).station(); auto wheel = (*chambIt).wheel(); auto sector = (*chambIt).sector(); - auto station = (*chambIt).station(); - - seg4D_wheel.push_back(wheel); - seg4D_sector.push_back(sector); - seg4D_station.push_back(station); bool hasPhi = segment4D->hasPhi(); bool hasZed = segment4D->hasZed(); - seg4D_hasPhi.push_back(hasPhi); - seg4D_hasZed.push_back(hasZed); - auto pos = segment4D->localPosition(); auto dir = segment4D->localDirection(); - seg4D_posLoc_x.push_back(pos.x()); - seg4D_posLoc_y.push_back(pos.y()); - seg4D_posLoc_z.push_back(pos.z()); - - seg4D_dirLoc_x.push_back(dir.x()); - seg4D_dirLoc_y.push_back(dir.y()); - seg4D_dirLoc_z.push_back(dir.z()); - - double xPosLocSL[2] = {DEFAULT_DOUBLE_VAL, DEFAULT_DOUBLE_VAL}; - bool hasPptSL[2] = {false, false}; + std::array xPosLocSL{{DEFAULT_DOUBLE_VAL, DEFAULT_DOUBLE_VAL}}; + std::array hasPptSL{{false, false}}; auto xPosLocMidPlane = DEFAULT_DOUBLE_VAL; const auto* chamb = m_dtGeometry->chamber(*chambIt); @@ -231,19 +190,15 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { const auto begin = seg4D_hitsExpPos.size(); - auto size{station == 4 ? 8 : 12}; + const auto size{station == 4 ? 8 : 12}; nExtr += size; seg4D_extr_begin.push_back(begin); seg4D_extr_end.push_back(begin + size); - std::vector iSLs{1, 2, 3}; - - // CB find a better way - if (station == 4) - iSLs.erase(++iSLs.begin()); + const auto iSLs = station < 4 ? std::vector{1, 2, 3} : std::vector{1, 3}; - for (int iL = 1; iL < 5; ++iL) { + for (int iL = FIRST_LAYER; iL <= LAST_LAYER; ++iL) { for (const auto iSL : iSLs) { auto* layer = m_dtGeometry->layer(DTWireId{wheel, station, sector, iSL, iL, 2}); auto ppt = segmentPlaneCrossing.position(layer->surface()); @@ -259,11 +214,11 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { LocalPoint segPosAtZWireLayer = layer->toLocal(segExrapolationToLayer); LocalPoint segPosAtZWireChamber = chamb->toLocal(segExrapolationToLayer); - if (hasPhi && iSL != 2) { + if (hasPhi && iSL != THETA_SL) { expPos = segPosAtZWireLayer.x(); expPosCh = segPosAtZWireChamber.x(); expWire = layer->specificTopology().channel(segPosAtZWireLayer); - } else if (hasZed && iSL == 2) { + } else if (hasZed && iSL == THETA_SL) { expPos = segPosAtZWireLayer.x(); expPosCh = segPosAtZWireChamber.y(); expWire = layer->specificTopology().channel(segPosAtZWireLayer); @@ -276,44 +231,15 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { } } - const GeomDet* geomDet = m_trackingGeometry->idToDet(segment4D->geographicalId()); - auto posGlb = geomDet->toGlobal(pos); - auto dirGlb = geomDet->toGlobal(dir); - - seg4D_posGlb_phi.push_back(posGlb.phi()); - seg4D_posGlb_eta.push_back(posGlb.eta()); - - seg4D_dirGlb_phi.push_back(dirGlb.phi()); - seg4D_dirGlb_eta.push_back(dirGlb.eta()); - seg2D_hits_begin.push_back(seg2D_hits_pos.size()); + const GeomDet* geomDet = m_trackingGeometry->idToDet(segment4D->geographicalId()); if (hasPhi) { - const auto* phiSeg = segment4D->phiSegment(); - - seg2D_phi_t0.push_back(phiSeg->t0()); - seg2D_phi_vDrift.push_back(phiSeg->vDrift()); - seg2D_phi_normChi2.push_back(phiSeg->chi2() / phiSeg->degreesOfFreedom()); - seg2D_phi_nHits.push_back(phiSeg->specificRecHits().size()); - - fillHits(phiSeg, geomDet); - } else { - seg2D_phi_t0.push_back(DEFAULT_DOUBLE_VAL); - seg2D_phi_vDrift.push_back(DEFAULT_DOUBLE_VAL); - seg2D_phi_normChi2.push_back(DEFAULT_DOUBLE_VAL_POS); - seg2D_phi_nHits.push_back(0); + fillHits(segment4D->phiSegment(), geomDet); } if (hasZed) { - const auto* zSeg = segment4D->zSegment(); - - seg2D_z_normChi2.push_back(zSeg->chi2() / zSeg->degreesOfFreedom()); - seg2D_z_nHits.push_back(zSeg->specificRecHits().size()); - - fillHits(zSeg, geomDet); - } else { - seg2D_z_normChi2.push_back(DEFAULT_DOUBLE_VAL_POS); - seg2D_z_nHits.push_back(0); + fillHits(segment4D->zSegment(), geomDet); } seg2D_hits_end.push_back(seg2D_hits_pos.size()); @@ -322,29 +248,10 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { } } - auto table = std::make_unique(nSegments, m_label, false, false); + auto table = std::make_unique(nSegments, m_name, false, true); table->setDoc("DT segment information"); - addColumn(table, "wheel", seg4D_wheel, "wheel - [-2:2] range"); - addColumn(table, - "sector", - seg4D_sector, - "sector - [1:14] range" - "
sector 13 used for the second MB4 of sector 4" - "
sector 14 used for the second MB4 of sector 10"); - addColumn(table, "station", seg4D_station, "station - [1:4] range"); - - addColumn(table, "hasPhi", seg4D_hasPhi, "has segment phi view - 0/1 = no/yes"); - addColumn(table, "hasZed", seg4D_hasZed, "has segment zed view - 0/1 = no/yes"); - - addColumn(table, "seg4D_posLoc_x", seg4D_posLoc_x, "position x in local coordinates - cm"); - addColumn(table, "seg4D_posLoc_y", seg4D_posLoc_y, "position y in local coordinates - cm"); - addColumn(table, "seg4D_posLoc_z", seg4D_posLoc_z, "position z in local coordinates - cm"); - addColumn(table, "seg4D_dirLoc_x", seg4D_dirLoc_x, "direction x in local coordinates"); - addColumn(table, "seg4D_dirLoc_y", seg4D_dirLoc_y, "direction y in local coordinates"); - addColumn(table, "seg4D_dirLoc_z", seg4D_dirLoc_z, "direction z in local coordinates"); - addColumn(table, "seg4D_posLoc_x_SL1", seg4D_posLoc_x_SL1, "position x at SL1 in local coordinates - cm"); addColumn(table, "seg4D_posLoc_x_SL3", seg4D_posLoc_x_SL3, "position x at SL3 in local coordinates - cm"); addColumn(table, @@ -352,45 +259,35 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { seg4D_posLoc_x_midPlane, "position x at SL1 - SL3 mid plane in local coordinates - cm"); - addColumn(table, "seg4D_posGlb_phi", seg4D_posGlb_phi, "position phi in global coordinates - radians [-pi:pi]"); - addColumn(table, "seg4D_posGlb_eta", seg4D_posGlb_eta, "position eta in global coordinates"); - addColumn(table, "seg4D_dirGlb_phi", seg4D_dirGlb_phi, "direction phi in global coordinates - radians [-pi:pi]"); - addColumn(table, "seg4D_dirGlb_eta", seg4D_dirGlb_eta, "direction eta in global coordinates"); - - addColumn(table, "seg2D_phi_t0", seg2D_phi_t0, "t0 from segments with phi view - ns"); - - addColumn(table, "seg2D_phi_vDrift", seg2D_phi_vDrift, "v_drift from segments with phi view"); - addColumn(table, "seg2D_phi_normChi2", seg2D_phi_normChi2, "chi2/n.d.o.f. from segments with phi view"); - addColumn(table, "seg2D_phi_nHits", seg2D_phi_nHits, "# hits in phi view - [0:8] range"); + addColumn(table, "seg2D_hits_begin", seg2D_hits_begin, "begin() of range of quantities in the *_hits_* vectors"); + addColumn(table, "seg2D_hits_end", seg2D_hits_end, "end() of range of quantities in the *_hits_* vectors"); - addColumn(table, "seg2D_z_normChi2", seg2D_z_normChi2, "chi2/n.d.o.f. from segments with z view"); - addColumn(table, "seg2D_z_nHits", seg2D_z_nHits, "# hits in z view - [0:4] range"); - - addColumn(table, "seg2D_hits_begin", seg2D_hits_begin, "begin of range of quantities in the hits_* vectors"); - addColumn(table, "seg2D_hits_end", seg2D_hits_end, "end of range of quantities in the hits_* vectors"); - - addColumn(table, "seg4D_extr_begin", seg4D_extr_begin, "begin of range of quantities in the extr_* vectors"); - addColumn(table, "seg4D_extr_end", seg4D_extr_end, "end of range of quantities in the extr_* vectors"); + addColumn(table, "seg4D_extr_begin", seg4D_extr_begin, "begin() of range of quantities in the *_extr_* vectors"); + addColumn(table, "seg4D_extr_end", seg4D_extr_end, "end() of range of quantities in the *_extr_* vectors"); ev.put(std::move(table)); if (m_fillHits) { - auto tabHits = std::make_unique(nHits, m_label + "_hits", false, false); + auto tabHits = std::make_unique(nHits, m_name + "_hits", false, false); - tabHits->setDoc("Size of DT segment hits_* vectors"); + tabHits->setDoc("Size of DT segment *_hits_* vectors"); - addColumn(tabHits, "pos", seg2D_hits_pos, "local position of a hit in layer local coordinates - x coordinate"); - addColumn( - tabHits, "posCh", seg2D_hits_posCh, "local position of a hit in chamber local coordinates - x coordinate"); + addColumn(tabHits, "pos", seg2D_hits_pos, "local x position of a hit in layer local coordinates"); + addColumn(tabHits, "posCh", seg2D_hits_posCh, "local x position of a hit in chamber local coordinates"); addColumn(tabHits, "posErr", seg2D_hits_posErr, "local position error of a hit in layer local coordinates - xx component of error matrix"); addColumn(tabHits, "side", seg2D_hits_side, "is hit on L/R side of a cell wire - 1/2 is R/L"); - addColumn(tabHits, "wire", seg2D_hits_wire, "hit wire number - range [1:X] X"); - addColumn(tabHits, "wirePos", seg2D_hits_wirePos, "hit wire position in layer local coordinates - x coordinate"); + addColumn(tabHits, "wire", seg2D_hits_wire, "hit wire number - range depends on chamber size"); + addColumn(tabHits, "wirePos", seg2D_hits_wirePos, "hit wire x position in layer local coordinates"); addColumn(tabHits, "layer", seg2D_hits_layer, "hit layer number - range [1:4]"); - addColumn(tabHits, "superLayer", seg2D_hits_superLayer, "hit SL number - [1 or 3] the two phi SLs"); + addColumn(tabHits, + "superLayer", + seg2D_hits_superLayer, + "hit superlayer - [1:3] range" + "
SL 1 and 3 are phi SLs" + "
SL 2 is theta SL"); addColumn(tabHits, "time", seg2D_hits_time, "digi time - ns, pedestal not subtracted"); addColumn(tabHits, "timeCali", seg2D_hits_timeCali, "digi time - ns, pedestal subtracted"); @@ -398,9 +295,9 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { } if (m_fillExtr) { - auto tabExtr = std::make_unique(nExtr, m_label + "_extr", false, false); + auto tabExtr = std::make_unique(nExtr, m_name + "_extr", false, false); - tabExtr->setDoc("Size of DT segment extr_* vectors"); + tabExtr->setDoc("Size of DT segment *_extr_* vectors"); addColumn(tabExtr, "ExpPos", seg4D_hitsExpPos, @@ -426,4 +323,4 @@ void MuNtupleDTSegmentFiller::fill(edm::Event& ev) { #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(MuNtupleDTSegmentFiller); +DEFINE_FWK_MODULE(MuDTSegmentExtTableProducer); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.h b/DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.h similarity index 60% rename from DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.h rename to DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.h index 8e14b2a078842..4cdfeca39eec9 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleDTSegmentFiller.h +++ b/DPGAnalysis/MuonTools/plugins/MuDTSegmentExtTableProducer.h @@ -1,16 +1,16 @@ -#ifndef MuNtuple_MuNtupleDTSegmentFiller_h -#define MuNtuple_MuNtupleDTSegmentFiller_h +#ifndef MuNtuple_MuDTSegmentExtTableProducer_h +#define MuNtuple_MuDTSegmentExtTableProducer_h -/** \class MuNtupleDTSegmentFiller MuNtupleDTSegmentFiller.h DPGAnalysis/MuonTools/src/MuNtupleDTSegmentFiller.h +/** \class MuDTSegmentExtTableProducer MuDTSegmentExtTableProducer.h DPGAnalysis/MuonTools/src/MuDTSegmentExtTableProducer.h * - * Helper class : the segment filler for Phase-1 / Phase2 DT segments (the DataFormat is the same) + * Helper class : the segment TableProducer for Phase-1 / Phase2 DT segments (the DataFormat is the same) * * \author C. Battilana (INFN BO) * * */ -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" +#include "DPGAnalysis/MuonTools/src/MuBaseFlatTableProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -24,25 +24,28 @@ #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" -class MuNtupleDTSegmentFiller : public MuNtupleBaseFiller { +class MuDTSegmentExtTableProducer : public MuBaseFlatTableProducer { public: /// Constructor - MuNtupleDTSegmentFiller(const edm::ParameterSet &); + MuDTSegmentExtTableProducer(const edm::ParameterSet &); /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions &); protected: /// Fill tree branches for a given event - void fill(edm::Event &ev) final; + void fillTable(edm::Event &) final; /// Get info from the ES by run - void getFromES(const edm::Run &run, const edm::EventSetup &environment) final; + void getFromES(const edm::Run &, const edm::EventSetup &) final; /// Get info from the ES for a given event - void getFromES(const edm::EventSetup &environment) final; + void getFromES(const edm::EventSetup &) final; private: + static const int FIRST_LAYER{1}; + static const int LAST_LAYER{4}; + static const int THETA_SL{2}; /// The segment token nano_mu::EDTokenHandle m_token; diff --git a/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.cc b/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.cc index ef9f1f70f63ac..6dec63f708aad 100644 --- a/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.cc +++ b/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.cc @@ -88,7 +88,7 @@ void MuDTTPGPhiFlatTableProducer::fillTable(edm::Event& ev) { auto table = std::make_unique(nTrigs, m_name, false, false); - table->setDoc("DT trigger primitive information (phi view)"); + table->setDoc("Barrel trigger primitive information (phi view)"); addColumn(table, "wheel", wheel, "wheel - [-2:2] range"); addColumn(table, diff --git a/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.h b/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.h index b825631ba1ecf..73162df9f154b 100644 --- a/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.h +++ b/DPGAnalysis/MuonTools/plugins/MuDTTPGPhiFlatTableProducer.h @@ -46,7 +46,7 @@ class MuDTTPGPhiFlatTableProducer : public MuBaseFlatTableProducer { nano_mu::DTTrigGeomUtils m_trigGeomUtils; /// Helper function translating config parameter into TriggerTag - TriggerTag getTag(const edm::ParameterSet& config); + TriggerTag getTag(const edm::ParameterSet&); }; #endif diff --git a/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.cc b/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.cc index 9f6a1e7b7b2bb..345af11ee8e82 100644 --- a/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.cc +++ b/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.cc @@ -74,7 +74,7 @@ void MuDTTPGThetaFlatTableProducer::fillTable(edm::Event& ev) { auto table = std::make_unique(nTrigs, m_name, false, false); - table->setDoc("DT trigger primitive information (theta view)"); + table->setDoc("Barrel trigger primitive information (theta view)"); addColumn(table, "wheel", wheel, "wheel - [-2:2] range"); addColumn(table, diff --git a/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.h b/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.h index dee3aac832607..b28f724915f03 100644 --- a/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.h +++ b/DPGAnalysis/MuonTools/plugins/MuDTTPGThetaFlatTableProducer.h @@ -40,7 +40,7 @@ class MuDTTPGThetaFlatTableProducer : public MuBaseFlatTableProducer { nano_mu::EDTokenHandle m_token; /// Helper function translating config parameter into TriggerTag - TriggerTag getTag(const edm::ParameterSet& config); + TriggerTag getTag(const edm::ParameterSet&); }; #endif diff --git a/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc b/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc index 33c0b58b0c643..53b10ed9b2d2b 100644 --- a/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc +++ b/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc @@ -10,28 +10,28 @@ #include "DPGAnalysis/MuonTools/src/MuDigiBaseProducer.h" #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" -using CSCWireDigiFlatTableProducer = MuDigiBaseProducer; +using CSCWireDigiFlatTableProducer = MuDigiBaseProducer; #include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" -using CSCALCTDigiFlatTableProducer = MuDigiBaseProducer; +using CSCAlctDigiFlatTableProducer = MuDigiBaseProducer; #include "DataFormats/DTDigi/interface/DTDigiCollection.h" -using DTDigiFlatTableProducer = MuDigiBaseProducer; +using DTDigiFlatTableProducer = MuDigiBaseProducer; #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" -using RPCDigiFlatTableProducer = MuDigiBaseProducer; +using RPCDigiFlatTableProducer = MuDigiBaseProducer; #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" -using GEMDigiFlatTableProducer = MuDigiBaseProducer; +using GEMDigiFlatTableProducer = MuDigiBaseProducer; #include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h" -using GEMOHStatusFlatTableProducer = MuDigiBaseProducer; +using GEMOHStatusFlatTableProducer = MuDigiBaseProducer; #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(CSCWireDigiFlatTableProducer); -DEFINE_FWK_MODULE(CSCALCTDigiFlatTableProducer); +DEFINE_FWK_MODULE(CSCAlctDigiFlatTableProducer); DEFINE_FWK_MODULE(DTDigiFlatTableProducer); DEFINE_FWK_MODULE(RPCDigiFlatTableProducer); DEFINE_FWK_MODULE(GEMDigiFlatTableProducer); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.cc b/DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.cc similarity index 82% rename from DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.cc rename to DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.cc index 45badbf846b9b..70380c0feff15 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.cc +++ b/DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.cc @@ -1,4 +1,4 @@ -#include "DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.h" +#include "DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.h" #include "DataFormats/MuonDetId/interface/MuonSubdetId.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" @@ -9,9 +9,9 @@ #include -MuNtupleGEMMuonFiller::MuNtupleGEMMuonFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller{config}, - m_token{config, consumesCollector(), "muonToken"}, +MuGEMMuonExtTableProducer::MuGEMMuonExtTableProducer(const edm::ParameterSet& config) + : MuBaseFlatTableProducer{config}, + m_token{config, consumesCollector(), "src"}, m_fillPropagated{config.getParameter("fillPropagated")}, m_gemGeometry{consumesCollector()}, m_transientTrackBuilder{consumesCollector(), "TransientTrackBuilder"}, @@ -24,11 +24,11 @@ MuNtupleGEMMuonFiller::MuNtupleGEMMuonFiller(const edm::ParameterSet& config) } } -void MuNtupleGEMMuonFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void MuGEMMuonExtTableProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("label", "gemMuon"); - desc.add("muonToken", edm::InputTag{"muons"}); + desc.add("name", "muon"); + desc.add("src", edm::InputTag{"muons"}); desc.add("fillPropagated", true); desc.setAllowAnything(); @@ -36,40 +36,21 @@ void MuNtupleGEMMuonFiller::fillDescriptions(edm::ConfigurationDescriptions& des descriptions.addWithDefaultLabel(desc); } -void MuNtupleGEMMuonFiller::getFromES(const edm::Run& run, const edm::EventSetup& environment) { +void MuGEMMuonExtTableProducer::getFromES(const edm::Run& run, const edm::EventSetup& environment) { m_gemGeometry.getFromES(environment); } -void MuNtupleGEMMuonFiller::getFromES(const edm::EventSetup& environment) { +void MuGEMMuonExtTableProducer::getFromES(const edm::EventSetup& environment) { m_transientTrackBuilder.getFromES(environment); m_muonSP->update(environment); } -void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { +void MuGEMMuonExtTableProducer::fillTable(edm::Event& ev) { unsigned int nMuons{0}; - std::vector pt; - std::vector phi; - std::vector eta; - std::vector charge; - - std::vector isGlobal; - std::vector isStandalone; - std::vector isTracker; - std::vector isGEM; std::vector isCSC; std::vector isME11; - std::vector isLoose; - std::vector isMedium; - std::vector isTight; - - std::vector numberOfValidPixelHits; - std::vector innerTracker_ValidFraction; - std::vector numberOfValidTrackerHits; - - std::vector trackNormChi2; - std::vector innermost_x; std::vector innermost_y; std::vector innermost_z; @@ -136,29 +117,6 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { if (muons.isValid() && m_transientTrackBuilder.isValid()) { //loop on recoMuons for (const auto& muon : (*muons)) { - pt.push_back(muon.pt()); - eta.push_back(muon.eta()); - phi.push_back(muon.phi()); - charge.push_back(muon.charge()); - - isGlobal.push_back(muon.isGlobalMuon()); - isStandalone.push_back(muon.isStandAloneMuon()); - isTracker.push_back(muon.isTrackerMuon()); - isGEM.push_back(muon.isGEMMuon()); - - isLoose.push_back(muon.passed(reco::Muon::CutBasedIdLoose)); - isMedium.push_back(muon.passed(reco::Muon::CutBasedIdMedium)); - isTight.push_back(muon.passed(reco::Muon::CutBasedIdTight)); - - if (!muon.innerTrack().isNull()) { - numberOfValidPixelHits.push_back(muon.innerTrack()->hitPattern().numberOfValidPixelHits()); - innerTracker_ValidFraction.push_back(muon.innerTrack()->validFraction()); - numberOfValidTrackerHits.push_back(muon.innerTrack()->hitPattern().numberOfValidTrackerHits()); - } else { - numberOfValidPixelHits.push_back(DEFAULT_DOUBLE_VAL); - innerTracker_ValidFraction.push_back(DEFAULT_DOUBLE_VAL); - numberOfValidTrackerHits.push_back(DEFAULT_DOUBLE_VAL); - } ++nMuons; bool is_csc = false; @@ -186,16 +144,16 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { const auto& htp = transient_track.hitPattern(); if (transient_track.isValid()) { - trackNormChi2.push_back(transient_track.normalizedChi2()); - innermost_x.push_back(transient_track.innermostMeasurementState().globalPosition().x()); - innermost_y.push_back(transient_track.innermostMeasurementState().globalPosition().y()); - innermost_z.push_back(transient_track.innermostMeasurementState().globalPosition().z()); - outermost_x.push_back(transient_track.outermostMeasurementState().globalPosition().x()); - outermost_y.push_back(transient_track.outermostMeasurementState().globalPosition().y()); - outermost_z.push_back(transient_track.outermostMeasurementState().globalPosition().z()); - + const auto innerPosGlb{transient_track.innermostMeasurementState().globalPosition()}; + const auto outerPosGlb{transient_track.outermostMeasurementState().globalPosition()}; + + innermost_x.push_back(innerPosGlb.x()); + innermost_y.push_back(innerPosGlb.y()); + innermost_z.push_back(innerPosGlb.z()); + outermost_x.push_back(outerPosGlb.x()); + outermost_y.push_back(outerPosGlb.y()); + outermost_z.push_back(outerPosGlb.z()); } else { - trackNormChi2.push_back(DEFAULT_DOUBLE_VAL); innermost_x.push_back(DEFAULT_DOUBLE_VAL); innermost_y.push_back(DEFAULT_DOUBLE_VAL); innermost_z.push_back(DEFAULT_DOUBLE_VAL); @@ -312,12 +270,14 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { propagated_nME3hits.push_back(nME3_hits); propagated_nME4hits.push_back(nME4_hits); - propagated_EtaPartition_centerX.push_back(eta_partition->position().x()); - propagated_EtaPartition_centerY.push_back(eta_partition->position().y()); - propagated_EtaPartition_rMin.push_back(eta_partition->surface().rSpan().first); - propagated_EtaPartition_rMax.push_back(eta_partition->surface().rSpan().second); - propagated_EtaPartition_phiMin.push_back(eta_partition->surface().phiSpan().first); - propagated_EtaPartition_phiMax.push_back(eta_partition->surface().phiSpan().second); + const auto eta_partition_pos{eta_partition->position()}; + const auto eta_partition_surf{eta_partition->surface()}; + propagated_EtaPartition_centerX.push_back(eta_partition_pos.x()); + propagated_EtaPartition_centerY.push_back(eta_partition_pos.y()); + propagated_EtaPartition_rMin.push_back(eta_partition_surf.rSpan().first); + propagated_EtaPartition_rMax.push_back(eta_partition_surf.rSpan().second); + propagated_EtaPartition_phiMin.push_back(eta_partition_surf.phiSpan().first); + propagated_EtaPartition_phiMax.push_back(eta_partition_surf.phiSpan().second); propagatedGlb_x.push_back(dest_global_pos.x()); propagatedGlb_y.push_back(dest_global_pos.y()); @@ -325,14 +285,15 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { propagatedGlb_r.push_back(dest_global_pos.perp()); propagatedGlb_phi.push_back(dest_global_pos.phi()); + const auto dest_local_dir{dest_state.localDirection()}; propagatedLoc_x.push_back(dest_local_pos.x()); propagatedLoc_y.push_back(dest_local_pos.y()); propagatedLoc_z.push_back(dest_local_pos.z()); propagatedLoc_r.push_back(dest_local_pos.perp()); propagatedLoc_phi.push_back(dest_local_pos.phi()); - propagatedLoc_dirX.push_back(dest_state.localDirection().x()); - propagatedLoc_dirY.push_back(dest_state.localDirection().y()); - propagatedLoc_dirZ.push_back(dest_state.localDirection().z()); + propagatedLoc_dirX.push_back(dest_local_dir.x()); + propagatedLoc_dirY.push_back(dest_local_dir.y()); + propagatedLoc_dirZ.push_back(dest_local_dir.z()); propagatedLoc_errX.push_back(dest_local_err.xx()); propagatedLoc_errY.push_back(dest_local_err.yy()); @@ -354,7 +315,6 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { } //loop on EtaPartitions } //is_csc therefore perform propagation } else { //!muon.outerTrack().isNull() - trackNormChi2.push_back(DEFAULT_DOUBLE_VAL); innermost_x.push_back(DEFAULT_DOUBLE_VAL); innermost_y.push_back(DEFAULT_DOUBLE_VAL); innermost_z.push_back(DEFAULT_DOUBLE_VAL); @@ -368,31 +328,9 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { } //loop on reco muons } - auto table = std::make_unique(nMuons, m_label, false, false); - - table->setDoc("RECO muon information (GEM specific object)"); - - addColumn(table, "pt", pt, ""); - addColumn(table, "phi", phi, ""); - addColumn(table, "eta", eta, ""); - addColumn(table, "charge", charge, ""); - - addColumn(table, "isGlobal", isGlobal, ""); - addColumn(table, "isStandalone", isStandalone, ""); - addColumn(table, "isTracker", isTracker, ""); - addColumn(table, "isGEM", isGEM, ""); - addColumn(table, "isCSC", isCSC, ""); - addColumn(table, "isME11", isME11, ""); - - addColumn(table, "isLoose", isLoose, ""); - addColumn(table, "isMedium", isMedium, ""); - addColumn(table, "isTight", isTight, ""); - - addColumn(table, "numberOfValidPixelHits", numberOfValidPixelHits, ""); - addColumn(table, "innerTracker_ValidFraction", innerTracker_ValidFraction, ""); - addColumn(table, "numberOfValidTrackerHits", numberOfValidTrackerHits, ""); + auto table = std::make_unique(nMuons, m_name, false, true); - addColumn(table, "trackNormChi2", trackNormChi2, ""); + //table->setDoc("RECO muon information"); addColumn(table, "innermost_x", innermost_x, ""); addColumn(table, "innermost_y", innermost_y, ""); @@ -404,7 +342,7 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { ev.put(std::move(table)); if (m_fillPropagated) { - auto tabProp = std::make_unique(nProp, m_label + "_propagated", false, false); + auto tabProp = std::make_unique(nProp, m_name + "_propagated", false, false); addColumn(tabProp, "propagated_muIdx", propagated_muIdx, ""); @@ -597,4 +535,4 @@ void MuNtupleGEMMuonFiller::fill(edm::Event& ev) { #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(MuNtupleGEMMuonFiller); +DEFINE_FWK_MODULE(MuGEMMuonExtTableProducer); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.h b/DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.h similarity index 70% rename from DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.h rename to DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.h index b69d9656869cb..dd18a6f8ea468 100644 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMMuonFiller.h +++ b/DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.h @@ -1,7 +1,7 @@ -#ifndef MuNtuple_MuNtupleGEMMuonFiller_h -#define MuNtuple_MuNtupleGEMMuonFiller_h +#ifndef MuNtuple_MuGEMMuonExtTableProducer_h +#define MuNtuple_MuGEMMuonExtTableProducer_h -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" +#include "DPGAnalysis/MuonTools/src/MuBaseFlatTableProducer.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -17,23 +17,23 @@ #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" -class MuNtupleGEMMuonFiller : public MuNtupleBaseFiller { +class MuGEMMuonExtTableProducer : public MuBaseFlatTableProducer { public: /// Constructor - MuNtupleGEMMuonFiller(const edm::ParameterSet &); + MuGEMMuonExtTableProducer(const edm::ParameterSet &); /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); + static void fillDescriptions(edm::ConfigurationDescriptions &); protected: /// Fill tree branches for a given event - void fill(edm::Event &ev) final; + void fillTable(edm::Event &) final; /// Get info from the ES by run - void getFromES(const edm::Run &run, const edm::EventSetup &environment) final; + void getFromES(const edm::Run &, const edm::EventSetup &) final; /// Get info from the ES for a given event - void getFromES(const edm::EventSetup &environment) final; + void getFromES(const edm::EventSetup &) final; private: /// The RECO mu token diff --git a/DPGAnalysis/MuonTools/plugins/MuRecoTableProducers.cc b/DPGAnalysis/MuonTools/plugins/MuLocalRecoFlatTableProducers.cc similarity index 96% rename from DPGAnalysis/MuonTools/plugins/MuRecoTableProducers.cc rename to DPGAnalysis/MuonTools/plugins/MuLocalRecoFlatTableProducers.cc index 5ed3f01ef38bf..58662979f2261 100644 --- a/DPGAnalysis/MuonTools/plugins/MuRecoTableProducers.cc +++ b/DPGAnalysis/MuonTools/plugins/MuLocalRecoFlatTableProducers.cc @@ -7,7 +7,7 @@ * */ -#include "DPGAnalysis/MuonTools/src/MuRecObjBaseProducer.h" +#include "DPGAnalysis/MuonTools/src/MuLocalRecoBaseProducer.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.cc deleted file mode 100644 index 15cc09dd7d2b9..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.cc +++ /dev/null @@ -1,175 +0,0 @@ -/** \class MuNtupleBmtfFiller MuNtupleBmtfFiller.cc DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.cc - * - * Helper class : the BMTF filler - * - * \author L. Borgonovi (INFN BO) - * - * - */ - -#include "DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.h" - -#include - -MuNtupleBmtfFiller::MuNtupleBmtfFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), - m_tpgPhiToken{config, consumesCollector(), "dtTpTag"}, - m_bmtfToken{config, consumesCollector(), "bmtfTag"} { - produces(); -} - -void MuNtupleBmtfFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "l1tBmtfOut"); - desc.add("dtTpTag", edm::InputTag{"bmtfDigis"}); - desc.add("bmtfTag", edm::InputTag{"bmtfDigis"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleBmtfFiller::fill(edm::Event& ev) { - unsigned int nBmtfCands{0}; - - std::vector wheel; - std::vector sector; - - std::vector pt; - std::vector phi; - std::vector eta; - std::vector bx; - std::vector dxy; - std::vector qual; - std::vector etaFine; - - std::vector matchedTpIdxMB1; - std::vector matchedTpIdxMB2; - std::vector matchedTpIdxMB3; - std::vector matchedTpIdxMB4; - - auto bmtfColl = m_bmtfToken.conditionalGet(ev); - auto tpColl = m_tpgPhiToken.conditionalGet(ev); - - if (bmtfColl.isValid()) { - auto bmtfCandBX = bmtfColl->getFirstBX(); - auto bmtfCandLastBX = bmtfColl->getLastBX(); - - for (; bmtfCandBX <= bmtfCandLastBX; ++bmtfCandBX) { - auto bmtfCand = bmtfColl->begin(bmtfCandBX); - auto bmtfCandLast = bmtfColl->end(bmtfCandBX); - - for (; bmtfCand != bmtfCandLast; ++bmtfCand) { - std::map mapTA = bmtfCand->trackAddress(); - - int wsign = mapTA[0] == 0 ? 1 : -1; - int wh = wsign * mapTA[1]; - int sec = bmtfCand->processor(); - - wheel.push_back(wh); - sector.push_back(sec); - - std::array ts_mb{{DEFAULT_INT_VAL, DEFAULT_INT_VAL, DEFAULT_INT_VAL, DEFAULT_INT_VAL}}; - std::array w_mb{{DEFAULT_INT_VAL, DEFAULT_INT_VAL, DEFAULT_INT_VAL, DEFAULT_INT_VAL}}; - std::array s_mb{{DEFAULT_INT_VAL, DEFAULT_INT_VAL, DEFAULT_INT_VAL, DEFAULT_INT_VAL}}; - - std::array triggerIndex{{0, 0, 0, 0}}; - - if (mapTA[2] != 3) { - w_mb[0] = wh; - s_mb[0] = sec; - ts_mb[0] = (mapTA[2] & 1) ? 1 : 0; - } - - for (int iSt = 1; iSt <= N_STAT; ++iSt) { - if (mapTA[iSt + 2] != 15) { - ts_mb[iSt] = (mapTA[iSt + 2] & 1) ? 1 : 0; // 0 for ts1 , 1 for ts2 - w_mb[iSt] = - (mapTA[iSt + 2] & 8) - ? wh - : wh + - wsign; // own wheel if true, nex wheel if false (depends on sign of the wheel -> case 0+, +1: +1, case 0-, -1: -1) - int tmpMapValue = mapTA[iSt + 2] >> 1; // temp value to remove less significant bit - if (tmpMapValue & 1) - s_mb[iSt] = - sec != 0 ? sec - 1 : 11; // if last two remained bit == 01 -> sector-1 (N+1 column of ref table) - else if (tmpMapValue & 2) - s_mb[iSt] = - sec != 11 ? sec + 1 : 0; // if last two remained bit == 10 -> sector+1 (N-1 column of ref table) - else - s_mb[iSt] = sec; // if last two remained bit == 00 -> sector (N column of ref table) - } - } - - int tmpIdx = 0; - - for (int iSt = 0; iSt < N_STAT; ++iSt) { - int iTP = 0; - - if (tpColl.isValid()) { - const auto trigs = tpColl->getContainer(); - - for (const auto& trig : (*trigs)) { - if (trig.code() != 7) { - if (bmtfCandBX == trig.bxNum()) { - if ((w_mb[iSt] == trig.whNum()) && (ts_mb[iSt] == trig.Ts2Tag()) && (s_mb[iSt] == trig.scNum()) && - (iSt + 1 == trig.stNum())) { - triggerIndex[tmpIdx] = iTP; - tmpIdx++; - } - } - } - - iTP++; - } - } - } - - int iPhi = bmtfCand->hwPhi() + bmtfCand->processor() * 48 - 15; - if (iPhi < 0) - iPhi += 576; - - bx.push_back(bmtfCandBX); - pt.push_back((bmtfCand->hwPt()) * PT_SCALE); - phi.push_back(iPhi * PHI_SCALE); //no conversion yet - eta.push_back((bmtfCand->hwEta()) * ETA_SCALE); - dxy.push_back(bmtfCand->hwDXY()); - qual.push_back(bmtfCand->hwQual()); - etaFine.push_back(bmtfCand->hwHF()); - - matchedTpIdxMB1.push_back(triggerIndex[0]); - matchedTpIdxMB2.push_back(triggerIndex[1]); - matchedTpIdxMB3.push_back(triggerIndex[2]); - matchedTpIdxMB4.push_back(triggerIndex[3]); - - ++nBmtfCands; - } - } - } - - auto table = std::make_unique(nBmtfCands, m_label, false, false); - - table->setDoc("BMTF information"); - - addColumn(table, "pt", pt, "BMTF cand pt - GeV/c "); - addColumn(table, "phi", phi, "BMTF cand phi - rad"); - addColumn(table, "eta", eta, "BMTF cand eta"); - - addColumn(table, "wheel", pt, "BMTF cand wheel"); - addColumn(table, "sector ", pt, "BMTF cand sector"); - - addColumn(table, "dxy", dxy, "BMTF cand dxy - units?"); - addColumn(table, "qual", qual, "BMTF cand quality"); - addColumn(table, "etaFine", etaFine, "BMTF cand fine eta bit"); - - addColumn(table, "matchedTpIdxMB1", matchedTpIdxMB1, "BMTF link to TP index (MB1)"); - addColumn(table, "matchedTpIdxMB2", matchedTpIdxMB2, "BMTF link to TP index (MB2)"); - addColumn(table, "matchedTpIdxMB3", matchedTpIdxMB3, "BMTF link to TP index (MB3)"); - addColumn(table, "matchedTpIdxMB4", matchedTpIdxMB4, "BMTF link to TP index (MB4)"); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleBmtfFiller); \ No newline at end of file diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.h deleted file mode 100644 index 7772baacc8db4..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef MuNtuple_MuNtupleBmtfFiller_h -#define MuNtuple_MuNtupleBmtfFiller_h - -/** \class MuNtupleBmtfFiller MuNtupleBmtfFiller.h DPGAnalysis/MuonTools/plugins/MuNtupleBmtfFiller.h - * - * Helper class : the BMTF filler - * - * \author L. Borgonovi (INFN BO) - * - * - */ - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h" -#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h" - -class MuNtupleBmtfFiller : public MuNtupleBaseFiller { -public: - /// Constructor - MuNtupleBmtfFiller(const edm::ParameterSet &); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions &); - -protected: - /// Fill tree branches for a given events - void fill(edm::Event &) final; - -private: - /// Scale to convert HW pt to GeV - static constexpr double PT_SCALE{0.5}; - - /// Scale to convert HW eta to phisical value - static constexpr double ETA_SCALE{0.010875}; - - /// Scale to convert HW eta to rad - static constexpr double PHI_SCALE{0.010908308}; // 2 * pi / 576 - - /// Number of DT stations - static constexpr int N_STAT{4}; - - /// The trigger tokens - nano_mu::EDTokenHandle m_tpgPhiToken; - nano_mu::EDTokenHandle m_bmtfToken; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.cc deleted file mode 100644 index e75a46a195bd4..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.cc +++ /dev/null @@ -1,89 +0,0 @@ -/** \class MuDPGAnalysis/MuonDPGNtuples/plugins/MuNtupleCSCALCTDigiFiller.cc - * - * Helper class : the digi filler for CSC ALCT digis - * (used in ZeroBias Analysis for Background Studies) - * - * \author P. Verwilligen (INFN BA) - * - * - */ - -#include "DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.h" - -MuNtupleCSCALCTDigiFiller::MuNtupleCSCALCTDigiFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller{config}, m_token{config, consumesCollector(), "cscALCTDigiTag"} { - produces(); -} - -void MuNtupleCSCALCTDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "cscALCTDigis"); - desc.add("cscALCTDigiTag", edm::InputTag{"muonCSCDigis", "MuonCSCALCTDigi"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleCSCALCTDigiFiller::fill(edm::Event& ev) { - unsigned int nDigis{0}; - - std::vector endcap; - std::vector station; - std::vector ring; - std::vector chamber; - std::vector layer; - std::vector valid; - std::vector quality; - std::vector accelbit; - std::vector colpattb; - std::vector keywiregroup; - std::vector alctbx; - - auto cscALCTDigis = m_token.conditionalGet(ev); - - if (cscALCTDigis.isValid()) { - auto cscDetIdIt = cscALCTDigis->begin(); - auto cscDetIdEnd = cscALCTDigis->end(); - - for (; cscDetIdIt != cscDetIdEnd; ++cscDetIdIt) { - const auto& [cscDetId, range] = (*cscDetIdIt); - - for (auto digi = range.first; digi != range.second; ++digi) { - endcap.push_back(cscDetId.endcap()); - station.push_back(cscDetId.station()); - ring.push_back(cscDetId.ring()); - chamber.push_back(cscDetId.chamber()); - layer.push_back(cscDetId.layer()); - keywiregroup.push_back(digi->getKeyWG()); // Fundamental - valid.push_back(digi->isValid()); // Interesting for future study ... can be dropped - quality.push_back(digi->getQuality()); // Interesting for future study ... can be dropped - accelbit.push_back(digi->getAccelerator()); // Interesting for future study ... can be dropped - colpattb.push_back(digi->getCollisionB()); // Interesting for future study ... can be dropped - alctbx.push_back(digi->getBX()); // should keep this for redundancy ??? - - ++nDigis; - } - } - } - - auto table = std::make_unique(nDigis, m_label, false, false); // CB check those falses - - addColumn(table, "endcap", endcap, ""); // CB has to be documented - addColumn(table, "station", station, ""); // CB has to be documented - addColumn(table, "ring", ring, ""); // CB has to be documented - addColumn(table, "chamber", chamber, ""); // CB has to be documented - addColumn(table, "layer", layer, ""); // CB has to be documented - addColumn(table, "keywiregroup", keywiregroup, ""); // CB has to be documented - addColumn(table, "valid", valid, ""); // CB has to be documented - addColumn(table, "quality", quality, ""); // CB has to be documented - addColumn(table, "accelerator", accelbit, ""); // CB has to be documented - addColumn(table, "patternB", colpattb, ""); // CB has to be documented - addColumn(table, "alctbx", alctbx, ""); // CB has to be documented - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleCSCALCTDigiFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.h deleted file mode 100644 index 4da9c39af25c9..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCALCTDigiFiller.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef MuNtuple_MuNtupleCSCALCTDigiFiller_h -#define MuNtuple_MuNtupleCSCALCTDigiFiller_h - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/CSCDigi/interface/CSCALCTDigiCollection.h" - -class MuNtupleCSCALCTDigiFiller : public MuNtupleBaseFiller { -public: - //Constructor - MuNtupleCSCALCTDigiFiller(const edm::ParameterSet&); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions&); - -protected: - /// Fill tree branches for a given events - virtual void fill(edm::Event&) final; - -private: - /// The digi token - nano_mu::EDTokenHandle m_token; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.cc deleted file mode 100644 index 71365b07330af..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.cc +++ /dev/null @@ -1,80 +0,0 @@ -/** \class MuDPGAnalysis/MuonDPGNtuples/plugins/MuNtupleCSCWireDigiFiller.cc - * - * Helper class : the digi filler for CSC Wire digis - * (used in ZeroBias Analysis for Background Studies) - * - * \author P. Verwilligen (INFN BA) - * - * - */ - -#include "DPGAnalysis/MuonTools//plugins/MuNtupleCSCWireDigiFiller.h" - -MuNtupleCSCWireDigiFiller::MuNtupleCSCWireDigiFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller{config}, m_token{config, consumesCollector(), "cscWireDigiTag"} { - produces(); -} - -void MuNtupleCSCWireDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "cscWireDigis"); - desc.add("cscWireDigiTag", edm::InputTag{"muonCSCDigis", "MuonCSCWireDigi"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleCSCWireDigiFiller::fill(edm::Event& ev) { - unsigned int nDigis{0}; - - std::vector endcap; - std::vector station; - std::vector ring; - std::vector chamber; - std::vector layer; - std::vector wiregroup; - std::vector wgtimebin; - std::vector wgbx; - - auto cscWireDigis = m_token.conditionalGet(ev); - - if (cscWireDigis.isValid()) { - auto cscDetIdIt = cscWireDigis->begin(); - auto cscDetIdEnd = cscWireDigis->end(); - - for (; cscDetIdIt != cscDetIdEnd; ++cscDetIdIt) { - const auto& [cscDetId, range] = (*cscDetIdIt); - - for (auto digi = range.first; digi != range.second; ++digi) { - endcap.push_back(cscDetId.endcap()); - station.push_back(cscDetId.station()); - ring.push_back(cscDetId.ring()); - chamber.push_back(cscDetId.chamber()); - layer.push_back(cscDetId.layer()); - wiregroup.push_back(digi->getWireGroup()); - wgtimebin.push_back(digi->getTimeBin()); - wgbx.push_back(digi->getWireGroupBX()); - - ++nDigis; - } - } - } - - auto table = std::make_unique(nDigis, m_label, false, false); // CB check those falses - - addColumn(table, "endcap", endcap, ""); // CB has to be documented - addColumn(table, "station", station, ""); // CB has to be documented - addColumn(table, "ring", ring, ""); // CB has to be documented - addColumn(table, "chamber", chamber, ""); // CB has to be documented - addColumn(table, "layer", layer, ""); // CB has to be documented - addColumn(table, "wiregroup", wiregroup, ""); // CB has to be documented - addColumn(table, "wiregrouptimebin", wgtimebin, ""); // CB has to be documented - addColumn(table, "wiregroupbx", wgbx, ""); // CB has to be documented - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleCSCWireDigiFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.h deleted file mode 100644 index 3f588702fd0e5..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleCSCWireDigiFiller.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef MuNtuple_MuNtupleCSCWireDigiFiller_h -#define MuNtuple_MuNtupleCSCWireDigiFiller_h - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" - -class MuNtupleCSCWireDigiFiller : public MuNtupleBaseFiller { -public: - //Constructor - MuNtupleCSCWireDigiFiller(const edm::ParameterSet&); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions&); - -protected: - /// Fill tree branches for a given events - virtual void fill(edm::Event&) final; - -private: - /// The digi token - nano_mu::EDTokenHandle m_token; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.cc deleted file mode 100644 index 9ca13cc2056c2..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.cc +++ /dev/null @@ -1,98 +0,0 @@ -/** \class MuNtupleDigiFiller MuNtupleDigiFiller.cc DPGAnalysis/MuonTools/src/MuNtupleDTDigiFiller.cc - * - * Helper class : the digi filler for Phase-1 / Phase2 DT digis (the DataFormat is the same) - * - * \author C. Battilana (INFN BO) - * - * - */ - -#include "DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.h" - -#include - -MuNtupleDTDigiFiller::MuNtupleDTDigiFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller{config}, m_token{config, consumesCollector(), "dtDigiTag"} { - produces(); -} - -void MuNtupleDTDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "dtDigis"); - desc.add("dtDigiTag", edm::InputTag{"muonDTDigis"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleDTDigiFiller::fill(edm::Event& ev) { - unsigned int nDigis{0}; - - std::vector wheel; - std::vector sector; - std::vector station; - - std::vector superLayer; - std::vector layer; - std::vector wire; - - std::vector time; - - auto dtDigis = m_token.conditionalGet(ev); - - if (dtDigis.isValid()) { - auto dtLayerIdIt = dtDigis->begin(); - auto dtLayerIdEnd = dtDigis->end(); - - for (; dtLayerIdIt != dtLayerIdEnd; ++dtLayerIdIt) { - const auto& [dtLayerId, range] = (*dtLayerIdIt); - - for (auto digiIt = range.first; digiIt != range.second; ++digiIt) { - wheel.push_back(dtLayerId.wheel()); - sector.push_back(dtLayerId.sector()); - station.push_back(dtLayerId.station()); - - superLayer.push_back(dtLayerId.superLayer()); - layer.push_back(dtLayerId.layer()); - wire.push_back(digiIt->wire()); - - time.push_back(digiIt->time()); - - ++nDigis; - } - } - } - - auto table = std::make_unique(nDigis, m_label, false, false); - - table->setDoc("DT digi information"); - - addColumn(table, "wheel", wheel, "wheel - [-2:2] range"); - addColumn(table, - "sector", - sector, - "sector - [1:14] range" - "
sector 13 used for the second MB4 of sector 4" - "
sector 14 used for the second MB4 of sector 10"); - addColumn(table, "station", station, "station - [1:4] range"); - addColumn(table, - "superLayer", - superLayer, - "superlayer - [1:3] range" - "
SL 1 and 3 are phi SLs" - "
SL 2 is theta SL"); - addColumn(table, "layer", layer, "station - [1:4] range"); - addColumn(table, - "wire", - wire, - "wire - [1:X] range" - "
X varies for different chambers SLs and layers"); - addColumn(table, "time", time, "digi time in ns (no pedestal subtraction)"); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleDTDigiFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.h deleted file mode 100644 index ab22f32e4cbd9..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MuNtuple_MuNtupleDTDigiFiller_h -#define MuNtuple_MuNtupleDTDigiFiller_h - -/** \class MuNtupleDTDigiFiller MuNtupleDTDigiFiller.h DPGAnalysis/MuonTools/plugins/MuNtupleDTDigiFiller.h - * - * Helper class : the digi filler for Phase-1 / Phase2 DT digis (the DataFormat is the same) - * - * \author C. Battilana (INFN BO) - * - * - */ - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/DTDigi/interface/DTDigiCollection.h" - -class MuNtupleDTDigiFiller : public MuNtupleBaseFiller { -public: - /// Constructor - MuNtupleDTDigiFiller(const edm::ParameterSet&); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions&); - -protected: - /// Fill tree branches for a given event - void fill(edm::Event&) final; - -private: - /// The digi token - nano_mu::EDTokenHandle m_token; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.cc deleted file mode 100644 index 6a338198e39b2..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.cc +++ /dev/null @@ -1,129 +0,0 @@ -#include "DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.h" - -#include - -MuNtupleGEMDigiFiller::MuNtupleGEMDigiFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), m_token{config, consumesCollector(), "gemDigiTag"}, m_gemGeometry{consumesCollector()} { - produces(); -} - -void MuNtupleGEMDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "gemDigis"); - desc.add("gemDigiTag", edm::InputTag{"muonGEMDigis"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleGEMDigiFiller::getFromES(const edm::Run& run, const edm::EventSetup& environment) { - m_gemGeometry.getFromES(environment); -} - -void MuNtupleGEMDigiFiller::fill(edm::Event& ev) { - unsigned int nDigis{0}; - - std::vector station; - std::vector roll; - std::vector strip; - std::vector bx; - std::vector region; - - std::vector g_r; - std::vector g_phi; - std::vector g_eta; - std::vector g_x; - std::vector g_y; - std::vector g_z; - - auto gemDigis = m_token.conditionalGet(ev); - - if (gemDigis.isValid()) { - auto gemDetIdIt = gemDigis->begin(); - auto gemDetIdEnd = gemDigis->end(); - - for (; gemDetIdIt != gemDetIdEnd; ++gemDetIdIt) { - const auto& [gemDetId, range] = (*gemDetIdIt); - - const auto etaPart = m_gemGeometry->etaPartition(gemDetId); - const auto& surface = etaPart->surface(); - - for (auto digi = range.first; digi != range.second; ++digi) { - station.push_back(gemDetId.station()); - roll.push_back(gemDetId.roll()); - strip.push_back(digi->strip()); - bx.push_back(digi->bx()); - - region.push_back(gemDetId.region()); - - const auto& localPos = etaPart->centreOfStrip(digi->strip()); - const auto& globalPos = surface.toGlobal(localPos); - - g_r.push_back(globalPos.perp()); - g_phi.push_back(globalPos.phi()); - g_eta.push_back(globalPos.eta()); - g_x.push_back(globalPos.x()); - g_y.push_back(globalPos.y()); - g_z.push_back(globalPos.z()); - - ++nDigis; - } - } - } - - auto table = std::make_unique(nDigis, m_label, false, false); - - table->setDoc("GEM digi information"); - - addColumn(table, "station", station, "GEM station
always 1 for GE1/1)"); - addColumn(table, - "roll", - roll, - "roll id (also known as eta partition)" - "
(partitions numbered from 1 to 8"); - addColumn(table, "strip", strip, "index of the readout strip associated to the digi"); - addColumn(table, - "region", - region, - "GE11 region where the digi is detected" - "
(int, positive endcap: +1, negative endcap: -1"); - addColumn(table, "bx", bx, "bunch crossing associated to the digi"); - - addColumn(table, - "g_r", - g_r, - "Global digi position" - "
(global radial coordinates, cm)"); - addColumn(table, - "g_phi", - g_phi, - "Global digi position" - "
(global azimuthal coordinates, rad)"); - addColumn(table, - "g_eta", - g_eta, - "Global digi position" - "
(global pseudorapidity coordinates)"); - addColumn(table, - "g_x", - g_x, - "Global digi position" - "
(global x coordinates, cm)"); - addColumn(table, - "g_y", - g_y, - "Global digi position" - "
(global y coordinates, cm)"); - addColumn(table, - "g_z", - g_z, - "Global digi position" - "
(global z coordinates, cm)"); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleGEMDigiFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.h deleted file mode 100644 index 2ba618254609e..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMDigiFiller.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef MuNtuple_MuNtupleGEMDigiFiller_h -#define MuNtuple_MuNtupleGEMDigiFiller_h - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" - -#include "Geometry/GEMGeometry/interface/GEMGeometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" - -class MuNtupleGEMDigiFiller : public MuNtupleBaseFiller { -public: - //Constructor - MuNtupleGEMDigiFiller(const edm::ParameterSet &); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions &); - -protected: - void fill(edm::Event &) final; - - /// Get info from the ES by run - void getFromES(const edm::Run &, const edm::EventSetup &) final; - -private: - /// The digi token - nano_mu::EDTokenHandle m_token; - - /// GEM Geometry - nano_mu::ESTokenHandle m_gemGeometry; -}; - -#endif \ No newline at end of file diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.cc deleted file mode 100644 index 5222bdc53c2a5..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.cc +++ /dev/null @@ -1,175 +0,0 @@ -#include "DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.h" - -#include - -MuNtupleGEMRecHitFiller::MuNtupleGEMRecHitFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller{config}, - m_token{config, consumesCollector(), "gemRecHitTag"}, - m_gemGeometry{consumesCollector()} { - produces(); -} - -void MuNtupleGEMRecHitFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "gemRecHits"); - desc.add("gemRecHitTag", edm::InputTag{"gemRecHits"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleGEMRecHitFiller::getFromES(const edm::Run& run, const edm::EventSetup& environment) { - m_gemGeometry.getFromES(environment); -} - -void MuNtupleGEMRecHitFiller::fill(edm::Event& ev) { - unsigned int nRecHits{0}; - - std::vector cluster_size; - std::vector firstClusterStrip; - std::vector bx; - - std::vector region; - std::vector chamber; - std::vector layer; - std::vector etaPartition; - - std::vector loc_r; - std::vector loc_phi; - std::vector loc_x; - std::vector loc_y; - std::vector loc_z; - - std::vector g_r; - std::vector g_phi; - std::vector g_x; - std::vector g_y; - std::vector g_z; - - auto gemRecHits = m_token.conditionalGet(ev); - - if (gemRecHits.isValid()) { - auto rechitIt = gemRecHits->begin(); - auto recHitEnd = gemRecHits->end(); - - for (; rechitIt != recHitEnd; ++rechitIt) { - GEMDetId gemDetId{rechitIt->gemId()}; - - etaPartition.push_back(gemDetId.roll()); - region.push_back(gemDetId.region()); - chamber.push_back(gemDetId.chamber()); - layer.push_back(gemDetId.layer()); - - const BoundPlane& surface = m_gemGeometry->idToDet(gemDetId)->surface(); - const auto rechit_local_pos = rechitIt->localPosition(); - const auto rechit_global_pos = surface.toGlobal(rechit_local_pos); - - loc_r.push_back(rechit_local_pos.perp()); - loc_phi.push_back(rechit_local_pos.phi()); - loc_x.push_back(rechit_local_pos.x()); - loc_y.push_back(rechit_local_pos.y()); - loc_z.push_back(rechit_local_pos.z()); - - g_r.push_back(rechit_global_pos.perp()); - g_phi.push_back(rechit_global_pos.phi()); - g_x.push_back(rechit_global_pos.x()); - g_y.push_back(rechit_global_pos.y()); - g_z.push_back(rechit_global_pos.z()); - - bx.push_back(rechitIt->BunchX()); - cluster_size.push_back(rechitIt->clusterSize()); - firstClusterStrip.push_back(rechitIt->firstClusterStrip()); - - ++nRecHits; - } - } - - auto table = std::make_unique(nRecHits, m_label, false, false); - - table->setDoc("GEM rec-hit information"); - - addColumn(table, "cluster_size", cluster_size, "recHit cluster size (strip multiplicity)"); - addColumn( - table, "firstClusterStrip", firstClusterStrip, "index of the first readout strip associated to the cluster"); - addColumn(table, "bx", bx, "bunch crossing associated to the recHit"); - - addColumn(table, - "region", - region, - "GE11 region where the hit is reconstructed" - "
(positive endcap: +1, negative endcap: -1"); - addColumn(table, - "chamber", - chamber, - "GE11 superchamber where the hit is reconstructed" - "
(chambers numbered from 0 to 35"); - addColumn(table, - "layer", - layer, - "GE11 layer where the hit is reconstructed" - "
(layer1: 1, layer2: 2"); - addColumn(table, - "etaPartition", - etaPartition, - "GE11 eta partition where the hit is reconstructed" - "
(partitions numbered from 1 to 8"); - - addColumn(table, - "loc_r", - loc_r, - "Local recHit position" - "
(local layer radial coordinates, cm)"); - addColumn(table, - "loc_phi", - loc_phi, - "Local recHit position" - "
(local layer azimuthal coordinates, rad)"); - addColumn(table, - "loc_x", - loc_x, - "Local recHit position" - "
(local layer x coordinates, cm)"); - addColumn(table, - "loc_y", - loc_y, - "Local recHit position" - "
(local layer y coordinates, cm)"); - addColumn(table, - "loc_z", - loc_z, - "Local recHit position" - "
(local layer z coordinates, cm)"); - - addColumn(table, - "g_r", - g_r, - "Global recHit position" - "
(global radial coordinates, cm)"); - addColumn(table, - "g_phi", - g_phi, - "Global recHit position" - "
(global azimuthal coordinates, rad)"); - addColumn(table, - "g_x", - g_x, - "Global recHit position" - "
(global x coordinates, cm)"); - addColumn(table, - "g_y", - g_y, - "Global recHit position" - "
(global y coordinates, cm)"); - addColumn(table, - "g_z", - g_z, - "Global recHit position" - "
(global z coordinates, cm)"); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleGEMRecHitFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.h deleted file mode 100644 index 06830e1497749..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMRecHitFiller.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MuNtuple_MuNtupleGEMRecHitFiller_h -#define MuNtuple_MuNtupleGEMRecHitFiller_h - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "Geometry/GEMGeometry/interface/GEMGeometry.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" - -#include "DataFormats/GEMRecHit/interface/GEMRecHitCollection.h" - -class MuNtupleGEMRecHitFiller : public MuNtupleBaseFiller { -public: - //Constructor - MuNtupleGEMRecHitFiller(const edm::ParameterSet &); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions &); - -protected: - /// Fill tree branches for a given events - void fill(edm::Event &) final; - - /// Get info from the ES by run - void getFromES(const edm::Run &, const edm::EventSetup &) final; - -private: - /// The rec-hit token - nano_mu::EDTokenHandle m_token; - - /// GEM Geometry - nano_mu::ESTokenHandle m_gemGeometry; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.cc deleted file mode 100644 index 036b902a0695a..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.cc +++ /dev/null @@ -1,126 +0,0 @@ -#include "DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.h" - -#include - -MuNtupleGEMSegmentFiller::MuNtupleGEMSegmentFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), - m_token{config, consumesCollector(), "gemSegmentTag"}, - m_trackingGeometry{consumesCollector()} { - produces(); -} - -void MuNtupleGEMSegmentFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "gemSegments"); - desc.add("gemSegmentTag", edm::InputTag{"gemSegments"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleGEMSegmentFiller::getFromES(const edm::EventSetup& environment) { - m_trackingGeometry.getFromES(environment); -} - -void MuNtupleGEMSegmentFiller::fill(edm::Event& ev) { - unsigned int nSegments{0}; - - std::vector region; - std::vector ring; - std::vector station; - std::vector posLoc_x; - std::vector posLoc_y; - std::vector posLoc_z; - std::vector dirLoc_x; - std::vector dirLoc_y; - std::vector dirLoc_z; - - std::vector posGlb_x; - std::vector posGlb_y; - std::vector posGlb_z; - - std::vector posGlb_phi; - std::vector posGlb_eta; - std::vector dirGlb_phi; - std::vector dirGlb_eta; - - std::vector time; - std::vector time_err; - std::vector chi2; - - auto segments = m_token.conditionalGet(ev); - - if (segments.isValid()) { - for (auto range_iter = segments->id_begin(); range_iter != segments->id_end(); range_iter++) { - const auto range = segments->get(*range_iter); - - for (auto segment = range.first; segment != range.second; ++segment) { - region.push_back((*range_iter).region()); - ring.push_back((*range_iter).ring()); - station.push_back((*range_iter).station()); - - auto pos = segment->localPosition(); - auto dir = segment->localDirection(); - - posLoc_x.push_back(pos.x()); - posLoc_y.push_back(pos.y()); - posLoc_z.push_back(pos.z()); - - dirLoc_x.push_back(dir.x()); - dirLoc_y.push_back(dir.y()); - dirLoc_z.push_back(dir.z()); - - const GeomDet* geomDet = m_trackingGeometry->idToDet(segment->geographicalId()); - auto posGlb = geomDet->toGlobal(pos); - auto dirGlb = geomDet->toGlobal(dir); - - posGlb_x.push_back(posGlb.x()); - posGlb_y.push_back(posGlb.y()); - posGlb_z.push_back(posGlb.z()); - posGlb_phi.push_back(posGlb.phi()); - posGlb_eta.push_back(posGlb.eta()); - - dirGlb_phi.push_back(dirGlb.phi()); - dirGlb_eta.push_back(dirGlb.eta()); - - time.push_back(segment->bunchX()); - chi2.push_back(segment->chi2()); - - ++nSegments; - } - } - } - - auto table = std::make_unique(nSegments, m_label, false, false); - - table->setDoc("GEM segment information"); - - addColumn(table, "region", region, ""); - addColumn(table, "ring", ring, ""); - addColumn(table, "station", station, ""); - - addColumn(table, "posLoc_x", posLoc_x, "position x in local coordinates - cm"); - addColumn(table, "posLoc_y", posLoc_y, "position y in local coordinates - cm"); - addColumn(table, "posLoc_z", posLoc_z, "position z in local coordinates - cm"); - - addColumn(table, "dirLoc_x", dirLoc_x, "direction x in local coordinates"); - addColumn(table, "dirLoc_y", dirLoc_y, "direction y in local coordinates"); - addColumn(table, "dirLoc_z", dirLoc_z, "direction z in local coordinates"); - - addColumn(table, "posGlb_x", posGlb_x, "position x in global coordinates - cm"); - addColumn(table, "posGlb_y", posGlb_y, "position y in global coordinates - cm"); - addColumn(table, "posGlb_z", posGlb_z, "position z in global coordinates - cm"); - - addColumn(table, "dirGlb_phi", dirGlb_phi, "direction phi in global coordinates - radians [-pi:pi]"); - addColumn(table, "dirGlb_eta", dirGlb_eta, "direction eta in global coordinates"); - - addColumn(table, "time", time, ""); - addColumn(table, "chi2", chi2, ""); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleGEMSegmentFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.h deleted file mode 100644 index 71e6b56c1defc..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleGEMSegmentFiller.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MuNtuple_MuNtupleGEMSegmentFiller_h -#define MuNtuple_MuNtupleGEMSegmentFiller_h - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/GEMRecHit/interface/GEMSegmentCollection.h" - -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" - -class MuNtupleGEMSegmentFiller : public MuNtupleBaseFiller { -public: - /// Constructor - MuNtupleGEMSegmentFiller(const edm::ParameterSet&); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions&); - -protected: - /// Fill tree branches for a given event - void fill(edm::Event&) final; - - /// Get info from the ES for a given event - void getFromES(const edm::EventSetup&) final; - -private: - /// The segment token - nano_mu::EDTokenHandle m_token; - - /// Tracking Geometry - nano_mu::ESTokenHandle m_trackingGeometry; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc deleted file mode 100644 index 1aeac6bf91b57..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc +++ /dev/null @@ -1,487 +0,0 @@ -/** \class MuNtupleMuonFiller MuNtupleMuonFiller.cc DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.cc - * - * Helper class : the muon filler - * - * \author L. Lunerti (INFN BO) - * - * - */ - -#include "DPGAnalysis/MuonTools/plugins/MuNtupleMuonFiller.h" - -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/MuonDetId/interface/DTChamberId.h" -#include "DataFormats/MuonReco/interface/MuonChamberMatch.h" -#include "DataFormats/MuonReco/interface/MuonSegmentMatch.h" -#include "DataFormats/MuonReco/interface/MuonSelectors.h" - -#include "DataFormats/DTRecHit/interface/DTRecSegment4D.h" -#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h" -#include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" -#include "DataFormats/MuonDetId/interface/DTChamberId.h" - -#include "DataFormats/Math/interface/deltaR.h" - -#include "TString.h" -#include "TRegexp.h" - -#include -#include - -MuNtupleMuonFiller::MuNtupleMuonFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), - m_muToken{config, consumesCollector(), "muonTag"}, - m_dtSegmentToken{config, consumesCollector(), "dtSegmentTag"}, - m_primaryVerticesToken{config, consumesCollector(), "primaryVerticesTag"}, - m_trigResultsToken{config, consumesCollector(), "trigResultsTag"}, - m_trigEventToken{config, consumesCollector(), "trigEventTag"}, - m_fillMatches{config.getParameter("fillMatches")}, - m_trigName{config.getParameter("trigName")}, - m_isoTrigName{config.getParameter("isoTrigName")}, - m_dtGeometry{consumesCollector()} { - produces(); - if (m_fillMatches) { - produces("matches"); - produces("staMatches"); - } -} - -void MuNtupleMuonFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "muon"); - desc.add("muonTag", edm::InputTag{"muons"}); - desc.add("dtSegmentTag", edm::InputTag{"dt4DSegments"}); - desc.add("primaryVerticesTag", edm::InputTag{"offlinePrimaryVertices"}); - - desc.add("fillMatches", true); - - desc.add("trigEventTag", edm::InputTag{"hltTriggerSummaryAOD::HLT"}); - desc.add("trigResultsTag", edm::InputTag{"TriggerResults::HLT"}); - - desc.add("trigName", "none"); - desc.add("isoTrigName", "HLT_IsoMu2*"); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleMuonFiller::getFromES(const edm::Run& run, const edm::EventSetup& environment) { - m_dtGeometry.getFromES(environment); - - bool changed{true}; - m_hltConfig.init(run, environment, "HLT", changed); - - const bool enableWildcard{true}; - - TString tName = TString(m_trigName); - TRegexp tNamePattern = TRegexp(tName, enableWildcard); - - for (unsigned iPath = 0; iPath < m_hltConfig.size(); ++iPath) { - TString pathName = TString(m_hltConfig.triggerName(iPath)); - if (pathName.Contains(tNamePattern)) - m_trigIndices.push_back(static_cast(iPath)); - } - - tName = TString(m_isoTrigName); - tNamePattern = TRegexp(tName, enableWildcard); - - for (unsigned iPath = 0; iPath < m_hltConfig.size(); ++iPath) { - TString pathName = TString(m_hltConfig.triggerName(iPath)); - if (pathName.Contains(tNamePattern)) - m_isoTrigIndices.push_back(static_cast(iPath)); - } -} - -void MuNtupleMuonFiller::fill(edm::Event& ev) { - unsigned int nMuons{0}; - - std::vector pt; - std::vector phi; - std::vector eta; - std::vector charge; - - std::vector isGlobal; - std::vector isStandalone; - std::vector isTracker; - std::vector isTrackerArb; - std::vector isRPC; - - std::vector firesIsoTrig; - std::vector firesTrig; - - std::vector isLoose; - std::vector isMedium; - std::vector isTight; - - std::vector trkIso03; - std::vector pfIso04; - - std::vector trk_dxy; - std::vector trk_dz; - - std::vector trk_algo; - std::vector trk_origAlgo; - - std::vector trk_numberOfValidPixelHits; - std::vector trk_numberOfValidTrackerLayers; - - std::vector trkMu_stationMask; - std::vector trkMu_numberOfMatchedStations; - std::vector trkMu_numberOfMatchedRPCLayers; - - std::vector staMu_numberOfValidMuonHits; - std::vector staMu_normChi2; - std::vector glbMu_normChi2; - - std::vector nMatches; - std::vector staMu_nMatchSeg; - - std::vector matches_begin; - std::vector matches_end; - - std::vector staMatches_begin; - std::vector staMatches_end; - - std::vector matches_wheel; - std::vector matches_sector; - std::vector matches_station; - - std::vector matches_x; - std::vector matches_y; - - std::vector matches_phi; - std::vector matches_eta; - std::vector matches_edgeX; - std::vector matches_edgeY; - - std::vector matches_dXdZ; - std::vector matches_dYdZ; - - std::vector staMatches_MuSegIdx; - - auto muons = m_muToken.conditionalGet(ev); - auto segments = m_dtSegmentToken.conditionalGet(ev); - auto vtxs = m_primaryVerticesToken.conditionalGet(ev); - - auto triggerResults = m_trigResultsToken.conditionalGet(ev); - auto triggerEvent = m_trigEventToken.conditionalGet(ev); - - if (muons.isValid() && segments.isValid() && vtxs.isValid()) { - for (const auto& muon : (*muons)) { - pt.push_back(muon.pt()); - eta.push_back(muon.eta()); - phi.push_back(muon.phi()); - charge.push_back(muon.charge()); - - isGlobal.push_back(muon.isGlobalMuon()); - isStandalone.push_back(muon.isStandAloneMuon()); - isTracker.push_back(muon.isTrackerMuon()); - isTrackerArb.push_back(muon::isGoodMuon(muon, muon::TrackerMuonArbitrated)); - isRPC.push_back(muon.isRPCMuon()); - - if (triggerResults.isValid() && triggerEvent.isValid()) { - const auto& triggerObjects = triggerEvent->getObjects(); - - bool hasIsoTrig = hasTrigger(m_isoTrigIndices, triggerObjects, triggerEvent, muon); - bool hasTrig = hasTrigger(m_trigIndices, triggerObjects, triggerEvent, muon); - - firesIsoTrig.push_back(hasIsoTrig); - firesTrig.push_back(hasTrig); - - } else { - firesIsoTrig.push_back(false); - firesTrig.push_back(false); - } - - isLoose.push_back(muon.passed(reco::Muon::CutBasedIdLoose)); - isMedium.push_back(muon.passed(reco::Muon::CutBasedIdMedium)); - isTight.push_back(muon.passed(reco::Muon::CutBasedIdTight)); - - trkIso03.push_back(computeTrkIso(muon.isolationR03(), muon.pt())); - pfIso04.push_back(computePFIso(muon.pfIsolationR04(), muon.pt())); - - //INNER TRACK VARIABLES - if (!muon.innerTrack().isNull()) { - const reco::TrackRef innerTrackRef = muon.innerTrack(); - const reco::Vertex& vertex = vtxs->at(0); - - trk_dxy.push_back(innerTrackRef->dxy(vertex.position())); - trk_dz.push_back(innerTrackRef->dz(vertex.position())); - trk_algo.push_back(innerTrackRef->algo()); - trk_origAlgo.push_back(innerTrackRef->originalAlgo()); - trk_numberOfValidPixelHits.push_back(innerTrackRef->hitPattern().numberOfValidPixelHits()); - trk_numberOfValidTrackerLayers.push_back(innerTrackRef->hitPattern().trackerLayersWithMeasurement()); - - } else { - trk_dxy.push_back(MuNtupleBaseFiller::DEFAULT_DOUBLE_VAL); - trk_dz.push_back(MuNtupleBaseFiller::DEFAULT_DOUBLE_VAL); - trk_algo.push_back(MuNtupleBaseFiller::DEFAULT_INT_VAL_POS); - trk_origAlgo.push_back(MuNtupleBaseFiller::DEFAULT_INT_VAL_POS); - trk_numberOfValidPixelHits.push_back(MuNtupleBaseFiller::DEFAULT_INT_VAL_POS); - trk_numberOfValidTrackerLayers.push_back(MuNtupleBaseFiller::DEFAULT_INT_VAL_POS); - } - - //TRACKER / RPC MUON VARIABLES - trkMu_stationMask.push_back(muon.stationMask()); - trkMu_numberOfMatchedStations.push_back(muon.numberOfMatchedStations()); - trkMu_numberOfMatchedRPCLayers.push_back(muon.numberOfMatchedRPCLayers()); - - //STANDALONE MUON VARIABLES - if (muon.isStandAloneMuon()) { - const reco::TrackRef outerTrackRef = muon.outerTrack(); - staMu_numberOfValidMuonHits.push_back(outerTrackRef->hitPattern().numberOfValidMuonHits()); - staMu_normChi2.push_back(outerTrackRef->chi2() / outerTrackRef->ndof()); - - } else { - staMu_numberOfValidMuonHits.push_back(MuNtupleBaseFiller::DEFAULT_INT_VAL_POS); - staMu_normChi2.push_back(MuNtupleBaseFiller::DEFAULT_DOUBLE_VAL_POS); - } - - //GLOBAL MUON VARIABLES - if (muon.isGlobalMuon()) { - const reco::TrackRef globalTrackRef = muon.globalTrack(); - glbMu_normChi2.push_back(globalTrackRef->chi2() / globalTrackRef->ndof()); - - } else { - glbMu_normChi2.push_back(MuNtupleBaseFiller::DEFAULT_DOUBLE_VAL_POS); - } - - size_t iMatches = 0; - size_t iSegMatches = 0; - - if (m_fillMatches) { - matches_begin.push_back(matches_wheel.size()); - - if (muon.isMatchesValid()) { - for (const auto& match : muon.matches()) { - if (iMatches < 16 && match.id.det() == DetId::Muon && match.id.subdetId() == MuonSubdetId::DT) { - DTChamberId dtId(match.id.rawId()); - const auto chamb = m_dtGeometry->chamber(static_cast(match.id)); - - matches_wheel.push_back(dtId.wheel()); - matches_sector.push_back(dtId.sector()); - matches_station.push_back(dtId.station()); - - matches_x.push_back(match.x); - matches_y.push_back(match.y); - - matches_phi.push_back(chamb->toGlobal(LocalPoint(match.x, match.y, 0.)).phi()); - matches_eta.push_back(chamb->toGlobal(LocalPoint(match.x, match.y, 0.)).eta()); - - matches_edgeX.push_back(match.edgeX); - matches_edgeY.push_back(match.edgeY); - - matches_dXdZ.push_back(match.dXdZ); - matches_dYdZ.push_back(match.dYdZ); - - ++iMatches; - } - } - } - - matches_end.push_back(matches_wheel.size()); - - //SEGMENT MATCHING VARIABLES - - staMatches_begin.push_back(staMatches_MuSegIdx.size()); - - if (!muon.outerTrack().isNull()) { - reco::TrackRef outerTrackRef = muon.outerTrack(); - - auto recHitIt = outerTrackRef->recHitsBegin(); - auto recHitEnd = outerTrackRef->recHitsEnd(); - - for (; recHitIt != recHitEnd; ++recHitIt) { - DetId detId = (*recHitIt)->geographicalId(); - - if (detId.det() == DetId::Muon && detId.subdetId() == MuonSubdetId::DT) { - const auto dtSegmentSta = dynamic_cast((*recHitIt)); - int iSeg = 0; - - for (const auto& segment : (*segments)) { - if (dtSegmentSta && dtSegmentSta->chamberId().station() == segment.chamberId().station() && - dtSegmentSta->chamberId().wheel() == segment.chamberId().wheel() && - dtSegmentSta->chamberId().sector() == segment.chamberId().sector() && - std::abs(dtSegmentSta->localPosition().x() - segment.localPosition().x()) < 0.01 && - std::abs(dtSegmentSta->localPosition().y() - segment.localPosition().y()) < 0.01 && - std::abs(dtSegmentSta->localDirection().x() - segment.localDirection().x()) < 0.01 && - std::abs(dtSegmentSta->localDirection().y() - segment.localDirection().y()) < 0.01) { - staMatches_MuSegIdx.push_back(iSeg); - ++iSegMatches; - } - - ++iSeg; - } //loop over segments - } - - } //loop over recHits - } - - staMatches_end.push_back(staMatches_MuSegIdx.size()); - } - - nMatches.push_back(iMatches); - staMu_nMatchSeg.push_back(iSegMatches); - - ++nMuons; - } - } - - auto table = std::make_unique(nMuons, m_label, false, false); - - table->setDoc("RECO muon information"); - - addColumn(table, "pt", pt, "muon pT - GeV/c"); - addColumn(table, "phi", phi, "muon phi - rad"); - addColumn(table, "eta", eta, "muon eta"); - addColumn(table, "charge", charge, "muon charge"); - - addColumn(table, "isGlobal", isGlobal, ""); - addColumn(table, "isStandalone", isStandalone, ""); - addColumn(table, "isTracker", isTracker, ""); - addColumn(table, "isTrackerArb", isTrackerArb, ""); - addColumn(table, "isRPC", isRPC, ""); - - addColumn(table, - "firesIsoTrig", - firesIsoTrig, - "True if the muon is matched to an isolated trigger" - "
specified in the ntuple config file"); - - addColumn(table, - "firesTrig", - firesTrig, - "True if the muon is matched to a (non isolated)trigger" - "
specified in the ntuple config file"); - - addColumn(table, "isLoose", isLoose, "Loose muon ID"); - addColumn(table, "isMedium", isMedium, "Medium muon ID"); - addColumn(table, "isTight", isTight, "Tight muon ID"); - - addColumn(table, "trkIso03", trkIso03, "Relative tracker isolation (0.3 cone)"); - addColumn(table, "pfIso04", pfIso04, "Relative PF-isolation (delta beta corrected, 0.4 cone)"); - - addColumn(table, "trk_dxy", trk_dxy, "Inner track dxy parameter with respect to the primary vertex - cm"); - addColumn(table, "trk_dz", trk_dz, "Inner track dz parameter with respect to the primary vertex - cm"); - - addColumn(table, "trk_algo", trk_algo, "iterative tracking algorithm used to build the inner track"); - addColumn(table, - "trk_origAlgo", - trk_origAlgo, - "Original (pre muon iterations) iterative tracking algorithm used to build the inner track"); - - addColumn(table, "trk_numberOfValidPixelHits", trk_numberOfValidPixelHits, "Number of valid pixel hits"); - addColumn(table, "trk_numberOfValidTrackerLayers", trk_numberOfValidTrackerLayers, "Number of valid tracker layers"); - - addColumn(table, - "trkMu_stationMask", - trkMu_stationMask, - "Bit map of stations with tracks within given distance (in cm) of chamber edges"); - addColumn(table, "trkMu_numberOfMatchedStations", trkMu_numberOfMatchedStations, "Number of matched DT/CSC stations"); - addColumn(table, "trkMu_numberOfMatchedRPCLayers", trkMu_numberOfMatchedRPCLayers, "Number of matched RPC layers"); - - addColumn(table, "staMu_numberOfValidMuonHits", staMu_numberOfValidMuonHits, "Number of valid muon hits"); - - addColumn(table, "staMu_normChi2", staMu_normChi2, "chi2/ndof (standalone track)"); - - addColumn(table, "glbMu_normChi2", glbMu_normChi2, "chi2/ndof (global track)"); - - addColumn(table, "nMatches", nMatches, "Number of muon chamber matches (DT only)"); - addColumn(table, "staMu_nMatchSeg", staMu_nMatchSeg, "Number of segments used in the standalone track (DT only)"); - - addColumn( - table, "matches_begin", matches_begin, "begin of range of quantities for a given muon in the matches_* vectors"); - addColumn(table, "matches_end", matches_end, "end of range of quantities for a given muon in the matches_* vectors"); - - addColumn(table, - "staMatches_begin", - staMatches_begin, - "begin of range of quantities for a given muon in the matches_staMuSegIdx vector"); - addColumn(table, - "staMatches_end", - staMatches_end, - "end of range of quantities for a given muon in the matches_staMuSegIdx vector"); - - ev.put(std::move(table)); - - if (m_fillMatches) { - auto sum = [](std::vector v) { return std::accumulate(v.begin(), v.end(), 0); }; - - auto tabMatches = std::make_unique(sum(nMatches), m_label + "_matches", false, false); - - tabMatches->setDoc("Size of RECO muon matches_* vectors"); - - addColumn(tabMatches, "x", matches_x, "X position of the extrapolated track on the matched chamber"); - addColumn(tabMatches, "y", matches_y, "Y position of the extrapolated track on the matched chamber"); - - addColumn(tabMatches, "wheel", matches_wheel, "Matched chamber wheel"); - addColumn(tabMatches, "sector", matches_sector, "Matched chamber sector"); - addColumn(tabMatches, "station", matches_station, "Matched chamber station"); - - addColumn( - tabMatches, "phi", matches_phi, "Phi of the (x,y) position on the matched chamber (global reference frame)"); - addColumn( - tabMatches, "eta", matches_eta, " Eta of the (x,y) position on the matched chamber (global reference frame)"); - - addColumn(tabMatches, "dXdZ", matches_dXdZ, "dXdZ of the extrapolated track on the matched chamber"); - addColumn(tabMatches, "dYdZ", matches_dYdZ, "dYdZ of the extrapolated track on the matched chamber"); - - ev.put(std::move(tabMatches), "matches"); - - auto tabStaMatches = - std::make_unique(sum(staMu_nMatchSeg), m_label + "_staMatches", false, false); - - tabStaMatches->setDoc("Size of RECO muon staMatches_* vector"); - - addColumn(tabStaMatches, - "MuSegIdx", - staMatches_MuSegIdx, - "Index of DT segments used in the standalone track it corresponds" - "
to the index of a given segment in the ntuple seg_* collection"); - - ev.put(std::move(tabStaMatches), "staMatches"); - } -} - -float MuNtupleMuonFiller::computeTrkIso(const reco::MuonIsolation& isolation, float muonPt) { - return isolation.sumPt / muonPt; -} - -float MuNtupleMuonFiller::computePFIso(const reco::MuonPFIsolation& pfIsolation, float muonPt) { - return (pfIsolation.sumChargedHadronPt + - std::max(0., pfIsolation.sumNeutralHadronEt + pfIsolation.sumPhotonEt - 0.5 * pfIsolation.sumPUPt)) / - muonPt; -} - -bool MuNtupleMuonFiller::hasTrigger(std::vector& trigIndices, - const trigger::TriggerObjectCollection& trigObjs, - edm::Handle& trigEvent, - const reco::Muon& muon) { - float dRMatch = 999.; - for (int trigIdx : trigIndices) { - const std::vector trigModuleLabels = m_hltConfig.moduleLabels(trigIdx); - - const unsigned trigModuleIndex = - std::find(trigModuleLabels.begin(), trigModuleLabels.end(), "hltBoolEnd") - trigModuleLabels.begin() - 1; - const unsigned hltFilterIndex = trigEvent->filterIndex(edm::InputTag(trigModuleLabels[trigModuleIndex], "", "HLT")); - if (hltFilterIndex < trigEvent->sizeFilters()) { - const trigger::Keys keys = trigEvent->filterKeys(hltFilterIndex); - const trigger::Vids vids = trigEvent->filterIds(hltFilterIndex); - const unsigned nTriggers = vids.size(); - - for (unsigned iTrig = 0; iTrig < nTriggers; ++iTrig) { - trigger::TriggerObject trigObj = trigObjs[keys[iTrig]]; - float dR = deltaR(muon, trigObj); - if (dR < dRMatch) - dRMatch = dR; - } - } - } - - return dRMatch < 0.1; //CB should get it programmable -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleMuonFiller); \ No newline at end of file diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.cc deleted file mode 100644 index a42f3f932a029..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.cc +++ /dev/null @@ -1,108 +0,0 @@ -/** \class MuNtupleDigiFiller MuNtupleDigiFiller.cc DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.cc - * - * Helper class : the digi filler for RPC digis - * - * \author Eliza Melo Da Costa (UERJ) - * - * - */ - -#include "DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.h" - -#include "DataFormats/MuonDetId/interface/RPCDetId.h" - -#include - -MuNtupleRPCDigiFiller::MuNtupleRPCDigiFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), m_token{config, consumesCollector(), "rpcDigiTag"} { - produces(); -} - -void MuNtupleRPCDigiFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "rpcDigis"); - desc.add("rpcDigiTag", edm::InputTag{"muonRPCDigis"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleRPCDigiFiller::fill(edm::Event& ev) { - unsigned int nDigis{0}; - - std::vector strip; - std::vector bx; - - std::vector region; - std::vector ring; - std::vector station; - std::vector layer; - std::vector sector; - std::vector subsector; - std::vector roll; - - std::vector rawId; - - auto rpcDigis = m_token.conditionalGet(ev); - - if (rpcDigis.isValid()) { - auto detUnitIt = rpcDigis->begin(); - auto detUnitEnd = rpcDigis->end(); - - for (; detUnitIt != detUnitEnd; ++detUnitIt) { - const auto& [rpcDetId, range] = (*detUnitIt); - - for (auto digiIt = range.first; digiIt != range.second; ++digiIt) { - strip.push_back(digiIt->strip()); - bx.push_back(digiIt->bx()); - - region.push_back(rpcDetId.region()); - ring.push_back(rpcDetId.ring()); - station.push_back(rpcDetId.station()); - layer.push_back(rpcDetId.layer()); - sector.push_back(rpcDetId.sector()); - subsector.push_back(rpcDetId.subsector()); - roll.push_back(rpcDetId.roll()); - - rawId.push_back(rpcDetId.rawId()); - - ++nDigis; - } - } - } - - auto table = std::make_unique(nDigis, m_label, false, false); - - table->setDoc("RPC digi information"); - - addColumn(table, "strip", strip, "Strip number fired in a given BX"); - addColumn(table, "bx", bx, "Bunch crossing number"); - - addColumn(table, "region", region, "0: Barrel, +-1: Endcap"); - addColumn(table, "ring", ring, "Ring id: Wheel number in Barrel (from -2 to +2) Ring Number in Endcap (from 1 to 3)"); - addColumn(table, "station", station, "Chambers at same R in barrel, chamber at same Z ion endcap"); - addColumn(table, - "layer", - layer, - "Layer id: in station 1 and 2 for barrel, we have two layers of chambers: " - "layer 1 is the inner chamber and layer 2 is the outer chamber"); - addColumn(table, "sector", sector, "Group of chambers at same phi"); - addColumn(table, - "subsector", - subsector, - "Some sectors are divided along the phi direction in subsectors " - "(from 1 to 4 in Barrel, from 1 to 6 in Endcap)"); - addColumn(table, - "roll", - roll, - "Roll id (also known as eta partition) each chamber is divided along the strip direction in"); - - addColumn(table, "rawId", rawId, "Unique detector unit ID"); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleRPCDigiFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.h deleted file mode 100644 index 9d98bc371d1eb..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MuNtuple_MuNtupleRPCDigiFiller_h -#define MuNtuple_MuNtupleRPCDigiFiller_h - -/** \class MuNtupleRPCDigiFiller MuNtupleRPCDigiFiller.h DPGAnalysis/MuonTools/plugins/MuNtupleRPCDigiFiller.h - * - * Helper class : the digi filler for RPC digis - * - * \author Eliza Melo Da Costa (UERJ) - * - * - */ - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "DataFormats/RPCDigi/interface/RPCDigiCollection.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -class MuNtupleRPCDigiFiller : public MuNtupleBaseFiller { -public: - /// Constructor - MuNtupleRPCDigiFiller(const edm::ParameterSet&); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions&); - -protected: - /// Fill tree branches for a given events - void fill(edm::Event&) final; - -private: - /// The digi token - nano_mu::EDTokenHandle m_token; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.cc b/DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.cc deleted file mode 100644 index 85a6b385e1fd1..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.cc +++ /dev/null @@ -1,121 +0,0 @@ -/** \class MuNtupleDigiFiller MuNtupleDigiFiller.cc DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.cc - * - * Helper class : the digi filler for RPC RecHits - * - * \author Eliza Melo Da Costa (UERJ) - * - * - */ - -#include "DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.h" - -#include "DataFormats/MuonDetId/interface/RPCDetId.h" - -#include - -MuNtupleRPCRecHitFiller::MuNtupleRPCRecHitFiller(const edm::ParameterSet& config) - : MuNtupleBaseFiller(config), m_token{config, consumesCollector(), "rpcRecHitTag"} { - produces(); -} - -void MuNtupleRPCRecHitFiller::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - edm::ParameterSetDescription desc; - - desc.add("label", "rpcRecHits"); - desc.add("rpcRecHitTag", edm::InputTag{"rpcRecHits"}); - - descriptions.addWithDefaultLabel(desc); -} - -void MuNtupleRPCRecHitFiller::fill(edm::Event& ev) { - unsigned int nRecHit{0}; - - std::vector firstClusterStrip; - std::vector clusterSize; - std::vector bx; - std::vector time; - std::vector coordinateX; - std::vector coordinateY; - std::vector coordinateZ; - - std::vector region; - std::vector ring; - std::vector station; - std::vector layer; - std::vector sector; - std::vector subsector; - std::vector roll; - - std::vector rawId; - - auto rpcRecHits = m_token.conditionalGet(ev); - - if (rpcRecHits.isValid()) { - auto recHitIt = rpcRecHits->begin(); - auto recHitEnd = rpcRecHits->end(); - - for (; recHitIt != recHitEnd; recHitIt++) { - firstClusterStrip.push_back(recHitIt->firstClusterStrip()); - clusterSize.push_back(recHitIt->clusterSize()); - bx.push_back(recHitIt->BunchX()); - time.push_back(recHitIt->time()); - coordinateX.push_back(recHitIt->localPosition().x()); - coordinateY.push_back(recHitIt->localPosition().y()); - coordinateZ.push_back(recHitIt->localPosition().z()); - - auto rpcDetId = (RPCDetId)(*recHitIt).rpcId(); - region.push_back(rpcDetId.region()); - ring.push_back(rpcDetId.ring()); - station.push_back(rpcDetId.station()); - layer.push_back(rpcDetId.layer()); - sector.push_back(rpcDetId.sector()); - subsector.push_back(rpcDetId.subsector()); - roll.push_back(rpcDetId.roll()); - rawId.push_back(rpcDetId.rawId()); - ++nRecHit; - } - } - auto table = std::make_unique(nRecHit, m_label, false, false); - - table->setDoc("RPC rec-hit information"); - - addColumn(table, "bx", bx, "Bunch crossing number"); - addColumn(table, "time", time, "Float with time information in ns"); - addColumn(table, "firstClusterStrip", firstClusterStrip, "Lowest-numbered strip in the cluster"); - addColumn(table, "clusterSize", clusterSize, "Number of strips in the cluster"); - addColumn(table, "coordinateX", coordinateX, "Local x coordinate in cm"); - addColumn(table, "coordinateY", coordinateY, "Local y coordinate in cm"); - addColumn(table, "coordinateZ", coordinateZ, "Local z coordinate in cm"); - - addColumn(table, "region", region, "0: Barrel, +-1: Endcap"); - addColumn(table, - "ring", - ring, - "Ring id: Wheel number in Barrel (from -2 to +2) " - "Ring Number in Endcap (from 1 to 3)"); - addColumn(table, "station", station, "Chambers at same R in barrel, chamber at same Z ion endcap"); - addColumn(table, - "layer", - layer, - "Layer id: in station 1 and 2 for barrel, we have two layers of chambers: " - "layer 1 is the inner chamber and layer 2 is the outer chamber"); - addColumn(table, "sector", sector, "Group of chambers at same phi"); - addColumn(table, - "subsector", - subsector, - "Some sectors are divided along the phi direction in subsectors " - "(from 1 to 4 in Barrel, from 1 to 6 in Endcap)"); - addColumn(table, - "roll", - roll, - "Roll id (also known as eta partition) each chamber is divided along the strip direction in"); - - addColumn(table, "rawId", rawId, "Unique detector unit ID"); - - ev.put(std::move(table)); -} - -#include "FWCore/PluginManager/interface/ModuleDef.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -DEFINE_FWK_MODULE(MuNtupleRPCRecHitFiller); diff --git a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.h b/DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.h deleted file mode 100644 index b0437dbe7317b..0000000000000 --- a/DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef MuNtuple_MuNtupleRPCRecHitFiller_h -#define MuNtuple_MuNtupleRPCRecHitFiller_h - -/** \class MuNtupleRPCRecHitFiller MuNtupleRPCRecHitFiller.h DPGAnalysis/MuonTools/plugins/MuNtupleRPCRecHitFiller.h - * - * Helper class : the digi filler for RPC recHits - * - * \author Eliza Melo Da Costa (UERJ) - * - * - */ - -#include "DPGAnalysis/MuonTools/src/MuNtupleBaseFiller.h" - -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - -#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" - -class MuNtupleRPCRecHitFiller : public MuNtupleBaseFiller { -public: - /// Constructor - MuNtupleRPCRecHitFiller(const edm::ParameterSet&); - - /// Fill descriptors - static void fillDescriptions(edm::ConfigurationDescriptions&); - -protected: - /// Fill tree branches for a given events - void fill(edm::Event&) final; - -private: - /// The rec-hit token - nano_mu::EDTokenHandle m_token; -}; - -#endif diff --git a/DPGAnalysis/MuonTools/python/muNtupleProducerBkg_cff.py b/DPGAnalysis/MuonTools/python/muNtupleProducerBkg_cff.py new file mode 100644 index 0000000000000..b928bf610b491 --- /dev/null +++ b/DPGAnalysis/MuonTools/python/muNtupleProducerBkg_cff.py @@ -0,0 +1,15 @@ +import FWCore.ParameterSet.Config as cms + +from PhysicsTools.NanoAOD.common_cff import * + +from DPGAnalysis.MuonTools.nano_mu_digi_cff import * + +muNtupleProducerBkg = cms.Sequence(muDigiProducersBkg) + +def nanoAOD_customizeCommon(process) : + + if hasattr(process, "NANOAODoutput"): + process.NANOAODoutput.outputCommands.append("keep nanoaodFlatTable_*Table*_*_*") + process.NANOAODoutput.outputCommands.append("drop edmTriggerResults_*_*_*") + + return process \ No newline at end of file diff --git a/DPGAnalysis/MuonTools/python/muNtupleProducer_cff.py b/DPGAnalysis/MuonTools/python/muNtupleProducer_cff.py index 6fcf458ad1336..993e2e1098e90 100644 --- a/DPGAnalysis/MuonTools/python/muNtupleProducer_cff.py +++ b/DPGAnalysis/MuonTools/python/muNtupleProducer_cff.py @@ -1,22 +1,4 @@ import FWCore.ParameterSet.Config as cms -from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy - -from DPGAnalysis.MuonTools.muNtupleDTDigiFiller_cfi import muNtupleDTDigiFiller -from DPGAnalysis.MuonTools.muNtupleRPCDigiFiller_cfi import muNtupleRPCDigiFiller -from DPGAnalysis.MuonTools.muNtupleGEMDigiFiller_cfi import muNtupleGEMDigiFiller - -from DPGAnalysis.MuonTools.muNtupleRPCRecHitFiller_cfi import muNtupleRPCRecHitFiller -from DPGAnalysis.MuonTools.muNtupleGEMRecHitFiller_cfi import muNtupleGEMRecHitFiller - -from DPGAnalysis.MuonTools.muNtupleDTSegmentFiller_cfi import muNtupleDTSegmentFiller -from DPGAnalysis.MuonTools.muNtupleGEMSegmentFiller_cfi import muNtupleGEMSegmentFiller - -from DPGAnalysis.MuonTools.muNtupleMuonFiller_cfi import muNtupleMuonFiller -from DPGAnalysis.MuonTools.muNtupleGEMMuonFiller_cfi import muNtupleGEMMuonFiller -muNtupleGEMMuonFiller.ServiceParameters = MuonServiceProxy.ServiceParameters - -from DPGAnalysis.MuonTools.muNtupleCSCTnPFiller_cfi import muNtupleCSCTnPFiller -muNtupleCSCTnPFiller.ServiceParameters = MuonServiceProxy.ServiceParameters from PhysicsTools.NanoAOD.common_cff import * @@ -25,27 +7,15 @@ from DPGAnalysis.MuonTools.nano_mu_reco_cff import * from DPGAnalysis.MuonTools.nano_mu_l1t_cff import * -muNtupleBaseProducer = cms.Sequence(muNtupleDTDigiFiller - + muNtupleRPCDigiFiller - + muNtupleGEMDigiFiller - + muNtupleRPCRecHitFiller - + muNtupleGEMRecHitFiller - + muNtupleDTSegmentFiller - + muNtupleGEMSegmentFiller - + muNtupleMuonFiller - + muNtupleGEMMuonFiller - + muNtupleCSCTnPFiller - ) - -muNtupleProducer = cms.Sequence(muNtupleBaseProducer - + muDigiProducers +muNtupleProducer = cms.Sequence(muDigiProducers + muLocalRecoProducers + muRecoProducers - + muL1TriggerProducers) - + + muL1TriggerProducers + ) + def nanoAOD_customizeCommon(process) : - if hasattr(process, "muNtupleGEMMuonFiller") or hasattr(process, "muNtupleCSCTnPFiller"): + if hasattr(process, "muGEMMuonExtTableProducer") or hasattr(process, "muCSCTnPFlatTableProducer"): process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi") process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi") process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi") diff --git a/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py b/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py index b7cb2d7d3baa3..2192e266a9142 100644 --- a/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py +++ b/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py @@ -5,7 +5,7 @@ from DPGAnalysis.MuonTools.dtDigiFlatTableProducer_cfi import dtDigiFlatTableProducer -dtDigiFlatTableProducer.name = "dtDigiT" +dtDigiFlatTableProducer.name = "dtDigi" dtDigiFlatTableProducer.src = "muonDTDigis" dtDigiFlatTableProducer.doc = "DT digi information" @@ -30,7 +30,7 @@ from DPGAnalysis.MuonTools.rpcDigiFlatTableProducer_cfi import rpcDigiFlatTableProducer -rpcDigiFlatTableProducer.name = "rpcDigiT" +rpcDigiFlatTableProducer.name = "rpcDigi" rpcDigiFlatTableProducer.src = "muonRPCDigis" rpcDigiFlatTableProducer.doc = "RPC digi information" @@ -58,7 +58,7 @@ from DPGAnalysis.MuonTools.gemDigiFlatTableProducer_cfi import gemDigiFlatTableProducer -gemDigiFlatTableProducer.name = "gemDigiT" +gemDigiFlatTableProducer.name = "gemDigi" gemDigiFlatTableProducer.src = "muonGEMDigis" gemDigiFlatTableProducer.doc = "GEM digi information" @@ -79,7 +79,7 @@ from DPGAnalysis.MuonTools.gemohStatusFlatTableProducer_cfi import gemohStatusFlatTableProducer -gemohStatusFlatTableProducer.name = "gemOHStatusT" +gemohStatusFlatTableProducer.name = "gemOHStatus" gemohStatusFlatTableProducer.src = "muonGEMDigis:OHStatus:" gemohStatusFlatTableProducer.doc = "GEM OH status information" @@ -101,8 +101,57 @@ layer = DetIdVar("layer()", "int8", doc = "layer with which the GEMOHStatus is associated
either 1 or 2 for GE1/1 and GE2/1") ) + +from DPGAnalysis.MuonTools.cscWireDigiFlatTableProducer_cfi import cscWireDigiFlatTableProducer + +cscWireDigiFlatTableProducer.name = "cscWireDigi" +cscWireDigiFlatTableProducer.src = "muonCSCDigis:MuonCSCWireDigi" +cscWireDigiFlatTableProducer.doc = "CSC wire digi information" + +cscWireDigiFlatTableProducer.variables = cms.PSet( + timeBin = Var("getTimeBin()", "int8", doc = ""), + wireGroup = Var("getWireGroup()", "int8", doc=""), + wireGroupBX = Var("getWireGroupBX()", "int8", doc="") +) + +cscWireDigiFlatTableProducer.detIdVariables = cms.PSet( + endcap = DetIdVar("endcap()", "int8", doc = ""), + station = DetIdVar("station()", "int8", doc = ""), + ring = DetIdVar("ring()", "int8", doc = ""), + chamber = DetIdVar("chamber()", "int8", doc = ""), + layer = DetIdVar("layer()", "int8", doc = "") +) + +from DPGAnalysis.MuonTools.cscAlctDigiFlatTableProducer_cfi import cscAlctDigiFlatTableProducer + +cscAlctDigiFlatTableProducer.name = "cscALCTDigi" +cscAlctDigiFlatTableProducer.src = "muonCSCDigis:MuonCSCALCTDigi:" +cscAlctDigiFlatTableProducer.doc = "CSC ALCT digi information" + +cscAlctDigiFlatTableProducer.variables = cms.PSet( + keyWireGroup = Var("getKeyWG()", "int8", doc = ""), + wireGroup = Var("getWireGroup()", "int8", doc=""), + bx = Var("getBX()", "int8", doc="") +) + +cscAlctDigiFlatTableProducer.detIdVariables = cms.PSet( + endcap = DetIdVar("endcap()", "int8", doc = ""), + station = DetIdVar("station()", "int8", doc = ""), + ring = DetIdVar("ring()", "int8", doc = ""), + chamber = DetIdVar("chamber()", "int8", doc = ""), + layer = DetIdVar("layer()", "int8", doc = "") +) + muDigiProducers = cms.Sequence(dtDigiFlatTableProducer + rpcDigiFlatTableProducer + gemDigiFlatTableProducer + gemohStatusFlatTableProducer - ) + ) + +muDigiProducersBkg = cms.Sequence(dtDigiFlatTableProducer + + rpcDigiFlatTableProducer + + cscAlctDigiFlatTableProducer + + cscWireDigiFlatTableProducer + + gemDigiFlatTableProducer + + gemohStatusFlatTableProducer + ) diff --git a/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py b/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py index 57bf81dbb0c74..20b8fa0e330ae 100644 --- a/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py +++ b/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py @@ -5,7 +5,7 @@ from PhysicsTools.NanoAOD.common_cff import * from DPGAnalysis.MuonTools.common_cff import * -dtSegmentFlatTableProducer.name = "dtSegmentT" +dtSegmentFlatTableProducer.name = "dtSegment" dtSegmentFlatTableProducer.src = "dt4DSegments" dtSegmentFlatTableProducer.doc = "DT segment information" @@ -47,9 +47,11 @@ seg4D_dirGlb_eta = GlobGeomVar("eta()", doc = "direction eta in global coordinates"), ) +from DPGAnalysis.MuonTools.muDTSegmentExtTableProducer_cfi import muDTSegmentExtTableProducer + from DPGAnalysis.MuonTools.rpcRecHitFlatTableProducer_cfi import rpcRecHitFlatTableProducer -rpcRecHitFlatTableProducer.name = "rpcRecHitT" +rpcRecHitFlatTableProducer.name = "rpcRecHit" rpcRecHitFlatTableProducer.src = "rpcRecHits" rpcRecHitFlatTableProducer.doc = "RPC rec-hit information" @@ -82,7 +84,7 @@ from DPGAnalysis.MuonTools.gemRecHitFlatTableProducer_cfi import gemRecHitFlatTableProducer -gemRecHitFlatTableProducer.name = "gemRecHitT" +gemRecHitFlatTableProducer.name = "gemRecHit" gemRecHitFlatTableProducer.src = "gemRecHits" gemRecHitFlatTableProducer.doc = "GEM rec-hit information" @@ -116,7 +118,7 @@ from DPGAnalysis.MuonTools.gemSegmentFlatTableProducer_cfi import gemSegmentFlatTableProducer -gemSegmentFlatTableProducer.name = "gemSegT" +gemSegmentFlatTableProducer.name = "gemSegment" gemSegmentFlatTableProducer.src = "gemSegments" gemSegmentFlatTableProducer.doc = "GEM segment information" @@ -154,5 +156,6 @@ muLocalRecoProducers = cms.Sequence(rpcRecHitFlatTableProducer + gemRecHitFlatTableProducer + dtSegmentFlatTableProducer + + muDTSegmentExtTableProducer + gemSegmentFlatTableProducer ) diff --git a/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py b/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py index bfe2df7473d0c..1d4716f5099bf 100644 --- a/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py +++ b/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py @@ -3,15 +3,14 @@ from PhysicsTools.NanoAOD.common_cff import * from DPGAnalysis.MuonTools.common_cff import * -from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi import simpleCandidateFlatTableProducer from PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi import * muonFlatTableProducer = simpleCandidateFlatTableProducer.clone( src = cms.InputTag("patMuons"), - name = cms.string("muonT"), - doc = cms.string("DT digi information"), + name = cms.string("muon"), + doc = cms.string("RECO muon information"), variables = cms.PSet(CandVars, # CB is this including eta isGlobal = Var("isGlobalMuon", bool, doc="muon is a global muon"), @@ -25,8 +24,8 @@ isMedium = Var("passed('CutBasedIdMedium')", bool, doc="Medium muon ID"), isTight = Var("passed('CutBasedIdTight')", bool, doc="Tight muon ID"), - pfIso04 = Var("(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt", float, doc="Relative PF-isolation (delta beta corrected, 0.4 cone)", precision=6), - trkIso03 = Var("isolationR03().sumPt/tunePMuonBestTrack().pt", float, doc="Relative tracker isolation (0.3 cone)", precision=6), + pfIso04 = Var("(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt", float, doc="relative PF-isolation (delta beta corrected, 0.4 cone)", precision=6), + trkIso03 = Var("isolationR03().sumPt/tunePMuonBestTrack().pt", float, doc="relative tracker isolation (0.3 cone)", precision=6), trk_dz = Var(f"?!innerTrack().isNull()? dB('PVDZ') : {defaults.FLOAT}", float, doc="dz (with sign) wrt first PV - cm", precision=10), trk_dxy = Var(f"?!innerTrack().isNull()? dB('PV2D') : {defaults.FLOAT}", float, doc="dxy (with sign) wrt first PV - cm", precision=10), @@ -49,14 +48,19 @@ ) ) -from DPGAnalysis.MuonTools.muNtupleMuonFiller_cfi import muNtupleMuonFiller +from DPGAnalysis.MuonTools.muDTMuonExtTableProducer_cfi import muDTMuonExtTableProducer + +from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy -from DPGAnalysis.MuonTools.muNtupleGEMMuonFiller_cfi import muNtupleGEMMuonFiller -muNtupleGEMMuonFiller.ServiceParameters = MuonServiceProxy.ServiceParameters +from DPGAnalysis.MuonTools.muGEMMuonExtTableProducer_cfi import muGEMMuonExtTableProducer +muGEMMuonExtTableProducer.ServiceParameters = MuonServiceProxy.ServiceParameters -from DPGAnalysis.MuonTools.muNtupleCSCTnPFiller_cfi import muNtupleCSCTnPFiller -muNtupleCSCTnPFiller.ServiceParameters = MuonServiceProxy.ServiceParameters +from DPGAnalysis.MuonTools.muCSCTnPFlatTableProducer_cfi import muCSCTnPFlatTableProducer +muCSCTnPFlatTableProducer.ServiceParameters = MuonServiceProxy.ServiceParameters muRecoProducers = cms.Sequence(patMuons + muonFlatTableProducer + + muDTMuonExtTableProducer + + muGEMMuonExtTableProducer + + muCSCTnPFlatTableProducer ) diff --git a/DPGAnalysis/MuonTools/src/MuDigiBaseProducer.h b/DPGAnalysis/MuonTools/src/MuDigiBaseProducer.h index d814244cc5a31..27d161fa233c5 100644 --- a/DPGAnalysis/MuonTools/src/MuDigiBaseProducer.h +++ b/DPGAnalysis/MuonTools/src/MuDigiBaseProducer.h @@ -84,11 +84,11 @@ class MuDigiBaseProducer : public SimpleFlatTableProducerBase fillTable(const edm::Event &iEvent, - const edm::Handle &prod) const override { + const edm::Handle &prod) const override { std::vector digis; std::vector detIds; - std::list detIdObjs; // CB needed to store DetIds (they are transient) - + std::list detIdObjs; // CB needed to store DetIds (they are transient) + if (prod.isValid()) { auto detIdIt = prod->begin(); auto detIdEnd = prod->end(); @@ -97,10 +97,10 @@ class MuDigiBaseProducer : public SimpleFlatTableProducerBase(digis.size(), this->name_, false, this->extension_); for (const auto &var : this->vars_) { diff --git a/DPGAnalysis/MuonTools/src/MuRecObjBaseProducer.h b/DPGAnalysis/MuonTools/src/MuLocalRecoBaseProducer.h similarity index 98% rename from DPGAnalysis/MuonTools/src/MuRecObjBaseProducer.h rename to DPGAnalysis/MuonTools/src/MuLocalRecoBaseProducer.h index cde1fdce794c2..c077cccf1a48b 100644 --- a/DPGAnalysis/MuonTools/src/MuRecObjBaseProducer.h +++ b/DPGAnalysis/MuonTools/src/MuLocalRecoBaseProducer.h @@ -68,7 +68,7 @@ class MuRecObjBaseProducer std::unique_ptr> detVarPtr; if (type == "int") { - detVarPtr = std::move(std::make_unique(name, varCfg)); // Cb can improve? + detVarPtr = std::move(std::make_unique(name, varCfg)); // Cb can improve? } else if (type == "uint") { detVarPtr = std::move(std::make_unique(name, varCfg)); } else if (type == "int8") { @@ -94,7 +94,7 @@ class MuRecObjBaseProducer varNames = varCfgs.getParameterNamesForType(); std::transform(varNames.begin(), varNames.end(), std::back_inserter(globalDirVars_), [&](const auto &name) { - return std::make_unique(name, varCfgs.getParameter(name)); + return std::make_unique(name, varCfgs.getParameter(name)); }); } } @@ -151,7 +151,7 @@ class MuRecObjBaseProducer std::vector globalDirections; // CB needed to store DetIds, global points and vectors (they are transient) - std::list detIdObjs; + std::list detIdObjs; std::list globalPointObjs; std::list globalVectorObjs;