From 7095d7ad4fb03431e6fa19fc90ee589a4c1e6028 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Fri, 15 May 2026 11:23:56 -0500 Subject: [PATCH 1/2] Move stored types in io_v1 namespace, reset class versions to 3 The io_v1 namespace allows schema evolution of complex cases (e.g. pointed-to container type of edm::Ref being changed) that ROOT's schema evolution can not support. Moving classes to io_v1 breaks backwards compatibility for these types that was agreed to be done in CMSSW_20_0_0 that serves a start of Phase 2 (only) targeting software. Taking advantage of the backwards compatiblity break, the class versions are reset to 3. In addition, include two complex schema evolution cases that were too difficult earlier - Make PFCandidate to no longer inherit from CompositeCandidate - Reduce use of RangeMap in muon code --- .../interface/AlignmentGlobalTrackSelector.h | 4 +- .../interface/MillePedeMonitor.h | 5 +- .../SUSYBSMObjects/src/classes_def.xml | 25 +- .../TopObjects/src/classes_def.xml | 56 +- .../TrackInfo/src/classes_def.xml | 17 +- .../MuonTools/interface/MuNtupleUtils.h | 3 +- .../src/DTLocalTriggerBaseTask.h | 3 +- .../plugins/GEMEffByGEMCSCSegmentSource.cc | 6 +- .../plugins/tracking/SiStripFineDelayTOF.h | 1 + DataFormats/Alignment/src/classes_def.xml | 18 +- DataFormats/BTauReco/interface/BaseTagInfo.h | 34 +- DataFormats/BTauReco/interface/IPTagInfo.h | 2 +- DataFormats/BTauReco/interface/JetTagInfo.h | 38 +- .../BTauReco/interface/PixelClusterTagInfo.h | 127 +- .../TemplatedSecondaryVertexTagInfo.h | 2 +- .../interface/TemplatedSoftLeptonTagInfo.h | 2 +- DataFormats/BTauReco/src/classes_def.xml | 300 +- DataFormats/BeamSpot/interface/BeamSpot.h | 280 +- DataFormats/BeamSpot/interface/BeamSpotFwd.h | 7 +- DataFormats/BeamSpot/src/BeamSpot.cc | 144 +- DataFormats/BeamSpot/src/classes_def.xml | 7 +- DataFormats/CLHEP/src/classes_def.xml | 27 +- DataFormats/CSCDigi/interface/CSCALCTDigi.h | 193 +- .../CSCDigi/interface/CSCALCTDigiFwd.h | 5 +- DataFormats/CSCDigi/interface/CSCCLCTDigi.h | 354 +- .../CSCDigi/interface/CSCCLCTDigiFwd.h | 5 +- .../CSCDigi/interface/CSCCLCTPreTriggerDigi.h | 200 +- .../CSCDigi/interface/CSCComparatorDigi.h | 88 +- .../CSCDigi/interface/CSCComparatorDigiFwd.h | 5 +- .../CSCDigi/interface/CSCCorrelatedLCTDigi.h | 500 +-- .../interface/CSCCorrelatedLCTDigiFwd.h | 5 +- .../interface/CSCDCCFormatStatusDigi.h | 358 +- DataFormats/CSCDigi/interface/CSCShowerDigi.h | 115 +- DataFormats/CSCDigi/interface/CSCStripDigi.h | 144 +- .../CSCDigi/interface/CSCStripDigiFwd.h | 5 +- DataFormats/CSCDigi/interface/CSCWireDigi.h | 82 +- .../CSCDigi/interface/CSCWireDigiFwd.h | 5 +- DataFormats/CSCDigi/src/CSCALCTDigi.cc | 234 +- DataFormats/CSCDigi/src/CSCCLCTDigi.cc | 408 +-- .../CSCDigi/src/CSCCLCTPreTriggerDigi.cc | 214 +- DataFormats/CSCDigi/src/CSCComparatorDigi.cc | 204 +- .../CSCDigi/src/CSCCorrelatedLCTDigi.cc | 347 +- .../CSCDigi/src/CSCDCCFormatStatusDigi.cc | 157 +- DataFormats/CSCDigi/src/CSCShowerDigi.cc | 168 +- DataFormats/CSCDigi/src/CSCStripDigi.cc | 106 +- DataFormats/CSCDigi/src/CSCWireDigi.cc | 127 +- DataFormats/CSCDigi/src/classes_def.xml | 175 +- DataFormats/CSCRecHit/interface/CSCRecHit2D.h | 252 +- .../interface/CSCRecHit2DCollection.h | 12 +- DataFormats/CSCRecHit/interface/CSCSegment.h | 118 +- .../interface/CSCSegmentCollection.h | 14 +- DataFormats/CSCRecHit/src/CSCRecHit2D.cc | 392 +- DataFormats/CSCRecHit/src/CSCSegment.cc | 338 +- DataFormats/CSCRecHit/src/classes_def.xml | 49 +- .../CTPPSDigi/interface/CTPPSDiamondDigi.h | 138 +- .../CTPPSDigi/interface/CTPPSPixelDataError.h | 80 +- .../CTPPSDigi/interface/CTPPSPixelDigi.h | 87 +- .../CTPPSDigi/interface/TotemFEDInfo.h | 68 +- DataFormats/CTPPSDigi/interface/TotemRPDigi.h | 26 +- .../CTPPSDigi/interface/TotemTimingDigi.h | 179 +- .../CTPPSDigi/interface/TotemVFATStatus.h | 116 +- DataFormats/CTPPSDigi/src/TotemVFATStatus.cc | 10 +- DataFormats/CTPPSDigi/src/classes_def.xml | 132 +- .../interface/CTPPSDiamondLocalTrack.h | 52 +- .../CTPPSReco/interface/CTPPSDiamondRecHit.h | 92 +- .../CTPPSReco/interface/CTPPSLocalTrackLite.h | 270 +- .../interface/CTPPSLocalTrackLiteFwd.h | 5 +- .../CTPPSReco/interface/CTPPSPixelCluster.h | 188 +- .../interface/CTPPSPixelLocalTrack.h | 351 +- .../CTPPSReco/interface/CTPPSPixelRecHit.h | 128 +- .../interface/CTPPSTimingLocalTrack.h | 102 +- .../CTPPSReco/interface/CTPPSTimingRecHit.h | 64 +- .../CTPPSReco/interface/TotemRPCluster.h | 50 +- .../CTPPSReco/interface/TotemRPLocalTrack.h | 176 +- .../CTPPSReco/interface/TotemRPRecHit.h | 49 +- .../CTPPSReco/interface/TotemRPUVPattern.h | 58 +- .../interface/TotemTimingLocalTrack.h | 14 +- .../CTPPSReco/interface/TotemTimingRecHit.h | 82 +- .../CTPPSReco/src/CTPPSTimingLocalTrack.cc | 41 +- .../CTPPSReco/src/TotemRPLocalTrack.cc | 26 +- DataFormats/CTPPSReco/src/TotemRPUVPattern.cc | 55 +- DataFormats/CTPPSReco/src/classes_def.xml | 404 +-- .../CaloRecHit/interface/CaloCluster.h | 425 +-- .../CaloRecHit/interface/CaloClusterFwd.h | 7 +- DataFormats/CaloRecHit/src/CaloCluster.cc | 2 +- DataFormats/CaloRecHit/src/classes_def.xml | 38 +- DataFormats/CaloTowers/interface/CaloTower.h | 436 +-- .../CaloTowers/interface/CaloTowerFwd.h | 5 +- DataFormats/CaloTowers/src/CaloTower.cc | 513 +-- DataFormats/CaloTowers/src/classes_def.xml | 50 +- DataFormats/Candidate/interface/Candidate.h | 521 +-- .../Candidate/interface/CandidateFwd.h | 6 +- .../Candidate/interface/CandidateOnlyFwd.h | 7 +- .../Candidate/interface/CandidateWithRef.h | 2 +- .../Candidate/interface/CompositeCandidate.h | 142 +- .../interface/CompositeCandidateFwd.h | 7 +- .../interface/CompositePtrCandidate.h | 136 +- .../interface/CompositeRefCandidateT.h | 2 +- .../Candidate/interface/LeafRefCandidateT.h | 344 +- .../interface/VertexCompositeCandidate.h | 115 +- .../interface/VertexCompositeCandidateFwd.h | 5 +- .../VertexCompositeCandidateOnlyFwd.h | 7 +- .../interface/VertexCompositePtrCandidate.h | 226 +- .../VertexCompositePtrCandidateFwd.h | 7 +- .../Candidate/src/CompositePtrCandidate.cc | 1 + DataFormats/Candidate/src/classes_def.xml | 259 +- DataFormats/CastorReco/src/classes_def.xml | 24 +- DataFormats/Common/interface/Association.h | 2 +- DataFormats/Common/interface/AssociationMap.h | 2 +- .../Common/interface/AssociationVector.h | 2 +- DataFormats/Common/interface/BaseHolder.h | 2 +- .../Common/interface/CMS_CLASS_VERSION.h | 2 +- DataFormats/Common/interface/ContainerMask.h | 2 +- DataFormats/Common/interface/DetSet.h | 2 +- .../Common/interface/DetSetRefVector.h | 2 +- DataFormats/Common/interface/DetSetVector.h | 2 +- .../Common/interface/DetSetVectorNew.h | 2 +- .../Common/interface/ErrorSummaryEntry.h | 59 +- DataFormats/Common/interface/FwdPtr.h | 2 +- DataFormats/Common/interface/FwdRef.h | 2 +- DataFormats/Common/interface/Holder.h | 2 +- DataFormats/Common/interface/IdToHitRange.h | 220 ++ DataFormats/Common/interface/IndirectHolder.h | 2 +- .../Common/interface/IndirectVectorHolder.h | 2 +- .../Common/interface/MultiAssociation.h | 2 +- DataFormats/Common/interface/OwnVector.h | 2 +- DataFormats/Common/interface/Ptr.h | 2 +- DataFormats/Common/interface/PtrVector.h | 2 +- DataFormats/Common/interface/RangeMap.h | 2 +- DataFormats/Common/interface/Ref.h | 4 +- DataFormats/Common/interface/RefHolder_.h | 2 +- DataFormats/Common/interface/RefProd.h | 2 +- DataFormats/Common/interface/RefToBase.h | 2 +- DataFormats/Common/interface/RefToBaseProd.h | 2 +- .../Common/interface/RefToBaseVector.h | 2 +- DataFormats/Common/interface/RefVector.h | 2 +- DataFormats/Common/interface/RefVectorBase.h | 2 +- .../Common/interface/RefVectorHolder.h | 2 +- .../Common/interface/SortedCollection.h | 2 +- DataFormats/Common/interface/ValueMap.h | 2 +- DataFormats/Common/interface/VectorHolder.h | 2 +- DataFormats/Common/src/classes_def.xml | 93 +- DataFormats/Common/test/IdToHitRange_t.cpp | 440 +++ DataFormats/DTDigi/interface/DTDigi.h | 93 +- DataFormats/DTDigi/interface/DTDigiFwd.h | 5 +- .../DTDigi/interface/DTuROSControlData.h | 67 +- .../DTDigi/interface/DTuROSFEDDataFwd.h | 5 +- DataFormats/DTDigi/src/DTDigi.cc | 58 +- DataFormats/DTDigi/src/classes_def.xml | 109 +- DataFormats/DTRecHit/interface/DTRecHit1D.h | 115 +- .../DTRecHit/interface/DTRecHit1DFwd.h | 5 +- .../DTRecHit/interface/DTRecHit1DPair.h | 124 +- .../DTRecHit/interface/DTRecHitCollection.h | 7 +- .../DTRecHit/interface/DTRecSegment4D.h | 176 +- .../interface/DTRecSegment4DCollection.h | 9 +- .../DTRecHit/interface/DTRecSegment4DFwd.h | 5 +- DataFormats/DTRecHit/src/DTRecHit1D.cc | 126 +- DataFormats/DTRecHit/src/DTRecHit1DPair.cc | 220 +- DataFormats/DTRecHit/src/DTRecSegment4D.cc | 466 +-- DataFormats/DTRecHit/src/classes_def.xml | 72 +- DataFormats/DTRecHit/test/BuildFile.xml | 4 + .../test/test_catch2_DTRangeMapAccessor.cc | 85 + DataFormats/EcalDetId/interface/EBDetId.h | 284 +- DataFormats/EcalDetId/interface/EBDetIdFwd.h | 5 +- DataFormats/EcalDetId/interface/EEDetId.h | 272 +- DataFormats/EcalDetId/interface/EEDetIdFwd.h | 5 +- .../EcalDetId/interface/EcalElectronicsId.h | 152 +- .../interface/EcalElectronicsIdFwd.h | 5 +- DataFormats/EcalDetId/src/EBDetId.cc | 9 +- DataFormats/EcalDetId/src/EEDetId.cc | 8 +- DataFormats/EcalDetId/src/classes_def.xml | 86 +- .../EcalDigi/interface/EBDigiCollectionFwd.h | 5 +- DataFormats/EcalDigi/interface/EBSrFlag.h | 45 +- .../EcalDigi/interface/EEDigiCollectionFwd.h | 6 +- DataFormats/EcalDigi/interface/EESrFlag.h | 49 +- .../EcalDigi/interface/ESDigiCollectionFwd.h | 5 +- .../EcalDigi/interface/EcalDigiCollections.h | 124 +- .../interface/EcalEBTriggerPrimitiveDigi.h | 75 +- .../EcalDigi/interface/EcalPnDiodeDigi.h | 39 +- .../interface/EcalPseudoStripInputDigi.h | 58 +- DataFormats/EcalDigi/interface/EcalTimeDigi.h | 87 +- .../interface/EcalTrigPrimCompactColl.h | 143 +- .../interface/EcalTriggerPrimitiveDigi.h | 92 +- .../src/EcalEBTriggerPrimitiveDigi.cc | 14 +- .../EcalDigi/src/EcalTriggerPrimitiveDigi.cc | 14 +- DataFormats/EcalDigi/src/classes_def.xml | 162 +- .../interface/EcalDCCHeaderBlock.h | 346 +- DataFormats/EcalRawData/src/classes_def.xml | 32 +- DataFormats/EcalRecHit/interface/EcalRecHit.h | 385 +- .../interface/EcalRecHitComparison.h | 17 +- .../EcalRecHit/interface/EcalRecHitFwd.h | 5 +- DataFormats/EcalRecHit/src/EcalRecHit.cc | 22 +- DataFormats/EcalRecHit/src/classes_def.xml | 47 +- .../EgammaCandidates/interface/Conversion.h | 436 +-- .../interface/ConversionFwd.h | 5 +- .../EgammaCandidates/interface/Electron.h | 74 +- .../EgammaCandidates/interface/ElectronFwd.h | 5 +- .../EgammaCandidates/interface/GsfElectron.h | 1805 +++++----- .../interface/GsfElectronCore.h | 105 +- .../interface/GsfElectronCoreFwd.h | 5 +- .../interface/GsfElectronFwd.h | 7 +- .../EgammaCandidates/interface/Photon.h | 1181 +++--- .../EgammaCandidates/interface/PhotonCore.h | 130 +- .../interface/PhotonCoreFwd.h | 5 +- .../EgammaCandidates/interface/PhotonFwd.h | 5 +- .../EgammaCandidates/src/classes_def.xml | 507 ++- .../EgammaReco/interface/ElectronSeed.h | 213 +- .../EgammaReco/interface/ElectronSeedFwd.h | 5 +- .../EgammaReco/interface/HFEMClusterShape.h | 85 +- .../interface/HFEMClusterShapeFwd.h | 5 +- .../EgammaReco/interface/PreshowerCluster.h | 69 +- .../interface/PreshowerClusterFwd.h | 5 +- .../interface/PreshowerClusterShape.h | 49 +- .../interface/PreshowerClusterShapeFwd.h | 5 +- .../EgammaReco/interface/SuperCluster.h | 323 +- .../EgammaReco/interface/SuperClusterFwd.h | 5 +- DataFormats/EgammaReco/src/classes_def.xml | 166 +- DataFormats/FEDRawData/src/classes_def.xml | 22 +- DataFormats/FTLDigi/interface/BTLSample.h | 123 +- DataFormats/FTLDigi/interface/ETLSample.h | 151 +- .../FTLDigi/interface/PMTDSimAccumulator.h | 257 +- DataFormats/FTLDigi/src/classes_def.xml | 29 +- DataFormats/FTLRecHit/interface/FTLCluster.h | 464 +-- DataFormats/FTLRecHit/interface/FTLRecHit.h | 174 +- .../FTLRecHit/interface/FTLRecHitComparison.h | 17 +- .../interface/FTLUncalibratedRecHit.h | 120 +- DataFormats/FTLRecHit/src/FTLRecHit.cc | 101 +- DataFormats/FTLRecHit/src/classes_def.xml | 55 +- DataFormats/FWLite/src/classes_def.xml | 19 +- DataFormats/ForwardDetId/interface/BTLDetId.h | 365 +- DataFormats/ForwardDetId/interface/ETLDetId.h | 451 +-- DataFormats/ForwardDetId/interface/MTDDetId.h | 128 +- DataFormats/ForwardDetId/src/BTLDetId.cc | 32 +- DataFormats/ForwardDetId/src/ETLDetId.cc | 30 +- DataFormats/ForwardDetId/src/MTDDetId.cc | 38 +- DataFormats/ForwardDetId/src/classes_def.xml | 49 +- .../GEMDigi/interface/GEMAMC13Status.h | 111 +- DataFormats/GEMDigi/interface/GEMAMCStatus.h | 149 +- DataFormats/GEMDigi/interface/GEMCoPadDigi.h | 43 +- DataFormats/GEMDigi/interface/GEMDigi.h | 39 +- DataFormats/GEMDigi/interface/GEMOHStatus.h | 168 +- DataFormats/GEMDigi/interface/GEMPadDigi.h | 79 +- .../GEMDigi/interface/GEMPadDigiCluster.h | 87 +- .../GEMDigi/interface/GEMPadDigiClusterFwd.h | 5 +- DataFormats/GEMDigi/interface/GEMVFATStatus.h | 130 +- DataFormats/GEMDigi/src/GEMCoPadDigi.cc | 88 +- DataFormats/GEMDigi/src/GEMDigi.cc | 40 +- DataFormats/GEMDigi/src/GEMPadDigi.cc | 72 +- DataFormats/GEMDigi/src/GEMPadDigiCluster.cc | 108 +- DataFormats/GEMDigi/src/classes_def.xml | 166 +- .../GEMRecHit/interface/GEMCSCSegment.h | 105 +- .../interface/GEMCSCSegmentCollection.h | 6 +- DataFormats/GEMRecHit/interface/GEMRecHit.h | 116 +- .../GEMRecHit/interface/GEMRecHitCollection.h | 9 +- DataFormats/GEMRecHit/interface/GEMSegment.h | 123 +- .../interface/GEMSegmentCollection.h | 9 +- .../GEMRecHit/interface/ME0RecHitCollection.h | 8 +- .../interface/ME0SegmentCollection.h | 6 +- DataFormats/GEMRecHit/src/GEMCSCSegment.cc | 200 +- DataFormats/GEMRecHit/src/GEMRecHit.cc | 137 +- DataFormats/GEMRecHit/src/GEMSegment.cc | 248 +- DataFormats/GEMRecHit/src/classes_def.xml | 82 +- .../GeometryCommonDetAlgo/src/classes_def.xml | 8 +- .../GeometrySurface/src/classes_def.xml | 4 +- .../GeometryVector/src/classes_def.xml | 152 +- DataFormats/GsfTrackReco/interface/GsfTrack.h | 188 +- .../GsfTrackReco/interface/GsfTrackExtra.h | 134 +- .../GsfTrackReco/interface/GsfTrackExtraFwd.h | 5 +- .../GsfTrackReco/interface/GsfTrackFwd.h | 5 +- DataFormats/GsfTrackReco/src/classes_def.xml | 64 +- DataFormats/HGCDigi/interface/HGCSample.h | 200 +- DataFormats/HGCDigi/src/classes_def.xml | 20 +- DataFormats/HGCRecHit/interface/HGCRecHit.h | 218 +- DataFormats/HGCRecHit/src/HGCRecHit.cc | 216 +- DataFormats/HGCRecHit/src/classes_def.xml | 55 +- .../HGCalDigi/interface/PHGCSimAccumulator.h | 257 +- DataFormats/HGCalDigi/src/classes_def.xml | 18 +- .../HGCalReco/interface/TICLCandidate.h | 259 +- DataFormats/HGCalReco/interface/Trackster.h | 471 +-- .../HGCalReco/interface/TracksterFwd.h | 7 +- DataFormats/HGCalReco/src/classes_def.xml | 35 +- .../HLTReco/interface/TriggerEventWithRefs.h | 1491 ++++---- .../interface/TriggerFilterObjectWithRefs.h | 100 +- .../TriggerFilterObjectWithRefsFwd.h | 8 +- .../interface/TriggerRefsCollections.h | 3198 +++++++++-------- DataFormats/HLTReco/src/classes_def.xml | 83 +- .../HcalCalibObjects/src/classes_def.xml | 24 +- DataFormats/HcalDetId/src/classes_def.xml | 81 +- .../HcalDigi/interface/HBHEDataFrame.h | 166 +- .../HcalDigi/interface/HBHEDataFrameFwd.h | 5 +- DataFormats/HcalDigi/interface/HFDataFrame.h | 166 +- .../HcalDigi/interface/HFDataFrameFwd.h | 6 +- DataFormats/HcalDigi/interface/HODataFrame.h | 166 +- .../HcalDigi/interface/HODataFrameFwd.h | 6 +- .../interface/HcalTriggerPrimitiveDigi.h | 88 +- .../HcalDigi/interface/HcalUnpackerReport.h | 124 +- .../HcalDigi/interface/QIE10DataFrame.h | 234 +- .../HcalDigi/interface/QIE10DataFrameFwd.h | 5 +- .../HcalDigi/interface/QIE11DataFrame.h | 237 +- .../HcalDigi/interface/QIE11DataFrameFwd.h | 6 +- DataFormats/HcalDigi/interface/ZDCDataFrame.h | 84 +- .../HcalDigi/interface/ZDCDataFrameFwd.h | 5 +- DataFormats/HcalDigi/src/HBHEDataFrame.cc | 35 +- DataFormats/HcalDigi/src/HFDataFrame.cc | 35 +- DataFormats/HcalDigi/src/HODataFrame.cc | 34 +- .../HcalDigi/src/HcalTriggerPrimitiveDigi.cc | 72 +- DataFormats/HcalDigi/src/QIE10DataFrame.cc | 46 +- DataFormats/HcalDigi/src/QIE11DataFrame.cc | 44 +- DataFormats/HcalDigi/src/ZDCDataFrame.cc | 134 +- DataFormats/HcalDigi/src/classes_def.xml | 114 +- .../HcalIsolatedTrack/src/classes_def.xml | 26 +- DataFormats/HcalRecHit/interface/HBHERecHit.h | 144 +- .../HcalRecHit/interface/HBHERecHitFwd.h | 5 +- .../HcalRecHit/interface/HFPreRecHit.h | 130 +- DataFormats/HcalRecHit/interface/HFRecHit.h | 56 +- DataFormats/HcalRecHit/interface/HORecHit.h | 22 +- DataFormats/HcalRecHit/interface/ZDCRecHit.h | 62 +- DataFormats/HcalRecHit/src/HBHERecHit.cc | 66 +- DataFormats/HcalRecHit/src/HFRecHit.cc | 14 +- DataFormats/HcalRecHit/src/HORecHit.cc | 8 +- DataFormats/HcalRecHit/src/ZDCRecHit.cc | 26 +- DataFormats/HcalRecHit/src/classes_def.xml | 143 +- DataFormats/HeavyIonEvent/src/classes_def.xml | 14 +- .../HepMCCandidate/interface/GenParticle.h | 192 +- .../HepMCCandidate/interface/GenParticleFwd.h | 5 +- .../HepMCCandidate/src/classes_def.xml | 52 +- .../JetMatching/interface/JetFlavourInfo.h | 87 +- .../interface/JetFlavourInfoMatching.h | 21 +- DataFormats/JetMatching/src/classes_def.xml | 45 +- DataFormats/JetReco/interface/BasicJet.h | 45 +- DataFormats/JetReco/interface/CaloJet.h | 269 +- DataFormats/JetReco/interface/CaloJetFwd.h | 7 +- DataFormats/JetReco/interface/GenJet.h | 232 +- DataFormats/JetReco/interface/GenJetFwd.h | 7 +- DataFormats/JetReco/interface/JPTJet.h | 227 +- DataFormats/JetReco/interface/Jet.h | 167 +- .../interface/JetExtendedAssociation.h | 27 +- DataFormats/JetReco/interface/JetFwd.h | 5 +- DataFormats/JetReco/interface/JetID.h | 92 +- DataFormats/JetReco/interface/PFJet.h | 343 +- .../JetReco/interface/PFJetCollection.h | 5 +- .../JetReco/interface/TrackExtrapolation.h | 59 +- DataFormats/JetReco/interface/TrackJet.h | 73 +- DataFormats/JetReco/src/PFJet.cc | 3 +- DataFormats/JetReco/src/classes_def_1.xml | 161 +- DataFormats/JetReco/src/classes_def_2.xml | 34 +- DataFormats/JetReco/src/classes_def_3.xml | 80 +- DataFormats/JetReco/src/classes_def_4.xml | 88 +- .../interface/L1CSCSPStatusDigi.h | 90 +- .../L1CSCTrackFinder/interface/L1Track.h | 233 +- .../L1CSCTrackFinder/interface/TrackStub.h | 88 +- .../L1CSCTrackFinder/interface/TrackStubFwd.h | 7 +- DataFormats/L1CSCTrackFinder/src/L1Track.cc | 290 +- .../L1CSCTrackFinder/src/classes_def.xml | 44 +- .../L1CaloTrigger/interface/L1CaloEmCand.h | 116 +- .../L1CaloTrigger/interface/L1CaloEmCandFwd.h | 5 +- .../L1CaloTrigger/interface/L1CaloRegion.h | 282 +- .../interface/L1CaloRegionDetId.h | 64 +- .../L1CaloTrigger/interface/L1CaloRegionFwd.h | 6 +- DataFormats/L1CaloTrigger/src/L1CaloEmCand.cc | 102 +- DataFormats/L1CaloTrigger/src/L1CaloRegion.cc | 294 +- DataFormats/L1CaloTrigger/src/classes_def.xml | 21 +- .../interface/L1MuDTChambPhContainer.h | 40 +- .../interface/L1MuDTChambPhContainerFwd.h | 6 +- .../interface/L1MuDTChambThContainer.h | 38 +- .../interface/L1MuDTChambThContainerFwd.h | 6 +- .../interface/L1MuDTTrackContainer.h | 40 +- .../interface/L1Phase2MuDTExtPhContainer.h | 25 +- .../interface/L1Phase2MuDTExtPhDigi.h | 109 +- .../interface/L1Phase2MuDTExtPhiThetaPair.h | 51 +- .../L1Phase2MuDTExtPhiThetaPairContainer.h | 25 +- .../interface/L1Phase2MuDTExtThContainer.h | 25 +- .../interface/L1Phase2MuDTExtThDigi.h | 101 +- .../interface/L1Phase2MuDTPhContainer.h | 25 +- .../interface/L1Phase2MuDTPhDigi.h | 71 +- .../interface/L1Phase2MuDTPhDigiFwd.h | 9 + .../interface/L1Phase2MuDTShower.h | 85 +- .../interface/L1Phase2MuDTShowerContainer.h | 25 +- .../interface/L1Phase2MuDTThContainer.h | 25 +- .../interface/L1Phase2MuDTThDigi.h | 65 +- .../src/L1Phase2MuDTExtPhContainer.cc | 20 +- .../src/L1Phase2MuDTExtPhDigi.cc | 170 +- .../src/L1Phase2MuDTExtPhiThetaPair.cc | 12 +- .../L1Phase2MuDTExtPhiThetaPairContainer.cc | 30 +- .../src/L1Phase2MuDTExtThContainer.cc | 20 +- .../src/L1Phase2MuDTExtThDigi.cc | 156 +- .../src/L1Phase2MuDTPhContainer.cc | 18 +- .../L1DTTrackFinder/src/L1Phase2MuDTPhDigi.cc | 88 +- .../L1DTTrackFinder/src/L1Phase2MuDTShower.cc | 128 +- .../src/L1Phase2MuDTShowerContainer.cc | 20 +- .../src/L1Phase2MuDTThContainer.cc | 12 +- .../L1DTTrackFinder/src/L1Phase2MuDTThDigi.cc | 76 +- .../L1DTTrackFinder/src/classes_def.xml | 114 +- .../L1GlobalCaloTrigger/interface/L1GctCand.h | 49 +- .../interface/L1GctCandFwd.h | 9 + .../interface/L1GctEmCand.h | 122 +- .../interface/L1GctEmCandFwd.h | 6 +- .../interface/L1GctEtHad.h | 94 +- .../interface/L1GctEtHadFwd.h | 5 +- .../interface/L1GctEtMiss.h | 94 +- .../interface/L1GctEtMissFwd.h | 6 +- .../interface/L1GctEtTotal.h | 94 +- .../interface/L1GctEtTotalFwd.h | 6 +- .../interface/L1GctFibreWord.h | 40 +- .../interface/L1GctHFBitCounts.h | 142 +- .../interface/L1GctHFBitCountsFwd.h | 6 +- .../interface/L1GctHFRingEtSums.h | 142 +- .../interface/L1GctHFRingEtSumsFwd.h | 6 +- .../interface/L1GctHtMiss.h | 96 +- .../interface/L1GctHtMissFwd.h | 6 +- .../interface/L1GctInternEmCand.h | 118 +- .../interface/L1GctInternEtSum.h | 198 +- .../interface/L1GctInternHFData.h | 176 +- .../interface/L1GctInternHtMiss.h | 262 +- .../interface/L1GctInternJetData.h | 212 +- .../interface/L1GctInternJetDataFwd.h | 6 +- .../interface/L1GctJetCand.h | 124 +- .../interface/L1GctJetCandFwd.h | 6 +- .../interface/L1GctJetCounts.h | 114 +- .../interface/L1GctJetCountsFwd.h | 6 +- .../L1GlobalCaloTrigger/src/L1GctEmCand.cc | 157 +- .../L1GlobalCaloTrigger/src/L1GctEtHad.cc | 38 +- .../L1GlobalCaloTrigger/src/L1GctEtMiss.cc | 64 +- .../L1GlobalCaloTrigger/src/L1GctEtTotal.cc | 38 +- .../L1GlobalCaloTrigger/src/L1GctFibreWord.cc | 20 +- .../src/L1GctHFBitCounts.cc | 119 +- .../src/L1GctHFRingEtSums.cc | 125 +- .../L1GlobalCaloTrigger/src/L1GctHtMiss.cc | 72 +- .../src/L1GctInternEmCand.cc | 100 +- .../src/L1GctInternEtSum.cc | 360 +- .../src/L1GctInternHFData.cc | 219 +- .../src/L1GctInternHtMiss.cc | 272 +- .../src/L1GctInternJetData.cc | 312 +- .../L1GlobalCaloTrigger/src/L1GctJetCand.cc | 158 +- .../L1GlobalCaloTrigger/src/L1GctJetCounts.cc | 120 +- .../L1GlobalCaloTrigger/src/classes_def.xml | 188 +- .../interface/L1MuGMTCand.h | 312 +- .../interface/L1MuGMTCandFwd.h | 6 +- .../interface/L1MuGMTReadoutCollection.h | 55 +- .../interface/L1MuGMTReadoutCollectionFwd.h | 6 +- .../interface/L1MuRegionalCand.h | 269 +- .../interface/L1MuRegionalCandFwd.h | 6 +- .../L1GlobalMuonTrigger/src/L1MuGMTCand.cc | 260 +- .../L1GlobalMuonTrigger/src/classes_def.xml | 35 +- .../interface/L1GlobalTriggerReadoutRecord.h | 168 +- .../L1GlobalTriggerReadoutRecordFwd.h | 6 +- .../L1GlobalTrigger/src/classes_def.xml | 82 +- .../L1TCalorimeter/interface/CaloCluster.h | 123 +- .../L1TCalorimeter/interface/CaloTower.h | 88 +- .../L1TCalorimeter/src/classes_def.xml | 12 +- .../interface/CaloCrystalCluster.h | 265 +- .../L1TCalorimeterPhase2/interface/CaloJet.h | 89 +- .../interface/CaloTower.h | 125 +- .../interface/DigitizedClusterCorrelator.h | 348 +- .../interface/DigitizedClusterGT.h | 177 +- .../interface/DigitizedTowerCorrelator.h | 161 +- .../interface/Phase2L1CaloJet.h | 165 +- .../L1TCalorimeterPhase2/src/classes_def.xml | 37 +- .../L1TCorrelator/interface/TkElectron.h | 62 +- .../L1TCorrelator/interface/TkElectronFwd.h | 5 +- DataFormats/L1TCorrelator/interface/TkEm.h | 112 +- DataFormats/L1TCorrelator/interface/TkEmFwd.h | 5 +- .../L1TCorrelator/interface/TkEtMiss.h | 95 +- .../L1TCorrelator/interface/TkEtMissFwd.h | 5 +- .../L1TCorrelator/interface/TkHTMiss.h | 85 +- .../L1TCorrelator/interface/TkHTMissFwd.h | 5 +- DataFormats/L1TCorrelator/interface/TkJet.h | 76 +- .../L1TCorrelator/interface/TkJetFwd.h | 6 +- .../L1TCorrelator/interface/TkTriplet.h | 72 +- .../L1TCorrelator/interface/TkTripletFwd.h | 5 +- DataFormats/L1TCorrelator/src/classes_def.xml | 109 +- .../L1TGlobal/interface/GlobalAlgBlk.h | 172 +- .../L1TGlobal/interface/GlobalExtBlk.h | 47 +- .../interface/GlobalObjectMapRecord.h | 1 - DataFormats/L1TGlobal/src/classes_def.xml | 23 +- DataFormats/L1THGCal/interface/HGCalCluster.h | 26 +- .../L1THGCal/interface/HGCalMulticluster.h | 137 +- DataFormats/L1THGCal/interface/HGCalTower.h | 107 +- .../L1THGCal/interface/HGCalTowerMap.h | 33 +- .../L1THGCal/interface/HGCalTriggerCell.h | 56 +- DataFormats/L1THGCal/src/classes_def.xml | 104 +- DataFormats/L1TMuon/interface/EMTFHit.h | 670 ++-- DataFormats/L1TMuon/interface/EMTFTrack.h | 412 +-- DataFormats/L1TMuon/interface/L1MuBMTrack.h | 238 +- .../L1TMuon/interface/L1MuBMTrackFwd.h | 6 +- .../L1TMuon/interface/L1MuBMTrackSegEta.h | 96 +- .../L1TMuon/interface/L1MuBMTrackSegEtaFwd.h | 6 +- .../L1TMuon/interface/L1MuBMTrackSegPhi.h | 170 +- .../L1TMuon/interface/L1MuBMTrackSegPhiFwd.h | 6 +- DataFormats/L1TMuon/interface/L1MuKBMTrack.h | 320 +- .../L1TMuon/interface/RegionalMuonCand.h | 417 +-- .../L1TMuon/interface/RegionalMuonCandFwd.h | 5 +- .../L1TMuon/interface/RegionalMuonShower.h | 113 +- DataFormats/L1TMuon/src/L1MuBMTrack.cc | 438 +-- DataFormats/L1TMuon/src/L1MuBMTrackSegEta.cc | 163 +- DataFormats/L1TMuon/src/L1MuBMTrackSegPhi.cc | 240 +- DataFormats/L1TMuon/src/L1MuKBMTrack.cc | 353 +- DataFormats/L1TMuon/src/RegionalMuonShower.cc | 90 +- DataFormats/L1TMuon/src/classes_def.xml | 60 +- .../L1TMuonPhase2/interface/MuonStub.h | 250 +- DataFormats/L1TMuonPhase2/interface/SAMuon.h | 143 +- .../L1TMuonPhase2/interface/TrackerMuon.h | 146 +- DataFormats/L1TMuonPhase2/src/classes_def.xml | 34 +- .../L1TParticleFlow/interface/PFCandidate.h | 151 +- .../L1TParticleFlow/interface/PFCluster.h | 182 +- .../L1TParticleFlow/interface/PFClusterFwd.h | 7 +- DataFormats/L1TParticleFlow/interface/PFJet.h | 166 +- DataFormats/L1TParticleFlow/interface/PFTau.h | 130 +- .../L1TParticleFlow/interface/PFTrack.h | 137 +- .../L1TParticleFlow/interface/PFTrackFwd.h | 7 +- DataFormats/L1TParticleFlow/interface/jets.h | 80 +- .../interface/layer1_emulator.h | 132 +- .../L1TParticleFlow/src/classes_def.xml | 55 +- DataFormats/L1TParticleFlow/src/jets.cpp | 35 +- .../L1TrackTrigger/src/classes_def.xml | 12 +- DataFormats/L1Trigger/interface/EGamma.h | 99 +- DataFormats/L1Trigger/interface/EtSum.h | 125 +- DataFormats/L1Trigger/interface/Jet.h | 81 +- DataFormats/L1Trigger/interface/L1Candidate.h | 82 +- .../L1Trigger/interface/L1CandidateFwd.h | 7 +- .../L1Trigger/interface/L1TriggerError.h | 38 +- DataFormats/L1Trigger/interface/Muon.h | 258 +- DataFormats/L1Trigger/interface/MuonShower.h | 118 +- .../L1Trigger/interface/P2GTAlgoBlock.h | 92 +- .../L1Trigger/interface/P2GTCandidate.h | 585 +-- DataFormats/L1Trigger/interface/Tau.h | 93 +- DataFormats/L1Trigger/interface/TkJetWord.h | 339 +- .../L1Trigger/interface/TkTripletWord.h | 449 +-- DataFormats/L1Trigger/interface/Vertex.h | 41 +- DataFormats/L1Trigger/interface/VertexWord.h | 341 +- DataFormats/L1Trigger/src/EtSum.cc | 22 +- DataFormats/L1Trigger/src/L1Candidate.cc | 22 +- DataFormats/L1Trigger/src/Muon.cc | 211 +- DataFormats/L1Trigger/src/MuonShower.cc | 50 +- DataFormats/L1Trigger/src/classes_def.xml | 216 +- DataFormats/LTCDigi/src/classes_def.xml | 5 +- DataFormats/Luminosity/src/classes_def.xml | 47 +- .../METReco/interface/BeamHaloSummary.h | 116 +- DataFormats/METReco/interface/CSCHaloData.h | 280 +- DataFormats/METReco/interface/CaloMET.h | 123 +- DataFormats/METReco/interface/CaloMETFwd.h | 5 +- DataFormats/METReco/interface/EcalHaloData.h | 71 +- DataFormats/METReco/interface/GenMET.h | 129 +- DataFormats/METReco/interface/GenMETFwd.h | 5 +- .../METReco/interface/GlobalHaloData.h | 161 +- .../interface/HaloClusterCandidateECAL.h | 125 +- .../interface/HaloClusterCandidateHCAL.h | 127 +- DataFormats/METReco/interface/HcalHaloData.h | 51 +- DataFormats/METReco/interface/MET.h | 95 +- DataFormats/METReco/interface/METFwd.h | 5 +- DataFormats/METReco/interface/PFMET.h | 103 +- DataFormats/METReco/interface/PFMETFwd.h | 5 +- .../METReco/src/HaloClusterCandidateECAL.cc | 1 + .../METReco/src/HaloClusterCandidateHCAL.cc | 1 + DataFormats/METReco/src/classes_def.xml | 221 +- DataFormats/MuonDetId/interface/CSCDetId.h | 338 +- DataFormats/MuonDetId/interface/CSCDetIdFwd.h | 5 +- DataFormats/MuonDetId/interface/DTChamberId.h | 202 +- .../MuonDetId/interface/DTChamberIdFwd.h | 5 +- DataFormats/MuonDetId/interface/DTLayerId.h | 84 +- .../MuonDetId/interface/DTLayerIdFwd.h | 5 +- DataFormats/MuonDetId/interface/GEMDetId.h | 462 +-- DataFormats/MuonDetId/interface/GEMDetIdFwd.h | 5 +- DataFormats/MuonDetId/interface/RPCDetId.h | 259 +- DataFormats/MuonDetId/interface/RPCDetIdFwd.h | 6 +- DataFormats/MuonDetId/src/CSCDetId.cc | 14 +- DataFormats/MuonDetId/src/DTChamberId.cc | 10 +- DataFormats/MuonDetId/src/DTLayerId.cc | 12 +- DataFormats/MuonDetId/src/GEMDetId.cc | 12 +- DataFormats/MuonDetId/src/RPCDetId.cc | 12 +- DataFormats/MuonDetId/src/classes.h | 1 + DataFormats/MuonDetId/src/classes_def.xml | 92 +- DataFormats/MuonReco/interface/CaloMuon.h | 108 +- DataFormats/MuonReco/interface/Muon.h | 819 ++--- .../MuonReco/interface/MuonChamberMatch.h | 61 +- .../interface/MuonCosmicCompatibility.h | 45 +- DataFormats/MuonReco/interface/MuonFwd.h | 17 +- .../interface/MuonMETCorrectionData.h | 57 +- .../MuonReco/interface/MuonSegmentMatch.h | 97 +- DataFormats/MuonReco/interface/MuonShower.h | 25 +- DataFormats/MuonReco/interface/MuonSimInfo.h | 54 +- .../MuonReco/interface/MuonTimeExtra.h | 113 +- .../MuonReco/interface/MuonTimeExtraFwd.h | 5 +- .../MuonReco/interface/MuonTrackLinks.h | 65 +- DataFormats/MuonReco/src/MuonChamberMatch.cc | 1 + DataFormats/MuonReco/src/classes_def.xml | 208 +- .../MuonSeed/interface/L2MuonTrajectorySeed.h | 77 +- DataFormats/MuonSeed/src/classes_def.xml | 43 +- DataFormats/NanoAOD/src/classes_def.xml | 14 +- .../OnlineMetaData/interface/CTPPSRecord.h | 100 +- .../OnlineMetaData/interface/DCSRecord.h | 132 +- .../interface/OnlineLuminosityRecord.h | 66 +- DataFormats/OnlineMetaData/src/CTPPSRecord.cc | 54 +- DataFormats/OnlineMetaData/src/DCSRecord.cc | 99 +- .../src/OnlineLuminosityRecord.cc | 68 +- .../OnlineMetaData/src/classes_def.xml | 26 +- .../interface/PFCandidate.h | 842 ++--- .../interface/PFCandidateFwd.h | 6 +- .../ParticleFlowCandidate/src/PFCandidate.cc | 8 +- .../ParticleFlowCandidate/src/classes_def.xml | 129 +- .../interface/HGCalMultiCluster.h | 33 +- .../ParticleFlowReco/interface/PFBlock.h | 127 +- .../interface/PFBlockElement.h | 309 +- .../ParticleFlowReco/interface/PFBlockFwd.h | 5 +- .../ParticleFlowReco/interface/PFCluster.h | 185 +- .../ParticleFlowReco/interface/PFClusterFwd.h | 5 +- .../ParticleFlowReco/interface/PFConversion.h | 2 - .../interface/PFDisplacedVertex.h | 431 +-- .../interface/PFDisplacedVertexFwd.h | 5 +- .../ParticleFlowReco/interface/PFRecHit.h | 208 +- .../interface/PFRecHitFraction.h | 39 +- .../ParticleFlowReco/interface/PFRecHitFwd.h | 5 +- .../ParticleFlowReco/interface/PreId.h | 219 +- .../ParticleFlowReco/interface/PreIdFwd.h | 5 +- DataFormats/ParticleFlowReco/src/PFBlock.cc | 2 +- .../ParticleFlowReco/src/PFBlockElement.cc | 18 +- DataFormats/ParticleFlowReco/src/PFCluster.cc | 3 +- .../ParticleFlowReco/src/PFRecHitFraction.cc | 3 +- .../ParticleFlowReco/src/classes_def_1.xml | 24 +- .../ParticleFlowReco/src/classes_def_2.xml | 257 +- .../interface/CompositeCandidate.h | 33 +- .../PatCandidates/interface/Electron.h | 744 ++-- .../PatCandidates/interface/ElectronFwd.h | 7 +- .../PatCandidates/interface/IsolatedTrack.h | 310 +- DataFormats/PatCandidates/interface/Jet.h | 1239 +++---- DataFormats/PatCandidates/interface/MET.h | 586 +-- DataFormats/PatCandidates/interface/Muon.h | 901 ++--- DataFormats/PatCandidates/interface/MuonFwd.h | 7 +- .../PatCandidates/interface/PackedCandidate.h | 2249 ++++++------ .../interface/PackedGenParticle.h | 952 ++--- .../interface/PackedTriggerPrescales.h | 125 +- DataFormats/PatCandidates/interface/Photon.h | 773 ++-- DataFormats/PatCandidates/interface/Tau.h | 902 ++--- .../PatCandidates/interface/TauPFEssential.h | 84 +- .../PatCandidates/interface/TauPFSpecific.h | 92 +- .../interface/TriggerObjectStandAlone.h | 373 +- .../PatCandidates/src/PackedCandidate.cc | 921 ++--- .../PatCandidates/src/PackedGenParticle.cc | 212 +- .../PatCandidates/src/TauPFEssential.cc | 2 +- .../PatCandidates/src/TauPFSpecific.cc | 2 +- .../PatCandidates/src/classes_def_objects.xml | 557 +-- .../PatCandidates/src/classes_def_other.xml | 35 +- .../PatCandidates/src/classes_def_trigger.xml | 55 +- .../PatCandidates/src/classes_def_user.xml | 8 +- .../interface/Phase2TrackerCluster1D.h | 64 +- .../Phase2TrackerCluster/src/classes_def.xml | 28 +- .../interface/Phase2TrackerDigi.h | 94 +- .../interface/Phase2TrackerDigiFwd.h | 5 +- .../Phase2TrackerDigi/src/classes_def.xml | 26 +- .../ProtonReco/interface/ForwardProton.h | 305 +- .../ProtonReco/interface/ForwardProtonFwd.h | 5 +- DataFormats/ProtonReco/src/classes_def.xml | 14 +- DataFormats/RPCDigi/interface/RPCDigi.h | 88 +- DataFormats/RPCDigi/interface/RPCDigiFwd.h | 6 +- DataFormats/RPCDigi/src/RPCDigi.cc | 82 +- DataFormats/RPCDigi/src/classes_def.xml | 26 +- DataFormats/RPCRecHit/interface/RPCRecHit.h | 129 +- .../RPCRecHit/interface/RPCRecHitCollection.h | 8 +- .../RPCRecHit/interface/RPCRecHitFwd.h | 6 +- DataFormats/RPCRecHit/src/RPCRecHit.cc | 160 +- DataFormats/RPCRecHit/src/classes.h | 2 + DataFormats/RPCRecHit/src/classes_def.xml | 22 +- .../RecoCandidate/interface/IsoDeposit.h | 497 +-- .../RecoCandidate/interface/IsoDepositFwd.h | 5 +- .../interface/RecoChargedCandidate.h | 55 +- .../interface/RecoChargedCandidateFwd.h | 5 +- .../interface/RecoChargedRefCandidate.h | 76 +- .../interface/RecoEcalCandidate.h | 55 +- .../interface/RecoEcalCandidateFwd.h | 5 +- DataFormats/RecoCandidate/src/classes_def.xml | 172 +- .../Scalers/interface/BeamSpotOnline.h | 148 +- DataFormats/Scalers/interface/DcsStatus.h | 162 +- .../Scalers/interface/L1AcceptBunchCrossing.h | 78 +- .../interface/L1AcceptBunchCrossingFwd.h | 5 +- .../Scalers/interface/L1TriggerScalers.h | 210 +- .../Scalers/interface/L1TriggerScalersFwd.h | 6 +- .../Scalers/interface/Level1TriggerScalers.h | 310 +- .../interface/Level1TriggerScalersFwd.h | 6 +- DataFormats/Scalers/interface/LumiScalers.h | 234 +- DataFormats/Scalers/src/BeamSpotOnline.cc | 172 +- DataFormats/Scalers/src/DcsStatus.cc | 132 +- .../Scalers/src/L1AcceptBunchCrossing.cc | 76 +- DataFormats/Scalers/src/L1TriggerScalers.cc | 434 +-- .../Scalers/src/Level1TriggerScalers.cc | 749 ++-- DataFormats/Scalers/src/LumiScalers.cc | 413 +-- DataFormats/Scalers/src/classes_def.xml | 87 +- .../SiPixelCluster/interface/SiPixelCluster.h | 385 +- .../interface/SiPixelClusterFwd.h | 6 +- .../SiPixelCluster/src/SiPixelCluster.cc | 92 +- .../SiPixelCluster/src/classes_def.xml | 65 +- DataFormats/SiPixelDetId/src/classes_def.xml | 10 +- DataFormats/SiPixelDigi/interface/PixelDigi.h | 139 +- .../interface/PixelDigiCollection.h | 33 +- .../SiPixelDigi/interface/PixelDigiFwd.h | 5 +- .../SiPixelDigi/src/PixelDigiCollection.cc | 98 +- DataFormats/SiPixelDigi/src/classes_def.xml | 40 +- .../SiPixelRawData/src/classes_def.xml | 5 +- .../SiStripCluster/src/classes_def.xml | 14 +- DataFormats/SiStripCommon/src/classes_def.xml | 34 +- DataFormats/SiStripDetId/src/classes_def.xml | 5 +- DataFormats/SiStripDigi/src/classes_def.xml | 14 +- DataFormats/Streamer/src/classes_def.xml | 19 +- DataFormats/TCDS/interface/TCDSRecord.h | 276 +- DataFormats/TCDS/interface/TCDSRecordFwd.h | 5 +- DataFormats/TCDS/src/TCDSRecord.cc | 170 +- DataFormats/TCDS/src/classes_def.xml | 13 +- DataFormats/TauReco/interface/BaseTau.h | 63 +- DataFormats/TauReco/interface/BaseTauFwd.h | 5 +- .../interface/PFRecoTauChargedHadron.h | 110 +- .../interface/PFRecoTauChargedHadronFwd.h | 5 +- DataFormats/TauReco/interface/PFTau.h | 555 +-- .../TauReco/interface/PFTauDiscriminator.h | 15 +- DataFormats/TauReco/interface/PFTauFwd.h | 5 +- .../PFTauTransverseImpactParameter.h | 109 +- .../PFTauTransverseImpactParameterFwd.h | 5 +- DataFormats/TauReco/interface/RecoTauPiZero.h | 177 +- .../TauReco/interface/RecoTauPiZeroFwd.h | 5 +- .../interface/TauDiscriminatorContainer.h | 15 +- DataFormats/TauReco/src/BaseTau.cc | 1 + .../TauReco/src/PFRecoTauChargedHadron.cc | 212 +- DataFormats/TauReco/src/RecoTauPiZero.cc | 146 +- DataFormats/TauReco/src/classes_def_1.xml | 99 +- DataFormats/TauReco/src/classes_def_2.xml | 362 +- DataFormats/TauReco/src/classes_def_3.xml | 64 +- DataFormats/TauReco/src/classes_def_hlt.xml | 16 +- DataFormats/TestObjects/src/classes_def.xml | 138 +- DataFormats/TotemReco/interface/TotemT2Digi.h | 56 +- DataFormats/TotemReco/src/TotemT2Digi.cc | 28 +- DataFormats/TotemReco/src/classes_def.xml | 16 +- .../TrackCandidate/src/classes_def.xml | 7 +- DataFormats/TrackReco/BuildFile.xml | 1 - DataFormats/TrackReco/interface/DeDxData.h | 42 +- DataFormats/TrackReco/interface/DeDxHitInfo.h | 188 +- DataFormats/TrackReco/interface/Track.h | 196 +- DataFormats/TrackReco/interface/TrackExtra.h | 249 +- .../TrackReco/interface/TrackExtraBase.h | 125 +- .../TrackReco/interface/TrackExtraFwd.h | 5 +- DataFormats/TrackReco/interface/TrackFwd.h | 6 +- DataFormats/TrackReco/src/classes_def.xml | 514 +-- .../TrackerCommon/interface/ClusterSummary.h | 190 +- DataFormats/TrackerCommon/src/classes_def.xml | 5 +- .../interface/BaseTrackerRecHit.h | 273 +- .../interface/MTDTrackingRecHit.h | 34 +- .../interface/OmniClusterRef.h | 200 +- .../interface/OmniClusterRefFwd.h | 9 + .../interface/TrackerSingleRecHit.h | 112 +- .../TrackerRecHit2D/src/classes_def.xml | 96 +- .../TrackingRecHit/interface/TrackingRecHit.h | 264 +- .../interface/TrackingRecHitFwd.h | 5 +- .../TrackingRecHit/src/classes_def.xml | 50 +- .../TrajectorySeed/interface/TrajectorySeed.h | 73 +- .../interface/TrajectorySeedFwd.h | 6 +- .../TrajectorySeed/src/classes_def.xml | 36 +- .../TrajectoryState/src/classes_def.xml | 12 +- DataFormats/V0Candidate/src/classes_def.xml | 6 +- DataFormats/VertexReco/interface/Vertex.h | 393 +- DataFormats/VertexReco/interface/VertexFwd.h | 5 +- DataFormats/VertexReco/src/classes_def.xml | 58 +- FWCore/Utilities/src/FriendlyName.cc | 2 +- .../test/test_catch2_friendlyname.cc | 4 + .../External/src/classes_def.xml | 10 +- .../NuclearInteractions/src/classes_def.xml | 22 +- .../PileUpEvents/src/classes_def.xml | 12 +- .../Calo/interface/FWTauProxyBuilderBase.h | 4 +- Fireworks/Tracks/interface/TrackUtils.h | 1 + Fireworks/Tracks/interface/estimate_field.h | 4 +- .../Tracks/plugins/FWTrackHitsDetailView.h | 4 +- .../plugins/FWTrackResidualDetailView.h | 5 +- HLTrigger/btau/plugins/HLTmmkFilter.h | 1 + .../interface/CaloJetMETcorrInputProducerT.h | 2 +- .../interface/JetCleanerForType1METT.h | 2 +- .../interface/PFJetMETcorrInputProducerT.h | 2 +- .../interface/L1GlobalTriggerPSB.h | 2 +- .../interface/L1GtCaloCondition.h | 3 +- .../interface/L1GtUtils.h | 2 +- .../L1THGCalUtilities/src/classes_def.xml | 8 +- .../interface/L1MuBMMuonSorter.h | 2 +- .../interface/corrector.h | 5 +- .../plugins/dtMDSshowerTableProducer.cc | 2 + .../SelectorUtils/src/classes_def.xml | 6 +- .../interface/LowPtGsfElectronFeatures.h | 5 +- .../TICL/interface/TracksterInferenceByCNN.h | 5 +- .../test/GEMCSCCoincidenceRateAnalyzer.cc | 5 +- RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc | 2 +- .../plugins/GlobalMuonToMuonProducer.h | 4 +- .../MuonIdentification/plugins/MuonProducer.h | 4 +- .../MuonIsolation/interface/MuIsoByTrackPt.h | 4 +- .../interface/L1MuonPixelTrackFitter.h | 5 +- .../interface/PFRecoTauChargedHadronPlugins.h | 5 +- .../plugins/DuplicateListMerger.cc | 29 +- .../plugins/DuplicateTrackMerger.cc | 1 - .../plugins/TrackCollectionFilterCloner.cc | 28 +- .../interface/SeedFromProtoTrack.h | 4 +- .../interface/DAFTrackProducerAlgorithm.h | 4 +- ...coClusterToSimLayerClusterAssociationMap.h | 83 +- ...mLayerClusterToRecoClusterAssociationMap.h | 109 +- ...oClusterToSimLayerClusterAssociationMap.cc | 6 +- ...LayerClusterToRecoClusterAssociationMap.cc | 6 +- .../Associations/src/classes_def.xml | 119 +- .../CaloAnalysis/interface/CaloParticle.h | 303 +- .../CaloAnalysis/interface/CaloParticleFwd.h | 7 +- .../CaloAnalysis/interface/MtdCaloParticle.h | 49 +- .../interface/MtdCaloParticleFwd.h | 7 +- .../CaloAnalysis/interface/MtdSimCluster.h | 227 +- .../CaloAnalysis/interface/MtdSimClusterFwd.h | 7 +- .../interface/MtdSimLayerCluster.h | 87 +- .../interface/MtdSimLayerClusterFwd.h | 4 +- .../CaloAnalysis/interface/MtdSimTrackster.h | 53 +- .../interface/MtdSimTracksterFwd.h | 7 +- .../CaloAnalysis/interface/SimCluster.h | 404 +-- .../CaloAnalysis/interface/SimClusterFwd.h | 7 +- .../CaloAnalysis/interface/SimTauCPLink.h | 277 +- .../CaloAnalysis/src/CaloParticle.cc | 82 +- .../CaloAnalysis/src/MtdCaloParticle.cc | 78 +- .../CaloAnalysis/src/MtdSimCluster.cc | 62 +- .../CaloAnalysis/src/MtdSimLayerCluster.cc | 76 +- .../CaloAnalysis/src/MtdSimTrackster.cc | 106 +- SimDataFormats/CaloAnalysis/src/SimCluster.cc | 56 +- .../CaloAnalysis/src/classes_def.xml | 38 +- SimDataFormats/CaloHit/interface/PCaloHit.h | 105 +- .../CaloHit/interface/PCaloHitFwd.h | 5 +- SimDataFormats/CaloHit/src/PCaloHit.cc | 34 +- SimDataFormats/CaloHit/src/classes_def.xml | 30 +- SimDataFormats/CaloTest/src/classes_def.xml | 20 +- .../interface/CrossingFramePlaybackInfoNew.h | 82 +- .../CrossingFramePlaybackInfoNewFwd.h | 6 +- .../src/CrossingFramePlaybackInfoNew.cc | 16 +- .../CrossingFrame/src/classes_def.xml | 10 +- .../DigiSimLinks/interface/DTDigiSimLink.h | 123 +- .../DigiSimLinks/src/DTDigiSimLink.cc | 67 +- .../DigiSimLinks/src/classes_def.xml | 13 +- .../EcalTestBeam/src/classes_def.xml | 4 +- .../EncodedEventId/src/classes_def.xml | 4 +- SimDataFormats/Forward/src/classes_def.xml | 12 +- .../GEMDigiSimLink/interface/GEMDigiSimLink.h | 51 +- .../GEMDigiSimLink/interface/ME0DigiSimLink.h | 5 +- .../GEMDigiSimLink/src/classes_def.xml | 38 +- .../interface/GenEventInfoProduct.h | 124 +- .../interface/GenFilterInfo.h | 96 +- .../interface/GenLumiInfoHeader.h | 40 +- .../interface/GenLumiInfoProduct.h | 276 +- .../interface/GenRunInfoProduct.h | 88 +- .../interface/HepMCProduct.h | 53 +- .../interface/HepMCProductFwd.h | 7 +- .../interface/LHEEventProduct.h | 166 +- .../interface/LHERunInfoProduct.h | 180 +- .../interface/LHEXMLStringProduct.h | 42 +- .../src/GenEventInfoProduct.cc | 172 +- .../GeneratorProducts/src/GenFilterInfo.cc | 218 +- .../src/GenLumiInfoProduct.cc | 166 +- .../src/GenRunInfoProduct.cc | 30 +- .../GeneratorProducts/src/LHEEventProduct.cc | 102 +- .../src/LHERunInfoProduct.cc | 433 +-- .../src/LHEXMLStringProduct.cc | 186 +- .../GeneratorProducts/src/classes_def.xml | 221 +- .../HcalTestBeam/src/classes_def.xml | 20 +- SimDataFormats/HiGenData/src/classes_def.xml | 4 +- .../interface/PileupSummaryInfo.h | 156 +- .../interface/PileupSummaryInfoFwd.h | 6 +- .../src/PileupSummaryInfo.cc | 122 +- .../PileupSummaryInfo/src/classes_def.xml | 22 +- .../RPCDigiSimLink/interface/RPCDigiSimLink.h | 101 +- .../RPCDigiSimLink/src/classes_def.xml | 18 +- .../RandomEngine/src/classes_def.xml | 8 +- SimDataFormats/Track/interface/SimTrack.h | 169 +- SimDataFormats/Track/interface/SimTrackFwd.h | 5 +- SimDataFormats/Track/src/SimTrack.cc | 34 +- SimDataFormats/Track/src/classes_def.xml | 41 +- .../interface/PixelDigiSimLink.h | 85 +- .../interface/PixelDigiSimLinkFwd.h | 5 +- .../interface/StripDigiSimLink.h | 93 +- .../interface/StripDigiSimLinkFwd.h | 5 +- .../TrackerDigiSimLink/src/classes_def.xml | 40 +- .../interface/TrackingParticle.h | 317 +- .../interface/TrackingParticleFwd.h | 7 +- .../interface/TrackingVertex.h | 133 +- .../interface/TrackingVertexFwd.h | 5 +- .../interface/UniqueSimTrackId.h | 9 +- .../TrackingAnalysis/src/TrackingParticle.cc | 102 +- .../TrackingAnalysis/src/TrackingVertex.cc | 126 +- .../TrackingAnalysis/src/classes_def.xml | 53 +- .../TrackingHit/interface/PSimHit.h | 179 +- .../TrackingHit/interface/PSimHitFwd.h | 5 +- SimDataFormats/TrackingHit/src/PSimHit.cc | 8 +- .../TrackingHit/src/classes_def.xml | 19 +- .../ValidationFormats/src/classes_def.xml | 164 +- SimDataFormats/Vertex/interface/SimVertex.h | 61 +- .../Vertex/interface/SimVertexFwd.h | 5 +- SimDataFormats/Vertex/src/SimVertex.cc | 28 +- SimDataFormats/Vertex/src/classes_def.xml | 17 +- .../EcalTBObjects/src/classes_def.xml | 32 +- .../HcalTBObjects/src/classes_def.xml | 24 +- .../interface/MuonDetCleaner.h | 5 +- .../plugins/CollectionMerger.cc | 15 +- TrackingTools/GsfTracking/src/classes_def.xml | 12 +- .../RecoMuon/src/GlobalMuonMatchAnalyzer.h | 6 - Validation/RecoMuon/src/MuonSeedTrack.h | 5 +- 897 files changed, 50512 insertions(+), 50028 deletions(-) create mode 100644 DataFormats/Common/interface/IdToHitRange.h create mode 100644 DataFormats/Common/test/IdToHitRange_t.cpp create mode 100644 DataFormats/DTRecHit/test/BuildFile.xml create mode 100644 DataFormats/DTRecHit/test/test_catch2_DTRangeMapAccessor.cc create mode 100644 DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigiFwd.h create mode 100644 DataFormats/L1GlobalCaloTrigger/interface/L1GctCandFwd.h create mode 100644 DataFormats/TrackerRecHit2D/interface/OmniClusterRefFwd.h diff --git a/Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h b/Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h index 05ca577acc208..4a684a13e75c1 100644 --- a/Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h +++ b/Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h @@ -3,6 +3,7 @@ #include "DataFormats/JetReco/interface/CaloJetCollection.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" //Framework #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -12,9 +13,6 @@ //STL #include -namespace reco { - class Track; -} namespace edm { class Event; class EventSetup; diff --git a/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeMonitor.h b/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeMonitor.h index 07aaa33d093c2..d871fcff07f54 100644 --- a/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeMonitor.h +++ b/Alignment/MillePedeAlignmentAlgorithm/interface/MillePedeMonitor.h @@ -13,6 +13,7 @@ #include "DataFormats/CLHEP/interface/AlgebraicObjects.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "Alignment/ReferenceTrajectories/interface/ReferenceTrajectoryBase.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -33,10 +34,6 @@ class TDirectory; class TrackerTopology; -namespace reco { - class Track; -} - class Alignable; class AlignableDetOrUnitPtr; class TrajectoryStateOnSurface; diff --git a/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml b/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml index f1a41fe196ea8..d21857631dc17 100644 --- a/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml +++ b/AnalysisDataFormats/SUSYBSMObjects/src/classes_def.xml @@ -1,9 +1,9 @@ - - + + - - + + @@ -14,17 +14,16 @@ - - + + - - - + + @@ -35,8 +34,8 @@ - - + + @@ -47,8 +46,8 @@ - - + + diff --git a/AnalysisDataFormats/TopObjects/src/classes_def.xml b/AnalysisDataFormats/TopObjects/src/classes_def.xml index ee2f9b9cf6837..2df8187f71061 100644 --- a/AnalysisDataFormats/TopObjects/src/classes_def.xml +++ b/AnalysisDataFormats/TopObjects/src/classes_def.xml @@ -1,30 +1,24 @@ - - - - + + - - - + + - - + + - - + + - - - + + - - - + + - - - + + @@ -32,7 +26,6 @@ - @@ -42,24 +35,21 @@ - - - - + - - + + - - + + - - + + - - + + diff --git a/AnalysisDataFormats/TrackInfo/src/classes_def.xml b/AnalysisDataFormats/TrackInfo/src/classes_def.xml index 1ffc2e260f75e..f4fb56d2791de 100644 --- a/AnalysisDataFormats/TrackInfo/src/classes_def.xml +++ b/AnalysisDataFormats/TrackInfo/src/classes_def.xml @@ -1,15 +1,14 @@ - - - + + - - + + @@ -24,16 +23,16 @@ - - + + - - + + diff --git a/DPGAnalysis/MuonTools/interface/MuNtupleUtils.h b/DPGAnalysis/MuonTools/interface/MuNtupleUtils.h index 71116cf55956d..81f3283639aa0 100644 --- a/DPGAnalysis/MuonTools/interface/MuNtupleUtils.h +++ b/DPGAnalysis/MuonTools/interface/MuNtupleUtils.h @@ -27,8 +27,9 @@ #include #include +#include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigiFwd.h" + class L1MuDTChambPhDigi; -class L1Phase2MuDTPhDigi; namespace nano_mu { diff --git a/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h b/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h index c6ac250589611..4b95957ebcdeb 100644 --- a/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h +++ b/DQM/DTMonitorModule/src/DTLocalTriggerBaseTask.h @@ -34,11 +34,12 @@ #include #include +#include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigiFwd.h" + class DTGeometry; class DTTrigGeomUtils; class L1MuDTChambPhDigi; class L1MuDTChambThDigi; -class L1Phase2MuDTPhDigi; class DTTPGCompareUnit; class DTTimeEvolutionHisto; diff --git a/DQM/GEM/plugins/GEMEffByGEMCSCSegmentSource.cc b/DQM/GEM/plugins/GEMEffByGEMCSCSegmentSource.cc index 3b5c408cadbb2..474776db8f3ef 100644 --- a/DQM/GEM/plugins/GEMEffByGEMCSCSegmentSource.cc +++ b/DQM/GEM/plugins/GEMEffByGEMCSCSegmentSource.cc @@ -179,11 +179,7 @@ void GEMEffByGEMCSCSegmentSource::analyze(const edm::Event& event, const edm::Ev findMatchedME11Segments(muon_collection); } - for (edm::OwnVector::const_iterator iter = gemcsc_segment_collection->begin(); - iter != gemcsc_segment_collection->end(); - iter++) { - const GEMCSCSegment& gemcsc_segment = *iter; - + for (const GEMCSCSegment& gemcsc_segment : *gemcsc_segment_collection) { const CSCDetId csc_id = gemcsc_segment.cscDetId(); if (csc_id.isME11()) { analyzeGE11ME11Segment(gemcsc_segment, oh_status_collection, vfat_status_collection); diff --git a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayTOF.h b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayTOF.h index 60c60c80435dc..68aa72ebc4db2 100644 --- a/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayTOF.h +++ b/DQM/SiStripCommissioningSources/plugins/tracking/SiStripFineDelayTOF.h @@ -3,6 +3,7 @@ #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" + class SiStripFineDelayTOF { public: static double timeOfFlight(bool cosmics, bool field, double* trackParameters, double* hit, double* phit, bool onDisk); diff --git a/DataFormats/Alignment/src/classes_def.xml b/DataFormats/Alignment/src/classes_def.xml index b66ea827aafb3..91aa6514134f2 100644 --- a/DataFormats/Alignment/src/classes_def.xml +++ b/DataFormats/Alignment/src/classes_def.xml @@ -1,19 +1,17 @@ - - - + + - - + + - - - + + @@ -22,8 +20,8 @@ - - + + diff --git a/DataFormats/BTauReco/interface/BaseTagInfo.h b/DataFormats/BTauReco/interface/BaseTagInfo.h index cac8aa7c4d7cf..e7862e877935b 100644 --- a/DataFormats/BTauReco/interface/BaseTagInfo.h +++ b/DataFormats/BTauReco/interface/BaseTagInfo.h @@ -8,28 +8,32 @@ #include "DataFormats/BTauReco/interface/TaggingVariable.h" namespace reco { + namespace io_v1 { - class BaseTagInfo { - public: - BaseTagInfo(void) {} + class BaseTagInfo { + public: + BaseTagInfo(void) {} - virtual ~BaseTagInfo(void) {} + virtual ~BaseTagInfo(void) {} - /// clone - virtual BaseTagInfo* clone(void) const { return new BaseTagInfo(*this); } + /// clone + virtual BaseTagInfo* clone(void) const { return new BaseTagInfo(*this); } - /// returns a polymorphic reference to the tagged jet - virtual edm::RefToBase jet(void) const { return edm::RefToBase(); } + /// returns a polymorphic reference to the tagged jet + virtual edm::RefToBase jet(void) const { return edm::RefToBase(); } - /// returns a list of tracks associated to the jet - virtual TrackRefVector tracks(void) const { return TrackRefVector(); } + /// returns a list of tracks associated to the jet + virtual TrackRefVector tracks(void) const { return TrackRefVector(); } - /// check if the algorithm is using the tracks or not - virtual bool hasTracks(void) const { return false; } + /// check if the algorithm is using the tracks or not + virtual bool hasTracks(void) const { return false; } - /// returns a description of the extended informations in a TaggingVariableList - virtual TaggingVariableList taggingVariables(void) const { return TaggingVariableList(); } - }; + /// returns a description of the extended informations in a TaggingVariableList + virtual TaggingVariableList taggingVariables(void) const { return TaggingVariableList(); } + }; + + } // namespace io_v1 + using BaseTagInfo = io_v1::BaseTagInfo; DECLARE_EDM_REFS(BaseTagInfo) diff --git a/DataFormats/BTauReco/interface/IPTagInfo.h b/DataFormats/BTauReco/interface/IPTagInfo.h index 887377ea5a820..3cf7f5ee53f50 100644 --- a/DataFormats/BTauReco/interface/IPTagInfo.h +++ b/DataFormats/BTauReco/interface/IPTagInfo.h @@ -138,7 +138,7 @@ namespace reco { const Track* selectedTrack(size_t i) const { return reco::btag::toTrack(m_selected[i]); } // Used by ROOT storage - CMS_CLASS_VERSION(11) + CMS_CLASS_VERSION(3) private: std::vector m_data; diff --git a/DataFormats/BTauReco/interface/JetTagInfo.h b/DataFormats/BTauReco/interface/JetTagInfo.h index 9892806fd646e..8230674a61c13 100644 --- a/DataFormats/BTauReco/interface/JetTagInfo.h +++ b/DataFormats/BTauReco/interface/JetTagInfo.h @@ -5,35 +5,37 @@ #include "DataFormats/BTauReco/interface/BaseTagInfo.h" namespace reco { + namespace io_v1 { - class JetTagInfo : public BaseTagInfo { - public: - JetTagInfo(void) : m_jet() {} + class JetTagInfo : public BaseTagInfo { + public: + JetTagInfo(void) : m_jet() {} - template - JetTagInfo(const edm::Ref& jetRef) : m_jet(jetRef) {} + template + JetTagInfo(const edm::Ref& jetRef) : m_jet(jetRef) {} - JetTagInfo(const edm::RefToBase& jetRef) : m_jet(jetRef) {} + JetTagInfo(const edm::RefToBase& jetRef) : m_jet(jetRef) {} - ~JetTagInfo(void) override {} + ~JetTagInfo(void) override {} - JetTagInfo* clone(void) const override { return new JetTagInfo(*this); } + JetTagInfo* clone(void) const override { return new JetTagInfo(*this); } - edm::RefToBase jet(void) const override { return m_jet; } + edm::RefToBase jet(void) const override { return m_jet; } - template - void setJetRef(const edm::Ref& jetRef) { - m_jet = edm::RefToBase(jetRef); - } + template + void setJetRef(const edm::Ref& jetRef) { + m_jet = edm::RefToBase(jetRef); + } - void setJetRef(const edm::RefToBase& jetRef) { m_jet = edm::RefToBase(jetRef); } + void setJetRef(const edm::RefToBase& jetRef) { m_jet = edm::RefToBase(jetRef); } - protected: - edm::RefToBase m_jet; - }; + protected: + edm::RefToBase m_jet; + }; + } // namespace io_v1 + using JetTagInfo = io_v1::JetTagInfo; DECLARE_EDM_REFS(JetTagInfo) - } // namespace reco #endif // DataFormats_BTauReco_JetTagInfo_h diff --git a/DataFormats/BTauReco/interface/PixelClusterTagInfo.h b/DataFormats/BTauReco/interface/PixelClusterTagInfo.h index 78ce0a8422e94..e39c636968bb7 100644 --- a/DataFormats/BTauReco/interface/PixelClusterTagInfo.h +++ b/DataFormats/BTauReco/interface/PixelClusterTagInfo.h @@ -6,69 +6,70 @@ #include "DataFormats/BTauReco/interface/BaseTagInfo.h" namespace reco { - - struct PixelClusterProperties { - float x = 0; - float y = 0; - float z = 0; - int charge = 0; - unsigned int layer = 0; - }; - - struct PixelClusterData { - std::vector r004; - std::vector r006; - std::vector r008; - std::vector r010; - std::vector r016; - std::vector rvar; - std::vector rvwt; - PixelClusterData(unsigned int l = 4) { - r004 = std::vector(l, 0); - r006 = std::vector(l, 0); - r008 = std::vector(l, 0); - r010 = std::vector(l, 0); - r016 = std::vector(l, 0); - rvar = std::vector(l, 0); - rvwt = std::vector(l, 0); - } - CMS_CLASS_VERSION(3) - }; - - class PixelClusterTagInfo : public BaseTagInfo { - public: - PixelClusterTagInfo() {} - - PixelClusterTagInfo(const PixelClusterData& data, const edm::RefToBase& ref) - : pixelClusters_(data), jetRef_(ref) {} - - ~PixelClusterTagInfo() override {} - - // without overriding clone from base class will be store/retrieved - PixelClusterTagInfo* clone(void) const override { return new PixelClusterTagInfo(*this); } - - // method to set the jet RefToBase - void setJetRef(const edm::RefToBase& ref) { jetRef_ = ref; } - - // method to jet the jet RefToBase - edm::RefToBase jet() const override { return jetRef_; } - - // method to set the PixelClusterData - void setData(const PixelClusterData& data) { pixelClusters_ = data; } - - // method to get the PixelClusterData struct - const PixelClusterData& data() const { return pixelClusters_; } - - CMS_CLASS_VERSION(3) - - private: - PixelClusterData pixelClusters_; - - edm::RefToBase jetRef_; - }; - - typedef std::vector PixelClusterTagInfoCollection; - + namespace io_v1 { + + struct PixelClusterProperties { + float x = 0; + float y = 0; + float z = 0; + int charge = 0; + unsigned int layer = 0; + }; + + struct PixelClusterData { + std::vector r004; + std::vector r006; + std::vector r008; + std::vector r010; + std::vector r016; + std::vector rvar; + std::vector rvwt; + PixelClusterData(unsigned int l = 4) { + r004 = std::vector(l, 0); + r006 = std::vector(l, 0); + r008 = std::vector(l, 0); + r010 = std::vector(l, 0); + r016 = std::vector(l, 0); + rvar = std::vector(l, 0); + rvwt = std::vector(l, 0); + } + }; + + class PixelClusterTagInfo : public BaseTagInfo { + public: + PixelClusterTagInfo() {} + + PixelClusterTagInfo(const PixelClusterData& data, const edm::RefToBase& ref) + : pixelClusters_(data), jetRef_(ref) {} + + ~PixelClusterTagInfo() override {} + + // without overriding clone from base class will be store/retrieved + PixelClusterTagInfo* clone(void) const override { return new PixelClusterTagInfo(*this); } + + // method to set the jet RefToBase + void setJetRef(const edm::RefToBase& ref) { jetRef_ = ref; } + + // method to jet the jet RefToBase + edm::RefToBase jet() const override { return jetRef_; } + + // method to set the PixelClusterData + void setData(const PixelClusterData& data) { pixelClusters_ = data; } + + // method to get the PixelClusterData struct + const PixelClusterData& data() const { return pixelClusters_; } + + private: + PixelClusterData pixelClusters_; + + edm::RefToBase jetRef_; + }; + + } // namespace io_v1 + using PixelClusterProperties = io_v1::PixelClusterProperties; + using PixelClusterData = io_v1::PixelClusterData; + using PixelClusterTagInfo = io_v1::PixelClusterTagInfo; + using PixelClusterTagInfoCollection = std::vector; } // namespace reco #endif // DataFormats_BTauReco_PixelClusterTagInfo_h diff --git a/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h b/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h index d2f25b5219a5b..71e4e574ba819 100644 --- a/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h +++ b/DataFormats/BTauReco/interface/TemplatedSecondaryVertexTagInfo.h @@ -55,7 +55,7 @@ namespace reco { GlobalVector direction; // Used by ROOT storage - CMS_CLASS_VERSION(12) + CMS_CLASS_VERSION(3) }; struct TrackFinder { diff --git a/DataFormats/BTauReco/interface/TemplatedSoftLeptonTagInfo.h b/DataFormats/BTauReco/interface/TemplatedSoftLeptonTagInfo.h index bbd44f84ba1a3..6eb1863fb42a9 100644 --- a/DataFormats/BTauReco/interface/TemplatedSoftLeptonTagInfo.h +++ b/DataFormats/BTauReco/interface/TemplatedSoftLeptonTagInfo.h @@ -129,7 +129,7 @@ namespace reco { TaggingVariableList taggingVariables(void) const override; // Used by ROOT storage - CMS_CLASS_VERSION(2) + CMS_CLASS_VERSION(3) private: LeptonMap m_leptons; diff --git a/DataFormats/BTauReco/src/classes_def.xml b/DataFormats/BTauReco/src/classes_def.xml index 705b64db899d0..6b84387e328fc 100644 --- a/DataFormats/BTauReco/src/classes_def.xml +++ b/DataFormats/BTauReco/src/classes_def.xml @@ -1,7 +1,7 @@ - - + + @@ -10,9 +10,8 @@ - - - + + @@ -21,9 +20,8 @@ - - - + + @@ -32,17 +30,13 @@ - - - - - + + - - + @@ -52,7 +46,7 @@ - + @@ -63,7 +57,7 @@ - + @@ -74,7 +68,7 @@ - + @@ -84,9 +78,8 @@ - - - + + @@ -95,9 +88,8 @@ - - - + + @@ -107,27 +99,12 @@ - - - - - - - - - - - - - - - - - - + + + - - + + @@ -136,8 +113,8 @@ - - + + @@ -147,14 +124,13 @@ - - + + - + - - - + + @@ -165,23 +141,23 @@ - + - + - + - - + + @@ -191,16 +167,16 @@ - - - - + + + + - - - - + + + + @@ -211,11 +187,11 @@ - - + + - - + + @@ -231,9 +207,8 @@ - - - + + @@ -242,9 +217,8 @@ - - - + + @@ -253,9 +227,8 @@ - - - + + @@ -276,11 +249,9 @@ - - - + + - @@ -302,141 +273,132 @@ - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - + + + + + + + + + - + - + - - - - + + + + - - - - + + + + - - - + + - - - - + + - - - - + + - - - - - - + + @@ -444,13 +406,11 @@ - - - + + - - - + + @@ -507,12 +467,12 @@ - - - + + + - - + + diff --git a/DataFormats/BeamSpot/interface/BeamSpot.h b/DataFormats/BeamSpot/interface/BeamSpot.h index b25b300e7b21c..4ab6f5a31c859 100644 --- a/DataFormats/BeamSpot/interface/BeamSpot.h +++ b/DataFormats/BeamSpot/interface/BeamSpot.h @@ -17,148 +17,152 @@ #include namespace reco { - - class BeamSpot { - public: - /// beam spot flags - enum BeamType { Unknown = -1, Fake = 0, LHC = 1, Tracker = 2 }; - - /// point in the space - typedef math::XYZPoint Point; - enum { dimension = 7 }; - typedef math::Error::type CovarianceMatrix; - enum { dim3 = 3 }; - typedef math::Error::type Covariance3DMatrix; - enum { resdim = 2 }; - typedef math::Error::type ResCovMatrix; - - /// default constructor - BeamSpot(); - - /// constructor from values - BeamSpot(const Point& point, - double sigmaZ, - double dxdz, - double dydz, - double BeamWidthX, - const CovarianceMatrix& error, - BeamType type = Unknown) { - position_ = point; - sigmaZ_ = sigmaZ; - dxdz_ = dxdz; - dydz_ = dydz; - BeamWidthX_ = BeamWidthX; - BeamWidthY_ = BeamWidthX; - error_ = error; - type_ = type; - emittanceX_ = emittanceY_ = 0; - betaStar_ = 0; - }; - - /// position - const Point& position() const { return position_; } - /// x coordinate - double x0() const { return position_.X(); } - /// y coordinate - double y0() const { return position_.Y(); } - /// z coordinate - double z0() const { return position_.Z(); } - - /// x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) - double x(const double z) const { return x0() + dxdz() * (z - z0()); } - /// y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) - double y(const double z) const { return y0() + dydz() * (z - z0()); } - /// position of the beam spot at a given z value (it takes into account the dxdz and dydz slopes) - const Point position(const double z) const; - // const Point position(const double z) const {Point pos(x(z),y(z),z); return pos;} - - /// sigma z - double sigmaZ() const { return sigmaZ_; } - /// dxdz slope - double dxdz() const { return dxdz_; } - /// dydz slope - double dydz() const { return dydz_; } - /// beam width X - double BeamWidthX() const { return BeamWidthX_; } - /// beam width Y - double BeamWidthY() const { return BeamWidthY_; } - /// error on x - double x0Error() const { return sqrt(error_(0, 0)); } - /// error on y - double y0Error() const { return sqrt(error_(1, 1)); } - /// error on z - double z0Error() const { return sqrt(error_(2, 2)); } - /// error on sigma z - double sigmaZ0Error() const { return sqrt(error_(3, 3)); } - /// error on dxdz - double dxdzError() const { return sqrt(error_(4, 4)); } - /// error on dydz - double dydzError() const { return sqrt(error_(5, 5)); } - - /// error on beam width X, assume error in X = Y - double BeamWidthXError() const { return sqrt(error_(6, 6)); } - /// error on beam width Y, assume error in X = Y - double BeamWidthYError() const { return sqrt(error_(6, 6)); } - - /// - void setBeamWidthX(double v) { BeamWidthX_ = v; } - void setBeamWidthY(double v) { BeamWidthY_ = v; } - - /// (i,j)-th element of error matrix - double covariance(int i, int j) const { return error_(i, j); } - /// return full covariance matrix of dim 7 - CovarianceMatrix covariance() const { return error_; } - /// return only 3D position covariance matrix - Covariance3DMatrix covariance3D() const { - Covariance3DMatrix matrix; - for (int j = 0; j < 3; j++) { - for (int k = j; k < 3; k++) { - matrix(j, k) = error_(j, k); + namespace io_v1 { + + class BeamSpot { + public: + /// beam spot flags + enum BeamType { Unknown = -1, Fake = 0, LHC = 1, Tracker = 2 }; + + /// point in the space + typedef math::XYZPoint Point; + enum { dimension = 7 }; + typedef math::Error::type CovarianceMatrix; + enum { dim3 = 3 }; + typedef math::Error::type Covariance3DMatrix; + enum { resdim = 2 }; + typedef math::Error::type ResCovMatrix; + + /// default constructor + BeamSpot(); + + /// constructor from values + BeamSpot(const Point& point, + double sigmaZ, + double dxdz, + double dydz, + double BeamWidthX, + const CovarianceMatrix& error, + BeamType type = Unknown) { + position_ = point; + sigmaZ_ = sigmaZ; + dxdz_ = dxdz; + dydz_ = dydz; + BeamWidthX_ = BeamWidthX; + BeamWidthY_ = BeamWidthX; + error_ = error; + type_ = type; + emittanceX_ = emittanceY_ = 0; + betaStar_ = 0; + }; + + /// position + const Point& position() const { return position_; } + /// x coordinate + double x0() const { return position_.X(); } + /// y coordinate + double y0() const { return position_.Y(); } + /// z coordinate + double z0() const { return position_.Z(); } + + /// x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) + double x(const double z) const { return x0() + dxdz() * (z - z0()); } + /// y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) + double y(const double z) const { return y0() + dydz() * (z - z0()); } + /// position of the beam spot at a given z value (it takes into account the dxdz and dydz slopes) + const Point position(const double z) const; + // const Point position(const double z) const {Point pos(x(z),y(z),z); return pos;} + + /// sigma z + double sigmaZ() const { return sigmaZ_; } + /// dxdz slope + double dxdz() const { return dxdz_; } + /// dydz slope + double dydz() const { return dydz_; } + /// beam width X + double BeamWidthX() const { return BeamWidthX_; } + /// beam width Y + double BeamWidthY() const { return BeamWidthY_; } + /// error on x + double x0Error() const { return sqrt(error_(0, 0)); } + /// error on y + double y0Error() const { return sqrt(error_(1, 1)); } + /// error on z + double z0Error() const { return sqrt(error_(2, 2)); } + /// error on sigma z + double sigmaZ0Error() const { return sqrt(error_(3, 3)); } + /// error on dxdz + double dxdzError() const { return sqrt(error_(4, 4)); } + /// error on dydz + double dydzError() const { return sqrt(error_(5, 5)); } + + /// error on beam width X, assume error in X = Y + double BeamWidthXError() const { return sqrt(error_(6, 6)); } + /// error on beam width Y, assume error in X = Y + double BeamWidthYError() const { return sqrt(error_(6, 6)); } + + /// + void setBeamWidthX(double v) { BeamWidthX_ = v; } + void setBeamWidthY(double v) { BeamWidthY_ = v; } + + /// (i,j)-th element of error matrix + double covariance(int i, int j) const { return error_(i, j); } + /// return full covariance matrix of dim 7 + CovarianceMatrix covariance() const { return error_; } + /// return only 3D position covariance matrix + Covariance3DMatrix covariance3D() const { + Covariance3DMatrix matrix; + for (int j = 0; j < 3; j++) { + for (int k = j; k < 3; k++) { + matrix(j, k) = error_(j, k); + } } + return matrix; + }; + /// return beam type + BeamType type() const { return type_; } + /// set beam type + void setType(BeamType type) { type_ = type; } + /// + Covariance3DMatrix rotatedCovariance3D() const; + + /// additional information + double emittanceX() const { return emittanceX_; } + double emittanceY() const { return emittanceY_; } + double betaStar() const { return betaStar_; } + double beamWidthFromBeta(double z, double e) const { + return sqrt(e * betaStar_ * (1 + pow((z - position_.Z()) / betaStar_, 2))); } - return matrix; + /// + void setEmittanceX(double v) { emittanceX_ = v; } + void setEmittanceY(double v) { emittanceY_ = v; } + void setbetaStar(double v) { betaStar_ = v; } + + /// print information + void print(std::stringstream& ss) const; + + private: + /// position + Point position_; + /// errors + CovarianceMatrix error_; + + Double32_t sigmaZ_; + Double32_t BeamWidthX_; + Double32_t BeamWidthY_; + Double32_t dxdz_; + Double32_t dydz_; + Double32_t emittanceX_; + Double32_t emittanceY_; + Double32_t betaStar_; + + BeamType type_; }; - /// return beam type - BeamType type() const { return type_; } - /// set beam type - void setType(BeamType type) { type_ = type; } - /// - Covariance3DMatrix rotatedCovariance3D() const; - - /// additional information - double emittanceX() const { return emittanceX_; } - double emittanceY() const { return emittanceY_; } - double betaStar() const { return betaStar_; } - double beamWidthFromBeta(double z, double e) const { - return sqrt(e * betaStar_ * (1 + pow((z - position_.Z()) / betaStar_, 2))); - } /// - void setEmittanceX(double v) { emittanceX_ = v; } - void setEmittanceY(double v) { emittanceY_ = v; } - void setbetaStar(double v) { betaStar_ = v; } - - /// print information - void print(std::stringstream& ss) const; - - private: - /// position - Point position_; - /// errors - CovarianceMatrix error_; - - Double32_t sigmaZ_; - Double32_t BeamWidthX_; - Double32_t BeamWidthY_; - Double32_t dxdz_; - Double32_t dydz_; - Double32_t emittanceX_; - Double32_t emittanceY_; - Double32_t betaStar_; - - BeamType type_; - }; - /// - std::ostream& operator<<(std::ostream&, BeamSpot beam); + std::ostream& operator<<(std::ostream&, BeamSpot beam); + + } // namespace io_v1 + using BeamSpot = io_v1::BeamSpot; } // namespace reco diff --git a/DataFormats/BeamSpot/interface/BeamSpotFwd.h b/DataFormats/BeamSpot/interface/BeamSpotFwd.h index de50e55009470..ca8a8918a04b6 100644 --- a/DataFormats/BeamSpot/interface/BeamSpotFwd.h +++ b/DataFormats/BeamSpot/interface/BeamSpotFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_BeamSpot_BeamSpotFwd_h #define DataFormats_BeamSpot_BeamSpotFwd_h namespace reco { - class BeamSpot; -} + namespace io_v1 { + class BeamSpot; + } + using BeamSpot = io_v1::BeamSpot; +} // namespace reco #endif diff --git a/DataFormats/BeamSpot/src/BeamSpot.cc b/DataFormats/BeamSpot/src/BeamSpot.cc index fb672ce09f0d1..6256936c3c727 100644 --- a/DataFormats/BeamSpot/src/BeamSpot.cc +++ b/DataFormats/BeamSpot/src/BeamSpot.cc @@ -17,85 +17,85 @@ #include namespace reco { + namespace io_v1 { + using namespace math; - using namespace math; - - BeamSpot::BeamSpot() { - // initialize - position_ = Point(0., 0., 0.); - sigmaZ_ = 0.; - dxdz_ = 0.; - dydz_ = 0.; - BeamWidthX_ = 0.; - BeamWidthY_ = 0; - for (int j = 0; j < 7; j++) { - for (int k = j; k < 7; k++) { - error_(j, k) = 0.; + BeamSpot::BeamSpot() { + // initialize + position_ = Point(0., 0., 0.); + sigmaZ_ = 0.; + dxdz_ = 0.; + dydz_ = 0.; + BeamWidthX_ = 0.; + BeamWidthY_ = 0; + for (int j = 0; j < 7; j++) { + for (int k = j; k < 7; k++) { + error_(j, k) = 0.; + } } + type_ = Unknown; + emittanceX_ = 0; + emittanceY_ = 0; + betaStar_ = 0; } - type_ = Unknown; - emittanceX_ = 0; - emittanceY_ = 0; - betaStar_ = 0; - } - - const BeamSpot::Point BeamSpot::position(const double z) const { - Point pos(x(z), y(z), z); - return pos; - } - void BeamSpot::print(std::stringstream& ss) const { - ss << "-----------------------------------------------------\n" - << " Beam Spot Data\n\n" - << " Beam type = " << type() << "\n" - << " X0 = " << x0() << " +/- " << x0Error() << " [cm]\n" - << " Y0 = " << y0() << " +/- " << y0Error() << " [cm]\n" - << " Z0 = " << z0() << " +/- " << z0Error() << " [cm]\n" - << " Sigma Z0 = " << sigmaZ() << " +/- " << sigmaZ0Error() << " [cm]\n" - << " dxdz = " << dxdz() << " +/- " << dxdzError() << " [radians]\n" - << " dydz = " << dydz() << " +/- " << dydzError() << " [radians]\n" - << " Beam width X = " << BeamWidthX() << " +/- " << BeamWidthXError() << " [cm]\n" - << " Beam width Y = " << BeamWidthY() << " +/- " << BeamWidthYError() << " [cm]\n" - << " EmittanceX = " << emittanceX() << " [cm]\n" - << " EmittanceY = " << emittanceY() << " [cm]\n" - << " beta-star = " << betaStar() << " [cm]\n" - << "-----------------------------------------------------\n\n"; - } + const BeamSpot::Point BeamSpot::position(const double z) const { + Point pos(x(z), y(z), z); + return pos; + } - // - std::ostream& operator<<(std::ostream& os, BeamSpot beam) { - std::stringstream ss; - beam.print(ss); - os << ss.str(); - return os; - } + void BeamSpot::print(std::stringstream& ss) const { + ss << "-----------------------------------------------------\n" + << " Beam Spot Data\n\n" + << " Beam type = " << type() << "\n" + << " X0 = " << x0() << " +/- " << x0Error() << " [cm]\n" + << " Y0 = " << y0() << " +/- " << y0Error() << " [cm]\n" + << " Z0 = " << z0() << " +/- " << z0Error() << " [cm]\n" + << " Sigma Z0 = " << sigmaZ() << " +/- " << sigmaZ0Error() << " [cm]\n" + << " dxdz = " << dxdz() << " +/- " << dxdzError() << " [radians]\n" + << " dydz = " << dydz() << " +/- " << dydzError() << " [radians]\n" + << " Beam width X = " << BeamWidthX() << " +/- " << BeamWidthXError() << " [cm]\n" + << " Beam width Y = " << BeamWidthY() << " +/- " << BeamWidthYError() << " [cm]\n" + << " EmittanceX = " << emittanceX() << " [cm]\n" + << " EmittanceY = " << emittanceY() << " [cm]\n" + << " beta-star = " << betaStar() << " [cm]\n" + << "-----------------------------------------------------\n\n"; + } - BeamSpot::Covariance3DMatrix BeamSpot::rotatedCovariance3D() const { - AlgebraicVector3 newZ(dxdz(), dydz(), 1.); - AlgebraicVector3 globalZ(0., 0., 1.); - AlgebraicVector3 rotationAxis = ROOT::Math::Cross(globalZ.Unit(), newZ.Unit()); - float rotationAngle = -acos(ROOT::Math::Dot(globalZ.Unit(), newZ.Unit())); - Basic3DVector aa(rotationAxis[0], rotationAxis[1], rotationAxis[2]); - TkRotation rotation(aa, rotationAngle); - AlgebraicMatrix33 rotationMatrix; - rotationMatrix(0, 0) = rotation.xx(); - rotationMatrix(0, 1) = rotation.xy(); - rotationMatrix(0, 2) = rotation.xz(); - rotationMatrix(1, 0) = rotation.yx(); - rotationMatrix(1, 1) = rotation.yy(); - rotationMatrix(1, 2) = rotation.yz(); - rotationMatrix(2, 0) = rotation.zx(); - rotationMatrix(2, 1) = rotation.zy(); - rotationMatrix(2, 2) = rotation.zz(); + // + std::ostream& operator<<(std::ostream& os, BeamSpot beam) { + std::stringstream ss; + beam.print(ss); + os << ss.str(); + return os; + } - AlgebraicSymMatrix33 diagError; - diagError(0, 0) = pow(BeamWidthX(), 2); - diagError(1, 1) = pow(BeamWidthY(), 2); - diagError(2, 2) = pow(sigmaZ(), 2); + BeamSpot::Covariance3DMatrix BeamSpot::rotatedCovariance3D() const { + AlgebraicVector3 newZ(dxdz(), dydz(), 1.); + AlgebraicVector3 globalZ(0., 0., 1.); + AlgebraicVector3 rotationAxis = ROOT::Math::Cross(globalZ.Unit(), newZ.Unit()); + float rotationAngle = -acos(ROOT::Math::Dot(globalZ.Unit(), newZ.Unit())); + Basic3DVector aa(rotationAxis[0], rotationAxis[1], rotationAxis[2]); + TkRotation rotation(aa, rotationAngle); + AlgebraicMatrix33 rotationMatrix; + rotationMatrix(0, 0) = rotation.xx(); + rotationMatrix(0, 1) = rotation.xy(); + rotationMatrix(0, 2) = rotation.xz(); + rotationMatrix(1, 0) = rotation.yx(); + rotationMatrix(1, 1) = rotation.yy(); + rotationMatrix(1, 2) = rotation.yz(); + rotationMatrix(2, 0) = rotation.zx(); + rotationMatrix(2, 1) = rotation.zy(); + rotationMatrix(2, 2) = rotation.zz(); - Covariance3DMatrix matrix; - matrix = ROOT::Math::Similarity(rotationMatrix, diagError) + covariance3D(); - return matrix; - } + AlgebraicSymMatrix33 diagError; + diagError(0, 0) = pow(BeamWidthX(), 2); + diagError(1, 1) = pow(BeamWidthY(), 2); + diagError(2, 2) = pow(sigmaZ(), 2); + Covariance3DMatrix matrix; + matrix = ROOT::Math::Similarity(rotationMatrix, diagError) + covariance3D(); + return matrix; + } + } // namespace io_v1 } // namespace reco diff --git a/DataFormats/BeamSpot/src/classes_def.xml b/DataFormats/BeamSpot/src/classes_def.xml index 846be19d45b6b..94995e5ded3fe 100644 --- a/DataFormats/BeamSpot/src/classes_def.xml +++ b/DataFormats/BeamSpot/src/classes_def.xml @@ -1,9 +1,8 @@ - - - + + - + diff --git a/DataFormats/CLHEP/src/classes_def.xml b/DataFormats/CLHEP/src/classes_def.xml index 37e65a265cc17..f7c145c5fa7d8 100644 --- a/DataFormats/CLHEP/src/classes_def.xml +++ b/DataFormats/CLHEP/src/classes_def.xml @@ -1,24 +1,21 @@ - - - + + - - + + - - + + - - + + - - - + + - - - + + diff --git a/DataFormats/CSCDigi/interface/CSCALCTDigi.h b/DataFormats/CSCDigi/interface/CSCALCTDigi.h index a96c23fe95cb8..2e0aa7c6789b6 100644 --- a/DataFormats/CSCDigi/interface/CSCALCTDigi.h +++ b/DataFormats/CSCDigi/interface/CSCALCTDigi.h @@ -14,131 +14,136 @@ #include #include -class CSCALCTDigi { -public: - enum class Version { Legacy = 0, Run3 }; +namespace io_v1 { - typedef std::vector> WireContainer; + class CSCALCTDigi { + public: + enum class Version { Legacy = 0, Run3 }; - /// Constructors - CSCALCTDigi(const uint16_t valid, - const uint16_t quality, - const uint16_t accel, - const uint16_t patternb, - const uint16_t keywire, - const uint16_t bx, - const uint16_t trknmb = 0, - const uint16_t hmt = 0, - const Version version = Version::Legacy); - /// default - CSCALCTDigi(); + typedef std::vector> WireContainer; - /// clear this ALCT - void clear(); + /// Constructors + CSCALCTDigi(const uint16_t valid, + const uint16_t quality, + const uint16_t accel, + const uint16_t patternb, + const uint16_t keywire, + const uint16_t bx, + const uint16_t trknmb = 0, + const uint16_t hmt = 0, + const Version version = Version::Legacy); + /// default + CSCALCTDigi(); - /// check ALCT validity (1 - valid ALCT) - bool isValid() const { return valid_; } + /// clear this ALCT + void clear(); - /// set valid - void setValid(const uint16_t valid) { valid_ = valid; } + /// check ALCT validity (1 - valid ALCT) + bool isValid() const { return valid_; } - /// return quality of a pattern - uint16_t getQuality() const { return quality_; } + /// set valid + void setValid(const uint16_t valid) { valid_ = valid; } - /// set quality - void setQuality(const uint16_t quality) { quality_ = quality; } + /// return quality of a pattern + uint16_t getQuality() const { return quality_; } - /// return Accelerator bit - /// 1-Accelerator pattern, 0-CollisionA or CollisionB pattern - uint16_t getAccelerator() const { return accel_; } + /// set quality + void setQuality(const uint16_t quality) { quality_ = quality; } - /// set accelerator bit - void setAccelerator(const uint16_t accelerator) { accel_ = accelerator; } + /// return Accelerator bit + /// 1-Accelerator pattern, 0-CollisionA or CollisionB pattern + uint16_t getAccelerator() const { return accel_; } - /// return Collision Pattern B bit - /// 1-CollisionB pattern (accel_ = 0), - /// 0-CollisionA pattern (accel_ = 0) - uint16_t getCollisionB() const { return patternb_; } + /// set accelerator bit + void setAccelerator(const uint16_t accelerator) { accel_ = accelerator; } - /// set Collision Pattern B bit - void setCollisionB(const uint16_t collision) { patternb_ = collision; } + /// return Collision Pattern B bit + /// 1-CollisionB pattern (accel_ = 0), + /// 0-CollisionA pattern (accel_ = 0) + uint16_t getCollisionB() const { return patternb_; } - /// return key wire group - uint16_t getKeyWG() const { return keywire_; } + /// set Collision Pattern B bit + void setCollisionB(const uint16_t collision) { patternb_ = collision; } - /// set key wire group - void setKeyWG(const uint16_t keyWG) { keywire_ = keyWG; } + /// return key wire group + uint16_t getKeyWG() const { return keywire_; } - /// return BX - five low bits of BXN counter tagged by the ALCT - uint16_t getBX() const { return bx_; } + /// set key wire group + void setKeyWG(const uint16_t keyWG) { keywire_ = keyWG; } - /// set BX - void setBX(const uint16_t BX) { bx_ = BX; } + /// return BX - five low bits of BXN counter tagged by the ALCT + uint16_t getBX() const { return bx_; } - /// return track number (1,2) - uint16_t getTrknmb() const { return trknmb_; } + /// set BX + void setBX(const uint16_t BX) { bx_ = BX; } - /// Set track number (1,2) after sorting ALCTs. - void setTrknmb(const uint16_t number) { trknmb_ = number; } + /// return track number (1,2) + uint16_t getTrknmb() const { return trknmb_; } - /// return 12-bit full BX. - uint16_t getFullBX() const { return fullbx_; } + /// Set track number (1,2) after sorting ALCTs. + void setTrknmb(const uint16_t number) { trknmb_ = number; } - /// Set 12-bit full BX. - void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } + /// return 12-bit full BX. + uint16_t getFullBX() const { return fullbx_; } - /// return the high multiplicity bits - uint16_t getHMT() const; + /// Set 12-bit full BX. + void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } - /// set the high multiplicity bits - void setHMT(const uint16_t hmt); + /// return the high multiplicity bits + uint16_t getHMT() const; - /// True if the first ALCT has a larger quality, or if it has the same - /// quality but a larger wire group. - bool operator>(const CSCALCTDigi&) const; + /// set the high multiplicity bits + void setHMT(const uint16_t hmt); - /// True if all members (except the number) of both ALCTs are equal. - bool operator==(const CSCALCTDigi&) const; + /// True if the first ALCT has a larger quality, or if it has the same + /// quality but a larger wire group. + bool operator>(const CSCALCTDigi&) const; - /// True if the preceding one is false. - bool operator!=(const CSCALCTDigi&) const; + /// True if all members (except the number) of both ALCTs are equal. + bool operator==(const CSCALCTDigi&) const; - /// Print content of digi. - void print() const; + /// True if the preceding one is false. + bool operator!=(const CSCALCTDigi&) const; - /// set wiregroup number - void setWireGroup(uint16_t wiregroup) { keywire_ = wiregroup; } + /// Print content of digi. + void print() const; - /// Distinguish Run-1/2 from Run-3 - bool isRun3() const { return version_ == Version::Run3; } + /// set wiregroup number + void setWireGroup(uint16_t wiregroup) { keywire_ = wiregroup; } - void setRun3(const bool isRun3); + /// Distinguish Run-1/2 from Run-3 + bool isRun3() const { return version_ == Version::Run3; } - // wire hits in this ALCT - const WireContainer& getHits() const { return hits_.empty() ? emptyContainer() : hits_; } + void setRun3(const bool isRun3); - void setHits(const WireContainer& hits) { hits_ = hits; } + // wire hits in this ALCT + const WireContainer& getHits() const { return hits_.empty() ? emptyContainer() : hits_; } -private: - static const WireContainer& emptyContainer(); - uint16_t valid_; - uint16_t quality_; - uint16_t accel_; - uint16_t patternb_; // not used since 2007 - uint16_t keywire_; - uint16_t bx_; - uint16_t trknmb_; - uint16_t fullbx_; - // In Run-3, CSC trigger data will include the high-multiplicity - // bits for a chamber. These bits may indicate the observation of - // "exotic" events. This data member was included in a prototype. - // Later on, we developed a dedicated object: "CSCShowerDigi" - uint16_t hmt_; + void setHits(const WireContainer& hits) { hits_ = hits; } - Version version_; - // which hits are in this ALCT? - WireContainer hits_; -}; + private: + static const WireContainer& emptyContainer(); + uint16_t valid_; + uint16_t quality_; + uint16_t accel_; + uint16_t patternb_; // not used since 2007 + uint16_t keywire_; + uint16_t bx_; + uint16_t trknmb_; + uint16_t fullbx_; + // In Run-3, CSC trigger data will include the high-multiplicity + // bits for a chamber. These bits may indicate the observation of + // "exotic" events. This data member was included in a prototype. + // Later on, we developed a dedicated object: "CSCShowerDigi" + uint16_t hmt_; -std::ostream& operator<<(std::ostream& o, const CSCALCTDigi& digi); + Version version_; + // which hits are in this ALCT? + WireContainer hits_; + }; + + std::ostream& operator<<(std::ostream& o, const CSCALCTDigi& digi); + +} // namespace io_v1 +using CSCALCTDigi = io_v1::CSCALCTDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCALCTDigiFwd.h b/DataFormats/CSCDigi/interface/CSCALCTDigiFwd.h index 8cd2a9b213c59..04cd0b9495dbe 100644 --- a/DataFormats/CSCDigi/interface/CSCALCTDigiFwd.h +++ b/DataFormats/CSCDigi/interface/CSCALCTDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CSCDigi_CSCALCTDigiFwd_h #define DataFormats_CSCDigi_CSCALCTDigiFwd_h -class CSCALCTDigi; +namespace io_v1 { + class CSCALCTDigi; +} +using CSCALCTDigi = io_v1::CSCALCTDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCCLCTDigi.h b/DataFormats/CSCDigi/interface/CSCCLCTDigi.h index b095210fe1650..95cf6c63c5393 100644 --- a/DataFormats/CSCDigi/interface/CSCCLCTDigi.h +++ b/DataFormats/CSCDigi/interface/CSCCLCTDigi.h @@ -14,132 +14,134 @@ #include #include -class CSCCLCTDigi { -public: - typedef std::vector> ComparatorContainer; +namespace io_v1 { - enum class Version { Legacy = 0, Run3 }; - // for data vs emulator studies - enum CLCTBXMask { kBXDataMask = 0x3 }; + class CSCCLCTDigi { + public: + typedef std::vector> ComparatorContainer; - /// Constructors - CSCCLCTDigi(const uint16_t valid, - const uint16_t quality, - const uint16_t pattern, - const uint16_t striptype, - const uint16_t bend, - const uint16_t strip, - const uint16_t cfeb, - const uint16_t bx, - const uint16_t trknmb = 0, - const uint16_t fullbx = 0, - const int16_t compCode = -1, - const Version version = Version::Legacy, - const bool run3_quart_strip_bit = false, - const bool run3_eighth_strip_bit = false, - const uint16_t run3_pattern = 0, - const uint16_t run3_slope = 0); + enum class Version { Legacy = 0, Run3 }; + // for data vs emulator studies + enum CLCTBXMask { kBXDataMask = 0x3 }; - /// default (calls clear()) - CSCCLCTDigi(); + /// Constructors + CSCCLCTDigi(const uint16_t valid, + const uint16_t quality, + const uint16_t pattern, + const uint16_t striptype, + const uint16_t bend, + const uint16_t strip, + const uint16_t cfeb, + const uint16_t bx, + const uint16_t trknmb = 0, + const uint16_t fullbx = 0, + const int16_t compCode = -1, + const Version version = Version::Legacy, + const bool run3_quart_strip_bit = false, + const bool run3_eighth_strip_bit = false, + const uint16_t run3_pattern = 0, + const uint16_t run3_slope = 0); - /// clear this CLCT - void clear(); + /// default (calls clear()) + CSCCLCTDigi(); - /// check CLCT validity (1 - valid CLCT) - bool isValid() const { return valid_; } + /// clear this CLCT + void clear(); - /// set valid - void setValid(const uint16_t valid) { valid_ = valid; } + /// check CLCT validity (1 - valid CLCT) + bool isValid() const { return valid_; } - /// return quality of a pattern (number of layers hit!) - uint16_t getQuality() const { return quality_; } + /// set valid + void setValid(const uint16_t valid) { valid_ = valid; } - /// set quality - void setQuality(const uint16_t quality) { quality_ = quality; } + /// return quality of a pattern (number of layers hit!) + uint16_t getQuality() const { return quality_; } - /// return pattern - uint16_t getPattern() const { return pattern_; } + /// set quality + void setQuality(const uint16_t quality) { quality_ = quality; } - /// set pattern - void setPattern(const uint16_t pattern) { pattern_ = pattern; } + /// return pattern + uint16_t getPattern() const { return pattern_; } - /// return pattern - uint16_t getRun3Pattern() const { return run3_pattern_; } + /// set pattern + void setPattern(const uint16_t pattern) { pattern_ = pattern; } - /// set pattern - void setRun3Pattern(const uint16_t pattern) { run3_pattern_ = pattern; } + /// return pattern + uint16_t getRun3Pattern() const { return run3_pattern_; } - /// return the slope - uint16_t getSlope() const { return run3_slope_; } + /// set pattern + void setRun3Pattern(const uint16_t pattern) { run3_pattern_ = pattern; } - /// set the slope - void setSlope(const uint16_t slope) { run3_slope_ = slope; } + /// return the slope + uint16_t getSlope() const { return run3_slope_; } - /// slope in number of half-strips/layer - /// negative means left-bending - /// positive means right-bending - float getFractionalSlope() const; + /// set the slope + void setSlope(const uint16_t slope) { run3_slope_ = slope; } - /// return striptype - uint16_t getStripType() const { return striptype_; } + /// slope in number of half-strips/layer + /// negative means left-bending + /// positive means right-bending + float getFractionalSlope() const; - /// set stripType - void setStripType(const uint16_t stripType) { striptype_ = stripType; } + /// return striptype + uint16_t getStripType() const { return striptype_; } - /// return bending - /// 0: left-bending (negative delta-strip / delta layer) - /// 1: right-bending (positive delta-strip / delta layer) - uint16_t getBend() const { return bend_; } + /// set stripType + void setStripType(const uint16_t stripType) { striptype_ = stripType; } - /// set bend - void setBend(const uint16_t bend) { bend_ = bend; } + /// return bending + /// 0: left-bending (negative delta-strip / delta layer) + /// 1: right-bending (positive delta-strip / delta layer) + uint16_t getBend() const { return bend_; } - /// return halfstrip that goes from 0 to 31 in a (D)CFEB - uint16_t getStrip() const { return strip_; } + /// set bend + void setBend(const uint16_t bend) { bend_ = bend; } - /// set strip - void setStrip(const uint16_t strip) { strip_ = strip; } + /// return halfstrip that goes from 0 to 31 in a (D)CFEB + uint16_t getStrip() const { return strip_; } - /// set single quart strip bit - void setQuartStripBit(const bool quartStripBit) { run3_quart_strip_bit_ = quartStripBit; } + /// set strip + void setStrip(const uint16_t strip) { strip_ = strip; } - /// get single quart strip bit - bool getQuartStripBit() const { return run3_quart_strip_bit_; } + /// set single quart strip bit + void setQuartStripBit(const bool quartStripBit) { run3_quart_strip_bit_ = quartStripBit; } - /// set single eighth strip bit - void setEighthStripBit(const bool eighthStripBit) { run3_eighth_strip_bit_ = eighthStripBit; } + /// get single quart strip bit + bool getQuartStripBit() const { return run3_quart_strip_bit_; } - /// get single eighth strip bit - bool getEighthStripBit() const { return run3_eighth_strip_bit_; } + /// set single eighth strip bit + void setEighthStripBit(const bool eighthStripBit) { run3_eighth_strip_bit_ = eighthStripBit; } - /// return Key CFEB ID - uint16_t getCFEB() const { return cfeb_; } + /// get single eighth strip bit + bool getEighthStripBit() const { return run3_eighth_strip_bit_; } - /// set Key CFEB ID - void setCFEB(const uint16_t cfeb) { cfeb_ = cfeb; } + /// return Key CFEB ID + uint16_t getCFEB() const { return cfeb_; } - /// return BX - uint16_t getBX() const { return bx_; } + /// set Key CFEB ID + void setCFEB(const uint16_t cfeb) { cfeb_ = cfeb; } - /// return 2-bit BX as in data - uint16_t getBXData() const { return bx_ & kBXDataMask; } + /// return BX + uint16_t getBX() const { return bx_; } - /// set bx - void setBX(const uint16_t bx) { bx_ = bx; } + /// return 2-bit BX as in data + uint16_t getBXData() const { return bx_ & kBXDataMask; } - /// return track number (1,2) - uint16_t getTrknmb() const { return trknmb_; } + /// set bx + void setBX(const uint16_t bx) { bx_ = bx; } - /// Convert strip_ and cfeb_ to keyStrip. Each CFEB has up to 16 strips - /// (32 halfstrips). There are 5 cfebs. The "strip_" variable is one - /// of 32 halfstrips on the keylayer of a single CFEB, so that - /// Halfstrip = (cfeb*32 + strip). - /// This function can also return the quartstrip or eighthstrip - /// when the comparator code has been set - uint16_t getKeyStrip(const uint16_t n = 2) const; + /// return track number (1,2) + uint16_t getTrknmb() const { return trknmb_; } - /* + /// Convert strip_ and cfeb_ to keyStrip. Each CFEB has up to 16 strips + /// (32 halfstrips). There are 5 cfebs. The "strip_" variable is one + /// of 32 halfstrips on the keylayer of a single CFEB, so that + /// Halfstrip = (cfeb*32 + strip). + /// This function can also return the quartstrip or eighthstrip + /// when the comparator code has been set + uint16_t getKeyStrip(const uint16_t n = 2) const; + + /* Strips are numbered starting from 1 in CMSSW Half-strips, quarter-strips and eighth-strips are numbered starting from 0 The table below shows the correct numbering @@ -156,86 +158,88 @@ class CSCCLCTDigi { Note: the CSC geometry also has a strip offset of +/- 0.25 strips. When comparing the CLCT/LCT position with the true muon position, take the offset into account! */ - float getFractionalStrip(const uint16_t n = 2) const; - - /// Set track number (1,2) after sorting CLCTs. - void setTrknmb(const uint16_t number) { trknmb_ = number; } - - /// return 12-bit full BX. - uint16_t getFullBX() const { return fullbx_; } - - /// Set 12-bit full BX. - void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } - - // 12-bit comparator code - int16_t getCompCode() const { return (isRun3() ? compCode_ : -1); } - - void setCompCode(const int16_t code) { compCode_ = code; } - - // comparator hits in this CLCT - const ComparatorContainer& getHits() const { return hits_.empty() ? emptyContainer() : hits_; } - - void setHits(const ComparatorContainer& hits) { hits_ = hits; } - - /// True if the left-hand side has a larger "quality". Full definition - /// of "quality" depends on quality word itself, pattern type, and strip - /// number. - bool operator>(const CSCCLCTDigi&) const; - - /// True if the two LCTs have exactly the same members (except the number). - bool operator==(const CSCCLCTDigi&) const; - - /// True if the preceding one is false. - bool operator!=(const CSCCLCTDigi&) const; - - /// Print content of digi. - void print() const; - - /// Distinguish Run-1/2 from Run-3 - bool isRun3() const { return version_ == Version::Run3; } - - void setRun3(bool isRun3); - -private: - static const ComparatorContainer& emptyContainer(); - uint16_t valid_; - uint16_t quality_; - // Run-1/2 pattern number. - // For Run-3 CLCTs, please use run3_pattern_. For some backward - // compatibility the trigger emulator translates run3_pattern_ - // approximately into pattern_ with a lookup table - uint16_t pattern_; - uint16_t striptype_; // not used since mid-2008 - // Common definition for left/right bending in Run-1, Run-2 and Run-3. - // 0: right; 1: left - uint16_t bend_; - // actually the half-strip number - uint16_t strip_; - // There are up to 7 (D)CFEBs in a chamber - uint16_t cfeb_; - uint16_t bx_; - uint16_t trknmb_; - uint16_t fullbx_; - - // new members in Run-3: - - // 12-bit comparator code - // set by default to -1 for Run-1 and Run-2 CLCTs - int16_t compCode_; - // 1/4-strip bit set by CCLUT (see DN-19-059) - bool run3_quart_strip_bit_; - // 1/8-strip bit set by CCLUT - bool run3_eighth_strip_bit_; - // In Run-3, the CLCT digi has 3-bit pattern ID, 0 through 4 - uint16_t run3_pattern_; - // 4-bit bending value. There will be 16 bending values * 2 (left/right) - uint16_t run3_slope_; - - // which hits are in this CLCT? - ComparatorContainer hits_; - Version version_; -}; - -std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi); - + float getFractionalStrip(const uint16_t n = 2) const; + + /// Set track number (1,2) after sorting CLCTs. + void setTrknmb(const uint16_t number) { trknmb_ = number; } + + /// return 12-bit full BX. + uint16_t getFullBX() const { return fullbx_; } + + /// Set 12-bit full BX. + void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } + + // 12-bit comparator code + int16_t getCompCode() const { return (isRun3() ? compCode_ : -1); } + + void setCompCode(const int16_t code) { compCode_ = code; } + + // comparator hits in this CLCT + const ComparatorContainer& getHits() const { return hits_.empty() ? emptyContainer() : hits_; } + + void setHits(const ComparatorContainer& hits) { hits_ = hits; } + + /// True if the left-hand side has a larger "quality". Full definition + /// of "quality" depends on quality word itself, pattern type, and strip + /// number. + bool operator>(const CSCCLCTDigi&) const; + + /// True if the two LCTs have exactly the same members (except the number). + bool operator==(const CSCCLCTDigi&) const; + + /// True if the preceding one is false. + bool operator!=(const CSCCLCTDigi&) const; + + /// Print content of digi. + void print() const; + + /// Distinguish Run-1/2 from Run-3 + bool isRun3() const { return version_ == Version::Run3; } + + void setRun3(bool isRun3); + + private: + static const ComparatorContainer& emptyContainer(); + uint16_t valid_; + uint16_t quality_; + // Run-1/2 pattern number. + // For Run-3 CLCTs, please use run3_pattern_. For some backward + // compatibility the trigger emulator translates run3_pattern_ + // approximately into pattern_ with a lookup table + uint16_t pattern_; + uint16_t striptype_; // not used since mid-2008 + // Common definition for left/right bending in Run-1, Run-2 and Run-3. + // 0: right; 1: left + uint16_t bend_; + // actually the half-strip number + uint16_t strip_; + // There are up to 7 (D)CFEBs in a chamber + uint16_t cfeb_; + uint16_t bx_; + uint16_t trknmb_; + uint16_t fullbx_; + + // new members in Run-3: + + // 12-bit comparator code + // set by default to -1 for Run-1 and Run-2 CLCTs + int16_t compCode_; + // 1/4-strip bit set by CCLUT (see DN-19-059) + bool run3_quart_strip_bit_; + // 1/8-strip bit set by CCLUT + bool run3_eighth_strip_bit_; + // In Run-3, the CLCT digi has 3-bit pattern ID, 0 through 4 + uint16_t run3_pattern_; + // 4-bit bending value. There will be 16 bending values * 2 (left/right) + uint16_t run3_slope_; + + // which hits are in this CLCT? + ComparatorContainer hits_; + Version version_; + }; + + std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi); + +} // namespace io_v1 +using CSCCLCTDigi = io_v1::CSCCLCTDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCCLCTDigiFwd.h b/DataFormats/CSCDigi/interface/CSCCLCTDigiFwd.h index 5e2c7906ad8f5..e18c2680284a7 100644 --- a/DataFormats/CSCDigi/interface/CSCCLCTDigiFwd.h +++ b/DataFormats/CSCDigi/interface/CSCCLCTDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CSCDigi_CSCCLCTDigiFwd_h #define DataFormats_CSCDigi_CSCCLCTDigiFwd_h -class CSCCLCTDigi; +namespace io_v1 { + class CSCCLCTDigi; +} +using CSCCLCTDigi = io_v1::CSCCLCTDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h b/DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h index 47ef156253891..14b214580d4e1 100644 --- a/DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h +++ b/DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigi.h @@ -12,102 +12,106 @@ #include #include -class CSCCLCTPreTriggerDigi { -public: - /// Constructors - CSCCLCTPreTriggerDigi(const int valid, - const int quality, - const int pattern, - const int striptype, - const int bend, - const int strip, - const int cfeb, - const int bx, - const int trknmb = 0, - const int fullbx = 0); - /// default - CSCCLCTPreTriggerDigi(); - - /// clear this CLCT - void clear(); - - /// check CLCT validity (1 - valid CLCT) - bool isValid() const { return valid_; } - - /// return quality of a pattern (number of layers hit!) - int getQuality() const { return quality_; } - - /// return pattern - int getPattern() const { return pattern_; } - - /// return striptype - int getStripType() const { return striptype_; } - - /// return bend - int getBend() const { return bend_; } - - /// return halfstrip that goes from 0 to 31 - int getStrip() const { return strip_; } - - /// return Key CFEB ID - int getCFEB() const { return cfeb_; } - - /// return BX - int getBX() const { return bx_; } - - /// return track number (1,2) - int getTrknmb() const { return trknmb_; } - - /// Convert strip_ and cfeb_ to keyStrip. Each CFEB has up to 16 strips - /// (32 halfstrips). There are 5 cfebs. The "strip_" variable is one - /// of 32 halfstrips on the keylayer of a single CFEB, so that - /// Distrip = (cfeb*32 + strip)/4. - /// Halfstrip = (cfeb*32 + strip). - /// Always return halfstrip number since this is what is stored in - /// the correlated LCT digi. For distrip patterns, the convention is - /// the same as for persistent strip numbers: low halfstrip of a distrip. - /// SV, June 15th, 2006. - int getKeyStrip() const { - int keyStrip = cfeb_ * 32 + strip_; - return keyStrip; - } - - /// Set track number (1,2) after sorting CLCTs. - void setTrknmb(const uint16_t number) { trknmb_ = number; } - - /// return 12-bit full BX. - int getFullBX() const { return fullbx_; } - - /// Set 12-bit full BX. - void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } - - /// True if the left-hand side has a larger "quality". Full definition - /// of "quality" depends on quality word itself, pattern type, and strip - /// number. - bool operator>(const CSCCLCTPreTriggerDigi&) const; - - /// True if the two LCTs have exactly the same members (except the number). - bool operator==(const CSCCLCTPreTriggerDigi&) const; - - /// True if the preceding one is false. - bool operator!=(const CSCCLCTPreTriggerDigi&) const; - - /// Print content of digi. - void print() const; - -private: - uint16_t valid_; - uint16_t quality_; - uint16_t pattern_; - uint16_t striptype_; // not used since mid-2008 - uint16_t bend_; - uint16_t strip_; - uint16_t cfeb_; - uint16_t bx_; - uint16_t trknmb_; - uint16_t fullbx_; -}; - -std::ostream& operator<<(std::ostream& o, const CSCCLCTPreTriggerDigi& digi); - +namespace io_v1 { + + class CSCCLCTPreTriggerDigi { + public: + /// Constructors + CSCCLCTPreTriggerDigi(const int valid, + const int quality, + const int pattern, + const int striptype, + const int bend, + const int strip, + const int cfeb, + const int bx, + const int trknmb = 0, + const int fullbx = 0); + /// default + CSCCLCTPreTriggerDigi(); + + /// clear this CLCT + void clear(); + + /// check CLCT validity (1 - valid CLCT) + bool isValid() const { return valid_; } + + /// return quality of a pattern (number of layers hit!) + int getQuality() const { return quality_; } + + /// return pattern + int getPattern() const { return pattern_; } + + /// return striptype + int getStripType() const { return striptype_; } + + /// return bend + int getBend() const { return bend_; } + + /// return halfstrip that goes from 0 to 31 + int getStrip() const { return strip_; } + + /// return Key CFEB ID + int getCFEB() const { return cfeb_; } + + /// return BX + int getBX() const { return bx_; } + + /// return track number (1,2) + int getTrknmb() const { return trknmb_; } + + /// Convert strip_ and cfeb_ to keyStrip. Each CFEB has up to 16 strips + /// (32 halfstrips). There are 5 cfebs. The "strip_" variable is one + /// of 32 halfstrips on the keylayer of a single CFEB, so that + /// Distrip = (cfeb*32 + strip)/4. + /// Halfstrip = (cfeb*32 + strip). + /// Always return halfstrip number since this is what is stored in + /// the correlated LCT digi. For distrip patterns, the convention is + /// the same as for persistent strip numbers: low halfstrip of a distrip. + /// SV, June 15th, 2006. + int getKeyStrip() const { + int keyStrip = cfeb_ * 32 + strip_; + return keyStrip; + } + + /// Set track number (1,2) after sorting CLCTs. + void setTrknmb(const uint16_t number) { trknmb_ = number; } + + /// return 12-bit full BX. + int getFullBX() const { return fullbx_; } + + /// Set 12-bit full BX. + void setFullBX(const uint16_t fullbx) { fullbx_ = fullbx; } + + /// True if the left-hand side has a larger "quality". Full definition + /// of "quality" depends on quality word itself, pattern type, and strip + /// number. + bool operator>(const CSCCLCTPreTriggerDigi&) const; + + /// True if the two LCTs have exactly the same members (except the number). + bool operator==(const CSCCLCTPreTriggerDigi&) const; + + /// True if the preceding one is false. + bool operator!=(const CSCCLCTPreTriggerDigi&) const; + + /// Print content of digi. + void print() const; + + private: + uint16_t valid_; + uint16_t quality_; + uint16_t pattern_; + uint16_t striptype_; // not used since mid-2008 + uint16_t bend_; + uint16_t strip_; + uint16_t cfeb_; + uint16_t bx_; + uint16_t trknmb_; + uint16_t fullbx_; + }; + + std::ostream& operator<<(std::ostream& o, const CSCCLCTPreTriggerDigi& digi); + +} // namespace io_v1 +using CSCCLCTPreTriggerDigi = io_v1::CSCCLCTPreTriggerDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCComparatorDigi.h b/DataFormats/CSCDigi/interface/CSCComparatorDigi.h index 3d57a7022e365..a32d6d86cc7fb 100644 --- a/DataFormats/CSCDigi/interface/CSCComparatorDigi.h +++ b/DataFormats/CSCDigi/interface/CSCComparatorDigi.h @@ -13,66 +13,70 @@ #include #include -class CSCComparatorDigi { -public: - /// Construct from the strip number and the ADC readings. - CSCComparatorDigi(int strip, int comparator, int timeBinWord); - ///comparator here can be either 0 or 1 for left or right halfstrip of given strip +namespace io_v1 { - /// Default construction. - CSCComparatorDigi(); + class CSCComparatorDigi { + public: + /// Construct from the strip number and the ADC readings. + CSCComparatorDigi(int strip, int comparator, int timeBinWord); + ///comparator here can be either 0 or 1 for left or right halfstrip of given strip - /// Digis are equal if they are on the same strip and have same Comparator data - bool operator==(const CSCComparatorDigi& digi) const; + /// Default construction. + CSCComparatorDigi(); - /// sort by time first, then by strip - bool operator<(const CSCComparatorDigi& digi) const; + /// Digis are equal if they are on the same strip and have same Comparator data + bool operator==(const CSCComparatorDigi& digi) const; - /// Get the distrip number. Counts from 0. - int getDiStrip() const; + /// sort by time first, then by strip + bool operator<(const CSCComparatorDigi& digi) const; - /// Get the strip number. Counts from 1. - int getStrip() const { return strip_; } + /// Get the distrip number. Counts from 0. + int getDiStrip() const; - /// Get the CFEB number. Counts from 0. - int getCFEB() const; + /// Get the strip number. Counts from 1. + int getStrip() const { return strip_; } - /// Get Comparator readings. Can be 0 or 1. - int getComparator() const { return comparator_; } + /// Get the CFEB number. Counts from 0. + int getCFEB() const; - /// Return the word with each bit corresponding to a time bin - int getTimeBinWord() const { return timeBinWord_; } + /// Get Comparator readings. Can be 0 or 1. + int getComparator() const { return comparator_; } - /// Return bin number of first time bin which is ON. Counts from 0. - int getTimeBin() const; + /// Return the word with each bit corresponding to a time bin + int getTimeBinWord() const { return timeBinWord_; } - /// Get the associated halfstrip number for this comparator digi. Counts from 0. - int getHalfStrip() const; + /// Return bin number of first time bin which is ON. Counts from 0. + int getTimeBin() const; - /// Return the fractional half-strip. Counts from 0.25 - float getFractionalStrip() const; + /// Get the associated halfstrip number for this comparator digi. Counts from 0. + int getHalfStrip() const; - /** Return vector of the bin numbers for which time bins are ON. + /// Return the fractional half-strip. Counts from 0.25 + float getFractionalStrip() const; + + /** Return vector of the bin numbers for which time bins are ON. * e.g. if bits 0 and 13 fired, then this vector will contain the values 0 and 13 */ - std::vector getTimeBinsOn() const; + std::vector getTimeBinsOn() const; - /// Set the strip number - void setStrip(int strip); + /// Set the strip number + void setStrip(int strip); - /// Set Comparator data - void setComparator(int comparator); + /// Set Comparator data + void setComparator(int comparator); - /// Print content of digi - void print() const; + /// Print content of digi + void print() const; -private: - uint16_t strip_; - uint16_t comparator_; - uint16_t timeBinWord_; -}; + private: + uint16_t strip_; + uint16_t comparator_; + uint16_t timeBinWord_; + }; -/// Output operator -std::ostream& operator<<(std::ostream& o, const CSCComparatorDigi& digi); + /// Output operator + std::ostream& operator<<(std::ostream& o, const CSCComparatorDigi& digi); +} // namespace io_v1 +using CSCComparatorDigi = io_v1::CSCComparatorDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCComparatorDigiFwd.h b/DataFormats/CSCDigi/interface/CSCComparatorDigiFwd.h index afa2dda3a47a5..6e97be3317944 100644 --- a/DataFormats/CSCDigi/interface/CSCComparatorDigiFwd.h +++ b/DataFormats/CSCDigi/interface/CSCComparatorDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CSCDigi_CSCComparatorDigiFwd_h #define DataFormats_CSCDigi_CSCComparatorDigiFwd_h -class CSCComparatorDigi; +namespace io_v1 { + class CSCComparatorDigi; +} +using CSCComparatorDigi = io_v1::CSCComparatorDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h b/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h index b3931a80e04c7..eaa5867b28269 100644 --- a/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h +++ b/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h @@ -16,79 +16,81 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" -class CSCCorrelatedLCTDigi { -public: - enum class Version { Legacy = 0, Run3, Run3HR }; - // for data vs emulator studies - enum LCTBXMask { kBXDataMask = 0x1 }; - - /// SIMULATION ONLY //// - enum Type { - CLCTALCT, // CLCT-centric - ALCTCLCT, // ALCT-centric - ALCTCLCTGEM, // ALCT-CLCT-1 GEM pad - ALCTCLCT2GEM, // ALCT-CLCT-2 GEM pads in coincidence - ALCT2GEM, // ALCT-2 GEM pads in coincidence - CLCT2GEM, // CLCT-2 GEM pads in coincidence - CLCTONLY, // Missing ALCT - ALCTONLY // Missing CLCT - }; - - /// Constructors - CSCCorrelatedLCTDigi(const uint16_t trknmb, - const uint16_t valid, - const uint16_t quality, - const uint16_t keywire, - const uint16_t strip, - const uint16_t pattern, - const uint16_t bend, - const uint16_t bx, - const uint16_t mpclink = 0, - const uint16_t bx0 = 0, - const uint16_t syncErr = 0, - const uint16_t cscID = 0, - const Version version = Version::Legacy, - const bool run3_quart_strip_bit = false, - const bool run3_eighth_strip_bit = false, - const uint16_t run3_pattern = 0, - const uint16_t run3_slope = 0, - const int type = ALCTCLCT, - const uint16_t gemLayerUsedForSlopeComputation = 0); - - /// default (calls clear()) - CSCCorrelatedLCTDigi(); - - /// clear this LCT - void clear(); - - /// return track number - uint16_t getTrknmb() const { return trknmb; } - - /// return valid pattern bit - bool isValid() const { return valid; } - - /// return the Quality - uint16_t getQuality() const { return quality; } - - /// return the key wire group. counts from 0. - uint16_t getKeyWG() const { return keywire; } - - /// return the key halfstrip from 0,159 - uint16_t getStrip(uint16_t n = 2) const; - - /// set single quart strip bit - void setQuartStripBit(const bool quartStripBit) { run3_quart_strip_bit_ = quartStripBit; } - - /// get single quart strip bit - bool getQuartStripBit() const { return run3_quart_strip_bit_; } - - /// set single eighth strip bit - void setEighthStripBit(const bool eighthStripBit) { run3_eighth_strip_bit_ = eighthStripBit; } - - /// get single eighth strip bit - bool getEighthStripBit() const { return run3_eighth_strip_bit_; } - - /* +namespace io_v1 { + + class CSCCorrelatedLCTDigi { + public: + enum class Version { Legacy = 0, Run3, Run3HR }; + // for data vs emulator studies + enum LCTBXMask { kBXDataMask = 0x1 }; + + /// SIMULATION ONLY //// + enum Type { + CLCTALCT, // CLCT-centric + ALCTCLCT, // ALCT-centric + ALCTCLCTGEM, // ALCT-CLCT-1 GEM pad + ALCTCLCT2GEM, // ALCT-CLCT-2 GEM pads in coincidence + ALCT2GEM, // ALCT-2 GEM pads in coincidence + CLCT2GEM, // CLCT-2 GEM pads in coincidence + CLCTONLY, // Missing ALCT + ALCTONLY // Missing CLCT + }; + + /// Constructors + CSCCorrelatedLCTDigi(const uint16_t trknmb, + const uint16_t valid, + const uint16_t quality, + const uint16_t keywire, + const uint16_t strip, + const uint16_t pattern, + const uint16_t bend, + const uint16_t bx, + const uint16_t mpclink = 0, + const uint16_t bx0 = 0, + const uint16_t syncErr = 0, + const uint16_t cscID = 0, + const Version version = Version::Legacy, + const bool run3_quart_strip_bit = false, + const bool run3_eighth_strip_bit = false, + const uint16_t run3_pattern = 0, + const uint16_t run3_slope = 0, + const int type = ALCTCLCT, + const uint16_t gemLayerUsedForSlopeComputation = 0); + + /// default (calls clear()) + CSCCorrelatedLCTDigi(); + + /// clear this LCT + void clear(); + + /// return track number + uint16_t getTrknmb() const { return trknmb; } + + /// return valid pattern bit + bool isValid() const { return valid; } + + /// return the Quality + uint16_t getQuality() const { return quality; } + + /// return the key wire group. counts from 0. + uint16_t getKeyWG() const { return keywire; } + + /// return the key halfstrip from 0,159 + uint16_t getStrip(uint16_t n = 2) const; + + /// set single quart strip bit + void setQuartStripBit(const bool quartStripBit) { run3_quart_strip_bit_ = quartStripBit; } + + /// get single quart strip bit + bool getQuartStripBit() const { return run3_quart_strip_bit_; } + + /// set single eighth strip bit + void setEighthStripBit(const bool eighthStripBit) { run3_eighth_strip_bit_ = eighthStripBit; } + + /// get single eighth strip bit + bool getEighthStripBit() const { return run3_eighth_strip_bit_; } + + /* Strips are numbered starting from 1 in CMSSW Half-strips, quarter-strips and eighth-strips are numbered starting from 0 The table below shows the correct numbering @@ -105,193 +107,195 @@ class CSCCorrelatedLCTDigi { Note: the CSC geometry also has a strip offset of +/- 0.25 strips. When comparing the CLCT/LCT position with the true muon position, take the offset into account! */ - float getFractionalStrip(uint16_t n = 2) const; + float getFractionalStrip(uint16_t n = 2) const; - /// return the Run-2 pattern ID - uint16_t getPattern() const { return pattern; } + /// return the Run-2 pattern ID + uint16_t getPattern() const { return pattern; } - /// return the Run-3 pattern ID - uint16_t getRun3Pattern() const { return run3_pattern_; } + /// return the Run-3 pattern ID + uint16_t getRun3Pattern() const { return run3_pattern_; } - /// return the slope with the 4 bits resolution (for backward compatibility). - uint16_t getSlope() const; - // return the slope with extended resolution. The raw slope resolution is 4 bits for Legacy and Run3, and 6 bits for Run3HR. If resolution=0, return raw slope value with the full resolution. - uint16_t getSlopeEx(uint16_t resolution = 0) const; - uint16_t getRawSlopeResolution() const { return version_ == Version::Run3HR ? 6 : 4; } + /// return the slope with the 4 bits resolution (for backward compatibility). + uint16_t getSlope() const; + // return the slope with extended resolution. The raw slope resolution is 4 bits for Legacy and Run3, and 6 bits for Run3HR. If resolution=0, return raw slope value with the full resolution. + uint16_t getSlopeEx(uint16_t resolution = 0) const; + uint16_t getRawSlopeResolution() const { return version_ == Version::Run3HR ? 6 : 4; } - /// slope in number of half-strips/layer - /// negative means left-bending - /// positive means right-bending - float getFractionalSlope() const; + /// slope in number of half-strips/layer + /// negative means left-bending + /// positive means right-bending + float getFractionalSlope() const; - /// return left/right bending - /// 0: left-bending (negative delta-strip / delta layer) - /// 1: right-bending (positive delta-strip / delta layer) - uint16_t getBend() const { return bend; } + /// return left/right bending + /// 0: left-bending (negative delta-strip / delta layer) + /// 1: right-bending (positive delta-strip / delta layer) + uint16_t getBend() const { return bend; } - /// return BX - uint16_t getBX() const { return bx; } + /// return BX + uint16_t getBX() const { return bx; } - /// return 1-bit BX as in data - uint16_t getBXData() const { return bx & kBXDataMask; } + /// return 1-bit BX as in data + uint16_t getBXData() const { return bx & kBXDataMask; } - /// return CLCT pattern number (in use again Feb 2011) - /// This function should not be used for Run-3 - uint16_t getCLCTPattern() const; + /// return CLCT pattern number (in use again Feb 2011) + /// This function should not be used for Run-3 + uint16_t getCLCTPattern() const; - /// return strip type (obsolete since mid-2008) - uint16_t getStripType() const { return ((pattern & 0x8) >> 3); } + /// return strip type (obsolete since mid-2008) + uint16_t getStripType() const { return ((pattern & 0x8) >> 3); } - /// return MPC link number, 0 means not sorted, 1-3 give MPC sorting rank - uint16_t getMPCLink() const { return mpclink; } + /// return MPC link number, 0 means not sorted, 1-3 give MPC sorting rank + uint16_t getMPCLink() const { return mpclink; } - uint16_t getCSCID() const { return cscID; } - uint16_t getBX0() const { return bx0; } - uint16_t getSyncErr() const { return syncErr; } + uint16_t getCSCID() const { return cscID; } + uint16_t getBX0() const { return bx0; } + uint16_t getSyncErr() const { return syncErr; } - /// Run-3 introduces high-multiplicity bits for CSCs. - /// The allocation is different for ME1/1 and non-ME1/1 - /// chambers. Both LCTs in a chamber are needed for the complete - /// high-multiplicity trigger information - uint16_t getHMT() const; + /// Run-3 introduces high-multiplicity bits for CSCs. + /// The allocation is different for ME1/1 and non-ME1/1 + /// chambers. Both LCTs in a chamber are needed for the complete + /// high-multiplicity trigger information + uint16_t getHMT() const; + + /// Set track number (1,2) after sorting LCTs. + void setTrknmb(const uint16_t number) { trknmb = number; } + + /// Set mpc link number after MPC sorting + void setMPCLink(const uint16_t& link) { mpclink = link; } + + /// Print content of correlated LCT digi + void print() const; + + ///Comparison + bool operator==(const CSCCorrelatedLCTDigi&) const; + bool operator!=(const CSCCorrelatedLCTDigi& rhs) const { return !(this->operator==(rhs)); } + + /// set wiregroup number + void setWireGroup(const uint16_t wiregroup) { keywire = wiregroup; } + + /// set quality code + void setQuality(const uint16_t q) { quality = q; } + + /// set valid + void setValid(const uint16_t v) { valid = v; } + + /// set strip + void setStrip(const uint16_t s) { strip = s; } + + /// set pattern + void setPattern(const uint16_t p) { pattern = p; } + + /// set Run-3 pattern + void setRun3Pattern(const uint16_t pattern) { run3_pattern_ = pattern; } + + /// set the slope + void setSlope(const uint16_t slope) { run3_slope_ = slope; } + + /// set bend + void setBend(const uint16_t b) { bend = b; } + + /// set bx + void setBX(const uint16_t b) { bx = b; } + + /// set bx0 + void setBX0(const uint16_t b) { bx0 = b; } + + /// set syncErr + void setSyncErr(const uint16_t s) { syncErr = s; } + + /// set cscID + void setCSCID(const uint16_t c) { cscID = c; } + + /// set high-multiplicity bits + void setHMT(const uint16_t h); + + /// Distinguish Run-1/2 from Run-3 + bool isRun3() const { return version_ == Version::Run3 || version_ == Version::Run3HR; } + + Version getVersion() const { return version_; } + void setVersion(const Version version) { version_ = version; } + + int getType() const { return type_; } + + void setType(int type) { type_ = type; } + + uint16_t getGemLayerUsedForSlopeComputation() const { return gemLayerUsedForSlopeComputation_; } + void setGemLayerUsedForSlopeComputation(uint16_t layer) { gemLayerUsedForSlopeComputation_ = layer; } + + void setALCT(const CSCALCTDigi& alct) { alct_ = alct; } + void setCLCT(const CSCCLCTDigi& clct) { clct_ = clct; } + void setGEM1(const GEMPadDigi& gem) { gem1_ = gem; } + void setGEM2(const GEMPadDigi& gem) { gem2_ = gem; } + const CSCALCTDigi& getALCT() const { return alct_; } + const CSCCLCTDigi& getCLCT() const { return clct_; } + const GEMPadDigi& getGEM1() const { return gem1_; } + const GEMPadDigi& getGEM2() const { return gem2_; } + + private: + // Note: The Run-3 data format is substantially different than the + // Run-1/2 data format. Some explanation is provided below. For + // more information, please check "DN-20-016". + + // Run-1, Run-2 and Run-3 trknmb is either 1 or 2. + uint16_t trknmb; + // In Run-3, the valid will be encoded as a quality + // value "000" or "00". + uint16_t valid; + // In Run-3, the LCT quality number will be 2 or 3 bits + // For ME1/1 chambers: 3 bits + // For non-ME1/1 chambers: 2 bits + uint16_t quality; + // 7-bit key wire + uint16_t keywire; + // actually the 8-bit half-strip number + uint16_t strip; + // Run-1/2 pattern number. + // For Run-3 CLCTs, please use run3_pattern_. For some backward + // compatibility the trigger emulator translates run3_pattern_ + // approximately into pattern_ with a lookup table + uint16_t pattern; + // Common definition for left/right bending in Run-1, Run-2 and Run-3. + // 0: right; 1: left + uint16_t bend; + uint16_t bx; + uint16_t mpclink; + uint16_t bx0; + // The synchronization bit is actually not used by MPC or EMTF + uint16_t syncErr; + // 4-bit CSC chamber identifier + uint16_t cscID; + + // new members in Run-3: + + // In Run-3, CSC trigger data will include the high-multiplicity + // bits for a chamber. These bits may indicate the observation of + // "exotic" events. This data member was included in a prototype. + // Later on, we developed a dedicated object: "CSCShowerDigi" + uint16_t hmt; + // 1/4-strip bit set by CCLUT (see DN-19-059) + bool run3_quart_strip_bit_; + // 1/8-strip bit set by CCLUT + bool run3_eighth_strip_bit_; + // In Run-3, the CLCT digi has 3-bit pattern ID, 0 through 4 + uint16_t run3_pattern_; + // 4-bit bending value. There will be 16 bending values * 2 (left/right) + uint16_t run3_slope_; + // In Run-3, the GEM information is included in the LCT data format. The "gemLayerUsedForSlopeComputation_" indicates what GEM layer was used to compute the slope. + uint16_t gemLayerUsedForSlopeComputation_; + + /// SIMULATION ONLY //// + int type_; + + CSCALCTDigi alct_; + CSCCLCTDigi clct_; + GEMPadDigi gem1_; + GEMPadDigi gem2_; + + Version version_; + }; - /// Set track number (1,2) after sorting LCTs. - void setTrknmb(const uint16_t number) { trknmb = number; } - - /// Set mpc link number after MPC sorting - void setMPCLink(const uint16_t& link) { mpclink = link; } - - /// Print content of correlated LCT digi - void print() const; - - ///Comparison - bool operator==(const CSCCorrelatedLCTDigi&) const; - bool operator!=(const CSCCorrelatedLCTDigi& rhs) const { return !(this->operator==(rhs)); } - - /// set wiregroup number - void setWireGroup(const uint16_t wiregroup) { keywire = wiregroup; } - - /// set quality code - void setQuality(const uint16_t q) { quality = q; } - - /// set valid - void setValid(const uint16_t v) { valid = v; } - - /// set strip - void setStrip(const uint16_t s) { strip = s; } - - /// set pattern - void setPattern(const uint16_t p) { pattern = p; } - - /// set Run-3 pattern - void setRun3Pattern(const uint16_t pattern) { run3_pattern_ = pattern; } - - /// set the slope - void setSlope(const uint16_t slope) { run3_slope_ = slope; } - - /// set bend - void setBend(const uint16_t b) { bend = b; } - - /// set bx - void setBX(const uint16_t b) { bx = b; } - - /// set bx0 - void setBX0(const uint16_t b) { bx0 = b; } - - /// set syncErr - void setSyncErr(const uint16_t s) { syncErr = s; } - - /// set cscID - void setCSCID(const uint16_t c) { cscID = c; } - - /// set high-multiplicity bits - void setHMT(const uint16_t h); - - /// Distinguish Run-1/2 from Run-3 - bool isRun3() const { return version_ == Version::Run3 || version_ == Version::Run3HR; } - - Version getVersion() const { return version_; } - void setVersion(const Version version) { version_ = version; } - - int getType() const { return type_; } - - void setType(int type) { type_ = type; } - - uint16_t getGemLayerUsedForSlopeComputation() const { return gemLayerUsedForSlopeComputation_; } - void setGemLayerUsedForSlopeComputation(uint16_t layer) { gemLayerUsedForSlopeComputation_ = layer; } - - void setALCT(const CSCALCTDigi& alct) { alct_ = alct; } - void setCLCT(const CSCCLCTDigi& clct) { clct_ = clct; } - void setGEM1(const GEMPadDigi& gem) { gem1_ = gem; } - void setGEM2(const GEMPadDigi& gem) { gem2_ = gem; } - const CSCALCTDigi& getALCT() const { return alct_; } - const CSCCLCTDigi& getCLCT() const { return clct_; } - const GEMPadDigi& getGEM1() const { return gem1_; } - const GEMPadDigi& getGEM2() const { return gem2_; } - -private: - // Note: The Run-3 data format is substantially different than the - // Run-1/2 data format. Some explanation is provided below. For - // more information, please check "DN-20-016". - - // Run-1, Run-2 and Run-3 trknmb is either 1 or 2. - uint16_t trknmb; - // In Run-3, the valid will be encoded as a quality - // value "000" or "00". - uint16_t valid; - // In Run-3, the LCT quality number will be 2 or 3 bits - // For ME1/1 chambers: 3 bits - // For non-ME1/1 chambers: 2 bits - uint16_t quality; - // 7-bit key wire - uint16_t keywire; - // actually the 8-bit half-strip number - uint16_t strip; - // Run-1/2 pattern number. - // For Run-3 CLCTs, please use run3_pattern_. For some backward - // compatibility the trigger emulator translates run3_pattern_ - // approximately into pattern_ with a lookup table - uint16_t pattern; - // Common definition for left/right bending in Run-1, Run-2 and Run-3. - // 0: right; 1: left - uint16_t bend; - uint16_t bx; - uint16_t mpclink; - uint16_t bx0; - // The synchronization bit is actually not used by MPC or EMTF - uint16_t syncErr; - // 4-bit CSC chamber identifier - uint16_t cscID; - - // new members in Run-3: - - // In Run-3, CSC trigger data will include the high-multiplicity - // bits for a chamber. These bits may indicate the observation of - // "exotic" events. This data member was included in a prototype. - // Later on, we developed a dedicated object: "CSCShowerDigi" - uint16_t hmt; - // 1/4-strip bit set by CCLUT (see DN-19-059) - bool run3_quart_strip_bit_; - // 1/8-strip bit set by CCLUT - bool run3_eighth_strip_bit_; - // In Run-3, the CLCT digi has 3-bit pattern ID, 0 through 4 - uint16_t run3_pattern_; - // 4-bit bending value. There will be 16 bending values * 2 (left/right) - uint16_t run3_slope_; - // In Run-3, the GEM information is included in the LCT data format. The "gemLayerUsedForSlopeComputation_" indicates what GEM layer was used to compute the slope. - uint16_t gemLayerUsedForSlopeComputation_; - - /// SIMULATION ONLY //// - int type_; - - CSCALCTDigi alct_; - CSCCLCTDigi clct_; - GEMPadDigi gem1_; - GEMPadDigi gem2_; - - Version version_; -}; - -std::ostream& operator<<(std::ostream& o, const CSCCorrelatedLCTDigi& digi); + std::ostream& operator<<(std::ostream& o, const CSCCorrelatedLCTDigi& digi); +} // namespace io_v1 +using CSCCorrelatedLCTDigi = io_v1::CSCCorrelatedLCTDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiFwd.h b/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiFwd.h index 30c52c7884258..4b08b7f704bad 100644 --- a/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiFwd.h +++ b/DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CSCDigi_CSCCorrelatedLCTDigiFwd_h #define DataFormats_CSCDigi_CSCCorrelatedLCTDigiFwd_h -class CSCCorrelatedLCTDigi; +namespace io_v1 { + class CSCCorrelatedLCTDigi; +} +using CSCCorrelatedLCTDigi = io_v1::CSCCorrelatedLCTDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h b/DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h index 7bb9773cb1235..81ad4d2b1f340 100644 --- a/DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h +++ b/DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h @@ -157,48 +157,50 @@ std::set getKeysList(const std::map& m) { * @class CSCDCCFormatStatusDigi * @brief CSC Format Status Object */ -class CSCDCCFormatStatusDigi { -private: - /** +namespace io_v1 { + + class CSCDCCFormatStatusDigi { + private: + /** * Internal mask storage variables and containers. */ - /** DCC Examiner mask used */ - ExaminerMaskType fDCC_MASK; + /** DCC Examiner mask used */ + ExaminerMaskType fDCC_MASK; - /** CSC Examiner mask used */ - ExaminerMaskType fCSC_MASK; + /** CSC Examiner mask used */ + ExaminerMaskType fCSC_MASK; - /** FED/DCC Id */ - DCCIdType DCCId; + /** FED/DCC Id */ + DCCIdType DCCId; - /** DCC Level summary errors */ - ExaminerStatusType fDDU_SUMMARY_ERRORS; + /** DCC Level summary errors */ + ExaminerStatusType fDDU_SUMMARY_ERRORS; - std::map mDDU_ERRORS; - std::map mCSC_ERRORS; - std::map mCSC_PAYLOADS; - std::map mCSC_STATUS; + std::map mDDU_ERRORS; + std::map mCSC_ERRORS; + std::map mCSC_PAYLOADS; + std::map mCSC_STATUS; -protected: - /// Make CSCIdType from Crate and DMB IDs - CSCIdType makeCSCId(const uint16_t crateId, const uint16_t dmbId) const { - return ((CSCIdType(crateId & 0xFF) << 4) | (dmbId & 0xF)); - } + protected: + /// Make CSCIdType from Crate and DMB IDs + CSCIdType makeCSCId(const uint16_t crateId, const uint16_t dmbId) const { + return ((CSCIdType(crateId & 0xFF) << 4) | (dmbId & 0xF)); + } - /// Init internal data stuctures - void init() { - fDDU_SUMMARY_ERRORS = 0; - fCSC_MASK = 0; - fDCC_MASK = 0; - mDDU_ERRORS.clear(); - mCSC_ERRORS.clear(); - mCSC_PAYLOADS.clear(); - mCSC_STATUS.clear(); - } + /// Init internal data stuctures + void init() { + fDDU_SUMMARY_ERRORS = 0; + fCSC_MASK = 0; + fDCC_MASK = 0; + mDDU_ERRORS.clear(); + mCSC_ERRORS.clear(); + mCSC_PAYLOADS.clear(); + mCSC_STATUS.clear(); + } -public: - /** + public: + /** * @brief Constructor * @param fDCC_MASK_ DCC Examiner mask used (for information purposes). * @param fCSC_MASK_ Examiner mask per chamber @@ -208,85 +210,85 @@ class CSCDCCFormatStatusDigi { * @param mCSC_PAYLOADS_ List of payloads per CSC * @param mCSC_STATUS_ List of statuses per CSC */ - CSCDCCFormatStatusDigi(const DCCIdType DCCId_, - const ExaminerMaskType fDCC_MASK_, - const ExaminerMaskType fCSC_MASK_, - const ExaminerStatusType fDDU_SUMMARY_ERRORS_, - const std::map& mDDU_ERRORS_, - const std::map& mCSC_ERRORS_, - const std::map& mCSC_PAYLOADS_, - const std::map& mCSC_STATUS_) - : DCCId(DCCId_) { - init(); - setDCCExaminerInfo( - fDCC_MASK_, fCSC_MASK_, fDDU_SUMMARY_ERRORS_, mDDU_ERRORS_, mCSC_ERRORS_, mCSC_PAYLOADS_, mCSC_STATUS_); - } + CSCDCCFormatStatusDigi(const DCCIdType DCCId_, + const ExaminerMaskType fDCC_MASK_, + const ExaminerMaskType fCSC_MASK_, + const ExaminerStatusType fDDU_SUMMARY_ERRORS_, + const std::map& mDDU_ERRORS_, + const std::map& mCSC_ERRORS_, + const std::map& mCSC_PAYLOADS_, + const std::map& mCSC_STATUS_) + : DCCId(DCCId_) { + init(); + setDCCExaminerInfo( + fDCC_MASK_, fCSC_MASK_, fDDU_SUMMARY_ERRORS_, mDDU_ERRORS_, mCSC_ERRORS_, mCSC_PAYLOADS_, mCSC_STATUS_); + } - CSCDCCFormatStatusDigi(const DCCIdType DCCId_) : DCCId(DCCId_) { init(); } + CSCDCCFormatStatusDigi(const DCCIdType DCCId_) : DCCId(DCCId_) { init(); } - /// Default constructor. - CSCDCCFormatStatusDigi() : DCCId(0) { init(); } + /// Default constructor. + CSCDCCFormatStatusDigi() : DCCId(0) { init(); } - /// Fill internal data structures using Examiner object - void setDCCExaminerInfo(const ExaminerMaskType fDCC_MASK_, - const ExaminerMaskType fCSC_MASK_, - const ExaminerStatusType fDDU_SUMMARY_ERRORS_, - const std::map& mDDU_ERRORS_, - const std::map& mCSC_ERRORS_, - const std::map& mCSC_PAYLOADS_, - const std::map& mCSC_STATUS_); + /// Fill internal data structures using Examiner object + void setDCCExaminerInfo(const ExaminerMaskType fDCC_MASK_, + const ExaminerMaskType fCSC_MASK_, + const ExaminerStatusType fDDU_SUMMARY_ERRORS_, + const std::map& mDDU_ERRORS_, + const std::map& mCSC_ERRORS_, + const std::map& mCSC_PAYLOADS_, + const std::map& mCSC_STATUS_); #ifdef DEBUG - /** + /** * Manipulate internal data structures for debug purposes */ - void setDCCId(DCCIdType id) { DCCId = id; } - void setDCCMask(ExaminerMaskType mask) { fDCC_MASK = mask; } - void setCSCMask(ExaminerMaskType mask) { fCSC_MASK = mask; } - void setDDUSummaryErrors(ExaminerStatusType status) { fDDU_SUMMARY_ERRORS = status; } - void setDDUErrors(DDUIdType DDUId, ExaminerStatusType status) { - std::map::const_iterator item = mDDU_ERRORS.find(DDUId); - if (item != mDDU_ERRORS.end()) - mDDU_ERRORS[DDUId] = status; - else - mDDU_ERRORS.insert(std::make_pair(DDUId, status)); - } - void setCSCErrors(CSCIdType CSCId, ExaminerStatusType status) { - std::map::const_iterator item = mCSC_ERRORS.find(CSCId); - if (item != mCSC_ERRORS.end()) - mCSC_ERRORS[CSCId] = status; - else - mCSC_ERRORS.insert(std::make_pair(CSCId, status)); - } - void setCSCPayload(CSCIdType CSCId, ExaminerStatusType status) { - std::map::const_iterator item = mCSC_PAYLOADS.find(CSCId); - if (item != mCSC_PAYLOADS.end()) - mCSC_PAYLOADS[CSCId] = status; - else - mCSC_PAYLOADS.insert(std::make_pair(CSCId, status)); - } - void setCSCStatus(CSCIdType CSCId, ExaminerStatusType status) { - std::map::const_iterator item = mCSC_STATUS.find(CSCId); - if (item != mCSC_STATUS.end()) - mCSC_STATUS[CSCId] = status; - else - mCSC_STATUS.insert(std::make_pair(CSCId, status)); - } + void setDCCId(DCCIdType id) { DCCId = id; } + void setDCCMask(ExaminerMaskType mask) { fDCC_MASK = mask; } + void setCSCMask(ExaminerMaskType mask) { fCSC_MASK = mask; } + void setDDUSummaryErrors(ExaminerStatusType status) { fDDU_SUMMARY_ERRORS = status; } + void setDDUErrors(DDUIdType DDUId, ExaminerStatusType status) { + std::map::const_iterator item = mDDU_ERRORS.find(DDUId); + if (item != mDDU_ERRORS.end()) + mDDU_ERRORS[DDUId] = status; + else + mDDU_ERRORS.insert(std::make_pair(DDUId, status)); + } + void setCSCErrors(CSCIdType CSCId, ExaminerStatusType status) { + std::map::const_iterator item = mCSC_ERRORS.find(CSCId); + if (item != mCSC_ERRORS.end()) + mCSC_ERRORS[CSCId] = status; + else + mCSC_ERRORS.insert(std::make_pair(CSCId, status)); + } + void setCSCPayload(CSCIdType CSCId, ExaminerStatusType status) { + std::map::const_iterator item = mCSC_PAYLOADS.find(CSCId); + if (item != mCSC_PAYLOADS.end()) + mCSC_PAYLOADS[CSCId] = status; + else + mCSC_PAYLOADS.insert(std::make_pair(CSCId, status)); + } + void setCSCStatus(CSCIdType CSCId, ExaminerStatusType status) { + std::map::const_iterator item = mCSC_STATUS.find(CSCId); + if (item != mCSC_STATUS.end()) + mCSC_STATUS[CSCId] = status; + else + mCSC_STATUS.insert(std::make_pair(CSCId, status)); + } #endif - /** + /** * Get lists of DDUs and CSCs * Loop iterators for CSCs */ - std::set getListOfDDUs() const { return getKeysList(mDDU_ERRORS); } + std::set getListOfDDUs() const { return getKeysList(mDDU_ERRORS); } - std::set getListOfCSCs() const { return getKeysList(mCSC_PAYLOADS); } + std::set getListOfCSCs() const { return getKeysList(mCSC_PAYLOADS); } - std::set getListOfCSCsWithErrors() const { return getKeysList(mCSC_ERRORS); } + std::set getListOfCSCsWithErrors() const { return getKeysList(mCSC_ERRORS); } - /** + /** * @brief CSC with error iteration procedure. * Usage: * unsigned int i = 0; @@ -299,136 +301,142 @@ class CSCDCCFormatStatusDigi { * @return true if CSC id found and returned, false - otherwise */ - bool nextCSCWithError(uint32_t& iterator, CSCIdType& CSCId) const { return nextInMap(iterator, CSCId, mCSC_ERRORS); } + bool nextCSCWithError(uint32_t& iterator, CSCIdType& CSCId) const { + return nextInMap(iterator, CSCId, mCSC_ERRORS); + } - /** + /** * @brief CSC with status iteration procedure. * @see bool nextCSCWithError(uint32_t&, CSCIdType&) const * @param iterator Integer iterator (incremented automatically) * @param CSCId CSC id to return * @return true if CSC id found and returned, false - otherwise */ - bool nextCSCWithStatus(uint32_t& iterator, CSCIdType& CSCId) const { return nextInMap(iterator, CSCId, mCSC_STATUS); } + bool nextCSCWithStatus(uint32_t& iterator, CSCIdType& CSCId) const { + return nextInMap(iterator, CSCId, mCSC_STATUS); + } - /** + /** * @brief CSC with payload iteration procedure. * @see bool nextCSCWithError(uint32_t&, CSCIdType&) const * @param iterator Integer iterator (incremented automatically) * @param CSCId CSC id to return * @return true if CSC id found and returned, false - otherwise */ - bool nextCSCWithPayload(uint32_t& iterator, CSCIdType& CSCId) const { - return nextInMap(iterator, CSCId, mCSC_PAYLOADS); - } + bool nextCSCWithPayload(uint32_t& iterator, CSCIdType& CSCId) const { + return nextInMap(iterator, CSCId, mCSC_PAYLOADS); + } - /** + /** * Getters for complete mask by using internal identifiers. * Mostly to be used by examiner and old/current code. */ - /** + /** * Return DCC/DDU level Error Status */ - ExaminerStatusType getDDUSummaryErrors() const { return fDDU_SUMMARY_ERRORS; } + ExaminerStatusType getDDUSummaryErrors() const { return fDDU_SUMMARY_ERRORS; } - ExaminerStatusType getDDUErrors(const DDUIdType DDUId) const { - std::map::const_iterator item = mDDU_ERRORS.find(DDUId); - if (item != mDDU_ERRORS.end()) - return item->second; - else - return 0; - } + ExaminerStatusType getDDUErrors(const DDUIdType DDUId) const { + std::map::const_iterator item = mDDU_ERRORS.find(DDUId); + if (item != mDDU_ERRORS.end()) + return item->second; + else + return 0; + } - ExaminerStatusType getCSCErrors(const CSCIdType CSCId) const { - std::map::const_iterator item = mCSC_ERRORS.find(CSCId); - if (item != mCSC_ERRORS.end()) - return item->second; - else - return 0; - } + ExaminerStatusType getCSCErrors(const CSCIdType CSCId) const { + std::map::const_iterator item = mCSC_ERRORS.find(CSCId); + if (item != mCSC_ERRORS.end()) + return item->second; + else + return 0; + } - ExaminerStatusType getCSCErrors(const uint16_t crateId, const uint16_t dmbId) const { - return getCSCErrors(makeCSCId(crateId, dmbId)); - } + ExaminerStatusType getCSCErrors(const uint16_t crateId, const uint16_t dmbId) const { + return getCSCErrors(makeCSCId(crateId, dmbId)); + } - ExaminerStatusType getCSCPayload(const CSCIdType CSCId) const { - std::map::const_iterator item = mCSC_PAYLOADS.find(CSCId); - if (item != mCSC_PAYLOADS.end()) - return item->second; - else - return 0; - } + ExaminerStatusType getCSCPayload(const CSCIdType CSCId) const { + std::map::const_iterator item = mCSC_PAYLOADS.find(CSCId); + if (item != mCSC_PAYLOADS.end()) + return item->second; + else + return 0; + } - ExaminerStatusType getCSCPayload(const uint16_t crateId, const uint16_t dmbId) const { - return getCSCPayload(makeCSCId(crateId, dmbId)); - } + ExaminerStatusType getCSCPayload(const uint16_t crateId, const uint16_t dmbId) const { + return getCSCPayload(makeCSCId(crateId, dmbId)); + } - ExaminerStatusType getCSCStatus(const CSCIdType CSCId) const { - std::map::const_iterator item = mCSC_STATUS.find(CSCId); - if (item != mCSC_STATUS.end()) - return item->second; - else - return 0; - } + ExaminerStatusType getCSCStatus(const CSCIdType CSCId) const { + std::map::const_iterator item = mCSC_STATUS.find(CSCId); + if (item != mCSC_STATUS.end()) + return item->second; + else + return 0; + } - ExaminerStatusType getCSCStatus(const uint16_t crateId, const uint16_t dmbId) const { - return getCSCStatus(makeCSCId(crateId, dmbId)); - } + ExaminerStatusType getCSCStatus(const uint16_t crateId, const uint16_t dmbId) const { + return getCSCStatus(makeCSCId(crateId, dmbId)); + } - /* + /* * Return FED/DCC Id */ - DCCIdType getDCCId() const { return DCCId; } + DCCIdType getDCCId() const { return DCCId; } - /** + /** * Return DCC/DDU level Errors Mask */ - ExaminerMaskType getDCCMask() const { return fDCC_MASK; } + ExaminerMaskType getDCCMask() const { return fDCC_MASK; } - /** + /** * Return CSC level Errors Mask */ - ExaminerMaskType getCSCMask() const { return fCSC_MASK; } + ExaminerMaskType getCSCMask() const { return fCSC_MASK; } - /** + /** * Flag Getters for individual named masks. */ - bool getDDUSummaryFlag(const FormatErrorFlag flag) const { - return ((fDDU_SUMMARY_ERRORS & ExaminerStatusType(0x1 << flag)) != 0); - } - bool getDDUErrorFlag(const DDUIdType DDUId, const FormatErrorFlag flag) const { - return ((getDDUErrors(DDUId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getDDUSummaryFlag(const FormatErrorFlag flag) const { + return ((fDDU_SUMMARY_ERRORS & ExaminerStatusType(0x1 << flag)) != 0); + } + bool getDDUErrorFlag(const DDUIdType DDUId, const FormatErrorFlag flag) const { + return ((getDDUErrors(DDUId) & ExaminerStatusType(0x1 << flag)) != 0); + } - bool getCSCErrorFlag(const CSCIdType CSCId, const FormatErrorFlag flag) const { - return ((getCSCErrors(CSCId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getCSCErrorFlag(const CSCIdType CSCId, const FormatErrorFlag flag) const { + return ((getCSCErrors(CSCId) & ExaminerStatusType(0x1 << flag)) != 0); + } - bool getCSCErrorFlag(const uint16_t crateId, const uint16_t dmbId, const FormatErrorFlag flag) const { - return ((getCSCErrors(crateId, dmbId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getCSCErrorFlag(const uint16_t crateId, const uint16_t dmbId, const FormatErrorFlag flag) const { + return ((getCSCErrors(crateId, dmbId) & ExaminerStatusType(0x1 << flag)) != 0); + } - bool getCSCPayloadFlag(const CSCIdType CSCId, const CSCPayloadFlag flag) const { - return ((getCSCPayload(CSCId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getCSCPayloadFlag(const CSCIdType CSCId, const CSCPayloadFlag flag) const { + return ((getCSCPayload(CSCId) & ExaminerStatusType(0x1 << flag)) != 0); + } - bool getCSCPayloadFlag(const uint16_t crateId, const uint16_t dmbId, const CSCPayloadFlag flag) const { - return ((getCSCPayload(crateId, dmbId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getCSCPayloadFlag(const uint16_t crateId, const uint16_t dmbId, const CSCPayloadFlag flag) const { + return ((getCSCPayload(crateId, dmbId) & ExaminerStatusType(0x1 << flag)) != 0); + } - bool getCSCStatusFlag(const CSCIdType CSCId, const CSCStatusFlag flag) const { - return ((getCSCStatus(CSCId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getCSCStatusFlag(const CSCIdType CSCId, const CSCStatusFlag flag) const { + return ((getCSCStatus(CSCId) & ExaminerStatusType(0x1 << flag)) != 0); + } - bool getCSCStatusFlag(const uint16_t crateId, const uint16_t dmbId, const CSCStatusFlag flag) const { - return ((getCSCStatus(crateId, dmbId) & ExaminerStatusType(0x1 << flag)) != 0); - } + bool getCSCStatusFlag(const uint16_t crateId, const uint16_t dmbId, const CSCStatusFlag flag) const { + return ((getCSCStatus(crateId, dmbId) & ExaminerStatusType(0x1 << flag)) != 0); + } - void print() const; -}; + void print() const; + }; -std::ostream& operator<<(std::ostream& o, const CSCDCCFormatStatusDigi& digi); + std::ostream& operator<<(std::ostream& o, const CSCDCCFormatStatusDigi& digi); +} // namespace io_v1 +using CSCDCCFormatStatusDigi = io_v1::CSCDCCFormatStatusDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCShowerDigi.h b/DataFormats/CSCDigi/interface/CSCShowerDigi.h index f637fd89299e1..9ca4554d0c387 100644 --- a/DataFormats/CSCDigi/interface/CSCShowerDigi.h +++ b/DataFormats/CSCDigi/interface/CSCShowerDigi.h @@ -6,68 +6,73 @@ #include #include -class CSCShowerDigi { -public: - // Run-3 definitions as provided in DN-20-033 - enum Run3Shower { kInvalid = 0, kLoose = 1, kNominal = 2, kTight = 3 }; - // Shower types. and showers from OTMB/TMB are assigned with kLCTShower - enum ShowerType { - kInvalidShower = 0, - kALCTShower = 1, - kCLCTShower = 2, - kLCTShower = 3, - kEMTFShower = 4, - kGMTShower = 5 - }; +namespace io_v1 { + + class CSCShowerDigi { + public: + // Run-3 definitions as provided in DN-20-033 + enum Run3Shower { kInvalid = 0, kLoose = 1, kNominal = 2, kTight = 3 }; + // Shower types. and showers from OTMB/TMB are assigned with kLCTShower + enum ShowerType { + kInvalidShower = 0, + kALCTShower = 1, + kCLCTShower = 2, + kLCTShower = 3, + kEMTFShower = 4, + kGMTShower = 5 + }; - /// Constructors - CSCShowerDigi(const uint16_t inTimeBits, - const uint16_t outTimeBits, - const uint16_t cscID, - const uint16_t bx = 0, - const uint16_t showerType = 4, - const uint16_t wireNHits = 0, - const uint16_t compNHits = 0); - /// default - CSCShowerDigi(); + /// Constructors + CSCShowerDigi(const uint16_t inTimeBits, + const uint16_t outTimeBits, + const uint16_t cscID, + const uint16_t bx = 0, + const uint16_t showerType = 4, + const uint16_t wireNHits = 0, + const uint16_t compNHits = 0); + /// default + CSCShowerDigi(); - /// clear this Shower - void clear(); + /// clear this Shower + void clear(); - /// data - bool isValid() const; + /// data + bool isValid() const; - bool isLooseInTime() const; - bool isNominalInTime() const; - bool isTightInTime() const; - bool isLooseOutOfTime() const; - bool isNominalOutOfTime() const; - bool isTightOutOfTime() const; - bool isValidShowerType() const; + bool isLooseInTime() const; + bool isNominalInTime() const; + bool isTightInTime() const; + bool isLooseOutOfTime() const; + bool isNominalOutOfTime() const; + bool isTightOutOfTime() const; + bool isValidShowerType() const; - uint16_t bitsInTime() const { return bitsInTime_; } - uint16_t bitsOutOfTime() const { return bitsOutOfTime_; } + uint16_t bitsInTime() const { return bitsInTime_; } + uint16_t bitsOutOfTime() const { return bitsOutOfTime_; } - uint16_t getBX() const { return bx_; } - uint16_t getCSCID() const { return cscID_; } - uint16_t getShowerType() const { return showerType_; } - uint16_t getWireNHits() const { return wireNHits_; } - uint16_t getComparatorNHits() const { return comparatorNHits_; } + uint16_t getBX() const { return bx_; } + uint16_t getCSCID() const { return cscID_; } + uint16_t getShowerType() const { return showerType_; } + uint16_t getWireNHits() const { return wireNHits_; } + uint16_t getComparatorNHits() const { return comparatorNHits_; } - /// set cscID - void setCSCID(const uint16_t c) { cscID_ = c; } - void setBX(const uint16_t bx) { bx_ = bx; } + /// set cscID + void setCSCID(const uint16_t c) { cscID_ = c; } + void setBX(const uint16_t bx) { bx_ = bx; } + + private: + uint16_t bitsInTime_; + uint16_t bitsOutOfTime_; + // 4-bit CSC chamber identifier + uint16_t cscID_; + uint16_t bx_; + uint16_t showerType_; + uint16_t wireNHits_; + uint16_t comparatorNHits_; + }; -private: - uint16_t bitsInTime_; - uint16_t bitsOutOfTime_; - // 4-bit CSC chamber identifier - uint16_t cscID_; - uint16_t bx_; - uint16_t showerType_; - uint16_t wireNHits_; - uint16_t comparatorNHits_; -}; + std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi); -std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi); +} // namespace io_v1 +using CSCShowerDigi = io_v1::CSCShowerDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCStripDigi.h b/DataFormats/CSCDigi/interface/CSCStripDigi.h index 525e556b9a698..296b76f6440ee 100644 --- a/DataFormats/CSCDigi/interface/CSCStripDigi.h +++ b/DataFormats/CSCDigi/interface/CSCStripDigi.h @@ -14,74 +14,78 @@ #include #include -class CSCStripDigi { -public: - // Construct from the strip number and all the other data members. - CSCStripDigi(const int& istrip, - const std::vector& vADCCounts, - const std::vector& vADCOverflow, - const std::vector& vOverlap, - const std::vector& vErrorstat) - : strip(istrip), - ADCCounts(vADCCounts), - ADCOverflow(vADCOverflow), - OverlappedSample(vOverlap), - Errorstat(vErrorstat) {} - - // Construct from the strip number and the ADC readings. - CSCStripDigi(const int& istrip, const std::vector& vADCCounts) - : strip(istrip), ADCCounts(vADCCounts), ADCOverflow(8, 0), OverlappedSample(8, 0), Errorstat(8, 0) {} - - CSCStripDigi() : strip(0), ADCCounts(8, 0), ADCOverflow(8, 0), OverlappedSample(8, 0), Errorstat(8, 0) {} - - // Digis are equal if they are on the same strip and have same ADC readings - bool operator==(const CSCStripDigi& digi) const; - - // Get the strip number. counts from 1. - int getStrip() const { return strip; } - - /// Get the CFEB number. Counts from 0. - int getCFEB() const; - - /// Get ADC readings - std::vector const& getADCCounts() const { return ADCCounts; } - - /// Get L1APhase from OverlappedSample (9th bit) - std::vector getL1APhase() const { - std::vector L1APhaseResult(getOverlappedSample().size()); - for (int i = 0; i < (int)getOverlappedSample().size(); i++) - L1APhaseResult[i] = (getOverlappedSample()[i] >> 8) & 0x1; - return L1APhaseResult; - } - - int getL1APhase(int i) const { return (getOverlappedSample()[i] >> 8) & 0x1; } - - /// Other getters - std::vector const& getADCOverflow() const { return ADCOverflow; } - std::vector const& getOverlappedSample() const { return OverlappedSample; } - std::vector const& getErrorstat() const { return Errorstat; } - - // Set the strip number - void setStrip(int istrip) { strip = istrip; } - - // Set with a vector of ADC readings - void setADCCounts(const std::vector& ADCCounts); - - // Print content of digi - void print() const; - - ///methods for calibrations - float pedestal() const { return 0.5f * (ADCCounts[0] + ADCCounts[1]); } - float amplitude() const { return ADCCounts[4] - pedestal(); } - -private: - uint16_t strip; - std::vector ADCCounts; - std::vector ADCOverflow; - std::vector OverlappedSample; - std::vector Errorstat; -}; - -std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi); - +namespace io_v1 { + + class CSCStripDigi { + public: + // Construct from the strip number and all the other data members. + CSCStripDigi(const int& istrip, + const std::vector& vADCCounts, + const std::vector& vADCOverflow, + const std::vector& vOverlap, + const std::vector& vErrorstat) + : strip(istrip), + ADCCounts(vADCCounts), + ADCOverflow(vADCOverflow), + OverlappedSample(vOverlap), + Errorstat(vErrorstat) {} + + // Construct from the strip number and the ADC readings. + CSCStripDigi(const int& istrip, const std::vector& vADCCounts) + : strip(istrip), ADCCounts(vADCCounts), ADCOverflow(8, 0), OverlappedSample(8, 0), Errorstat(8, 0) {} + + CSCStripDigi() : strip(0), ADCCounts(8, 0), ADCOverflow(8, 0), OverlappedSample(8, 0), Errorstat(8, 0) {} + + // Digis are equal if they are on the same strip and have same ADC readings + bool operator==(const CSCStripDigi& digi) const; + + // Get the strip number. counts from 1. + int getStrip() const { return strip; } + + /// Get the CFEB number. Counts from 0. + int getCFEB() const; + + /// Get ADC readings + std::vector const& getADCCounts() const { return ADCCounts; } + + /// Get L1APhase from OverlappedSample (9th bit) + std::vector getL1APhase() const { + std::vector L1APhaseResult(getOverlappedSample().size()); + for (int i = 0; i < (int)getOverlappedSample().size(); i++) + L1APhaseResult[i] = (getOverlappedSample()[i] >> 8) & 0x1; + return L1APhaseResult; + } + + int getL1APhase(int i) const { return (getOverlappedSample()[i] >> 8) & 0x1; } + + /// Other getters + std::vector const& getADCOverflow() const { return ADCOverflow; } + std::vector const& getOverlappedSample() const { return OverlappedSample; } + std::vector const& getErrorstat() const { return Errorstat; } + + // Set the strip number + void setStrip(int istrip) { strip = istrip; } + + // Set with a vector of ADC readings + void setADCCounts(const std::vector& ADCCounts); + + // Print content of digi + void print() const; + + ///methods for calibrations + float pedestal() const { return 0.5f * (ADCCounts[0] + ADCCounts[1]); } + float amplitude() const { return ADCCounts[4] - pedestal(); } + + private: + uint16_t strip; + std::vector ADCCounts; + std::vector ADCOverflow; + std::vector OverlappedSample; + std::vector Errorstat; + }; + + std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi); + +} // namespace io_v1 +using CSCStripDigi = io_v1::CSCStripDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCStripDigiFwd.h b/DataFormats/CSCDigi/interface/CSCStripDigiFwd.h index 1d34043b04231..7c272f80874ee 100644 --- a/DataFormats/CSCDigi/interface/CSCStripDigiFwd.h +++ b/DataFormats/CSCDigi/interface/CSCStripDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CSCDigi_CSCStripDigiFwd_h #define DataFormats_CSCDigi_CSCStripDigiFwd_h -class CSCStripDigi; +namespace io_v1 { + class CSCStripDigi; +} +using CSCStripDigi = io_v1::CSCStripDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCWireDigi.h b/DataFormats/CSCDigi/interface/CSCWireDigi.h index b2ed06ccde077..987a385ca71e3 100644 --- a/DataFormats/CSCDigi/interface/CSCWireDigi.h +++ b/DataFormats/CSCDigi/interface/CSCWireDigi.h @@ -11,43 +11,47 @@ #include #include -class CSCWireDigi { -public: - /// Constructors - - CSCWireDigi(int wire, unsigned int tbinb); /// wiregroup#, tbin bit word - CSCWireDigi(); /// default - - /// return wiregroup number. counts from 1. - int getWireGroup() const { return wire_; } - /// return BX assigned for the wire group (16 upper bits from the wire group number) - int getWireGroupBX() const { return wireBX_; } - /// return BX-wiregroup number combined - /// (16 upper bits - BX + 16 lower bits - wire group number) - int getBXandWireGroup() const { return wireBXandWires_; } - /// return the word with time bins bits - unsigned int getTimeBinWord() const { return tbinb_; } - /// return tbin number, (obsolete, use getTimeBin() instead) - int getBeamCrossingTag() const; - /// return first tbin ON number - int getTimeBin() const; - /// return vector of time bins ON - std::vector getTimeBinsOn() const; - - /// Print content of digi - void print() const; - - /// set wiregroup number - void setWireGroup(unsigned int wiregroup) { wire_ = wiregroup; } - -private: - int wire_; - uint32_t tbinb_; - /// BX in the wire digis (16 upper bits from the wire group number) - int wireBXandWires_; - int wireBX_; -}; - -std::ostream& operator<<(std::ostream& o, const CSCWireDigi& digi); - +namespace io_v1 { + + class CSCWireDigi { + public: + /// Constructors + + CSCWireDigi(int wire, unsigned int tbinb); /// wiregroup#, tbin bit word + CSCWireDigi(); /// default + + /// return wiregroup number. counts from 1. + int getWireGroup() const { return wire_; } + /// return BX assigned for the wire group (16 upper bits from the wire group number) + int getWireGroupBX() const { return wireBX_; } + /// return BX-wiregroup number combined + /// (16 upper bits - BX + 16 lower bits - wire group number) + int getBXandWireGroup() const { return wireBXandWires_; } + /// return the word with time bins bits + unsigned int getTimeBinWord() const { return tbinb_; } + /// return tbin number, (obsolete, use getTimeBin() instead) + int getBeamCrossingTag() const; + /// return first tbin ON number + int getTimeBin() const; + /// return vector of time bins ON + std::vector getTimeBinsOn() const; + + /// Print content of digi + void print() const; + + /// set wiregroup number + void setWireGroup(unsigned int wiregroup) { wire_ = wiregroup; } + + private: + int wire_; + uint32_t tbinb_; + /// BX in the wire digis (16 upper bits from the wire group number) + int wireBXandWires_; + int wireBX_; + }; + + std::ostream& operator<<(std::ostream& o, const CSCWireDigi& digi); + +} // namespace io_v1 +using CSCWireDigi = io_v1::CSCWireDigi; #endif diff --git a/DataFormats/CSCDigi/interface/CSCWireDigiFwd.h b/DataFormats/CSCDigi/interface/CSCWireDigiFwd.h index 87cda22084504..3e172210eff19 100644 --- a/DataFormats/CSCDigi/interface/CSCWireDigiFwd.h +++ b/DataFormats/CSCDigi/interface/CSCWireDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CSCDigi_CSCWireDigiFwd_h #define DataFormats_CSCDigi_CSCWireDigiFwd_h -class CSCWireDigi; +namespace io_v1 { + class CSCWireDigi; +} +using CSCWireDigi = io_v1::CSCWireDigi; #endif diff --git a/DataFormats/CSCDigi/src/CSCALCTDigi.cc b/DataFormats/CSCDigi/src/CSCALCTDigi.cc index d78f2b8cb7d58..ca1d39c56821a 100644 --- a/DataFormats/CSCDigi/src/CSCALCTDigi.cc +++ b/DataFormats/CSCDigi/src/CSCALCTDigi.cc @@ -13,128 +13,132 @@ using namespace std; -namespace { - enum Pattern_Info { NUM_LAYERS = 6, ALCT_PATTERN_WIDTH = 5 }; - - CSCALCTDigi::WireContainer makeEmptyContainer() { - CSCALCTDigi::WireContainer ret; - ret.resize(NUM_LAYERS); - for (auto& p : ret) { - p.resize(ALCT_PATTERN_WIDTH); +namespace io_v1 { + + namespace { + enum Pattern_Info { NUM_LAYERS = 6, ALCT_PATTERN_WIDTH = 5 }; + + CSCALCTDigi::WireContainer makeEmptyContainer() { + CSCALCTDigi::WireContainer ret; + ret.resize(NUM_LAYERS); + for (auto& p : ret) { + p.resize(ALCT_PATTERN_WIDTH); + } + return ret; } - return ret; + } // namespace + + CSCALCTDigi::WireContainer const& CSCALCTDigi::emptyContainer() { + static WireContainer const s_container = makeEmptyContainer(); + return s_container; + } + + /// Constructors + CSCALCTDigi::CSCALCTDigi(const uint16_t valid, + const uint16_t quality, + const uint16_t accel, + const uint16_t patternb, + const uint16_t keywire, + const uint16_t bx, + const uint16_t trknmb, + const uint16_t hmt, + const Version version) + : valid_(valid), + quality_(quality), + accel_(accel), + patternb_(patternb), + keywire_(keywire), + bx_(bx), + trknmb_(trknmb), + fullbx_(0), + hmt_(hmt), + version_(version) {} + + /// Default + CSCALCTDigi::CSCALCTDigi() { + clear(); // set contents to zero } -} // namespace - -CSCALCTDigi::WireContainer const& CSCALCTDigi::emptyContainer() { - static WireContainer const s_container = makeEmptyContainer(); - return s_container; -} - -/// Constructors -CSCALCTDigi::CSCALCTDigi(const uint16_t valid, - const uint16_t quality, - const uint16_t accel, - const uint16_t patternb, - const uint16_t keywire, - const uint16_t bx, - const uint16_t trknmb, - const uint16_t hmt, - const Version version) - : valid_(valid), - quality_(quality), - accel_(accel), - patternb_(patternb), - keywire_(keywire), - bx_(bx), - trknmb_(trknmb), - fullbx_(0), - hmt_(hmt), - version_(version) {} - -/// Default -CSCALCTDigi::CSCALCTDigi() { - clear(); // set contents to zero -} - -/// Clears this ALCT. -void CSCALCTDigi::clear() { - valid_ = 0; - quality_ = 0; - accel_ = 0; - patternb_ = 0; - keywire_ = 0; - bx_ = 0; - trknmb_ = 0; - fullbx_ = 0; - hmt_ = 0; - hits_.clear(); - version_ = Version::Legacy; -} - -uint16_t CSCALCTDigi::getHMT() const { return (isRun3() ? hmt_ : std::numeric_limits::max()); } - -void CSCALCTDigi::setHMT(const uint16_t h) { hmt_ = isRun3() ? h : std::numeric_limits::max(); } - -void CSCALCTDigi::setRun3(const bool isRun3) { version_ = isRun3 ? Version::Run3 : Version::Legacy; } - -bool CSCALCTDigi::operator>(const CSCALCTDigi& rhs) const { - bool returnValue = false; - - // Early ALCTs are always preferred to the ones found at later bx's. - if (getBX() < rhs.getBX()) { - returnValue = true; + + /// Clears this ALCT. + void CSCALCTDigi::clear() { + valid_ = 0; + quality_ = 0; + accel_ = 0; + patternb_ = 0; + keywire_ = 0; + bx_ = 0; + trknmb_ = 0; + fullbx_ = 0; + hmt_ = 0; + hits_.clear(); + version_ = Version::Legacy; } - if (getBX() != rhs.getBX()) { + + uint16_t CSCALCTDigi::getHMT() const { return (isRun3() ? hmt_ : std::numeric_limits::max()); } + + void CSCALCTDigi::setHMT(const uint16_t h) { hmt_ = isRun3() ? h : std::numeric_limits::max(); } + + void CSCALCTDigi::setRun3(const bool isRun3) { version_ = isRun3 ? Version::Run3 : Version::Legacy; } + + bool CSCALCTDigi::operator>(const CSCALCTDigi& rhs) const { + bool returnValue = false; + + // Early ALCTs are always preferred to the ones found at later bx's. + if (getBX() < rhs.getBX()) { + returnValue = true; + } + if (getBX() != rhs.getBX()) { + return returnValue; + } + + // The > operator then checks the quality of ALCTs. + // If two qualities are equal, the ALCT furthest from the beam axis + // (lowest eta, highest wire group number) is selected. + uint16_t quality1 = getQuality(); + uint16_t quality2 = rhs.getQuality(); + if (quality1 > quality2) { + returnValue = true; + } else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG()) { + returnValue = true; + } + return returnValue; + } + + bool CSCALCTDigi::operator==(const CSCALCTDigi& rhs) const { + // Exact equality. + bool returnValue = false; + if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getAccelerator() == rhs.getAccelerator() && + getCollisionB() == rhs.getCollisionB() && getKeyWG() == rhs.getKeyWG() && getBX() == rhs.getBX()) { + returnValue = true; + } return returnValue; } - // The > operator then checks the quality of ALCTs. - // If two qualities are equal, the ALCT furthest from the beam axis - // (lowest eta, highest wire group number) is selected. - uint16_t quality1 = getQuality(); - uint16_t quality2 = rhs.getQuality(); - if (quality1 > quality2) { - returnValue = true; - } else if (quality1 == quality2 && getKeyWG() > rhs.getKeyWG()) { - returnValue = true; + bool CSCALCTDigi::operator!=(const CSCALCTDigi& rhs) const { + // True if == is false. + bool returnValue = true; + if ((*this) == rhs) + returnValue = false; + return returnValue; } - return returnValue; -} - -bool CSCALCTDigi::operator==(const CSCALCTDigi& rhs) const { - // Exact equality. - bool returnValue = false; - if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getAccelerator() == rhs.getAccelerator() && - getCollisionB() == rhs.getCollisionB() && getKeyWG() == rhs.getKeyWG() && getBX() == rhs.getBX()) { - returnValue = true; + + /// Debug + void CSCALCTDigi::print() const { + if (isValid()) { + edm::LogVerbatim("CSCDigi") << "CSC ALCT #" << setw(1) << getTrknmb() << ": Valid = " << setw(1) << isValid() + << " Quality = " << setw(2) << getQuality() << " Accel. = " << setw(1) + << getAccelerator() << " PatternB = " << setw(1) << getCollisionB() + << " Key wire group = " << setw(3) << getKeyWG() << " BX = " << setw(2) << getBX() + << " Full BX = " << std::setw(1) << getFullBX(); + } else { + edm::LogVerbatim("CSCDigi") << "Not a valid Anode LCT."; + } } - return returnValue; -} - -bool CSCALCTDigi::operator!=(const CSCALCTDigi& rhs) const { - // True if == is false. - bool returnValue = true; - if ((*this) == rhs) - returnValue = false; - return returnValue; -} - -/// Debug -void CSCALCTDigi::print() const { - if (isValid()) { - edm::LogVerbatim("CSCDigi") << "CSC ALCT #" << setw(1) << getTrknmb() << ": Valid = " << setw(1) << isValid() - << " Quality = " << setw(2) << getQuality() << " Accel. = " << setw(1) - << getAccelerator() << " PatternB = " << setw(1) << getCollisionB() - << " Key wire group = " << setw(3) << getKeyWG() << " BX = " << setw(2) << getBX() - << " Full BX = " << std::setw(1) << getFullBX(); - } else { - edm::LogVerbatim("CSCDigi") << "Not a valid Anode LCT."; + + std::ostream& operator<<(std::ostream& o, const CSCALCTDigi& digi) { + return o << "CSC ALCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality() + << " Accel. = " << digi.getAccelerator() << " PatternB = " << digi.getCollisionB() + << " Key wire group = " << digi.getKeyWG() << " BX = " << digi.getBX(); } -} -std::ostream& operator<<(std::ostream& o, const CSCALCTDigi& digi) { - return o << "CSC ALCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality() - << " Accel. = " << digi.getAccelerator() << " PatternB = " << digi.getCollisionB() - << " Key wire group = " << digi.getKeyWG() << " BX = " << digi.getBX(); -} +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCCLCTDigi.cc b/DataFormats/CSCDigi/src/CSCCLCTDigi.cc index 3edc6dfbabada..58dfcab16d539 100644 --- a/DataFormats/CSCDigi/src/CSCCLCTDigi.cc +++ b/DataFormats/CSCDigi/src/CSCCLCTDigi.cc @@ -11,220 +11,224 @@ #include #include -enum Pattern_Info { NUM_LAYERS = 6, CLCT_PATTERN_WIDTH = 11 }; - -namespace { - CSCCLCTDigi::ComparatorContainer makeEmptyContainer() { - CSCCLCTDigi::ComparatorContainer ret; - ret.resize(NUM_LAYERS); - for (auto& p : ret) { - p.resize(CLCT_PATTERN_WIDTH); +namespace io_v1 { + + enum Pattern_Info { NUM_LAYERS = 6, CLCT_PATTERN_WIDTH = 11 }; + + namespace { + CSCCLCTDigi::ComparatorContainer makeEmptyContainer() { + CSCCLCTDigi::ComparatorContainer ret; + ret.resize(NUM_LAYERS); + for (auto& p : ret) { + p.resize(CLCT_PATTERN_WIDTH); + } + return ret; } - return ret; + } // namespace + + CSCCLCTDigi::ComparatorContainer const& CSCCLCTDigi::emptyContainer() { + static ComparatorContainer const s_container = makeEmptyContainer(); + return s_container; } -} // namespace - -CSCCLCTDigi::ComparatorContainer const& CSCCLCTDigi::emptyContainer() { - static ComparatorContainer const s_container = makeEmptyContainer(); - return s_container; -} - -/// Constructors -CSCCLCTDigi::CSCCLCTDigi(const uint16_t valid, - const uint16_t quality, - const uint16_t pattern, - const uint16_t striptype, - const uint16_t bend, - const uint16_t strip, - const uint16_t cfeb, - const uint16_t bx, - const uint16_t trknmb, - const uint16_t fullbx, - const int16_t compCode, - const Version version, - const bool run3_quart_strip_bit, - const bool run3_eighth_strip_bit, - const uint16_t run3_pattern, - const uint16_t run3_slope) - : valid_(valid), - quality_(quality), - pattern_(pattern), - striptype_(striptype), - bend_(bend), - strip_(strip), - cfeb_(cfeb), - bx_(bx), - trknmb_(trknmb), - fullbx_(fullbx), - compCode_(compCode), - run3_quart_strip_bit_(run3_quart_strip_bit), - run3_eighth_strip_bit_(run3_eighth_strip_bit), - run3_pattern_(run3_pattern), - run3_slope_(run3_slope), - hits_(), - version_(version) {} - -/// Default -CSCCLCTDigi::CSCCLCTDigi() { - clear(); // set contents to zero -} - -/// Clears this CLCT. -void CSCCLCTDigi::clear() { - valid_ = 0; - quality_ = 0; - pattern_ = 0; - striptype_ = 0; - bend_ = 0; - strip_ = 0; - cfeb_ = 0; - bx_ = 0; - trknmb_ = 0; - fullbx_ = 0; - // Run-3 variables - compCode_ = -1; - run3_quart_strip_bit_ = false; - run3_eighth_strip_bit_ = false; - run3_pattern_ = 0; - run3_slope_ = 0; - version_ = Version::Legacy; - hits_.clear(); -} - -// slope in number of half-strips/layer -float CSCCLCTDigi::getFractionalSlope() const { - if (isRun3()) { - // 4-bit slope - float slope[17] = { - 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; - return (2 * getBend() - 1) * slope[getSlope()]; - } else { - int slope[11] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; - return float(slope[getPattern()] / 5.); + + /// Constructors + CSCCLCTDigi::CSCCLCTDigi(const uint16_t valid, + const uint16_t quality, + const uint16_t pattern, + const uint16_t striptype, + const uint16_t bend, + const uint16_t strip, + const uint16_t cfeb, + const uint16_t bx, + const uint16_t trknmb, + const uint16_t fullbx, + const int16_t compCode, + const Version version, + const bool run3_quart_strip_bit, + const bool run3_eighth_strip_bit, + const uint16_t run3_pattern, + const uint16_t run3_slope) + : valid_(valid), + quality_(quality), + pattern_(pattern), + striptype_(striptype), + bend_(bend), + strip_(strip), + cfeb_(cfeb), + bx_(bx), + trknmb_(trknmb), + fullbx_(fullbx), + compCode_(compCode), + run3_quart_strip_bit_(run3_quart_strip_bit), + run3_eighth_strip_bit_(run3_eighth_strip_bit), + run3_pattern_(run3_pattern), + run3_slope_(run3_slope), + hits_(), + version_(version) {} + + /// Default + CSCCLCTDigi::CSCCLCTDigi() { + clear(); // set contents to zero } -} -uint16_t CSCCLCTDigi::getKeyStrip(const uint16_t n) const { - // 10-bit case for strip data word - if (compCode_ != -1 and n == 8) { - return getKeyStrip(4) * 2 + getEighthStripBit(); + /// Clears this CLCT. + void CSCCLCTDigi::clear() { + valid_ = 0; + quality_ = 0; + pattern_ = 0; + striptype_ = 0; + bend_ = 0; + strip_ = 0; + cfeb_ = 0; + bx_ = 0; + trknmb_ = 0; + fullbx_ = 0; + // Run-3 variables + compCode_ = -1; + run3_quart_strip_bit_ = false; + run3_eighth_strip_bit_ = false; + run3_pattern_ = 0; + run3_slope_ = 0; + version_ = Version::Legacy; + hits_.clear(); } - // 9-bit case for strip data word - else if (compCode_ != -1 and n == 4) { - return getKeyStrip(2) * 2 + getQuartStripBit(); + + // slope in number of half-strips/layer + float CSCCLCTDigi::getFractionalSlope() const { + if (isRun3()) { + // 4-bit slope + float slope[17] = { + 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; + return (2 * getBend() - 1) * slope[getSlope()]; + } else { + int slope[11] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; + return float(slope[getPattern()] / 5.); + } } - // 8-bit case for strip data word (all other cases) - else { - return cfeb_ * 32 + getStrip(); + + uint16_t CSCCLCTDigi::getKeyStrip(const uint16_t n) const { + // 10-bit case for strip data word + if (compCode_ != -1 and n == 8) { + return getKeyStrip(4) * 2 + getEighthStripBit(); + } + // 9-bit case for strip data word + else if (compCode_ != -1 and n == 4) { + return getKeyStrip(2) * 2 + getQuartStripBit(); + } + // 8-bit case for strip data word (all other cases) + else { + return cfeb_ * 32 + getStrip(); + } } -} - -/// return the fractional strip (middle of the strip) -float CSCCLCTDigi::getFractionalStrip(const uint16_t n) const { - if (compCode_ != -1 and n == 8) { - return 0.125f * (getKeyStrip(n) + 0.5); - } else if (compCode_ != -1 and n == 4) { - return 0.25f * (getKeyStrip(n) + 0.5); - } else { - return 0.5f * (getKeyStrip(n) + 0.5); + + /// return the fractional strip (middle of the strip) + float CSCCLCTDigi::getFractionalStrip(const uint16_t n) const { + if (compCode_ != -1 and n == 8) { + return 0.125f * (getKeyStrip(n) + 0.5); + } else if (compCode_ != -1 and n == 4) { + return 0.25f * (getKeyStrip(n) + 0.5); + } else { + return 0.5f * (getKeyStrip(n) + 0.5); + } } -} - -void CSCCLCTDigi::setRun3(const bool isRun3) { version_ = isRun3 ? Version::Run3 : Version::Legacy; } - -bool CSCCLCTDigi::operator>(const CSCCLCTDigi& rhs) const { - // Several versions of CLCT sorting criteria were used before 2008. - // They are available in CMSSW versions prior to 3_1_0; here we only keep - // the latest one, used in TMB-07 firmware (w/o distrips). - bool returnValue = false; - - uint16_t quality1 = getQuality(); - uint16_t quality2 = rhs.getQuality(); - - // Run-3 case - if (version_ == Version::Run3) { - // Better-quality CLCTs are preferred. - // If two qualities are equal, smaller bending is preferred; - // left- and right-bend patterns are considered to be of - // the same quality. This corresponds to "pattern" being smaller!!! - // If both qualities and pattern id's are the same, lower keystrip - // is preferred. - if ((quality1 > quality2) || (quality1 == quality2 && getPattern() < rhs.getPattern()) || - (quality1 == quality2 && getPattern() == rhs.getPattern() && getKeyStrip() < rhs.getKeyStrip())) { - returnValue = true; + + void CSCCLCTDigi::setRun3(const bool isRun3) { version_ = isRun3 ? Version::Run3 : Version::Legacy; } + + bool CSCCLCTDigi::operator>(const CSCCLCTDigi& rhs) const { + // Several versions of CLCT sorting criteria were used before 2008. + // They are available in CMSSW versions prior to 3_1_0; here we only keep + // the latest one, used in TMB-07 firmware (w/o distrips). + bool returnValue = false; + + uint16_t quality1 = getQuality(); + uint16_t quality2 = rhs.getQuality(); + + // Run-3 case + if (version_ == Version::Run3) { + // Better-quality CLCTs are preferred. + // If two qualities are equal, smaller bending is preferred; + // left- and right-bend patterns are considered to be of + // the same quality. This corresponds to "pattern" being smaller!!! + // If both qualities and pattern id's are the same, lower keystrip + // is preferred. + if ((quality1 > quality2) || (quality1 == quality2 && getPattern() < rhs.getPattern()) || + (quality1 == quality2 && getPattern() == rhs.getPattern() && getKeyStrip() < rhs.getKeyStrip())) { + returnValue = true; + } + } + // Legacy case: + else { + // The bend-direction bit pid[0] is ignored (left and right bends have + // equal quality). + uint16_t pattern1 = getPattern() & 14; + uint16_t pattern2 = rhs.getPattern() & 14; + + // Better-quality CLCTs are preferred. + // If two qualities are equal, larger pattern id (i.e., straighter pattern) + // is preferred; left- and right-bend patterns are considered to be of + // the same quality. + // If both qualities and pattern id's are the same, lower keystrip + // is preferred. + if ((quality1 > quality2) || (quality1 == quality2 && pattern1 > pattern2) || + (quality1 == quality2 && pattern1 == pattern2 && getKeyStrip() < rhs.getKeyStrip())) { + returnValue = true; + } } + return returnValue; } - // Legacy case: - else { - // The bend-direction bit pid[0] is ignored (left and right bends have - // equal quality). - uint16_t pattern1 = getPattern() & 14; - uint16_t pattern2 = rhs.getPattern() & 14; - - // Better-quality CLCTs are preferred. - // If two qualities are equal, larger pattern id (i.e., straighter pattern) - // is preferred; left- and right-bend patterns are considered to be of - // the same quality. - // If both qualities and pattern id's are the same, lower keystrip - // is preferred. - if ((quality1 > quality2) || (quality1 == quality2 && pattern1 > pattern2) || - (quality1 == quality2 && pattern1 == pattern2 && getKeyStrip() < rhs.getKeyStrip())) { + + bool CSCCLCTDigi::operator==(const CSCCLCTDigi& rhs) const { + // Exact equality. + bool returnValue = false; + if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getPattern() == rhs.getPattern() && + getKeyStrip() == rhs.getKeyStrip() && getStripType() == rhs.getStripType() && getBend() == rhs.getBend() && + getBX() == rhs.getBX() && getCompCode() == rhs.getCompCode()) { returnValue = true; } + return returnValue; + } + + bool CSCCLCTDigi::operator!=(const CSCCLCTDigi& rhs) const { + // True if == is false. + bool returnValue = true; + if ((*this) == rhs) + returnValue = false; + return returnValue; } - return returnValue; -} - -bool CSCCLCTDigi::operator==(const CSCCLCTDigi& rhs) const { - // Exact equality. - bool returnValue = false; - if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getPattern() == rhs.getPattern() && - getKeyStrip() == rhs.getKeyStrip() && getStripType() == rhs.getStripType() && getBend() == rhs.getBend() && - getBX() == rhs.getBX() && getCompCode() == rhs.getCompCode()) { - returnValue = true; + + /// Debug + void CSCCLCTDigi::print() const { + if (isValid()) { + char stripType = (getStripType() == 0) ? 'D' : 'H'; + char bend = (getBend() == 0) ? 'L' : 'R'; + + edm::LogVerbatim("CSCDigi") << " CSC CLCT #" << std::setw(1) << getTrknmb() << ": Valid = " << std::setw(1) + << isValid() << " Key Strip = " << std::setw(3) << getKeyStrip() + << " Strip = " << std::setw(2) << getStrip() << " Quality = " << std::setw(1) + << getQuality() << " Pattern = " << std::setw(1) << getPattern() + << " Bend = " << std::setw(1) << bend << " Strip type = " << std::setw(1) << stripType + << " CFEB ID = " << std::setw(1) << getCFEB() << " BX = " << std::setw(1) << getBX() + << " Full BX= " << std::setw(1) << getFullBX() << " Comp Code= " << std::setw(1) + << getCompCode(); + } else { + edm::LogVerbatim("CSCDigi") << "Not a valid Cathode LCT."; + } } - return returnValue; -} - -bool CSCCLCTDigi::operator!=(const CSCCLCTDigi& rhs) const { - // True if == is false. - bool returnValue = true; - if ((*this) == rhs) - returnValue = false; - return returnValue; -} - -/// Debug -void CSCCLCTDigi::print() const { - if (isValid()) { - char stripType = (getStripType() == 0) ? 'D' : 'H'; - char bend = (getBend() == 0) ? 'L' : 'R'; - - edm::LogVerbatim("CSCDigi") << " CSC CLCT #" << std::setw(1) << getTrknmb() << ": Valid = " << std::setw(1) - << isValid() << " Key Strip = " << std::setw(3) << getKeyStrip() - << " Strip = " << std::setw(2) << getStrip() << " Quality = " << std::setw(1) - << getQuality() << " Pattern = " << std::setw(1) << getPattern() - << " Bend = " << std::setw(1) << bend << " Strip type = " << std::setw(1) << stripType - << " CFEB ID = " << std::setw(1) << getCFEB() << " BX = " << std::setw(1) << getBX() - << " Full BX= " << std::setw(1) << getFullBX() << " Comp Code= " << std::setw(1) - << getCompCode(); - } else { - edm::LogVerbatim("CSCDigi") << "Not a valid Cathode LCT."; + + std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi) { + if (digi.isRun3()) + return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() + << " Run-2 Pattern = " << digi.getPattern() << " Run-3 Pattern = " << digi.getRun3Pattern() + << " Quality = " << digi.getQuality() << " Comp Code " << digi.getCompCode() + << " Bend = " << digi.getBend() << "\n" + << " Slope = " << digi.getSlope() << " CFEB = " << digi.getCFEB() << " Strip = " << digi.getStrip() + << " KeyHalfStrip = " << digi.getKeyStrip() << " KeyQuartStrip = " << digi.getKeyStrip(4) + << " KeyEighthStrip = " << digi.getKeyStrip(8); + else + return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() + << " Pattern = " << digi.getPattern() << " Quality = " << digi.getQuality() + << " Bend = " << digi.getBend() << " CFEB = " << digi.getCFEB() << " HalfStrip = " << digi.getStrip() + << " KeyHalfStrip = " << digi.getKeyStrip(); } -} - -std::ostream& operator<<(std::ostream& o, const CSCCLCTDigi& digi) { - if (digi.isRun3()) - return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() - << " Run-2 Pattern = " << digi.getPattern() << " Run-3 Pattern = " << digi.getRun3Pattern() - << " Quality = " << digi.getQuality() << " Comp Code " << digi.getCompCode() - << " Bend = " << digi.getBend() << "\n" - << " Slope = " << digi.getSlope() << " CFEB = " << digi.getCFEB() << " Strip = " << digi.getStrip() - << " KeyHalfStrip = " << digi.getKeyStrip() << " KeyQuartStrip = " << digi.getKeyStrip(4) - << " KeyEighthStrip = " << digi.getKeyStrip(8); - else - return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() - << " Pattern = " << digi.getPattern() << " Quality = " << digi.getQuality() << " Bend = " << digi.getBend() - << " CFEB = " << digi.getCFEB() << " HalfStrip = " << digi.getStrip() - << " KeyHalfStrip = " << digi.getKeyStrip(); -} + +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCCLCTPreTriggerDigi.cc b/DataFormats/CSCDigi/src/CSCCLCTPreTriggerDigi.cc index fd5ff41d2c2a6..939003e7545a3 100644 --- a/DataFormats/CSCDigi/src/CSCCLCTPreTriggerDigi.cc +++ b/DataFormats/CSCDigi/src/CSCCLCTPreTriggerDigi.cc @@ -4,122 +4,126 @@ #include #include -/// Constructors -CSCCLCTPreTriggerDigi::CSCCLCTPreTriggerDigi(const int valid, - const int quality, - const int pattern, - const int striptype, - const int bend, - const int strip, - const int cfeb, - const int bx, - const int trknmb, - const int fullbx) - : valid_(valid), - quality_(quality), - pattern_(pattern), - striptype_(striptype), - bend_(bend), - strip_(strip), - cfeb_(cfeb), - bx_(bx), - trknmb_(trknmb), - fullbx_(fullbx) {} +namespace io_v1 { -/// Default -CSCCLCTPreTriggerDigi::CSCCLCTPreTriggerDigi() - : valid_(0), - quality_(0), - pattern_(0), - striptype_(0), - bend_(0), - strip_(0), - cfeb_(0), - bx_(0), - trknmb_(0), - fullbx_(0) {} + /// Constructors + CSCCLCTPreTriggerDigi::CSCCLCTPreTriggerDigi(const int valid, + const int quality, + const int pattern, + const int striptype, + const int bend, + const int strip, + const int cfeb, + const int bx, + const int trknmb, + const int fullbx) + : valid_(valid), + quality_(quality), + pattern_(pattern), + striptype_(striptype), + bend_(bend), + strip_(strip), + cfeb_(cfeb), + bx_(bx), + trknmb_(trknmb), + fullbx_(fullbx) {} -/// Clears this CLCT. -void CSCCLCTPreTriggerDigi::clear() { - valid_ = 0; - quality_ = 0; - pattern_ = 0; - striptype_ = 0; - bend_ = 0; - strip_ = 0; - cfeb_ = 0; - bx_ = 0; - trknmb_ = 0; - fullbx_ = 0; -} + /// Default + CSCCLCTPreTriggerDigi::CSCCLCTPreTriggerDigi() + : valid_(0), + quality_(0), + pattern_(0), + striptype_(0), + bend_(0), + strip_(0), + cfeb_(0), + bx_(0), + trknmb_(0), + fullbx_(0) {} -bool CSCCLCTPreTriggerDigi::operator>(const CSCCLCTPreTriggerDigi& rhs) const { - // Several versions of CLCT sorting criteria were used before 2008. - // They are available in CMSSW versions prior to 3_1_0; here we only keep - // the latest one, used in TMB-07 firmware (w/o distrips). - bool returnValue = false; + /// Clears this CLCT. + void CSCCLCTPreTriggerDigi::clear() { + valid_ = 0; + quality_ = 0; + pattern_ = 0; + striptype_ = 0; + bend_ = 0; + strip_ = 0; + cfeb_ = 0; + bx_ = 0; + trknmb_ = 0; + fullbx_ = 0; + } + + bool CSCCLCTPreTriggerDigi::operator>(const CSCCLCTPreTriggerDigi& rhs) const { + // Several versions of CLCT sorting criteria were used before 2008. + // They are available in CMSSW versions prior to 3_1_0; here we only keep + // the latest one, used in TMB-07 firmware (w/o distrips). + bool returnValue = false; + + int quality1 = getQuality(); + int quality2 = rhs.getQuality(); + // The bend-direction bit pid[0] is ignored (left and right bends have + // equal quality). + int pattern1 = getPattern() & 14; + int pattern2 = rhs.getPattern() & 14; - int quality1 = getQuality(); - int quality2 = rhs.getQuality(); - // The bend-direction bit pid[0] is ignored (left and right bends have - // equal quality). - int pattern1 = getPattern() & 14; - int pattern2 = rhs.getPattern() & 14; + // Better-quality CLCTs are preferred. + // If two qualities are equal, larger pattern id (i.e., straighter pattern) + // is preferred; left- and right-bend patterns are considered to be of + // the same quality. + // If both qualities and pattern id's are the same, lower keystrip + // is preferred. + if ((quality1 > quality2) || (quality1 == quality2 && pattern1 > pattern2) || + (quality1 == quality2 && pattern1 == pattern2 && getKeyStrip() < rhs.getKeyStrip())) { + returnValue = true; + } - // Better-quality CLCTs are preferred. - // If two qualities are equal, larger pattern id (i.e., straighter pattern) - // is preferred; left- and right-bend patterns are considered to be of - // the same quality. - // If both qualities and pattern id's are the same, lower keystrip - // is preferred. - if ((quality1 > quality2) || (quality1 == quality2 && pattern1 > pattern2) || - (quality1 == quality2 && pattern1 == pattern2 && getKeyStrip() < rhs.getKeyStrip())) { - returnValue = true; + return returnValue; } - return returnValue; -} + bool CSCCLCTPreTriggerDigi::operator==(const CSCCLCTPreTriggerDigi& rhs) const { + // Exact equality. + bool returnValue = false; + if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getPattern() == rhs.getPattern() && + getKeyStrip() == rhs.getKeyStrip() && getStripType() == rhs.getStripType() && getBend() == getBend() && + getBX() == rhs.getBX()) { + returnValue = true; + } + return returnValue; + } -bool CSCCLCTPreTriggerDigi::operator==(const CSCCLCTPreTriggerDigi& rhs) const { - // Exact equality. - bool returnValue = false; - if (isValid() == rhs.isValid() && getQuality() == rhs.getQuality() && getPattern() == rhs.getPattern() && - getKeyStrip() == rhs.getKeyStrip() && getStripType() == rhs.getStripType() && getBend() == getBend() && - getBX() == rhs.getBX()) { - returnValue = true; + bool CSCCLCTPreTriggerDigi::operator!=(const CSCCLCTPreTriggerDigi& rhs) const { + // True if == is false. + bool returnValue = true; + if ((*this) == rhs) + returnValue = false; + return returnValue; } - return returnValue; -} -bool CSCCLCTPreTriggerDigi::operator!=(const CSCCLCTPreTriggerDigi& rhs) const { - // True if == is false. - bool returnValue = true; - if ((*this) == rhs) - returnValue = false; - return returnValue; -} + /// Debug + void CSCCLCTPreTriggerDigi::print() const { + if (isValid()) { + char stripType = (getStripType() == 0) ? 'D' : 'H'; + char bend = (getBend() == 0) ? 'L' : 'R'; -/// Debug -void CSCCLCTPreTriggerDigi::print() const { - if (isValid()) { - char stripType = (getStripType() == 0) ? 'D' : 'H'; - char bend = (getBend() == 0) ? 'L' : 'R'; + edm::LogVerbatim("CSCDigi") << " CSC CLCT #" << std::setw(1) << getTrknmb() << ": Valid = " << std::setw(1) + << isValid() << " Key Strip = " << std::setw(3) << getKeyStrip() + << " Strip = " << std::setw(2) << getStrip() << " Quality = " << std::setw(1) + << getQuality() << " Pattern = " << std::setw(1) << getPattern() + << " Bend = " << std::setw(1) << bend << " Strip type = " << std::setw(1) << stripType + << " CFEB ID = " << std::setw(1) << getCFEB() << " BX = " << std::setw(1) << getBX() + << " Full BX= " << std::setw(1) << getFullBX(); + } else { + edm::LogVerbatim("CSCDigi") << "Not a valid Cathode LCT."; + } + } - edm::LogVerbatim("CSCDigi") << " CSC CLCT #" << std::setw(1) << getTrknmb() << ": Valid = " << std::setw(1) - << isValid() << " Key Strip = " << std::setw(3) << getKeyStrip() - << " Strip = " << std::setw(2) << getStrip() << " Quality = " << std::setw(1) - << getQuality() << " Pattern = " << std::setw(1) << getPattern() - << " Bend = " << std::setw(1) << bend << " Strip type = " << std::setw(1) << stripType - << " CFEB ID = " << std::setw(1) << getCFEB() << " BX = " << std::setw(1) << getBX() - << " Full BX= " << std::setw(1) << getFullBX(); - } else { - edm::LogVerbatim("CSCDigi") << "Not a valid Cathode LCT."; + std::ostream& operator<<(std::ostream& o, const CSCCLCTPreTriggerDigi& digi) { + return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality() + << " Pattern = " << digi.getPattern() << " StripType = " << digi.getStripType() + << " Bend = " << digi.getBend() << " Strip = " << digi.getStrip() << " KeyStrip = " << digi.getKeyStrip() + << " CFEB = " << digi.getCFEB() << " BX = " << digi.getBX(); } -} -std::ostream& operator<<(std::ostream& o, const CSCCLCTPreTriggerDigi& digi) { - return o << "CSC CLCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " Quality = " << digi.getQuality() - << " Pattern = " << digi.getPattern() << " StripType = " << digi.getStripType() - << " Bend = " << digi.getBend() << " Strip = " << digi.getStrip() << " KeyStrip = " << digi.getKeyStrip() - << " CFEB = " << digi.getCFEB() << " BX = " << digi.getBX(); -} +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCComparatorDigi.cc b/DataFormats/CSCDigi/src/CSCComparatorDigi.cc index e2df7b2efbf65..a90443582402e 100644 --- a/DataFormats/CSCDigi/src/CSCComparatorDigi.cc +++ b/DataFormats/CSCDigi/src/CSCComparatorDigi.cc @@ -12,107 +12,111 @@ using namespace std; -// Constructors -CSCComparatorDigi::CSCComparatorDigi(int strip, int comparator, int timeBinWord) - : strip_(strip), comparator_(comparator), timeBinWord_(timeBinWord) {} - -CSCComparatorDigi::CSCComparatorDigi() : strip_(0), comparator_(0), timeBinWord_(0) {} - -// Comparison - -bool CSCComparatorDigi::operator==(const CSCComparatorDigi& digi) const { - if (getStrip() != digi.getStrip()) - return false; - if (getComparator() != digi.getComparator()) - return false; - if (getTimeBinWord() != digi.getTimeBinWord()) - return false; - return true; -} - -//@@ If one wanted to order comparator digis how would one want op< to behave? -// I don't know... -// I think LHS < RHS only makes sense if -// i) time(LHS) .eq. time(RHS) -// AND -// ii) strip(LHS) .lt. strip(RHS) -// But I don't see how this can be useful. - -bool CSCComparatorDigi::operator<(const CSCComparatorDigi& digi) const { - bool result = false; - if (getTimeBin() == digi.getTimeBin()) { - result = (getStrip() < digi.getStrip()); +namespace io_v1 { + + // Constructors + CSCComparatorDigi::CSCComparatorDigi(int strip, int comparator, int timeBinWord) + : strip_(strip), comparator_(comparator), timeBinWord_(timeBinWord) {} + + CSCComparatorDigi::CSCComparatorDigi() : strip_(0), comparator_(0), timeBinWord_(0) {} + + // Comparison + + bool CSCComparatorDigi::operator==(const CSCComparatorDigi& digi) const { + if (getStrip() != digi.getStrip()) + return false; + if (getComparator() != digi.getComparator()) + return false; + if (getTimeBinWord() != digi.getTimeBinWord()) + return false; + return true; + } + + //@@ If one wanted to order comparator digis how would one want op< to behave? + // I don't know... + // I think LHS < RHS only makes sense if + // i) time(LHS) .eq. time(RHS) + // AND + // ii) strip(LHS) .lt. strip(RHS) + // But I don't see how this can be useful. + + bool CSCComparatorDigi::operator<(const CSCComparatorDigi& digi) const { + bool result = false; + if (getTimeBin() == digi.getTimeBin()) { + result = (getStrip() < digi.getStrip()); + } + return result; + } + + // Getters + + int CSCComparatorDigi::getTimeBin() const { + // Find first bin which fired, counting from 0 + uint16_t tbit = 1; + int tbin = -1; + for (int i = 0; i < 16; ++i) { + if (tbit & timeBinWord_) { + tbin = i; + break; + } + tbit = tbit << 1; + } + return tbin; } - return result; -} - -// Getters - -int CSCComparatorDigi::getTimeBin() const { - // Find first bin which fired, counting from 0 - uint16_t tbit = 1; - int tbin = -1; - for (int i = 0; i < 16; ++i) { - if (tbit & timeBinWord_) { - tbin = i; - break; + + /// Get the distrip number. Counts from 0. + // originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc + int CSCComparatorDigi::getDiStrip() const { return ((strip_ - 1) % CSCConstants::NUM_STRIPS_PER_CFEB) / 2; } + + /// Get the CFEB number. Counts from 0. + // originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc + int CSCComparatorDigi::getCFEB() const { return (strip_ - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } + + // This definition is consistent with the one used in + // the function CSCComparatorData::add() in EventFilter/CSCRawToDigi + // The halfstrip counts from 0! + int CSCComparatorDigi::getHalfStrip() const { return (getStrip() - 1) * 2 + getComparator(); } + + // Return the fractional half-strip + float CSCComparatorDigi::getFractionalStrip() const { return getStrip() + getComparator() * 0.5f - 0.75f; } + + std::vector CSCComparatorDigi::getTimeBinsOn() const { + std::vector tbins; + uint16_t tbit = timeBinWord_; + const uint16_t one = 1; + for (int i = 0; i < 16; ++i) { + if (tbit & one) + tbins.push_back(i); + tbit = tbit >> 1; + if (tbit == 0) + break; // end already if no more bits set } - tbit = tbit << 1; + return tbins; } - return tbin; -} - -/// Get the distrip number. Counts from 0. -// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc -int CSCComparatorDigi::getDiStrip() const { return ((strip_ - 1) % CSCConstants::NUM_STRIPS_PER_CFEB) / 2; } - -/// Get the CFEB number. Counts from 0. -// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc -int CSCComparatorDigi::getCFEB() const { return (strip_ - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } - -// This definition is consistent with the one used in -// the function CSCComparatorData::add() in EventFilter/CSCRawToDigi -// The halfstrip counts from 0! -int CSCComparatorDigi::getHalfStrip() const { return (getStrip() - 1) * 2 + getComparator(); } - -// Return the fractional half-strip -float CSCComparatorDigi::getFractionalStrip() const { return getStrip() + getComparator() * 0.5f - 0.75f; } - -std::vector CSCComparatorDigi::getTimeBinsOn() const { - std::vector tbins; - uint16_t tbit = timeBinWord_; - const uint16_t one = 1; - for (int i = 0; i < 16; ++i) { - if (tbit & one) - tbins.push_back(i); - tbit = tbit >> 1; - if (tbit == 0) - break; // end already if no more bits set + + // Setters + //@@ No way to set time word? + + void CSCComparatorDigi::setStrip(int strip) { strip_ = strip; } + void CSCComparatorDigi::setComparator(int comparator) { comparator_ = comparator; } + + // Output + + void CSCComparatorDigi::print() const { + std::ostringstream ost; + ost << "CSCComparatorDigi | strip " << getStrip() << " | comparator " << getComparator() << " | first time bin " + << getTimeBin() << " | time bins on "; + std::vector tbins = getTimeBinsOn(); + std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(ost, " ")); + edm::LogVerbatim("CSCDigi") << ost.str(); + } + + std::ostream& operator<<(std::ostream& o, const CSCComparatorDigi& digi) { + o << "CSCComparatorDigi Strip:" << digi.getStrip() << ", Comparator: " << digi.getComparator() + << ", First Time Bin On: " << digi.getTimeBin() << ", Time Bins On: "; + std::vector tbins = digi.getTimeBinsOn(); + std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(o, " ")); + return o; } - return tbins; -} - -// Setters -//@@ No way to set time word? - -void CSCComparatorDigi::setStrip(int strip) { strip_ = strip; } -void CSCComparatorDigi::setComparator(int comparator) { comparator_ = comparator; } - -// Output - -void CSCComparatorDigi::print() const { - std::ostringstream ost; - ost << "CSCComparatorDigi | strip " << getStrip() << " | comparator " << getComparator() << " | first time bin " - << getTimeBin() << " | time bins on "; - std::vector tbins = getTimeBinsOn(); - std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(ost, " ")); - edm::LogVerbatim("CSCDigi") << ost.str(); -} - -std::ostream& operator<<(std::ostream& o, const CSCComparatorDigi& digi) { - o << "CSCComparatorDigi Strip:" << digi.getStrip() << ", Comparator: " << digi.getComparator() - << ", First Time Bin On: " << digi.getTimeBin() << ", Time Bins On: "; - std::vector tbins = digi.getTimeBinsOn(); - std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(o, " ")); - return o; -} + +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc b/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc index 18f559faea000..53b24b7e997aa 100644 --- a/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc +++ b/DataFormats/CSCDigi/src/CSCCorrelatedLCTDigi.cc @@ -10,181 +10,184 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include -/// Constructors -CSCCorrelatedLCTDigi::CSCCorrelatedLCTDigi(const uint16_t itrknmb, - const uint16_t ivalid, - const uint16_t iquality, - const uint16_t ikeywire, - const uint16_t istrip, - const uint16_t ipattern, - const uint16_t ibend, - const uint16_t ibx, - const uint16_t impclink, - const uint16_t ibx0, - const uint16_t isyncErr, - const uint16_t icscID, - const Version version, - const bool run3_quart_strip_bit, - const bool run3_eighth_strip_bit, - const uint16_t run3_pattern, - const uint16_t run3_slope, - const int type, - const uint16_t gemLayerUsedForSlopeComputation) - - : trknmb(itrknmb), - valid(ivalid), - quality(iquality), - keywire(ikeywire), - strip(istrip), - pattern(ipattern), - bend(ibend), - bx(ibx), - mpclink(impclink), - bx0(ibx0), - syncErr(isyncErr), - cscID(icscID), - hmt(0), - run3_quart_strip_bit_(run3_quart_strip_bit), - run3_eighth_strip_bit_(run3_eighth_strip_bit), - run3_pattern_(run3_pattern), - run3_slope_(run3_slope), - gemLayerUsedForSlopeComputation_(gemLayerUsedForSlopeComputation), - type_(type), - version_(version) {} - -/// Default -CSCCorrelatedLCTDigi::CSCCorrelatedLCTDigi() { - clear(); // set contents to zero -} - -/// Clears this LCT. -void CSCCorrelatedLCTDigi::clear() { - trknmb = 0; - valid = 0; - quality = 0; - keywire = 0; - strip = 0; - pattern = 0; - bend = 0; - bx = 0; - mpclink = 0; - bx0 = 0; - syncErr = 0; - cscID = 0; - hmt = 0; - version_ = Version::Legacy; - // Run-3 variables - run3_quart_strip_bit_ = false; - run3_eighth_strip_bit_ = false; - run3_pattern_ = 0; - run3_slope_ = 0; - // clear the components - type_ = 1; - gemLayerUsedForSlopeComputation_ = 0; - alct_.clear(); - clct_.clear(); - gem1_ = GEMPadDigi(); - gem2_ = GEMPadDigi(); -} - -uint16_t CSCCorrelatedLCTDigi::getStrip(const uint16_t n) const { - // all 10 bits - if (n == 8) { - return 2 * getStrip(4) + getEighthStripBit(); +namespace io_v1 { + + /// Constructors + CSCCorrelatedLCTDigi::CSCCorrelatedLCTDigi(const uint16_t itrknmb, + const uint16_t ivalid, + const uint16_t iquality, + const uint16_t ikeywire, + const uint16_t istrip, + const uint16_t ipattern, + const uint16_t ibend, + const uint16_t ibx, + const uint16_t impclink, + const uint16_t ibx0, + const uint16_t isyncErr, + const uint16_t icscID, + const Version version, + const bool run3_quart_strip_bit, + const bool run3_eighth_strip_bit, + const uint16_t run3_pattern, + const uint16_t run3_slope, + const int type, + const uint16_t gemLayerUsedForSlopeComputation) + + : trknmb(itrknmb), + valid(ivalid), + quality(iquality), + keywire(ikeywire), + strip(istrip), + pattern(ipattern), + bend(ibend), + bx(ibx), + mpclink(impclink), + bx0(ibx0), + syncErr(isyncErr), + cscID(icscID), + hmt(0), + run3_quart_strip_bit_(run3_quart_strip_bit), + run3_eighth_strip_bit_(run3_eighth_strip_bit), + run3_pattern_(run3_pattern), + run3_slope_(run3_slope), + gemLayerUsedForSlopeComputation_(gemLayerUsedForSlopeComputation), + type_(type), + version_(version) {} + + /// Default + CSCCorrelatedLCTDigi::CSCCorrelatedLCTDigi() { + clear(); // set contents to zero } - // lowest 9 bits - else if (n == 4) { - return 2 * getStrip(2) + getQuartStripBit(); + + /// Clears this LCT. + void CSCCorrelatedLCTDigi::clear() { + trknmb = 0; + valid = 0; + quality = 0; + keywire = 0; + strip = 0; + pattern = 0; + bend = 0; + bx = 0; + mpclink = 0; + bx0 = 0; + syncErr = 0; + cscID = 0; + hmt = 0; + version_ = Version::Legacy; + // Run-3 variables + run3_quart_strip_bit_ = false; + run3_eighth_strip_bit_ = false; + run3_pattern_ = 0; + run3_slope_ = 0; + // clear the components + type_ = 1; + gemLayerUsedForSlopeComputation_ = 0; + alct_.clear(); + clct_.clear(); + gem1_ = GEMPadDigi(); + gem2_ = GEMPadDigi(); + } + + uint16_t CSCCorrelatedLCTDigi::getStrip(const uint16_t n) const { + // all 10 bits + if (n == 8) { + return 2 * getStrip(4) + getEighthStripBit(); + } + // lowest 9 bits + else if (n == 4) { + return 2 * getStrip(2) + getQuartStripBit(); + } + // lowest 8 bits + else { + return strip; + } + } + + // slope in number of half-strips/layer + float CSCCorrelatedLCTDigi::getFractionalSlope() const { + if (isRun3()) { + // 4-bit slope + float slope[17] = { + 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; + return (2 * getBend() - 1) * slope[getSlope()]; + } else { + int slope[11] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; + return float(slope[getPattern()] / 5.); + } + } + + /// return the fractional strip + float CSCCorrelatedLCTDigi::getFractionalStrip(const uint16_t n) const { + if (n == 8) { + return 0.125f * (getStrip(n) + 0.5); + } else if (n == 4) { + return 0.25f * (getStrip(n) + 0.5); + } else { + return 0.5f * (getStrip(n) + 0.5); + } + } + + uint16_t CSCCorrelatedLCTDigi::getCLCTPattern() const { + return (isRun3() ? std::numeric_limits::max() : (pattern & 0xF)); } - // lowest 8 bits - else { - return strip; + + uint16_t CSCCorrelatedLCTDigi::getHMT() const { return (isRun3() ? hmt : std::numeric_limits::max()); } + + void CSCCorrelatedLCTDigi::setHMT(const uint16_t h) { hmt = isRun3() ? h : std::numeric_limits::max(); } + + uint16_t CSCCorrelatedLCTDigi::getSlope() const { + return version_ == Version::Run3HR ? (run3_slope_ >> 2) : run3_slope_; } -} - -// slope in number of half-strips/layer -float CSCCorrelatedLCTDigi::getFractionalSlope() const { - if (isRun3()) { - // 4-bit slope - float slope[17] = { - 0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0, 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 2.0, 2.5}; - return (2 * getBend() - 1) * slope[getSlope()]; - } else { - int slope[11] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; - return float(slope[getPattern()] / 5.); + + uint16_t CSCCorrelatedLCTDigi::getSlopeEx(uint16_t resolution) const { + if (resolution > 16) + throw cms::Exception("InvalidSlopeResolution") + << "Requested slope resolution " << resolution << " is larger than 16 bits, which is not supported."; + const uint16_t rawResolution = getRawSlopeResolution(); + if (resolution == 0 || resolution == rawResolution) + return run3_slope_; + if (resolution > rawResolution) + return run3_slope_ << (resolution - rawResolution); + return run3_slope_ >> (rawResolution - resolution); } -} - -/// return the fractional strip -float CSCCorrelatedLCTDigi::getFractionalStrip(const uint16_t n) const { - if (n == 8) { - return 0.125f * (getStrip(n) + 0.5); - } else if (n == 4) { - return 0.25f * (getStrip(n) + 0.5); - } else { - return 0.5f * (getStrip(n) + 0.5); + + /// Comparison + bool CSCCorrelatedLCTDigi::operator==(const CSCCorrelatedLCTDigi& rhs) const { + return ((trknmb == rhs.trknmb) && (quality == rhs.quality) && (keywire == rhs.keywire) && (strip == rhs.strip) && + (pattern == rhs.pattern) && (bend == rhs.bend) && (bx == rhs.bx) && (valid == rhs.valid) && + (mpclink == rhs.mpclink)); } -} - -uint16_t CSCCorrelatedLCTDigi::getCLCTPattern() const { - return (isRun3() ? std::numeric_limits::max() : (pattern & 0xF)); -} - -uint16_t CSCCorrelatedLCTDigi::getHMT() const { return (isRun3() ? hmt : std::numeric_limits::max()); } - -void CSCCorrelatedLCTDigi::setHMT(const uint16_t h) { hmt = isRun3() ? h : std::numeric_limits::max(); } - -uint16_t CSCCorrelatedLCTDigi::getSlope() const { - return version_ == Version::Run3HR ? (run3_slope_ >> 2) : run3_slope_; -} - -uint16_t CSCCorrelatedLCTDigi::getSlopeEx(uint16_t resolution) const { - if (resolution > 16) - throw cms::Exception("InvalidSlopeResolution") - << "Requested slope resolution " << resolution << " is larger than 16 bits, which is not supported."; - const uint16_t rawResolution = getRawSlopeResolution(); - if (resolution == 0 || resolution == rawResolution) - return run3_slope_; - if (resolution > rawResolution) - return run3_slope_ << (resolution - rawResolution); - return run3_slope_ >> (rawResolution - resolution); -} - -/// Comparison -bool CSCCorrelatedLCTDigi::operator==(const CSCCorrelatedLCTDigi& rhs) const { - return ((trknmb == rhs.trknmb) && (quality == rhs.quality) && (keywire == rhs.keywire) && (strip == rhs.strip) && - (pattern == rhs.pattern) && (bend == rhs.bend) && (bx == rhs.bx) && (valid == rhs.valid) && - (mpclink == rhs.mpclink)); -} - -/// Debug -void CSCCorrelatedLCTDigi::print() const { - if (isValid()) { - edm::LogVerbatim("CSCDigi") << "CSC LCT #" << getTrknmb() << ": Valid = " << isValid() - << " Quality = " << getQuality() << " Key Wire = " << getKeyWG() - << " Strip = " << getStrip() << " Pattern = " << getPattern() - << " Bend = " << ((getBend() == 0) ? 'L' : 'R') << " BX = " << getBX() - << " MPC Link = " << getMPCLink() << " Type (SIM) = " << getType(); - } else { - edm::LogVerbatim("CSCDigi") << "Not a valid correlated LCT."; + + /// Debug + void CSCCorrelatedLCTDigi::print() const { + if (isValid()) { + edm::LogVerbatim("CSCDigi") << "CSC LCT #" << getTrknmb() << ": Valid = " << isValid() + << " Quality = " << getQuality() << " Key Wire = " << getKeyWG() + << " Strip = " << getStrip() << " Pattern = " << getPattern() + << " Bend = " << ((getBend() == 0) ? 'L' : 'R') << " BX = " << getBX() + << " MPC Link = " << getMPCLink() << " Type (SIM) = " << getType(); + } else { + edm::LogVerbatim("CSCDigi") << "Not a valid correlated LCT."; + } + } + + std::ostream& operator<<(std::ostream& o, const CSCCorrelatedLCTDigi& digi) { + // do not print out CSCID and sync error. They are not used anyway in the firmware, or the emulation + if (digi.isRun3()) + return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() + << " Run-2 Pattern = " << digi.getPattern() << " Run-3 Pattern = " << digi.getRun3Pattern() + << " Quality = " << digi.getQuality() << " Bend = " << digi.getBend() << " Slope = " << digi.getSlope() + << "\n" + << " KeyHalfStrip = " << digi.getStrip() << " KeyQuartStrip = " << digi.getStrip(4) + << " KeyEighthStrip = " << digi.getStrip(8) << " KeyWireGroup = " << digi.getKeyWG() + << " Type (SIM) = " << digi.getType() << " MPC Link = " << digi.getMPCLink(); + else + return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() + << " Pattern = " << digi.getPattern() << " Quality = " << digi.getQuality() + << " Bend = " << digi.getBend() << "\n" + << " KeyHalfStrip = " << digi.getStrip() << " KeyWireGroup = " << digi.getKeyWG() + << " Type (SIM) = " << digi.getType() << " MPC Link = " << digi.getMPCLink(); } -} - -std::ostream& operator<<(std::ostream& o, const CSCCorrelatedLCTDigi& digi) { - // do not print out CSCID and sync error. They are not used anyway in the firmware, or the emulation - if (digi.isRun3()) - return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() - << " Run-2 Pattern = " << digi.getPattern() << " Run-3 Pattern = " << digi.getRun3Pattern() - << " Quality = " << digi.getQuality() << " Bend = " << digi.getBend() << " Slope = " << digi.getSlopeEx() - << " Slope resolution = " << digi.getRawSlopeResolution() << " bits" - << " GemLayer = " << digi.getGemLayerUsedForSlopeComputation() << "\n" - << " KeyHalfStrip = " << digi.getStrip() << " KeyQuartStrip = " << digi.getStrip(4) - << " KeyEighthStrip = " << digi.getStrip(8) << " KeyWireGroup = " << digi.getKeyWG() - << " Type (SIM) = " << digi.getType() << " MPC Link = " << digi.getMPCLink(); - else - return o << "CSC LCT #" << digi.getTrknmb() << ": Valid = " << digi.isValid() << " BX = " << digi.getBX() - << " Pattern = " << digi.getPattern() << " Quality = " << digi.getQuality() << " Bend = " << digi.getBend() - << "\n" - << " KeyHalfStrip = " << digi.getStrip() << " KeyWireGroup = " << digi.getKeyWG() - << " Type (SIM) = " << digi.getType() << " MPC Link = " << digi.getMPCLink(); -} + +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCDCCFormatStatusDigi.cc b/DataFormats/CSCDigi/src/CSCDCCFormatStatusDigi.cc index 415b8992b29f1..e238ea59bce8f 100644 --- a/DataFormats/CSCDigi/src/CSCDCCFormatStatusDigi.cc +++ b/DataFormats/CSCDigi/src/CSCDCCFormatStatusDigi.cc @@ -22,7 +22,9 @@ #include #include -/** +namespace io_v1 { + + /** * @brief setExaminerInfo * @param fDCC_MASK_ DCC Examiner mask used (for information purposes). * @param fCSC_MASK_ Examiner mask per chamber @@ -32,86 +34,89 @@ * @param mCSC_PAYLOADS_ List of payloads per CSC * @param mCSC_STATUS_ List of statuses per CSC */ -void CSCDCCFormatStatusDigi::setDCCExaminerInfo(const ExaminerMaskType fDCC_MASK_, - const ExaminerMaskType fCSC_MASK_, - const ExaminerStatusType fDDU_SUMMARY_ERRORS_, - const std::map& mDDU_ERRORS_, - const std::map& mCSC_ERRORS_, - const std::map& mCSC_PAYLOADS_, - const std::map& mCSC_STATUS_) { - fDCC_MASK = fDCC_MASK_; - fCSC_MASK = fCSC_MASK_; - fDDU_SUMMARY_ERRORS = fDDU_SUMMARY_ERRORS_; - mDDU_ERRORS = mDDU_ERRORS_; - mCSC_ERRORS = mCSC_ERRORS_; - mCSC_PAYLOADS = mCSC_PAYLOADS_; - mCSC_STATUS = mCSC_STATUS_; -} + void CSCDCCFormatStatusDigi::setDCCExaminerInfo(const ExaminerMaskType fDCC_MASK_, + const ExaminerMaskType fCSC_MASK_, + const ExaminerStatusType fDDU_SUMMARY_ERRORS_, + const std::map& mDDU_ERRORS_, + const std::map& mCSC_ERRORS_, + const std::map& mCSC_PAYLOADS_, + const std::map& mCSC_STATUS_) { + fDCC_MASK = fDCC_MASK_; + fCSC_MASK = fCSC_MASK_; + fDDU_SUMMARY_ERRORS = fDDU_SUMMARY_ERRORS_; + mDDU_ERRORS = mDDU_ERRORS_; + mCSC_ERRORS = mCSC_ERRORS_; + mCSC_PAYLOADS = mCSC_PAYLOADS_; + mCSC_STATUS = mCSC_STATUS_; + } -/// Debug -void CSCDCCFormatStatusDigi::print() const { - // Keep original code in case I messed up the formatting in some subtle way when switching to MessageLogger - // - // std::cout << "CSCDCCFormatStatusDigi: DCC=" << std::dec << getDCCId() - // << " DCCMask=0x" << std::hex << std::setw(8) << std::setfill('0') << getDCCMask() - // << " CSCMask=0x" << std::hex << std::setw(8) << std::setfill('0') << getCSCMask() - // << " DCCErrors=0x" << std::hex << std::setw(8) << std::setfill('0') << getDDUSummaryErrors() - // << std::dec << "\n"; - // std::set ddu_list = getListOfDDUs(); - // for (std::set::iterator itr=ddu_list.begin(); itr != ddu_list.end(); ++itr) { - // std::cout << "DDU_" << std::dec << ((*itr)&0xFF) - // << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') << getDDUErrors(*itr) << "\n"; - // } - // std::set csc_list = getListOfCSCs(); - // for (std::set::iterator itr=csc_list.begin(); itr != csc_list.end(); ++itr) { - // - // std::cout << "CSC_" << std::dec << (((*itr)>>4)&0xFF) << "_" << ((*itr)&0xF) - // << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') << getCSCErrors(*itr) - // << " Payload=0x" << std::setw(8) << std::setfill('0') << getCSCPayload(*itr) - // << " Status=0x" << std::setw(8) << std::setfill('0') << getCSCStatus(*itr) << "\n"; - // } + /// Debug + void CSCDCCFormatStatusDigi::print() const { + // Keep original code in case I messed up the formatting in some subtle way when switching to MessageLogger + // + // std::cout << "CSCDCCFormatStatusDigi: DCC=" << std::dec << getDCCId() + // << " DCCMask=0x" << std::hex << std::setw(8) << std::setfill('0') << getDCCMask() + // << " CSCMask=0x" << std::hex << std::setw(8) << std::setfill('0') << getCSCMask() + // << " DCCErrors=0x" << std::hex << std::setw(8) << std::setfill('0') << getDDUSummaryErrors() + // << std::dec << "\n"; + // std::set ddu_list = getListOfDDUs(); + // for (std::set::iterator itr=ddu_list.begin(); itr != ddu_list.end(); ++itr) { + // std::cout << "DDU_" << std::dec << ((*itr)&0xFF) + // << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') << getDDUErrors(*itr) << "\n"; + // } + // std::set csc_list = getListOfCSCs(); + // for (std::set::iterator itr=csc_list.begin(); itr != csc_list.end(); ++itr) { + // + // std::cout << "CSC_" << std::dec << (((*itr)>>4)&0xFF) << "_" << ((*itr)&0xF) + // << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') << getCSCErrors(*itr) + // << " Payload=0x" << std::setw(8) << std::setfill('0') << getCSCPayload(*itr) + // << " Status=0x" << std::setw(8) << std::setfill('0') << getCSCStatus(*itr) << "\n"; + // } - edm::LogVerbatim("CSCDigi") << "CSCDCCFormatStatusDigi: DCC=" << std::dec << getDCCId() << " DCCMask=0x" << std::hex - << std::setw(8) << std::setfill('0') << getDCCMask() << " CSCMask=0x" << std::hex - << std::setw(8) << std::setfill('0') << getCSCMask() << " DCCErrors=0x" << std::hex - << std::setw(8) << std::setfill('0') << getDDUSummaryErrors() << std::dec; + edm::LogVerbatim("CSCDigi") << "CSCDCCFormatStatusDigi: DCC=" << std::dec << getDCCId() << " DCCMask=0x" << std::hex + << std::setw(8) << std::setfill('0') << getDCCMask() << " CSCMask=0x" << std::hex + << std::setw(8) << std::setfill('0') << getCSCMask() << " DCCErrors=0x" << std::hex + << std::setw(8) << std::setfill('0') << getDDUSummaryErrors() << std::dec; - std::ostringstream ost; + std::ostringstream ost; - std::set ddu_list = getListOfDDUs(); - for (std::set::iterator itr = ddu_list.begin(); itr != ddu_list.end(); ++itr) { - ost << "DDU_" << std::dec << ((*itr) & 0xFF) << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') - << getDDUErrors(*itr); - edm::LogVerbatim("CSCDigi") << ost.str(); - ost.clear(); - } + std::set ddu_list = getListOfDDUs(); + for (std::set::iterator itr = ddu_list.begin(); itr != ddu_list.end(); ++itr) { + ost << "DDU_" << std::dec << ((*itr) & 0xFF) << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') + << getDDUErrors(*itr); + edm::LogVerbatim("CSCDigi") << ost.str(); + ost.clear(); + } - std::set csc_list = getListOfCSCs(); - for (std::set::iterator itr = csc_list.begin(); itr != csc_list.end(); ++itr) { - ost << "CSC_" << std::dec << (((*itr) >> 4) & 0xFF) << "_" << ((*itr) & 0xF) << " Errors=0x" << std::hex - << std::setw(8) << std::setfill('0') << getCSCErrors(*itr) << " Payload=0x" << std::setw(8) << std::setfill('0') - << getCSCPayload(*itr) << " Status=0x" << std::setw(8) << std::setfill('0') << getCSCStatus(*itr); - edm::LogVerbatim("CSCDigi") << ost.str(); - ost.clear(); + std::set csc_list = getListOfCSCs(); + for (std::set::iterator itr = csc_list.begin(); itr != csc_list.end(); ++itr) { + ost << "CSC_" << std::dec << (((*itr) >> 4) & 0xFF) << "_" << ((*itr) & 0xF) << " Errors=0x" << std::hex + << std::setw(8) << std::setfill('0') << getCSCErrors(*itr) << " Payload=0x" << std::setw(8) + << std::setfill('0') << getCSCPayload(*itr) << " Status=0x" << std::setw(8) << std::setfill('0') + << getCSCStatus(*itr); + edm::LogVerbatim("CSCDigi") << ost.str(); + ost.clear(); + } } -} -std::ostream& operator<<(std::ostream& o, const CSCDCCFormatStatusDigi& digi) { - o << "CSCDCCFormatStatusDigi: DCC=" << std::dec << digi.getDCCId() << " DCCMask=0x" << std::hex << std::setw(8) - << std::setfill('0') << digi.getDCCMask() << " CSCMask=0x" << std::hex << std::setw(8) << std::setfill('0') - << digi.getCSCMask() << " DCCErrors=0x" << std::hex << std::setw(8) << std::setfill('0') - << digi.getDDUSummaryErrors() << std::dec << "\n"; - std::set ddu_list = digi.getListOfDDUs(); - for (std::set::iterator itr = ddu_list.begin(); itr != ddu_list.end(); ++itr) { - o << "DDU_" << std::dec << ((*itr) & 0xFF) << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') - << digi.getDDUErrors(*itr) << "\n"; + std::ostream& operator<<(std::ostream& o, const CSCDCCFormatStatusDigi& digi) { + o << "CSCDCCFormatStatusDigi: DCC=" << std::dec << digi.getDCCId() << " DCCMask=0x" << std::hex << std::setw(8) + << std::setfill('0') << digi.getDCCMask() << " CSCMask=0x" << std::hex << std::setw(8) << std::setfill('0') + << digi.getCSCMask() << " DCCErrors=0x" << std::hex << std::setw(8) << std::setfill('0') + << digi.getDDUSummaryErrors() << std::dec << "\n"; + std::set ddu_list = digi.getListOfDDUs(); + for (std::set::iterator itr = ddu_list.begin(); itr != ddu_list.end(); ++itr) { + o << "DDU_" << std::dec << ((*itr) & 0xFF) << " Errors=0x" << std::hex << std::setw(8) << std::setfill('0') + << digi.getDDUErrors(*itr) << "\n"; + } + std::set csc_list = digi.getListOfCSCs(); + for (std::set::iterator itr = csc_list.begin(); itr != csc_list.end(); ++itr) { + o << "CSC_" << std::dec << (((*itr) >> 4) & 0xFF) << "_" << ((*itr) & 0xF) << " Errors=0x" << std::hex + << std::setw(8) << std::setfill('0') << digi.getCSCErrors(*itr) << " Payload=0x" << std::setw(8) + << std::setfill('0') << digi.getCSCPayload(*itr) << " Status=0x" << std::setw(8) << std::setfill('0') + << digi.getCSCStatus(*itr) << "\n"; + } + return o; } - std::set csc_list = digi.getListOfCSCs(); - for (std::set::iterator itr = csc_list.begin(); itr != csc_list.end(); ++itr) { - o << "CSC_" << std::dec << (((*itr) >> 4) & 0xFF) << "_" << ((*itr) & 0xF) << " Errors=0x" << std::hex - << std::setw(8) << std::setfill('0') << digi.getCSCErrors(*itr) << " Payload=0x" << std::setw(8) - << std::setfill('0') << digi.getCSCPayload(*itr) << " Status=0x" << std::setw(8) << std::setfill('0') - << digi.getCSCStatus(*itr) << "\n"; - } - return o; -} + +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCShowerDigi.cc b/DataFormats/CSCDigi/src/CSCShowerDigi.cc index e79ab6453bdcc..3523a2a829551 100644 --- a/DataFormats/CSCDigi/src/CSCShowerDigi.cc +++ b/DataFormats/CSCDigi/src/CSCShowerDigi.cc @@ -5,87 +5,91 @@ using namespace std; -/// Constructors -CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime, - const uint16_t bitsOutOfTime, - const uint16_t cscID, - const uint16_t bx, - const uint16_t showerType, - const uint16_t wireNHits, - const uint16_t compNHits) - : bitsInTime_(bitsInTime), - bitsOutOfTime_(bitsOutOfTime), - cscID_(cscID), - bx_(bx), - showerType_(showerType), - wireNHits_(wireNHits), - comparatorNHits_(compNHits) {} - -/// Default -CSCShowerDigi::CSCShowerDigi() - : bitsInTime_(0), bitsOutOfTime_(0), cscID_(0), bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0) {} - -void CSCShowerDigi::clear() { - bitsInTime_ = 0; - bitsOutOfTime_ = 0; - cscID_ = 0; - bx_ = 0; - showerType_ = 0; - wireNHits_ = 0; - comparatorNHits_ = 0; -} - -bool CSCShowerDigi::isValid() const { - // any loose shower is valid - // isLooseOutofTime() is removed as out-of-time shower is not used for Run3 - return isLooseInTime() and isValidShowerType(); -} - -bool CSCShowerDigi::isLooseInTime() const { return bitsInTime() >= kLoose; } - -bool CSCShowerDigi::isNominalInTime() const { return bitsInTime() >= kNominal; } - -bool CSCShowerDigi::isTightInTime() const { return bitsInTime() >= kTight; } - -bool CSCShowerDigi::isLooseOutOfTime() const { return bitsOutOfTime() >= kLoose; } - -bool CSCShowerDigi::isNominalOutOfTime() const { return bitsOutOfTime() >= kNominal; } - -bool CSCShowerDigi::isTightOutOfTime() const { return bitsOutOfTime() >= kTight; } - -bool CSCShowerDigi::isValidShowerType() const { return showerType_ > kInvalidShower; } - -std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi) { - unsigned int showerType = digi.getShowerType(); - std::string compHitsStr(", comparatorHits "); - compHitsStr += std::to_string(digi.getComparatorNHits()); - std::string wireHitsStr(", wireHits "); - wireHitsStr += std::to_string(digi.getWireNHits()); - std::string showerStr; - switch (showerType) { - case 0: - showerStr = "Invalid ShowerType"; - break; - case 1: - showerStr = "AnodeShower"; - break; - case 2: - showerStr = "CathodeShower"; - break; - case 3: - showerStr = "MatchedShower"; - break; - case 4: - showerStr = "EMTFShower"; - break; - case 5: - showerStr = "GMTShower"; - break; - default: - showerStr = "UnknownShowerType"; +namespace io_v1 { + + /// Constructors + CSCShowerDigi::CSCShowerDigi(const uint16_t bitsInTime, + const uint16_t bitsOutOfTime, + const uint16_t cscID, + const uint16_t bx, + const uint16_t showerType, + const uint16_t wireNHits, + const uint16_t compNHits) + : bitsInTime_(bitsInTime), + bitsOutOfTime_(bitsOutOfTime), + cscID_(cscID), + bx_(bx), + showerType_(showerType), + wireNHits_(wireNHits), + comparatorNHits_(compNHits) {} + + /// Default + CSCShowerDigi::CSCShowerDigi() + : bitsInTime_(0), bitsOutOfTime_(0), cscID_(0), bx_(0), showerType_(0), wireNHits_(0), comparatorNHits_(0) {} + + void CSCShowerDigi::clear() { + bitsInTime_ = 0; + bitsOutOfTime_ = 0; + cscID_ = 0; + bx_ = 0; + showerType_ = 0; + wireNHits_ = 0; + comparatorNHits_ = 0; + } + + bool CSCShowerDigi::isValid() const { + // any loose shower is valid + // isLooseOutofTime() is removed as out-of-time shower is not used for Run3 + return isLooseInTime() and isValidShowerType(); + } + + bool CSCShowerDigi::isLooseInTime() const { return bitsInTime() >= kLoose; } + + bool CSCShowerDigi::isNominalInTime() const { return bitsInTime() >= kNominal; } + + bool CSCShowerDigi::isTightInTime() const { return bitsInTime() >= kTight; } + + bool CSCShowerDigi::isLooseOutOfTime() const { return bitsOutOfTime() >= kLoose; } + + bool CSCShowerDigi::isNominalOutOfTime() const { return bitsOutOfTime() >= kNominal; } + + bool CSCShowerDigi::isTightOutOfTime() const { return bitsOutOfTime() >= kTight; } + + bool CSCShowerDigi::isValidShowerType() const { return showerType_ > kInvalidShower; } + + std::ostream& operator<<(std::ostream& o, const CSCShowerDigi& digi) { + unsigned int showerType = digi.getShowerType(); + std::string compHitsStr(", comparatorHits "); + compHitsStr += std::to_string(digi.getComparatorNHits()); + std::string wireHitsStr(", wireHits "); + wireHitsStr += std::to_string(digi.getWireNHits()); + std::string showerStr; + switch (showerType) { + case 0: + showerStr = "Invalid ShowerType"; + break; + case 1: + showerStr = "AnodeShower"; + break; + case 2: + showerStr = "CathodeShower"; + break; + case 3: + showerStr = "MatchedShower"; + break; + case 4: + showerStr = "EMTFShower"; + break; + case 5: + showerStr = "GMTShower"; + break; + default: + showerStr = "UnknownShowerType"; + } + + return o << showerStr << ": bx " << digi.getBX() << ", in-time bits " << digi.bitsInTime() << ", out-of-time bits " + << digi.bitsOutOfTime() << ((showerType == 1 or showerType == 3) ? wireHitsStr : "") + << ((showerType == 2 or showerType == 3) ? compHitsStr : "") << ";"; } - return o << showerStr << ": bx " << digi.getBX() << ", in-time bits " << digi.bitsInTime() << ", out-of-time bits " - << digi.bitsOutOfTime() << ((showerType == 1 or showerType == 3) ? wireHitsStr : "") - << ((showerType == 2 or showerType == 3) ? compHitsStr : "") << ";"; -} +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCStripDigi.cc b/DataFormats/CSCDigi/src/CSCStripDigi.cc index 66e0bd117c2bc..eba957233c374 100644 --- a/DataFormats/CSCDigi/src/CSCStripDigi.cc +++ b/DataFormats/CSCDigi/src/CSCStripDigi.cc @@ -9,61 +9,65 @@ #include #include -// Comparison -bool CSCStripDigi::operator==(const CSCStripDigi& digi) const { - if (getStrip() != digi.getStrip()) - return false; - if (getADCCounts().size() != digi.getADCCounts().size()) - return false; - if (getADCCounts() != digi.getADCCounts()) - return false; - return true; -} +namespace io_v1 { -/// Get the CFEB number. Counts from 0. -// originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc -int CSCStripDigi::getCFEB() const { return (strip - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } - -void CSCStripDigi::setADCCounts(const std::vector& vADCCounts) { - bool badVal = false; - for (int i = 0; i < (int)vADCCounts.size(); i++) { - if (vADCCounts[i] < 1) - badVal = true; - } - if (!badVal) { - ADCCounts = vADCCounts; - } else { - std::vector ZeroCounts(8, 0); - ADCCounts = ZeroCounts; + // Comparison + bool CSCStripDigi::operator==(const CSCStripDigi& digi) const { + if (getStrip() != digi.getStrip()) + return false; + if (getADCCounts().size() != digi.getADCCounts().size()) + return false; + if (getADCCounts() != digi.getADCCounts()) + return false; + return true; } -} -// Debug -void CSCStripDigi::print() const { - std::ostringstream ost; - ost << "CSCStripDigi | strip " << getStrip() << " | ADCCounts "; - for (int i = 0; i < (int)getADCCounts().size(); i++) { - ost << getADCCounts()[i] << " "; - } - ost << " | Overflow "; - for (int i = 0; i < (int)getADCOverflow().size(); i++) { - ost << getADCOverflow()[i] << " "; - } - ost << " | Overlapped "; - for (int i = 0; i < (int)getOverlappedSample().size(); i++) { - ost << getOverlappedSample()[i] << " "; + /// Get the CFEB number. Counts from 0. + // originally defined in EventFilter/CSCRawToDigi/src/CSCComparatorData.cc + int CSCStripDigi::getCFEB() const { return (strip - 1) / CSCConstants::NUM_STRIPS_PER_CFEB; } + + void CSCStripDigi::setADCCounts(const std::vector& vADCCounts) { + bool badVal = false; + for (int i = 0; i < (int)vADCCounts.size(); i++) { + if (vADCCounts[i] < 1) + badVal = true; + } + if (!badVal) { + ADCCounts = vADCCounts; + } else { + std::vector ZeroCounts(8, 0); + ADCCounts = ZeroCounts; + } } - ost << " | L1APhase "; - for (int i = 0; i < (int)getL1APhase().size(); i++) { - ost << getL1APhase()[i] << " "; + + // Debug + void CSCStripDigi::print() const { + std::ostringstream ost; + ost << "CSCStripDigi | strip " << getStrip() << " | ADCCounts "; + for (int i = 0; i < (int)getADCCounts().size(); i++) { + ost << getADCCounts()[i] << " "; + } + ost << " | Overflow "; + for (int i = 0; i < (int)getADCOverflow().size(); i++) { + ost << getADCOverflow()[i] << " "; + } + ost << " | Overlapped "; + for (int i = 0; i < (int)getOverlappedSample().size(); i++) { + ost << getOverlappedSample()[i] << " "; + } + ost << " | L1APhase "; + for (int i = 0; i < (int)getL1APhase().size(); i++) { + ost << getL1APhase()[i] << " "; + } + edm::LogVerbatim("CSCDigi") << ost.str(); } - edm::LogVerbatim("CSCDigi") << ost.str(); -} -std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi) { - o << " " << digi.getStrip(); - for (size_t i = 0; i < digi.getADCCounts().size(); ++i) { - o << " " << (digi.getADCCounts())[i]; + std::ostream& operator<<(std::ostream& o, const CSCStripDigi& digi) { + o << " " << digi.getStrip(); + for (size_t i = 0; i < digi.getADCCounts().size(); ++i) { + o << " " << (digi.getADCCounts())[i]; + } + return o; } - return o; -} + +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/CSCWireDigi.cc b/DataFormats/CSCDigi/src/CSCWireDigi.cc index 582723813f59c..f8c4b49d2befe 100644 --- a/DataFormats/CSCDigi/src/CSCWireDigi.cc +++ b/DataFormats/CSCDigi/src/CSCWireDigi.cc @@ -10,72 +10,77 @@ #include #include -/// Constructors +namespace io_v1 { -CSCWireDigi::CSCWireDigi(int wire, unsigned int tbinb) { - /// Wire group number in the digi (16 lower bits from the wire group number) - wire_ = wire & 0x0000FFFF; - tbinb_ = tbinb; - /// BX in the wire digis (16 upper bits from the wire group number) - wireBX_ = (wire >> 16) & 0x0000FFFF; - /// BX wire group combination - wireBXandWires_ = wire; -} + /// Constructors -/// Default -CSCWireDigi::CSCWireDigi() { - wire_ = 0; - tbinb_ = 0; - wireBX_ = 0; - wireBXandWires_ = 0; -} + CSCWireDigi::CSCWireDigi(int wire, unsigned int tbinb) { + /// Wire group number in the digi (16 lower bits from the wire group number) + wire_ = wire & 0x0000FFFF; + tbinb_ = tbinb; + /// BX in the wire digis (16 upper bits from the wire group number) + wireBX_ = (wire >> 16) & 0x0000FFFF; + /// BX wire group combination + wireBXandWires_ = wire; + } + + /// Default + CSCWireDigi::CSCWireDigi() { + wire_ = 0; + tbinb_ = 0; + wireBX_ = 0; + wireBXandWires_ = 0; + } -/// return tbin number (obsolete, use getTimeBin() instead) -int CSCWireDigi::getBeamCrossingTag() const { return getTimeBin(); } -/// return first tbin ON number -int CSCWireDigi::getTimeBin() const { - uint32_t tbit = 1; - int tbin = -1; - for (int i = 0; i < 32; i++) { - if (tbit & tbinb_) - tbin = i; - if (tbin > -1) - break; - tbit = tbit << 1; + /// return tbin number (obsolete, use getTimeBin() instead) + int CSCWireDigi::getBeamCrossingTag() const { return getTimeBin(); } + /// return first tbin ON number + int CSCWireDigi::getTimeBin() const { + uint32_t tbit = 1; + int tbin = -1; + for (int i = 0; i < 32; i++) { + if (tbit & tbinb_) + tbin = i; + if (tbin > -1) + break; + tbit = tbit << 1; + } + return tbin; } - return tbin; -} -/// return vector of time bins ON -std::vector CSCWireDigi::getTimeBinsOn() const { - std::vector tbins; - uint32_t tbit = tbinb_; - uint32_t one = 1; - for (int i = 0; i < 32; i++) { - if (tbit & one) - tbins.push_back(i); - tbit = tbit >> 1; - if (tbit == 0) - break; + /// return vector of time bins ON + std::vector CSCWireDigi::getTimeBinsOn() const { + std::vector tbins; + uint32_t tbit = tbinb_; + uint32_t one = 1; + for (int i = 0; i < 32; i++) { + if (tbit & one) + tbins.push_back(i); + tbit = tbit >> 1; + if (tbit == 0) + break; + } + return tbins; } - return tbins; -} -/// Debug + /// Debug -void CSCWireDigi::print() const { - std::ostringstream ost; - ost << "CSCWireDigi | wg " << getWireGroup() << " | " - << " BX # " << getWireGroupBX() << " | " - << " BX + Wire " << std::hex << getBXandWireGroup() << " | " << std::dec << " First Time Bin On " << getTimeBin() - << " | Time Bins On "; - std::vector tbins = getTimeBinsOn(); - std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(ost, " ")); - edm::LogVerbatim("CSCDigi") << ost.str(); -} + void CSCWireDigi::print() const { + std::ostringstream ost; + ost << "CSCWireDigi | wg " << getWireGroup() << " | " + << " BX # " << getWireGroupBX() << " | " + << " BX + Wire " << std::hex << getBXandWireGroup() << " | " << std::dec << " First Time Bin On " + << getTimeBin() << " | Time Bins On "; + std::vector tbins = getTimeBinsOn(); + std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(ost, " ")); + edm::LogVerbatim("CSCDigi") << ost.str(); + } + + std::ostream& operator<<(std::ostream& o, const CSCWireDigi& digi) { + o << " CSCWireDigi wg: " << digi.getWireGroup() << ", First Time Bin On: " << digi.getTimeBin() + << ", Time Bins On: "; + std::vector tbins = digi.getTimeBinsOn(); + std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(o, " ")); + return o; + } -std::ostream& operator<<(std::ostream& o, const CSCWireDigi& digi) { - o << " CSCWireDigi wg: " << digi.getWireGroup() << ", First Time Bin On: " << digi.getTimeBin() << ", Time Bins On: "; - std::vector tbins = digi.getTimeBinsOn(); - std::copy(tbins.begin(), tbins.end(), std::ostream_iterator(o, " ")); - return o; -} +} // namespace io_v1 diff --git a/DataFormats/CSCDigi/src/classes_def.xml b/DataFormats/CSCDigi/src/classes_def.xml index 123fb4252662c..e05d6b77b3d5e 100644 --- a/DataFormats/CSCDigi/src/classes_def.xml +++ b/DataFormats/CSCDigi/src/classes_def.xml @@ -1,170 +1,157 @@ - - + + - - + + - - + + - - + + - - - - - - + + - - - + + - - - - - + + - - - + + - - - - + + - - + + - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - - + + + - - - + + + - + - + - + - - - + + + - - - + + + - + - + - + - - - + + + - - - + + + - + - + - + - - - + + + - - - + + + - + - + - + - - - + + + - - - + + + - + - + diff --git a/DataFormats/CSCRecHit/interface/CSCRecHit2D.h b/DataFormats/CSCRecHit/interface/CSCRecHit2D.h index f280ce987a288..9a2ec8f382c4f 100644 --- a/DataFormats/CSCRecHit/interface/CSCRecHit2D.h +++ b/DataFormats/CSCRecHit/interface/CSCRecHit2D.h @@ -15,131 +15,135 @@ #include #include -class CSCRecHit2D final : public RecHit2DLocalPos { -public: - typedef std::vector ChannelContainer; - typedef edm::RangeMap > ADCContainer; - - enum SharedInputType { - all = TrackingRecHit::all, - some = TrackingRecHit::some, - allWires, - someWires, - allStrips, - someStrips +namespace io_v1 { + + class CSCRecHit2D final : public RecHit2DLocalPos { + public: + typedef std::vector ChannelContainer; + typedef edm::RangeMap > ADCContainer; + + enum SharedInputType { + all = TrackingRecHit::all, + some = TrackingRecHit::some, + allWires, + someWires, + allStrips, + someStrips + }; + + static const unsigned int MAXSTRIPS = 3; + static const unsigned int MAXTIMEBINS = 4; + static const unsigned int N_ADC = MAXSTRIPS * MAXTIMEBINS; + CSCRecHit2D(); + + CSCRecHit2D(const CSCDetId& id, + const LocalPoint& pos, + const LocalError& err, + const ChannelContainer& channels, + const ADCContainer& adcs, + const ChannelContainer& wgroups, + float tpeak, + float posInStrip, + float errInStrip, + int quality, + short int badStrip = 0, + short int badWireGroup = 0, + int scaledWireTime = 0, + float energyDeposit = -995.); + + ~CSCRecHit2D() override; + + /// RecHit2DLocalPos base class interface + CSCRecHit2D* clone() const override { return new CSCRecHit2D(*this); } + LocalPoint localPosition() const override { return theLocalPosition; } + LocalError localPositionError() const override { return theLocalError; } + CSCDetId cscDetId() const { return geographicalId(); } + + /// Extracting strip channel numbers comprising the rechit - low + int channels(unsigned int i) const { return theStrips_[i]; } + unsigned int nStrips() const { return nStrips_; } + + /// Extract the L1A phase bits from the StripChannelContainer - high + int channelsl1a(unsigned int i) const { return theL1APhaseBits_[i]; } /// L1A + + /// Container of wire groups comprising the rechit + short int hitWire() const { return hitWire_; } + short int wgroupsBX() const { return theWGroupsBX_; } + + unsigned int nWireGroups() const { return nWireGroups_; } + + /// Map of strip ADCs for strips comprising the rechit + float adcs(unsigned int strip, unsigned int timebin) const { return theADCs_[strip * MAXTIMEBINS + timebin]; } + + unsigned int nTimeBins() const { return nTimeBins_; } + + /// Fitted peaking time + float tpeak() const { return theTpeak; } + + /// The estimated position within the strip + float positionWithinStrip() const { return thePositionWithinStrip; }; + + /// The uncertainty of the estimated position within the strip + float errorWithinStrip() const { return theErrorWithinStrip; }; + + /// quality flag of the reconstruction + int quality() const { return theQuality; } + + /// flags for involvement of 'bad' channels + short int badStrip() const { return theBadStrip; } + short int badWireGroup() const { return theBadWireGroup; } + + // Calculated wire time in ns + float wireTime() const { return (float)theScaledWireTime / 100.; } + + /// Energy deposited in the layer. Note: this value is dE. In order to + /// get the dE/dX, you will need to divide by the path length. + /// Specific failure values... + /// If the user has chosen not to use the gas gain correction ---> -998. + /// If the gas gain correction from the database is a bad value -> -997. + /// If it is an edge strip --------------------------------------> -996. + /// If gas-gain is OK, but the ADC vector is the wrong size ----> -999. + /// If the user has created the Rechit without the energy deposit> -995. + /// If the user has created the Rechit with no arguments --------> -994. + float energyDepositedInLayer() const { return theEnergyDeposit; } + + /// Returns true if the two TrackingRecHits are using the same input information, false otherwise. In this case, looks at the geographical ID and channel numbers for strips and wires. + bool sharesInput(const TrackingRecHit* other, TrackingRecHit::SharedInputType what) const override; + + /// Returns true if the two TrackingRecHits are using the same input information, false otherwise. In this case, looks at the geographical ID and channel numbers for strips and wires. + bool sharesInput(const TrackingRecHit* other, CSCRecHit2D::SharedInputType what) const; + + /// Returns true if the two CSCRecHits are using the same input information, false otherwise. In this case, looks at the geographical ID and channel numbers for strips and wires. + bool sharesInput(const CSCRecHit2D* otherRecHit, CSCRecHit2D::SharedInputType what) const; + + /// Print the content of the RecHit2D including L1A (for debugging) + void print() const; + + private: + float theTpeak; + float thePositionWithinStrip; + float theErrorWithinStrip; + float theEnergyDeposit; + int theQuality; + int theScaledWireTime; + short int hitWire_; + short int theWGroupsBX_; + short int theBadStrip; + short int theBadWireGroup; + + unsigned char nStrips_, nWireGroups_, nTimeBins_; + + unsigned char theL1APhaseBits_[MAXSTRIPS]; + unsigned char theStrips_[MAXSTRIPS]; + float theADCs_[N_ADC]; + + LocalPoint theLocalPosition; + LocalError theLocalError; }; - static const unsigned int MAXSTRIPS = 3; - static const unsigned int MAXTIMEBINS = 4; - static const unsigned int N_ADC = MAXSTRIPS * MAXTIMEBINS; - CSCRecHit2D(); - - CSCRecHit2D(const CSCDetId& id, - const LocalPoint& pos, - const LocalError& err, - const ChannelContainer& channels, - const ADCContainer& adcs, - const ChannelContainer& wgroups, - float tpeak, - float posInStrip, - float errInStrip, - int quality, - short int badStrip = 0, - short int badWireGroup = 0, - int scaledWireTime = 0, - float energyDeposit = -995.); - - ~CSCRecHit2D() override; - - /// RecHit2DLocalPos base class interface - CSCRecHit2D* clone() const override { return new CSCRecHit2D(*this); } - LocalPoint localPosition() const override { return theLocalPosition; } - LocalError localPositionError() const override { return theLocalError; } - CSCDetId cscDetId() const { return geographicalId(); } - - /// Extracting strip channel numbers comprising the rechit - low - int channels(unsigned int i) const { return theStrips_[i]; } - unsigned int nStrips() const { return nStrips_; } - - /// Extract the L1A phase bits from the StripChannelContainer - high - int channelsl1a(unsigned int i) const { return theL1APhaseBits_[i]; } /// L1A - - /// Container of wire groups comprising the rechit - short int hitWire() const { return hitWire_; } - short int wgroupsBX() const { return theWGroupsBX_; } - - unsigned int nWireGroups() const { return nWireGroups_; } - - /// Map of strip ADCs for strips comprising the rechit - float adcs(unsigned int strip, unsigned int timebin) const { return theADCs_[strip * MAXTIMEBINS + timebin]; } - - unsigned int nTimeBins() const { return nTimeBins_; } - - /// Fitted peaking time - float tpeak() const { return theTpeak; } - - /// The estimated position within the strip - float positionWithinStrip() const { return thePositionWithinStrip; }; - - /// The uncertainty of the estimated position within the strip - float errorWithinStrip() const { return theErrorWithinStrip; }; - - /// quality flag of the reconstruction - int quality() const { return theQuality; } - - /// flags for involvement of 'bad' channels - short int badStrip() const { return theBadStrip; } - short int badWireGroup() const { return theBadWireGroup; } - - // Calculated wire time in ns - float wireTime() const { return (float)theScaledWireTime / 100.; } - - /// Energy deposited in the layer. Note: this value is dE. In order to - /// get the dE/dX, you will need to divide by the path length. - /// Specific failure values... - /// If the user has chosen not to use the gas gain correction ---> -998. - /// If the gas gain correction from the database is a bad value -> -997. - /// If it is an edge strip --------------------------------------> -996. - /// If gas-gain is OK, but the ADC vector is the wrong size ----> -999. - /// If the user has created the Rechit without the energy deposit> -995. - /// If the user has created the Rechit with no arguments --------> -994. - float energyDepositedInLayer() const { return theEnergyDeposit; } - - /// Returns true if the two TrackingRecHits are using the same input information, false otherwise. In this case, looks at the geographical ID and channel numbers for strips and wires. - bool sharesInput(const TrackingRecHit* other, TrackingRecHit::SharedInputType what) const override; - - /// Returns true if the two TrackingRecHits are using the same input information, false otherwise. In this case, looks at the geographical ID and channel numbers for strips and wires. - bool sharesInput(const TrackingRecHit* other, CSCRecHit2D::SharedInputType what) const; - - /// Returns true if the two CSCRecHits are using the same input information, false otherwise. In this case, looks at the geographical ID and channel numbers for strips and wires. - bool sharesInput(const CSCRecHit2D* otherRecHit, CSCRecHit2D::SharedInputType what) const; - - /// Print the content of the RecHit2D including L1A (for debugging) - void print() const; - -private: - float theTpeak; - float thePositionWithinStrip; - float theErrorWithinStrip; - float theEnergyDeposit; - int theQuality; - int theScaledWireTime; - short int hitWire_; - short int theWGroupsBX_; - short int theBadStrip; - short int theBadWireGroup; - - unsigned char nStrips_, nWireGroups_, nTimeBins_; - - unsigned char theL1APhaseBits_[MAXSTRIPS]; - unsigned char theStrips_[MAXSTRIPS]; - float theADCs_[N_ADC]; - - LocalPoint theLocalPosition; - LocalError theLocalError; -}; - -/// Output operator for CSCRecHit2D -std::ostream& operator<<(std::ostream& os, const CSCRecHit2D& rh); + /// Output operator for CSCRecHit2D + std::ostream& operator<<(std::ostream& os, const CSCRecHit2D& rh); +} // namespace io_v1 +using CSCRecHit2D = io_v1::CSCRecHit2D; #endif diff --git a/DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h b/DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h index 9d0d4d8a89ca9..d38c7771777d8 100644 --- a/DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h +++ b/DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h @@ -6,13 +6,13 @@ * The collection of CSCRecHit2D's. See \ref CSCRecHit2DCollection.h for details. * */ -#include -#include +#include -#include -#include -#include +#include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCRecHit/interface/CSCRecHit2D.h" -typedef edm::RangeMap > CSCRecHit2DCollection; +#include "DataFormats/Common/interface/IdToHitRange.h" + +using CSCRecHit2DCollection = edm::IdToHitRange; #endif diff --git a/DataFormats/CSCRecHit/interface/CSCSegment.h b/DataFormats/CSCRecHit/interface/CSCSegment.h index 50fe2310c2e6d..625c99d761b7d 100644 --- a/DataFormats/CSCRecHit/interface/CSCSegment.h +++ b/DataFormats/CSCRecHit/interface/CSCSegment.h @@ -17,87 +17,91 @@ #include -class CSCSegment final : public RecSegment { -public: - /// Default constructor - CSCSegment() : theChi2(0.), aME11a_duplicate(false) {} +namespace io_v1 { - /// Constructor - CSCSegment(const std::vector& proto_segment, - LocalPoint origin, - LocalVector direction, - const AlgebraicSymMatrix& errors, - double chi2); + class CSCSegment final : public RecSegment { + public: + /// Default constructor + CSCSegment() : theChi2(0.), aME11a_duplicate(false) {} - /// Destructor - ~CSCSegment() override; + /// Constructor + CSCSegment(const std::vector& proto_segment, + LocalPoint origin, + LocalVector direction, + const AlgebraicSymMatrix& errors, + double chi2); - //--- Base class interface - CSCSegment* clone() const override { return new CSCSegment(*this); } + /// Destructor + ~CSCSegment() override; - LocalPoint localPosition() const override { return theOrigin; } - LocalError localPositionError() const override; + //--- Base class interface + CSCSegment* clone() const override { return new CSCSegment(*this); } - LocalVector localDirection() const override { return theLocalDirection; } - LocalError localDirectionError() const override; + LocalPoint localPosition() const override { return theOrigin; } + LocalError localPositionError() const override; - /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) - AlgebraicVector parameters() const override; + LocalVector localDirection() const override { return theLocalDirection; } + LocalError localDirectionError() const override; - /// Covariance matrix of parameters() - AlgebraicSymMatrix parametersError() const override { return theCovMatrix; } + /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) + AlgebraicVector parameters() const override; - /// The projection matrix relates the trajectory state parameters to the segment parameters(). - AlgebraicMatrix projectionMatrix() const override; + /// Covariance matrix of parameters() + AlgebraicSymMatrix parametersError() const override { return theCovMatrix; } - std::vector recHits() const override; + /// The projection matrix relates the trajectory state parameters to the segment parameters(). + AlgebraicMatrix projectionMatrix() const override; - std::vector recHits() override; + std::vector recHits() const override; - double chi2() const override { return theChi2; }; + std::vector recHits() override; - int dimension() const override { return 4; } + double chi2() const override { return theChi2; }; - int degreesOfFreedom() const override { return 2 * nRecHits() - 4; } + int dimension() const override { return 4; } - //--- Extension of the interface + int degreesOfFreedom() const override { return 2 * nRecHits() - 4; } - const std::vector& specificRecHits() const { return theCSCRecHits; } + //--- Extension of the interface - int nRecHits() const { return theCSCRecHits.size(); } + const std::vector& specificRecHits() const { return theCSCRecHits; } - CSCDetId cscDetId() const { return geographicalId(); } + int nRecHits() const { return theCSCRecHits.size(); } - void setDuplicateSegments(std::vector& duplicates); + CSCDetId cscDetId() const { return geographicalId(); } - bool isME11a_duplicate() const { return (!theDuplicateSegments.empty() ? true : false); } - // a copy of the duplicated segments (ME1/1a only) - const std::vector& duplicateSegments() const { return theDuplicateSegments; } + void setDuplicateSegments(std::vector& duplicates); - bool testSharesAllInSpecificRecHits(const std::vector& specificRecHits_1, - const std::vector& specificRecHits_2, - CSCRecHit2D::SharedInputType) const; + bool isME11a_duplicate() const { return (!theDuplicateSegments.empty() ? true : false); } + // a copy of the duplicated segments (ME1/1a only) + const std::vector& duplicateSegments() const { return theDuplicateSegments; } - //bool sharesRecHits(CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType); - // checks if ALL the rechits share the specific input (allWires, allStrips or all) - bool sharesRecHits(const CSCSegment& anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const; - // checks if ALL the rechits share SOME wire AND SOME strip input - bool sharesRecHits(const CSCSegment& anotherSegment) const; + bool testSharesAllInSpecificRecHits(const std::vector& specificRecHits_1, + const std::vector& specificRecHits_2, + CSCRecHit2D::SharedInputType) const; - float time() const; + //bool sharesRecHits(CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType); + // checks if ALL the rechits share the specific input (allWires, allStrips or all) + bool sharesRecHits(const CSCSegment& anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const; + // checks if ALL the rechits share SOME wire AND SOME strip input + bool sharesRecHits(const CSCSegment& anotherSegment) const; - void print() const; + float time() const; -private: - std::vector theCSCRecHits; - LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system - LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system - AlgebraicSymMatrix theCovMatrix; // the covariance matrix - double theChi2; - bool aME11a_duplicate; - std::vector theDuplicateSegments; // ME1/1a only -}; + void print() const; -std::ostream& operator<<(std::ostream& os, const CSCSegment& seg); + private: + std::vector theCSCRecHits; + LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system + LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system + AlgebraicSymMatrix theCovMatrix; // the covariance matrix + double theChi2; + bool aME11a_duplicate; + std::vector theDuplicateSegments; // ME1/1a only + }; + std::ostream& operator<<(std::ostream& os, const CSCSegment& seg); + +} // namespace io_v1 +using CSCSegment = io_v1::CSCSegment; #endif // CSCRecHit_CSCSegment_h diff --git a/DataFormats/CSCRecHit/interface/CSCSegmentCollection.h b/DataFormats/CSCRecHit/interface/CSCSegmentCollection.h index 52745ecf67853..50f461ad4514b 100644 --- a/DataFormats/CSCRecHit/interface/CSCSegmentCollection.h +++ b/DataFormats/CSCRecHit/interface/CSCSegmentCollection.h @@ -8,17 +8,15 @@ * \author Matteo Sani */ -#include -#include +#include "DataFormats/MuonDetId/interface/CSCDetId.h" +#include "DataFormats/CSCRecHit/interface/CSCSegment.h" -#include -#include -#include +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap > CSCSegmentCollection; +using CSCSegmentCollection = edm::IdToHitRange; -#include -typedef edm::Ref CSCSegmentRef; +#include "DataFormats/Common/interface/Ref.h" +using CSCSegmentRef = edm::Ref; //typedef std::vector CSCSegmentCollection; diff --git a/DataFormats/CSCRecHit/src/CSCRecHit2D.cc b/DataFormats/CSCRecHit/src/CSCRecHit2D.cc index 2e91b32889bd0..855bdb4a6934f 100644 --- a/DataFormats/CSCRecHit/src/CSCRecHit2D.cc +++ b/DataFormats/CSCRecHit/src/CSCRecHit2D.cc @@ -1,224 +1,228 @@ #include #include -CSCRecHit2D::CSCRecHit2D() - : theTpeak(-999.), - thePositionWithinStrip(-999.), - theErrorWithinStrip(-999.), - theEnergyDeposit(-994.), - theQuality(0), - theScaledWireTime(0), - theBadStrip(0), - theBadWireGroup(0), - nStrips_(0), - nWireGroups_(0), - nTimeBins_(0), - theLocalPosition(0., 0.), - theLocalError(0., 0., 0.) { - for (unsigned int i = 0; i < MAXSTRIPS; i++) - theStrips_[i] = 0; - for (unsigned int i = 0; i < MAXSTRIPS; i++) - for (unsigned int j = 0; j < MAXTIMEBINS; j++) - theADCs_[i * MAXTIMEBINS + j] = 0; -} - -CSCRecHit2D::CSCRecHit2D(const CSCDetId& id, - const LocalPoint& pos, - const LocalError& err, - const ChannelContainer& channels, - const ADCContainer& adcs, - const ChannelContainer& wgroups, - float tpeak, - float posInStrip, - float errInStrip, - int quality, - short int badStrip, - short int badWireGroup, - int scaledWireTime, - float energyDeposit) - : RecHit2DLocalPos(id), - theTpeak(tpeak), - thePositionWithinStrip(posInStrip), - theErrorWithinStrip(errInStrip), - theEnergyDeposit(energyDeposit), - theQuality(quality), - theScaledWireTime(scaledWireTime), - theBadStrip(badStrip), - theBadWireGroup(badWireGroup), - theLocalPosition(pos), - theLocalError(err) { - nStrips_ = channels.size(); - nWireGroups_ = wgroups.size(); - - if (nStrips_ > MAXSTRIPS) { - std::cout << "CSCRecHit2D: not enough strips in DataFormat! " << unsigned(nStrips_) << std::endl; - nStrips_ = MAXSTRIPS; +namespace io_v1 { + + CSCRecHit2D::CSCRecHit2D() + : theTpeak(-999.), + thePositionWithinStrip(-999.), + theErrorWithinStrip(-999.), + theEnergyDeposit(-994.), + theQuality(0), + theScaledWireTime(0), + theBadStrip(0), + theBadWireGroup(0), + nStrips_(0), + nWireGroups_(0), + nTimeBins_(0), + theLocalPosition(0., 0.), + theLocalError(0., 0., 0.) { + for (unsigned int i = 0; i < MAXSTRIPS; i++) + theStrips_[i] = 0; + for (unsigned int i = 0; i < MAXSTRIPS; i++) + for (unsigned int j = 0; j < MAXTIMEBINS; j++) + theADCs_[i * MAXTIMEBINS + j] = 0; } - for (unsigned int i = 0; i < MAXSTRIPS; i++) - theStrips_[i] = 0; - for (unsigned int i = 0; i < MAXSTRIPS; i++) - theL1APhaseBits_[i] = 0; - for (unsigned int i = 0; i < MAXSTRIPS; i++) - for (unsigned int j = 0; j < MAXTIMEBINS; j++) - theADCs_[i * MAXTIMEBINS + j] = 0; - - for (unsigned int i = 0; i < nStrips_; i++) { - theStrips_[i] = channels[i] & 0x000000FF; - theL1APhaseBits_[i] = channels[i] & 0x0000FF00; - } - if (nWireGroups_ > 0) { - //take only the low bits - hitWire_ = wgroups[nWireGroups_ / 2] & 0x0000FFFF; - theWGroupsBX_ = (wgroups[nWireGroups_ / 2] >> 16) & 0x0000FFFF; - } else { - hitWire_ = 0; - theWGroupsBX_ = 0; - } - ADCContainer tmp(adcs); //must be a bug in RangeMap!!!??? - nTimeBins_ = tmp.size() / nStrips_; - unsigned int k = 0; - for (unsigned int i = 0; i < nStrips_; i++) - for (unsigned int j = 0; j < nTimeBins_; j++) { - theADCs_[i * MAXTIMEBINS + j] = tmp[k]; - k++; + CSCRecHit2D::CSCRecHit2D(const CSCDetId& id, + const LocalPoint& pos, + const LocalError& err, + const ChannelContainer& channels, + const ADCContainer& adcs, + const ChannelContainer& wgroups, + float tpeak, + float posInStrip, + float errInStrip, + int quality, + short int badStrip, + short int badWireGroup, + int scaledWireTime, + float energyDeposit) + : RecHit2DLocalPos(id), + theTpeak(tpeak), + thePositionWithinStrip(posInStrip), + theErrorWithinStrip(errInStrip), + theEnergyDeposit(energyDeposit), + theQuality(quality), + theScaledWireTime(scaledWireTime), + theBadStrip(badStrip), + theBadWireGroup(badWireGroup), + theLocalPosition(pos), + theLocalError(err) { + nStrips_ = channels.size(); + nWireGroups_ = wgroups.size(); + + if (nStrips_ > MAXSTRIPS) { + std::cout << "CSCRecHit2D: not enough strips in DataFormat! " << unsigned(nStrips_) << std::endl; + nStrips_ = MAXSTRIPS; } -} -CSCRecHit2D::~CSCRecHit2D() {} + for (unsigned int i = 0; i < MAXSTRIPS; i++) + theStrips_[i] = 0; + for (unsigned int i = 0; i < MAXSTRIPS; i++) + theL1APhaseBits_[i] = 0; + for (unsigned int i = 0; i < MAXSTRIPS; i++) + for (unsigned int j = 0; j < MAXTIMEBINS; j++) + theADCs_[i * MAXTIMEBINS + j] = 0; + + for (unsigned int i = 0; i < nStrips_; i++) { + theStrips_[i] = channels[i] & 0x000000FF; + theL1APhaseBits_[i] = channels[i] & 0x0000FF00; + } + if (nWireGroups_ > 0) { + //take only the low bits + hitWire_ = wgroups[nWireGroups_ / 2] & 0x0000FFFF; + theWGroupsBX_ = (wgroups[nWireGroups_ / 2] >> 16) & 0x0000FFFF; + } else { + hitWire_ = 0; + theWGroupsBX_ = 0; + } + ADCContainer tmp(adcs); //must be a bug in RangeMap!!!??? + nTimeBins_ = tmp.size() / nStrips_; + unsigned int k = 0; + for (unsigned int i = 0; i < nStrips_; i++) + for (unsigned int j = 0; j < nTimeBins_; j++) { + theADCs_[i * MAXTIMEBINS + j] = tmp[k]; + k++; + } + } -bool CSCRecHit2D::sharesInput(const TrackingRecHit* other, TrackingRecHit::SharedInputType what) const { - // This is to satisfy the base class virtual function + CSCRecHit2D::~CSCRecHit2D() {} - // @@ Cast the enum (!) But what if the TRH::SIT changes?! - CSCRecHit2D::SharedInputType cscWhat = static_cast(what); - return sharesInput(other, cscWhat); -} + bool CSCRecHit2D::sharesInput(const TrackingRecHit* other, TrackingRecHit::SharedInputType what) const { + // This is to satisfy the base class virtual function -bool CSCRecHit2D::sharesInput(const TrackingRecHit* other, CSCRecHit2D::SharedInputType what) const { - // Check to see if the TrackingRecHit is actually a CSCRecHit2D. - if (other->geographicalId().subdetId() != MuonSubdetId::CSC) - return false; + // @@ Cast the enum (!) But what if the TRH::SIT changes?! + CSCRecHit2D::SharedInputType cscWhat = static_cast(what); + return sharesInput(other, cscWhat); + } - // Now I can static cast, because the previous guarantees that this is a CSCRecHit2D - const CSCRecHit2D* otherRecHit = static_cast(other); + bool CSCRecHit2D::sharesInput(const TrackingRecHit* other, CSCRecHit2D::SharedInputType what) const { + // Check to see if the TrackingRecHit is actually a CSCRecHit2D. + if (other->geographicalId().subdetId() != MuonSubdetId::CSC) + return false; - return sharesInput(otherRecHit, what); -} + // Now I can static cast, because the previous guarantees that this is a CSCRecHit2D + const CSCRecHit2D* otherRecHit = static_cast(other); -bool CSCRecHit2D::sharesInput(const CSCRecHit2D* otherRecHit, CSCRecHit2D::SharedInputType what) const { - // Check to see if the geographical ID of the two are the same - if (geographicalId() != otherRecHit->geographicalId()) - return false; + return sharesInput(otherRecHit, what); + } - // Trivial cases - if (nStrips() == 0 && otherRecHit->nStrips() == 0 && nWireGroups() == 0 && otherRecHit->nWireGroups() == 0) - return true; - if ((what == allWires || what == someWires) && nWireGroups() == 0 && otherRecHit->nWireGroups() == 0) - return true; - if ((what == allStrips || what == someStrips) && nStrips() == 0 && otherRecHit->nStrips() == 0) - return true; + bool CSCRecHit2D::sharesInput(const CSCRecHit2D* otherRecHit, CSCRecHit2D::SharedInputType what) const { + // Check to see if the geographical ID of the two are the same + if (geographicalId() != otherRecHit->geographicalId()) + return false; - // Check to see if the wire containers are the same length - if ((what == all || what == allWires) && nWireGroups() != otherRecHit->nWireGroups()) - return false; + // Trivial cases + if (nStrips() == 0 && otherRecHit->nStrips() == 0 && nWireGroups() == 0 && otherRecHit->nWireGroups() == 0) + return true; + if ((what == allWires || what == someWires) && nWireGroups() == 0 && otherRecHit->nWireGroups() == 0) + return true; + if ((what == allStrips || what == someStrips) && nStrips() == 0 && otherRecHit->nStrips() == 0) + return true; - // Check to see if the strip containers are the same length - if ((what == all || what == allStrips) && nStrips() != otherRecHit->nStrips()) - return false; + // Check to see if the wire containers are the same length + if ((what == all || what == allWires) && nWireGroups() != otherRecHit->nWireGroups()) + return false; - bool foundWire = false; - // Check to see if the wires are the same - if (what != allStrips && what != someStrips) { - //can we do better here? - if (hitWire() != otherRecHit->hitWire()) + // Check to see if the strip containers are the same length + if ((what == all || what == allStrips) && nStrips() != otherRecHit->nStrips()) return false; - } - // Check to see if the wires are the same - bool foundStrip = false; - if (what != allWires && what != someWires) { - for (unsigned int i = 0; i < nStrips(); i++) { - bool found = false; - for (unsigned int j = 0; j < nStrips(); j++) { - //a strip is a channel for all but ME1/1a chambers (where 3 ganged strips are a channel) - if (cscDetId().channel(channels(i)) == otherRecHit->cscDetId().channel(otherRecHit->channels(j))) { - if (what == some || what == someStrips) - return true; - else { - found = true; - foundStrip = true; - break; + bool foundWire = false; + // Check to see if the wires are the same + if (what != allStrips && what != someStrips) { + //can we do better here? + if (hitWire() != otherRecHit->hitWire()) + return false; + } + + // Check to see if the wires are the same + bool foundStrip = false; + if (what != allWires && what != someWires) { + for (unsigned int i = 0; i < nStrips(); i++) { + bool found = false; + for (unsigned int j = 0; j < nStrips(); j++) { + //a strip is a channel for all but ME1/1a chambers (where 3 ganged strips are a channel) + if (cscDetId().channel(channels(i)) == otherRecHit->cscDetId().channel(otherRecHit->channels(j))) { + if (what == some || what == someStrips) + return true; + else { + found = true; + foundStrip = true; + break; + } } } + if ((what == all || what == allStrips) && !found) + return false; } - if ((what == all || what == allStrips) && !found) + if (what == someStrips && !foundStrip) return false; } - if (what == someStrips && !foundStrip) + + // In case we were looking for "some" and found absolutely nothing. + if (!foundWire && !foundStrip) return false; - } - // In case we were looking for "some" and found absolutely nothing. - if (!foundWire && !foundStrip) - return false; - - // If we made it this far, then: - // 1) the detector IDs are the same - // 2) the channel containers have the same number of entries - // 3) for each entry in my channel container, I can find the same value in the other RecHit's corresponding channel container - // I think that means we are the same. - return true; -} - -void CSCRecHit2D::print() const { - std::cout << "CSCRecHit in CSC Detector: " << cscDetId() << std::endl; - std::cout << " local x = " << localPosition().x() << " +/- " << sqrt(localPositionError().xx()) - << " y = " << localPosition().y() << " +/- " << sqrt(localPositionError().yy()) << std::endl; - - std::cout << " tpeak " << theTpeak << " psoInStrip " << thePositionWithinStrip << " errorinstrip " - << theErrorWithinStrip << " " - << " qual " << theQuality << " wiretime " << theScaledWireTime << " tbs " << theBadStrip << " bwg " - << theBadWireGroup << std::endl; - - std::cout << " Channels: "; - for (unsigned int i = 0; i < nStrips(); i++) { - std::cout << std::dec << channels(i) << " " - << " (" - << "HEX: " << std::hex << channels(i) << ")" - << " "; + // If we made it this far, then: + // 1) the detector IDs are the same + // 2) the channel containers have the same number of entries + // 3) for each entry in my channel container, I can find the same value in the other RecHit's corresponding channel container + // I think that means we are the same. + return true; } - std::cout << std::endl; - - /// L1A - std::cout << " L1APhase: "; - for (int i = 0; i < (int)nStrips(); i++) { - std::cout << "|"; - for (int k = 0; k < 8; k++) { - std::cout << ((channelsl1a(i) >> (15 - k)) & 0x1) << " "; + + void CSCRecHit2D::print() const { + std::cout << "CSCRecHit in CSC Detector: " << cscDetId() << std::endl; + std::cout << " local x = " << localPosition().x() << " +/- " << sqrt(localPositionError().xx()) + << " y = " << localPosition().y() << " +/- " << sqrt(localPositionError().yy()) << std::endl; + + std::cout << " tpeak " << theTpeak << " psoInStrip " << thePositionWithinStrip << " errorinstrip " + << theErrorWithinStrip << " " + << " qual " << theQuality << " wiretime " << theScaledWireTime << " tbs " << theBadStrip << " bwg " + << theBadWireGroup << std::endl; + + std::cout << " Channels: "; + for (unsigned int i = 0; i < nStrips(); i++) { + std::cout << std::dec << channels(i) << " " + << " (" + << "HEX: " << std::hex << channels(i) << ")" + << " "; } - std::cout << "| "; - } - std::cout << std::endl; - - std::cout << "nWireGroups " << (int)nWireGroups() << " central wire " << hitWire_ << std::endl; -} - -std::ostream& operator<<(std::ostream& os, const CSCRecHit2D& rh) { - os << "CSCRecHit2D: " - << "local x: " << rh.localPosition().x() << " +/- " << sqrt(rh.localPositionError().xx()) - << " y: " << rh.localPosition().y() << " +/- " << sqrt(rh.localPositionError().yy()) - << " in strip X: " << rh.positionWithinStrip() << " +/- " << rh.errorWithinStrip() << " quality: " << rh.quality() - << " tpeak: " << rh.tpeak() << " wireTime: " << rh.wireTime() << std::endl; - os << "strips: "; - for (size_t iS = 0; iS < rh.nStrips(); ++iS) { - os << rh.channels(iS) << " "; + std::cout << std::endl; + + /// L1A + std::cout << " L1APhase: "; + for (int i = 0; i < (int)nStrips(); i++) { + std::cout << "|"; + for (int k = 0; k < 8; k++) { + std::cout << ((channelsl1a(i) >> (15 - k)) & 0x1) << " "; + } + std::cout << "| "; + } + std::cout << std::endl; + + std::cout << "nWireGroups " << (int)nWireGroups() << " central wire " << hitWire_ << std::endl; } - int nwgs = rh.nWireGroups(); - if (nwgs == 1) { - os << "central wire: " << rh.hitWire() << " of " << nwgs << " wiregroup" << std::endl; - } else { - os << "central wire: " << rh.hitWire() << " of " << nwgs << " wiregroups" << std::endl; + + std::ostream& operator<<(std::ostream& os, const CSCRecHit2D& rh) { + os << "CSCRecHit2D: " + << "local x: " << rh.localPosition().x() << " +/- " << sqrt(rh.localPositionError().xx()) + << " y: " << rh.localPosition().y() << " +/- " << sqrt(rh.localPositionError().yy()) + << " in strip X: " << rh.positionWithinStrip() << " +/- " << rh.errorWithinStrip() + << " quality: " << rh.quality() << " tpeak: " << rh.tpeak() << " wireTime: " << rh.wireTime() << std::endl; + os << "strips: "; + for (size_t iS = 0; iS < rh.nStrips(); ++iS) { + os << rh.channels(iS) << " "; + } + int nwgs = rh.nWireGroups(); + if (nwgs == 1) { + os << "central wire: " << rh.hitWire() << " of " << nwgs << " wiregroup" << std::endl; + } else { + os << "central wire: " << rh.hitWire() << " of " << nwgs << " wiregroups" << std::endl; + } + return os; } - return os; -} + +} // namespace io_v1 diff --git a/DataFormats/CSCRecHit/src/CSCSegment.cc b/DataFormats/CSCRecHit/src/CSCSegment.cc index edb8d0abe4ef3..2e2cdc52966cd 100644 --- a/DataFormats/CSCRecHit/src/CSCSegment.cc +++ b/DataFormats/CSCRecHit/src/CSCSegment.cc @@ -6,187 +6,191 @@ #include #include -namespace { - // Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id - inline DetId buildDetId(CSCDetId id) { return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0); } - -} // namespace - -CSCSegment::CSCSegment(const std::vector& proto_segment, - LocalPoint origin, - LocalVector direction, - const AlgebraicSymMatrix& errors, - double chi2) - : RecSegment(buildDetId(proto_segment.front()->cscDetId())), - theOrigin(origin), - theLocalDirection(direction), - theCovMatrix(errors), - theChi2(chi2), - aME11a_duplicate(false) { - for (unsigned int i = 0; i < proto_segment.size(); ++i) - theCSCRecHits.push_back(*proto_segment[i]); -} - -CSCSegment::~CSCSegment() {} - -std::vector CSCSegment::recHits() const { - std::vector pointersOfRecHits; - for (std::vector::const_iterator irh = theCSCRecHits.begin(); irh != theCSCRecHits.end(); ++irh) { - pointersOfRecHits.push_back(&(*irh)); +namespace io_v1 { + + namespace { + // Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id + inline DetId buildDetId(CSCDetId id) { return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0); } + + } // namespace + + CSCSegment::CSCSegment(const std::vector& proto_segment, + LocalPoint origin, + LocalVector direction, + const AlgebraicSymMatrix& errors, + double chi2) + : RecSegment(buildDetId(proto_segment.front()->cscDetId())), + theOrigin(origin), + theLocalDirection(direction), + theCovMatrix(errors), + theChi2(chi2), + aME11a_duplicate(false) { + for (unsigned int i = 0; i < proto_segment.size(); ++i) + theCSCRecHits.push_back(*proto_segment[i]); } - return pointersOfRecHits; -} -std::vector CSCSegment::recHits() { - std::vector pointersOfRecHits; - for (std::vector::iterator irh = theCSCRecHits.begin(); irh != theCSCRecHits.end(); ++irh) { - pointersOfRecHits.push_back(&(*irh)); + CSCSegment::~CSCSegment() {} + + std::vector CSCSegment::recHits() const { + std::vector pointersOfRecHits; + for (std::vector::const_iterator irh = theCSCRecHits.begin(); irh != theCSCRecHits.end(); ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + return pointersOfRecHits; + } + + std::vector CSCSegment::recHits() { + std::vector pointersOfRecHits; + for (std::vector::iterator irh = theCSCRecHits.begin(); irh != theCSCRecHits.end(); ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + return pointersOfRecHits; } - return pointersOfRecHits; -} - -LocalError CSCSegment::localPositionError() const { - return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); -} - -LocalError CSCSegment::localDirectionError() const { - return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); -} - -AlgebraicVector CSCSegment::parameters() const { - // For consistency with DT and what we require for the TrackingRecHit interface, - // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) - - AlgebraicVector result(4); - - result[0] = theLocalDirection.x() / theLocalDirection.z(); - result[1] = theLocalDirection.y() / theLocalDirection.z(); - result[2] = theOrigin.x(); - result[3] = theOrigin.y(); - - return result; -} - -AlgebraicMatrix createStaticMatrix() { - AlgebraicMatrix m(4, 5, 0); - m[0][1] = 1; - m[1][2] = 1; - m[2][3] = 1; - m[3][4] = 1; - return m; -} - -static const AlgebraicMatrix theProjectionMatrix = createStaticMatrix(); - -AlgebraicMatrix CSCSegment::projectionMatrix() const { return theProjectionMatrix; } - -void CSCSegment::setDuplicateSegments(std::vector& duplicates) { - theDuplicateSegments.clear(); - for (unsigned int i = 0; i < duplicates.size(); ++i) { - theDuplicateSegments.push_back(*duplicates[i]); - //avoid copying duplicates of duplicates of duplicates... - theDuplicateSegments.back().theDuplicateSegments.resize(0); + + LocalError CSCSegment::localPositionError() const { + return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); } -} - -bool CSCSegment::testSharesAllInSpecificRecHits(const std::vector& specificRecHits_1, - const std::vector& specificRecHits_2, - CSCRecHit2D::SharedInputType sharesInput) const { - const std::vector* rhContainer_1 = &specificRecHits_1; - const std::vector* rhContainer_2 = &specificRecHits_2; - if (specificRecHits_1.size() > specificRecHits_2.size()) { - rhContainer_2 = &specificRecHits_1; - rhContainer_1 = &specificRecHits_2; + + LocalError CSCSegment::localDirectionError() const { + return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); } - // - bool shareConditionPassed = true; - for (std::vector::const_iterator itRH = rhContainer_1->begin(); itRH != rhContainer_1->end(); ++itRH) { - const CSCRecHit2D* firstRecHit = &(*itRH); - bool sharedHit = false; - for (std::vector::const_iterator itRH2 = rhContainer_2->begin(); itRH2 != rhContainer_2->end(); - ++itRH2) { - if (itRH2->sharesInput(firstRecHit, sharesInput)) { - sharedHit = true; + + AlgebraicVector CSCSegment::parameters() const { + // For consistency with DT and what we require for the TrackingRecHit interface, + // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) + + AlgebraicVector result(4); + + result[0] = theLocalDirection.x() / theLocalDirection.z(); + result[1] = theLocalDirection.y() / theLocalDirection.z(); + result[2] = theOrigin.x(); + result[3] = theOrigin.y(); + + return result; + } + + AlgebraicMatrix createStaticMatrix() { + AlgebraicMatrix m(4, 5, 0); + m[0][1] = 1; + m[1][2] = 1; + m[2][3] = 1; + m[3][4] = 1; + return m; + } + + static const AlgebraicMatrix theProjectionMatrix = createStaticMatrix(); + + AlgebraicMatrix CSCSegment::projectionMatrix() const { return theProjectionMatrix; } + + void CSCSegment::setDuplicateSegments(std::vector& duplicates) { + theDuplicateSegments.clear(); + for (unsigned int i = 0; i < duplicates.size(); ++i) { + theDuplicateSegments.push_back(*duplicates[i]); + //avoid copying duplicates of duplicates of duplicates... + theDuplicateSegments.back().theDuplicateSegments.resize(0); + } + } + + bool CSCSegment::testSharesAllInSpecificRecHits(const std::vector& specificRecHits_1, + const std::vector& specificRecHits_2, + CSCRecHit2D::SharedInputType sharesInput) const { + const std::vector* rhContainer_1 = &specificRecHits_1; + const std::vector* rhContainer_2 = &specificRecHits_2; + if (specificRecHits_1.size() > specificRecHits_2.size()) { + rhContainer_2 = &specificRecHits_1; + rhContainer_1 = &specificRecHits_2; + } + // + bool shareConditionPassed = true; + for (std::vector::const_iterator itRH = rhContainer_1->begin(); itRH != rhContainer_1->end(); ++itRH) { + const CSCRecHit2D* firstRecHit = &(*itRH); + bool sharedHit = false; + for (std::vector::const_iterator itRH2 = rhContainer_2->begin(); itRH2 != rhContainer_2->end(); + ++itRH2) { + if (itRH2->sharesInput(firstRecHit, sharesInput)) { + sharedHit = true; + break; + } + } + if (!sharedHit) { + shareConditionPassed = false; break; } } - if (!sharedHit) { - shareConditionPassed = false; - break; - } + return shareConditionPassed; } - return shareConditionPassed; -} - -//bool CSCSegment::sharesRecHits(CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType sharesInput){ -// 2 tracks through a chamber leave 4 rechits per layer (2 strips x 2 wire groups) -// this function finds segments sharing wires or strips (first the rechits by sharesInput() ) -// there could probably be more complicated cases with partial sharing (but this needs studies) -// -//return testSharesAllInSpecificRecHits( theCSCRecHits , anotherSegment.specificRecHits(), sharesInput); -//} - -bool CSCSegment::sharesRecHits(const CSCSegment& anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const { - return testSharesAllInSpecificRecHits(theCSCRecHits, anotherSegment.specificRecHits(), sharesInput); -} - -// -bool CSCSegment::sharesRecHits(const CSCSegment& anotherSegment) const { - if (testSharesAllInSpecificRecHits(theCSCRecHits, anotherSegment.specificRecHits(), CSCRecHit2D::someWires) && - testSharesAllInSpecificRecHits(theCSCRecHits, anotherSegment.specificRecHits(), CSCRecHit2D::someStrips)) { - return true; - } else { - return false; + + //bool CSCSegment::sharesRecHits(CSCSegment & anotherSegment, CSCRecHit2D::SharedInputType sharesInput){ + // 2 tracks through a chamber leave 4 rechits per layer (2 strips x 2 wire groups) + // this function finds segments sharing wires or strips (first the rechits by sharesInput() ) + // there could probably be more complicated cases with partial sharing (but this needs studies) + // + //return testSharesAllInSpecificRecHits( theCSCRecHits , anotherSegment.specificRecHits(), sharesInput); + //} + + bool CSCSegment::sharesRecHits(const CSCSegment& anotherSegment, CSCRecHit2D::SharedInputType sharesInput) const { + return testSharesAllInSpecificRecHits(theCSCRecHits, anotherSegment.specificRecHits(), sharesInput); } -} -// - -float CSCSegment::time() const { - float averageTime = 0; - std::vector wireTimes; - for (std::vector::const_iterator itRH = theCSCRecHits.begin(); itRH != theCSCRecHits.end(); ++itRH) { - const CSCRecHit2D* recHit = &(*itRH); - averageTime += recHit->tpeak(); - averageTime += recHit->wireTime(); - wireTimes.push_back(recHit->wireTime()); + + // + bool CSCSegment::sharesRecHits(const CSCSegment& anotherSegment) const { + if (testSharesAllInSpecificRecHits(theCSCRecHits, anotherSegment.specificRecHits(), CSCRecHit2D::someWires) && + testSharesAllInSpecificRecHits(theCSCRecHits, anotherSegment.specificRecHits(), CSCRecHit2D::someStrips)) { + return true; + } else { + return false; + } } - averageTime = averageTime / (2 * theCSCRecHits.size()); - - //The wire times have a long tail that has to be pruned. The strip times (tpeak) are fine - bool modified = true; - while (modified) { - modified = false; - double maxDiff = -1; - std::vector::iterator maxHit; - for (std::vector::iterator itWT = wireTimes.begin(); itWT != wireTimes.end(); ++itWT) { - float diff = fabs(*itWT - averageTime); - if (diff > maxDiff) { - maxDiff = diff; - maxHit = itWT; - } + // + + float CSCSegment::time() const { + float averageTime = 0; + std::vector wireTimes; + for (std::vector::const_iterator itRH = theCSCRecHits.begin(); itRH != theCSCRecHits.end(); ++itRH) { + const CSCRecHit2D* recHit = &(*itRH); + averageTime += recHit->tpeak(); + averageTime += recHit->wireTime(); + wireTimes.push_back(recHit->wireTime()); } - if (maxDiff > 26) { - int N = theCSCRecHits.size() + wireTimes.size(); - averageTime = (averageTime * N - (*maxHit)) / (N - 1); - wireTimes.erase(maxHit); - modified = true; + averageTime = averageTime / (2 * theCSCRecHits.size()); + + //The wire times have a long tail that has to be pruned. The strip times (tpeak) are fine + bool modified = true; + while (modified) { + modified = false; + double maxDiff = -1; + std::vector::iterator maxHit; + for (std::vector::iterator itWT = wireTimes.begin(); itWT != wireTimes.end(); ++itWT) { + float diff = fabs(*itWT - averageTime); + if (diff > maxDiff) { + maxDiff = diff; + maxHit = itWT; + } + } + if (maxDiff > 26) { + int N = theCSCRecHits.size() + wireTimes.size(); + averageTime = (averageTime * N - (*maxHit)) / (N - 1); + wireTimes.erase(maxHit); + modified = true; + } } + return averageTime; } - return averageTime; -} - -// -void CSCSegment::print() const { std::cout << *this << std::endl; } - -std::ostream& operator<<(std::ostream& os, const CSCSegment& seg) { - os << "CSCSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) << "," - << sqrt(seg.localPositionError().yy()) << "0,)\n" - << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << "," - << sqrt(seg.localDirectionError().yy()) << "0,)\n" - << " chi2/ndf = " << seg.chi2() / double(seg.degreesOfFreedom()) - << " #rechits = " << seg.specificRecHits().size() << " ME1/1a duplicates : " << seg.duplicateSegments().size(); - return os; -} + + // + void CSCSegment::print() const { std::cout << *this << std::endl; } + + std::ostream& operator<<(std::ostream& os, const CSCSegment& seg) { + os << "CSCSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) + << "," << sqrt(seg.localPositionError().yy()) << "0,)\n" + << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << "," + << sqrt(seg.localDirectionError().yy()) << "0,)\n" + << " chi2/ndf = " << seg.chi2() / double(seg.degreesOfFreedom()) + << " #rechits = " << seg.specificRecHits().size() << " ME1/1a duplicates : " << seg.duplicateSegments().size(); + return os; + } + +} // namespace io_v1 /* const CSCChamber* CSCSegment::chamber() const { return theChamber; } diff --git a/DataFormats/CSCRecHit/src/classes_def.xml b/DataFormats/CSCRecHit/src/classes_def.xml index 7a91c2b3a6bad..24474c3522129 100644 --- a/DataFormats/CSCRecHit/src/classes_def.xml +++ b/DataFormats/CSCRecHit/src/classes_def.xml @@ -1,43 +1,42 @@ - - - - - - + + - - + + - - - - - - - - - - + + + + + + + + + + + - - - - - + + + + + + + - + - + diff --git a/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h b/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h index ae554c5ec6105..23ea39c082535 100644 --- a/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h +++ b/DataFormats/CTPPSDigi/interface/CTPPSDiamondDigi.h @@ -13,76 +13,80 @@ #include #include "DataFormats/CTPPSDigi/interface/HPTDCErrorFlags.h" -class CTPPSDiamondDigi { -public: - CTPPSDiamondDigi( - unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_); - CTPPSDiamondDigi(); - ~CTPPSDiamondDigi() {} - - /// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags - bool operator==(const CTPPSDiamondDigi& digi) const; - - /// Return digi values number - - unsigned int leadingEdge() const { return ledgt; } - - unsigned int trailingEdge() const { return tedgt; } - - unsigned int thresholdVoltage() const { return threvolt; } - - bool multipleHit() const { return mhit; } - - HPTDCErrorFlags hptdcErrorFlags() const { return hptdcerror; } - - /// Set digi values - inline void setLeadingEdge(unsigned int ledgt_) { ledgt = ledgt_; } - inline void setTrailingEdge(unsigned int tedgt_) { tedgt = tedgt_; } - inline void setThresholdVoltage(unsigned int threvolt_) { threvolt = threvolt_; } - inline void setMultipleHit(bool mhit_) { mhit = mhit_; } - inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) { hptdcerror = hptdcerror_; } - -private: - // variable represents leading edge time - unsigned int ledgt; - // variable represents trailing edge time - unsigned int tedgt; - // variable represents threshold voltage - unsigned int threvolt; - // variable represents multi-hit - bool mhit; - HPTDCErrorFlags hptdcerror; -}; +namespace io_v1 { + class CTPPSDiamondDigi { + public: + CTPPSDiamondDigi( + unsigned int ledgt_, unsigned int tedgt_, unsigned int threvolt, bool mhit_, unsigned short hptdcerror_); + CTPPSDiamondDigi(); + ~CTPPSDiamondDigi() {} + + /// Digis are equal if they are have same ledt and tedt, threshold voltage, multihit flag, hptdcerror flags + bool operator==(const CTPPSDiamondDigi& digi) const; + + /// Return digi values number + + unsigned int leadingEdge() const { return ledgt; } + + unsigned int trailingEdge() const { return tedgt; } + + unsigned int thresholdVoltage() const { return threvolt; } + + bool multipleHit() const { return mhit; } + + HPTDCErrorFlags hptdcErrorFlags() const { return hptdcerror; } + + /// Set digi values + inline void setLeadingEdge(unsigned int ledgt_) { ledgt = ledgt_; } + inline void setTrailingEdge(unsigned int tedgt_) { tedgt = tedgt_; } + inline void setThresholdVoltage(unsigned int threvolt_) { threvolt = threvolt_; } + inline void setMultipleHit(bool mhit_) { mhit = mhit_; } + inline void setHPTDCErrorFlags(const HPTDCErrorFlags& hptdcerror_) { hptdcerror = hptdcerror_; } + + private: + // variable represents leading edge time + unsigned int ledgt; + // variable represents trailing edge time + unsigned int tedgt; + // variable represents threshold voltage + unsigned int threvolt; + // variable represents multi-hit + bool mhit; + HPTDCErrorFlags hptdcerror; + }; +} // namespace io_v1 +using CTPPSDiamondDigi = io_v1::CTPPSDiamondDigi; #include -inline bool operator<(const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other) { - if (one.leadingEdge() < other.leadingEdge()) - return true; - if (one.leadingEdge() > other.leadingEdge()) - return false; - if (one.trailingEdge() < other.trailingEdge()) - return true; - if (one.trailingEdge() > other.trailingEdge()) - return false; - if (one.multipleHit() < other.multipleHit()) - return true; - if (one.multipleHit() > other.multipleHit()) +namespace io_v1 { + inline bool operator<(const CTPPSDiamondDigi& one, const CTPPSDiamondDigi& other) { + if (one.leadingEdge() < other.leadingEdge()) + return true; + if (one.leadingEdge() > other.leadingEdge()) + return false; + if (one.trailingEdge() < other.trailingEdge()) + return true; + if (one.trailingEdge() > other.trailingEdge()) + return false; + if (one.multipleHit() < other.multipleHit()) + return true; + if (one.multipleHit() > other.multipleHit()) + return false; + if (one.hptdcErrorFlags().errorFlag() < other.hptdcErrorFlags().errorFlag()) + return true; + if (one.hptdcErrorFlags().errorFlag() > other.hptdcErrorFlags().errorFlag()) + return false; + if (one.thresholdVoltage() < other.thresholdVoltage()) + return true; + if (one.thresholdVoltage() > other.thresholdVoltage()) + return false; return false; - if (one.hptdcErrorFlags().errorFlag() < other.hptdcErrorFlags().errorFlag()) - return true; - if (one.hptdcErrorFlags().errorFlag() > other.hptdcErrorFlags().errorFlag()) - return false; - if (one.thresholdVoltage() < other.thresholdVoltage()) - return true; - if (one.thresholdVoltage() > other.thresholdVoltage()) - return false; - return false; -} - -inline std::ostream& operator<<(std::ostream& o, const CTPPSDiamondDigi& digi) { - return o << " " << digi.leadingEdge() << " " << digi.trailingEdge() << " " << digi.thresholdVoltage() << " " - << digi.multipleHit() << " " << digi.hptdcErrorFlags().errorFlag(); -} + } + inline std::ostream& operator<<(std::ostream& o, const CTPPSDiamondDigi& digi) { + return o << " " << digi.leadingEdge() << " " << digi.trailingEdge() << " " << digi.thresholdVoltage() << " " + << digi.multipleHit() << " " << digi.hptdcErrorFlags().errorFlag(); + } +} // namespace io_v1 #endif diff --git a/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h b/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h index a0a2b0c7e3596..69d3514fc0a49 100644 --- a/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h +++ b/DataFormats/CTPPSDigi/interface/CTPPSPixelDataError.h @@ -15,44 +15,46 @@ #include #include -class CTPPSPixelDataError { -public: - /// Default constructor - CTPPSPixelDataError(); - /// Constructor for 32-bit error word - CTPPSPixelDataError(uint32_t errorWord32, const int errorType, int fedId); - /// Constructor with 64-bit error word and type included (header or trailer word) - CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId); - /// Destructor - ~CTPPSPixelDataError(); - - /// the 32-bit word that contains the error information - inline uint32_t errorWord32() const { return errorWord32_; } - /// the 64-bit word that contains the error information - inline uint64_t errorWord64() const { return errorWord64_; } - /// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors) - inline int errorType() const { return errorType_; } - /// the fedId where the error occured - inline int fedId() const { return fedId_; } - /// the error message to be displayed with the error - inline const std::string& errorMessage() const { - if (errorType_ >= 25 && errorType_ <= 37) - return errorMessages_[errorType_ - 24]; - return errorMessages_[0]; +namespace io_v1 { + class CTPPSPixelDataError { + public: + /// Default constructor + CTPPSPixelDataError(); + /// Constructor for 32-bit error word + CTPPSPixelDataError(uint32_t errorWord32, const int errorType, int fedId); + /// Constructor with 64-bit error word and type included (header or trailer word) + CTPPSPixelDataError(uint64_t errorWord64, const int errorType, int fedId); + /// Destructor + ~CTPPSPixelDataError(); + + /// the 32-bit word that contains the error information + inline uint32_t errorWord32() const { return errorWord32_; } + /// the 64-bit word that contains the error information + inline uint64_t errorWord64() const { return errorWord64_; } + /// the number associated with the error type (26-31 for ROC number errors, 32-33 for calibration errors) + inline int errorType() const { return errorType_; } + /// the fedId where the error occured + inline int fedId() const { return fedId_; } + /// the error message to be displayed with the error + inline const std::string& errorMessage() const { + if (errorType_ >= 25 && errorType_ <= 37) + return errorMessages_[errorType_ - 24]; + return errorMessages_[0]; + } + + private: + static const std::array errorMessages_; + + uint64_t errorWord64_; + uint32_t errorWord32_; + int errorType_; + int fedId_; + }; + + /// Comparison operators + inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) { + return one.fedId() < other.fedId(); } - -private: - static const std::array errorMessages_; - - uint64_t errorWord64_; - uint32_t errorWord32_; - int errorType_; - int fedId_; -}; - -/// Comparison operators -inline bool operator<(const CTPPSPixelDataError& one, const CTPPSPixelDataError& other) { - return one.fedId() < other.fedId(); -} - +} // namespace io_v1 +using CTPPSPixelDataError = io_v1::CTPPSPixelDataError; #endif diff --git a/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h b/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h index 43568708d8067..0190da94cccc6 100644 --- a/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h +++ b/DataFormats/CTPPSDigi/interface/CTPPSPixelDigi.h @@ -7,60 +7,65 @@ #include "FWCore/Utilities/interface/Exception.h" -class CTPPSPixelDigi { -public: - CTPPSPixelDigi(int packed_value) : theData(packed_value) {} +namespace io_v1 { + class CTPPSPixelDigi { + public: + CTPPSPixelDigi(int packed_value) : theData(packed_value) {} - CTPPSPixelDigi(int row, int col, int adc) { init(row, col, adc); } + CTPPSPixelDigi(int row, int col, int adc) { init(row, col, adc); } - CTPPSPixelDigi(int chan, int adc) { - std::pair rc = channelToPixel(chan); - init(rc.first, rc.second, adc); - } + CTPPSPixelDigi(int chan, int adc) { + std::pair rc = channelToPixel(chan); + init(rc.first, rc.second, adc); + } - CTPPSPixelDigi() : theData(0) {} + CTPPSPixelDigi() : theData(0) {} - /// Access to digi information - int row() const { return (theData >> row_shift) & row_mask; } - int column() const { return (theData >> column_shift) & column_mask; } - unsigned short adc() const { return (theData >> adc_shift) & adc_mask; } - uint32_t packedData() const { return theData; } + /// Access to digi information + int row() const { return (theData >> row_shift) & row_mask; } + int column() const { return (theData >> column_shift) & column_mask; } + unsigned short adc() const { return (theData >> adc_shift) & adc_mask; } + uint32_t packedData() const { return theData; } - static std::pair channelToPixel(int ch) { - int row = (ch >> column_width_ch) & row_mask_ch; - int col = ch & column_mask_ch; - return std::pair(row, col); - } + static std::pair channelToPixel(int ch) { + int row = (ch >> column_width_ch) & row_mask_ch; + int col = ch & column_mask_ch; + return std::pair(row, col); + } - static int pixelToChannel(int row, int col) { return (row << column_width_ch) | col; } + static int pixelToChannel(int row, int col) { return (row << column_width_ch) | col; } - int channel() const { return pixelToChannel(row(), column()); } + int channel() const { return pixelToChannel(row(), column()); } - /// const values for digi packing with bit structure: adc_bits+col_bits+row_bits - static const uint32_t row_shift, column_shift, adc_shift; - static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask; - static const uint32_t row_width, column_width, adc_width; - static const uint32_t max_row, max_column, max_adc; + /// const values for digi packing with bit structure: adc_bits+col_bits+row_bits + static const uint32_t row_shift, column_shift, adc_shift; + static const uint32_t row_mask, column_mask, adc_mask, rowcol_mask; + static const uint32_t row_width, column_width, adc_width; + static const uint32_t max_row, max_column, max_adc; - /// const values for channel definition with bit structure: row_bits+col_bits - static const uint32_t column_width_ch; - static const uint32_t column_mask_ch; - static const uint32_t row_mask_ch; + /// const values for channel definition with bit structure: row_bits+col_bits + static const uint32_t column_width_ch; + static const uint32_t column_mask_ch; + static const uint32_t row_mask_ch; -private: - void init(int row, int col, int adc); - uint32_t theData; -}; + private: + void init(int row, int col, int adc); + uint32_t theData; + }; -/// Comparison operator + /// Comparison operator -inline bool operator<(const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) { - return (one.packedData() & CTPPSPixelDigi::rowcol_mask) < (other.packedData() & CTPPSPixelDigi::rowcol_mask); -} + inline bool operator<(const CTPPSPixelDigi& one, const CTPPSPixelDigi& other) { + return (one.packedData() & CTPPSPixelDigi::rowcol_mask) < (other.packedData() & CTPPSPixelDigi::rowcol_mask); + } +} // namespace io_v1 +using CTPPSPixelDigi = io_v1::CTPPSPixelDigi; #include -inline std::ostream& operator<<(std::ostream& o, const CTPPSPixelDigi& digi) { - return o << " " << digi.row() << " " << digi.column() << " " << digi.adc(); -} +namespace io_v1 { + inline std::ostream& operator<<(std::ostream& o, const CTPPSPixelDigi& digi) { + return o << " " << digi.row() << " " << digi.column() << " " << digi.adc(); + } +} // namespace io_v1 #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h b/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h index 9a52a130ab510..a7c43c5e425f3 100644 --- a/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h +++ b/DataFormats/CTPPSDigi/interface/TotemFEDInfo.h @@ -14,37 +14,39 @@ /** * \brief OptoRx headers and footers. **/ -class TotemFEDInfo { -public: - TotemFEDInfo(int id = 0) : fedId_(id), header(0), orbitCounter_(0), footer(0) {} - - void setFEDId(int f) { fedId_ = f; } - int fedId() const { return fedId_; } - - void setHeader(uint64_t _h) { header = _h; } - uint8_t boe() const { return (header >> 60) & 0xF; } - uint32_t lv1() const { return (header >> 32) & 0xFFFFFF; } - uint16_t bx() const { return (header >> 20) & 0xFFF; } - uint16_t optoRxId() const { return (header >> 8) & 0xFFF; } - uint8_t fov() const { return (header >> 4) & 0xF; } - uint8_t h0() const { return (header >> 0) & 0xF; } - - void setOrbitCounter(uint32_t oc) { orbitCounter_ = oc; } - uint32_t orbitCounter() const { return orbitCounter_; } - - void setFooter(uint64_t _f) { footer = _f; } - uint8_t eoe() const { return (footer >> 60) & 0xF; } - uint16_t fSize() const { return (footer >> 32) & 0x3FF; } - uint8_t f0() const { return (footer >> 0) & 0xF; } - -private: - /// Id from FEDRawDataCollection. - int fedId_; - - /// Data from OptoRx headers and footer. - uint64_t header; - uint32_t orbitCounter_; - uint64_t footer; -}; - +namespace io_v1 { + class TotemFEDInfo { + public: + TotemFEDInfo(int id = 0) : fedId_(id), header(0), orbitCounter_(0), footer(0) {} + + void setFEDId(int f) { fedId_ = f; } + int fedId() const { return fedId_; } + + void setHeader(uint64_t _h) { header = _h; } + uint8_t boe() const { return (header >> 60) & 0xF; } + uint32_t lv1() const { return (header >> 32) & 0xFFFFFF; } + uint16_t bx() const { return (header >> 20) & 0xFFF; } + uint16_t optoRxId() const { return (header >> 8) & 0xFFF; } + uint8_t fov() const { return (header >> 4) & 0xF; } + uint8_t h0() const { return (header >> 0) & 0xF; } + + void setOrbitCounter(uint32_t oc) { orbitCounter_ = oc; } + uint32_t orbitCounter() const { return orbitCounter_; } + + void setFooter(uint64_t _f) { footer = _f; } + uint8_t eoe() const { return (footer >> 60) & 0xF; } + uint16_t fSize() const { return (footer >> 32) & 0x3FF; } + uint8_t f0() const { return (footer >> 0) & 0xF; } + + private: + /// Id from FEDRawDataCollection. + int fedId_; + + /// Data from OptoRx headers and footer. + uint64_t header; + uint32_t orbitCounter_; + uint64_t footer; + }; +} // namespace io_v1 +using TotemFEDInfo = io_v1::TotemFEDInfo; #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemRPDigi.h b/DataFormats/CTPPSDigi/interface/TotemRPDigi.h index 4daf60af5c44e..b6b76f61b6214 100644 --- a/DataFormats/CTPPSDigi/interface/TotemRPDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemRPDigi.h @@ -13,19 +13,21 @@ /** * Digi structure for TOTEM RP silicon strip sensors. **/ -class TotemRPDigi { -public: - TotemRPDigi(unsigned short strip_no = 0) : strip_no_(strip_no) {} +namespace io_v1 { + class TotemRPDigi { + public: + TotemRPDigi(unsigned short strip_no = 0) : strip_no_(strip_no) {} - unsigned short stripNumber() const { return strip_no_; } + unsigned short stripNumber() const { return strip_no_; } -private: - /// index of the activated strip - unsigned short strip_no_; -}; - -inline bool operator<(const TotemRPDigi& one, const TotemRPDigi& other) { - return one.stripNumber() < other.stripNumber(); -} + private: + /// index of the activated strip + unsigned short strip_no_; + }; + inline bool operator<(const TotemRPDigi& one, const TotemRPDigi& other) { + return one.stripNumber() < other.stripNumber(); + } +} // namespace io_v1 +using TotemRPDigi = io_v1::TotemRPDigi; #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h index e5858355153a6..bd1cadd3614bd 100644 --- a/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h +++ b/DataFormats/CTPPSDigi/interface/TotemTimingDigi.h @@ -16,126 +16,129 @@ #include -class TotemTimingDigi { -public: - TotemTimingDigi(const uint8_t hwId, - const uint64_t fpgaTimestamp, - const uint16_t timestampA, - const uint16_t timestampB, - const uint16_t cellInfo, - const std::vector& samples, - const TotemTimingEventInfo& totemTimingEventInfo); - TotemTimingDigi(); +namespace io_v1 { + class TotemTimingDigi { + public: + TotemTimingDigi(const uint8_t hwId, + const uint64_t fpgaTimestamp, + const uint16_t timestampA, + const uint16_t timestampB, + const uint16_t cellInfo, + const std::vector& samples, + const TotemTimingEventInfo& totemTimingEventInfo); + TotemTimingDigi(); - /// Digis are equal if they have all the same values, NOT checking the samples! - bool operator==(const TotemTimingDigi& digi) const; + /// Digis are equal if they have all the same values, NOT checking the samples! + bool operator==(const TotemTimingDigi& digi) const; - /// Return digi values number + /// Return digi values number - /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline unsigned int hardwareId() const { return hwId_; } + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline unsigned int hardwareId() const { return hwId_; } - inline unsigned int hardwareBoardId() const { return (hwId_ & 0xE0) >> 5; } + inline unsigned int hardwareBoardId() const { return (hwId_ & 0xE0) >> 5; } - inline unsigned int hardwareSampicId() const { return (hwId_ & 0x10) >> 4; } + inline unsigned int hardwareSampicId() const { return (hwId_ & 0x10) >> 4; } - inline unsigned int hardwareChannelId() const { return (hwId_ & 0x0F); } + inline unsigned int hardwareChannelId() const { return (hwId_ & 0x0F); } - inline unsigned int fpgaTimestamp() const { return fpgaTimestamp_; } + inline unsigned int fpgaTimestamp() const { return fpgaTimestamp_; } - inline unsigned int timestampA() const { return timestampA_; } + inline unsigned int timestampA() const { return timestampA_; } - inline unsigned int timestampB() const { return timestampB_; } + inline unsigned int timestampB() const { return timestampB_; } - inline unsigned int cellInfo() const { return cellInfo_; } + inline unsigned int cellInfo() const { return cellInfo_; } - inline std::vector samples() const { return samples_; } + inline std::vector samples() const { return samples_; } - inline std::vector::const_iterator samplesBegin() const { return samples_.cbegin(); } + inline std::vector::const_iterator samplesBegin() const { return samples_.cbegin(); } - inline std::vector::const_iterator samplesEnd() const { return samples_.cend(); } + inline std::vector::const_iterator samplesEnd() const { return samples_.cend(); } - inline unsigned int numberOfSamples() const { return samples_.size(); } + inline unsigned int numberOfSamples() const { return samples_.size(); } - inline int sampleAt(const unsigned int i) const { - int sampleValue = -1; - if (i < samples_.size()) - sampleValue = (int)samples_.at(i); - return sampleValue; - } + inline int sampleAt(const unsigned int i) const { + int sampleValue = -1; + if (i < samples_.size()) + sampleValue = (int)samples_.at(i); + return sampleValue; + } - inline TotemTimingEventInfo eventInfo() const { return totemTimingEventInfo_; } + inline TotemTimingEventInfo eventInfo() const { return totemTimingEventInfo_; } - /// Set digi values - /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id - inline void setHardwareId(const uint8_t hwId) { hwId_ = hwId; } + /// Set digi values + /// Hardware Id formatted as: bits 0-3 Channel Id, bit 4 Sampic Id, bits 5-7 Digitizer Board Id + inline void setHardwareId(const uint8_t hwId) { hwId_ = hwId; } - inline void setHardwareBoardId(const unsigned int boardId) { - hwId_ &= 0x1F; // set board bits to 0 - hwId_ |= ((boardId & 0x07) << 5) & 0xE0; - } + inline void setHardwareBoardId(const unsigned int boardId) { + hwId_ &= 0x1F; // set board bits to 0 + hwId_ |= ((boardId & 0x07) << 5) & 0xE0; + } - inline void setHardwareSampicId(const unsigned int sampicId) { - hwId_ &= 0xEF; // set Sampic bit to 0 - hwId_ |= ((sampicId & 0x01) << 4) & 0x10; - } + inline void setHardwareSampicId(const unsigned int sampicId) { + hwId_ &= 0xEF; // set Sampic bit to 0 + hwId_ |= ((sampicId & 0x01) << 4) & 0x10; + } - inline void setHardwareChannelId(const unsigned int channelId) { - hwId_ &= 0xF0; // Set Sampic bit to 0 - hwId_ |= (channelId & 0x0F) & 0x0F; - } + inline void setHardwareChannelId(const unsigned int channelId) { + hwId_ &= 0xF0; // Set Sampic bit to 0 + hwId_ |= (channelId & 0x0F) & 0x0F; + } - inline void setFPGATimestamp(const uint64_t fpgaTimestamp) { fpgaTimestamp_ = fpgaTimestamp; } + inline void setFPGATimestamp(const uint64_t fpgaTimestamp) { fpgaTimestamp_ = fpgaTimestamp; } - inline void setTimestampA(const uint16_t timestampA) { timestampA_ = timestampA; } + inline void setTimestampA(const uint16_t timestampA) { timestampA_ = timestampA; } - inline void setTimestampB(const uint16_t timestampB) { timestampB_ = timestampB; } + inline void setTimestampB(const uint16_t timestampB) { timestampB_ = timestampB; } - inline void setCellInfo(const uint16_t cellInfo) { cellInfo_ = cellInfo & 0x3F; } + inline void setCellInfo(const uint16_t cellInfo) { cellInfo_ = cellInfo & 0x3F; } - inline void setSamples(const std::vector& samples) { samples_ = samples; } + inline void setSamples(const std::vector& samples) { samples_ = samples; } - inline void addSample(const uint8_t sampleValue) { samples_.emplace_back(sampleValue); } + inline void addSample(const uint8_t sampleValue) { samples_.emplace_back(sampleValue); } - inline void setSampleAt(const unsigned int i, const uint8_t sampleValue) { - if (i < samples_.size()) - samples_.at(i) = sampleValue; - } + inline void setSampleAt(const unsigned int i, const uint8_t sampleValue) { + if (i < samples_.size()) + samples_.at(i) = sampleValue; + } - inline void setEventInfo(const TotemTimingEventInfo& totemTimingEventInfo) { - totemTimingEventInfo_ = totemTimingEventInfo; - } - -private: - uint8_t hwId_; - uint64_t fpgaTimestamp_; - uint16_t timestampA_; - uint16_t timestampB_; - uint16_t cellInfo_; + inline void setEventInfo(const TotemTimingEventInfo& totemTimingEventInfo) { + totemTimingEventInfo_ = totemTimingEventInfo; + } - std::vector samples_; + private: + uint8_t hwId_; + uint64_t fpgaTimestamp_; + uint16_t timestampA_; + uint16_t timestampB_; + uint16_t cellInfo_; - TotemTimingEventInfo totemTimingEventInfo_; -}; + std::vector samples_; + TotemTimingEventInfo totemTimingEventInfo_; + }; +} // namespace io_v1 #include -inline bool operator<(const TotemTimingDigi& one, const TotemTimingDigi& other) { - if (one.eventInfo() < other.eventInfo()) - return true; - if (one.hardwareId() < other.hardwareId()) - return true; - return false; -} - -inline std::ostream& operator<<(std::ostream& os, const TotemTimingDigi& digi) { - return os << "TotemTimingDigi:" - << "\nHardwareId:\t" << std::hex << digi.hardwareId() << "\nDB: " << std::dec << digi.hardwareBoardId() - << "\tSampic: " << digi.hardwareSampicId() << "\tChannel: " << digi.hardwareChannelId() - << "\nFPGATimestamp:\t" << std::dec << digi.fpgaTimestamp() << "\nTimestampA:\t" << std::dec - << digi.timestampA() << "\nTimestampB:\t" << std::dec << digi.timestampB() << "\nCellInfo:\t" << std::hex - << digi.cellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.numberOfSamples() << std::endl - << digi.eventInfo() << std::endl; -} +namespace io_v1 { + inline bool operator<(const TotemTimingDigi& one, const TotemTimingDigi& other) { + if (one.eventInfo() < other.eventInfo()) + return true; + if (one.hardwareId() < other.hardwareId()) + return true; + return false; + } + inline std::ostream& operator<<(std::ostream& os, const TotemTimingDigi& digi) { + return os << "TotemTimingDigi:" + << "\nHardwareId:\t" << std::hex << digi.hardwareId() << "\nDB: " << std::dec << digi.hardwareBoardId() + << "\tSampic: " << digi.hardwareSampicId() << "\tChannel: " << digi.hardwareChannelId() + << "\nFPGATimestamp:\t" << std::dec << digi.fpgaTimestamp() << "\nTimestampA:\t" << std::dec + << digi.timestampA() << "\nTimestampB:\t" << std::dec << digi.timestampB() << "\nCellInfo:\t" << std::hex + << digi.cellInfo() << "\nNumberOfSamples:\t" << std::dec << digi.numberOfSamples() << std::endl + << digi.eventInfo() << std::endl; + } +} // namespace io_v1 +using TotemTimingDigi = io_v1::TotemTimingDigi; #endif diff --git a/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h b/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h index 6ea77011258f7..523ceaa0194d2 100644 --- a/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h +++ b/DataFormats/CTPPSDigi/interface/TotemVFATStatus.h @@ -19,81 +19,83 @@ /** * Class which contains information about conversion from RAW to DIGI for a single read-out chip (VFAT). */ -class TotemVFATStatus { -public: - TotemVFATStatus(uint8_t cp = 0) - : chipPosition_(cp), status(0), numberOfClustersSpecified(false), numberOfClusters_(0), eventCounter(0) {} +namespace io_v1 { + class TotemVFATStatus { + public: + TotemVFATStatus(uint8_t cp = 0) + : chipPosition_(cp), status(0), numberOfClustersSpecified(false), numberOfClusters_(0), eventCounter(0) {} - /// Chip position - inline uint8_t chipPosition() const { return chipPosition_; } - inline void setChipPosition(uint8_t cp) { chipPosition_ = cp; } + /// Chip position + inline uint8_t chipPosition() const { return chipPosition_; } + inline void setChipPosition(uint8_t cp) { chipPosition_ = cp; } - /// VFAT is present in mapping but no data is present int raw event - inline bool isMissing() const { return status[0]; } - inline void setMissing(bool val = true) { status[0] = val; } + /// VFAT is present in mapping but no data is present int raw event + inline bool isMissing() const { return status[0]; } + inline void setMissing(bool val = true) { status[0] = val; } - /// 12-bit hw id from the header of the vfat frame is diffrent from the 16-bit one from hw mapping - inline bool isIDMismatch() const { return status[1]; } - inline void setIDMismatch(bool val = true) { status[1] = val; } + /// 12-bit hw id from the header of the vfat frame is diffrent from the 16-bit one from hw mapping + inline bool isIDMismatch() const { return status[1]; } + inline void setIDMismatch(bool val = true) { status[1] = val; } - /// Footprint error - inline bool isFootprintError() const { return status[2]; } - inline void setFootprintError(bool val = true) { status[2] = val; } + /// Footprint error + inline bool isFootprintError() const { return status[2]; } + inline void setFootprintError(bool val = true) { status[2] = val; } - /// CRC error - inline bool isCRCError() const { return status[3]; } - inline void setCRCError(bool val = true) { status[3] = val; } + /// CRC error + inline bool isCRCError() const { return status[3]; } + inline void setCRCError(bool val = true) { status[3] = val; } - /// VFATFrame event number doesn't follow the number derived from DAQ - inline bool isECProgressError() const { return status[4]; } - inline void setECProgressError(bool val = true) { status[4] = val; } + /// VFATFrame event number doesn't follow the number derived from DAQ + inline bool isECProgressError() const { return status[4]; } + inline void setECProgressError(bool val = true) { status[4] = val; } - /// BC number is incorrect - inline bool isBCProgressError() const { return status[5]; } - inline void setBCProgressError(bool val = true) { status[5] = val; } + /// BC number is incorrect + inline bool isBCProgressError() const { return status[5]; } + inline void setBCProgressError(bool val = true) { status[5] = val; } - /// All channels from that VFAT are not taken into account - inline bool isFullyMaskedOut() const { return status[6]; } - inline void setFullyMaskedOut() { status[6] = true; } + /// All channels from that VFAT are not taken into account + inline bool isFullyMaskedOut() const { return status[6]; } + inline void setFullyMaskedOut() { status[6] = true; } - /// Some channels from VFAT ale masked out, but not all - inline bool isPartiallyMaskedOut() const { return status[7]; } - inline void setPartiallyMaskedOut() { status[7] = true; } + /// Some channels from VFAT ale masked out, but not all + inline bool isPartiallyMaskedOut() const { return status[7]; } + inline void setPartiallyMaskedOut() { status[7] = true; } - /// No channels are masked out - inline bool isNotMasked() const { return !(status[6] || status[7]); } - inline void setNotMasked() { status[6] = status[7] = false; } + /// No channels are masked out + inline bool isNotMasked() const { return !(status[6] || status[7]); } + inline void setNotMasked() { status[6] = status[7] = false; } - bool isOK() const { return !(status[0] || status[1] || status[2] || status[3] || status[4] || status[5]); } + bool isOK() const { return !(status[0] || status[1] || status[2] || status[3] || status[4] || status[5]); } - /// number of clusters - inline bool isNumberOfClustersSpecified() const { return numberOfClustersSpecified; } - inline void setNumberOfClustersSpecified(bool v) { numberOfClustersSpecified = v; } + /// number of clusters + inline bool isNumberOfClustersSpecified() const { return numberOfClustersSpecified; } + inline void setNumberOfClustersSpecified(bool v) { numberOfClustersSpecified = v; } - inline uint8_t numberOfClusters() const { return numberOfClusters_; } - inline void setNumberOfClusters(uint8_t v) { numberOfClusters_ = v; } + inline uint8_t numberOfClusters() const { return numberOfClusters_; } + inline void setNumberOfClusters(uint8_t v) { numberOfClusters_ = v; } - bool operator<(const TotemVFATStatus& cmp) const { return (status.to_ulong() < cmp.status.to_ulong()); } + bool operator<(const TotemVFATStatus& cmp) const { return (status.to_ulong() < cmp.status.to_ulong()); } - friend std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st); + friend std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st); - /// event Counter - inline uint8_t ec() const { return eventCounter; } - inline void setEC(const uint8_t ec) { eventCounter = ec; } + /// event Counter + inline uint8_t ec() const { return eventCounter; } + inline void setEC(const uint8_t ec) { eventCounter = ec; } -private: - /// describes placement of the VFAT within the detector - uint8_t chipPosition_; + private: + /// describes placement of the VFAT within the detector + uint8_t chipPosition_; - /// the status bits - std::bitset<8> status; + /// the status bits + std::bitset<8> status; - /// the number of hit clusters before DAQ trimming - bool numberOfClustersSpecified; - uint8_t numberOfClusters_; - - /// event counter in the VFAT frame - uint8_t eventCounter; -}; + /// the number of hit clusters before DAQ trimming + bool numberOfClustersSpecified; + uint8_t numberOfClusters_; + /// event counter in the VFAT frame + uint8_t eventCounter; + }; +} // namespace io_v1 +using TotemVFATStatus = io_v1::TotemVFATStatus; #endif diff --git a/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc b/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc index 30fe737fb5ae1..fb2b8d6795f7b 100644 --- a/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc +++ b/DataFormats/CTPPSDigi/src/TotemVFATStatus.cc @@ -11,7 +11,9 @@ #include -std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st) { - return s << "miss=" << st.status[0] << ",ID=" << st.status[1] << ",foot=" << st.status[2] << ",CRC=" << st.status[3] - << ",EC=" << st.status[4] << ",BC=" << st.status[5] << ",fm=" << st.status[6] << ",pm=" << st.status[7]; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const TotemVFATStatus& st) { + return s << "miss=" << st.status[0] << ",ID=" << st.status[1] << ",foot=" << st.status[2] << ",CRC=" << st.status[3] + << ",EC=" << st.status[4] << ",BC=" << st.status[5] << ",fm=" << st.status[6] << ",pm=" << st.status[7]; + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSDigi/src/classes_def.xml b/DataFormats/CTPPSDigi/src/classes_def.xml index c104fb5708ec1..d9853c4c0f2f0 100644 --- a/DataFormats/CTPPSDigi/src/classes_def.xml +++ b/DataFormats/CTPPSDigi/src/classes_def.xml @@ -1,75 +1,59 @@ - - + + - - - - - - + + + + + + - - - - - + + - - - - - - - - - - - - + + + + + + - - - + + - - - - - - - - + + - - + + - - - - - - + + + + + + - - + + - - - - - - + + + + + + @@ -85,34 +69,34 @@ - - + + - + - - - - - - - + + + + + + + - - + + - - - - - - - - - - + + + + + + + + + + diff --git a/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h b/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h index 67dd80692d463..c8b5200333d56 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/CTPPSDiamondLocalTrack.h @@ -17,27 +17,33 @@ //---------------------------------------------------------------------------------------------------- -class CTPPSDiamondLocalTrack : public CTPPSTimingLocalTrack { -public: - CTPPSDiamondLocalTrack(); - CTPPSDiamondLocalTrack( - const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma, int oot_idx, int mult_hits); - - bool containsHit(const CTPPSDiamondRecHit& recHit, float tolerance = 0.1) const; - - //--- temporal set'ters - - inline void setOOTIndex(int i) { ts_index_ = i; } - inline int ootIndex() const { return ts_index_; } - - inline void setMultipleHits(int i) { mh_ = i; } - inline int multipleHits() const { return mh_; } - -private: - /// Time slice index - int ts_index_; - /// Multiple hits counter - int mh_; -}; - +namespace io_v1 { + class CTPPSDiamondLocalTrack : public CTPPSTimingLocalTrack { + public: + CTPPSDiamondLocalTrack(); + CTPPSDiamondLocalTrack(const math::XYZPoint& pos0, + const math::XYZPoint& pos0_sigma, + float t, + float t_sigma, + int oot_idx, + int mult_hits); + + bool containsHit(const CTPPSDiamondRecHit& recHit, float tolerance = 0.1) const; + + //--- temporal set'ters + + inline void setOOTIndex(int i) { ts_index_ = i; } + inline int ootIndex() const { return ts_index_; } + + inline void setMultipleHits(int i) { mh_ = i; } + inline int multipleHits() const { return mh_; } + + private: + /// Time slice index + int ts_index_; + /// Multiple hits counter + int mh_; + }; +} // namespace io_v1 +using CTPPSDiamondLocalTrack = io_v1::CTPPSDiamondLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h index 6c3b92ad5710a..1e549622f45ea 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSDiamondRecHit.h @@ -14,56 +14,58 @@ #include "DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h" /// Reconstructed hit in diamond detectors. -class CTPPSDiamondRecHit : public CTPPSTimingRecHit { -public: - CTPPSDiamondRecHit() : CTPPSTimingRecHit(), tot_(0), tPrecision_(0), tsIndex_(0), hptdcErr_(0), mh_(false) {} - CTPPSDiamondRecHit(float x, - float xWidth, - float y, - float yWidth, - float z, - float zWidth, - float t, - float tot, - float tPrecision, - int ootIdx, - const HPTDCErrorFlags &hptdcErr, - const bool mh) - : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), - tot_(tot), - tPrecision_(tPrecision), - tsIndex_(ootIdx), - hptdcErr_(hptdcErr), - mh_(mh) {} +namespace io_v1 { + class CTPPSDiamondRecHit : public CTPPSTimingRecHit { + public: + CTPPSDiamondRecHit() : CTPPSTimingRecHit(), tot_(0), tPrecision_(0), tsIndex_(0), hptdcErr_(0), mh_(false) {} + CTPPSDiamondRecHit(float x, + float xWidth, + float y, + float yWidth, + float z, + float zWidth, + float t, + float tot, + float tPrecision, + int ootIdx, + const HPTDCErrorFlags &hptdcErr, + const bool mh) + : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), + tot_(tot), + tPrecision_(tPrecision), + tsIndex_(ootIdx), + hptdcErr_(hptdcErr), + mh_(mh) {} - static constexpr int TIMESLICE_WITHOUT_LEADING = -10; + static constexpr int TIMESLICE_WITHOUT_LEADING = -10; - inline void setToT(float tot) { tot_ = tot; } - inline float toT() const { return tot_; } + inline void setToT(float tot) { tot_ = tot; } + inline float toT() const { return tot_; } - inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } - inline float tPrecision() const { return tPrecision_; } + inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } + inline float tPrecision() const { return tPrecision_; } - inline void setOOTIndex(int i) { tsIndex_ = i; } - inline int ootIndex() const { return tsIndex_; } + inline void setOOTIndex(int i) { tsIndex_ = i; } + inline int ootIndex() const { return tsIndex_; } - inline void setMultipleHits(bool mh) { mh_ = mh; } - inline bool multipleHits() const { return mh_; } + inline void setMultipleHits(bool mh) { mh_ = mh; } + inline bool multipleHits() const { return mh_; } - inline void setHPTDCErrorFlags(const HPTDCErrorFlags &err) { hptdcErr_ = err; } - inline HPTDCErrorFlags hptdcErrorFlags() const { return hptdcErr_; } - -private: - /// Time over threshold - float tot_; - /// Expected timing precision - float tPrecision_; - /// Time slice index - int tsIndex_; - /// List of error flags encountered by the HPTDC - HPTDCErrorFlags hptdcErr_; - /// Multiple hits detected - bool mh_; -}; + inline void setHPTDCErrorFlags(const HPTDCErrorFlags &err) { hptdcErr_ = err; } + inline HPTDCErrorFlags hptdcErrorFlags() const { return hptdcErr_; } + private: + /// Time over threshold + float tot_; + /// Expected timing precision + float tPrecision_; + /// Time slice index + int tsIndex_; + /// List of error flags encountered by the HPTDC + HPTDCErrorFlags hptdcErr_; + /// Multiple hits detected + bool mh_; + }; +} // namespace io_v1 +using CTPPSDiamondRecHit = io_v1::CTPPSDiamondRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h index 4c35d9cf7dd38..07e44200418c5 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h +++ b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLite.h @@ -16,138 +16,140 @@ /** *\brief Local (=single RP) track with essential information only. **/ -class CTPPSLocalTrackLite { -public: - CTPPSLocalTrackLite() - : rp_id_(0), - x_(0.), - x_unc_(-1.), - y_(0.), - y_unc_(-1.), - tx_(999.), - tx_unc_(-1.), - ty_(999.), - ty_unc_(-1.), - chi2_norm_(-1.), - pixel_track_reco_info_(CTPPSpixelLocalTrackReconstructionInfo::invalid), - num_points_fit_(0), - time_(0.), - time_unc_(-1.) {} - - CTPPSLocalTrackLite(uint32_t pid, - float px, - float pxu, - float py, - float pyu, - float ptx, - float ptxu, - float pty, - float ptyu, - float pchiSquaredOverNDF, - CTPPSpixelLocalTrackReconstructionInfo ppixelTrack_reco_info, - unsigned short pNumberOfPointsUsedForFit, - float pt, - float ptu) - : rp_id_(pid), - x_(px), - x_unc_(pxu), - y_(py), - y_unc_(pyu), - tx_(ptx), - tx_unc_(ptxu), - ty_(pty), - ty_unc_(ptyu), - chi2_norm_(pchiSquaredOverNDF), - pixel_track_reco_info_(ppixelTrack_reco_info), - num_points_fit_(pNumberOfPointsUsedForFit), - time_(pt), - time_unc_(ptu) {} - - /// returns the RP id - inline uint32_t rpId() const { return rp_id_; } - - /// returns the horizontal track position - inline float x() const { return x_; } - - /// returns the horizontal track position uncertainty - inline float xUnc() const { return x_unc_; } - - /// returns the vertical track position - inline float y() const { return y_; } - - /// returns the vertical track position uncertainty - inline float yUnc() const { return y_unc_; } - - /// returns the track time - inline float time() const { return time_; } - - /// returns the track time uncertainty - inline float timeUnc() const { return time_unc_; } - - /// returns the track horizontal angle - inline float tx() const { return tx_; } - - /// returns the track horizontal angle uncertainty - inline float txUnc() const { return tx_unc_; } - - /// returns the track vertical angle - inline float ty() const { return ty_; } - - /// returns the track vertical angle uncertainty - inline float tyUnc() const { return ty_unc_; } - - /// returns the track fit chi Squared over NDF - inline float chiSquaredOverNDF() const { return chi2_norm_; } - - /// returns the track reconstruction info byte - inline CTPPSpixelLocalTrackReconstructionInfo pixelTrackRecoInfo() const { return pixel_track_reco_info_; } - - /// returns the number of points used for fit - inline unsigned short numberOfPointsUsedForFit() const { return num_points_fit_; } - -protected: - /// RP id - uint32_t rp_id_; - - /// local track parameterization - /// x = x0 + tx*(z-z0), y = y0 + ty*(z-z0) - /// x0, y0, z-z0 in mm - /// z0: position of the reference scoring plane (in the middle of the RP) - - /// horizontal hit position, mm - float x_; - /// uncertainty on horizontal hit position, mm - float x_unc_; - /// vertical hit position, mm - float y_; - /// uncertainty on vertical hit position, mm - float y_unc_; - /// horizontal angle, x = x0 + tx*(z-z0) - float tx_; - /// uncertainty on horizontal angle - float tx_unc_; - /// vertical angle, y = y0 + ty*(z-z0) - float ty_; - /// uncertainty on vertical angle - float ty_unc_; - /// fit \f$\chi^2\f$/NDF - float chi2_norm_; - - /// Track information byte for bx-shifted runs: - /// * notShiftedRun -> Default value for tracks reconstructed in non-bx-shifted ROCs - /// * allShiftedPlanes -> Track reconstructed in a bx-shifted ROC with bx-shifted planes only - /// * noShiftedPlanes -> Track reconstructed in a bx-shifted ROC with non-bx-shifted planes only - /// * mixedPlanes -> Track reconstructed in a bx-shifted ROC both with bx-shifted and non-bx-shifted planes - /// * invalid -> Dummy value. Assigned when pixelTrack_reco_info is not computed (i.e. non-pixel tracks) - CTPPSpixelLocalTrackReconstructionInfo pixel_track_reco_info_; - - /// number of points used for fit - unsigned short num_points_fit_; - - /// time information, ns - float time_; - /// uncertainty on time information, ns - float time_unc_; -}; - +namespace io_v1 { + class CTPPSLocalTrackLite { + public: + CTPPSLocalTrackLite() + : rp_id_(0), + x_(0.), + x_unc_(-1.), + y_(0.), + y_unc_(-1.), + tx_(999.), + tx_unc_(-1.), + ty_(999.), + ty_unc_(-1.), + chi2_norm_(-1.), + pixel_track_reco_info_(CTPPSpixelLocalTrackReconstructionInfo::invalid), + num_points_fit_(0), + time_(0.), + time_unc_(-1.) {} + + CTPPSLocalTrackLite(uint32_t pid, + float px, + float pxu, + float py, + float pyu, + float ptx, + float ptxu, + float pty, + float ptyu, + float pchiSquaredOverNDF, + CTPPSpixelLocalTrackReconstructionInfo ppixelTrack_reco_info, + unsigned short pNumberOfPointsUsedForFit, + float pt, + float ptu) + : rp_id_(pid), + x_(px), + x_unc_(pxu), + y_(py), + y_unc_(pyu), + tx_(ptx), + tx_unc_(ptxu), + ty_(pty), + ty_unc_(ptyu), + chi2_norm_(pchiSquaredOverNDF), + pixel_track_reco_info_(ppixelTrack_reco_info), + num_points_fit_(pNumberOfPointsUsedForFit), + time_(pt), + time_unc_(ptu) {} + + /// returns the RP id + inline uint32_t rpId() const { return rp_id_; } + + /// returns the horizontal track position + inline float x() const { return x_; } + + /// returns the horizontal track position uncertainty + inline float xUnc() const { return x_unc_; } + + /// returns the vertical track position + inline float y() const { return y_; } + + /// returns the vertical track position uncertainty + inline float yUnc() const { return y_unc_; } + + /// returns the track time + inline float time() const { return time_; } + + /// returns the track time uncertainty + inline float timeUnc() const { return time_unc_; } + + /// returns the track horizontal angle + inline float tx() const { return tx_; } + + /// returns the track horizontal angle uncertainty + inline float txUnc() const { return tx_unc_; } + + /// returns the track vertical angle + inline float ty() const { return ty_; } + + /// returns the track vertical angle uncertainty + inline float tyUnc() const { return ty_unc_; } + + /// returns the track fit chi Squared over NDF + inline float chiSquaredOverNDF() const { return chi2_norm_; } + + /// returns the track reconstruction info byte + inline CTPPSpixelLocalTrackReconstructionInfo pixelTrackRecoInfo() const { return pixel_track_reco_info_; } + + /// returns the number of points used for fit + inline unsigned short numberOfPointsUsedForFit() const { return num_points_fit_; } + + protected: + /// RP id + uint32_t rp_id_; + + /// local track parameterization + /// x = x0 + tx*(z-z0), y = y0 + ty*(z-z0) + /// x0, y0, z-z0 in mm + /// z0: position of the reference scoring plane (in the middle of the RP) + + /// horizontal hit position, mm + float x_; + /// uncertainty on horizontal hit position, mm + float x_unc_; + /// vertical hit position, mm + float y_; + /// uncertainty on vertical hit position, mm + float y_unc_; + /// horizontal angle, x = x0 + tx*(z-z0) + float tx_; + /// uncertainty on horizontal angle + float tx_unc_; + /// vertical angle, y = y0 + ty*(z-z0) + float ty_; + /// uncertainty on vertical angle + float ty_unc_; + /// fit \f$\chi^2\f$/NDF + float chi2_norm_; + + /// Track information byte for bx-shifted runs: + /// * notShiftedRun -> Default value for tracks reconstructed in non-bx-shifted ROCs + /// * allShiftedPlanes -> Track reconstructed in a bx-shifted ROC with bx-shifted planes only + /// * noShiftedPlanes -> Track reconstructed in a bx-shifted ROC with non-bx-shifted planes only + /// * mixedPlanes -> Track reconstructed in a bx-shifted ROC both with bx-shifted and non-bx-shifted planes + /// * invalid -> Dummy value. Assigned when pixelTrack_reco_info is not computed (i.e. non-pixel tracks) + CTPPSpixelLocalTrackReconstructionInfo pixel_track_reco_info_; + + /// number of points used for fit + unsigned short num_points_fit_; + + /// time information, ns + float time_; + /// uncertainty on time information, ns + float time_unc_; + }; +} // namespace io_v1 +using CTPPSLocalTrackLite = io_v1::CTPPSLocalTrackLite; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h index 4835de7f08cf6..7dc31e99906dc 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h +++ b/DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h @@ -16,7 +16,10 @@ #include -class CTPPSLocalTrackLite; +namespace io_v1 { + class CTPPSLocalTrackLite; +} +using CTPPSLocalTrackLite = io_v1::CTPPSLocalTrackLite; /// Collection of CTPPSLocalTrackLite objects typedef std::vector CTPPSLocalTrackLiteCollection; /// Persistent reference to a CTPPSLocalTrackLite diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h b/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h index 7151044d46295..9d85ba8a54904 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelCluster.h @@ -11,114 +11,116 @@ #include #include -class CTPPSPixelCluster { -public: - CTPPSPixelCluster() {} - static constexpr uint8_t MAXSPAN = 255; - static constexpr uint8_t MAXCOL = 155; - static constexpr uint8_t MAXROW = 159; - - CTPPSPixelCluster(uint16_t isize, uint16_t* adcs, uint8_t const* rowpos, uint8_t const* colpos) - : thePixelOffset( - 2 * - isize), // the pixel offset is the pixel position inside the cluster wrt rowmin (even positions) and colmin (odd positions) - thePixelADC(adcs, adcs + isize) { - uint8_t maxCol = 0; - uint8_t maxRow = 0; - uint8_t rowmin = MAXROW; - uint8_t colmin = MAXCOL; - for (unsigned int j = 0; j != isize; ++j) { - rowmin = std::min(rowpos[j], rowmin); - colmin = std::min(colpos[j], colmin); +namespace io_v1 { + class CTPPSPixelCluster { + public: + CTPPSPixelCluster() {} + static constexpr uint8_t MAXSPAN = 255; + static constexpr uint8_t MAXCOL = 155; + static constexpr uint8_t MAXROW = 159; + + CTPPSPixelCluster(uint16_t isize, uint16_t* adcs, uint8_t const* rowpos, uint8_t const* colpos) + : thePixelOffset( + 2 * + isize), // the pixel offset is the pixel position inside the cluster wrt rowmin (even positions) and colmin (odd positions) + thePixelADC(adcs, adcs + isize) { + uint8_t maxCol = 0; + uint8_t maxRow = 0; + uint8_t rowmin = MAXROW; + uint8_t colmin = MAXCOL; + for (unsigned int j = 0; j != isize; ++j) { + rowmin = std::min(rowpos[j], rowmin); + colmin = std::min(colpos[j], colmin); + } + for (unsigned int i = 0; i != isize; ++i) { + uint8_t rowoffset = rowpos[i] - rowmin; + uint8_t coloffset = colpos[i] - colmin; + thePixelOffset[i * 2] = std::min(MAXSPAN, rowoffset); + thePixelOffset[i * 2 + 1] = std::min(MAXSPAN, coloffset); + if (rowoffset > maxRow) + maxRow = rowoffset; + if (coloffset > maxCol) + maxCol = coloffset; + } + + theMinPixelRow = rowmin; + thePixelRowSpan = std::min(maxRow, MAXSPAN); + + theMinPixelCol = colmin; + thePixelColSpan = std::min(maxCol, MAXSPAN); } - for (unsigned int i = 0; i != isize; ++i) { - uint8_t rowoffset = rowpos[i] - rowmin; - uint8_t coloffset = colpos[i] - colmin; - thePixelOffset[i * 2] = std::min(MAXSPAN, rowoffset); - thePixelOffset[i * 2 + 1] = std::min(MAXSPAN, coloffset); - if (rowoffset > maxRow) - maxRow = rowoffset; - if (coloffset > maxCol) - maxCol = coloffset; - } - - theMinPixelRow = rowmin; - thePixelRowSpan = std::min(maxRow, MAXSPAN); - - theMinPixelCol = colmin; - thePixelColSpan = std::min(maxCol, MAXSPAN); - } - // barycenter + // barycenter - float avg_row() const { - float qm = 0.0; - unsigned int isize = thePixelADC.size(); - for (unsigned int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]) * (thePixelOffset[i * 2] + theMinPixelRow + 0.5f); - return qm / charge(); - } + float avg_row() const { + float qm = 0.0; + unsigned int isize = thePixelADC.size(); + for (unsigned int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]) * (thePixelOffset[i * 2] + theMinPixelRow + 0.5f); + return qm / charge(); + } - float avg_col() const { - float qm = 0.0; - unsigned int isize = thePixelADC.size(); - for (unsigned int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + theMinPixelCol + 0.5f); - return qm / charge(); - } + float avg_col() const { + float qm = 0.0; + unsigned int isize = thePixelADC.size(); + for (unsigned int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + theMinPixelCol + 0.5f); + return qm / charge(); + } - //cluster charge + //cluster charge - inline float charge() const { - float qm = 0.0; - unsigned int isize = thePixelADC.size(); - for (unsigned int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]); - return qm; - } + inline float charge() const { + float qm = 0.0; + unsigned int isize = thePixelADC.size(); + for (unsigned int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]); + return qm; + } - // Return number of pixels. - unsigned int size() const { return thePixelADC.size(); } + // Return number of pixels. + unsigned int size() const { return thePixelADC.size(); } - // Return cluster dimension in rows - unsigned int sizeRow() const { return thePixelRowSpan + 1; } + // Return cluster dimension in rows + unsigned int sizeRow() const { return thePixelRowSpan + 1; } - // Return cluster dimension in columns - unsigned int sizeCol() const { return thePixelColSpan + 1; } + // Return cluster dimension in columns + unsigned int sizeCol() const { return thePixelColSpan + 1; } - inline unsigned int minPixelRow() const { return theMinPixelRow; } - inline unsigned int minPixelCol() const { return theMinPixelCol; } + inline unsigned int minPixelRow() const { return theMinPixelRow; } + inline unsigned int minPixelCol() const { return theMinPixelCol; } - inline unsigned int colSpan() const { return thePixelColSpan; } - inline unsigned int rowSpan() const { return thePixelRowSpan; } + inline unsigned int colSpan() const { return thePixelColSpan; } + inline unsigned int rowSpan() const { return thePixelRowSpan; } - const std::vector& pixelOffset() const { return thePixelOffset; } - const std::vector& pixelADC() const { return thePixelADC; } + const std::vector& pixelOffset() const { return thePixelOffset; } + const std::vector& pixelADC() const { return thePixelADC; } - unsigned int pixelRow(unsigned int i) const { return theMinPixelRow + thePixelOffset[i * 2]; } - unsigned int pixelCol(unsigned int i) const { return theMinPixelCol + thePixelOffset[i * 2 + 1]; } - unsigned int pixelADC(unsigned int i) const { return thePixelADC[i]; } + unsigned int pixelRow(unsigned int i) const { return theMinPixelRow + thePixelOffset[i * 2]; } + unsigned int pixelCol(unsigned int i) const { return theMinPixelCol + thePixelOffset[i * 2 + 1]; } + unsigned int pixelADC(unsigned int i) const { return thePixelADC[i]; } -private: - std::vector thePixelOffset; - std::vector thePixelADC; + private: + std::vector thePixelOffset; + std::vector thePixelADC; - uint8_t theMinPixelRow = MAXROW; - uint8_t theMinPixelCol = MAXCOL; - uint8_t thePixelRowSpan = 0; - uint8_t thePixelColSpan = 0; -}; + uint8_t theMinPixelRow = MAXROW; + uint8_t theMinPixelCol = MAXCOL; + uint8_t thePixelRowSpan = 0; + uint8_t thePixelColSpan = 0; + }; -inline bool operator<(const CTPPSPixelCluster& one, const CTPPSPixelCluster& two) { - if (one.minPixelRow() < two.minPixelRow()) { - return true; - } else if (one.minPixelRow() > two.minPixelRow()) { - return false; - } else if (one.minPixelCol() < two.minPixelCol()) { - return true; - } else { - return false; + inline bool operator<(const CTPPSPixelCluster& one, const CTPPSPixelCluster& two) { + if (one.minPixelRow() < two.minPixelRow()) { + return true; + } else if (one.minPixelRow() > two.minPixelRow()) { + return false; + } else if (one.minPixelCol() < two.minPixelCol()) { + return true; + } else { + return false; + } } -} - +} // namespace io_v1 +using CTPPSPixelCluster = io_v1::CTPPSPixelCluster; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h b/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h index fb0799687b23d..bd704ea8debcc 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrack.h @@ -27,191 +27,194 @@ #include "DataFormats/CTPPSReco/interface/CTPPSPixelLocalTrackRecoInfo.h" //---------------------------------------------------------------------------------------------------- -class CTPPSPixelFittedRecHit : public CTPPSPixelRecHit { -public: - CTPPSPixelFittedRecHit(const CTPPSPixelRecHit& hit, - const GlobalPoint& space_point_on_det, - const LocalPoint& residual, - const LocalPoint& pull) - : CTPPSPixelRecHit(hit), - space_point_on_det_(space_point_on_det), - residual_(residual), - pull_(pull), - isUsedForFit_(false), - isRealHit_(false) {} - - CTPPSPixelFittedRecHit() - : CTPPSPixelRecHit(), - residual_(LocalPoint(0, 0)), - pull_(LocalPoint(0, 0)), - isUsedForFit_(false), - isRealHit_(false) {} - - virtual ~CTPPSPixelFittedRecHit() {} - - inline const GlobalPoint& globalCoordinates() const { return space_point_on_det_; } - inline float xResidual() const { return residual_.x(); } - inline float yResidual() const { return residual_.y(); } - - inline float xPull() const { return pull_.x(); } - inline float yPull() const { return pull_.y(); } - - inline float xPullNormalization() const { return residual_.x() / pull_.x(); } - inline float yPullNormalization() const { return residual_.y() / pull_.y(); } - - inline void setIsUsedForFit(bool usedForFit) { - if (usedForFit) - isRealHit_ = true; - isUsedForFit_ = usedForFit; - } - inline bool isUsedForFit() const { return isUsedForFit_; } - - inline void setIsRealHit(bool realHit) { - if (!realHit) - isUsedForFit_ = false; - isRealHit_ = realHit; - } - inline bool isRealHit() const { return isRealHit_; } - -private: - GlobalPoint space_point_on_det_; ///< mm - LocalPoint residual_; ///< mm - LocalPoint pull_; ///< normalised residual - bool isUsedForFit_; - bool isRealHit_; -}; - -class CTPPSPixelLocalTrack { -public: - enum class TrackPar { x0 = 0, y0 = 1, tx = 2, ty = 3 }; - - ///< parameter vector size - static constexpr int dimension = 4; - typedef math::Error::type CovarianceMatrix; - typedef math::Vector::type ParameterVector; - - ///< covariance matrix size - static constexpr int covarianceSize = dimension * dimension; - - CTPPSPixelLocalTrack() - : z0_(0), - chiSquared_(0), - valid_(false), - numberOfPointsUsedForFit_(0), - recoInfo_(CTPPSpixelLocalTrackReconstructionInfo::invalid) {} - - CTPPSPixelLocalTrack(float z0, - const ParameterVector& track_params_vector, - const CovarianceMatrix& par_covariance_matrix, - float chiSquared); - - ~CTPPSPixelLocalTrack() {} - - inline const edm::DetSetVector& hits() const { return track_hits_vector_; } - inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit& hit) { - track_hits_vector_.find_or_insert(detId).push_back(hit); - if (hit.isUsedForFit()) - ++numberOfPointsUsedForFit_; - } - - inline float x0() const { return track_params_vector_[(unsigned int)TrackPar::x0]; } - inline float x0Sigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]); - } - inline float x0Variance() const { - return par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]; - } - - inline float y0() const { return track_params_vector_[(unsigned int)TrackPar::y0]; } - inline float y0Sigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]); - } - inline float y0Variance() const { - return par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]; - } - - inline float z0() const { return z0_; } - inline void setZ0(float z0) { z0_ = z0; } - - inline float tx() const { return track_params_vector_[(unsigned int)TrackPar::tx]; } - inline float txSigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::tx][(unsigned int)TrackPar::tx]); - } - - inline float ty() const { return track_params_vector_[(unsigned int)TrackPar::ty]; } - inline float tySigma() const { - return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::ty][(unsigned int)TrackPar::ty]); - } - - inline GlobalVector directionVector() const { - GlobalVector vect(tx(), ty(), 1); - return vect.unit(); - } +namespace io_v1 { + class CTPPSPixelFittedRecHit : public CTPPSPixelRecHit { + public: + CTPPSPixelFittedRecHit(const CTPPSPixelRecHit& hit, + const GlobalPoint& space_point_on_det, + const LocalPoint& residual, + const LocalPoint& pull) + : CTPPSPixelRecHit(hit), + space_point_on_det_(space_point_on_det), + residual_(residual), + pull_(pull), + isUsedForFit_(false), + isRealHit_(false) {} + + CTPPSPixelFittedRecHit() + : CTPPSPixelRecHit(), + residual_(LocalPoint(0, 0)), + pull_(LocalPoint(0, 0)), + isUsedForFit_(false), + isRealHit_(false) {} + + virtual ~CTPPSPixelFittedRecHit() {} + + inline const GlobalPoint& globalCoordinates() const { return space_point_on_det_; } + inline float xResidual() const { return residual_.x(); } + inline float yResidual() const { return residual_.y(); } + + inline float xPull() const { return pull_.x(); } + inline float yPull() const { return pull_.y(); } + + inline float xPullNormalization() const { return residual_.x() / pull_.x(); } + inline float yPullNormalization() const { return residual_.y() / pull_.y(); } + + inline void setIsUsedForFit(bool usedForFit) { + if (usedForFit) + isRealHit_ = true; + isUsedForFit_ = usedForFit; + } + inline bool isUsedForFit() const { return isUsedForFit_; } + + inline void setIsRealHit(bool realHit) { + if (!realHit) + isUsedForFit_ = false; + isRealHit_ = realHit; + } + inline bool isRealHit() const { return isRealHit_; } + + private: + GlobalPoint space_point_on_det_; ///< mm + LocalPoint residual_; ///< mm + LocalPoint pull_; ///< normalised residual + bool isUsedForFit_; + bool isRealHit_; + }; + + class CTPPSPixelLocalTrack { + public: + enum class TrackPar { x0 = 0, y0 = 1, tx = 2, ty = 3 }; + + ///< parameter vector size + static constexpr int dimension = 4; + typedef math::Error::type CovarianceMatrix; + typedef math::Vector::type ParameterVector; + + ///< covariance matrix size + static constexpr int covarianceSize = dimension * dimension; + + CTPPSPixelLocalTrack() + : z0_(0), + chiSquared_(0), + valid_(false), + numberOfPointsUsedForFit_(0), + recoInfo_(CTPPSpixelLocalTrackReconstructionInfo::invalid) {} + + CTPPSPixelLocalTrack(float z0, + const ParameterVector& track_params_vector, + const CovarianceMatrix& par_covariance_matrix, + float chiSquared); + + ~CTPPSPixelLocalTrack() {} + + inline const edm::DetSetVector& hits() const { return track_hits_vector_; } + inline void addHit(unsigned int detId, const CTPPSPixelFittedRecHit& hit) { + track_hits_vector_.find_or_insert(detId).push_back(hit); + if (hit.isUsedForFit()) + ++numberOfPointsUsedForFit_; + } + + inline float x0() const { return track_params_vector_[(unsigned int)TrackPar::x0]; } + inline float x0Sigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]); + } + inline float x0Variance() const { + return par_covariance_matrix_[(unsigned int)TrackPar::x0][(unsigned int)TrackPar::x0]; + } + + inline float y0() const { return track_params_vector_[(unsigned int)TrackPar::y0]; } + inline float y0Sigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]); + } + inline float y0Variance() const { + return par_covariance_matrix_[(unsigned int)TrackPar::y0][(unsigned int)TrackPar::y0]; + } + + inline float z0() const { return z0_; } + inline void setZ0(float z0) { z0_ = z0; } + + inline float tx() const { return track_params_vector_[(unsigned int)TrackPar::tx]; } + inline float txSigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::tx][(unsigned int)TrackPar::tx]); + } + + inline float ty() const { return track_params_vector_[(unsigned int)TrackPar::ty]; } + inline float tySigma() const { + return sqrt(par_covariance_matrix_[(unsigned int)TrackPar::ty][(unsigned int)TrackPar::ty]); + } + + inline GlobalVector directionVector() const { + GlobalVector vect(tx(), ty(), 1); + return vect.unit(); + } + + inline const ParameterVector& parameterVector() const { return track_params_vector_; } + + inline const CovarianceMatrix& covarianceMatrix() const { return par_covariance_matrix_; } + + inline float chiSquared() const { return chiSquared_; } + + inline float chiSquaredOverNDF() const { + if (numberOfPointsUsedForFit_ <= dimension / 2) + return -999.; + else + return chiSquared_ / (2 * numberOfPointsUsedForFit_ - dimension); + } + + inline int ndf() const { return (2 * numberOfPointsUsedForFit_ - dimension); } + + /// returns the point from which the track is passing by at the selected z + inline GlobalPoint trackPoint(float z) const { + float delta_z = z - z0_; + return GlobalPoint( + track_params_vector_[(unsigned int)TrackPar::x0] + track_params_vector_[(unsigned int)TrackPar::tx] * delta_z, + track_params_vector_[(unsigned int)TrackPar::y0] + track_params_vector_[(unsigned int)TrackPar::ty] * delta_z, + z); + } + + inline GlobalPoint trackCentrePoint() { + return GlobalPoint( + track_params_vector_[(unsigned int)TrackPar::x0], track_params_vector_[(unsigned int)TrackPar::y0], z0_); + } + + AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const; - inline const ParameterVector& parameterVector() const { return track_params_vector_; } - - inline const CovarianceMatrix& covarianceMatrix() const { return par_covariance_matrix_; } + inline bool isValid() const { return valid_; } - inline float chiSquared() const { return chiSquared_; } - - inline float chiSquaredOverNDF() const { - if (numberOfPointsUsedForFit_ <= dimension / 2) - return -999.; - else - return chiSquared_ / (2 * numberOfPointsUsedForFit_ - dimension); - } - - inline int ndf() const { return (2 * numberOfPointsUsedForFit_ - dimension); } - - /// returns the point from which the track is passing by at the selected z - inline GlobalPoint trackPoint(float z) const { - float delta_z = z - z0_; - return GlobalPoint( - track_params_vector_[(unsigned int)TrackPar::x0] + track_params_vector_[(unsigned int)TrackPar::tx] * delta_z, - track_params_vector_[(unsigned int)TrackPar::y0] + track_params_vector_[(unsigned int)TrackPar::ty] * delta_z, - z); - } + inline void setValid(bool valid) { valid_ = valid; } - inline GlobalPoint trackCentrePoint() { - return GlobalPoint( - track_params_vector_[(unsigned int)TrackPar::x0], track_params_vector_[(unsigned int)TrackPar::y0], z0_); - } + bool operator<(const CTPPSPixelLocalTrack& r); - AlgebraicSymMatrix22 trackPointInterpolationCovariance(float z) const; + inline CTPPSpixelLocalTrackReconstructionInfo recoInfo() const { return recoInfo_; } + inline void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo) { recoInfo_ = recoInfo; } - inline bool isValid() const { return valid_; } + inline unsigned short numberOfPointsUsedForFit() const { return numberOfPointsUsedForFit_; } - inline void setValid(bool valid) { valid_ = valid; } + private: + edm::DetSetVector track_hits_vector_; - bool operator<(const CTPPSPixelLocalTrack& r); + /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... + ParameterVector track_params_vector_; - inline CTPPSpixelLocalTrackReconstructionInfo recoInfo() const { return recoInfo_; } - inline void setRecoInfo(CTPPSpixelLocalTrackReconstructionInfo recoInfo) { recoInfo_ = recoInfo; } + /// z where x0 and y0 are evaluated. + /// filled from TotemRPGeometry::GetRPGlobalTranslation + float z0_; - inline unsigned short numberOfPointsUsedForFit() const { return numberOfPointsUsedForFit_; } + CovarianceMatrix par_covariance_matrix_; -private: - edm::DetSetVector track_hits_vector_; + /// fit chi^2 + float chiSquared_; - /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... - ParameterVector track_params_vector_; + /// fit valid? + bool valid_; - /// z where x0 and y0 are evaluated. - /// filled from TotemRPGeometry::GetRPGlobalTranslation - float z0_; - - CovarianceMatrix par_covariance_matrix_; - - /// fit chi^2 - float chiSquared_; - - /// fit valid? - bool valid_; - - /// number of points used for the track fit - int numberOfPointsUsedForFit_; - - CTPPSpixelLocalTrackReconstructionInfo recoInfo_; -}; + /// number of points used for the track fit + int numberOfPointsUsedForFit_; + CTPPSpixelLocalTrackReconstructionInfo recoInfo_; + }; +} // namespace io_v1 +using CTPPSPixelLocalTrack = io_v1::CTPPSPixelLocalTrack; +using CTPPSPixelFittedRecHit = io_v1::CTPPSPixelFittedRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h index b032212b5323b..b9ffa9400501d 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSPixelRecHit.h @@ -17,67 +17,69 @@ // Reconstructed hits in CTPPS Pixel detector -class CTPPSPixelRecHit { -public: - CTPPSPixelRecHit(LocalPoint lp = LocalPoint(0., 0., 0.), - LocalError le = LocalError(0., 0., 0.), - bool edge = false, - bool bad = false, - bool rocs = false, - int minrow = 0, - int mincol = 0, - int size = 0, - int rowsize = 0, - int colsize = 0) - : thePoint_(lp), - theError_(le), - isOnEdge_(edge), - hasBadPixels_(bad), - spanTwoRocs_(rocs), - minPixelRow_(minrow), - minPixelCol_(mincol), - clusterSize_(size), - clusterSizeRow_(rowsize), - clusterSizeCol_(colsize) {} - - LocalPoint point() const { return thePoint_; } - LocalError error() const { return theError_; } - - bool isOnEdge() const { return isOnEdge_; } - bool hasBadPixels() const { return hasBadPixels_; } - bool spanTwoRocs() const { return spanTwoRocs_; } - - unsigned int minPixelRow() const { return minPixelRow_; } - unsigned int minPixelCol() const { return minPixelCol_; } - - unsigned int clusterSize() const { return clusterSize_; } - unsigned int clusterSizeRow() const { return clusterSizeRow_; } - unsigned int clusterSizeCol() const { return clusterSizeCol_; } - - float sort_key() const { return thePoint_.mag2(); } - -private: - LocalPoint thePoint_; - LocalError theError_; - - bool isOnEdge_; - bool hasBadPixels_; - bool spanTwoRocs_; - - unsigned int minPixelRow_; - unsigned int minPixelCol_; - - unsigned int clusterSize_; - unsigned int clusterSizeRow_; - unsigned int clusterSizeCol_; -}; - -inline bool operator<(CTPPSPixelRecHit const& a, CTPPSPixelRecHit const& b) { - float a_key = a.sort_key(); - float b_key = b.sort_key(); - assert(edm::isFinite(a_key)); - assert(edm::isFinite(b_key)); - return a_key < b_key; -} - +namespace io_v1 { + class CTPPSPixelRecHit { + public: + CTPPSPixelRecHit(LocalPoint lp = LocalPoint(0., 0., 0.), + LocalError le = LocalError(0., 0., 0.), + bool edge = false, + bool bad = false, + bool rocs = false, + int minrow = 0, + int mincol = 0, + int size = 0, + int rowsize = 0, + int colsize = 0) + : thePoint_(lp), + theError_(le), + isOnEdge_(edge), + hasBadPixels_(bad), + spanTwoRocs_(rocs), + minPixelRow_(minrow), + minPixelCol_(mincol), + clusterSize_(size), + clusterSizeRow_(rowsize), + clusterSizeCol_(colsize) {} + + LocalPoint point() const { return thePoint_; } + LocalError error() const { return theError_; } + + bool isOnEdge() const { return isOnEdge_; } + bool hasBadPixels() const { return hasBadPixels_; } + bool spanTwoRocs() const { return spanTwoRocs_; } + + unsigned int minPixelRow() const { return minPixelRow_; } + unsigned int minPixelCol() const { return minPixelCol_; } + + unsigned int clusterSize() const { return clusterSize_; } + unsigned int clusterSizeRow() const { return clusterSizeRow_; } + unsigned int clusterSizeCol() const { return clusterSizeCol_; } + + float sort_key() const { return thePoint_.mag2(); } + + private: + LocalPoint thePoint_; + LocalError theError_; + + bool isOnEdge_; + bool hasBadPixels_; + bool spanTwoRocs_; + + unsigned int minPixelRow_; + unsigned int minPixelCol_; + + unsigned int clusterSize_; + unsigned int clusterSizeRow_; + unsigned int clusterSizeCol_; + }; + + inline bool operator<(CTPPSPixelRecHit const& a, CTPPSPixelRecHit const& b) { + float a_key = a.sort_key(); + float b_key = b.sort_key(); + assert(edm::isFinite(a_key)); + assert(edm::isFinite(b_key)); + return a_key < b_key; + } +} // namespace io_v1 +using CTPPSPixelRecHit = io_v1::CTPPSPixelRecHit; #endif // DataFormats_CTPPSReco_interface_CTPPSPixelRecHit_h diff --git a/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h b/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h index 8052bd773705a..a9abbc46a43d8 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/CTPPSTimingLocalTrack.h @@ -16,76 +16,78 @@ //---------------------------------------------------------------------------------------------------- -class CTPPSTimingLocalTrack { -public: - CTPPSTimingLocalTrack(); - CTPPSTimingLocalTrack(const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma); +namespace io_v1 { + class CTPPSTimingLocalTrack { + public: + CTPPSTimingLocalTrack(); + CTPPSTimingLocalTrack(const math::XYZPoint& pos0, const math::XYZPoint& pos0_sigma, float t, float t_sigma); - enum class CheckDimension { x, y, all }; - bool containsHit(const CTPPSTimingRecHit& recHit, - float tolerance = 0.1f, - CheckDimension check = CheckDimension::all) const; + enum class CheckDimension { x, y, all }; + bool containsHit(const CTPPSTimingRecHit& recHit, + float tolerance = 0.1f, + CheckDimension check = CheckDimension::all) const; - //--- spatial get'ters + //--- spatial get'ters - inline float x0() const { return pos0_.x(); } - inline float x0Sigma() const { return pos0_sigma_.x(); } + inline float x0() const { return pos0_.x(); } + inline float x0Sigma() const { return pos0_sigma_.x(); } - inline float y0() const { return pos0_.y(); } - inline float y0Sigma() const { return pos0_sigma_.y(); } + inline float y0() const { return pos0_.y(); } + inline float y0Sigma() const { return pos0_sigma_.y(); } - inline float z0() const { return pos0_.z(); } - inline float z0Sigma() const { return pos0_sigma_.z(); } + inline float z0() const { return pos0_.z(); } + inline float z0Sigma() const { return pos0_sigma_.z(); } - inline int numberOfHits() const { return num_hits_; } - inline int numberOfPlanes() const { return num_planes_; } + inline int numberOfHits() const { return num_hits_; } + inline int numberOfPlanes() const { return num_planes_; } - //--- spatial set'ters + //--- spatial set'ters - inline void setPosition(const math::XYZPoint& pos0) { pos0_ = pos0; } - inline void setPositionSigma(const math::XYZPoint& pos0_sigma) { pos0_sigma_ = pos0_sigma; } + inline void setPosition(const math::XYZPoint& pos0) { pos0_ = pos0; } + inline void setPositionSigma(const math::XYZPoint& pos0_sigma) { pos0_sigma_ = pos0_sigma; } - inline void setNumOfHits(int num_hits) { num_hits_ = num_hits; } - inline void setNumOfPlanes(int num_planes) { num_planes_ = num_planes; } + inline void setNumOfHits(int num_hits) { num_hits_ = num_hits; } + inline void setNumOfPlanes(int num_planes) { num_planes_ = num_planes; } - //--- validity related members + //--- validity related members - inline bool isValid() const { return valid_; } - inline void setValid(bool valid) { valid_ = valid; } + inline bool isValid() const { return valid_; } + inline void setValid(bool valid) { valid_ = valid; } - //--- temporal get'ters + //--- temporal get'ters - inline float time() const { return t_; } - inline float timeSigma() const { return t_sigma_; } + inline float time() const { return t_; } + inline float timeSigma() const { return t_sigma_; } - //--- temporal set'ters + //--- temporal set'ters - inline void setTime(float t) { t_ = t; } - inline void setTimeSigma(float t_sigma) { t_sigma_ = t_sigma; } + inline void setTime(float t) { t_ = t; } + inline void setTimeSigma(float t_sigma) { t_sigma_ = t_sigma; } -private: - //--- spatial information + private: + //--- spatial information - /// initial track position - math::XYZPoint pos0_; - /// error on the initial track position - math::XYZPoint pos0_sigma_; + /// initial track position + math::XYZPoint pos0_; + /// error on the initial track position + math::XYZPoint pos0_sigma_; - /// number of hits participating in the track - int num_hits_; + /// number of hits participating in the track + int num_hits_; - /// number of planes participating in the track - int num_planes_; + /// number of planes participating in the track + int num_planes_; - /// fit valid? - bool valid_; + /// fit valid? + bool valid_; - //--- timing information - float t_; - float t_sigma_; -}; - -/// Comparison operator -bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs); + //--- timing information + float t_; + float t_sigma_; + }; + /// Comparison operator + bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs); +} // namespace io_v1 +using CTPPSTimingLocalTrack = io_v1::CTPPSTimingLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h b/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h index 248ce1df7321a..06895326642bd 100644 --- a/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h +++ b/DataFormats/CTPPSReco/interface/CTPPSTimingRecHit.h @@ -11,45 +11,47 @@ #define DataFormats_CTPPSReco_CTPPSTimingRecHit /// Reconstructed hit in timing detectors. -class CTPPSTimingRecHit { -public: - CTPPSTimingRecHit() : x_(0.), xWidth_(0.), y_(0.), yWidth_(0.), z_(0.), zWidth_(0.), t_(0.) {} - CTPPSTimingRecHit(float x, float xWidth, float y, float yWidth, float z, float zWidth, float t) - : x_(x), xWidth_(xWidth), y_(y), yWidth_(yWidth), z_(z), zWidth_(zWidth), t_(t) {} +namespace io_v1 { + class CTPPSTimingRecHit { + public: + CTPPSTimingRecHit() : x_(0.), xWidth_(0.), y_(0.), yWidth_(0.), z_(0.), zWidth_(0.), t_(0.) {} + CTPPSTimingRecHit(float x, float xWidth, float y, float yWidth, float z, float zWidth, float t) + : x_(x), xWidth_(xWidth), y_(y), yWidth_(yWidth), z_(z), zWidth_(zWidth), t_(t) {} - inline void setX(float x) { x_ = x; } - inline float x() const { return x_; } + inline void setX(float x) { x_ = x; } + inline float x() const { return x_; } - inline void setY(float y) { y_ = y; } - inline float y() const { return y_; } + inline void setY(float y) { y_ = y; } + inline float y() const { return y_; } - inline void setZ(float z) { z_ = z; } - inline float z() const { return z_; } + inline void setZ(float z) { z_ = z; } + inline float z() const { return z_; } - inline void setXWidth(float xWidth) { xWidth_ = xWidth; } - inline float xWidth() const { return xWidth_; } + inline void setXWidth(float xWidth) { xWidth_ = xWidth; } + inline float xWidth() const { return xWidth_; } - inline void setYWidth(float yWidth) { yWidth_ = yWidth; } - inline float yWidth() const { return yWidth_; } + inline void setYWidth(float yWidth) { yWidth_ = yWidth; } + inline float yWidth() const { return yWidth_; } - inline void setZWidth(float zWidth) { zWidth_ = zWidth; } - inline float zWidth() const { return zWidth_; } + inline void setZWidth(float zWidth) { zWidth_ = zWidth; } + inline float zWidth() const { return zWidth_; } - inline void setTime(float t) { t_ = t; } - inline float time() const { return t_; } + inline void setTime(float t) { t_ = t; } + inline float time() const { return t_; } -protected: - float x_, xWidth_; - float y_, yWidth_; - float z_, zWidth_; - float t_; -}; + protected: + float x_, xWidth_; + float y_, yWidth_; + float z_, zWidth_; + float t_; + }; -//---------------------------------------------------------------------------------------------------- - -inline bool operator<(const CTPPSTimingRecHit &l, const CTPPSTimingRecHit &r) { - // only sort by leading edge time - return (l.time() < r.time()); -} + //---------------------------------------------------------------------------------------------------- + inline bool operator<(const CTPPSTimingRecHit &l, const CTPPSTimingRecHit &r) { + // only sort by leading edge time + return (l.time() < r.time()); + } +} // namespace io_v1 +using CTPPSTimingRecHit = io_v1::CTPPSTimingRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPCluster.h b/DataFormats/CTPPSReco/interface/TotemRPCluster.h index 46976be6090ac..f13f65891d19d 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPCluster.h +++ b/DataFormats/CTPPSReco/interface/TotemRPCluster.h @@ -15,37 +15,39 @@ /** *\brief Cluster of TOTEM RP strip hits. **/ -class TotemRPCluster { -public: - TotemRPCluster(unsigned short str_beg = 0, unsigned short str_end = 0) : str_beg_(str_beg), str_end_(str_end) {} +namespace io_v1 { + class TotemRPCluster { + public: + TotemRPCluster(unsigned short str_beg = 0, unsigned short str_end = 0) : str_beg_(str_beg), str_end_(str_end) {} - inline uint16_t stripBegin() const { return str_beg_; } - inline void setStripBegin(unsigned short str_beg) { str_beg_ = str_beg; } + inline uint16_t stripBegin() const { return str_beg_; } + inline void setStripBegin(unsigned short str_beg) { str_beg_ = str_beg; } - inline uint16_t stripEnd() const { return str_end_; } - inline void setStripEnd(unsigned short str_end) { str_end_ = str_end; } + inline uint16_t stripEnd() const { return str_end_; } + inline void setStripEnd(unsigned short str_end) { str_end_ = str_end; } - inline int numberOfStrips() const { return str_end_ - str_beg_ + 1; } + inline int numberOfStrips() const { return str_end_ - str_beg_ + 1; } - inline double centerStripPosition() const { return (str_beg_ + str_end_) / 2.; } + inline double centerStripPosition() const { return (str_beg_ + str_end_) / 2.; } -private: - uint16_t str_beg_; - uint16_t str_end_; -}; + private: + uint16_t str_beg_; + uint16_t str_end_; + }; -//---------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------- -inline bool operator<(const TotemRPCluster& l, const TotemRPCluster& r) { - if (l.stripBegin() < r.stripBegin()) - return true; - if (l.stripBegin() > r.stripBegin()) - return false; - - if (l.stripEnd() < r.stripEnd()) - return true; + inline bool operator<(const TotemRPCluster& l, const TotemRPCluster& r) { + if (l.stripBegin() < r.stripBegin()) + return true; + if (l.stripBegin() > r.stripBegin()) + return false; - return false; -} + if (l.stripEnd() < r.stripEnd()) + return true; + return false; + } +} // namespace io_v1 +using TotemRPCluster = io_v1::TotemRPCluster; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h b/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h index 8dc833eca8400..3494486eba7a2 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h @@ -28,129 +28,133 @@ * x any y refer to the global (x, y) system with the beam at (x = 0, y = 0). * Only VALID tracks (IsValid()==true) can be later used for physics reconstruction! **/ -class TotemRPLocalTrack { -public: - class FittedRecHit : public TotemRPRecHit { +namespace io_v1 { + class TotemRPLocalTrack { public: - FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull) - : TotemRPRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull) {} + class FittedRecHit : public TotemRPRecHit { + public: + FittedRecHit(const TotemRPRecHit &hit, const TVector3 &space_point_on_det, double residual, double pull) + : TotemRPRecHit(hit), space_point_on_det_(space_point_on_det), residual_(residual), pull_(pull) {} - FittedRecHit() : TotemRPRecHit(), residual_(0), pull_(0) {} + FittedRecHit() : TotemRPRecHit(), residual_(0), pull_(0) {} - virtual ~FittedRecHit() {} + virtual ~FittedRecHit() {} - inline const TVector3 &globalCoordinates() const { return space_point_on_det_; } - inline void setGlobalCoordinates(const TVector3 &space_point_on_det) { space_point_on_det_ = space_point_on_det; } + inline const TVector3 &globalCoordinates() const { return space_point_on_det_; } + inline void setGlobalCoordinates(const TVector3 &space_point_on_det) { space_point_on_det_ = space_point_on_det; } - inline double residual() const { return residual_; } - inline void setResidual(double residual) { residual_ = residual; } + inline double residual() const { return residual_; } + inline void setResidual(double residual) { residual_ = residual; } - inline double pull() const { return pull_; } - inline void setPull(double pull) { pull_ = pull; } + inline double pull() const { return pull_; } + inline void setPull(double pull) { pull_ = pull; } - inline double pullNormalization() const { return residual_ / pull_; } + inline double pullNormalization() const { return residual_ / pull_; } - private: - TVector3 space_point_on_det_; ///< mm - double residual_; ///< mm - double pull_; ///< normalised residual - }; - -public: - ///< parameter vector size - static const int dimension = 4; + private: + TVector3 space_point_on_det_; ///< mm + double residual_; ///< mm + double pull_; ///< normalised residual + }; - ///< covariance matrix size - static const int covarianceSize = dimension * dimension; + public: + ///< parameter vector size + static const int dimension = 4; - TotemRPLocalTrack() : z0_(0), chiSquared_(0), valid_(false) {} + ///< covariance matrix size + static const int covarianceSize = dimension * dimension; - TotemRPLocalTrack(double z0, - const TVectorD &track_params_vector, - const TMatrixD &par_covariance_matrix, - double chiSquared); + TotemRPLocalTrack() : z0_(0), chiSquared_(0), valid_(false) {} - virtual ~TotemRPLocalTrack() {} + TotemRPLocalTrack(double z0, + const TVectorD &track_params_vector, + const TMatrixD &par_covariance_matrix, + double chiSquared); - inline const edm::DetSetVector &hits() const { return track_hits_vector_; } - inline void addHit(unsigned int detId, const FittedRecHit &hit) { - track_hits_vector_.find_or_insert(detId).push_back(hit); - } + virtual ~TotemRPLocalTrack() {} - inline double x0() const { return track_params_vector_[0]; } - inline double x0Sigma() const { return sqrt(CovarianceMatrixElement(0, 0)); } - inline double x0Variance() const { return CovarianceMatrixElement(0, 0); } + inline const edm::DetSetVector &hits() const { return track_hits_vector_; } + inline void addHit(unsigned int detId, const FittedRecHit &hit) { + track_hits_vector_.find_or_insert(detId).push_back(hit); + } - inline double y0() const { return track_params_vector_[1]; } - inline double y0Sigma() const { return sqrt(CovarianceMatrixElement(1, 1)); } - inline double y0Variance() const { return CovarianceMatrixElement(1, 1); } + inline double x0() const { return track_params_vector_[0]; } + inline double x0Sigma() const { return sqrt(CovarianceMatrixElement(0, 0)); } + inline double x0Variance() const { return CovarianceMatrixElement(0, 0); } - inline double z0() const { return z0_; } - inline void setZ0(double z0) { z0_ = z0; } + inline double y0() const { return track_params_vector_[1]; } + inline double y0Sigma() const { return sqrt(CovarianceMatrixElement(1, 1)); } + inline double y0Variance() const { return CovarianceMatrixElement(1, 1); } - inline double tx() const { return track_params_vector_[2]; } - inline double txSigma() const { return sqrt(CovarianceMatrixElement(2, 2)); } + inline double z0() const { return z0_; } + inline void setZ0(double z0) { z0_ = z0; } - inline double ty() const { return track_params_vector_[3]; } - inline double tySigma() const { return sqrt(CovarianceMatrixElement(3, 3)); } + inline double tx() const { return track_params_vector_[2]; } + inline double txSigma() const { return sqrt(CovarianceMatrixElement(2, 2)); } - inline TVector3 directionVector() const { - TVector3 vect(tx(), ty(), 1); - vect.SetMag(1.0); - return vect; - } + inline double ty() const { return track_params_vector_[3]; } + inline double tySigma() const { return sqrt(CovarianceMatrixElement(3, 3)); } - TVectorD parameterVector() const; - void setParameterVector(const TVectorD &track_params_vector); + inline TVector3 directionVector() const { + TVector3 vect(tx(), ty(), 1); + vect.SetMag(1.0); + return vect; + } - TMatrixD covarianceMatrix() const; - void setCovarianceMatrix(const TMatrixD &par_covariance_matrix); + TVectorD parameterVector() const; + void setParameterVector(const TVectorD &track_params_vector); - inline double chiSquared() const { return chiSquared_; } - inline void setChiSquared(double &chiSquared) { chiSquared_ = chiSquared; } + TMatrixD covarianceMatrix() const; + void setCovarianceMatrix(const TMatrixD &par_covariance_matrix); - inline double chiSquaredOverNDF() const { return chiSquared_ / (track_hits_vector_.size() - 4); } + inline double chiSquared() const { return chiSquared_; } + inline void setChiSquared(double &chiSquared) { chiSquared_ = chiSquared; } - inline unsigned short numberOfPointsUsedForFit() const { return track_hits_vector_.size(); } + inline double chiSquaredOverNDF() const { return chiSquared_ / (track_hits_vector_.size() - 4); } - /// returns (x, y) vector - inline TVector2 trackPoint(double z) const { - double delta_z = z - z0_; - return TVector2(track_params_vector_[0] + track_params_vector_[2] * delta_z, - track_params_vector_[1] + track_params_vector_[3] * delta_z); - } + inline unsigned short numberOfPointsUsedForFit() const { return track_hits_vector_.size(); } - inline TVector3 trackCentrePoint() { return TVector3(track_params_vector_[0], track_params_vector_[1], z0_); } + /// returns (x, y) vector + inline TVector2 trackPoint(double z) const { + double delta_z = z - z0_; + return TVector2(track_params_vector_[0] + track_params_vector_[2] * delta_z, + track_params_vector_[1] + track_params_vector_[3] * delta_z); + } - TMatrixD trackPointInterpolationCovariance(double z) const; + inline TVector3 trackCentrePoint() { return TVector3(track_params_vector_[0], track_params_vector_[1], z0_); } - inline bool isValid() const { return valid_; } + TMatrixD trackPointInterpolationCovariance(double z) const; - inline void setValid(bool valid) { valid_ = valid; } + inline bool isValid() const { return valid_; } - friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r); + inline void setValid(bool valid) { valid_ = valid; } -private: - inline const double &CovarianceMatrixElement(int i, int j) const { return par_covariance_matrix_[i * dimension + j]; } + friend bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r); - inline double &CovarianceMatrixElement(int i, int j) { return par_covariance_matrix_[i * dimension + j]; } + private: + inline const double &CovarianceMatrixElement(int i, int j) const { + return par_covariance_matrix_[i * dimension + j]; + } - edm::DetSetVector track_hits_vector_; + inline double &CovarianceMatrixElement(int i, int j) { return par_covariance_matrix_[i * dimension + j]; } - /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... - double track_params_vector_[dimension]; + edm::DetSetVector track_hits_vector_; - /// z where x0 and y0 are evaluated. - /// filled from CTPPSGeometry::getRPTranslation - double z0_; + /// track parameters: (x0, y0, tx, ty); x = x0 + tx*(z-z0) ... + double track_params_vector_[dimension]; - double par_covariance_matrix_[covarianceSize]; + /// z where x0 and y0 are evaluated. + /// filled from CTPPSGeometry::getRPTranslation + double z0_; - /// fit chi^2 - double chiSquared_; + double par_covariance_matrix_[covarianceSize]; - /// fit valid? - bool valid_; -}; + /// fit chi^2 + double chiSquared_; + /// fit valid? + bool valid_; + }; +} // namespace io_v1 +using TotemRPLocalTrack = io_v1::TotemRPLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPRecHit.h b/DataFormats/CTPPSReco/interface/TotemRPRecHit.h index 8f3dbe448367e..a335d3aedcac8 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPRecHit.h +++ b/DataFormats/CTPPSReco/interface/TotemRPRecHit.h @@ -15,36 +15,39 @@ * * Basically a cluster (TotemRPCluster), the position of which has been converted into actual geometry (in mm). **/ -class TotemRPRecHit { -public: - TotemRPRecHit(double position = 0, double sigma = 0) : position_(position), sigma_(sigma) {} +namespace io_v1 { + class TotemRPRecHit { + public: + TotemRPRecHit(double position = 0, double sigma = 0) : position_(position), sigma_(sigma) {} - inline double position() const { return position_; } - inline void setPosition(double position) { position_ = position; } + inline double position() const { return position_; } + inline void setPosition(double position) { position_ = position; } - inline double sigma() const { return sigma_; } - inline void setSigma(double sigma) { sigma_ = sigma; } + inline double sigma() const { return sigma_; } + inline void setSigma(double sigma) { sigma_ = sigma; } -private: - /// position of the hit in mm, wrt detector center (see RPTopology::GetHitPositionInReadoutDirection) - double position_; + private: + /// position of the hit in mm, wrt detector center (see RPTopology::GetHitPositionInReadoutDirection) + double position_; - /// position uncertainty, in mm - double sigma_; -}; + /// position uncertainty, in mm + double sigma_; + }; -//---------------------------------------------------------------------------------------------------- + //---------------------------------------------------------------------------------------------------- -inline bool operator<(const TotemRPRecHit &l, const TotemRPRecHit &r) { - if (l.position() < r.position()) - return true; - if (l.position() > r.position()) - return false; + inline bool operator<(const TotemRPRecHit &l, const TotemRPRecHit &r) { + if (l.position() < r.position()) + return true; + if (l.position() > r.position()) + return false; - if (l.sigma() < r.sigma()) - return true; + if (l.sigma() < r.sigma()) + return true; - return false; -} + return false; + } +} // namespace io_v1 +using TotemRPRecHit = io_v1::TotemRPRecHit; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h b/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h index b064d2822c739..3baecc87d7572 100644 --- a/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h +++ b/DataFormats/CTPPSReco/interface/TotemRPUVPattern.h @@ -20,45 +20,47 @@ * The global coordinate system is used (wrt. the beam). This is the same convention * as for the 1-RP track fits. **/ -class TotemRPUVPattern { -public: - enum ProjectionType { projInvalid, projU, projV }; +namespace io_v1 { + class TotemRPUVPattern { + public: + enum ProjectionType { projInvalid, projU, projV }; - TotemRPUVPattern() : projection_(projInvalid), a_(0.), b_(0.), w_(0.), fittable_(false) {} + TotemRPUVPattern() : projection_(projInvalid), a_(0.), b_(0.), w_(0.), fittable_(false) {} - ProjectionType projection() const { return projection_; } - void setProjection(ProjectionType type) { projection_ = type; } + ProjectionType projection() const { return projection_; } + void setProjection(ProjectionType type) { projection_ = type; } - double a() const { return a_; } - void setA(double a) { a_ = a; } + double a() const { return a_; } + void setA(double a) { a_ = a; } - double b() const { return b_; } - void setB(double b) { b_ = b; } + double b() const { return b_; } + void setB(double b) { b_ = b; } - double w() const { return w_; } - void setW(double w) { w_ = w; } + double w() const { return w_; } + void setW(double w) { w_ = w; } - bool fittable() const { return fittable_; } - void setFittable(bool fittable) { fittable_ = fittable; } + bool fittable() const { return fittable_; } + void setFittable(bool fittable) { fittable_ = fittable; } - void addHit(edm::det_id_type detId, const TotemRPRecHit &hit) { hits_.find_or_insert(detId).push_back(hit); } + void addHit(edm::det_id_type detId, const TotemRPRecHit &hit) { hits_.find_or_insert(detId).push_back(hit); } - const edm::DetSetVector &hits() const { return hits_; } + const edm::DetSetVector &hits() const { return hits_; } - friend bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); + friend bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); -private: - ProjectionType projection_; ///< projection - double a_; ///< slope in rad - double b_; ///< intercept in mm - double w_; ///< weight - bool fittable_; ///< whether this pattern is worth including in track fits + private: + ProjectionType projection_; ///< projection + double a_; ///< slope in rad + double b_; ///< intercept in mm + double w_; ///< weight + bool fittable_; ///< whether this pattern is worth including in track fits - edm::DetSetVector hits_; ///< hits associated with the pattern -}; + edm::DetSetVector hits_; ///< hits associated with the pattern + }; -//---------------------------------------------------------------------------------------------------- - -extern bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); + //---------------------------------------------------------------------------------------------------- + extern bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r); +} // namespace io_v1 +using TotemRPUVPattern = io_v1::TotemRPUVPattern; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h b/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h index fb9ec86c0b748..c134c7c48bdc9 100644 --- a/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h +++ b/DataFormats/CTPPSReco/interface/TotemTimingLocalTrack.h @@ -14,10 +14,12 @@ //---------------------------------------------------------------------------------------------------- -class TotemTimingLocalTrack : public CTPPSTimingLocalTrack { -public: - using CTPPSTimingLocalTrack::CTPPSTimingLocalTrack; - // no specific class members yet -}; - +namespace io_v1 { + class TotemTimingLocalTrack : public CTPPSTimingLocalTrack { + public: + using CTPPSTimingLocalTrack::CTPPSTimingLocalTrack; + // no specific class members yet + }; +} // namespace io_v1 +using TotemTimingLocalTrack = io_v1::TotemTimingLocalTrack; #endif diff --git a/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h b/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h index 0c8433ac2e4cb..60f04cd520424 100644 --- a/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h +++ b/DataFormats/CTPPSReco/interface/TotemTimingRecHit.h @@ -14,52 +14,54 @@ /// Reconstructed hit in Totem UFSDetectors. /// \note t: time computed using algorithm timingAlgorithm() -class TotemTimingRecHit : public CTPPSTimingRecHit { -public: - enum TimingAlgorithm { NOT_SET, CFD, SMART, SIMPLE }; - static constexpr int NO_T_AVAILABLE = -100; +namespace io_v1 { + class TotemTimingRecHit : public CTPPSTimingRecHit { + public: + enum TimingAlgorithm { NOT_SET, CFD, SMART, SIMPLE }; + static constexpr int NO_T_AVAILABLE = -100; - TotemTimingRecHit() - : CTPPSTimingRecHit(), sampicThresholdTime_(0), tPrecision_(0), amplitude_(0), baselineRMS_(0), mode_(NOT_SET) {} + TotemTimingRecHit() + : CTPPSTimingRecHit(), sampicThresholdTime_(0), tPrecision_(0), amplitude_(0), baselineRMS_(0), mode_(NOT_SET) {} - TotemTimingRecHit(float x, - float xWidth, - float y, - float yWidth, - float z, - float zWidth, - float t, - float sampicThresholdTime, - float tPrecision, - float amplitude, - float baselineRMS, - TimingAlgorithm mode) - : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), - sampicThresholdTime_(sampicThresholdTime), - tPrecision_(tPrecision), - amplitude_(amplitude), - baselineRMS_(baselineRMS), - mode_(mode) {} + TotemTimingRecHit(float x, + float xWidth, + float y, + float yWidth, + float z, + float zWidth, + float t, + float sampicThresholdTime, + float tPrecision, + float amplitude, + float baselineRMS, + TimingAlgorithm mode) + : CTPPSTimingRecHit(x, xWidth, y, yWidth, z, zWidth, t), + sampicThresholdTime_(sampicThresholdTime), + tPrecision_(tPrecision), + amplitude_(amplitude), + baselineRMS_(baselineRMS), + mode_(mode) {} - inline void setSampicThresholdTime(float stt) { sampicThresholdTime_ = stt; } - inline float sampicThresholdTime() const { return sampicThresholdTime_; } + inline void setSampicThresholdTime(float stt) { sampicThresholdTime_ = stt; } + inline float sampicThresholdTime() const { return sampicThresholdTime_; } - inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } - inline float tPrecision() const { return tPrecision_; } + inline void setTPrecision(float tPrecision) { tPrecision_ = tPrecision; } + inline float tPrecision() const { return tPrecision_; } - inline void setAmplitude(float amplitude) { amplitude_ = amplitude; } - inline float amplitude() const { return amplitude_; } + inline void setAmplitude(float amplitude) { amplitude_ = amplitude; } + inline float amplitude() const { return amplitude_; } - inline void setBaselineRMS(float brms) { baselineRMS_ = brms; } - inline float baselineRMS() const { return baselineRMS_; } + inline void setBaselineRMS(float brms) { baselineRMS_ = brms; } + inline float baselineRMS() const { return baselineRMS_; } - inline TimingAlgorithm timingAlgorithm() const { return mode_; } - -private: - float sampicThresholdTime_, tPrecision_; - float amplitude_; - float baselineRMS_; - TimingAlgorithm mode_; -}; + inline TimingAlgorithm timingAlgorithm() const { return mode_; } + private: + float sampicThresholdTime_, tPrecision_; + float amplitude_; + float baselineRMS_; + TimingAlgorithm mode_; + }; +} // namespace io_v1 +using TotemTimingRecHit = io_v1::TotemTimingRecHit; #endif diff --git a/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc b/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc index e8da56c919f34..bf2adc85e2281 100644 --- a/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc +++ b/DataFormats/CTPPSReco/src/CTPPSTimingLocalTrack.cc @@ -48,23 +48,24 @@ bool CTPPSTimingLocalTrack::containsHit(const CTPPSTimingRecHit& recHit, float t //==================================================================================================== // Other methods implementation //==================================================================================================== - -bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs) { - // start to sort by temporal coordinate - if (lhs.time() < rhs.time()) - return true; - if (lhs.time() > rhs.time()) - return false; - // then sort by x-position - if (lhs.x0() < rhs.x0()) - return true; - if (lhs.x0() > rhs.x0()) - return false; - // ...and y-position - if (lhs.y0() < rhs.y0()) - return true; - if (lhs.y0() > rhs.y0()) - return false; - // ...and z-position - return (lhs.z0() < rhs.z0()); -} +namespace io_v1 { + bool operator<(const CTPPSTimingLocalTrack& lhs, const CTPPSTimingLocalTrack& rhs) { + // start to sort by temporal coordinate + if (lhs.time() < rhs.time()) + return true; + if (lhs.time() > rhs.time()) + return false; + // then sort by x-position + if (lhs.x0() < rhs.x0()) + return true; + if (lhs.x0() > rhs.x0()) + return false; + // ...and y-position + if (lhs.y0() < rhs.y0()) + return true; + if (lhs.y0() > rhs.y0()) + return false; + // ...and z-position + return (lhs.z0() < rhs.z0()); + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc b/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc index 04807f6f48467..34f36d0f3692e 100644 --- a/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc +++ b/DataFormats/CTPPSReco/src/TotemRPLocalTrack.cc @@ -84,18 +84,20 @@ void TotemRPLocalTrack::setCovarianceMatrix(const TMatrixD &par_covariance_matri //---------------------------------------------------------------------------------------------------- -bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r) { - if (l.z0_ < r.z0_) - return true; - if (l.z0_ > r.z0_) - return true; - - for (int i = 0; i < TotemRPLocalTrack::dimension; ++i) { - if (l.track_params_vector_[i] < r.track_params_vector_[i]) +namespace io_v1 { + bool operator<(const TotemRPLocalTrack &l, const TotemRPLocalTrack &r) { + if (l.z0_ < r.z0_) return true; - if (l.track_params_vector_[i] > r.track_params_vector_[i]) + if (l.z0_ > r.z0_) return true; - } - return false; -} + for (int i = 0; i < TotemRPLocalTrack::dimension; ++i) { + if (l.track_params_vector_[i] < r.track_params_vector_[i]) + return true; + if (l.track_params_vector_[i] > r.track_params_vector_[i]) + return true; + } + + return false; + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc b/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc index 099a97d155a69..4ff79f4287b66 100644 --- a/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc +++ b/DataFormats/CTPPSReco/src/TotemRPUVPattern.cc @@ -9,32 +9,33 @@ #include "DataFormats/CTPPSReco/interface/TotemRPUVPattern.h" //---------------------------------------------------------------------------------------------------- +namespace io_v1 { + bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r) { + if (l.projection_ < r.projection_) + return true; + if (l.projection_ > r.projection_) + return false; + + if (l.a_ < r.a_) + return true; + if (l.a_ > r.a_) + return false; + + if (l.b_ < r.b_) + return true; + if (l.b_ > r.b_) + return false; + + if (l.w_ < r.w_) + return true; + if (l.w_ > r.w_) + return false; + + if (l.fittable_ < r.fittable_) + return true; + if (l.fittable_ > r.fittable_) + return false; -bool operator<(const TotemRPUVPattern &l, const TotemRPUVPattern &r) { - if (l.projection_ < r.projection_) - return true; - if (l.projection_ > r.projection_) return false; - - if (l.a_ < r.a_) - return true; - if (l.a_ > r.a_) - return false; - - if (l.b_ < r.b_) - return true; - if (l.b_ > r.b_) - return false; - - if (l.w_ < r.w_) - return true; - if (l.w_ > r.w_) - return false; - - if (l.fittable_ < r.fittable_) - return true; - if (l.fittable_ > r.fittable_) - return false; - - return false; -} + } +} // namespace io_v1 diff --git a/DataFormats/CTPPSReco/src/classes_def.xml b/DataFormats/CTPPSReco/src/classes_def.xml index 6d9b52aaed0d2..03a5c63354fd4 100644 --- a/DataFormats/CTPPSReco/src/classes_def.xml +++ b/DataFormats/CTPPSReco/src/classes_def.xml @@ -2,256 +2,184 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/DataFormats/CaloRecHit/interface/CaloCluster.h b/DataFormats/CaloRecHit/interface/CaloCluster.h index 941ec56dadae0..caf8457578d26 100644 --- a/DataFormats/CaloRecHit/interface/CaloCluster.h +++ b/DataFormats/CaloRecHit/interface/CaloCluster.h @@ -24,231 +24,234 @@ #include namespace reco { + namespace io_v1 { + + class CaloCluster { + public: + enum AlgoId { + island = 0, + hybrid = 1, + fixedMatrix = 2, + dynamicHybrid = 3, + multi5x5 = 4, + particleFlow = 5, + hgcal_em = 6, + hgcal_had = 7, + hgcal_scintillator = 8, + hfnose = 9, + barrel_em = 10, + barrel_had = 11, + undefined = 1000 + }; + + // super-cluster flags + enum SCFlags { cleanOnly = 0, common = 100, uncleanOnly = 200 }; + // hcal cluster flags (used for pf) + enum HCalFlags { badHcalMarker = 1 }; + + //FIXME: + //temporary fix... to be removed before 310 final + typedef AlgoId AlgoID; + + /// default constructor. Sets energy and position to zero + CaloCluster() + : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(undefined), flags_(0) {} + + /// constructor with algoId, to be used in all child classes + CaloCluster(AlgoID algoID) + : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(algoID), flags_(0) {} + + CaloCluster(double energy, const math::XYZPoint& position, const CaloID& caloID) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + caloID_(caloID), + algoID_(undefined), + flags_(0) {} + + /// resets the CaloCluster (position, energy, hitsAndFractions) + void reset(); + + /// constructor from values + CaloCluster(double energy, const math::XYZPoint& position) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + algoID_(undefined), + flags_(0) {} + + CaloCluster( + double energy, const math::XYZPoint& position, const CaloID& caloID, const AlgoID& algoID, uint32_t flags = 0) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + caloID_(caloID), + algoID_(algoID) { + flags_ = flags & flagsMask_; + } + + CaloCluster(double energy, + const math::XYZPoint& position, + const CaloID& caloID, + const std::vector >& usedHitsAndFractions, + const AlgoId algoId, + const DetId seedId = DetId(0), + uint32_t flags = 0) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + caloID_(caloID), + hitsAndFractions_(usedHitsAndFractions), + algoID_(algoId), + seedId_(seedId) { + flags_ = flags & flagsMask_; + } + + //FIXME: + /// temporary compatibility constructor + CaloCluster(double energy, + const math::XYZPoint& position, + float chi2, + const std::vector& usedHits, + const AlgoId algoId, + uint32_t flags = 0) + : energy_(energy), + correctedEnergy_(-1.0), + correctedEnergyUncertainty_(-1.0), + position_(position), + algoID_(algoId) { + hitsAndFractions_.reserve(usedHits.size()); + for (size_t i = 0; i < usedHits.size(); i++) + hitsAndFractions_.push_back(std::pair(usedHits[i], 1.)); + flags_ = flags & flagsMask_; + } + + /// destructor + virtual ~CaloCluster() {} + + void setEnergy(double energy) { energy_ = energy; } + void setCorrectedEnergy(double cenergy) { correctedEnergy_ = cenergy; } + void setCorrectedEnergyUncertainty(float energyerr) { correctedEnergyUncertainty_ = energyerr; } + + void setPosition(const math::XYZPoint& p) { position_ = p; } + + void setCaloId(const CaloID& id) { caloID_ = id; } + + void setAlgoId(const AlgoId& id) { algoID_ = id; } + + void setSeed(const DetId& id) { seedId_ = id; } + + /// cluster energy + double energy() const { return energy_; } + double correctedEnergy() const { return correctedEnergy_; } + float correctedEnergyUncertainty() const { return correctedEnergyUncertainty_; } + + /// cluster centroid position + const math::XYZPoint& position() const { return position_; } + + /// comparison >= operator + bool operator>=(const CaloCluster& rhs) const { return (energy_ >= rhs.energy_); } + + /// comparison > operator + bool operator>(const CaloCluster& rhs) const { return (energy_ > rhs.energy_); } + + /// comparison <= operator + bool operator<=(const CaloCluster& rhs) const { return (energy_ <= rhs.energy_); } + + /// comparison < operator + bool operator<(const CaloCluster& rhs) const { return (energy_ < rhs.energy_); } + + /// comparison == operator + bool operator==(const CaloCluster& rhs) const { return (energy_ == rhs.energy_); }; + + /// x coordinate of cluster centroid + double x() const { return position_.x(); } + + /// y coordinate of cluster centroid + double y() const { return position_.y(); } + + /// z coordinate of cluster centroid + double z() const { return position_.z(); } + + /// pseudorapidity of cluster centroid + double eta() const { return position_.eta(); } + + /// azimuthal angle of cluster centroid + double phi() const { return position_.phi(); } + + /// size in number of hits (e.g. in crystals for ECAL) + size_t size() const { return hitsAndFractions_.size(); } + + /// algorithm identifier + AlgoId algo() const { return algoID_; } + AlgoID algoID() const { return algo(); } + + uint32_t flags() const { return flags_ & flagsMask_; } + void setFlags(uint32_t flags) { + uint32_t reserved = (flags_ & ~flagsMask_); + flags_ = (reserved) | (flags & flagsMask_); + } + bool isInClean() const { return flags() < uncleanOnly; } + bool isInUnclean() const { return flags() >= common; } + + const CaloID& caloID() const { return caloID_; } - class CaloCluster; - std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); - - class CaloCluster { - public: - enum AlgoId { - island = 0, - hybrid = 1, - fixedMatrix = 2, - dynamicHybrid = 3, - multi5x5 = 4, - particleFlow = 5, - hgcal_em = 6, - hgcal_had = 7, - hgcal_scintillator = 8, - hfnose = 9, - barrel_em = 10, - barrel_had = 11, - undefined = 1000 - }; + void addHitAndFraction(DetId id, float fraction) { + hitsAndFractions_.push_back(std::pair(id, fraction)); + } + + /// replace getHitsByDetId() : return hits by DetId + /// and their corresponding fraction of energy considered + /// to compute the total cluster energy + const std::vector >& hitsAndFractions() const { return hitsAndFractions_; } - // super-cluster flags - enum SCFlags { cleanOnly = 0, common = 100, uncleanOnly = 200 }; - // hcal cluster flags (used for pf) - enum HCalFlags { badHcalMarker = 1 }; - - //FIXME: - //temporary fix... to be removed before 310 final - typedef AlgoId AlgoID; - - /// default constructor. Sets energy and position to zero - CaloCluster() - : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(undefined), flags_(0) {} - - /// constructor with algoId, to be used in all child classes - CaloCluster(AlgoID algoID) - : energy_(0), correctedEnergy_(-1.0), correctedEnergyUncertainty_(-1.0), algoID_(algoID), flags_(0) {} - - CaloCluster(double energy, const math::XYZPoint& position, const CaloID& caloID) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - caloID_(caloID), - algoID_(undefined), - flags_(0) {} - - /// resets the CaloCluster (position, energy, hitsAndFractions) - void reset(); - - /// constructor from values - CaloCluster(double energy, const math::XYZPoint& position) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - algoID_(undefined), - flags_(0) {} - - CaloCluster( - double energy, const math::XYZPoint& position, const CaloID& caloID, const AlgoID& algoID, uint32_t flags = 0) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - caloID_(caloID), - algoID_(algoID) { - flags_ = flags & flagsMask_; - } - - CaloCluster(double energy, - const math::XYZPoint& position, - const CaloID& caloID, - const std::vector >& usedHitsAndFractions, - const AlgoId algoId, - const DetId seedId = DetId(0), - uint32_t flags = 0) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - caloID_(caloID), - hitsAndFractions_(usedHitsAndFractions), - algoID_(algoId), - seedId_(seedId) { - flags_ = flags & flagsMask_; - } - - //FIXME: - /// temporary compatibility constructor - CaloCluster(double energy, - const math::XYZPoint& position, - float chi2, - const std::vector& usedHits, - const AlgoId algoId, - uint32_t flags = 0) - : energy_(energy), - correctedEnergy_(-1.0), - correctedEnergyUncertainty_(-1.0), - position_(position), - algoID_(algoId) { - hitsAndFractions_.reserve(usedHits.size()); - for (size_t i = 0; i < usedHits.size(); i++) - hitsAndFractions_.push_back(std::pair(usedHits[i], 1.)); - flags_ = flags & flagsMask_; - } - - /// destructor - virtual ~CaloCluster() {} - - void setEnergy(double energy) { energy_ = energy; } - void setCorrectedEnergy(double cenergy) { correctedEnergy_ = cenergy; } - void setCorrectedEnergyUncertainty(float energyerr) { correctedEnergyUncertainty_ = energyerr; } - - void setPosition(const math::XYZPoint& p) { position_ = p; } - - void setCaloId(const CaloID& id) { caloID_ = id; } - - void setAlgoId(const AlgoId& id) { algoID_ = id; } - - void setSeed(const DetId& id) { seedId_ = id; } - - /// cluster energy - double energy() const { return energy_; } - double correctedEnergy() const { return correctedEnergy_; } - float correctedEnergyUncertainty() const { return correctedEnergyUncertainty_; } - - /// cluster centroid position - const math::XYZPoint& position() const { return position_; } - - /// comparison >= operator - bool operator>=(const CaloCluster& rhs) const { return (energy_ >= rhs.energy_); } - - /// comparison > operator - bool operator>(const CaloCluster& rhs) const { return (energy_ > rhs.energy_); } - - /// comparison <= operator - bool operator<=(const CaloCluster& rhs) const { return (energy_ <= rhs.energy_); } - - /// comparison < operator - bool operator<(const CaloCluster& rhs) const { return (energy_ < rhs.energy_); } - - /// comparison == operator - bool operator==(const CaloCluster& rhs) const { return (energy_ == rhs.energy_); }; - - /// x coordinate of cluster centroid - double x() const { return position_.x(); } - - /// y coordinate of cluster centroid - double y() const { return position_.y(); } - - /// z coordinate of cluster centroid - double z() const { return position_.z(); } - - /// pseudorapidity of cluster centroid - double eta() const { return position_.eta(); } - - /// azimuthal angle of cluster centroid - double phi() const { return position_.phi(); } - - /// size in number of hits (e.g. in crystals for ECAL) - size_t size() const { return hitsAndFractions_.size(); } - - /// algorithm identifier - AlgoId algo() const { return algoID_; } - AlgoID algoID() const { return algo(); } - - uint32_t flags() const { return flags_ & flagsMask_; } - void setFlags(uint32_t flags) { - uint32_t reserved = (flags_ & ~flagsMask_); - flags_ = (reserved) | (flags & flagsMask_); - } - bool isInClean() const { return flags() < uncleanOnly; } - bool isInUnclean() const { return flags() >= common; } - - const CaloID& caloID() const { return caloID_; } - - void addHitAndFraction(DetId id, float fraction) { - hitsAndFractions_.push_back(std::pair(id, fraction)); - } + /// print hitAndFraction + std::string printHitAndFraction(unsigned i) const; - /// replace getHitsByDetId() : return hits by DetId - /// and their corresponding fraction of energy considered - /// to compute the total cluster energy - const std::vector >& hitsAndFractions() const { return hitsAndFractions_; } + /// print me + friend std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); - /// print hitAndFraction - std::string printHitAndFraction(unsigned i) const; + /// return DetId of seed + DetId seed() const { return seedId_; } - /// print me - friend std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); + protected: + /// cluster energy + double energy_; + double correctedEnergy_; + float correctedEnergyUncertainty_; - /// return DetId of seed - DetId seed() const { return seedId_; } + /// cluster centroid position + math::XYZPoint position_; - protected: - /// cluster energy - double energy_; - double correctedEnergy_; - float correctedEnergyUncertainty_; + /// bitmask for detector information + CaloID caloID_; - /// cluster centroid position - math::XYZPoint position_; + // used hits by detId + std::vector > hitsAndFractions_; - /// bitmask for detector information - CaloID caloID_; + // cluster algorithm Id + AlgoID algoID_; - // used hits by detId - std::vector > hitsAndFractions_; + /// DetId of seed + DetId seedId_; - // cluster algorithm Id - AlgoID algoID_; + /// flags (e.g. for handling of cleaned/uncleaned SC) + /// 4 most significant bits reserved + /// 28 bits for handling of cleaned/uncleaned + uint32_t flags_; - /// DetId of seed - DetId seedId_; + static const uint32_t flagsMask_ = 0x0FFFFFFF; + static const uint32_t flagsOffset_ = 28; + }; - /// flags (e.g. for handling of cleaned/uncleaned SC) - /// 4 most significant bits reserved - /// 28 bits for handling of cleaned/uncleaned - uint32_t flags_; + std::ostream& operator<<(std::ostream& out, const CaloCluster& cluster); - static const uint32_t flagsMask_ = 0x0FFFFFFF; - static const uint32_t flagsOffset_ = 28; - }; + } // namespace io_v1 + using CaloCluster = io_v1::CaloCluster; } // namespace reco diff --git a/DataFormats/CaloRecHit/interface/CaloClusterFwd.h b/DataFormats/CaloRecHit/interface/CaloClusterFwd.h index 329d936b29eb9..b7c435ae35701 100644 --- a/DataFormats/CaloRecHit/interface/CaloClusterFwd.h +++ b/DataFormats/CaloRecHit/interface/CaloClusterFwd.h @@ -7,7 +7,10 @@ namespace edm { } namespace reco { - class CaloCluster; -} + namespace io_v1 { + class CaloCluster; + } + using CaloCluster = io_v1::CaloCluster; +} // namespace reco #endif diff --git a/DataFormats/CaloRecHit/src/CaloCluster.cc b/DataFormats/CaloRecHit/src/CaloCluster.cc index 7b130a8c5da0c..eca84526147d5 100644 --- a/DataFormats/CaloRecHit/src/CaloCluster.cc +++ b/DataFormats/CaloRecHit/src/CaloCluster.cc @@ -21,7 +21,7 @@ string CaloCluster::printHitAndFraction(unsigned i) const { return out.str(); } -std::ostream& reco::operator<<(std::ostream& out, const CaloCluster& cluster) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const CaloCluster& cluster) { if (!out) return out; diff --git a/DataFormats/CaloRecHit/src/classes_def.xml b/DataFormats/CaloRecHit/src/classes_def.xml index fa250a91eb62d..18407c70cec52 100644 --- a/DataFormats/CaloRecHit/src/classes_def.xml +++ b/DataFormats/CaloRecHit/src/classes_def.xml @@ -1,31 +1,29 @@ - - + + - - - - - + + - - - + + + - - - - + + + + + - - - - + + + + - - + + diff --git a/DataFormats/CaloTowers/interface/CaloTower.h b/DataFormats/CaloTowers/interface/CaloTower.h index acb100fbf77df..8b9981ba43832 100644 --- a/DataFormats/CaloTowers/interface/CaloTower.h +++ b/DataFormats/CaloTowers/interface/CaloTower.h @@ -23,240 +23,242 @@ // Make CaloTower inherit from LeafCandidate, // add new members and accessors. -class CaloTower : public reco::LeafCandidate { -public: - typedef CaloTowerDetId key_type; // for SortedCollection - - // Default constructor - CaloTower(); - - // Constructors from values - - CaloTower(const CaloTowerDetId& id, - double emE, - double hadE, - double outerE, - int ecal_tp, - int hcal_tp, - const PolarLorentzVector& p4, - const GlobalPoint& emPosition, - const GlobalPoint& hadPosition); - - CaloTower(const CaloTowerDetId& id, - double emE, - double hadE, - double outerE, - int ecal_tp, - int hcal_tp, - const LorentzVector& p4, - const GlobalPoint& emPosition, - const GlobalPoint& hadPosition); - - CaloTower(CaloTowerDetId id, - float emE, - float hadE, - float outerE, - int ecal_tp, - int hcal_tp, - GlobalVector p3, - float iEnergy, - bool massless, - GlobalPoint emPosition, - GlobalPoint hadPosition); - - CaloTower(CaloTowerDetId id, - float emE, - float hadE, - float outerE, - int ecal_tp, - int hcal_tp, - GlobalVector p3, - float iEnergy, - float imass, - GlobalPoint emPosition, - GlobalPoint hadPosition); - - // setters - void addConstituent(DetId id) { constituents_.push_back(id); } - void addConstituents(const std::vector& ids); - void setConstituents(std::vector&& ids) { constituents_ = std::move(ids); } - void setEcalTime(int t) { ecalTime_ = t; }; - void setHcalTime(int t) { hcalTime_ = t; }; - void setHcalSubdet(int lastHB, int lastHE, int lastHF, int lastHO) { - int ct_ieta = ietaAbs(); - if (ct_ieta <= lastHB) - subdet_ = HcalBarrel; - else if (ct_ieta <= lastHE) - subdet_ = HcalEndcap; - else if (ct_ieta <= lastHF) - subdet_ = HcalForward; - - //account for HO separately - if (ct_ieta <= lastHO) - inHO_ = true; - else - inHO_ = false; - - //account for gap/crossover tower separately - if (ct_ieta == lastHB) - inHBHEgap_ = true; - else - inHBHEgap_ = false; - } - - // set CaloTower status based on the number of - // bad/recovered/problematic cells in ECAL and HCAL - - void setCaloTowerStatus(unsigned int numBadHcalChan, - unsigned int numBadEcalChan, - unsigned int numRecHcalChan, - unsigned int numRecEcalChan, - unsigned int numProbHcalChan, - unsigned int numProbEcalChan); - - void setCaloTowerStatus(uint32_t s) { twrStatusWord_ = s; } - - // set the hottest cell energy in the tower - void setHottestCellE(double e) { hottestCellE_ = e; } - - // getters - CaloTowerDetId id() const { return id_; } - const std::vector& constituents() const { return constituents_; } - size_t constituentsSize() const { return constituents_.size(); } - DetId constituent(size_t i) const { return constituents_[i]; } - - // energy contributions from different detectors - // energy in HO ("outerEnergy")is not included in "hadEnergy" - double emEnergy() const { return emE_; } - double hadEnergy() const { return hadE_; } - double outerEnergy() const { return (inHO_) ? outerE_ : 0.0; } - - // transverse energies wrt to vtx (0,0,0) - double emEt() const { return emE_ * sin(theta()); } - double hadEt() const { return hadE_ * sin(theta()); } - double outerEt() const { return (inHO_) ? outerE_ * sin(theta()) : 0.0; } - - // preserve the inherited default accessors where applicable - // (user gets default p4 wrt to vtx (0,0,0) using p4(), etc. - - using LeafCandidate::et; - using LeafCandidate::p; - using LeafCandidate::p4; - - // recalculated wrt user provided vertex Z position; - - math::PtEtaPhiMLorentzVector p4(double vtxZ) const; - double p(double vtxZ) const { return p4(vtxZ).P(); } - double et(double vtxZ) const { return p4(vtxZ).Et(); } - - double emEt(double vtxZ) const { return emE_ * sin(p4(vtxZ).theta()); } - double hadEt(double vtxZ) const { return hadE_ * sin(p4(vtxZ).theta()); } - double outerEt(double vtxZ) const { return (inHO_) ? outerE_ * sin(p4(vtxZ).theta()) : 0.0; } - - // recalculated wrt vertex provided as 3D point - - math::PtEtaPhiMLorentzVector p4(const Point& v) const; - double p(const Point& v) const { return p4(v).P(); } - double et(const Point& v) const { return p4(v).Et(); } - - double emEt(const Point& v) const { return emE_ * sin(p4(v).theta()); } - double hadEt(const Point& v) const { return hadE_ * sin(p4(v).theta()); } - double outerEt(const Point& v) const { return (inHO_) ? outerE_ * sin(p4(v).theta()) : 0.0; } - - double hottestCellE() const { return hottestCellE_; } - - // Access to p4 comming from HO alone: requested by JetMET to add/subtract HO contributions - // to the tower for cases when the tower collection was created without/with HO - - math::PtEtaPhiMLorentzVector p4_HO() const; - math::PtEtaPhiMLorentzVector p4_HO(double vtxZ) const; - math::PtEtaPhiMLorentzVector p4_HO(const Point& v) const; - - // the reference poins in ECAL and HCAL for direction determination - // algorithm and parameters for selecting these points are set in the CaloTowersCreator - const GlobalPoint& emPosition() const { return emPosition_; } - const GlobalPoint& hadPosition() const { return hadPosition_; } - - int emLvl1() const { return emLvl1_; } - int hadLv11() const { return hadLvl1_; } - - // energy contained in depths>1 in the HE for 18<|iEta|<29 - double hadEnergyHeOuterLayer() const { return (subdet_ == HcalEndcap) ? outerE_ : 0; } - double hadEnergyHeInnerLayer() const { return (subdet_ == HcalEndcap) ? hadE_ - outerE_ : 0; } +namespace io_v1 { + class CaloTower : public reco::LeafCandidate { + public: + typedef CaloTowerDetId key_type; // for SortedCollection + + // Default constructor + CaloTower(); + + // Constructors from values + + CaloTower(const CaloTowerDetId& id, + double emE, + double hadE, + double outerE, + int ecal_tp, + int hcal_tp, + const PolarLorentzVector& p4, + const GlobalPoint& emPosition, + const GlobalPoint& hadPosition); + + CaloTower(const CaloTowerDetId& id, + double emE, + double hadE, + double outerE, + int ecal_tp, + int hcal_tp, + const LorentzVector& p4, + const GlobalPoint& emPosition, + const GlobalPoint& hadPosition); + + CaloTower(CaloTowerDetId id, + float emE, + float hadE, + float outerE, + int ecal_tp, + int hcal_tp, + GlobalVector p3, + float iEnergy, + bool massless, + GlobalPoint emPosition, + GlobalPoint hadPosition); + + CaloTower(CaloTowerDetId id, + float emE, + float hadE, + float outerE, + int ecal_tp, + int hcal_tp, + GlobalVector p3, + float iEnergy, + float imass, + GlobalPoint emPosition, + GlobalPoint hadPosition); + + // setters + void addConstituent(DetId id) { constituents_.push_back(id); } + void addConstituents(const std::vector& ids); + void setConstituents(std::vector&& ids) { constituents_ = std::move(ids); } + void setEcalTime(int t) { ecalTime_ = t; }; + void setHcalTime(int t) { hcalTime_ = t; }; + void setHcalSubdet(int lastHB, int lastHE, int lastHF, int lastHO) { + int ct_ieta = ietaAbs(); + if (ct_ieta <= lastHB) + subdet_ = HcalBarrel; + else if (ct_ieta <= lastHE) + subdet_ = HcalEndcap; + else if (ct_ieta <= lastHF) + subdet_ = HcalForward; + + //account for HO separately + if (ct_ieta <= lastHO) + inHO_ = true; + else + inHO_ = false; + + //account for gap/crossover tower separately + if (ct_ieta == lastHB) + inHBHEgap_ = true; + else + inHBHEgap_ = false; + } + + // set CaloTower status based on the number of + // bad/recovered/problematic cells in ECAL and HCAL + + void setCaloTowerStatus(unsigned int numBadHcalChan, + unsigned int numBadEcalChan, + unsigned int numRecHcalChan, + unsigned int numRecEcalChan, + unsigned int numProbHcalChan, + unsigned int numProbEcalChan); + + void setCaloTowerStatus(uint32_t s) { twrStatusWord_ = s; } + + // set the hottest cell energy in the tower + void setHottestCellE(double e) { hottestCellE_ = e; } + + // getters + CaloTowerDetId id() const { return id_; } + const std::vector& constituents() const { return constituents_; } + size_t constituentsSize() const { return constituents_.size(); } + DetId constituent(size_t i) const { return constituents_[i]; } + + // energy contributions from different detectors + // energy in HO ("outerEnergy")is not included in "hadEnergy" + double emEnergy() const { return emE_; } + double hadEnergy() const { return hadE_; } + double outerEnergy() const { return (inHO_) ? outerE_ : 0.0; } + + // transverse energies wrt to vtx (0,0,0) + double emEt() const { return emE_ * sin(theta()); } + double hadEt() const { return hadE_ * sin(theta()); } + double outerEt() const { return (inHO_) ? outerE_ * sin(theta()) : 0.0; } + + // preserve the inherited default accessors where applicable + // (user gets default p4 wrt to vtx (0,0,0) using p4(), etc. + + using LeafCandidate::et; + using LeafCandidate::p; + using LeafCandidate::p4; + + // recalculated wrt user provided vertex Z position; + + math::PtEtaPhiMLorentzVector p4(double vtxZ) const; + double p(double vtxZ) const { return p4(vtxZ).P(); } + double et(double vtxZ) const { return p4(vtxZ).Et(); } + + double emEt(double vtxZ) const { return emE_ * sin(p4(vtxZ).theta()); } + double hadEt(double vtxZ) const { return hadE_ * sin(p4(vtxZ).theta()); } + double outerEt(double vtxZ) const { return (inHO_) ? outerE_ * sin(p4(vtxZ).theta()) : 0.0; } + + // recalculated wrt vertex provided as 3D point + + math::PtEtaPhiMLorentzVector p4(const Point& v) const; + double p(const Point& v) const { return p4(v).P(); } + double et(const Point& v) const { return p4(v).Et(); } + + double emEt(const Point& v) const { return emE_ * sin(p4(v).theta()); } + double hadEt(const Point& v) const { return hadE_ * sin(p4(v).theta()); } + double outerEt(const Point& v) const { return (inHO_) ? outerE_ * sin(p4(v).theta()) : 0.0; } + + double hottestCellE() const { return hottestCellE_; } + + // Access to p4 comming from HO alone: requested by JetMET to add/subtract HO contributions + // to the tower for cases when the tower collection was created without/with HO + + math::PtEtaPhiMLorentzVector p4_HO() const; + math::PtEtaPhiMLorentzVector p4_HO(double vtxZ) const; + math::PtEtaPhiMLorentzVector p4_HO(const Point& v) const; + + // the reference poins in ECAL and HCAL for direction determination + // algorithm and parameters for selecting these points are set in the CaloTowersCreator + const GlobalPoint& emPosition() const { return emPosition_; } + const GlobalPoint& hadPosition() const { return hadPosition_; } + + int emLvl1() const { return emLvl1_; } + int hadLv11() const { return hadLvl1_; } + + // energy contained in depths>1 in the HE for 18<|iEta|<29 + double hadEnergyHeOuterLayer() const { return (subdet_ == HcalEndcap) ? outerE_ : 0; } + double hadEnergyHeInnerLayer() const { return (subdet_ == HcalEndcap) ? hadE_ - outerE_ : 0; } + + // energy in the tower by HCAL subdetector + // This is trivial except for tower 16 + // needed by JetMET cleanup in AOD. + double energyInHB() const; // { return (id_.ietaAbs()<16)? outerE_ : 0.0; } + double energyInHE() const; + double energyInHF() const; + double energyInHO() const; - // energy in the tower by HCAL subdetector - // This is trivial except for tower 16 - // needed by JetMET cleanup in AOD. - double energyInHB() const; // { return (id_.ietaAbs()<16)? outerE_ : 0.0; } - double energyInHE() const; - double energyInHF() const; - double energyInHO() const; + // time (ns) in ECAL/HCAL components of the tower based on weigted sum of the times in the contributing RecHits + float ecalTime() const { return float(ecalTime_) * 0.01; } + float hcalTime() const { return float(hcalTime_) * 0.01; } - // time (ns) in ECAL/HCAL components of the tower based on weigted sum of the times in the contributing RecHits - float ecalTime() const { return float(ecalTime_) * 0.01; } - float hcalTime() const { return float(hcalTime_) * 0.01; } + // position information on the tower + int ieta() const { return id_.ieta(); } + int ietaAbs() const { return id_.ietaAbs(); } + int iphi() const { return id_.iphi(); } + int zside() const { return id_.zside(); } - // position information on the tower - int ieta() const { return id_.ieta(); } - int ietaAbs() const { return id_.ietaAbs(); } - int iphi() const { return id_.iphi(); } - int zside() const { return id_.zside(); } + int numCrystals() const; - int numCrystals() const; + // methods to retrieve status information from the CaloTower: + // number of bad/recovered/problematic cells in the tower + // separately for ECAL and HCAL - // methods to retrieve status information from the CaloTower: - // number of bad/recovered/problematic cells in the tower - // separately for ECAL and HCAL + unsigned int numBadEcalCells() const { return (twrStatusWord_ & 0x1F); } + unsigned int numRecoveredEcalCells() const { return ((twrStatusWord_ >> 5) & 0x1F); } + unsigned int numProblematicEcalCells() const { return ((twrStatusWord_ >> 10) & 0x1F); } - unsigned int numBadEcalCells() const { return (twrStatusWord_ & 0x1F); } - unsigned int numRecoveredEcalCells() const { return ((twrStatusWord_ >> 5) & 0x1F); } - unsigned int numProblematicEcalCells() const { return ((twrStatusWord_ >> 10) & 0x1F); } + unsigned int numBadHcalCells() const { return ((twrStatusWord_ >> 15) & 0x7); } + unsigned int numRecoveredHcalCells() const { return ((twrStatusWord_ >> 18) & 0x7); } + unsigned int numProblematicHcalCells() const { return ((twrStatusWord_ >> 21) & 0x7); } - unsigned int numBadHcalCells() const { return ((twrStatusWord_ >> 15) & 0x7); } - unsigned int numRecoveredHcalCells() const { return ((twrStatusWord_ >> 18) & 0x7); } - unsigned int numProblematicHcalCells() const { return ((twrStatusWord_ >> 21) & 0x7); } + // the status word itself + uint32_t towerStatusWord() const { return twrStatusWord_; } - // the status word itself - uint32_t towerStatusWord() const { return twrStatusWord_; } + private: + CaloTowerDetId id_; -private: - CaloTowerDetId id_; + uint32_t twrStatusWord_; - uint32_t twrStatusWord_; + // positions of assumed EM and HAD shower positions + GlobalPoint emPosition_; + GlobalPoint hadPosition_; - // positions of assumed EM and HAD shower positions - GlobalPoint emPosition_; - GlobalPoint hadPosition_; + //hcal subdetector info + HcalSubdetector subdet_{HcalEmpty}; + bool inHO_{false}, inHBHEgap_{false}; - //hcal subdetector info - HcalSubdetector subdet_{HcalEmpty}; - bool inHO_{false}, inHBHEgap_{false}; + // time + int ecalTime_; + int hcalTime_; - // time - int ecalTime_; - int hcalTime_; + float emE_, hadE_, outerE_; + // for Jet ID use: hottest cell (ECAl or HCAL) + float hottestCellE_; - float emE_, hadE_, outerE_; - // for Jet ID use: hottest cell (ECAl or HCAL) - float hottestCellE_; + int emLvl1_, hadLvl1_; + std::vector constituents_; - int emLvl1_, hadLvl1_; - std::vector constituents_; + // vertex correction of EM and HAD momentum components: + // internally used in the transformation of the CaloTower p4 - // vertex correction of EM and HAD momentum components: - // internally used in the transformation of the CaloTower p4 + // for 3D vertex + math::PtEtaPhiMLorentzVector hadP4(const Point& v) const; + math::PtEtaPhiMLorentzVector emP4(const Point& v) const; - // for 3D vertex - math::PtEtaPhiMLorentzVector hadP4(const Point& v) const; - math::PtEtaPhiMLorentzVector emP4(const Point& v) const; + // taking only z-component + math::PtEtaPhiMLorentzVector hadP4(double vtxZ) const; + math::PtEtaPhiMLorentzVector emP4(double vtxZ) const; + }; - // taking only z-component - math::PtEtaPhiMLorentzVector hadP4(double vtxZ) const; - math::PtEtaPhiMLorentzVector emP4(double vtxZ) const; -}; - -std::ostream& operator<<(std::ostream& s, const CaloTower& ct); - -inline bool operator==(const CaloTower& t1, const CaloTower& t2) { return t1.id() == t2.id(); } + std::ostream& operator<<(std::ostream& s, const CaloTower& ct); + inline bool operator==(const CaloTower& t1, const CaloTower& t2) { return t1.id() == t2.id(); } +} // namespace io_v1 +using CaloTower = io_v1::CaloTower; #endif diff --git a/DataFormats/CaloTowers/interface/CaloTowerFwd.h b/DataFormats/CaloTowers/interface/CaloTowerFwd.h index 36702a9748291..3571fd0b35065 100644 --- a/DataFormats/CaloTowers/interface/CaloTowerFwd.h +++ b/DataFormats/CaloTowers/interface/CaloTowerFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_CaloTowers_CaloTowerFwd_h #define DataFormats_CaloTowers_CaloTowerFwd_h -class CaloTower; +namespace io_v1 { + class CaloTower; +} +using CaloTower = io_v1::CaloTower; #endif diff --git a/DataFormats/CaloTowers/src/CaloTower.cc b/DataFormats/CaloTowers/src/CaloTower.cc index cb9c3eb6db4ca..3f4cdc32da7cd 100644 --- a/DataFormats/CaloTowers/src/CaloTower.cc +++ b/DataFormats/CaloTowers/src/CaloTower.cc @@ -1,283 +1,286 @@ #include "DataFormats/CaloTowers/interface/CaloTower.h" -CaloTower::CaloTower() { - emE_ = 0; - hadE_ = 0; - outerE_ = 0; - emLvl1_ = 0; - hadLvl1_ = 0; -} - -CaloTower::CaloTower(const CaloTowerDetId& id, - double emE, - double hadE, - double outerE, - int ecal_tp, - int hcal_tp, - const PolarLorentzVector& p4, - const GlobalPoint& emPos, - const GlobalPoint& hadPos) - : LeafCandidate(0, p4, Point(0, 0, 0)), - id_(id), - emPosition_(emPos), - hadPosition_(hadPos), - emE_(emE), - hadE_(hadE), - outerE_(outerE), - emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} - -CaloTower::CaloTower(const CaloTowerDetId& id, - double emE, - double hadE, - double outerE, - int ecal_tp, - int hcal_tp, - const LorentzVector& p4, - const GlobalPoint& emPos, - const GlobalPoint& hadPos) - : LeafCandidate(0, p4, Point(0, 0, 0)), - id_(id), - emPosition_(emPos), - hadPosition_(hadPos), - emE_(emE), - hadE_(hadE), - outerE_(outerE), - emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} - -CaloTower::CaloTower(CaloTowerDetId id, - float emE, - float hadE, - float outerE, - int ecal_tp, - int hcal_tp, - GlobalVector p3, - float iEnergy, - bool massless, - GlobalPoint emPos, - GlobalPoint hadPos) - : LeafCandidate(0, p3, iEnergy, massless, Point(0, 0, 0)), - id_(id), - emPosition_(emPos), - hadPosition_(hadPos), - emE_(emE), - hadE_(hadE), - outerE_(outerE), - emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} - -CaloTower::CaloTower(CaloTowerDetId id, - float emE, - float hadE, - float outerE, - int ecal_tp, - int hcal_tp, - GlobalVector p3, - float iEnergy, - float imass, - GlobalPoint emPos, - GlobalPoint hadPos) - : LeafCandidate(0, p3, iEnergy, imass, Point(0, 0, 0)), - id_(id), - emPosition_(emPos), - hadPosition_(hadPos), - emE_(emE), - hadE_(hadE), - outerE_(outerE), - emLvl1_(ecal_tp), - hadLvl1_(hcal_tp) {} - -// recalculated momentum-related quantities wrt user provided vertex Z position - -math::PtEtaPhiMLorentzVector CaloTower::hadP4(double vtxZ) const { - // note: for now we use the same position for HO as for the other detectors - - double hcalTot; - if (inHO_) - hcalTot = (energy() - emE_); - else - hcalTot = hadE_; - - if (hcalTot > 0) { - double ctgTheta = (hadPosition_.z() - vtxZ) / hadPosition_.perp(); - double newEta = asinh(ctgTheta); - double pf = 1.0 / cosh(newEta); +namespace io_v1 { + CaloTower::CaloTower() { + emE_ = 0; + hadE_ = 0; + outerE_ = 0; + emLvl1_ = 0; + hadLvl1_ = 0; + } - return PolarLorentzVector(hcalTot * pf, newEta, hadPosition_.phi(), 0.0); + CaloTower::CaloTower(const CaloTowerDetId& id, + double emE, + double hadE, + double outerE, + int ecal_tp, + int hcal_tp, + const PolarLorentzVector& p4, + const GlobalPoint& emPos, + const GlobalPoint& hadPos) + : LeafCandidate(0, p4, Point(0, 0, 0)), + id_(id), + emPosition_(emPos), + hadPosition_(hadPos), + emE_(emE), + hadE_(hadE), + outerE_(outerE), + emLvl1_(ecal_tp), + hadLvl1_(hcal_tp) {} + + CaloTower::CaloTower(const CaloTowerDetId& id, + double emE, + double hadE, + double outerE, + int ecal_tp, + int hcal_tp, + const LorentzVector& p4, + const GlobalPoint& emPos, + const GlobalPoint& hadPos) + : LeafCandidate(0, p4, Point(0, 0, 0)), + id_(id), + emPosition_(emPos), + hadPosition_(hadPos), + emE_(emE), + hadE_(hadE), + outerE_(outerE), + emLvl1_(ecal_tp), + hadLvl1_(hcal_tp) {} + + CaloTower::CaloTower(CaloTowerDetId id, + float emE, + float hadE, + float outerE, + int ecal_tp, + int hcal_tp, + GlobalVector p3, + float iEnergy, + bool massless, + GlobalPoint emPos, + GlobalPoint hadPos) + : LeafCandidate(0, p3, iEnergy, massless, Point(0, 0, 0)), + id_(id), + emPosition_(emPos), + hadPosition_(hadPos), + emE_(emE), + hadE_(hadE), + outerE_(outerE), + emLvl1_(ecal_tp), + hadLvl1_(hcal_tp) {} + + CaloTower::CaloTower(CaloTowerDetId id, + float emE, + float hadE, + float outerE, + int ecal_tp, + int hcal_tp, + GlobalVector p3, + float iEnergy, + float imass, + GlobalPoint emPos, + GlobalPoint hadPos) + : LeafCandidate(0, p3, iEnergy, imass, Point(0, 0, 0)), + id_(id), + emPosition_(emPos), + hadPosition_(hadPos), + emE_(emE), + hadE_(hadE), + outerE_(outerE), + emLvl1_(ecal_tp), + hadLvl1_(hcal_tp) {} + + // recalculated momentum-related quantities wrt user provided vertex Z position + + math::PtEtaPhiMLorentzVector CaloTower::hadP4(double vtxZ) const { + // note: for now we use the same position for HO as for the other detectors + + double hcalTot; + if (inHO_) + hcalTot = (energy() - emE_); + else + hcalTot = hadE_; + + if (hcalTot > 0) { + double ctgTheta = (hadPosition_.z() - vtxZ) / hadPosition_.perp(); + double newEta = asinh(ctgTheta); + double pf = 1.0 / cosh(newEta); + + return PolarLorentzVector(hcalTot * pf, newEta, hadPosition_.phi(), 0.0); + } + + return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); } - return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); -} + math::PtEtaPhiMLorentzVector CaloTower::emP4(double vtxZ) const { + if (emE_ > 0) { + double ctgTheta = (emPosition_.z() - vtxZ) / emPosition_.perp(); + double newEta = asinh(ctgTheta); + double pf = 1.0 / cosh(newEta); -math::PtEtaPhiMLorentzVector CaloTower::emP4(double vtxZ) const { - if (emE_ > 0) { - double ctgTheta = (emPosition_.z() - vtxZ) / emPosition_.perp(); - double newEta = asinh(ctgTheta); - double pf = 1.0 / cosh(newEta); + return math::PtEtaPhiMLorentzVector(emE_ * pf, newEta, emPosition_.phi(), 0.0); + } - return math::PtEtaPhiMLorentzVector(emE_ * pf, newEta, emPosition_.phi(), 0.0); + return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); } - return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); -} + // recalculated momentum-related quantities wrt user provided 3D vertex -// recalculated momentum-related quantities wrt user provided 3D vertex + math::PtEtaPhiMLorentzVector CaloTower::hadP4(const Point& v) const { + // note: for now we use the same position for HO as for the other detectors -math::PtEtaPhiMLorentzVector CaloTower::hadP4(const Point& v) const { - // note: for now we use the same position for HO as for the other detectors + double hcalTot; + if (inHO_) + hcalTot = (energy() - emE_); + else + hcalTot = hadE_; - double hcalTot; - if (inHO_) - hcalTot = (energy() - emE_); - else - hcalTot = hadE_; + if (hcalTot > 0) { + GlobalPoint p(v.x(), v.y(), v.z()); + math::XYZVector dir = math::XYZVector(hadPosition_ - p); + return math::PtEtaPhiMLorentzVector(hcalTot * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); + } + + return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); + } + + math::PtEtaPhiMLorentzVector CaloTower::emP4(const Point& v) const { + if (emE_ > 0) { + GlobalPoint p(v.x(), v.y(), v.z()); + math::XYZVector dir = math::XYZVector(emPosition_ - p); + return math::PtEtaPhiMLorentzVector(emE_ * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); + } + + return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); + } + + math::PtEtaPhiMLorentzVector CaloTower::p4(double vtxZ) const { + if (subdet_ == HcalBarrel || subdet_ == HcalEndcap) { + return (emP4(vtxZ) + hadP4(vtxZ)); + } + // em and had energy in HF are defined in a special way + double ctgTheta = + (emPosition_.z() - vtxZ) / emPosition_.perp(); // em and had positions in HF are forced to be the same + double newEta = asinh(ctgTheta); + double pf = 1.0 / cosh(newEta); + return math::PtEtaPhiMLorentzVector(p4().energy() * pf, newEta, emPosition_.phi(), 0.0); + } - if (hcalTot > 0) { + math::PtEtaPhiMLorentzVector CaloTower::p4(const Point& v) const { + if (subdet_ == HcalBarrel || subdet_ == HcalEndcap) { + return emP4(v) + hadP4(v); + } + // em and had energy in HF are defined in a special way GlobalPoint p(v.x(), v.y(), v.z()); - math::XYZVector dir = math::XYZVector(hadPosition_ - p); - return math::PtEtaPhiMLorentzVector(hcalTot * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); + math::XYZVector dir = math::XYZVector(emPosition_ - p); // em and had positions in HF are forced to be the same + return math::PtEtaPhiMLorentzVector(p4().energy() * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); } - return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); -} + // p4 contribution from HO alone (note: direction is always taken to be the same as used for HB.) + + math::PtEtaPhiMLorentzVector CaloTower::p4_HO(const Point& v) const { + if (!inHO_ || outerE_ < 0) + return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); -math::PtEtaPhiMLorentzVector CaloTower::emP4(const Point& v) const { - if (emE_ > 0) { GlobalPoint p(v.x(), v.y(), v.z()); - math::XYZVector dir = math::XYZVector(emPosition_ - p); - return math::PtEtaPhiMLorentzVector(emE_ * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); + math::XYZVector dir = math::XYZVector(hadPosition_ - p); + return math::PtEtaPhiMLorentzVector(outerE_ * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); } - return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); -} + math::PtEtaPhiMLorentzVector CaloTower::p4_HO(double vtxZ) const { + Point p(0, 0, vtxZ); + return p4_HO(p); + } -math::PtEtaPhiMLorentzVector CaloTower::p4(double vtxZ) const { - if (subdet_ == HcalBarrel || subdet_ == HcalEndcap) { - return (emP4(vtxZ) + hadP4(vtxZ)); + math::PtEtaPhiMLorentzVector CaloTower::p4_HO() const { + if (!inHO_ || outerE_ < 0) + return math::PtEtaPhiMLorentzVector(0.0, 0.0, 0.0, 0.0); + return math::PtEtaPhiMLorentzVector( + outerE_ * sin(hadPosition_.theta()), hadPosition_.eta(), hadPosition_.phi(), 0.0); } - // em and had energy in HF are defined in a special way - double ctgTheta = - (emPosition_.z() - vtxZ) / emPosition_.perp(); // em and had positions in HF are forced to be the same - double newEta = asinh(ctgTheta); - double pf = 1.0 / cosh(newEta); - return math::PtEtaPhiMLorentzVector(p4().energy() * pf, newEta, emPosition_.phi(), 0.0); -} - -math::PtEtaPhiMLorentzVector CaloTower::p4(const Point& v) const { - if (subdet_ == HcalBarrel || subdet_ == HcalEndcap) { - return emP4(v) + hadP4(v); + + void CaloTower::addConstituents(const std::vector& ids) { + constituents_.reserve(constituents_.size() + ids.size()); + constituents_.insert(constituents_.end(), ids.begin(), ids.end()); } - // em and had energy in HF are defined in a special way - GlobalPoint p(v.x(), v.y(), v.z()); - math::XYZVector dir = math::XYZVector(emPosition_ - p); // em and had positions in HF are forced to be the same - return math::PtEtaPhiMLorentzVector(p4().energy() * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); -} -// p4 contribution from HO alone (note: direction is always taken to be the same as used for HB.) + int CaloTower::numCrystals() const { + if (subdet_ == HcalForward) + return 0; -math::PtEtaPhiMLorentzVector CaloTower::p4_HO(const Point& v) const { - if (!inHO_ || outerE_ < 0) - return math::PtEtaPhiMLorentzVector(0, 0, 0, 0); + int nC = 0; + std::vector::const_iterator it = constituents_.begin(); + for (; it != constituents_.end(); ++it) { + if (it->det() == DetId::Ecal) + ++nC; + } + + return nC; + } + + // Set the CaloTower status word from the number of bad/recovered/problematic + // cells in HCAL and ECAL. + + void CaloTower::setCaloTowerStatus(unsigned int numBadHcalChan, + unsigned int numBadEcalChan, + unsigned int numRecHcalChan, + unsigned int numRecEcalChan, + unsigned int numProbHcalChan, + unsigned int numProbEcalChan) { + twrStatusWord_ = 0x0; + + twrStatusWord_ |= (numBadEcalChan & 0x1F); + twrStatusWord_ |= ((numRecEcalChan & 0x1F) << 5); + twrStatusWord_ |= ((numProbEcalChan & 0x1F) << 10); + twrStatusWord_ |= ((numBadHcalChan & 0x7) << 15); + twrStatusWord_ |= ((numRecHcalChan & 0x7) << 18); + twrStatusWord_ |= ((numProbHcalChan & 0x7) << 21); + + return; + } + + // energy in the tower by HCAL subdetector + // This is trivia except for tower 16 + // needed by JetMET cleanup in AOD. + + double CaloTower::energyInHB() const { + if (inHBHEgap_) + return hadE_ - outerE_; + else if (subdet_ == HcalBarrel) + return hadE_; + else + return 0.0; + } + + double CaloTower::energyInHE() const { + if (inHBHEgap_) + return outerE_; + else if (subdet_ == HcalEndcap) + return hadE_; + else + return 0.0; + } - GlobalPoint p(v.x(), v.y(), v.z()); - math::XYZVector dir = math::XYZVector(hadPosition_ - p); - return math::PtEtaPhiMLorentzVector(outerE_ * sin(dir.theta()), dir.eta(), dir.phi(), 0.0); -} - -math::PtEtaPhiMLorentzVector CaloTower::p4_HO(double vtxZ) const { - Point p(0, 0, vtxZ); - return p4_HO(p); -} - -math::PtEtaPhiMLorentzVector CaloTower::p4_HO() const { - if (!inHO_ || outerE_ < 0) - return math::PtEtaPhiMLorentzVector(0.0, 0.0, 0.0, 0.0); - return math::PtEtaPhiMLorentzVector(outerE_ * sin(hadPosition_.theta()), hadPosition_.eta(), hadPosition_.phi(), 0.0); -} - -void CaloTower::addConstituents(const std::vector& ids) { - constituents_.reserve(constituents_.size() + ids.size()); - constituents_.insert(constituents_.end(), ids.begin(), ids.end()); -} - -int CaloTower::numCrystals() const { - if (subdet_ == HcalForward) - return 0; - - int nC = 0; - std::vector::const_iterator it = constituents_.begin(); - for (; it != constituents_.end(); ++it) { - if (it->det() == DetId::Ecal) - ++nC; + double CaloTower::energyInHF() const { + if (subdet_ == HcalForward) + return energy(); + else + return 0.0; } - return nC; -} - -// Set the CaloTower status word from the number of bad/recovered/problematic -// cells in HCAL and ECAL. - -void CaloTower::setCaloTowerStatus(unsigned int numBadHcalChan, - unsigned int numBadEcalChan, - unsigned int numRecHcalChan, - unsigned int numRecEcalChan, - unsigned int numProbHcalChan, - unsigned int numProbEcalChan) { - twrStatusWord_ = 0x0; - - twrStatusWord_ |= (numBadEcalChan & 0x1F); - twrStatusWord_ |= ((numRecEcalChan & 0x1F) << 5); - twrStatusWord_ |= ((numProbEcalChan & 0x1F) << 10); - twrStatusWord_ |= ((numBadHcalChan & 0x7) << 15); - twrStatusWord_ |= ((numRecHcalChan & 0x7) << 18); - twrStatusWord_ |= ((numProbHcalChan & 0x7) << 21); - - return; -} - -// energy in the tower by HCAL subdetector -// This is trivia except for tower 16 -// needed by JetMET cleanup in AOD. - -double CaloTower::energyInHB() const { - if (inHBHEgap_) - return hadE_ - outerE_; - else if (subdet_ == HcalBarrel) - return hadE_; - else - return 0.0; -} - -double CaloTower::energyInHE() const { - if (inHBHEgap_) - return outerE_; - else if (subdet_ == HcalEndcap) - return hadE_; - else - return 0.0; -} - -double CaloTower::energyInHF() const { - if (subdet_ == HcalForward) - return energy(); - else - return 0.0; -} - -// this is actual energy contributed to the tower -// (outerEnergy() returns HO energy regardless if it is used or not) -// Note: rounding error may lead to values not identically equal to zero -// when HO was not used - -double CaloTower::energyInHO() const { - if (inHO_) - return (energy() - hadE_ - emE_); - else - return 0.0; -} - -std::ostream& operator<<(std::ostream& s, const CaloTower& ct) { - return s << ct.id() << ":" << ct.et() << " GeV ET (EM=" << ct.emEt() << " HAD=" << ct.hadEt() - << " OUTER=" << ct.outerEt() << ") (" << ct.eta() << "," << ct.phi() << ")"; -} + // this is actual energy contributed to the tower + // (outerEnergy() returns HO energy regardless if it is used or not) + // Note: rounding error may lead to values not identically equal to zero + // when HO was not used + + double CaloTower::energyInHO() const { + if (inHO_) + return (energy() - hadE_ - emE_); + else + return 0.0; + } + + std::ostream& operator<<(std::ostream& s, const CaloTower& ct) { + return s << ct.id() << ":" << ct.et() << " GeV ET (EM=" << ct.emEt() << " HAD=" << ct.hadEt() + << " OUTER=" << ct.outerEt() << ") (" << ct.eta() << "," << ct.phi() << ")"; + } +} // namespace io_v1 diff --git a/DataFormats/CaloTowers/src/classes_def.xml b/DataFormats/CaloTowers/src/classes_def.xml index 88f2394498357..3286eda87953d 100644 --- a/DataFormats/CaloTowers/src/classes_def.xml +++ b/DataFormats/CaloTowers/src/classes_def.xml @@ -1,38 +1,34 @@ - - - + + - - - - - + + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - - - + + + + + diff --git a/DataFormats/Candidate/interface/Candidate.h b/DataFormats/Candidate/interface/Candidate.h index eb284246d9ab3..fe11605313bf0 100644 --- a/DataFormats/Candidate/interface/Candidate.h +++ b/DataFormats/Candidate/interface/Candidate.h @@ -24,277 +24,284 @@ class OverlapChecker; namespace reco { - class Candidate { - public: - typedef size_t size_type; - typedef candidate::const_iterator const_iterator; - typedef candidate::iterator iterator; + class ShallowCloneCandidate; + class ShallowClonePtrCandidate; + namespace io_v1 { + class Candidate { + public: + typedef size_t size_type; + typedef candidate::const_iterator const_iterator; + typedef candidate::iterator iterator; - /// electric charge type - typedef int Charge; - /// Lorentz vector - typedef math::XYZTLorentzVector LorentzVector; - /// Lorentz vector - typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; - /// point in the space - typedef math::XYZPoint Point; - /// point in the space - typedef math::XYZVector Vector; + /// electric charge type + typedef int Charge; + /// Lorentz vector + typedef math::XYZTLorentzVector LorentzVector; + /// Lorentz vector + typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; + /// point in the space + typedef math::XYZPoint Point; + /// point in the space + typedef math::XYZVector Vector; - enum { dimension = 3 }; - /// covariance error matrix (3x3) - typedef math::Error::type CovarianceMatrix; - /// matix size - enum { size = dimension * (dimension + 1) / 2 }; - /// index type - typedef unsigned int index; + enum { dimension = 3 }; + /// covariance error matrix (3x3) + typedef math::Error::type CovarianceMatrix; + /// matix size + enum { size = dimension * (dimension + 1) / 2 }; + /// index type + typedef unsigned int index; - /// default constructor - Candidate() {} - /// destructor - virtual ~Candidate(); - /// electric charge - virtual int charge() const = 0; - /// set electric charge - virtual void setCharge(Charge q) = 0; - /// electric charge - virtual int threeCharge() const = 0; - /// set electric charge - virtual void setThreeCharge(Charge qx3) = 0; - /// four-momentum Lorentz vector - virtual const LorentzVector& p4() const = 0; - /// four-momentum Lorentz vector - virtual const PolarLorentzVector& polarP4() const = 0; - /// spatial momentum vector - virtual Vector momentum() const = 0; - /// boost vector to boost a Lorentz vector - /// to the particle center of mass system - virtual Vector boostToCM() const = 0; - /// magnitude of momentum vector - virtual double p() const = 0; - /// energy - virtual double energy() const = 0; - /// transverse energy - virtual double et() const = 0; - /// transverse energy squared (use this for cut!) - virtual double et2() const = 0; - /// mass - virtual double mass() const = 0; - /// mass squared - virtual double massSqr() const = 0; - /// transverse mass - virtual double mt() const = 0; - /// transverse mass squared - virtual double mtSqr() const = 0; - /// x coordinate of momentum vector - virtual double px() const = 0; - /// y coordinate of momentum vector - virtual double py() const = 0; - /// z coordinate of momentum vector - virtual double pz() const = 0; - /// transverse momentum - virtual double pt() const = 0; - /// momentum azimuthal angle - virtual double phi() const = 0; - /// momentum polar angle - virtual double theta() const = 0; - /// momentum pseudorapidity - virtual double eta() const = 0; - /// rapidity - virtual double rapidity() const = 0; - /// rapidity - virtual double y() const = 0; - /// set 4-momentum - virtual void setP4(const LorentzVector& p4) = 0; - /// set 4-momentum - virtual void setP4(const PolarLorentzVector& p4) = 0; - /// set particle mass - virtual void setMass(double m) = 0; - virtual void setPz(double pz) = 0; - /// vertex position - virtual const Point& vertex() const = 0; - /// x coordinate of vertex position - virtual double vx() const = 0; - /// y coordinate of vertex position - virtual double vy() const = 0; - /// z coordinate of vertex position - virtual double vz() const = 0; - /// set vertex - virtual void setVertex(const Point& vertex) = 0; - /// PDG identifier - virtual int pdgId() const = 0; - // set PDG identifier - virtual void setPdgId(int pdgId) = 0; - /// status word - virtual int status() const = 0; - /// set status word - virtual void setStatus(int status) = 0; - /// set long lived flag - virtual void setLongLived() = 0; - /// is long lived? - virtual bool longLived() const = 0; - /// set mass constraint flag - virtual void setMassConstraint() = 0; - /// do mass constraint? - virtual bool massConstraint() const = 0; - /// returns a clone of the Candidate object - virtual Candidate* clone() const = 0; - /// first daughter const_iterator - const_iterator begin() const { return const_iterator(this, 0); } - /// last daughter const_iterator - const_iterator end() const { return const_iterator(this, numberOfDaughters()); } - /// first daughter iterator - iterator begin() { return iterator(this, 0); } - /// last daughter iterator - iterator end() { return iterator(this, numberOfDaughters()); } - /// number of daughters - virtual size_type numberOfDaughters() const = 0; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) - virtual const Candidate* daughter(size_type i) const = 0; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 - virtual Candidate* daughter(size_type i) = 0; - /// return daughter with a specified role name - virtual Candidate* daughter(const std::string& s) = 0; - /// return daughter with a specified role name - virtual const Candidate* daughter(const std::string& s) const = 0; - /// number of mothers (zero or one in most of but not all the cases) - virtual size_type numberOfMothers() const = 0; - /// return pointer to mother - virtual const Candidate* mother(size_type i = 0) const = 0; - /// return the number of source Candidates - /// ( the candidates used to construct this Candidate) - virtual size_t numberOfSourceCandidatePtrs() const = 0; - /// return a Ptr to one of the source Candidates - /// ( the candidates used to construct this Candidate) - virtual CandidatePtr sourceCandidatePtr(size_type i) const { return CandidatePtr(); } - /// \brief Set the ptr to the source Candidate. - /// - /// necessary, to allow a parallel treatment of all candidates - /// in PF2PAT. Does nothing for most Candidate classes, including - /// CompositePtrCandidates, where the source information is in fact - /// the collection of ptrs to daughters. For non-Composite Candidates, - /// this function can be used to set the ptr to the source of the - /// Candidate, which will allow to keep track - /// of the reconstruction history. - virtual void setSourceCandidatePtr(const CandidatePtr& ptr) {} + /// default constructor + Candidate() {} + /// destructor + virtual ~Candidate(); + /// electric charge + virtual int charge() const = 0; + /// set electric charge + virtual void setCharge(Charge q) = 0; + /// electric charge + virtual int threeCharge() const = 0; + /// set electric charge + virtual void setThreeCharge(Charge qx3) = 0; + /// four-momentum Lorentz vector + virtual const LorentzVector& p4() const = 0; + /// four-momentum Lorentz vector + virtual const PolarLorentzVector& polarP4() const = 0; + /// spatial momentum vector + virtual Vector momentum() const = 0; + /// boost vector to boost a Lorentz vector + /// to the particle center of mass system + virtual Vector boostToCM() const = 0; + /// magnitude of momentum vector + virtual double p() const = 0; + /// energy + virtual double energy() const = 0; + /// transverse energy + virtual double et() const = 0; + /// transverse energy squared (use this for cut!) + virtual double et2() const = 0; + /// mass + virtual double mass() const = 0; + /// mass squared + virtual double massSqr() const = 0; + /// transverse mass + virtual double mt() const = 0; + /// transverse mass squared + virtual double mtSqr() const = 0; + /// x coordinate of momentum vector + virtual double px() const = 0; + /// y coordinate of momentum vector + virtual double py() const = 0; + /// z coordinate of momentum vector + virtual double pz() const = 0; + /// transverse momentum + virtual double pt() const = 0; + /// momentum azimuthal angle + virtual double phi() const = 0; + /// momentum polar angle + virtual double theta() const = 0; + /// momentum pseudorapidity + virtual double eta() const = 0; + /// rapidity + virtual double rapidity() const = 0; + /// rapidity + virtual double y() const = 0; + /// set 4-momentum + virtual void setP4(const LorentzVector& p4) = 0; + /// set 4-momentum + virtual void setP4(const PolarLorentzVector& p4) = 0; + /// set particle mass + virtual void setMass(double m) = 0; + virtual void setPz(double pz) = 0; + /// vertex position + virtual const Point& vertex() const = 0; + /// x coordinate of vertex position + virtual double vx() const = 0; + /// y coordinate of vertex position + virtual double vy() const = 0; + /// z coordinate of vertex position + virtual double vz() const = 0; + /// set vertex + virtual void setVertex(const Point& vertex) = 0; + /// PDG identifier + virtual int pdgId() const = 0; + // set PDG identifier + virtual void setPdgId(int pdgId) = 0; + /// status word + virtual int status() const = 0; + /// set status word + virtual void setStatus(int status) = 0; + /// set long lived flag + virtual void setLongLived() = 0; + /// is long lived? + virtual bool longLived() const = 0; + /// set mass constraint flag + virtual void setMassConstraint() = 0; + /// do mass constraint? + virtual bool massConstraint() const = 0; + /// returns a clone of the Candidate object + virtual Candidate* clone() const = 0; + /// first daughter const_iterator + const_iterator begin() const { return const_iterator(this, 0); } + /// last daughter const_iterator + const_iterator end() const { return const_iterator(this, numberOfDaughters()); } + /// first daughter iterator + iterator begin() { return iterator(this, 0); } + /// last daughter iterator + iterator end() { return iterator(this, numberOfDaughters()); } + /// number of daughters + virtual size_type numberOfDaughters() const = 0; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) + virtual const Candidate* daughter(size_type i) const = 0; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 + virtual Candidate* daughter(size_type i) = 0; + /// return daughter with a specified role name + virtual Candidate* daughter(const std::string& s) = 0; + /// return daughter with a specified role name + virtual const Candidate* daughter(const std::string& s) const = 0; + /// number of mothers (zero or one in most of but not all the cases) + virtual size_type numberOfMothers() const = 0; + /// return pointer to mother + virtual const Candidate* mother(size_type i = 0) const = 0; + /// return the number of source Candidates + /// ( the candidates used to construct this Candidate) + virtual size_t numberOfSourceCandidatePtrs() const = 0; + /// return a Ptr to one of the source Candidates + /// ( the candidates used to construct this Candidate) + virtual CandidatePtr sourceCandidatePtr(size_type i) const { return CandidatePtr(); } + /// \brief Set the ptr to the source Candidate. + /// + /// necessary, to allow a parallel treatment of all candidates + /// in PF2PAT. Does nothing for most Candidate classes, including + /// CompositePtrCandidates, where the source information is in fact + /// the collection of ptrs to daughters. For non-Composite Candidates, + /// this function can be used to set the ptr to the source of the + /// Candidate, which will allow to keep track + /// of the reconstruction history. + virtual void setSourceCandidatePtr(const CandidatePtr& ptr) {} - /// chi-squares - virtual double vertexChi2() const = 0; - /** Number of degrees of freedom + /// chi-squares + virtual double vertexChi2() const = 0; + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - virtual double vertexNdof() const = 0; - /// chi-squared divided by n.d.o.f. - virtual double vertexNormalizedChi2() const = 0; - /// (i, j)-th element of error matrix, i, j = 0, ... 2 - virtual double vertexCovariance(int i, int j) const = 0; - /// fill SMatrix - virtual CovarianceMatrix vertexCovariance() const { - CovarianceMatrix m; - fillVertexCovariance(m); - return m; - } //TODO - virtual void fillVertexCovariance(CovarianceMatrix& v) const = 0; - /// returns true if this candidate has a reference to a master clone. - /// This only happens if the concrete Candidate type is ShallowCloneCandidate - virtual bool hasMasterClone() const = 0; - /// returns ptr to master clone, if existing. - /// Throws an exception unless the concrete Candidate type is ShallowCloneCandidate - virtual const CandidateBaseRef& masterClone() const = 0; - /// returns true if this candidate has a ptr to a master clone. - /// This only happens if the concrete Candidate type is ShallowClonePtrCandidate - virtual bool hasMasterClonePtr() const = 0; - /// returns ptr to master clone, if existing. - /// Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate - virtual const CandidatePtr& masterClonePtr() const = 0; - /// cast master clone reference to a concrete type - template - Ref masterRef() const { - return masterClone().template castTo(); - } - /// get a component + virtual double vertexNdof() const = 0; + /// chi-squared divided by n.d.o.f. + virtual double vertexNormalizedChi2() const = 0; + /// (i, j)-th element of error matrix, i, j = 0, ... 2 + virtual double vertexCovariance(int i, int j) const = 0; + /// fill SMatrix + virtual CovarianceMatrix vertexCovariance() const { + CovarianceMatrix m; + fillVertexCovariance(m); + return m; + } //TODO + virtual void fillVertexCovariance(CovarianceMatrix& v) const = 0; + /// returns true if this candidate has a reference to a master clone. + /// This only happens if the concrete Candidate type is ShallowCloneCandidate + virtual bool hasMasterClone() const = 0; + /// returns ptr to master clone, if existing. + /// Throws an exception unless the concrete Candidate type is ShallowCloneCandidate + virtual const CandidateBaseRef& masterClone() const = 0; + /// returns true if this candidate has a ptr to a master clone. + /// This only happens if the concrete Candidate type is ShallowClonePtrCandidate + virtual bool hasMasterClonePtr() const = 0; + /// returns ptr to master clone, if existing. + /// Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate + virtual const CandidatePtr& masterClonePtr() const = 0; + /// cast master clone reference to a concrete type + template + Ref masterRef() const { + return masterClone().template castTo(); + } + /// get a component - template - T get() const { - if (hasMasterClone()) - return masterClone()->get(); - else - return reco::get(*this); - } - /// get a component - template - T get() const { - if (hasMasterClone()) - return masterClone()->get(); - else - return reco::get(*this); - } - /// get a component - template - T get(size_type i) const { - if (hasMasterClone()) - return masterClone()->get(i); - else - return reco::get(*this, i); - } - /// get a component - template - T get(size_type i) const { - if (hasMasterClone()) - return masterClone()->get(i); - else - return reco::get(*this, i); - } - /// number of components - template - size_type numberOf() const { - if (hasMasterClone()) - return masterClone()->numberOf(); - else - return reco::numberOf(*this); - } - /// number of components - template - size_type numberOf() const { - if (hasMasterClone()) - return masterClone()->numberOf(); - else - return reco::numberOf(*this); - } + template + T get() const { + if (hasMasterClone()) + return masterClone()->get(); + else + return reco::get(*this); + } + /// get a component + template + T get() const { + if (hasMasterClone()) + return masterClone()->get(); + else + return reco::get(*this); + } + /// get a component + template + T get(size_type i) const { + if (hasMasterClone()) + return masterClone()->get(i); + else + return reco::get(*this, i); + } + /// get a component + template + T get(size_type i) const { + if (hasMasterClone()) + return masterClone()->get(i); + else + return reco::get(*this, i); + } + /// number of components + template + size_type numberOf() const { + if (hasMasterClone()) + return masterClone()->numberOf(); + else + return reco::numberOf(*this); + } + /// number of components + template + size_type numberOf() const { + if (hasMasterClone()) + return masterClone()->numberOf(); + else + return reco::numberOf(*this); + } - virtual const Track* bestTrack() const { return nullptr; } + virtual const Track* bestTrack() const { return nullptr; } - /// uncertainty on dz - virtual float dzError() const { - return 0; - } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dzError(); else return 0; } - /// uncertainty on dxy - virtual float dxyError() const { - return 0; - } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dxyError(); else return 0; } + /// uncertainty on dz + virtual float dzError() const { + return 0; + } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dzError(); else return 0; } + /// uncertainty on dxy + virtual float dxyError() const { + return 0; + } // { const Track * tr=bestTrack(); if(tr!=nullptr) return tr->dxyError(); else return 0; } - virtual bool isElectron() const = 0; - virtual bool isMuon() const = 0; - virtual bool isStandAloneMuon() const = 0; - virtual bool isGlobalMuon() const = 0; - virtual bool isTrackerMuon() const = 0; - virtual bool isCaloMuon() const = 0; - virtual bool isPhoton() const = 0; - virtual bool isConvertedPhoton() const = 0; - virtual bool isJet() const = 0; + virtual bool isElectron() const = 0; + virtual bool isMuon() const = 0; + virtual bool isStandAloneMuon() const = 0; + virtual bool isGlobalMuon() const = 0; + virtual bool isTrackerMuon() const = 0; + virtual bool isCaloMuon() const = 0; + virtual bool isPhoton() const = 0; + virtual bool isConvertedPhoton() const = 0; + virtual bool isJet() const = 0; - protected: - /// check overlap with another Candidate - virtual bool overlap(const Candidate&) const = 0; - template - friend struct component; - friend class ::OverlapChecker; - friend class ShallowCloneCandidate; - friend class ShallowClonePtrCandidate; - }; + protected: + /// check overlap with another Candidate + virtual bool overlap(const Candidate&) const = 0; + template + friend struct component; + friend class ::OverlapChecker; + friend class reco::ShallowCloneCandidate; + friend class reco::ShallowClonePtrCandidate; + }; + + } // namespace io_v1 + + using Candidate = io_v1::Candidate; namespace candidate { diff --git a/DataFormats/Candidate/interface/CandidateFwd.h b/DataFormats/Candidate/interface/CandidateFwd.h index 943e74951db7a..2d92278c75fd6 100644 --- a/DataFormats/Candidate/interface/CandidateFwd.h +++ b/DataFormats/Candidate/interface/CandidateFwd.h @@ -2,10 +2,6 @@ #define Candidate_CandidateFwd_h #include "DataFormats/Common/interface/OwnVector.h" -namespace reco { - class Candidate; -} - #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/Ptr.h" #include "DataFormats/Common/interface/PtrVector.h" @@ -16,6 +12,8 @@ namespace reco { #include "DataFormats/Common/interface/RefToBaseProd.h" #include "DataFormats/Common/interface/View.h" +#include "DataFormats/Candidate/interface/CandidateOnlyFwd.h" + namespace reco { /// collection of Candidate objects typedef edm::OwnVector CandidateCollection; diff --git a/DataFormats/Candidate/interface/CandidateOnlyFwd.h b/DataFormats/Candidate/interface/CandidateOnlyFwd.h index f5f3e09f1ca3a..8c7542fcba863 100644 --- a/DataFormats/Candidate/interface/CandidateOnlyFwd.h +++ b/DataFormats/Candidate/interface/CandidateOnlyFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_Candidate_CandidateOnlyFwd_h #define DataFormats_Candidate_CandidateOnlyFwd_h namespace reco { - class Candidate; -} + namespace io_v1 { + class Candidate; + } + using Candidate = io_v1::Candidate; +} // namespace reco #endif diff --git a/DataFormats/Candidate/interface/CandidateWithRef.h b/DataFormats/Candidate/interface/CandidateWithRef.h index 5df71c66f84bb..9d04c7df9129b 100644 --- a/DataFormats/Candidate/interface/CandidateWithRef.h +++ b/DataFormats/Candidate/interface/CandidateWithRef.h @@ -32,7 +32,7 @@ namespace reco { /// reference reference ref() const { return ref_; } - CMS_CLASS_VERSION(13) + CMS_CLASS_VERSION(3) private: /// check overlap with another candidate diff --git a/DataFormats/Candidate/interface/CompositeCandidate.h b/DataFormats/Candidate/interface/CompositeCandidate.h index 93730723ca42f..9a14f763d5654 100644 --- a/DataFormats/Candidate/interface/CompositeCandidate.h +++ b/DataFormats/Candidate/interface/CompositeCandidate.h @@ -17,77 +17,81 @@ #include namespace reco { + namespace io_v1 { - class CompositeCandidate : public LeafCandidate { - public: - /// collection of daughters - typedef CandidateCollection daughters; - typedef std::vector role_collection; - /// default constructor - CompositeCandidate(std::string name = "") : LeafCandidate(), name_(name) {} - /// constructor from values - template - CompositeCandidate(Charge q, - const P4& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 0, - int status = 0, - bool integerCharge = true, - std::string name = "") - : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name) {} - /// constructor from values - explicit CompositeCandidate(const Candidate& p, const std::string& name = ""); - /// constructor from values - explicit CompositeCandidate(const Candidate& p, const std::string& name, role_collection const& roles); - /// destructor - ~CompositeCandidate() override; - /// get the name of the candidate - std::string name() const { return name_; } - /// set the name of the candidate - void setName(std::string name) { name_ = name; } - /// get the roles - role_collection const& roles() const { return roles_; } - /// set the roles - void setRoles(const role_collection& roles) { - roles_.clear(); - roles_ = roles; - } - /// returns a clone of the candidate - CompositeCandidate* clone() const override; - /// number of daughters - size_type numberOfDaughters() const override; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) - const Candidate* daughter(size_type) const override; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 - Candidate* daughter(size_type) override; - // Get candidate based on role - Candidate* daughter(const std::string& s) override; - const Candidate* daughter(const std::string& s) const override; - /// add a clone of the passed candidate as daughter - void addDaughter(const Candidate&, const std::string& s = ""); - /// add a clone of the passed candidate as daughter - void addDaughter(std::unique_ptr, const std::string& s = ""); - /// clear daughters - void clearDaughters() { dau.clear(); } - // clear roles - void clearRoles() { roles_.clear(); } - // Apply the roles to the objects - void applyRoles(); - /// number of mothers (zero or one in most of but not all the cases) - size_type numberOfMothers() const override; - /// return pointer to mother - const Candidate* mother(size_type i = 0) const override; + class CompositeCandidate : public LeafCandidate { + public: + /// collection of daughters + typedef CandidateCollection daughters; + typedef std::vector role_collection; + /// default constructor + CompositeCandidate(std::string name = "") : LeafCandidate(), name_(name) {} + /// constructor from values + template + CompositeCandidate(Charge q, + const P4& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 0, + int status = 0, + bool integerCharge = true, + std::string name = "") + : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge), name_(name) {} + /// constructor from values + explicit CompositeCandidate(const Candidate& p, const std::string& name = ""); + /// constructor from values + explicit CompositeCandidate(const Candidate& p, const std::string& name, role_collection const& roles); + /// destructor + ~CompositeCandidate() override; + /// get the name of the candidate + std::string name() const { return name_; } + /// set the name of the candidate + void setName(std::string name) { name_ = name; } + /// get the roles + role_collection const& roles() const { return roles_; } + /// set the roles + void setRoles(const role_collection& roles) { + roles_.clear(); + roles_ = roles; + } + /// returns a clone of the candidate + CompositeCandidate* clone() const override; + /// number of daughters + size_type numberOfDaughters() const override; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) + const Candidate* daughter(size_type) const override; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 + Candidate* daughter(size_type) override; + // Get candidate based on role + Candidate* daughter(const std::string& s) override; + const Candidate* daughter(const std::string& s) const override; + /// add a clone of the passed candidate as daughter + void addDaughter(const Candidate&, const std::string& s = ""); + /// add a clone of the passed candidate as daughter + void addDaughter(std::unique_ptr, const std::string& s = ""); + /// clear daughters + void clearDaughters() { dau.clear(); } + // clear roles + void clearRoles() { roles_.clear(); } + // Apply the roles to the objects + void applyRoles(); + /// number of mothers (zero or one in most of but not all the cases) + size_type numberOfMothers() const override; + /// return pointer to mother + const Candidate* mother(size_type i = 0) const override; - private: - /// collection of daughters - daughters dau; - /// check overlap with another daughter - bool overlap(const Candidate&) const override; - /// candidate name - std::string name_; - /// candidate roles - role_collection roles_; - }; + private: + /// collection of daughters + daughters dau; + /// check overlap with another daughter + bool overlap(const Candidate&) const override; + /// candidate name + std::string name_; + /// candidate roles + role_collection roles_; + }; + + } // namespace io_v1 + using CompositeCandidate = io_v1::CompositeCandidate; } // namespace reco diff --git a/DataFormats/Candidate/interface/CompositeCandidateFwd.h b/DataFormats/Candidate/interface/CompositeCandidateFwd.h index f97279e182f54..d5270cac46c4c 100644 --- a/DataFormats/Candidate/interface/CompositeCandidateFwd.h +++ b/DataFormats/Candidate/interface/CompositeCandidateFwd.h @@ -3,8 +3,11 @@ #include "DataFormats/Common/interface/OwnVector.h" namespace reco { - class CompositeCandidate; -} + namespace io_v1 { + class CompositeCandidate; + } + using CompositeCandidate = io_v1::CompositeCandidate; +} // namespace reco #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" diff --git a/DataFormats/Candidate/interface/CompositePtrCandidate.h b/DataFormats/Candidate/interface/CompositePtrCandidate.h index 19db7759173dc..fc2bf508dc554 100644 --- a/DataFormats/Candidate/interface/CompositePtrCandidate.h +++ b/DataFormats/Candidate/interface/CompositePtrCandidate.h @@ -13,75 +13,79 @@ */ namespace reco { + namespace io_v1 { - class CompositePtrCandidate : public LeafCandidate { - public: - /// collection of references to daughters - typedef std::vector daughters; - /// collection of references to daughters - typedef std::vector mothers; - /// default constructor - CompositePtrCandidate() : LeafCandidate() {} - /// constructor from values - CompositePtrCandidate(Charge q, - const LorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 0, - int status = 0, - bool integerCharge = true) - : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {} - /// constructor from values - CompositePtrCandidate(Charge q, - const PolarLorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 0, - int status = 0, - bool integerCharge = true) - : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {} - /// constructor from a Candidate - explicit CompositePtrCandidate(const Candidate& p) : LeafCandidate(p) {} - /// destructor - ~CompositePtrCandidate() override; - /// returns a clone of the candidate - CompositePtrCandidate* clone() const override; - /// number of daughters - size_t numberOfDaughters() const override; - /// number of mothers - size_t numberOfMothers() const override; - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) - const Candidate* daughter(size_type) const override; - using reco::LeafCandidate::daughter; // avoid hiding the base - /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 - Candidate* daughter(size_type) override; - /// add a daughter via a reference - void addDaughter(const CandidatePtr&); - /// clear daughter references - virtual void clearDaughters() { dau.clear(); } - /// reference to daughter at given position - virtual CandidatePtr daughterPtr(size_type i) const { return dau[i]; } - /// references to daughtes - virtual const daughters& daughterPtrVector() const { return dau; } - /// return pointer to mother - const Candidate* mother(size_t i = 0) const override; - /// number of source candidates - /// ( the candidates used to construct this Candidate). - /// for CompositeRefBaseCandidates, the source candidates - /// are the daughters. - size_type numberOfSourceCandidatePtrs() const override; - /// return a RefToBase to one of the source Candidates - /// ( the candidates used to construct this Candidate). - /// for CompositeRefBaseCandidates, the source candidates - /// are the daughters. - CandidatePtr sourceCandidatePtr(size_type i) const override; + class CompositePtrCandidate : public LeafCandidate { + public: + /// collection of references to daughters + typedef std::vector daughters; + /// collection of references to daughters + typedef std::vector mothers; + /// default constructor + CompositePtrCandidate() : LeafCandidate() {} + /// constructor from values + CompositePtrCandidate(Charge q, + const LorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 0, + int status = 0, + bool integerCharge = true) + : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {} + /// constructor from values + CompositePtrCandidate(Charge q, + const PolarLorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 0, + int status = 0, + bool integerCharge = true) + : LeafCandidate(q, p4, vtx, pdgId, status, integerCharge) {} + /// constructor from a Candidate + explicit CompositePtrCandidate(const Candidate& p) : LeafCandidate(p) {} + /// destructor + ~CompositePtrCandidate() override; + /// returns a clone of the candidate + CompositePtrCandidate* clone() const override; + /// number of daughters + size_t numberOfDaughters() const override; + /// number of mothers + size_t numberOfMothers() const override; + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) + const Candidate* daughter(size_type) const override; + using reco::LeafCandidate::daughter; // avoid hiding the base + /// return daughter at a given position, i = 0, ... numberOfDaughters() - 1 + Candidate* daughter(size_type) override; + /// add a daughter via a reference + void addDaughter(const CandidatePtr&); + /// clear daughter references + virtual void clearDaughters() { dau.clear(); } + /// reference to daughter at given position + virtual CandidatePtr daughterPtr(size_type i) const { return dau[i]; } + /// references to daughtes + virtual const daughters& daughterPtrVector() const { return dau; } + /// return pointer to mother + const Candidate* mother(size_t i = 0) const override; + /// number of source candidates + /// ( the candidates used to construct this Candidate). + /// for CompositeRefBaseCandidates, the source candidates + /// are the daughters. + size_type numberOfSourceCandidatePtrs() const override; + /// return a RefToBase to one of the source Candidates + /// ( the candidates used to construct this Candidate). + /// for CompositeRefBaseCandidates, the source candidates + /// are the daughters. + CandidatePtr sourceCandidatePtr(size_type i) const override; - private: - /// collection of references to daughters - daughters dau; - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - }; + private: + /// collection of references to daughters + daughters dau; + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + }; - inline void CompositePtrCandidate::addDaughter(const CandidatePtr& cand) { dau.push_back(cand); } + inline void CompositePtrCandidate::addDaughter(const CandidatePtr& cand) { dau.push_back(cand); } + + } // namespace io_v1 + using CompositePtrCandidate = io_v1::CompositePtrCandidate; } // namespace reco diff --git a/DataFormats/Candidate/interface/CompositeRefCandidateT.h b/DataFormats/Candidate/interface/CompositeRefCandidateT.h index fbc5067c12c42..8b71195c94663 100644 --- a/DataFormats/Candidate/interface/CompositeRefCandidateT.h +++ b/DataFormats/Candidate/interface/CompositeRefCandidateT.h @@ -78,7 +78,7 @@ namespace reco { /// set mother product ID void resetMothers(const edm::ProductID& id) { mom = mothers(id); } - CMS_CLASS_VERSION(13) + CMS_CLASS_VERSION(3) private: /// collection of references to daughters diff --git a/DataFormats/Candidate/interface/LeafRefCandidateT.h b/DataFormats/Candidate/interface/LeafRefCandidateT.h index 7651ecafd0afe..45ca199f8a18d 100644 --- a/DataFormats/Candidate/interface/LeafRefCandidateT.h +++ b/DataFormats/Candidate/interface/LeafRefCandidateT.h @@ -13,170 +13,169 @@ #include "DataFormats/Common/interface/RefCoreWithIndex.h" namespace reco { - - class LeafRefCandidateT : public LeafCandidate { - public: - /// collection of daughter candidates - typedef CandidateCollection daughters; - /// electric charge type - typedef int Charge; - /// Lorentz vector - typedef math::XYZTLorentzVector LorentzVector; - /// Lorentz vector - typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; - /// point in the space - typedef math::XYZPoint Point; - /// point in the space - typedef math::XYZVector Vector; - - typedef unsigned int index; - - /// default constructor - LeafRefCandidateT() {} - // constructor from T - template - LeafRefCandidateT(const REF& c, float m) - : LeafCandidate(c->charge(), PolarLorentzVector(c->pt(), c->eta(), c->phi(), m), c->vertex()), - ref_(c.refCore(), c.key()) {} - /// destructor - ~LeafRefCandidateT() override {} - - protected: - // get the ref (better be the correct ref!) - template - REF getRef() const { - return REF(ref_.toRefCore(), ref_.index()); - } - - public: - /// number of daughters - size_t numberOfDaughters() const final { return 0; } - /// return daughter at a given position (throws an exception) - const Candidate* daughter(size_type) const final { return nullptr; } - /// number of mothers - size_t numberOfMothers() const final { return 0; } - /// return mother at a given position (throws an exception) - const Candidate* mother(size_type) const final { return nullptr; } - /// return daughter at a given position (throws an exception) - Candidate* daughter(size_type) final { return nullptr; } - /// return daughter with a specified role name - Candidate* daughter(const std::string& s) final { return nullptr; } - /// return daughter with a specified role name - const Candidate* daughter(const std::string& s) const final { return nullptr; } - /// return the number of source Candidates - /// ( the candidates used to construct this Candidate) - size_t numberOfSourceCandidatePtrs() const final { return 0; } - /// return a Ptr to one of the source Candidates - /// ( the candidates used to construct this Candidate) - CandidatePtr sourceCandidatePtr(size_type i) const final { - static const CandidatePtr dummyPtr; - return dummyPtr; - } - - /// This only happens if the concrete Candidate type is ShallowCloneCandidate - bool hasMasterClone() const final { return false; } - /// returns ptr to master clone, if existing. - /// Throws an exception unless the concrete Candidate type is ShallowCloneCandidate - const CandidateBaseRef& masterClone() const final { - static const CandidateBaseRef dummyRef; - return dummyRef; - } - /// returns true if this candidate has a ptr to a master clone. - /// This only happens if the concrete Candidate type is ShallowClonePtrCandidate - bool hasMasterClonePtr() const final { return false; } - /// returns ptr to master clone, if existing. - /// Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate - const CandidatePtr& masterClonePtr() const final { - static const CandidatePtr dummyPtr; - return dummyPtr; - } - - /// cast master clone reference to a concrete type - template - Ref masterRef() const { - Ref dummyRef; - return dummyRef; - } - /// get a component - - template - C get() const { - if (hasMasterClone()) - return masterClone()->template get(); - else - return reco::get(*this); - } - /// get a component - template - C get() const { - if (hasMasterClone()) - return masterClone()->template get(); - else - return reco::get(*this); - } - /// get a component - template - C get(size_type i) const { - if (hasMasterClone()) - return masterClone()->template get(i); - else - return reco::get(*this, i); - } - /// get a component - template - C get(size_type i) const { - if (hasMasterClone()) - return masterClone()->template get(i); - else - return reco::get(*this, i); - } - /// number of components - template - size_type numberOf() const { - if (hasMasterClone()) - return masterClone()->template numberOf(); - else - return reco::numberOf(*this); - } - /// number of components - template - size_type numberOf() const { - if (hasMasterClone()) - return masterClone()->template numberOf(); - else - return reco::numberOf(*this); - } - - bool isElectron() const final { return false; } - bool isMuon() const final { return false; } - bool isStandAloneMuon() const final { return false; } - bool isGlobalMuon() const final { return false; } - bool isTrackerMuon() const final { return false; } - bool isCaloMuon() const final { return false; } - bool isPhoton() const final { return false; } - bool isConvertedPhoton() const final { return false; } - bool isJet() const final { return false; } - - CMS_CLASS_VERSION(13) - - protected: - /// check overlap with another Candidate - bool overlap(const Candidate&) const override; - virtual bool overlap(const LeafRefCandidateT&) const; - template - friend struct component; - friend class ::OverlapChecker; - friend class ShallowCloneCandidate; - friend class ShallowClonePtrCandidate; - - protected: - edm::RefCoreWithIndex ref_; - - private: - /// - /// Hide these from all users: - /// - /* + namespace io_v1 { + + class LeafRefCandidateT : public LeafCandidate { + public: + /// collection of daughter candidates + typedef CandidateCollection daughters; + /// electric charge type + typedef int Charge; + /// Lorentz vector + typedef math::XYZTLorentzVector LorentzVector; + /// Lorentz vector + typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; + /// point in the space + typedef math::XYZPoint Point; + /// point in the space + typedef math::XYZVector Vector; + + typedef unsigned int index; + + /// default constructor + LeafRefCandidateT() {} + // constructor from T + template + LeafRefCandidateT(const REF& c, float m) + : LeafCandidate(c->charge(), PolarLorentzVector(c->pt(), c->eta(), c->phi(), m), c->vertex()), + ref_(c.refCore(), c.key()) {} + /// destructor + ~LeafRefCandidateT() override {} + + protected: + // get the ref (better be the correct ref!) + template + REF getRef() const { + return REF(ref_.toRefCore(), ref_.index()); + } + + public: + /// number of daughters + size_t numberOfDaughters() const final { return 0; } + /// return daughter at a given position (throws an exception) + const Candidate* daughter(size_type) const final { return nullptr; } + /// number of mothers + size_t numberOfMothers() const final { return 0; } + /// return mother at a given position (throws an exception) + const Candidate* mother(size_type) const final { return nullptr; } + /// return daughter at a given position (throws an exception) + Candidate* daughter(size_type) final { return nullptr; } + /// return daughter with a specified role name + Candidate* daughter(const std::string& s) final { return nullptr; } + /// return daughter with a specified role name + const Candidate* daughter(const std::string& s) const final { return nullptr; } + /// return the number of source Candidates + /// ( the candidates used to construct this Candidate) + size_t numberOfSourceCandidatePtrs() const final { return 0; } + /// return a Ptr to one of the source Candidates + /// ( the candidates used to construct this Candidate) + CandidatePtr sourceCandidatePtr(size_type i) const final { + static const CandidatePtr dummyPtr; + return dummyPtr; + } + + /// This only happens if the concrete Candidate type is ShallowCloneCandidate + bool hasMasterClone() const final { return false; } + /// returns ptr to master clone, if existing. + /// Throws an exception unless the concrete Candidate type is ShallowCloneCandidate + const CandidateBaseRef& masterClone() const final { + static const CandidateBaseRef dummyRef; + return dummyRef; + } + /// returns true if this candidate has a ptr to a master clone. + /// This only happens if the concrete Candidate type is ShallowClonePtrCandidate + bool hasMasterClonePtr() const final { return false; } + /// returns ptr to master clone, if existing. + /// Throws an exception unless the concrete Candidate type is ShallowClonePtrCandidate + const CandidatePtr& masterClonePtr() const final { + static const CandidatePtr dummyPtr; + return dummyPtr; + } + + /// cast master clone reference to a concrete type + template + Ref masterRef() const { + Ref dummyRef; + return dummyRef; + } + /// get a component + + template + C get() const { + if (hasMasterClone()) + return masterClone()->template get(); + else + return reco::get(*this); + } + /// get a component + template + C get() const { + if (hasMasterClone()) + return masterClone()->template get(); + else + return reco::get(*this); + } + /// get a component + template + C get(size_type i) const { + if (hasMasterClone()) + return masterClone()->template get(i); + else + return reco::get(*this, i); + } + /// get a component + template + C get(size_type i) const { + if (hasMasterClone()) + return masterClone()->template get(i); + else + return reco::get(*this, i); + } + /// number of components + template + size_type numberOf() const { + if (hasMasterClone()) + return masterClone()->template numberOf(); + else + return reco::numberOf(*this); + } + /// number of components + template + size_type numberOf() const { + if (hasMasterClone()) + return masterClone()->template numberOf(); + else + return reco::numberOf(*this); + } + + bool isElectron() const final { return false; } + bool isMuon() const final { return false; } + bool isStandAloneMuon() const final { return false; } + bool isGlobalMuon() const final { return false; } + bool isTrackerMuon() const final { return false; } + bool isCaloMuon() const final { return false; } + bool isPhoton() const final { return false; } + bool isConvertedPhoton() const final { return false; } + bool isJet() const final { return false; } + + protected: + /// check overlap with another Candidate + bool overlap(const Candidate&) const override; + virtual bool overlap(const LeafRefCandidateT&) const; + template + friend struct component; + friend class ::OverlapChecker; + friend class ShallowCloneCandidate; + friend class ShallowClonePtrCandidate; + + protected: + edm::RefCoreWithIndex ref_; + + private: + /// + /// Hide these from all users: + /// + /* virtual void setCharge( Charge q ) final {} virtual void setThreeCharge( Charge qx3 ) final {} virtual void setP4( const LorentzVector & p4 ) final {} @@ -194,15 +193,18 @@ namespace reco { virtual double vertexCovariance(int i, int j) const final { return 0.; } virtual void fillVertexCovariance(CovarianceMatrix & v) const final {} */ - }; + }; + + inline bool LeafRefCandidateT::overlap(const Candidate& o) const { + return (p4() == o.p4()) && (vertex() == o.vertex()) && (charge() == o.charge()); + } - inline bool LeafRefCandidateT::overlap(const Candidate& o) const { - return (p4() == o.p4()) && (vertex() == o.vertex()) && (charge() == o.charge()); - } + inline bool LeafRefCandidateT::overlap(const LeafRefCandidateT& o) const { + return (ref_.id() == o.ref_.id()) && (ref_.index() == o.ref_.index()); + } - inline bool LeafRefCandidateT::overlap(const LeafRefCandidateT& o) const { - return (ref_.id() == o.ref_.id()) && (ref_.index() == o.ref_.index()); - } + } // namespace io_v1 + using LeafRefCandidateT = io_v1::LeafRefCandidateT; } // namespace reco diff --git a/DataFormats/Candidate/interface/VertexCompositeCandidate.h b/DataFormats/Candidate/interface/VertexCompositeCandidate.h index 5ea32d742e812..1bc6e5b88d2b1 100644 --- a/DataFormats/Candidate/interface/VertexCompositeCandidate.h +++ b/DataFormats/Candidate/interface/VertexCompositeCandidate.h @@ -13,69 +13,72 @@ #include "DataFormats/Candidate/interface/CompositeCandidate.h" namespace reco { - class VertexCompositeCandidate : public CompositeCandidate { - public: - VertexCompositeCandidate() : CompositeCandidate() {} - /// constructor from values - VertexCompositeCandidate( - Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) - : CompositeCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0) {} - /// constructor from values - VertexCompositeCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - const CovarianceMatrix &err, - double chi2, - double ndof, - int pdgId = 0, - int status = 0, - bool integerCharge = true); - /// constructor from values - explicit VertexCompositeCandidate(const Candidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} - /// constructor from values - explicit VertexCompositeCandidate(const CompositeCandidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} - /// destructor - ~VertexCompositeCandidate() override; - /// returns a clone of the candidate - VertexCompositeCandidate *clone() const override; - /// chi-squares - double vertexChi2() const override { return chi2_; } - /** Number of degrees of freedom + namespace io_v1 { + class VertexCompositeCandidate : public CompositeCandidate { + public: + VertexCompositeCandidate() : CompositeCandidate() {} + /// constructor from values + VertexCompositeCandidate( + Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) + : CompositeCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0) {} + /// constructor from values + VertexCompositeCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + const CovarianceMatrix &err, + double chi2, + double ndof, + int pdgId = 0, + int status = 0, + bool integerCharge = true); + /// constructor from values + explicit VertexCompositeCandidate(const Candidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} + /// constructor from values + explicit VertexCompositeCandidate(const CompositeCandidate &p) : CompositeCandidate(p), chi2_(0), ndof_(0) {} + /// destructor + ~VertexCompositeCandidate() override; + /// returns a clone of the candidate + VertexCompositeCandidate *clone() const override; + /// chi-squares + double vertexChi2() const override { return chi2_; } + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - double vertexNdof() const override { return ndof_; } - /// chi-squared divided by n.d.o.f. - double vertexNormalizedChi2() const override { return chi2_ / ndof_; } - /// (i, j)-th element of error matrix, i, j = 0, ... 2 - double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } - using reco::LeafCandidate::vertexCovariance; // avoid hiding the - /// fill SMatrix - void fillVertexCovariance(CovarianceMatrix &v) const override; - /// set chi2 and ndof - void setChi2AndNdof(double chi2, double ndof) { - chi2_ = chi2; - ndof_ = ndof; - } - /// set covariance matrix - void setCovariance(const CovarianceMatrix &m); + double vertexNdof() const override { return ndof_; } + /// chi-squared divided by n.d.o.f. + double vertexNormalizedChi2() const override { return chi2_ / ndof_; } + /// (i, j)-th element of error matrix, i, j = 0, ... 2 + double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } + using reco::LeafCandidate::vertexCovariance; // avoid hiding the + /// fill SMatrix + void fillVertexCovariance(CovarianceMatrix &v) const override; + /// set chi2 and ndof + void setChi2AndNdof(double chi2, double ndof) { + chi2_ = chi2; + ndof_ = ndof; + } + /// set covariance matrix + void setCovariance(const CovarianceMatrix &m); - private: - /// chi-sqared - Double32_t chi2_; - /// number of degrees of freedom - Double32_t ndof_; - /// covariance matrix (3x3) as vector - Double32_t covariance_[size]; - /// position index - index idx(index i, index j) const { - int a = (i <= j ? i : j), b = (i <= j ? j : i); - return b * (b + 1) / 2 + a; - } - }; + private: + /// chi-sqared + Double32_t chi2_; + /// number of degrees of freedom + Double32_t ndof_; + /// covariance matrix (3x3) as vector + Double32_t covariance_[size]; + /// position index + index idx(index i, index j) const { + int a = (i <= j ? i : j), b = (i <= j ? j : i); + return b * (b + 1) / 2 + a; + } + }; + } // namespace io_v1 + using VertexCompositeCandidate = io_v1::VertexCompositeCandidate; } // namespace reco #endif diff --git a/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h b/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h index df47f0975725d..9a7716e4a3f06 100644 --- a/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h +++ b/DataFormats/Candidate/interface/VertexCompositeCandidateFwd.h @@ -2,10 +2,7 @@ #define DataFormats_Candidate_VertexCompositeCandidateFwd_h #include "DataFormats/Common/interface/OwnVector.h" -namespace reco { - class VertexCompositeCandidate; -} - +#include "DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" #include "DataFormats/Common/interface/RefVector.h" diff --git a/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h b/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h index 9be4756e0a4fe..05f6551a5b3ca 100644 --- a/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h +++ b/DataFormats/Candidate/interface/VertexCompositeCandidateOnlyFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_Candidate_VertexCompositeCandidateOnlyFwd_h #define DataFormats_Candidate_VertexCompositeCandidateOnlyFwd_h namespace reco { - class VertexCompositeCandidate; -} + namespace io_v1 { + class VertexCompositeCandidate; + } + using VertexCompositeCandidate = io_v1::VertexCompositeCandidate; +} // namespace reco #endif diff --git a/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h b/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h index 71a0348b302a0..cf261f21f786b 100644 --- a/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h +++ b/DataFormats/Candidate/interface/VertexCompositePtrCandidate.h @@ -13,130 +13,134 @@ #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" namespace reco { - class VertexCompositePtrCandidate : public CompositePtrCandidate { - public: - enum { dimension4D = 4 }; - /// covariance error matrix (3x3) - typedef math::Error::type CovarianceMatrix4D; - /// matix size - enum { size4D = dimension4D * (dimension4D + 1) / 2 }; + namespace io_v1 { + class VertexCompositePtrCandidate : public CompositePtrCandidate { + public: + enum { dimension4D = 4 }; + /// covariance error matrix (3x3) + typedef math::Error::type CovarianceMatrix4D; + /// matix size + enum { size4D = dimension4D * (dimension4D + 1) / 2 }; - VertexCompositePtrCandidate() : CompositePtrCandidate(), chi2_(0), ndof_(0), time_(0) {} - /// constructor from values - VertexCompositePtrCandidate( - Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(0) {} - VertexCompositePtrCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - double time, - int pdgId = 0, - int status = 0, - bool integerCharge = true) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(time) {} - /// constructor from values - VertexCompositePtrCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - const CovarianceMatrix &err, - double chi2, - double ndof, - int pdgId = 0, - int status = 0, - bool integerCharge = true); - VertexCompositePtrCandidate(Charge q, - const LorentzVector &p4, - const Point &vtx, - double time, - const CovarianceMatrix4D &err, - double chi2, - double ndof, - int pdgId = 0, - int status = 0, - bool integerCharge = true); - /// constructor from values - explicit VertexCompositePtrCandidate(const Candidate &p) : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} - /// constructor from values - explicit VertexCompositePtrCandidate(const CompositePtrCandidate &p) - : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} - /// destructor - ~VertexCompositePtrCandidate() override; - /// returns a clone of the candidate - VertexCompositePtrCandidate *clone() const override; + VertexCompositePtrCandidate() : CompositePtrCandidate(), chi2_(0), ndof_(0), time_(0) {} + /// constructor from values + VertexCompositePtrCandidate( + Charge q, const LorentzVector &p4, const Point &vtx, int pdgId = 0, int status = 0, bool integerCharge = true) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(0) {} + VertexCompositePtrCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + double time, + int pdgId = 0, + int status = 0, + bool integerCharge = true) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), chi2_(0), ndof_(0), time_(time) {} + /// constructor from values + VertexCompositePtrCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + const CovarianceMatrix &err, + double chi2, + double ndof, + int pdgId = 0, + int status = 0, + bool integerCharge = true); + VertexCompositePtrCandidate(Charge q, + const LorentzVector &p4, + const Point &vtx, + double time, + const CovarianceMatrix4D &err, + double chi2, + double ndof, + int pdgId = 0, + int status = 0, + bool integerCharge = true); + /// constructor from values + explicit VertexCompositePtrCandidate(const Candidate &p) + : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} + /// constructor from values + explicit VertexCompositePtrCandidate(const CompositePtrCandidate &p) + : CompositePtrCandidate(p), chi2_(0), ndof_(0), time_(0) {} + /// destructor + ~VertexCompositePtrCandidate() override; + /// returns a clone of the candidate + VertexCompositePtrCandidate *clone() const override; - /// chi-squares - double vertexChi2() const override { return chi2_; } - /** Number of degrees of freedom + /// chi-squares + double vertexChi2() const override { return chi2_; } + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - double vertexNdof() const override { return ndof_; } - /// chi-squared divided by n.d.o.f. - double vertexNormalizedChi2() const override { return chi2_ / ndof_; } - /// (i, j)-th element of error matrix, i, j = 0, ... 3 - double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } - using reco::LeafCandidate::vertexCovariance; // avoid hiding the - /// return SMatrix 4D - CovarianceMatrix4D vertexCovariance4D() const { - CovarianceMatrix4D m; - fillVertexCovariance(m); - return m; - } + double vertexNdof() const override { return ndof_; } + /// chi-squared divided by n.d.o.f. + double vertexNormalizedChi2() const override { return chi2_ / ndof_; } + /// (i, j)-th element of error matrix, i, j = 0, ... 3 + double vertexCovariance(int i, int j) const override { return covariance_[idx(i, j)]; } + using reco::LeafCandidate::vertexCovariance; // avoid hiding the + /// return SMatrix 4D + CovarianceMatrix4D vertexCovariance4D() const { + CovarianceMatrix4D m; + fillVertexCovariance(m); + return m; + } - /// fill SMatrix - void fillVertexCovariance(CovarianceMatrix &v) const override; - /// 4D version - void fillVertexCovariance(CovarianceMatrix4D &v) const; + /// fill SMatrix + void fillVertexCovariance(CovarianceMatrix &v) const override; + /// 4D version + void fillVertexCovariance(CovarianceMatrix4D &v) const; - /// set chi2 and ndof - void setChi2AndNdof(double chi2, double ndof) { - chi2_ = chi2; - ndof_ = ndof; - } - /// set covariance matrix - void setCovariance(const CovarianceMatrix &m); - /// set covariance matrix - void setCovariance(const CovarianceMatrix4D &m); + /// set chi2 and ndof + void setChi2AndNdof(double chi2, double ndof) { + chi2_ = chi2; + ndof_ = ndof; + } + /// set covariance matrix + void setCovariance(const CovarianceMatrix &m); + /// set covariance matrix + void setCovariance(const CovarianceMatrix4D &m); - // set time - void setTime(double time) { time_ = time; } + // set time + void setTime(double time) { time_ = time; } - /// the following functions are implemented to have a more consistent interface with the one of reco::Vertex - typedef math::Error::type Error; - typedef math::Error::type Error4D; - const Point &position() const { return vertex(); } - double t() const { return time_; } - double tError() const { return std::sqrt(vertexCovariance(3, 3)); } - Error error() const { - Error m; - fillVertexCovariance(m); - return m; - } - /// return SMatrix 4D - Error4D error4D() const { - Error4D m; - fillVertexCovariance(m); - return m; - } + /// the following functions are implemented to have a more consistent interface with the one of reco::Vertex + typedef math::Error::type Error; + typedef math::Error::type Error4D; + const Point &position() const { return vertex(); } + double t() const { return time_; } + double tError() const { return std::sqrt(vertexCovariance(3, 3)); } + Error error() const { + Error m; + fillVertexCovariance(m); + return m; + } + /// return SMatrix 4D + Error4D error4D() const { + Error4D m; + fillVertexCovariance(m); + return m; + } - private: - /// chi-sqared - Double32_t chi2_; - /// number of degrees of freedom - Double32_t ndof_; - /// covariance matrix (4x4) as vector - Double32_t covariance_[size4D]; - /// vertex time - Double32_t time_; - /// position index - index idx(index i, index j) const { - int a = (i <= j ? i : j), b = (i <= j ? j : i); - return b * (b + 1) / 2 + a; - } - }; + private: + /// chi-sqared + Double32_t chi2_; + /// number of degrees of freedom + Double32_t ndof_; + /// covariance matrix (4x4) as vector + Double32_t covariance_[size4D]; + /// vertex time + Double32_t time_; + /// position index + index idx(index i, index j) const { + int a = (i <= j ? i : j), b = (i <= j ? j : i); + return b * (b + 1) / 2 + a; + } + }; + } // namespace io_v1 + using VertexCompositePtrCandidate = io_v1::VertexCompositePtrCandidate; } // namespace reco #endif diff --git a/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h b/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h index dbe7f45239147..081c1ec5fd117 100644 --- a/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h +++ b/DataFormats/Candidate/interface/VertexCompositePtrCandidateFwd.h @@ -3,8 +3,11 @@ #include "DataFormats/Common/interface/OwnVector.h" namespace reco { - class VertexCompositePtrCandidate; -} + namespace io_v1 { + class VertexCompositePtrCandidate; + } + using VertexCompositePtrCandidate = io_v1::VertexCompositePtrCandidate; +} // namespace reco #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/RefProd.h" diff --git a/DataFormats/Candidate/src/CompositePtrCandidate.cc b/DataFormats/Candidate/src/CompositePtrCandidate.cc index c8403e26628be..44d339de36543 100644 --- a/DataFormats/Candidate/src/CompositePtrCandidate.cc +++ b/DataFormats/Candidate/src/CompositePtrCandidate.cc @@ -2,6 +2,7 @@ #include "FWCore/Utilities/interface/Exception.h" using namespace reco; +using namespace reco::io_v1; CompositePtrCandidate::~CompositePtrCandidate() {} diff --git a/DataFormats/Candidate/src/classes_def.xml b/DataFormats/Candidate/src/classes_def.xml index ee6e5fdb20de6..a745badd03f9a 100644 --- a/DataFormats/Candidate/src/classes_def.xml +++ b/DataFormats/Candidate/src/classes_def.xml @@ -1,7 +1,7 @@ - - + + @@ -11,109 +11,60 @@ setCartesian();]]> - - - - + + - - construct(onfile.qx3_, onfile.pt_,onfile.eta_,onfile.phi_,onfile.mass_,onfile.vertex_, onfile.pdgId_, onfile.status_); - ]]> - - - - + + - - - - - + + - - construct(onfile.qx3_, onfile.pt_,onfile.eta_,onfile.phi_,onfile.mass_,onfile.vertex_, onfile.pdgId_, onfile.status_); - ]]> - - - - - + + + + + + - - - - + + - - - - - - + + - - - - - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - - + + - - - + + - - - - + + @@ -125,32 +76,32 @@ - - - + + + - - - - - - - - - - + + + + + + + + + + - - + + - + - - + + @@ -158,51 +109,51 @@ - + - - + + - - + + - + - + - + - + - + - + - + - + - + - + @@ -217,53 +168,53 @@ - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - + - + - + - + - + - + - - + + - + - + @@ -271,26 +222,26 @@ - - + + - + - - - + + + - - + + - - + + - + diff --git a/DataFormats/CastorReco/src/classes_def.xml b/DataFormats/CastorReco/src/classes_def.xml index 71a4d04b0ad3a..291c1ddd545bc 100644 --- a/DataFormats/CastorReco/src/classes_def.xml +++ b/DataFormats/CastorReco/src/classes_def.xml @@ -1,7 +1,7 @@ - - + + @@ -13,10 +13,8 @@ --> - - - - + + @@ -26,8 +24,8 @@ - - + + @@ -36,9 +34,8 @@ - - - + + @@ -47,9 +44,8 @@ - - - + + diff --git a/DataFormats/Common/interface/Association.h b/DataFormats/Common/interface/Association.h index 053451cf845d4..cd3b22179ff4f 100644 --- a/DataFormats/Common/interface/Association.h +++ b/DataFormats/Common/interface/Association.h @@ -87,7 +87,7 @@ namespace edm { using base::id_offset_vector; //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: refprod_type ref_; diff --git a/DataFormats/Common/interface/AssociationMap.h b/DataFormats/Common/interface/AssociationMap.h index 259d7d95133d4..62f24ccf44da5 100644 --- a/DataFormats/Common/interface/AssociationMap.h +++ b/DataFormats/Common/interface/AssociationMap.h @@ -242,7 +242,7 @@ namespace edm { }; //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: /// reference set diff --git a/DataFormats/Common/interface/AssociationVector.h b/DataFormats/Common/interface/AssociationVector.h index 6930a434d4eff..96610d1a90873 100644 --- a/DataFormats/Common/interface/AssociationVector.h +++ b/DataFormats/Common/interface/AssociationVector.h @@ -109,7 +109,7 @@ namespace edm { const_iterator end() const { return transientVector().end(); } //Used by ROOT storage - CMS_CLASS_VERSION(11) + CMS_CLASS_VERSION(3) private: enum CacheState { kUnset, kFilling, kSet }; diff --git a/DataFormats/Common/interface/BaseHolder.h b/DataFormats/Common/interface/BaseHolder.h index a2e4194f97958..fb2fd22d8afae 100644 --- a/DataFormats/Common/interface/BaseHolder.h +++ b/DataFormats/Common/interface/BaseHolder.h @@ -62,7 +62,7 @@ namespace edm { virtual bool isTransient() const = 0; //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) protected: // We want the following called only by derived classes. diff --git a/DataFormats/Common/interface/CMS_CLASS_VERSION.h b/DataFormats/Common/interface/CMS_CLASS_VERSION.h index 09dea8fa80a2e..39d65f4f41f9d 100644 --- a/DataFormats/Common/interface/CMS_CLASS_VERSION.h +++ b/DataFormats/Common/interface/CMS_CLASS_VERSION.h @@ -14,7 +14,7 @@ CMS_CLASS_VERSION() For classes that have been stored into ROOT files before the addition of the macro, we suggest starting the at 10. This was chosen to be larger than any known number of stored changes to a templated class. - For new classes that have never been stored, we suggest starting the at 2 (0 and 1 have special meanings to ROOT). + For new classes that have never been stored, we suggest starting the at 3 (0 and 1 have special meanings to ROOT). */ // diff --git a/DataFormats/Common/interface/ContainerMask.h b/DataFormats/Common/interface/ContainerMask.h index 4020a6d49957a..ecfa28bf49d91 100644 --- a/DataFormats/Common/interface/ContainerMask.h +++ b/DataFormats/Common/interface/ContainerMask.h @@ -59,7 +59,7 @@ namespace edm { void swap(ContainerMask& iOther); //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: //ContainerMask(const ContainerMask&); // stop default diff --git a/DataFormats/Common/interface/DetSet.h b/DataFormats/Common/interface/DetSet.h index 0ab8c7d446b51..bf3ee5e7ead18 100644 --- a/DataFormats/Common/interface/DetSet.h +++ b/DataFormats/Common/interface/DetSet.h @@ -74,7 +74,7 @@ namespace edm { det_id_type detId() const { return id; } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) det_id_type id; collection_type data; diff --git a/DataFormats/Common/interface/DetSetRefVector.h b/DataFormats/Common/interface/DetSetRefVector.h index d26e16be43789..775d9fc2810f3 100644 --- a/DataFormats/Common/interface/DetSetRefVector.h +++ b/DataFormats/Common/interface/DetSetRefVector.h @@ -185,7 +185,7 @@ namespace edm { //void post_insert(); //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: collection_type sets_; diff --git a/DataFormats/Common/interface/DetSetVector.h b/DataFormats/Common/interface/DetSetVector.h index 512bf325c0354..d35aa667cac6c 100644 --- a/DataFormats/Common/interface/DetSetVector.h +++ b/DataFormats/Common/interface/DetSetVector.h @@ -227,7 +227,7 @@ namespace edm { void fillView(ProductID const& id, std::vector& pointers, FillViewHelperVector& helpers) const; //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: collection_type _sets; diff --git a/DataFormats/Common/interface/DetSetVectorNew.h b/DataFormats/Common/interface/DetSetVectorNew.h index a37335fd562bc..a712d9b3d5e4b 100644 --- a/DataFormats/Common/interface/DetSetVectorNew.h +++ b/DataFormats/Common/interface/DetSetVectorNew.h @@ -577,7 +577,7 @@ namespace edmNew { DataContainer const& data() const { return m_data; } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: //for testing diff --git a/DataFormats/Common/interface/ErrorSummaryEntry.h b/DataFormats/Common/interface/ErrorSummaryEntry.h index e99615b0919ae..20bce7fc8258d 100644 --- a/DataFormats/Common/interface/ErrorSummaryEntry.h +++ b/DataFormats/Common/interface/ErrorSummaryEntry.h @@ -33,35 +33,38 @@ // ---------------------------------------------------------------------- namespace edm { - struct ErrorSummaryEntry { - std::string category; - std::string module; - ELseverityLevel severity; - unsigned int count; - ErrorSummaryEntry(std::string const& cat, std::string const& mod, ELseverityLevel sev, unsigned int cnt = 0) - : category(cat), module(mod), severity(sev), count(cnt) {} - ErrorSummaryEntry() : category(), module(), severity(), count(0) {} - bool operator<(ErrorSummaryEntry const& rhs) const { - if (category < rhs.category) - return true; - if (category > rhs.category) + namespace io_v1 { + struct ErrorSummaryEntry { + std::string category; + std::string module; + ELseverityLevel severity; + unsigned int count; + ErrorSummaryEntry(std::string const& cat, std::string const& mod, ELseverityLevel sev, unsigned int cnt = 0) + : category(cat), module(mod), severity(sev), count(cnt) {} + ErrorSummaryEntry() : category(), module(), severity(), count(0) {} + bool operator<(ErrorSummaryEntry const& rhs) const { + if (category < rhs.category) + return true; + if (category > rhs.category) + return false; + if (module < rhs.module) + return true; + if (module > rhs.module) + return false; + if (severity < rhs.severity) + return true; + if (severity > rhs.severity) + return false; + if (count < rhs.count) + return true; return false; - if (module < rhs.module) - return true; - if (module > rhs.module) - return false; - if (severity < rhs.severity) - return true; - if (severity > rhs.severity) - return false; - if (count < rhs.count) - return true; - return false; - } - bool operator==(ErrorSummaryEntry const& rhs) const { - return ((category < rhs.category) && (module < rhs.module) && (severity < rhs.severity) && (count < rhs.count)); - } - }; + } + bool operator==(ErrorSummaryEntry const& rhs) const { + return ((category < rhs.category) && (module < rhs.module) && (severity < rhs.severity) && (count < rhs.count)); + } + }; + } // namespace io_v1 + using ErrorSummaryEntry = io_v1::ErrorSummaryEntry; } // end of namespace edm #endif // DataFormats_Common_ErrorSummaryEntry_h diff --git a/DataFormats/Common/interface/FwdPtr.h b/DataFormats/Common/interface/FwdPtr.h index 10d96ddeab98e..df2738398a899 100644 --- a/DataFormats/Common/interface/FwdPtr.h +++ b/DataFormats/Common/interface/FwdPtr.h @@ -117,7 +117,7 @@ namespace edm { Ptr const& backPtr() const { return backPtr_; } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: Ptr ptr_; diff --git a/DataFormats/Common/interface/FwdRef.h b/DataFormats/Common/interface/FwdRef.h index ee7b366887fb0..04b588e3d60ba 100644 --- a/DataFormats/Common/interface/FwdRef.h +++ b/DataFormats/Common/interface/FwdRef.h @@ -197,7 +197,7 @@ namespace edm { bool isTransient() const { return ref_.isTransient(); } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: Ref ref_; diff --git a/DataFormats/Common/interface/Holder.h b/DataFormats/Common/interface/Holder.h index 76700a5bda277..1bbb5426af74f 100644 --- a/DataFormats/Common/interface/Holder.h +++ b/DataFormats/Common/interface/Holder.h @@ -42,7 +42,7 @@ namespace edm { bool isTransient() const override { return ref_.isTransient(); } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: REF ref_; diff --git a/DataFormats/Common/interface/IdToHitRange.h b/DataFormats/Common/interface/IdToHitRange.h new file mode 100644 index 0000000000000..f41baa5036373 --- /dev/null +++ b/DataFormats/Common/interface/IdToHitRange.h @@ -0,0 +1,220 @@ +#ifndef DataFormats_Common_IdToHitRange_h +#define DataFormats_Common_IdToHitRange_h +// -*- C++ -*- +// +// Package: DataFormats/Common +// Class : IdToHitRange +// +/**\class IdToHitRange IdToHitRange.h "DataFormats/Common/interface/IdToHitRange.h" + + Description: Used to associate an ID to a range of hits + + Usage: + Allows quick lookup of a range of hits via the ID + +*/ +// +// Original Author: Christopher Jones +// Created: Tue, 26 Sep 2023 20:41:14 GMT +// + +// system include files +#include +#include + +// user include files +#include "DataFormats/Common/interface/CMS_CLASS_VERSION.h" +#include "FWCore/Utilities/interface/EDMException.h" + +// forward declarations + +namespace edm { + template + class IdToHitRange { + public: + using container = std::vector; + /// contained object type + using value_type = typename container::value_type; + /// collection size type + using size_type = typename container::size_type; + /// reference type + using reference = typename container::reference; + /// pointer type + using pointer = typename container::pointer; + /// constant access iterator type + using const_iterator = typename container::const_iterator; + /// iterator range + using range = std::pair; + + using id_iterator = typename std::vector::const_iterator; + + public: + IdToHitRange() {} + + // ---------- const member functions --------------------- + /// get a range of objects with specified identifier + range get(ID id) const { + auto i = find(id); + if (i == ids_.end()) { + return {collection_.end(), collection_.end()}; + } + auto offsetInOffsets = i - ids_.begin(); + if (ids_.size() != offsets_.size()) { + offsetInOffsets = offsets_[offsetInOffsets] + ids_.size(); + } + auto startIndex = offsets_[offsetInOffsets]; + if (static_cast(offsetInOffsets + 1) == offsets_.size()) { + return {collection_.begin() + startIndex, collection_.end()}; + } + auto endIndex = offsets_[offsetInOffsets + 1]; + return {collection_.begin() + startIndex, collection_.begin() + endIndex}; + } + + /// get range of objects matching a specified identifier with a specified comparator. + /// WARNING: the comparator has to be written + /// in such a way that the std::equal_range + /// function returns a meaningful range. + /// Not properly written comparators may return + /// an unpredictable range. It is recommended + /// to use only comparators provided with CMSSW release. + template + range get(ID id, CMP comparator) const { + if (ids_.size() != offsets_.size()) { + throw edm::Exception(edm::errors::LogicError, "calling get with comparitor before sorting."); + } + auto r = std::equal_range(ids_.begin(), ids_.end(), id, comparator); + const_iterator begin, end; + if ((r.first) == ids_.end()) { + begin = end = collection_.end(); + return std::make_pair(begin, end); + } else { + begin = collection_.begin() + offsets_[r.first - ids_.begin()]; + } + if ((r.second) == ids_.end()) { + end = collection_.end(); + } else { + end = collection_.begin() + offsets_[r.second - ids_.begin()]; + } + return std::make_pair(begin, end); + } + /// get range of objects matching a specified identifier with a specified comparator. + template + range get(std::pair p) const { + return get(p.first, p.second); + } + + /// return number of contained object + size_t size() const { return collection_.size(); } + /// first collection iterator + /// hits in collection are not guaranteed to be in ID order + const_iterator begin() const { return collection_.begin(); } + /// last collection iterator + const_iterator end() const { return collection_.end(); } + + // ---------- member functions --------------------------- + /// insert an object range with specified identifier + template + void put(ID id, CI begin, CI end) { + auto i = std::lower_bound(ids_.begin(), ids_.end(), id); + if (i == ids_.end()) { + bool isAlreadySorted = (offsets_.size() == ids_.size()); + ids_.emplace_back(std::move(id)); + offsets_.push_back(collection_.size()); + collection_.insert(collection_.end(), begin, end); + if (not isAlreadySorted) { + //need to update the indirection table used to find the ranges + offsets_.insert(offsets_.begin() + ids_.size() - 1, offsets_.size() - ids_.size()); + } + return; + } else if (*i == id) { + throw edm::Exception(edm::errors::LogicError, "trying to insert duplicate entry"); + } + if (offsets_.size() == ids_.size()) { + //was sorted, but now it will not be so need to reformat offsets_ + std::vector newOffsets; + newOffsets.reserve(ids_.size() * 2 + 2); + for (std::size_t index = 0; index < ids_.size(); ++index) { + newOffsets.push_back(index); + } + for (std::size_t index = 0; index < ids_.size(); ++index) { + newOffsets.push_back(offsets_[index]); + } + offsets_ = std::move(newOffsets); + } + auto offsetInIds = i - ids_.begin(); + ids_.insert(i, id); + offsets_.push_back(collection_.size()); + collection_.insert(collection_.end(), begin, end); + offsets_.insert(offsets_.begin() + offsetInIds, offsets_.size() - ids_.size()); + } + + /// perfor post insert action + void post_insert() { + if (ids_.size() == offsets_.size()) { + //already sorted + return; + } + + std::vector sortedCollection; + sortedCollection.reserve(collection_.size()); + + std::vector offsets; + offsets.reserve(ids_.size()); + + for (const auto& id : ids_) { + offsets.push_back(sortedCollection.size()); + auto range = get(id); + sortedCollection.insert(sortedCollection.end(), range.first, range.second); + } + offsets_ = std::move(offsets); + collection_ = std::move(sortedCollection); + } + + /// first identifier iterator + id_iterator id_begin() const { return ids_.begin(); } + /// last identifier iterator + id_iterator id_end() const { return ids_.end(); } + /// number of contained identifiers + size_t id_size() const { return ids_.size(); } + /// indentifier vector + std::vector ids() const { return ids_; } + /// direct access to an object in the collection + reference operator[](size_type i) { return collection_[i]; } + + /// swap member function + void swap(IdToHitRange& other); + + //Used by ROOT storage + CMS_CLASS_VERSION(3) + + private: + typename std::vector::const_iterator find(ID id) const { + auto i = std::lower_bound(ids_.begin(), ids_.end(), id); + if (i == ids_.end() or *i != id) { + return ids_.end(); + } + return i; + } + + // ---------- member data -------------------------------- + std::vector ids_; + std::vector offsets_; + container collection_; + }; + + template + inline void IdToHitRange::swap(IdToHitRange& other) { + ids_.swap(other.ids_); + offsets_.swap(other.offsets_); + collection_.swap(other.collection_); + } + + // free swap function + template + inline void swap(IdToHitRange& a, IdToHitRange& b) { + a.swap(b); + } + +} // namespace edm + +#endif diff --git a/DataFormats/Common/interface/IndirectHolder.h b/DataFormats/Common/interface/IndirectHolder.h index 539a1c59b8dc9..3369e2f7fd4c6 100644 --- a/DataFormats/Common/interface/IndirectHolder.h +++ b/DataFormats/Common/interface/IndirectHolder.h @@ -54,7 +54,7 @@ namespace edm { bool isTransient() const override { return helper_->isTransient(); } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: friend class RefToBase; diff --git a/DataFormats/Common/interface/IndirectVectorHolder.h b/DataFormats/Common/interface/IndirectVectorHolder.h index 1433234605a1f..6c2417a047c3c 100644 --- a/DataFormats/Common/interface/IndirectVectorHolder.h +++ b/DataFormats/Common/interface/IndirectVectorHolder.h @@ -50,7 +50,7 @@ namespace edm { bool isAvailable() const override { return helper_->isAvailable(); } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: typedef typename base_type::const_iterator_imp const_iterator_imp; diff --git a/DataFormats/Common/interface/MultiAssociation.h b/DataFormats/Common/interface/MultiAssociation.h index 81fbfbb6f05f4..4b453b0c09c31 100644 --- a/DataFormats/Common/interface/MultiAssociation.h +++ b/DataFormats/Common/interface/MultiAssociation.h @@ -292,7 +292,7 @@ namespace edm { } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: typedef helper::IndexRangeAssociation Indices; diff --git a/DataFormats/Common/interface/OwnVector.h b/DataFormats/Common/interface/OwnVector.h index 23ebad48fdc48..a16fadc1cf027 100644 --- a/DataFormats/Common/interface/OwnVector.h +++ b/DataFormats/Common/interface/OwnVector.h @@ -217,7 +217,7 @@ namespace edm { std::vector& ptrs) const; //Used by ROOT storage - CMS_CLASS_VERSION(11) + CMS_CLASS_VERSION(3) private: void destroy() noexcept; diff --git a/DataFormats/Common/interface/Ptr.h b/DataFormats/Common/interface/Ptr.h index 2bfcce105e992..bb65796e7479f 100644 --- a/DataFormats/Common/interface/Ptr.h +++ b/DataFormats/Common/interface/Ptr.h @@ -174,7 +174,7 @@ namespace edm { void const* product() const { return nullptr; } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: template diff --git a/DataFormats/Common/interface/PtrVector.h b/DataFormats/Common/interface/PtrVector.h index fd878baa173e7..2d961a08e03d4 100644 --- a/DataFormats/Common/interface/PtrVector.h +++ b/DataFormats/Common/interface/PtrVector.h @@ -174,7 +174,7 @@ namespace edm { void fillView(std::vector& pointers, FillViewHelperVector& helpers) const; //Used by ROOT storage - CMS_CLASS_VERSION(8) + CMS_CLASS_VERSION(3) private: //PtrVector const& operator=(PtrVector const&); // stop default diff --git a/DataFormats/Common/interface/RangeMap.h b/DataFormats/Common/interface/RangeMap.h index 951a1967f84c5..fb490ed26c669 100644 --- a/DataFormats/Common/interface/RangeMap.h +++ b/DataFormats/Common/interface/RangeMap.h @@ -195,7 +195,7 @@ namespace edm { void swap(RangeMap& other); //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: /// stored collection diff --git a/DataFormats/Common/interface/Ref.h b/DataFormats/Common/interface/Ref.h index 42fe4bb081a9d..b95cfd9fadd0a 100644 --- a/DataFormats/Common/interface/Ref.h +++ b/DataFormats/Common/interface/Ref.h @@ -261,7 +261,7 @@ namespace edm { RefCore const& refCore() const { return product_; } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) // private: // Constructor from member of RefVector Ref(RefCore const& iRefCore, key_type const& iKey) : product_(iRefCore), index_(iKey) {} @@ -410,7 +410,7 @@ namespace edm { RefCore const& refCore() const { return product_.toRefCore(); } //Used by ROOT storage - CMS_CLASS_VERSION(11) + CMS_CLASS_VERSION(3) // private: // Constructor from member of RefVector Ref(RefCore const& iRefCore, key_type const& iKey) : product_(iRefCore, iKey) {} diff --git a/DataFormats/Common/interface/RefHolder_.h b/DataFormats/Common/interface/RefHolder_.h index e04dc5f248c6b..3a68739245c6f 100644 --- a/DataFormats/Common/interface/RefHolder_.h +++ b/DataFormats/Common/interface/RefHolder_.h @@ -39,7 +39,7 @@ namespace edm { bool isTransient() const override { return ref_.isTransient(); } //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: void const* pointerToType(std::type_info const& iToType) const override; REF ref_; diff --git a/DataFormats/Common/interface/RefProd.h b/DataFormats/Common/interface/RefProd.h index c17a5f2d821ee..cc072f1f46f24 100644 --- a/DataFormats/Common/interface/RefProd.h +++ b/DataFormats/Common/interface/RefProd.h @@ -144,7 +144,7 @@ namespace edm { void swap(RefProd&); //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: // Compile time check that the argument is a C* or C const* diff --git a/DataFormats/Common/interface/RefToBase.h b/DataFormats/Common/interface/RefToBase.h index d6b57bbc8e429..d297b42636d56 100644 --- a/DataFormats/Common/interface/RefToBase.h +++ b/DataFormats/Common/interface/RefToBase.h @@ -128,7 +128,7 @@ namespace edm { bool isTransient() const { return holder_ ? holder_->isTransient() : false; } //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: value_type const* getPtrImpl() const; reftobase::BaseHolder* holder_; diff --git a/DataFormats/Common/interface/RefToBaseProd.h b/DataFormats/Common/interface/RefToBaseProd.h index b046ea271419f..b22cdb15c4903 100644 --- a/DataFormats/Common/interface/RefToBaseProd.h +++ b/DataFormats/Common/interface/RefToBaseProd.h @@ -89,7 +89,7 @@ namespace edm { void swap(RefToBaseProd&); //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: //NOTE: Access to RefCore should be private since we modify the use of productPtr RefCore const& refCore() const { return product_; } diff --git a/DataFormats/Common/interface/RefToBaseVector.h b/DataFormats/Common/interface/RefToBaseVector.h index 30043e1f1d92c..ab0182bff36f6 100644 --- a/DataFormats/Common/interface/RefToBaseVector.h +++ b/DataFormats/Common/interface/RefToBaseVector.h @@ -73,7 +73,7 @@ namespace edm { bool isAvailable() const { return holder_->isAvailable(); } //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: holder_type* holder_; diff --git a/DataFormats/Common/interface/RefVector.h b/DataFormats/Common/interface/RefVector.h index 3a1ab488b0425..6da7708068061 100644 --- a/DataFormats/Common/interface/RefVector.h +++ b/DataFormats/Common/interface/RefVector.h @@ -150,7 +150,7 @@ namespace edm { void fillView(ProductID const& id, std::vector& pointers, FillViewHelperVector& helpers) const; //Needed for ROOT storage - CMS_CLASS_VERSION(13) + CMS_CLASS_VERSION(3) private: contents_type refVector_; diff --git a/DataFormats/Common/interface/RefVectorBase.h b/DataFormats/Common/interface/RefVectorBase.h index eba2fd7f21e63..a16476a7ecca5 100644 --- a/DataFormats/Common/interface/RefVectorBase.h +++ b/DataFormats/Common/interface/RefVectorBase.h @@ -122,7 +122,7 @@ namespace edm { } //Needed for ROOT storage - CMS_CLASS_VERSION(13) + CMS_CLASS_VERSION(3) private: std::vector const& memberPointers() const { return memberPointersHolder_.memberPointers(); } diff --git a/DataFormats/Common/interface/RefVectorHolder.h b/DataFormats/Common/interface/RefVectorHolder.h index 9d5cbf4d56372..32381d7025416 100644 --- a/DataFormats/Common/interface/RefVectorHolder.h +++ b/DataFormats/Common/interface/RefVectorHolder.h @@ -32,7 +32,7 @@ namespace edm { size_t keyForIndex(size_t idx) const override; //Needed for ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: typedef typename RefVectorHolderBase::const_iterator_imp const_iterator_imp; diff --git a/DataFormats/Common/interface/SortedCollection.h b/DataFormats/Common/interface/SortedCollection.h index 8bca0f397d15f..c0c505dd7727e 100644 --- a/DataFormats/Common/interface/SortedCollection.h +++ b/DataFormats/Common/interface/SortedCollection.h @@ -162,7 +162,7 @@ namespace edm { std::vector& ptrs) const; //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: typedef std::vector collection_type; diff --git a/DataFormats/Common/interface/ValueMap.h b/DataFormats/Common/interface/ValueMap.h index f6045fee43881..1c3a644c5940e 100644 --- a/DataFormats/Common/interface/ValueMap.h +++ b/DataFormats/Common/interface/ValueMap.h @@ -229,7 +229,7 @@ namespace edm { const_reference_type get(size_t idx) const { return values_[idx]; } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) protected: container values_; diff --git a/DataFormats/Common/interface/VectorHolder.h b/DataFormats/Common/interface/VectorHolder.h index d61abe8d6a20c..2bda493904f56 100644 --- a/DataFormats/Common/interface/VectorHolder.h +++ b/DataFormats/Common/interface/VectorHolder.h @@ -77,7 +77,7 @@ namespace edm { bool isAvailable() const override { return refVector_.isAvailable(); } //Used by ROOT storage - CMS_CLASS_VERSION(10) + CMS_CLASS_VERSION(3) private: typedef typename base_type::const_iterator_imp const_iterator_imp; diff --git a/DataFormats/Common/src/classes_def.xml b/DataFormats/Common/src/classes_def.xml index ff3a3ff897b89..a3ea5e7988088 100644 --- a/DataFormats/Common/src/classes_def.xml +++ b/DataFormats/Common/src/classes_def.xml @@ -4,14 +4,12 @@ - - - + + - - - + + @@ -51,8 +49,8 @@ - - + + @@ -69,8 +67,8 @@ - - + + @@ -78,8 +76,8 @@ - - + + @@ -88,28 +86,24 @@ ]]> - - + + - - - + + - - - + - - - + + - - + + @@ -132,11 +126,11 @@ - - + + - - + + @@ -158,40 +152,39 @@ - - + + - - + + - - - - + + + + - - + + - - + + - - + + - - + + - - - + + - - + + diff --git a/DataFormats/Common/test/IdToHitRange_t.cpp b/DataFormats/Common/test/IdToHitRange_t.cpp new file mode 100644 index 0000000000000..998fba3f001e9 --- /dev/null +++ b/DataFormats/Common/test/IdToHitRange_t.cpp @@ -0,0 +1,440 @@ +#include "catch2/catch_all.hpp" +#include "DataFormats/Common/interface/IdToHitRange.h" + +namespace { + struct Hit { + Hit(int iValue) : value_(iValue) {} + int value_ = -1; + }; +} // namespace + +TEST_CASE("test IdToHitRange", "[IdToHitRange]") { + SECTION("empty") { + edm::IdToHitRange hr{}; + + REQUIRE(0 == hr.size()); + REQUIRE(hr.begin() == hr.end()); + REQUIRE(hr.id_size() == 0); + REQUIRE(hr.id_begin() == hr.id_end()); + REQUIRE(hr.ids().empty()); + REQUIRE(hr.get(0) == std::make_pair(hr.end(), hr.end())); + } + + SECTION("one entry") { + SECTION("with one hit") { + edm::IdToHitRange hr{}; + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + + REQUIRE(1 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 1); + REQUIRE(hr.get(0) == std::make_pair(hr.begin(), hr.end())); + REQUIRE(hr.get(0).first->value_ == 0); + REQUIRE(hr.get(1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.id_size() == 1); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 1); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(hr.ids().size() == 1); + } + + SECTION("with two hit") { + edm::IdToHitRange hr{}; + std::array a = {{{0}, {0}}}; + hr.put(0, a.begin(), a.end()); + + REQUIRE(2 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 2); + REQUIRE(hr.get(0) == std::make_pair(hr.begin(), hr.end())); + REQUIRE(hr.get(0).first->value_ == 0); + REQUIRE(hr.get(1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.id_size() == 1); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 1); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(hr.ids().size() == 1); + } + } + + SECTION("two entries") { + SECTION("consecutive IDs") { + SECTION("added in order") { + edm::IdToHitRange hr{}; + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + std::array b = {{{1}, {1}}}; + hr.put(1, b.begin(), b.end()); + + REQUIRE(3 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 3); + REQUIRE(hr.get(0) == std::make_pair(hr.begin(), hr.begin() + 1)); + REQUIRE(hr.get(0).first->value_ == 0); + auto get_1 = hr.get(1); + REQUIRE(get_1 == std::make_pair(hr.begin() + 1, hr.end())); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(2) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.id_size() == 2); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 2); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(hr.ids().size() == 2); + } + + SECTION("added out of order") { + edm::IdToHitRange hr{}; + std::array b = {{{1}, {1}}}; + hr.put(1, b.begin(), b.end()); + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + + REQUIRE(hr.id_size() == 2); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 2); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(hr.ids().size() == 2); + + REQUIRE(3 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 3); + auto get_0 = hr.get(0); + REQUIRE(get_0.first != hr.end()); + REQUIRE(get_0.first->value_ == 0); + REQUIRE(get_0.second - get_0.first == 1); + REQUIRE(hr.get(0) == std::make_pair(hr.begin() + 2, hr.end())); + REQUIRE(hr.get(0).first->value_ == 0); + auto get_1 = hr.get(1); + REQUIRE(get_1 == std::make_pair(hr.begin(), hr.begin() + 2)); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(2) == std::make_pair(hr.end(), hr.end())); + + SECTION("post_insert") { + hr.post_insert(); + + REQUIRE(3 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 3); + REQUIRE(hr.get(0) == std::make_pair(hr.begin(), hr.begin() + 1)); + REQUIRE(hr.get(0).first->value_ == 0); + auto get_1 = hr.get(1); + REQUIRE(get_1 == std::make_pair(hr.begin() + 1, hr.end())); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(2) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.id_size() == 2); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 2); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(hr.ids().size() == 2); + } + } + } + + SECTION("non-consecutive IDs") { + SECTION("added in order") { + edm::IdToHitRange hr{}; + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + std::array b = {{{2}, {2}}}; + hr.put(2, b.begin(), b.end()); + + REQUIRE(3 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 3); + REQUIRE(hr.get(0) == std::make_pair(hr.begin(), hr.begin() + 1)); + REQUIRE(hr.get(0).first->value_ == 0); + auto get_2 = hr.get(2); + REQUIRE(get_2 == std::make_pair(hr.begin() + 1, hr.end())); + REQUIRE(get_2.second - get_2.first == 2); + REQUIRE(get_2.first->value_ == 2); + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(3) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.id_size() == 2); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 2); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 2); + REQUIRE(hr.ids().size() == 2); + } + + SECTION("added out of order") { + edm::IdToHitRange hr{}; + std::array b = {{{2}, {2}}}; + hr.put(2, b.begin(), b.end()); + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + + REQUIRE(hr.id_size() == 2); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 2); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 2); + REQUIRE(hr.ids().size() == 2); + + REQUIRE(3 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 3); + auto get_0 = hr.get(0); + REQUIRE(get_0.first != hr.end()); + REQUIRE(get_0.first->value_ == 0); + REQUIRE(get_0.second - get_0.first == 1); + REQUIRE(hr.get(0) == std::make_pair(hr.begin() + 2, hr.end())); + REQUIRE(hr.get(0).first->value_ == 0); + auto get_2 = hr.get(2); + REQUIRE(get_2 == std::make_pair(hr.begin(), hr.begin() + 2)); + REQUIRE(get_2.second - get_2.first == 2); + REQUIRE(get_2.first->value_ == 2); + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(3) == std::make_pair(hr.end(), hr.end())); + } + } + } + SECTION("three entries") { + SECTION("first two in order, third out") { + SECTION("last added ID at beginning") { + edm::IdToHitRange hr{}; + { + std::array b = {{{1}, {1}}}; + hr.put(1, b.begin(), b.end()); + } + { + std::array c = {{{2}, {2}, {2}}}; + hr.put(2, c.begin(), c.end()); + } + { + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + } + REQUIRE(hr.id_size() == 3); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 3); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(*(hr.id_begin() + 2) == 2); + REQUIRE(hr.ids().size() == 3); + + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(3) == std::make_pair(hr.end(), hr.end())); + + REQUIRE(6 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 6); + { + auto get_0 = hr.get(0); + REQUIRE(get_0.first != hr.end()); + REQUIRE(get_0.first->value_ == 0); + REQUIRE(get_0.second - get_0.first == 1); + REQUIRE(get_0 == std::make_pair(hr.begin() + 5, hr.end())); + } + { + auto get_1 = hr.get(1); + REQUIRE(get_1.first != hr.end()); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1 == std::make_pair(hr.begin(), hr.begin() + 2)); + } + { + auto get_2 = hr.get(2); + REQUIRE(get_2.first != hr.end()); + REQUIRE(get_2.first->value_ == 2); + REQUIRE(get_2.second - get_2.first == 3); + REQUIRE(get_2 == std::make_pair(hr.begin() + 2, hr.begin() + 5)); + } + + SECTION("post_insert") { + hr.post_insert(); + + REQUIRE(hr.id_size() == 3); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 3); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(*(hr.id_begin() + 2) == 2); + REQUIRE(hr.ids().size() == 3); + + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(3) == std::make_pair(hr.end(), hr.end())); + + REQUIRE(6 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 6); + { + auto get_0 = hr.get(0); + REQUIRE(get_0.first != hr.end()); + REQUIRE(get_0.first->value_ == 0); + REQUIRE(get_0.second - get_0.first == 1); + REQUIRE(get_0 == std::make_pair(hr.begin(), hr.begin() + 1)); + } + { + auto get_1 = hr.get(1); + REQUIRE(get_1.first != hr.end()); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1 == std::make_pair(hr.begin() + 1, hr.begin() + 3)); + } + { + auto get_2 = hr.get(2); + REQUIRE(get_2.first != hr.end()); + REQUIRE(get_2.first->value_ == 2); + REQUIRE(get_2.second - get_2.first == 3); + REQUIRE(get_2 == std::make_pair(hr.begin() + 3, hr.end())); + } + } + } + SECTION("last added ID in middle") { + edm::IdToHitRange hr{}; + { + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + } + { + std::array c = {{{2}, {2}, {2}}}; + hr.put(2, c.begin(), c.end()); + } + { + std::array b = {{{1}, {1}}}; + hr.put(1, b.begin(), b.end()); + } + REQUIRE(hr.id_size() == 3); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 3); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(*(hr.id_begin() + 2) == 2); + REQUIRE(hr.ids().size() == 3); + + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(3) == std::make_pair(hr.end(), hr.end())); + + REQUIRE(6 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 6); + { + auto get_0 = hr.get(0); + REQUIRE(get_0.first != hr.end()); + REQUIRE(get_0.first->value_ == 0); + REQUIRE(get_0.second - get_0.first == 1); + REQUIRE(get_0 == std::make_pair(hr.begin(), hr.begin() + 1)); + } + { + auto get_1 = hr.get(1); + REQUIRE(get_1.first != hr.end()); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1 == std::make_pair(hr.begin() + 4, hr.end())); + } + { + auto get_2 = hr.get(2); + REQUIRE(get_2.first != hr.end()); + REQUIRE(get_2.first->value_ == 2); + REQUIRE(get_2.second - get_2.first == 3); + REQUIRE(get_2 == std::make_pair(hr.begin() + 1, hr.begin() + 4)); + } + + SECTION("post_insert") { + hr.post_insert(); + + REQUIRE(hr.id_size() == 3); + REQUIRE(hr.id_begin() != hr.id_end()); + REQUIRE(hr.id_end() - hr.id_begin() == 3); + REQUIRE(*hr.id_begin() == 0); + REQUIRE(*(hr.id_begin() + 1) == 1); + REQUIRE(*(hr.id_begin() + 2) == 2); + REQUIRE(hr.ids().size() == 3); + + REQUIRE(hr.get(-1) == std::make_pair(hr.end(), hr.end())); + REQUIRE(hr.get(3) == std::make_pair(hr.end(), hr.end())); + + REQUIRE(6 == hr.size()); + REQUIRE(hr.begin() != hr.end()); + REQUIRE(hr.end() - hr.begin() == 6); + { + auto get_0 = hr.get(0); + REQUIRE(get_0.first != hr.end()); + REQUIRE(get_0.first->value_ == 0); + REQUIRE(get_0.second - get_0.first == 1); + REQUIRE(get_0 == std::make_pair(hr.begin(), hr.begin() + 1)); + } + { + auto get_1 = hr.get(1); + REQUIRE(get_1.first != hr.end()); + REQUIRE(get_1.first->value_ == 1); + REQUIRE(get_1.second - get_1.first == 2); + REQUIRE(get_1 == std::make_pair(hr.begin() + 1, hr.begin() + 3)); + } + { + auto get_2 = hr.get(2); + REQUIRE(get_2.first != hr.end()); + REQUIRE(get_2.first->value_ == 2); + REQUIRE(get_2.second - get_2.first == 3); + REQUIRE(get_2 == std::make_pair(hr.begin() + 3, hr.end())); + } + } + } + } + } + SECTION("get with comparator") { + edm::IdToHitRange hr{}; + { + std::array a = {{0}}; + hr.put(0, a.begin(), a.end()); + } + { + std::array b = {{{1}, {1}}}; + hr.put(1, b.begin(), b.end()); + } + { + std::array c = {{{2}, {2}, {2}}}; + hr.put(2, c.begin(), c.end()); + } + + SECTION("none before") { + auto range = hr.get(-2, [](auto i, auto j) { return i / 2 < j / 2; }); + REQUIRE(range.second == range.first); + } + + SECTION("none after") { + auto range = hr.get(4, [](auto i, auto j) { return i / 2 < j / 2; }); + REQUIRE(range.second == range.first); + } + + SECTION("matches") { + SECTION("match to 0") { + auto range = hr.get(0, [](auto i, auto j) { return i / 2 < j / 2; }); + REQUIRE(range.second != range.first); + REQUIRE(range.second - range.first == 3); + REQUIRE(range.first->value_ == 0); + } + SECTION("match to 1") { + auto range = hr.get(0, [](auto i, auto j) { return i / 2 < j / 2; }); + REQUIRE(range.second != range.first); + REQUIRE(range.second - range.first == 3); + REQUIRE(range.first->value_ == 0); + } + SECTION("match to 2") { + auto range = hr.get(2, [](auto i, auto j) { return i / 2 < j / 2; }); + REQUIRE(range.second != range.first); + REQUIRE(range.second - range.first == 3); + REQUIRE(range.first->value_ == 2); + } + SECTION("match to 3") { + auto range = hr.get(3, [](auto i, auto j) { return i / 2 < j / 2; }); + REQUIRE(range.second != range.first); + REQUIRE(range.second - range.first == 3); + REQUIRE(range.first->value_ == 2); + } + } + } +} diff --git a/DataFormats/DTDigi/interface/DTDigi.h b/DataFormats/DTDigi/interface/DTDigi.h index 455a8ccaebf4e..9fcc648856d16 100644 --- a/DataFormats/DTDigi/interface/DTDigi.h +++ b/DataFormats/DTDigi/interface/DTDigi.h @@ -14,67 +14,72 @@ #include -class DTDigi { -public: - // typedef uint32_t ChannelType; +namespace io_v1 { + class DTDigi { + public: + // typedef uint32_t ChannelType; - /// Construct from the wire#, the TDC counts and the digi number. - /// number should identify uniquely multiple digis in the same cell. - explicit DTDigi(int wire, int nTDC, int number = 0, int base = 32); + /// Construct from the wire#, the TDC counts and the digi number. + /// number should identify uniquely multiple digis in the same cell. + explicit DTDigi(int wire, int nTDC, int number = 0, int base = 32); - // Construct from the wire#, the time (ns) and the digi number. - // time is converted in TDC counts (1 TDC = 25./base ns) - // number should identify uniquely multiple digis in the same cell. - explicit DTDigi(int wire, double tdrift, int number = 0, int base = 32); + // Construct from the wire#, the time (ns) and the digi number. + // time is converted in TDC counts (1 TDC = 25./base ns) + // number should identify uniquely multiple digis in the same cell. + explicit DTDigi(int wire, double tdrift, int number = 0, int base = 32); - // Construct from channel and counts. - // explicit DTDigi (ChannelType channel, int nTDC); + // Construct from channel and counts. + // explicit DTDigi (ChannelType channel, int nTDC); - /// Default construction. - DTDigi(); + /// Default construction. + DTDigi(); - /// Digis are equal if they are on the same cell and have same TDC count - bool operator==(const DTDigi& digi) const; + /// Digis are equal if they are on the same cell and have same TDC count + bool operator==(const DTDigi& digi) const; - // The channel identifier and the digi number packed together - // ChannelType channel() const ; + // The channel identifier and the digi number packed together + // ChannelType channel() const ; - /// Return wire number - int wire() const; + /// Return wire number + int wire() const; - /// Identifies different digis within the same cell - int number() const; + /// Identifies different digis within the same cell + int number() const; - /// Get time in ns - double time() const; + /// Get time in ns + double time() const; - /// Get raw TDC count - int32_t countsTDC() const; + /// Get raw TDC count + int32_t countsTDC() const; - /// Get the TDC unit value in ns - double tdcUnit() const; + /// Get the TDC unit value in ns + double tdcUnit() const; - /// Get the TDC base (counts per BX) - int tdcBase() const; + /// Get the TDC base (counts per BX) + int tdcBase() const; - /// Print content of digi - void print() const; + /// Print content of digi + void print() const; -private: - friend class testDTDigis; + private: + friend class testDTDigis; - // The value of one TDC count in ns - static const double reso; + // The value of one TDC count in ns + static const double reso; - int32_t theCounts; // TDC count, in units given by 1/theTDCBase - uint16_t theWire; // channel number - uint8_t theNumber; // counter for digis in the same cell - uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2) -}; + int32_t theCounts; // TDC count, in units given by 1/theTDCBase + uint16_t theWire; // channel number + uint8_t theNumber; // counter for digis in the same cell + uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2) + }; +} // namespace io_v1 +using DTDigi = io_v1::DTDigi; #include #include -inline std::ostream& operator<<(std::ostream& o, const DTDigi& digi) { - return o << " " << digi.wire() << " " << digi.time() << " " << digi.number(); -} +namespace io_v1 { + inline std::ostream& operator<<(std::ostream& o, const DTDigi& digi) { + return o << " " << digi.wire() << " " << digi.time() << " " << digi.number(); + } +} // namespace io_v1 #endif diff --git a/DataFormats/DTDigi/interface/DTDigiFwd.h b/DataFormats/DTDigi/interface/DTDigiFwd.h index 901a82ab798b2..28125e22b41c7 100644 --- a/DataFormats/DTDigi/interface/DTDigiFwd.h +++ b/DataFormats/DTDigi/interface/DTDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_DTDigi_DTDigiFwd_h #define DataFormats_DTDigi_DTDigiFwd_h -class DTDigi; +namespace io_v1 { + class DTDigi; +} +using DTDigi = io_v1::DTDigi; #endif diff --git a/DataFormats/DTDigi/interface/DTuROSControlData.h b/DataFormats/DTDigi/interface/DTuROSControlData.h index 78f7e1f1507af..36feaa37af3ec 100644 --- a/DataFormats/DTDigi/interface/DTuROSControlData.h +++ b/DataFormats/DTDigi/interface/DTuROSControlData.h @@ -100,60 +100,63 @@ class DTuROSROSData { std::vector error_; }; -class DTuROSFEDData { -public: - /// Constructor - DTuROSFEDData() : header1_(0), header2_(0), trailer_(0), fed_(-1), nslots_(0), evtLgth_(0) { - for (int i = 0; i < DOCESLOTS; i++) - rsize_[i] = 0; - } +namespace io_v1 { + class DTuROSFEDData { + public: + /// Constructor + DTuROSFEDData() : header1_(0), header2_(0), trailer_(0), fed_(-1), nslots_(0), evtLgth_(0) { + for (int i = 0; i < DOCESLOTS; i++) + rsize_[i] = 0; + } - /// Destructor - ~DTuROSFEDData() {} + /// Destructor + ~DTuROSFEDData() {} - void setfed(int fed) { fed_ = fed; } + void setfed(int fed) { fed_ = fed; } - void setheader1(long dword) { header1_ = dword; } + void setheader1(long dword) { header1_ = dword; } - void setheader2(long dword) { header2_ = dword; } + void setheader2(long dword) { header2_ = dword; } - void settrailer(long dword) { trailer_ = dword; } + void settrailer(long dword) { trailer_ = dword; } - void setnslots(int nslots) { nslots_ = nslots; } + void setnslots(int nslots) { nslots_ = nslots; } - void setevtlgth(int evtLgth) { evtLgth_ = evtLgth; } + void setevtlgth(int evtLgth) { evtLgth_ = evtLgth; } - void setslotsize(int slot, int size) { rsize_[slot - 1] = size; } + void setslotsize(int slot, int size) { rsize_[slot - 1] = size; } - void setuROS(int slot, DTuROSROSData rwords) { rdata_[slot - 1] = rwords; } + void setuROS(int slot, DTuROSROSData rwords) { rdata_[slot - 1] = rwords; } - int getfed() const { return fed_; } + int getfed() const { return fed_; } - long getheader1() const { return header1_; } + long getheader1() const { return header1_; } - long getheader2() const { return header2_; } + long getheader2() const { return header2_; } - long gettrailer() const { return trailer_; } + long gettrailer() const { return trailer_; } - int getnslots() const { return nslots_; } + int getnslots() const { return nslots_; } - int getevtlgth() const { return evtLgth_; } + int getevtlgth() const { return evtLgth_; } - int getslotsize(int slot) const { return rsize_[slot - 1]; } + int getslotsize(int slot) const { return rsize_[slot - 1]; } - int getBXId() const { return (getheader1() >> 20) & 0xFFF; } + int getBXId() const { return (getheader1() >> 20) & 0xFFF; } - int getTTS() const { return (gettrailer() >> 4) & 0xF; } + int getTTS() const { return (gettrailer() >> 4) & 0xF; } - DTuROSROSData getuROS(int slot) const { return rdata_[slot - 1]; } + DTuROSROSData getuROS(int slot) const { return rdata_[slot - 1]; } -private: - long header1_, header2_, trailer_; + private: + long header1_, header2_, trailer_; - int fed_, nslots_, evtLgth_, rsize_[DOCESLOTS]; + int fed_, nslots_, evtLgth_, rsize_[DOCESLOTS]; - DTuROSROSData rdata_[DOCESLOTS]; -}; + DTuROSROSData rdata_[DOCESLOTS]; + }; +} // namespace io_v1 +using DTuROSFEDData = io_v1::DTuROSFEDData; typedef std::vector DTuROSFEDDataCollection; #endif diff --git a/DataFormats/DTDigi/interface/DTuROSFEDDataFwd.h b/DataFormats/DTDigi/interface/DTuROSFEDDataFwd.h index be27d9c2b9e20..fa3de688e5ff1 100644 --- a/DataFormats/DTDigi/interface/DTuROSFEDDataFwd.h +++ b/DataFormats/DTDigi/interface/DTuROSFEDDataFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_DTDigi_DTuROSFEDDataFwd_h #define DataFormats_DTDigi_DTuROSFEDDataFwd_h -class DTuROSFEDData; +namespace io_v1 { + class DTuROSFEDData; +} +using DTuROSFEDData = io_v1::DTuROSFEDData; #endif diff --git a/DataFormats/DTDigi/src/DTDigi.cc b/DataFormats/DTDigi/src/DTDigi.cc index e5a79999db807..a436db3cf2c02 100644 --- a/DataFormats/DTDigi/src/DTDigi.cc +++ b/DataFormats/DTDigi/src/DTDigi.cc @@ -9,43 +9,45 @@ using namespace std; -DTDigi::DTDigi(int wire, int nTDC, int number, int base) - : theCounts(nTDC), theWire(wire), theNumber(number), theTDCBase(base) { - if (number > 255 || number < 0 || !(base == 30 || base == 32)) { - throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base; +namespace io_v1 { + DTDigi::DTDigi(int wire, int nTDC, int number, int base) + : theCounts(nTDC), theWire(wire), theNumber(number), theTDCBase(base) { + if (number > 255 || number < 0 || !(base == 30 || base == 32)) { + throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base; + } } -} -DTDigi::DTDigi(int wire, double tdrift, int number, int base) - : theCounts(static_cast(tdrift / 25. * base)), theWire(wire), theNumber(number), theTDCBase(base) { - if (number > 255 || number < 0 || !(base == 30 || base == 32)) { - throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base; + DTDigi::DTDigi(int wire, double tdrift, int number, int base) + : theCounts(static_cast(tdrift / 25. * base)), theWire(wire), theNumber(number), theTDCBase(base) { + if (number > 255 || number < 0 || !(base == 30 || base == 32)) { + throw cms::Exception("BadConfig") << "DTDigi ctor: invalid parameters: number: " << number << " base: " << base; + } } -} -DTDigi::DTDigi() : theCounts(0), theWire(0), theNumber(0), theTDCBase(32) {} + DTDigi::DTDigi() : theCounts(0), theWire(0), theNumber(0), theTDCBase(32) {} -// Comparison -bool DTDigi::operator==(const DTDigi& digi) const { - if (theWire != digi.wire() || - // theNumber != digi.number() || //FIXME required ?? - theCounts != digi.countsTDC()) - return false; - return true; -} + // Comparison + bool DTDigi::operator==(const DTDigi& digi) const { + if (theWire != digi.wire() || + // theNumber != digi.number() || //FIXME required ?? + theCounts != digi.countsTDC()) + return false; + return true; + } -double DTDigi::time() const { return theCounts * 25. / theTDCBase; } + double DTDigi::time() const { return theCounts * 25. / theTDCBase; } -int32_t DTDigi::countsTDC() const { return theCounts; } + int32_t DTDigi::countsTDC() const { return theCounts; } -int DTDigi::wire() const { return theWire; } + int DTDigi::wire() const { return theWire; } -int DTDigi::number() const { return theNumber; } + int DTDigi::number() const { return theNumber; } -double DTDigi::tdcUnit() const { return 25. / theTDCBase; } + double DTDigi::tdcUnit() const { return 25. / theTDCBase; } -int DTDigi::tdcBase() const { return theTDCBase; } + int DTDigi::tdcBase() const { return theTDCBase; } -void DTDigi::print() const { - cout << "Wire " << wire() << " Digi # " << number() << " Drift time (ns) " << time() << endl; -} + void DTDigi::print() const { + cout << "Wire " << wire() << " Digi # " << number() << " Drift time (ns) " << time() << endl; + } +} // namespace io_v1 diff --git a/DataFormats/DTDigi/src/classes_def.xml b/DataFormats/DTDigi/src/classes_def.xml index 79433e25c8d8e..1e0cefc218adc 100644 --- a/DataFormats/DTDigi/src/classes_def.xml +++ b/DataFormats/DTDigi/src/classes_def.xml @@ -1,16 +1,15 @@ - - - - - - - - - + + + + + + + + - - + + @@ -22,127 +21,127 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/DataFormats/DTRecHit/interface/DTRecHit1D.h b/DataFormats/DTRecHit/interface/DTRecHit1D.h index 0e71892302791..05388699cc862 100644 --- a/DataFormats/DTRecHit/interface/DTRecHit1D.h +++ b/DataFormats/DTRecHit/interface/DTRecHit1D.h @@ -22,80 +22,83 @@ class DTLayer; class GeomDet; -class DTRecHit1D : public RecHit1D { -public: - /// Constructor from wireId and digi time only. - DTRecHit1D(const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime); +namespace io_v1 { + class DTRecHit1D : public RecHit1D { + public: + /// Constructor from wireId and digi time only. + DTRecHit1D(const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime); - /// Default constructor - DTRecHit1D(); + /// Default constructor + DTRecHit1D(); - /// Constructor from a local position, wireId and digi time. - /// The 3-dimensional local error is defined as - /// resolution (the cell resolution) for the coordinate being measured - /// and 0 for the two other coordinates - DTRecHit1D(const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos); + /// Constructor from a local position, wireId and digi time. + /// The 3-dimensional local error is defined as + /// resolution (the cell resolution) for the coordinate being measured + /// and 0 for the two other coordinates + DTRecHit1D(const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos); - /// Constructor from a local position and error, wireId and digi time. - DTRecHit1D( - const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos, const LocalError& err); + /// Constructor from a local position and error, wireId and digi time. + DTRecHit1D( + const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos, const LocalError& err); - /// Destructor - ~DTRecHit1D() override; + /// Destructor + ~DTRecHit1D() override; - /// Return the 3-dimensional local position - LocalPoint localPosition() const override { return theLocalPosition; } + /// Return the 3-dimensional local position + LocalPoint localPosition() const override { return theLocalPosition; } - /// Return the 3-dimensional error on the local position - LocalError localPositionError() const override { return theLocalError; } + /// Return the 3-dimensional error on the local position + LocalError localPositionError() const override { return theLocalError; } - DTRecHit1D* clone() const override; + DTRecHit1D* clone() const override; - /// No components rechits: it returns a null vector - std::vector recHits() const override; + /// No components rechits: it returns a null vector + std::vector recHits() const override; - /// No components rechits: it returns a null vector - std::vector recHits() override; + /// No components rechits: it returns a null vector + std::vector recHits() override; - /// The side of the cell - DTEnums::DTCellSide lrSide() const { return theLRSide; } + /// The side of the cell + DTEnums::DTCellSide lrSide() const { return theLRSide; } - /// Set local position - void setPosition(LocalPoint pos) { theLocalPosition = pos; } + /// Set local position + void setPosition(LocalPoint pos) { theLocalPosition = pos; } - /// Set local position error - void setError(LocalError err) { theLocalError = err; } + /// Set local position error + void setError(LocalError err) { theLocalError = err; } - /// Set the local position and its error - void setPositionAndError(LocalPoint pos, LocalError err) { - theLocalPosition = pos; - theLocalError = err; - } + /// Set the local position and its error + void setPositionAndError(LocalPoint pos, LocalError err) { + theLocalPosition = pos; + theLocalError = err; + } - /// Return the wireId - DTWireId wireId() const { return theWireId; } + /// Return the wireId + DTWireId wireId() const { return theWireId; } - /// Return the time (ns) of the digi used to build the rechit - float digiTime() const { return theDigiTime; } + /// Return the time (ns) of the digi used to build the rechit + float digiTime() const { return theDigiTime; } - /// Comparison operator, based on the wireId and the digi time - bool operator==(const DTRecHit1D& hit) const; + /// Comparison operator, based on the wireId and the digi time + bool operator==(const DTRecHit1D& hit) const; -private: - // The wire id - DTWireId theWireId; + private: + // The wire id + DTWireId theWireId; - // Left/Right side code - DTEnums::DTCellSide theLRSide; + // Left/Right side code + DTEnums::DTCellSide theLRSide; - // The digi time used to reconstruct the hit - float theDigiTime; + // The digi time used to reconstruct the hit + float theDigiTime; - // Position and error in the Local Ref. Frame of the DTLayer - LocalPoint theLocalPosition; - LocalError theLocalError; -}; -#endif + // Position and error in the Local Ref. Frame of the DTLayer + LocalPoint theLocalPosition; + LocalError theLocalError; + }; -/// The ostream operator -std::ostream& operator<<(std::ostream& os, const DTRecHit1D& hit); + /// The ostream operator + std::ostream& operator<<(std::ostream& os, const DTRecHit1D& hit); +} // namespace io_v1 +using DTRecHit1D = io_v1::DTRecHit1D; +#endif diff --git a/DataFormats/DTRecHit/interface/DTRecHit1DFwd.h b/DataFormats/DTRecHit/interface/DTRecHit1DFwd.h index 849c80b03f10e..80f7b4603f941 100644 --- a/DataFormats/DTRecHit/interface/DTRecHit1DFwd.h +++ b/DataFormats/DTRecHit/interface/DTRecHit1DFwd.h @@ -1,5 +1,8 @@ #ifndef DataFormats_DTRecHit_DTRecHit1D_h #define DataFormats_DTRecHit_DTRecHit1D_h -class DTRecHit1D; +namespace io_v1 { + class DTRecHit1D; +} +using DTRecHit1D = io_v1::DTRecHit1D; #endif diff --git a/DataFormats/DTRecHit/interface/DTRecHit1DPair.h b/DataFormats/DTRecHit/interface/DTRecHit1DPair.h index c9e7802e972bb..d72b4d1a1f4d7 100644 --- a/DataFormats/DTRecHit/interface/DTRecHit1DPair.h +++ b/DataFormats/DTRecHit/interface/DTRecHit1DPair.h @@ -23,87 +23,89 @@ class DTLayer; -class DTRecHit1DPair : public RecHit1D { -public: - /// Constructor without components: must use setPos and Err! - DTRecHit1DPair(const DTWireId& wireId, const DTDigi& digi); +namespace io_v1 { + class DTRecHit1DPair : public RecHit1D { + public: + /// Constructor without components: must use setPos and Err! + DTRecHit1DPair(const DTWireId& wireId, const DTDigi& digi); - /// Default constructor. Needed to write the RecHit into a STL container. - DTRecHit1DPair(); + /// Default constructor. Needed to write the RecHit into a STL container. + DTRecHit1DPair(); - /// Destructor - ~DTRecHit1DPair() override; + /// Destructor + ~DTRecHit1DPair() override; - // Operations + // Operations - DTRecHit1DPair* clone() const override; + DTRecHit1DPair* clone() const override; - /// Return the 3-dimensional local position. - /// The average theLeftHit/theRightHit hits position, namely the wire position - /// is returned. - LocalPoint localPosition() const override; + /// Return the 3-dimensional local position. + /// The average theLeftHit/theRightHit hits position, namely the wire position + /// is returned. + LocalPoint localPosition() const override; - /// Return the 3-dimensional error on the local position. - /// The error is defiened as half - /// the distance between theLeftHit and theRightHit pos - LocalError localPositionError() const override; + /// Return the 3-dimensional error on the local position. + /// The error is defiened as half + /// the distance between theLeftHit and theRightHit pos + LocalError localPositionError() const override; - /// Access to component RecHits. - /// Return the two recHits (L/R) - std::vector recHits() const override; + /// Access to component RecHits. + /// Return the two recHits (L/R) + std::vector recHits() const override; - /// Non-const access to component RecHits. - /// Return the two recHits (L/R) - std::vector recHits() override; + /// Non-const access to component RecHits. + /// Return the two recHits (L/R) + std::vector recHits() override; - /// Return the detId of the Det (a DTLayer). - virtual DetId geographicalId() const; + /// Return the detId of the Det (a DTLayer). + virtual DetId geographicalId() const; - /// Return the digi time (ns) used to build the rechits - float digiTime() const { return theLeftHit.digiTime(); } + /// Return the digi time (ns) used to build the rechits + float digiTime() const { return theLeftHit.digiTime(); } - /// Comparison operator, based on the wireId and the digi time - bool operator==(const DTRecHit1DPair& hit) const; + /// Comparison operator, based on the wireId and the digi time + bool operator==(const DTRecHit1DPair& hit) const; - /// Inequality operator, defined as the mirror image of the comparions - /// operator - bool operator!=(const DTRecHit1DPair& hit) const { return !(*this == hit); } + /// Inequality operator, defined as the mirror image of the comparions + /// operator + bool operator!=(const DTRecHit1DPair& hit) const { return !(*this == hit); } - /// Return position in the local (layer) coordinate system for a - /// certain hypothesis about the L/R cell side - LocalPoint localPosition(DTEnums::DTCellSide lrside) const; + /// Return position in the local (layer) coordinate system for a + /// certain hypothesis about the L/R cell side + LocalPoint localPosition(DTEnums::DTCellSide lrside) const; - /// Return position error in the local (layer) coordinate system for a - /// certain hypothesis about the L/R cell side - LocalError localPositionError(DTEnums::DTCellSide lrside) const; + /// Return position error in the local (layer) coordinate system for a + /// certain hypothesis about the L/R cell side + LocalError localPositionError(DTEnums::DTCellSide lrside) const; - /// Set the 3-dimensional local position for the component hit - /// corresponding to the given cell side. Default value is assumed for the error. - void setPosition(DTEnums::DTCellSide lrside, const LocalPoint& point); + /// Set the 3-dimensional local position for the component hit + /// corresponding to the given cell side. Default value is assumed for the error. + void setPosition(DTEnums::DTCellSide lrside, const LocalPoint& point); - /// Set the 3-dimensional local position and error for the component hit - /// corresponding to the given cell side. Default value is assumed for the error. - void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint& point, const LocalError& err); + /// Set the 3-dimensional local position and error for the component hit + /// corresponding to the given cell side. Default value is assumed for the error. + void setPositionAndError(DTEnums::DTCellSide lrside, const LocalPoint& point, const LocalError& err); - // Return the wireId - DTWireId wireId() const { return theLeftHit.wireId(); } + // Return the wireId + DTWireId wireId() const { return theLeftHit.wireId(); } - /// Return the left/right DTRecHit1D - const DTRecHit1D* componentRecHit(DTEnums::DTCellSide lrSide) const; + /// Return the left/right DTRecHit1D + const DTRecHit1D* componentRecHit(DTEnums::DTCellSide lrSide) const; - /// Get the left and right 1D rechits (first and second respectively). - std::pair componentRecHits() const; + /// Get the left and right 1D rechits (first and second respectively). + std::pair componentRecHits() const; -private: - /// Non const access to left/right DTRecHit1D - DTRecHit1D* componentRecHit(DTEnums::DTCellSide lrSide); + private: + /// Non const access to left/right DTRecHit1D + DTRecHit1D* componentRecHit(DTEnums::DTCellSide lrSide); - // The two rechits - DTRecHit1D theLeftHit; - DTRecHit1D theRightHit; -}; - -/// Ostream operator -std::ostream& operator<<(std::ostream& os, const DTRecHit1DPair& hit); + // The two rechits + DTRecHit1D theLeftHit; + DTRecHit1D theRightHit; + }; + /// Ostream operator + std::ostream& operator<<(std::ostream& os, const DTRecHit1DPair& hit); +} // namespace io_v1 +using DTRecHit1DPair = io_v1::DTRecHit1DPair; #endif diff --git a/DataFormats/DTRecHit/interface/DTRecHitCollection.h b/DataFormats/DTRecHit/interface/DTRecHitCollection.h index c0ce265ae3277..1d2064f7d1fe9 100644 --- a/DataFormats/DTRecHit/interface/DTRecHitCollection.h +++ b/DataFormats/DTRecHit/interface/DTRecHitCollection.h @@ -9,11 +9,8 @@ #include "DataFormats/MuonDetId/interface/DTLayerId.h" #include "DataFormats/DTRecHit/interface/DTRecHit1DPair.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" -#include +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap > DTRecHitCollection; +typedef edm::IdToHitRange DTRecHitCollection; #endif diff --git a/DataFormats/DTRecHit/interface/DTRecSegment4D.h b/DataFormats/DTRecHit/interface/DTRecSegment4D.h index bba508c0ec817..d5d4328313a78 100644 --- a/DataFormats/DTRecHit/interface/DTRecSegment4D.h +++ b/DataFormats/DTRecHit/interface/DTRecSegment4D.h @@ -20,127 +20,129 @@ /* C++ Headers */ #include -class DTRecSegment4D : public RecSegment { -public: - friend class DTSegmentUpdator; - /// Empty constructor - DTRecSegment4D() : theProjection(none), theDimension(0) {} +namespace io_v1 { + class DTRecSegment4D : public RecSegment { + public: + friend class ::DTSegmentUpdator; + /// Empty constructor + DTRecSegment4D() : theProjection(none), theDimension(0) {} - /// Construct from phi and Z projections - DTRecSegment4D(const DTChamberRecSegment2D& phiSeg, - const DTSLRecSegment2D& zedSeg, - const LocalPoint& posZInCh, - const LocalVector& dirZInCh); + /// Construct from phi and Z projections + DTRecSegment4D(const DTChamberRecSegment2D& phiSeg, + const DTSLRecSegment2D& zedSeg, + const LocalPoint& posZInCh, + const LocalVector& dirZInCh); - /// Construct from phi projection - DTRecSegment4D(const DTChamberRecSegment2D& phiSeg); + /// Construct from phi projection + DTRecSegment4D(const DTChamberRecSegment2D& phiSeg); - /// Construct from Z projection - DTRecSegment4D(const DTSLRecSegment2D& zedSeg, const LocalPoint& posZInCh, const LocalVector& dirZInCh); + /// Construct from Z projection + DTRecSegment4D(const DTSLRecSegment2D& zedSeg, const LocalPoint& posZInCh, const LocalVector& dirZInCh); - /// Destructor - ~DTRecSegment4D() override; + /// Destructor + ~DTRecSegment4D() override; - //--- Base class interface + //--- Base class interface - DTRecSegment4D* clone() const override { return new DTRecSegment4D(*this); } + DTRecSegment4D* clone() const override { return new DTRecSegment4D(*this); } - /// Parameters of the segment, for the track fit. - /// For a 4D segment: (dx/dy,dy/dz,x,y) - /// For a 2D, phi-only segment: (dx/dz,x) - /// For a 2D, Z-only segment: (dy/dz,y) - AlgebraicVector parameters() const override; + /// Parameters of the segment, for the track fit. + /// For a 4D segment: (dx/dy,dy/dz,x,y) + /// For a 2D, phi-only segment: (dx/dz,x) + /// For a 2D, Z-only segment: (dy/dz,y) + AlgebraicVector parameters() const override; - /// Covariance matrix fo parameters() - AlgebraicSymMatrix parametersError() const override; + /// Covariance matrix fo parameters() + AlgebraicSymMatrix parametersError() const override; - /// The projection matrix relates the trajectory state parameters to the segment parameters(). - AlgebraicMatrix projectionMatrix() const override; + /// The projection matrix relates the trajectory state parameters to the segment parameters(). + AlgebraicMatrix projectionMatrix() const override; - /// Local position in Chamber frame - LocalPoint localPosition() const override { return thePosition; } + /// Local position in Chamber frame + LocalPoint localPosition() const override { return thePosition; } - /// Local position error in Chamber frame - LocalError localPositionError() const override; + /// Local position error in Chamber frame + LocalError localPositionError() const override; - /// Local direction in Chamber frame - LocalVector localDirection() const override { return theDirection; } + /// Local direction in Chamber frame + LocalVector localDirection() const override { return theDirection; } - /// Local direction error in the Chamber frame - LocalError localDirectionError() const override; + /// Local direction error in the Chamber frame + LocalError localDirectionError() const override; - // Chi2 of the segment fit - double chi2() const override; + // Chi2 of the segment fit + double chi2() const override; - // Degrees of freedom of the segment fit - int degreesOfFreedom() const override; + // Degrees of freedom of the segment fit + int degreesOfFreedom() const override; - // Dimension (in parameter space) - int dimension() const override { return theDimension; } + // Dimension (in parameter space) + int dimension() const override { return theDimension; } - // Access to component RecHits (if any) - std::vector recHits() const override; + // Access to component RecHits (if any) + std::vector recHits() const override; - // Non-const access to component RecHits (if any) - std::vector recHits() override; + // Non-const access to component RecHits (if any) + std::vector recHits() override; - //--- Extension of the interface + //--- Extension of the interface - /// Does it have the Phi projection? - bool hasPhi() const { return (theProjection == full || theProjection == phi); } + /// Does it have the Phi projection? + bool hasPhi() const { return (theProjection == full || theProjection == phi); } - /// Does it have the Z projection? - bool hasZed() const { return (theProjection == full || theProjection == Z); } + /// Does it have the Z projection? + bool hasZed() const { return (theProjection == full || theProjection == Z); } - /// The superPhi segment: 0 if no phi projection available - const DTChamberRecSegment2D* phiSegment() const { return hasPhi() ? &thePhiSeg : nullptr; } + /// The superPhi segment: 0 if no phi projection available + const DTChamberRecSegment2D* phiSegment() const { return hasPhi() ? &thePhiSeg : nullptr; } - /// The Z segment: 0 if not zed projection available - const DTSLRecSegment2D* zSegment() const { return hasZed() ? &theZedSeg : nullptr; } + /// The Z segment: 0 if not zed projection available + const DTSLRecSegment2D* zSegment() const { return hasZed() ? &theZedSeg : nullptr; } - /// Set position - void setPosition(LocalPoint pos) { thePosition = pos; } + /// Set position + void setPosition(LocalPoint pos) { thePosition = pos; } - /// Set direction - void setDirection(LocalVector dir) { theDirection = dir; } + /// Set direction + void setDirection(LocalVector dir) { theDirection = dir; } - /// Set covariance matrix - void setCovMatrix(const AlgebraicSymMatrix& mat) { theCovMatrix = mat; } + /// Set covariance matrix + void setCovMatrix(const AlgebraicSymMatrix& mat) { theCovMatrix = mat; } - /// The (specific) DetId of the chamber on which the segment resides - virtual DTChamberId chamberId() const; + /// The (specific) DetId of the chamber on which the segment resides + virtual DTChamberId chamberId() const; -private: - /// Which projections are actually there - enum Projection { full, phi, Z, none }; - Projection theProjection; + private: + /// Which projections are actually there + enum Projection { full, phi, Z, none }; + Projection theProjection; - /// the superPhi segment - DTChamberRecSegment2D* phiSegment() { return &thePhiSeg; } + /// the superPhi segment + DTChamberRecSegment2D* phiSegment() { return &thePhiSeg; } - /// the Z segment - DTSLRecSegment2D* zSegment() { return &theZedSeg; } + /// the Z segment + DTSLRecSegment2D* zSegment() { return &theZedSeg; } - LocalPoint thePosition; // in chamber frame - LocalVector theDirection; // in chamber frame + LocalPoint thePosition; // in chamber frame + LocalVector theDirection; // in chamber frame - void setCovMatrixForZed(const LocalPoint& posZInCh); + void setCovMatrixForZed(const LocalPoint& posZInCh); - // the covariance matrix, has the following meaning - // mat[0][0]=sigma (dx/dz) - // mat[1][1]=sigma (dy/dz) - // mat[2][2]=sigma (x) - // mat[3][3]=sigma (y) - // mat[0][2]=cov(dx/dz,x) - // mat[1][3]=cov(dy/dz,y) - AlgebraicSymMatrix theCovMatrix; + // the covariance matrix, has the following meaning + // mat[0][0]=sigma (dx/dz) + // mat[1][1]=sigma (dy/dz) + // mat[2][2]=sigma (x) + // mat[3][3]=sigma (y) + // mat[0][2]=cov(dx/dz,x) + // mat[1][3]=cov(dy/dz,y) + AlgebraicSymMatrix theCovMatrix; - DTChamberRecSegment2D thePhiSeg; - DTSLRecSegment2D theZedSeg; + DTChamberRecSegment2D thePhiSeg; + DTSLRecSegment2D theZedSeg; - int theDimension; // the dimension of this rechit -}; - -std::ostream& operator<<(std::ostream& os, const DTRecSegment4D& seg); + int theDimension; // the dimension of this rechit + }; + std::ostream& operator<<(std::ostream& os, const DTRecSegment4D& seg); +} // namespace io_v1 +using DTRecSegment4D = io_v1::DTRecSegment4D; #endif // DTRecHit_DTRecSegment4D_h diff --git a/DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h b/DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h index cd48f7ce2f230..80c9df0c902c5 100644 --- a/DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h +++ b/DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h @@ -10,17 +10,16 @@ /* Base Class Headers */ #include +#include /* Collaborating Class Declarations */ -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/IdToHitRange.h" #include "DataFormats/DTRecHit/interface/DTRecSegment4D.h" #include "DataFormats/MuonDetId/interface/DTChamberId.h" -typedef edm::RangeMap > DTRecSegment4DCollection; +using DTRecSegment4DCollection = edm::IdToHitRange; #include "DataFormats/Common/interface/Ref.h" -typedef edm::Ref DTRecSegment4DRef; +using DTRecSegment4DRef = edm::Ref; #endif diff --git a/DataFormats/DTRecHit/interface/DTRecSegment4DFwd.h b/DataFormats/DTRecHit/interface/DTRecSegment4DFwd.h index 5774fdeee4aed..d306d1465f8c8 100644 --- a/DataFormats/DTRecHit/interface/DTRecSegment4DFwd.h +++ b/DataFormats/DTRecHit/interface/DTRecSegment4DFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_DTRecHit_DTRecSegment4DFwd_h #define DataFormats_DTRecHit_DTRecSegment4DFwd_h -class DTRecSegment4D; +namespace io_v1 { + class DTRecSegment4D; +} +using DTRecSegment4D = io_v1::DTRecSegment4D; #endif diff --git a/DataFormats/DTRecHit/src/DTRecHit1D.cc b/DataFormats/DTRecHit/src/DTRecHit1D.cc index d7206150cc94c..2b328a33d60bc 100644 --- a/DataFormats/DTRecHit/src/DTRecHit1D.cc +++ b/DataFormats/DTRecHit/src/DTRecHit1D.cc @@ -8,74 +8,76 @@ using namespace std; using namespace DTEnums; -// Constructor from wireId and digi time only. -DTRecHit1D::DTRecHit1D(const DTWireId& wireId, - DTEnums::DTCellSide lr, - float digiTime) - : RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer). - theWireId(wireId), - theLRSide(lr), - theDigiTime(digiTime), - theLocalPosition(), - theLocalError() {} +namespace io_v1 { + // Constructor from wireId and digi time only. + DTRecHit1D::DTRecHit1D(const DTWireId& wireId, + DTEnums::DTCellSide lr, + float digiTime) + : RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer). + theWireId(wireId), + theLRSide(lr), + theDigiTime(digiTime), + theLocalPosition(), + theLocalError() {} -// Default constructor -DTRecHit1D::DTRecHit1D() : theWireId(), theLRSide(undefLR), theDigiTime(-1), theLocalPosition(), theLocalError() {} + // Default constructor + DTRecHit1D::DTRecHit1D() : theWireId(), theLRSide(undefLR), theDigiTime(-1), theLocalPosition(), theLocalError() {} -// Constructor from a local position, wireId and digi time. -// The 3-dimensional local error is defined as -// resolution (the cell resolution) for the coordinate being measured -// and 0 for the two other coordinates -DTRecHit1D::DTRecHit1D(const DTWireId& wireId, - DTEnums::DTCellSide lr, - float digiTime, - const LocalPoint& pos) - : RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer). - theWireId(wireId), - theLRSide(lr), - theDigiTime(digiTime), - theLocalPosition(pos) { - float cellResolution = 0.02; //cm cell resolution = 200 um = 0.02 cm - theLocalError = LocalError(cellResolution * cellResolution, 0., 0.); //FIXME: is it really needed? -} + // Constructor from a local position, wireId and digi time. + // The 3-dimensional local error is defined as + // resolution (the cell resolution) for the coordinate being measured + // and 0 for the two other coordinates + DTRecHit1D::DTRecHit1D(const DTWireId& wireId, + DTEnums::DTCellSide lr, + float digiTime, + const LocalPoint& pos) + : RecHit1D(wireId.layerId()), // the detId of the Det (a DTLayer). + theWireId(wireId), + theLRSide(lr), + theDigiTime(digiTime), + theLocalPosition(pos) { + float cellResolution = 0.02; //cm cell resolution = 200 um = 0.02 cm + theLocalError = LocalError(cellResolution * cellResolution, 0., 0.); //FIXME: is it really needed? + } -// Constructor from a local position and error, wireId and digi time. -DTRecHit1D::DTRecHit1D( - const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos, const LocalError& err) - : RecHit1D(wireId.layerId()), - theWireId(wireId), - theLRSide(lr), - theDigiTime(digiTime), - theLocalPosition(pos), - theLocalError(err) {} + // Constructor from a local position and error, wireId and digi time. + DTRecHit1D::DTRecHit1D( + const DTWireId& wireId, DTEnums::DTCellSide lr, float digiTime, const LocalPoint& pos, const LocalError& err) + : RecHit1D(wireId.layerId()), + theWireId(wireId), + theLRSide(lr), + theDigiTime(digiTime), + theLocalPosition(pos), + theLocalError(err) {} -// Destructor -DTRecHit1D::~DTRecHit1D() {} + // Destructor + DTRecHit1D::~DTRecHit1D() {} -DTRecHit1D* DTRecHit1D::clone() const { return new DTRecHit1D(*this); } + DTRecHit1D* DTRecHit1D::clone() const { return new DTRecHit1D(*this); } -// Access to component RecHits. -// No components rechits: it returns a null vector -vector DTRecHit1D::recHits() const { - vector nullvector; - return nullvector; -} + // Access to component RecHits. + // No components rechits: it returns a null vector + vector DTRecHit1D::recHits() const { + vector nullvector; + return nullvector; + } -// Non-const access to component RecHits. -// No components rechits: it returns a null vector -vector DTRecHit1D::recHits() { - vector nullvector; - return nullvector; -} + // Non-const access to component RecHits. + // No components rechits: it returns a null vector + vector DTRecHit1D::recHits() { + vector nullvector; + return nullvector; + } -// Comparison operator, based on the wireId and the digi time -bool DTRecHit1D::operator==(const DTRecHit1D& hit) const { - return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1; -} + // Comparison operator, based on the wireId and the digi time + bool DTRecHit1D::operator==(const DTRecHit1D& hit) const { + return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1; + } -// The ostream operator -ostream& operator<<(ostream& os, const DTRecHit1D& hit) { - os << "pos: " << hit.localPosition().x(); - os << " +/- " << sqrt(hit.localPositionError().xx()); - return os; -} + // The ostream operator + ostream& operator<<(ostream& os, const DTRecHit1D& hit) { + os << "pos: " << hit.localPosition().x(); + os << " +/- " << sqrt(hit.localPositionError().xx()); + return os; + } +} // namespace io_v1 diff --git a/DataFormats/DTRecHit/src/DTRecHit1DPair.cc b/DataFormats/DTRecHit/src/DTRecHit1DPair.cc index 0f24e0ae73a3b..fd4bcb01cdd4c 100644 --- a/DataFormats/DTRecHit/src/DTRecHit1DPair.cc +++ b/DataFormats/DTRecHit/src/DTRecHit1DPair.cc @@ -11,114 +11,116 @@ using namespace DTEnums; using namespace std; -// Constructor without components: must use setPos and Err! -DTRecHit1DPair::DTRecHit1DPair(const DTWireId& wireId, const DTDigi& digi) - : theLeftHit(wireId, Left, digi.time()), theRightHit(wireId, Right, digi.time()) {} - -// Default constructor -DTRecHit1DPair::DTRecHit1DPair() : theLeftHit(), theRightHit() {} - -// Destructor -DTRecHit1DPair::~DTRecHit1DPair() {} - -DTRecHit1DPair* DTRecHit1DPair::clone() const { return new DTRecHit1DPair(*this); } - -// Return the 3-dimensional local position. -// The average theLeftHit/theRightHit hits position, namely the wire position -// is returned. -LocalPoint DTRecHit1DPair::localPosition() const { - return theLeftHit.localPosition() + (theRightHit.localPosition() - theLeftHit.localPosition()) / 2.; -} - -// Return the 3-dimensional error on the local position. -// The error is defiened as half -// the distance between theLeftHit and theRightHit pos -LocalError DTRecHit1DPair::localPositionError() const { - return LocalError((theRightHit.localPosition().x() - theLeftHit.localPosition().x()) / 2., 0., 0.); -} - -// Access to component RecHits. -vector DTRecHit1DPair::recHits() const { - vector result; - result.push_back(componentRecHit(Left)); - result.push_back(componentRecHit(Right)); - return result; -} - -// Non-const access to component RecHits. -vector DTRecHit1DPair::recHits() { - vector result; - result.push_back(componentRecHit(Left)); - result.push_back(componentRecHit(Right)); - return result; -} - -// Return the detId of the Det (a DTLayer). -DetId DTRecHit1DPair::geographicalId() const { return wireId().layerId(); } - -// Comparison operator, based on the wireId and the digi time -bool DTRecHit1DPair::operator==(const DTRecHit1DPair& hit) const { - return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1; -} - -// Return position in the local (layer) coordinate system for a -// certain hypothesis about the L/R cell side -LocalPoint DTRecHit1DPair::localPosition(DTCellSide lrside) const { return componentRecHit(lrside)->localPosition(); } - -// Return position error in the local (layer) coordinate system for a -// certain hypothesis about the L/R cell side -LocalError DTRecHit1DPair::localPositionError(DTCellSide lrside) const { - return componentRecHit(lrside)->localPositionError(); -} - -// Set the 3-dimensional local position for the component hit -// corresponding to the given cell side. Default value is assumed for the error. -void DTRecHit1DPair::setPosition(DTCellSide lrside, const LocalPoint& point) { - if (lrside != undefLR) - componentRecHit(lrside)->setPosition(point); - else - throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR"); -} - -// Set the 3-dimensional local position and error for the component hit -// corresponding to the given cell side. Default value is assumed for the error. -void DTRecHit1DPair::setPositionAndError(DTCellSide lrside, const LocalPoint& point, const LocalError& err) { - if (lrside != undefLR) { - componentRecHit(lrside)->setPosition(point); - componentRecHit(lrside)->setError(err); - } else - throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR"); -} - -// Return the left/right DTRecHit1D -const DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) const { - if (lrSide == Left) { - return &theLeftHit; - } else if (lrSide == Right) { - return &theRightHit; - } else { - throw cms::Exception("DTRecHit1DPair::recHit with undefined LR"); +namespace io_v1 { + // Constructor without components: must use setPos and Err! + DTRecHit1DPair::DTRecHit1DPair(const DTWireId& wireId, const DTDigi& digi) + : theLeftHit(wireId, Left, digi.time()), theRightHit(wireId, Right, digi.time()) {} + + // Default constructor + DTRecHit1DPair::DTRecHit1DPair() : theLeftHit(), theRightHit() {} + + // Destructor + DTRecHit1DPair::~DTRecHit1DPair() {} + + DTRecHit1DPair* DTRecHit1DPair::clone() const { return new DTRecHit1DPair(*this); } + + // Return the 3-dimensional local position. + // The average theLeftHit/theRightHit hits position, namely the wire position + // is returned. + LocalPoint DTRecHit1DPair::localPosition() const { + return theLeftHit.localPosition() + (theRightHit.localPosition() - theLeftHit.localPosition()) / 2.; + } + + // Return the 3-dimensional error on the local position. + // The error is defiened as half + // the distance between theLeftHit and theRightHit pos + LocalError DTRecHit1DPair::localPositionError() const { + return LocalError((theRightHit.localPosition().x() - theLeftHit.localPosition().x()) / 2., 0., 0.); + } + + // Access to component RecHits. + vector DTRecHit1DPair::recHits() const { + vector result; + result.push_back(componentRecHit(Left)); + result.push_back(componentRecHit(Right)); + return result; + } + + // Non-const access to component RecHits. + vector DTRecHit1DPair::recHits() { + vector result; + result.push_back(componentRecHit(Left)); + result.push_back(componentRecHit(Right)); + return result; } -} - -// Non const access to left/right DTRecHit1D -DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) { - if (lrSide == Left) { - return &theLeftHit; - } else if (lrSide == Right) { - return &theRightHit; - } else { - throw cms::Exception("DTRecHit1DPair::recHit with undefined LR"); + + // Return the detId of the Det (a DTLayer). + DetId DTRecHit1DPair::geographicalId() const { return wireId().layerId(); } + + // Comparison operator, based on the wireId and the digi time + bool DTRecHit1DPair::operator==(const DTRecHit1DPair& hit) const { + return wireId() == hit.wireId() && fabs(digiTime() - hit.digiTime()) < 0.1; + } + + // Return position in the local (layer) coordinate system for a + // certain hypothesis about the L/R cell side + LocalPoint DTRecHit1DPair::localPosition(DTCellSide lrside) const { return componentRecHit(lrside)->localPosition(); } + + // Return position error in the local (layer) coordinate system for a + // certain hypothesis about the L/R cell side + LocalError DTRecHit1DPair::localPositionError(DTCellSide lrside) const { + return componentRecHit(lrside)->localPositionError(); + } + + // Set the 3-dimensional local position for the component hit + // corresponding to the given cell side. Default value is assumed for the error. + void DTRecHit1DPair::setPosition(DTCellSide lrside, const LocalPoint& point) { + if (lrside != undefLR) + componentRecHit(lrside)->setPosition(point); + else + throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR"); + } + + // Set the 3-dimensional local position and error for the component hit + // corresponding to the given cell side. Default value is assumed for the error. + void DTRecHit1DPair::setPositionAndError(DTCellSide lrside, const LocalPoint& point, const LocalError& err) { + if (lrside != undefLR) { + componentRecHit(lrside)->setPosition(point); + componentRecHit(lrside)->setError(err); + } else + throw cms::Exception("DTRecHit1DPair::setPosition with undefined LR"); + } + + // Return the left/right DTRecHit1D + const DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) const { + if (lrSide == Left) { + return &theLeftHit; + } else if (lrSide == Right) { + return &theRightHit; + } else { + throw cms::Exception("DTRecHit1DPair::recHit with undefined LR"); + } + } + + // Non const access to left/right DTRecHit1D + DTRecHit1D* DTRecHit1DPair::componentRecHit(DTCellSide lrSide) { + if (lrSide == Left) { + return &theLeftHit; + } else if (lrSide == Right) { + return &theRightHit; + } else { + throw cms::Exception("DTRecHit1DPair::recHit with undefined LR"); + } + } + + /// Get the left and right 1D rechits (first and second respectively). + pair DTRecHit1DPair::componentRecHits() const { + return make_pair(componentRecHit(Left), componentRecHit(Right)); + } + + // Ostream operator + ostream& operator<<(ostream& os, const DTRecHit1DPair& hit) { + os << "Pos: " << hit.localPosition(); + return os; } -} - -/// Get the left and right 1D rechits (first and second respectively). -pair DTRecHit1DPair::componentRecHits() const { - return make_pair(componentRecHit(Left), componentRecHit(Right)); -} - -// Ostream operator -ostream& operator<<(ostream& os, const DTRecHit1DPair& hit) { - os << "Pos: " << hit.localPosition(); - return os; -} +} // namespace io_v1 diff --git a/DataFormats/DTRecHit/src/DTRecSegment4D.cc b/DataFormats/DTRecHit/src/DTRecSegment4D.cc index 9ef6e8676d5a8..bb204681a8356 100644 --- a/DataFormats/DTRecHit/src/DTRecSegment4D.cc +++ b/DataFormats/DTRecHit/src/DTRecSegment4D.cc @@ -12,245 +12,249 @@ #include "FWCore/Utilities/interface/Exception.h" /* C++ Headers */ -DTRecSegment4D::DTRecSegment4D(const DTChamberRecSegment2D& phiSeg, - const DTSLRecSegment2D& zedSeg, - const LocalPoint& posZInCh, - const LocalVector& dirZInCh) - : RecSegment(phiSeg.chamberId()), theProjection(full), thePhiSeg(phiSeg), theZedSeg(zedSeg), theDimension(4) { - // Check consistency of 2 sub-segments - if (DTChamberId(phiSeg.geographicalId().rawId()) != DTChamberId(zedSeg.geographicalId().rawId())) - throw cms::Exception("DTRecSegment4D") - << "the z Segment and the phi segment have different chamber id" << std::endl; - - // The position of 2D segments are defined in the SL frame: I must first - // extrapolate that position at the Chamber reference plane - LocalPoint posZAt0 = posZInCh + dirZInCh * (-posZInCh.z()) / cos(dirZInCh.theta()); - - thePosition = LocalPoint(phiSeg.localPosition().x(), posZAt0.y(), 0.); - LocalVector dirPhiInCh = phiSeg.localDirection(); - - // given the actual definition of chamber refFrame, (with z poiniting to IP), - // the zed component of direction is negative. - theDirection = LocalVector(dirPhiInCh.x() / fabs(dirPhiInCh.z()), dirZInCh.y() / fabs(dirZInCh.z()), -1.); - theDirection = theDirection.unit(); - - // set cov matrix - theCovMatrix = AlgebraicSymMatrix(4); - theCovMatrix[0][0] = phiSeg.covMatrix()[0][0]; //sigma (dx/dz) - theCovMatrix[0][2] = phiSeg.covMatrix()[0][1]; //cov(dx/dz,x) - theCovMatrix[2][2] = phiSeg.covMatrix()[1][1]; //sigma (x) - setCovMatrixForZed(posZInCh); -} - -DTRecSegment4D::DTRecSegment4D(const DTChamberRecSegment2D& phiSeg) - : RecSegment(phiSeg.chamberId()), - theProjection(phi), - thePhiSeg(phiSeg), - theZedSeg(DTSLRecSegment2D()), - theDimension(2) { - thePosition = thePhiSeg.localPosition(); - - theDirection = thePhiSeg.localDirection(); - - // set cov matrix - theCovMatrix = AlgebraicSymMatrix(4); - theCovMatrix[0][0] = phiSeg.covMatrix()[0][0]; //sigma (dx/dz) - theCovMatrix[0][2] = phiSeg.covMatrix()[0][1]; //cov(dx/dz,x) - theCovMatrix[2][2] = phiSeg.covMatrix()[1][1]; //sigma (x) -} - -DTRecSegment4D::DTRecSegment4D(const DTSLRecSegment2D& zedSeg, const LocalPoint& posZInCh, const LocalVector& dirZInCh) - : RecSegment(zedSeg.superLayerId().chamberId()), - theProjection(Z), - thePhiSeg(DTChamberRecSegment2D()), - theZedSeg(zedSeg), - theDimension(2) { - LocalPoint posZAt0 = posZInCh + dirZInCh * (-posZInCh.z() / cos(dirZInCh.theta())); - - thePosition = posZAt0; - theDirection = dirZInCh; - - // set cov matrix - theCovMatrix = AlgebraicSymMatrix(4); - setCovMatrixForZed(posZInCh); -} - -DTRecSegment4D::~DTRecSegment4D() {} - -AlgebraicVector DTRecSegment4D::parameters() const { - if (dimension() == 4) { - // (dx/dz,dy/dz,x,y) - AlgebraicVector result(4); - result[2] = thePosition.x(); - result[3] = thePosition.y(); - result[0] = theDirection.x() / theDirection.z(); - result[1] = theDirection.y() / theDirection.z(); - return result; +namespace io_v1 { + DTRecSegment4D::DTRecSegment4D(const DTChamberRecSegment2D& phiSeg, + const DTSLRecSegment2D& zedSeg, + const LocalPoint& posZInCh, + const LocalVector& dirZInCh) + : RecSegment(phiSeg.chamberId()), theProjection(full), thePhiSeg(phiSeg), theZedSeg(zedSeg), theDimension(4) { + // Check consistency of 2 sub-segments + if (DTChamberId(phiSeg.geographicalId().rawId()) != DTChamberId(zedSeg.geographicalId().rawId())) + throw cms::Exception("DTRecSegment4D") + << "the z Segment and the phi segment have different chamber id" << std::endl; + + // The position of 2D segments are defined in the SL frame: I must first + // extrapolate that position at the Chamber reference plane + LocalPoint posZAt0 = posZInCh + dirZInCh * (-posZInCh.z()) / cos(dirZInCh.theta()); + + thePosition = LocalPoint(phiSeg.localPosition().x(), posZAt0.y(), 0.); + LocalVector dirPhiInCh = phiSeg.localDirection(); + + // given the actual definition of chamber refFrame, (with z poiniting to IP), + // the zed component of direction is negative. + theDirection = LocalVector(dirPhiInCh.x() / fabs(dirPhiInCh.z()), dirZInCh.y() / fabs(dirZInCh.z()), -1.); + theDirection = theDirection.unit(); + + // set cov matrix + theCovMatrix = AlgebraicSymMatrix(4); + theCovMatrix[0][0] = phiSeg.covMatrix()[0][0]; //sigma (dx/dz) + theCovMatrix[0][2] = phiSeg.covMatrix()[0][1]; //cov(dx/dz,x) + theCovMatrix[2][2] = phiSeg.covMatrix()[1][1]; //sigma (x) + setCovMatrixForZed(posZInCh); } - AlgebraicVector result(2); - if (theProjection == phi) { - // (dx/dz,x) - result[1] = thePosition.x(); - result[0] = theDirection.x() / theDirection.z(); - } else if (theProjection == Z) { - // (dy/dz,y) (note we are in the chamber r.f.) - result[1] = thePosition.y(); - result[0] = theDirection.y() / theDirection.z(); + DTRecSegment4D::DTRecSegment4D(const DTChamberRecSegment2D& phiSeg) + : RecSegment(phiSeg.chamberId()), + theProjection(phi), + thePhiSeg(phiSeg), + theZedSeg(DTSLRecSegment2D()), + theDimension(2) { + thePosition = thePhiSeg.localPosition(); + + theDirection = thePhiSeg.localDirection(); + + // set cov matrix + theCovMatrix = AlgebraicSymMatrix(4); + theCovMatrix[0][0] = phiSeg.covMatrix()[0][0]; //sigma (dx/dz) + theCovMatrix[0][2] = phiSeg.covMatrix()[0][1]; //cov(dx/dz,x) + theCovMatrix[2][2] = phiSeg.covMatrix()[1][1]; //sigma (x) } - return result; -} -AlgebraicSymMatrix DTRecSegment4D::parametersError() const { - if (dimension() == 4) { - return theCovMatrix; + DTRecSegment4D::DTRecSegment4D(const DTSLRecSegment2D& zedSeg, + const LocalPoint& posZInCh, + const LocalVector& dirZInCh) + : RecSegment(zedSeg.superLayerId().chamberId()), + theProjection(Z), + thePhiSeg(DTChamberRecSegment2D()), + theZedSeg(zedSeg), + theDimension(2) { + LocalPoint posZAt0 = posZInCh + dirZInCh * (-posZInCh.z() / cos(dirZInCh.theta())); + + thePosition = posZAt0; + theDirection = dirZInCh; + + // set cov matrix + theCovMatrix = AlgebraicSymMatrix(4); + setCovMatrixForZed(posZInCh); } - AlgebraicSymMatrix result(2); - if (theProjection == phi) { - result[0][0] = theCovMatrix[0][0]; //S(dx/dz) - result[0][1] = theCovMatrix[0][2]; //Cov(dx/dz,x) - result[1][1] = theCovMatrix[2][2]; //S(x) - } else if (theProjection == Z) { - result[0][0] = theCovMatrix[1][1]; //S(dy/dz) - result[0][1] = theCovMatrix[1][3]; //Cov(dy/dz,y) - result[1][1] = theCovMatrix[3][3]; //S(y) + DTRecSegment4D::~DTRecSegment4D() {} + + AlgebraicVector DTRecSegment4D::parameters() const { + if (dimension() == 4) { + // (dx/dz,dy/dz,x,y) + AlgebraicVector result(4); + result[2] = thePosition.x(); + result[3] = thePosition.y(); + result[0] = theDirection.x() / theDirection.z(); + result[1] = theDirection.y() / theDirection.z(); + return result; + } + + AlgebraicVector result(2); + if (theProjection == phi) { + // (dx/dz,x) + result[1] = thePosition.x(); + result[0] = theDirection.x() / theDirection.z(); + } else if (theProjection == Z) { + // (dy/dz,y) (note we are in the chamber r.f.) + result[1] = thePosition.y(); + result[0] = theDirection.y() / theDirection.z(); + } + return result; + } + + AlgebraicSymMatrix DTRecSegment4D::parametersError() const { + if (dimension() == 4) { + return theCovMatrix; + } + + AlgebraicSymMatrix result(2); + if (theProjection == phi) { + result[0][0] = theCovMatrix[0][0]; //S(dx/dz) + result[0][1] = theCovMatrix[0][2]; //Cov(dx/dz,x) + result[1][1] = theCovMatrix[2][2]; //S(x) + } else if (theProjection == Z) { + result[0][0] = theCovMatrix[1][1]; //S(dy/dz) + result[0][1] = theCovMatrix[1][3]; //Cov(dy/dz,y) + result[1][1] = theCovMatrix[3][3]; //S(y) + } + return result; } - return result; -} - -//These methods are only used to initialize the const static values -// used by projectionMatrix(). -static AlgebraicMatrix initThe4DProjectionMatrix() { - AlgebraicMatrix the4DProjectionMatrix(4, 5, 0); - the4DProjectionMatrix[0][1] = 1; - the4DProjectionMatrix[1][2] = 1; - the4DProjectionMatrix[2][3] = 1; - the4DProjectionMatrix[3][4] = 1; - return the4DProjectionMatrix; -} -static const AlgebraicMatrix the4DProjectionMatrix{initThe4DProjectionMatrix()}; - -static AlgebraicMatrix initThe2DPhiProjMatrix() { - AlgebraicMatrix the2DPhiProjMatrix(2, 5, 0); - the2DPhiProjMatrix[0][1] = 1; - the2DPhiProjMatrix[1][3] = 1; - return the2DPhiProjMatrix; -} -static const AlgebraicMatrix the2DPhiProjMatrix{initThe2DPhiProjMatrix()}; - -static AlgebraicMatrix initThe2DZProjMatrix() { - AlgebraicMatrix the2DZProjMatrix(2, 5, 0); - the2DZProjMatrix[0][2] = 1; - the2DZProjMatrix[1][4] = 1; - return the2DZProjMatrix; -} -static const AlgebraicMatrix the2DZProjMatrix{initThe2DZProjMatrix()}; - -AlgebraicMatrix DTRecSegment4D::projectionMatrix() const { - if (dimension() == 4) { + + //These methods are only used to initialize the const static values + // used by projectionMatrix(). + static AlgebraicMatrix initThe4DProjectionMatrix() { + AlgebraicMatrix the4DProjectionMatrix(4, 5, 0); + the4DProjectionMatrix[0][1] = 1; + the4DProjectionMatrix[1][2] = 1; + the4DProjectionMatrix[2][3] = 1; + the4DProjectionMatrix[3][4] = 1; return the4DProjectionMatrix; - } else if (theProjection == phi) { + } + static const AlgebraicMatrix the4DProjectionMatrix{initThe4DProjectionMatrix()}; + + static AlgebraicMatrix initThe2DPhiProjMatrix() { + AlgebraicMatrix the2DPhiProjMatrix(2, 5, 0); + the2DPhiProjMatrix[0][1] = 1; + the2DPhiProjMatrix[1][3] = 1; return the2DPhiProjMatrix; - } else if (theProjection == Z) { + } + static const AlgebraicMatrix the2DPhiProjMatrix{initThe2DPhiProjMatrix()}; + + static AlgebraicMatrix initThe2DZProjMatrix() { + AlgebraicMatrix the2DZProjMatrix(2, 5, 0); + the2DZProjMatrix[0][2] = 1; + the2DZProjMatrix[1][4] = 1; return the2DZProjMatrix; - } else { - return AlgebraicMatrix(); } -} - -LocalError DTRecSegment4D::localPositionError() const { - return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); -} - -LocalError DTRecSegment4D::localDirectionError() const { - return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); -} - -double DTRecSegment4D::chi2() const { - double result = 0; - if (hasPhi()) - result += thePhiSeg.chi2(); - if (hasZed()) - result += theZedSeg.chi2(); - return result; -} - -int DTRecSegment4D::degreesOfFreedom() const { - int result = 0; - if (hasPhi()) - result += thePhiSeg.degreesOfFreedom(); - if (hasZed()) - result += theZedSeg.degreesOfFreedom(); - return result; -} - -void DTRecSegment4D::setCovMatrixForZed(const LocalPoint& posZInCh) { - // Warning!!! the covariance matrix for Theta SL segment is defined in the SL - // reference frame, here that in the Chamber ref frame must be used. - // For direction, no problem, but the position is extrapolated, so we must - // propagate the error properly. - - // many thanks to Paolo Ronchese for the help in deriving the formulas! - - // y=m*z+q in SL frame - // y=m'*z+q' in CH frame - - // var(m') = var(m) - theCovMatrix[1][1] = theZedSeg.parametersError()[0][0]; //sigma (dy/dz) - - // cov(m',q') = DeltaZ*Var(m) + Cov(m,q) - theCovMatrix[1][3] = - posZInCh.z() * theZedSeg.parametersError()[0][0] + theZedSeg.parametersError()[0][1]; //cov(dy/dz,y) - - // Var(q') = DeltaZ^2*Var(m) + Var(q) + 2*DeltaZ*Cov(m,q) - // cout << "Var(q') = DeltaZ^2*Var(m) + Var(q) + 2*DeltaZ*Cov(m,q)" << endl; - // cout << "Var(q')= " << posZInCh.z()*posZInCh.z() << "*" << - // theZedSeg.parametersError()[0][0] << " + " << - // theZedSeg.parametersError()[1][1] << " + " << - // 2*posZInCh.z() << "*" << theZedSeg.parametersError()[0][1] ; - theCovMatrix[3][3] = 2. * (posZInCh.z() * posZInCh.z()) * theZedSeg.parametersError()[0][0] + - theZedSeg.parametersError()[1][1] + 2. * posZInCh.z() * theZedSeg.parametersError()[0][1]; - // cout << " = " << theCovMatrix[3][3] << endl; -} - -std::ostream& operator<<(std::ostream& os, const DTRecSegment4D& seg) { - os << "Pos " << seg.localPosition() << " Dir: " << seg.localDirection() << " dim: " << seg.dimension() - << " chi2/ndof: " << seg.chi2() << "/" << seg.degreesOfFreedom() << " :"; - if (seg.hasPhi()) - os << seg.phiSegment()->recHits().size(); - else - os << 0; - os << ":"; - if (seg.hasZed()) - os << seg.zSegment()->recHits().size(); - else - os << 0; - return os; -} - -/// Access to component RecHits (if any) -std::vector DTRecSegment4D::recHits() const { - std::vector pointersOfRecHits; - - if (hasPhi()) - pointersOfRecHits.push_back(phiSegment()); - if (hasZed()) - pointersOfRecHits.push_back(zSegment()); - - return pointersOfRecHits; -} - -/// Non-const access to component RecHits (if any) -std::vector DTRecSegment4D::recHits() { - std::vector pointersOfRecHits; - - if (hasPhi()) - pointersOfRecHits.push_back(phiSegment()); - if (hasZed()) - pointersOfRecHits.push_back(zSegment()); - - return pointersOfRecHits; -} - -DTChamberId DTRecSegment4D::chamberId() const { return DTChamberId(geographicalId()); } + static const AlgebraicMatrix the2DZProjMatrix{initThe2DZProjMatrix()}; + + AlgebraicMatrix DTRecSegment4D::projectionMatrix() const { + if (dimension() == 4) { + return the4DProjectionMatrix; + } else if (theProjection == phi) { + return the2DPhiProjMatrix; + } else if (theProjection == Z) { + return the2DZProjMatrix; + } else { + return AlgebraicMatrix(); + } + } + + LocalError DTRecSegment4D::localPositionError() const { + return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); + } + + LocalError DTRecSegment4D::localDirectionError() const { + return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); + } + + double DTRecSegment4D::chi2() const { + double result = 0; + if (hasPhi()) + result += thePhiSeg.chi2(); + if (hasZed()) + result += theZedSeg.chi2(); + return result; + } + + int DTRecSegment4D::degreesOfFreedom() const { + int result = 0; + if (hasPhi()) + result += thePhiSeg.degreesOfFreedom(); + if (hasZed()) + result += theZedSeg.degreesOfFreedom(); + return result; + } + + void DTRecSegment4D::setCovMatrixForZed(const LocalPoint& posZInCh) { + // Warning!!! the covariance matrix for Theta SL segment is defined in the SL + // reference frame, here that in the Chamber ref frame must be used. + // For direction, no problem, but the position is extrapolated, so we must + // propagate the error properly. + + // many thanks to Paolo Ronchese for the help in deriving the formulas! + + // y=m*z+q in SL frame + // y=m'*z+q' in CH frame + + // var(m') = var(m) + theCovMatrix[1][1] = theZedSeg.parametersError()[0][0]; //sigma (dy/dz) + + // cov(m',q') = DeltaZ*Var(m) + Cov(m,q) + theCovMatrix[1][3] = + posZInCh.z() * theZedSeg.parametersError()[0][0] + theZedSeg.parametersError()[0][1]; //cov(dy/dz,y) + + // Var(q') = DeltaZ^2*Var(m) + Var(q) + 2*DeltaZ*Cov(m,q) + // cout << "Var(q') = DeltaZ^2*Var(m) + Var(q) + 2*DeltaZ*Cov(m,q)" << endl; + // cout << "Var(q')= " << posZInCh.z()*posZInCh.z() << "*" << + // theZedSeg.parametersError()[0][0] << " + " << + // theZedSeg.parametersError()[1][1] << " + " << + // 2*posZInCh.z() << "*" << theZedSeg.parametersError()[0][1] ; + theCovMatrix[3][3] = 2. * (posZInCh.z() * posZInCh.z()) * theZedSeg.parametersError()[0][0] + + theZedSeg.parametersError()[1][1] + 2. * posZInCh.z() * theZedSeg.parametersError()[0][1]; + // cout << " = " << theCovMatrix[3][3] << endl; + } + + std::ostream& operator<<(std::ostream& os, const DTRecSegment4D& seg) { + os << "Pos " << seg.localPosition() << " Dir: " << seg.localDirection() << " dim: " << seg.dimension() + << " chi2/ndof: " << seg.chi2() << "/" << seg.degreesOfFreedom() << " :"; + if (seg.hasPhi()) + os << seg.phiSegment()->recHits().size(); + else + os << 0; + os << ":"; + if (seg.hasZed()) + os << seg.zSegment()->recHits().size(); + else + os << 0; + return os; + } + + /// Access to component RecHits (if any) + std::vector DTRecSegment4D::recHits() const { + std::vector pointersOfRecHits; + + if (hasPhi()) + pointersOfRecHits.push_back(phiSegment()); + if (hasZed()) + pointersOfRecHits.push_back(zSegment()); + + return pointersOfRecHits; + } + + /// Non-const access to component RecHits (if any) + std::vector DTRecSegment4D::recHits() { + std::vector pointersOfRecHits; + + if (hasPhi()) + pointersOfRecHits.push_back(phiSegment()); + if (hasZed()) + pointersOfRecHits.push_back(zSegment()); + + return pointersOfRecHits; + } + + DTChamberId DTRecSegment4D::chamberId() const { return DTChamberId(geographicalId()); } +} // namespace io_v1 diff --git a/DataFormats/DTRecHit/src/classes_def.xml b/DataFormats/DTRecHit/src/classes_def.xml index ad75fa4e79bbd..14b2ecc75fa45 100644 --- a/DataFormats/DTRecHit/src/classes_def.xml +++ b/DataFormats/DTRecHit/src/classes_def.xml @@ -1,40 +1,36 @@ - - - - + + - - - + + - + - - - - - - - - - + + + + + + + + + + - - - + + - - - + + @@ -42,29 +38,29 @@ - - - + + - - - - + + - + + - - - - - + + + + + + + - + @@ -73,7 +69,7 @@ - + diff --git a/DataFormats/DTRecHit/test/BuildFile.xml b/DataFormats/DTRecHit/test/BuildFile.xml new file mode 100644 index 0000000000000..41a8a32aae9d4 --- /dev/null +++ b/DataFormats/DTRecHit/test/BuildFile.xml @@ -0,0 +1,4 @@ + + + + diff --git a/DataFormats/DTRecHit/test/test_catch2_DTRangeMapAccessor.cc b/DataFormats/DTRecHit/test/test_catch2_DTRangeMapAccessor.cc new file mode 100644 index 0000000000000..5741ce6dbf52f --- /dev/null +++ b/DataFormats/DTRecHit/test/test_catch2_DTRangeMapAccessor.cc @@ -0,0 +1,85 @@ +#include "catch2/catch_all.hpp" + +#include "DataFormats/DTRecHit/interface/DTRangeMapAccessor.h" + +namespace { + + template + void loop_all_superlayers(F&& iF) { + for (int wheel = DTChamberId::minWheelId; wheel <= DTChamberId::maxWheelId; ++wheel) { + for (int station = DTChamberId::minStationId; station <= DTChamberId::maxStationId; ++station) { + for (int sector = DTChamberId::minSectorId; sector <= DTChamberId::maxSectorId; ++sector) { + for (int superlayer = DTChamberId::minSuperLayerId; superlayer <= DTChamberId::maxSuperLayerId; + ++superlayer) { + iF(DTSuperLayerId(wheel, station, sector, superlayer)); + } + } + } + } + } + + template + void loop_all_layers(F&& iF) { + loop_all_superlayers([&iF](auto superLayer) { + for (int layer = DTChamberId::minLayerId; layer <= DTChamberId::maxLayerId; ++layer) { + iF(DTLayerId(superLayer, layer)); + } + }); + } + +} // namespace + +TEST_CASE("Test DTRangeMapAccessor", "[DTRangeMapAccessor]") { + SECTION("DTSuperLayerIdComparator") { + SECTION("compare DTSuperLayerIds") { + loop_all_superlayers([](auto iLayer1) { + loop_all_superlayers([iLayer1](auto iLayer2) { + DTSuperLayerIdComparator cmp; + if (iLayer1 < iLayer2) { + REQUIRE(cmp(iLayer1, iLayer2)); + REQUIRE(not cmp(iLayer2, iLayer1)); + } else if (iLayer2 < iLayer1) { + REQUIRE(not cmp(iLayer1, iLayer2)); + REQUIRE(cmp(iLayer2, iLayer1)); + } else { + REQUIRE(not cmp(iLayer1, iLayer2)); + } + }); + }); + } + SECTION("compare DTSuperLayerId to DTLayerId") { + //NOTE: the DTSuperLayerIdComparator only works for this case + // because the comparitor takes its arguments by value, which + // means a new DTSuperLayerId must be created from the DTLayerId via + // the call to DTSuperLayerId(DTSuperLayerId const&) and that constructor + // explicitly masks out all the extra values coming from DTLayerId. + + loop_all_layers([](auto iLayer1) { + loop_all_superlayers([iLayer1](auto iLayer2) { + // std::cout <<"1 "< ids; + loop_all_layers([&ids](auto iID) { ids.emplace_back(iID); }); + std::sort(ids.begin(), ids.end()); + + loop_all_superlayers([&ids](auto iSuper) { + DTSuperLayerIdComparator cmp; + auto range = std::equal_range(ids.begin(), ids.end(), iSuper, cmp); + REQUIRE(range.second - range.first == DTChamberId::maxLayerId - DTChamberId::minLayerId + 1); + }); + } + } +} diff --git a/DataFormats/EcalDetId/interface/EBDetId.h b/DataFormats/EcalDetId/interface/EBDetId.h index 62ad79dc2a7fb..a0bbfd6e46277 100644 --- a/DataFormats/EcalDetId/interface/EBDetId.h +++ b/DataFormats/EcalDetId/interface/EBDetId.h @@ -13,152 +13,158 @@ * * */ - -class EBDetId : public DetId { -public: - enum { Subdet = EcalBarrel }; - /** Constructor of a null id */ - EBDetId() {} - /** Constructor from a raw value */ - EBDetId(uint32_t rawid) : DetId(rawid) {} - /** Constructor from crystal ieta and iphi +namespace io_v1 { + class EBDetId : public DetId { + public: + enum { Subdet = EcalBarrel }; + /** Constructor of a null id */ + EBDetId() {} + /** Constructor from a raw value */ + EBDetId(uint32_t rawid) : DetId(rawid) {} + /** Constructor from crystal ieta and iphi or from SM# and crystal# */ - // fast - EBDetId(int crystal_ieta, int crystal_iphi) : DetId(Ecal, EcalBarrel) { - id_ |= ((crystal_ieta > 0) ? (0x10000 | (crystal_ieta << 9)) : ((-crystal_ieta) << 9)) | (crystal_iphi & 0x1FF); - } - // slow - EBDetId(int index1, int index2, int mode); - /** Constructor from a generic cell id */ - EBDetId(const DetId& id) : DetId(id) {} - /** Assignment operator from cell id */ - EBDetId& operator=(const DetId& id) { - id_ = id.rawId(); - return *this; - } - - /// get the subdetector .i.e EcalBarrel (what else?) - // EcalSubdetector subdet() const { return EcalSubdetector(subdetId()); } - static EcalSubdetector subdet() { return EcalBarrel; } - - /// get the z-side of the crystal (1/-1) - int zside() const { return (id_ & 0x10000) ? (1) : (-1); } - /// get the absolute value of the crystal ieta - int ietaAbs() const { return (id_ >> 9) & 0x7F; } - /// get the crystal ieta - int ieta() const { return zside() * ietaAbs(); } - /// get the crystal iphi - int iphi() const { return id_ & 0x1FF; } - /// get the HCAL/trigger ieta of this crystal - int tower_ieta() const { return ((ietaAbs() - 1) / 5 + 1) * zside(); } - /// get the HCAL/trigger iphi of this crystal - int tower_iphi() const; - /// get the HCAL/trigger iphi of this crystal - EcalTrigTowerDetId tower() const { return EcalTrigTowerDetId(zside(), EcalBarrel, abs(tower_ieta()), tower_iphi()); } - /// get the ECAL/SM id - int ism() const { - int id = (iphi() - 1) / kCrystalsInPhi + 1; - return positiveZ() ? id : id + 18; - } - /// get the number of module inside the SM (1-4) - int im() const { - int ii = (ietaAbs() - 26); - return ii < 0 ? 1 : (ii / 20 + 2); - } - /// get ECAL/crystal number inside SM - int ic() const; - /// get the crystal ieta in the SM convention (1-85) - int ietaSM() const { return ietaAbs(); } - /// get the crystal iphi (1-20) - int iphiSM() const { return ((ic() - 1) % kCrystalsInPhi) + 1; } - - // is z positive? - bool positiveZ() const { return id_ & 0x10000; } - // crystal number in eta-phi grid - int numberByEtaPhi() const { return (MAX_IETA + (positiveZ() ? ietaAbs() - 1 : -ietaAbs())) * MAX_IPHI + iphi() - 1; } - // index numbering crystal by SM - int numberBySM() const; - /// get a compact index for arrays - int hashedIndex() const { return numberByEtaPhi(); } - - uint32_t denseIndex() const { return hashedIndex(); } - - /** returns a new EBDetId offset by nrStepsEta and nrStepsPhi (can be negative), + // fast + EBDetId(int crystal_ieta, int crystal_iphi) : DetId(Ecal, EcalBarrel) { + id_ |= ((crystal_ieta > 0) ? (0x10000 | (crystal_ieta << 9)) : ((-crystal_ieta) << 9)) | (crystal_iphi & 0x1FF); + } + // slow + EBDetId(int index1, int index2, int mode); + /** Constructor from a generic cell id */ + EBDetId(const DetId& id) : DetId(id) {} + /** Assignment operator from cell id */ + EBDetId& operator=(const DetId& id) { + id_ = id.rawId(); + return *this; + } + + /// get the subdetector .i.e EcalBarrel (what else?) + // EcalSubdetector subdet() const { return EcalSubdetector(subdetId()); } + static EcalSubdetector subdet() { return EcalBarrel; } + + /// get the z-side of the crystal (1/-1) + int zside() const { return (id_ & 0x10000) ? (1) : (-1); } + /// get the absolute value of the crystal ieta + int ietaAbs() const { return (id_ >> 9) & 0x7F; } + /// get the crystal ieta + int ieta() const { return zside() * ietaAbs(); } + /// get the crystal iphi + int iphi() const { return id_ & 0x1FF; } + /// get the HCAL/trigger ieta of this crystal + int tower_ieta() const { return ((ietaAbs() - 1) / 5 + 1) * zside(); } + /// get the HCAL/trigger iphi of this crystal + int tower_iphi() const; + /// get the HCAL/trigger iphi of this crystal + EcalTrigTowerDetId tower() const { + return EcalTrigTowerDetId(zside(), EcalBarrel, abs(tower_ieta()), tower_iphi()); + } + /// get the ECAL/SM id + int ism() const { + int id = (iphi() - 1) / kCrystalsInPhi + 1; + return positiveZ() ? id : id + 18; + } + /// get the number of module inside the SM (1-4) + int im() const { + int ii = (ietaAbs() - 26); + return ii < 0 ? 1 : (ii / 20 + 2); + } + /// get ECAL/crystal number inside SM + int ic() const; + /// get the crystal ieta in the SM convention (1-85) + int ietaSM() const { return ietaAbs(); } + /// get the crystal iphi (1-20) + int iphiSM() const { return ((ic() - 1) % kCrystalsInPhi) + 1; } + + // is z positive? + bool positiveZ() const { return id_ & 0x10000; } + // crystal number in eta-phi grid + int numberByEtaPhi() const { + return (MAX_IETA + (positiveZ() ? ietaAbs() - 1 : -ietaAbs())) * MAX_IPHI + iphi() - 1; + } + // index numbering crystal by SM + int numberBySM() const; + /// get a compact index for arrays + int hashedIndex() const { return numberByEtaPhi(); } + + uint32_t denseIndex() const { return hashedIndex(); } + + /** returns a new EBDetId offset by nrStepsEta and nrStepsPhi (can be negative), * returns EBDetId(0) if invalid */ - EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const; + EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const; - /** returns a new EBDetId on the other zside of barrel (ie iEta*-1), + /** returns a new EBDetId on the other zside of barrel (ie iEta*-1), * returns EBDetId(0) if invalid (shouldnt happen) */ - EBDetId switchZSide() const; + EBDetId switchZSide() const; - /** following are static member functions of the above two functions + /** following are static member functions of the above two functions * which take and return a DetId, returns DetId(0) if invalid */ - static DetId offsetBy(const DetId startId, int nrStepsEta, int nrStepsPhi); - static DetId switchZSide(const DetId startId); + static DetId offsetBy(const DetId startId, int nrStepsEta, int nrStepsPhi); + static DetId switchZSide(const DetId startId); - /** return an approximate values of eta (~0.15% precise) + /** return an approximate values of eta (~0.15% precise) */ - float approxEta() const { return ieta() * crystalUnitToEta; } - static float approxEta(const DetId id); - - static bool validDenseIndex(uint32_t din) { return (din < kSizeForDenseIndexing); } - - static EBDetId detIdFromDenseIndex(uint32_t di) { return unhashIndex(di); } - - /// get a DetId from a compact index for arrays - static EBDetId unhashIndex(int hi) { - const int pseudo_eta = hi / MAX_IPHI - MAX_IETA; - return (validHashIndex(hi) ? EBDetId(pseudo_eta < 0 ? pseudo_eta : pseudo_eta + 1, hi % MAX_IPHI + 1) : EBDetId()); - } - - static bool validHashIndex(int i) { return !(i < MIN_HASH || i > MAX_HASH); } - - /// check if a valid index combination - static bool validDetId(int i, int j) { - return i != 0 && (std::abs(i) <= MAX_IETA) && (j >= MIN_IPHI) && (j <= MAX_IPHI); - } - - static bool isNextToBoundary(EBDetId id); - - static bool isNextToEtaBoundary(EBDetId id); - - static bool isNextToPhiBoundary(EBDetId id); - - //return the distance in eta units between two EBDetId - static int distanceEta(const EBDetId& a, const EBDetId& b); - //return the distance in phi units between two EBDetId - static int distancePhi(const EBDetId& a, const EBDetId& b); - - /// range constants - static const int MIN_IETA = 1; - static const int MIN_IPHI = 1; - static const int MAX_IETA = 85; - static const int MAX_IPHI = 360; - static const int kChannelsPerCard = 5; - static const int kTowersInPhi = 4; // per SM - static const int kModulesPerSM = 4; - static const int kModuleBoundaries[4]; - static const int kCrystalsInPhi = 20; // per SM - static const int kCrystalsInEta = 85; // per SM - static const int kCrystalsPerSM = 1700; - static const int MIN_SM = 1; - static const int MAX_SM = 36; - static const int MIN_C = 1; - static const int MAX_C = kCrystalsPerSM; - static const int MIN_HASH = 0; // always 0 ... - static const int MAX_HASH = 2 * MAX_IPHI * MAX_IETA - 1; - - // eta coverage of one crystal (approximate) - static const float crystalUnitToEta; - - static constexpr int kSizeForDenseIndexing = MAX_HASH + 1; - - // function modes for (int, int) constructor - static const int ETAPHIMODE = 0; - static const int SMCRYSTALMODE = 1; -}; - -std::ostream& operator<<(std::ostream& s, const EBDetId& id); - + float approxEta() const { return ieta() * crystalUnitToEta; } + static float approxEta(const DetId id); + + static bool validDenseIndex(uint32_t din) { return (din < kSizeForDenseIndexing); } + + static EBDetId detIdFromDenseIndex(uint32_t di) { return unhashIndex(di); } + + /// get a DetId from a compact index for arrays + static EBDetId unhashIndex(int hi) { + const int pseudo_eta = hi / MAX_IPHI - MAX_IETA; + return (validHashIndex(hi) ? EBDetId(pseudo_eta < 0 ? pseudo_eta : pseudo_eta + 1, hi % MAX_IPHI + 1) + : EBDetId()); + } + + static bool validHashIndex(int i) { return !(i < MIN_HASH || i > MAX_HASH); } + + /// check if a valid index combination + static bool validDetId(int i, int j) { + return i != 0 && (std::abs(i) <= MAX_IETA) && (j >= MIN_IPHI) && (j <= MAX_IPHI); + } + + static bool isNextToBoundary(EBDetId id); + + static bool isNextToEtaBoundary(EBDetId id); + + static bool isNextToPhiBoundary(EBDetId id); + + //return the distance in eta units between two EBDetId + static int distanceEta(const EBDetId& a, const EBDetId& b); + //return the distance in phi units between two EBDetId + static int distancePhi(const EBDetId& a, const EBDetId& b); + + /// range constants + static const int MIN_IETA = 1; + static const int MIN_IPHI = 1; + static const int MAX_IETA = 85; + static const int MAX_IPHI = 360; + static const int kChannelsPerCard = 5; + static const int kTowersInPhi = 4; // per SM + static const int kModulesPerSM = 4; + static const int kModuleBoundaries[4]; + static const int kCrystalsInPhi = 20; // per SM + static const int kCrystalsInEta = 85; // per SM + static const int kCrystalsPerSM = 1700; + static const int MIN_SM = 1; + static const int MAX_SM = 36; + static const int MIN_C = 1; + static const int MAX_C = kCrystalsPerSM; + static const int MIN_HASH = 0; // always 0 ... + static const int MAX_HASH = 2 * MAX_IPHI * MAX_IETA - 1; + + // eta coverage of one crystal (approximate) + static const float crystalUnitToEta; + + static constexpr int kSizeForDenseIndexing = MAX_HASH + 1; + + // function modes for (int, int) constructor + static const int ETAPHIMODE = 0; + static const int SMCRYSTALMODE = 1; + }; + + std::ostream& operator<<(std::ostream& s, const EBDetId& id); +} // namespace io_v1 +using EBDetId = io_v1::EBDetId; #endif diff --git a/DataFormats/EcalDetId/interface/EBDetIdFwd.h b/DataFormats/EcalDetId/interface/EBDetIdFwd.h index 110da07788984..df74c1f97f78a 100644 --- a/DataFormats/EcalDetId/interface/EBDetIdFwd.h +++ b/DataFormats/EcalDetId/interface/EBDetIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_EcalDetId_EBDetIdFwd_h #define DataFormats_EcalDetId_EBDetIdFwd_h -class EBDetId; +namespace io_v1 { + class EBDetId; +} +using EBDetId = io_v1::EBDetId; #endif diff --git a/DataFormats/EcalDetId/interface/EEDetId.h b/DataFormats/EcalDetId/interface/EEDetId.h index e56eb6c957f98..6bff1133c6744 100644 --- a/DataFormats/EcalDetId/interface/EEDetId.h +++ b/DataFormats/EcalDetId/interface/EEDetId.h @@ -11,24 +11,25 @@ * * */ -class EEDetId : public DetId { -public: - enum { - /** Sudetector type. Here it is ECAL endcap. +namespace io_v1 { + class EEDetId : public DetId { + public: + enum { + /** Sudetector type. Here it is ECAL endcap. */ - Subdet = EcalEndcap - }; + Subdet = EcalEndcap + }; - /** Constructor of a null id + /** Constructor of a null id */ - EEDetId() {} + EEDetId() {} - /** Constructor from a raw value + /** Constructor from a raw value * @param rawid det ID number */ - EEDetId(uint32_t rawid) : DetId(rawid) {} + EEDetId(uint32_t rawid) : DetId(rawid) {} - /** Constructor from crystal ix,iy,iz (iz=+1/-1) (mode = XYMODE) + /** Constructor from crystal ix,iy,iz (iz=+1/-1) (mode = XYMODE) * or from sc,cr,iz (mode = SCCRYSTALMODE). *

ix runs from 1 to 100 along x-axis of standard CMS coordinates
* iy runs from 1 to 100 along y-axis of standard CMS coordinates
@@ -40,58 +41,58 @@ class EEDetId : public DetId { * @param iz iz/zside index: -1 for EE-, +1 for EE+ * @param mode pass XYMODE if i j refer to ix, iy, SCCRYSTALMODE if thery refer to isc, ic */ - // fast - EEDetId(int crystal_ix, int crystal_iy, int iz) : DetId(Ecal, EcalEndcap) { - id_ |= (crystal_iy & 0x7f) | ((crystal_ix & 0x7f) << 7) | ((iz > 0) ? (0x4000) : (0)); - } - // slow - EEDetId(int i, int j, int iz, int mode); + // fast + EEDetId(int crystal_ix, int crystal_iy, int iz) : DetId(Ecal, EcalEndcap) { + id_ |= (crystal_iy & 0x7f) | ((crystal_ix & 0x7f) << 7) | ((iz > 0) ? (0x4000) : (0)); + } + // slow + EEDetId(int i, int j, int iz, int mode); - /** Constructor from a generic cell id + /** Constructor from a generic cell id * @param id source detid */ - EEDetId(const DetId& id) : DetId(id) {} + EEDetId(const DetId& id) : DetId(id) {} - /** Assignment operator + /** Assignment operator * @param id source det id */ - EEDetId& operator=(const DetId& id) { - id_ = id.rawId(); - return *this; - } + EEDetId& operator=(const DetId& id) { + id_ = id.rawId(); + return *this; + } - /** Gets the subdetector + /** Gets the subdetector * @return subdetectot ID, that is EcalEndcap */ - static EcalSubdetector subdet() { return EcalEndcap; } + static EcalSubdetector subdet() { return EcalEndcap; } - /** Gets the z-side of the crystal (1/-1) + /** Gets the z-side of the crystal (1/-1) * @return -1 for EE-, +1 for EE+ */ - int zside() const { return (id_ & 0x4000) ? (1) : (-1); } + int zside() const { return (id_ & 0x4000) ? (1) : (-1); } - /** Gets the crystal x-index. + /** Gets the crystal x-index. * @see EEDetId(int, int, int, int) for x-index definition * @return x-index */ - int ix() const { return (id_ >> 7) & 0x7F; } + int ix() const { return (id_ >> 7) & 0x7F; } - /** Get the crystal y-index + /** Get the crystal y-index * @see EEDetId(int, int, int, int) for y-index definition. * @return y-index */ - int iy() const { return id_ & 0x7F; } + int iy() const { return id_ & 0x7F; } - /** Gets the DetId of the supercrystal the crystal belong to. + /** Gets the DetId of the supercrystal the crystal belong to. * @return the supercrystal det id * @throw cms::Exception if the crystal det id is invalid */ - EcalScDetId sc() const { - const int scEdge = 5; - return EcalScDetId(1 + (ix() - 1) / scEdge, 1 + (iy() - 1) / scEdge, zside()); - } + EcalScDetId sc() const { + const int scEdge = 5; + return EcalScDetId(1 + (ix() - 1) / scEdge, 1 + (iy() - 1) / scEdge, zside()); + } - /** Gets the SuperCrystal number within the endcap. This number runs from 1 to 316, + /** Gets the SuperCrystal number within the endcap. This number runs from 1 to 316, * numbers 70 149 228 307 are not used. * * BEWARE: This number is not consistent with indices used in constructor: see details below. @@ -123,9 +124,9 @@ class EEDetId : public DetId { * considers the isc as a local index. The discrepancy is most probably due to a bug in the * implementation of this isc() method. */ - int isc() const; + int isc() const; - /** Gets crystal number inside SuperCrystal. + /** Gets crystal number inside SuperCrystal. * Crystal numbering withing a supercrystal in each quadrant: * \verbatim * A y @@ -148,9 +149,9 @@ class EEDetId : public DetId { * * @return crystal number from 1 to 25 */ - int ic() const; + int ic() const; - /** Gets the quadrant of the DetId. + /** Gets the quadrant of the DetId. * Quadrant number definition, x and y in std CMS coordinates, for EE+: * * \verbatim @@ -166,195 +167,196 @@ class EEDetId : public DetId { * * @return quadrant number */ - int iquadrant() const; + int iquadrant() const; - /** Checks if crystal is in EE+ + /** Checks if crystal is in EE+ * @return true for EE+, false for EE- */ - bool positiveZ() const { return id_ & 0x4000; } + bool positiveZ() const { return id_ & 0x4000; } - int iPhiOuterRing() const; // 1-360 else==0 if not on outer ring! + int iPhiOuterRing() const; // 1-360 else==0 if not on outer ring! - static EEDetId idOuterRing(int iPhi, int zEnd); + static EEDetId idOuterRing(int iPhi, int zEnd); - /** Gets a compact index for arrays + /** Gets a compact index for arrays * @return compact index from 0 to kSizeForDenseIndexing-1 */ - int hashedIndex() const { - const uint32_t jx(ix()); - const uint32_t jd(2 * (iy() - 1) + (jx - 1) / 50); - return ((positiveZ() ? kEEhalf : 0) + kdi[jd] + jx - kxf[jd]); - } + int hashedIndex() const { + const uint32_t jx(ix()); + const uint32_t jd(2 * (iy() - 1) + (jx - 1) / 50); + return ((positiveZ() ? kEEhalf : 0) + kdi[jd] + jx - kxf[jd]); + } - /** Same as hashedIndex() + /** Same as hashedIndex() * @return compact index from 0 to kSizeForDenseIndexing-1 */ - uint32_t denseIndex() const { return hashedIndex(); } + uint32_t denseIndex() const { return hashedIndex(); } - /** returns a new EEDetId offset by nrStepsX and nrStepsY (can be negative), + /** returns a new EEDetId offset by nrStepsX and nrStepsY (can be negative), * returns EEDetId(0) if invalid */ - EEDetId offsetBy(int nrStepsX, int nrStepsY) const; + EEDetId offsetBy(int nrStepsX, int nrStepsY) const; - /** returns a new EEDetId swapped (same iX, iY) to the other endcap, + /** returns a new EEDetId swapped (same iX, iY) to the other endcap, * returns EEDetId(0) if invalid (shouldnt happen) */ - EEDetId switchZSide() const; + EEDetId switchZSide() const; - /** following are static member functions of the above two functions + /** following are static member functions of the above two functions * which take and return a DetId, returns DetId(0) if invalid */ - static DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY); - static DetId switchZSide(const DetId startId); + static DetId offsetBy(const DetId startId, int nrStepsX, int nrStepsY); + static DetId switchZSide(const DetId startId); - /** Checks validity of a dense/hashed index + /** Checks validity of a dense/hashed index * @param din dense/hashed index as returned by hashedIndex() or denseIndex() * method * @return true if index is valid, false otherwise */ - static bool validDenseIndex(uint32_t din) { return validHashIndex(din); } + static bool validDenseIndex(uint32_t din) { return validHashIndex(din); } - /** Converts a hashed/dense index as defined in hashedIndex() and denseIndex() + /** Converts a hashed/dense index as defined in hashedIndex() and denseIndex() * methods to a det id. * @param din hashed/dense index * @return det id */ - static EEDetId detIdFromDenseIndex(uint32_t din) { return unhashIndex(din); } + static EEDetId detIdFromDenseIndex(uint32_t din) { return unhashIndex(din); } - static bool isNextToBoundary(EEDetId id); + static bool isNextToBoundary(EEDetId id); - static bool isNextToDBoundary(EEDetId id); + static bool isNextToDBoundary(EEDetId id); - static bool isNextToRingBoundary(EEDetId id); + static bool isNextToRingBoundary(EEDetId id); - /** Gets a DetId from a compact index for arrays. Converse of hashedIndex() method. + /** Gets a DetId from a compact index for arrays. Converse of hashedIndex() method. * @param hi dense/hashed index * @return det id */ - static EEDetId unhashIndex(int hi); + static EEDetId unhashIndex(int hi); - /** Checks if a hashed/dense index is valid + /** Checks if a hashed/dense index is valid * @see hashedIndex(), denseIndex() * @param i hashed/dense index * @return true if the index is valid, false otherwise */ - static bool validHashIndex(int i) { return (i < kSizeForDenseIndexing); } + static bool validHashIndex(int i) { return (i < kSizeForDenseIndexing); } - /** Checks validity of a crystal (x,y.z) index triplet. + /** Checks validity of a crystal (x,y.z) index triplet. * @param crystal_ix crystal x-index * @param crystal_iy crystal y-index * @param iz crystal z-index * @see EEDetId(int, int, int, int) for index definition * @return true if valid, false otherwise */ - static bool validDetId(int crystal_ix, int crystal_iy, int iz) { - return crystal_ix >= IX_MIN && crystal_ix <= IX_MAX && crystal_iy >= IY_MIN && crystal_iy <= IY_MAX && - std::abs(iz) == 1 && (fastValidDetId(crystal_ix, crystal_iy) || slowValidDetId(crystal_ix, crystal_iy)); - } - static bool slowValidDetId(int crystal_ix, int crystal_iy); + static bool validDetId(int crystal_ix, int crystal_iy, int iz) { + return crystal_ix >= IX_MIN && crystal_ix <= IX_MAX && crystal_iy >= IY_MIN && crystal_iy <= IY_MAX && + std::abs(iz) == 1 && (fastValidDetId(crystal_ix, crystal_iy) || slowValidDetId(crystal_ix, crystal_iy)); + } + static bool slowValidDetId(int crystal_ix, int crystal_iy); - /** check if ix and iy is in a "ring" inscribed in EE + /** check if ix and iy is in a "ring" inscribed in EE * if is inside is valid for sure * if not the slow version shall be called */ - static bool fastValidDetId(int crystal_ix, int crystal_iy) { - float x = crystal_ix; - float y = crystal_iy; - float r = (x - 50.5f) * (x - 50.5f) + (y - 50.5f) * (y - 50.5f); - return r > 12.f * 12.f && r < 48.f * 48.f; - } + static bool fastValidDetId(int crystal_ix, int crystal_iy) { + float x = crystal_ix; + float y = crystal_iy; + float r = (x - 50.5f) * (x - 50.5f) + (y - 50.5f) * (y - 50.5f); + return r > 12.f * 12.f && r < 48.f * 48.f; + } - /** Returns the distance along x-axis in crystal units between two EEDetId + /** Returns the distance along x-axis in crystal units between two EEDetId * @param a det id of first crystal * @param b det id of second crystal * @return distance */ - static int distanceX(const EEDetId& a, const EEDetId& b); + static int distanceX(const EEDetId& a, const EEDetId& b); - /** Returns the distance along y-axis in crystal units between two EEDetId + /** Returns the distance along y-axis in crystal units between two EEDetId * @param a det id of first crystal * @param b det id of second crystal * @return distance */ - static int distanceY(const EEDetId& a, const EEDetId& b); + static int distanceY(const EEDetId& a, const EEDetId& b); - /** Gives supercrystal index from endcap *supercrystal* x and y indexes. + /** Gives supercrystal index from endcap *supercrystal* x and y indexes. * @see isc() for the index definition * @param iscCol supercrystal column number: supecrystal x-index for EE+ * @param iscRow: supecrystal y-index * @return supercystal index */ - static int isc(int iscCol, // output is 1-316 - int iscRow); // + static int isc(int iscCol, // output is 1-316 + int iscRow); // - /** Lower bound of EE crystal x-index + /** Lower bound of EE crystal x-index */ - static const int IX_MIN = 1; + static const int IX_MIN = 1; - /** Lower bound of EE crystal y-index + /** Lower bound of EE crystal y-index */ - static const int IY_MIN = 1; + static const int IY_MIN = 1; - /** Upper bound of EE crystal y-index + /** Upper bound of EE crystal y-index */ - static const int IX_MAX = 100; + static const int IX_MAX = 100; - /** Upper bound of EE crystal y-index + /** Upper bound of EE crystal y-index */ - static const int IY_MAX = 100; + static const int IY_MAX = 100; - /** Lower bound of supercystal index as defined in isc() + /** Lower bound of supercystal index as defined in isc() */ - static const int ISC_MIN = 1; + static const int ISC_MIN = 1; - /** Lower bound of crystal index within a supercrystal + /** Lower bound of crystal index within a supercrystal */ - static const int ICR_MIN = 1; + static const int ICR_MIN = 1; - /** Upper bound of supercystal index defined in isc() + /** Upper bound of supercystal index defined in isc() *

Beware it differs from the number of supercrystals in one endcap, * which is 312, because the numbering is not dense. */ - static const int ISC_MAX = 316; + static const int ISC_MAX = 316; - /** Upper bound of crystal index within a supercrystal + /** Upper bound of crystal index within a supercrystal */ - static const int ICR_MAX = 25; + static const int ICR_MAX = 25; - /** Number of crystals per Dee + /** Number of crystals per Dee */ - static constexpr int kEEhalf = 7324; - /** Number of dense crystal indices, that is number of + static constexpr int kEEhalf = 7324; + /** Number of dense crystal indices, that is number of * crystals per endcap. */ - static constexpr int kSizeForDenseIndexing = 2 * kEEhalf; + static constexpr int kSizeForDenseIndexing = 2 * kEEhalf; - /*@{*/ - /** function modes for EEDetId(int, int, int, int) constructor + /*@{*/ + /** function modes for EEDetId(int, int, int, int) constructor */ - static const int XYMODE = 0; - static const int SCCRYSTALMODE = 1; - /*@}*/ - -private: - bool isOuterRing() const; + static const int XYMODE = 0; + static const int SCCRYSTALMODE = 1; + /*@}*/ - static bool isOuterRingXY(int ax, int ay); + private: + bool isOuterRing() const; - //Functions from B. Kennedy to retrieve ix and iy from SC and Crystal number + static bool isOuterRingXY(int ax, int ay); - static const int nCols = 10; - static const int nCrys = 5; /* Number of crystals per row in SC */ - static const int QuadColLimits[nCols + 1]; - static const int iYoffset[nCols + 1]; + //Functions from B. Kennedy to retrieve ix and iy from SC and Crystal number - static const unsigned short kxf[2 * IY_MAX]; - static const unsigned short kdi[2 * IY_MAX]; + static const int nCols = 10; + static const int nCrys = 5; /* Number of crystals per row in SC */ + static const int QuadColLimits[nCols + 1]; + static const int iYoffset[nCols + 1]; - int ix(int iSC, int iCrys) const; - int iy(int iSC, int iCrys) const; - int ixQuadrantOne() const; - int iyQuadrantOne() const; -}; + static const unsigned short kxf[2 * IY_MAX]; + static const unsigned short kdi[2 * IY_MAX]; -std::ostream& operator<<(std::ostream& s, const EEDetId& id); + int ix(int iSC, int iCrys) const; + int iy(int iSC, int iCrys) const; + int ixQuadrantOne() const; + int iyQuadrantOne() const; + }; + std::ostream& operator<<(std::ostream& s, const EEDetId& id); +} // namespace io_v1 +using EEDetId = io_v1::EEDetId; #endif diff --git a/DataFormats/EcalDetId/interface/EEDetIdFwd.h b/DataFormats/EcalDetId/interface/EEDetIdFwd.h index b66eceaa0add6..c327c56121574 100644 --- a/DataFormats/EcalDetId/interface/EEDetIdFwd.h +++ b/DataFormats/EcalDetId/interface/EEDetIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_EcalDetId_EEDetIdFwd_h #define DataFormats_EcalDetId_EEDetIdFwd_h -class EEDetId; +namespace io_v1 { + class EEDetId; +} +using EEDetId = io_v1::EEDetId; #endif diff --git a/DataFormats/EcalDetId/interface/EcalElectronicsId.h b/DataFormats/EcalDetId/interface/EcalElectronicsId.h index d706273c5fe7b..c932105a1dd31 100644 --- a/DataFormats/EcalDetId/interface/EcalElectronicsId.h +++ b/DataFormats/EcalDetId/interface/EcalElectronicsId.h @@ -15,79 +15,81 @@ Index starts from 1 */ -class EcalElectronicsId { -public: - /** Default constructor -- invalid value */ - EcalElectronicsId(); - /** from raw */ - EcalElectronicsId(uint32_t); - /** Constructor from dcc,tower,channel **/ - EcalElectronicsId(int dccid, int towerid, int stripid, int xtalid); - - uint32_t operator()() { return EcalElectronicsId_; } - uint32_t rawId() const { return EcalElectronicsId_; } - - /// get the DCC (Ecal Local DCC value not global one) id - int dccId() const { return (EcalElectronicsId_ >> 13) & 0x7F; } - /// get the tower id - int towerId() const { return (EcalElectronicsId_ >> 6) & 0x7F; } - /// get the tower id - int stripId() const { return (EcalElectronicsId_ >> 3) & 0x7; } - /// get the channel id - int xtalId() const { return (EcalElectronicsId_ & 0x7); } - - /// zside = +1 or -1 - int zside() const; - - /// get the subdet - EcalSubdetector subdet() const; - - /// get a fast, compact, unique index for linear lookups (maximum value = 4194303) - int linearIndex() const { return (EcalElectronicsId_) & 0x3FFFFF; } - - /// so far for EndCap only : - int channelId() const; // xtal id between 1 and 25 - - static const int MAX_DCCID = 54; //To be updated with correct and final number - static const int MIN_DCCID = 1; - static const int MAX_TOWERID = 70; - static const int MIN_TOWERID = 1; - static const int MAX_STRIPID = 5; - static const int MIN_STRIPID = 1; - static const int MAX_CHANNELID = 25; - static const int MIN_CHANNELID = 1; - static const int MAX_XTALID = 5; - static const int MIN_XTALID = 1; - - static const int MIN_DCCID_EEM = 1; - static const int MAX_DCCID_EEM = 9; - static const int MIN_DCCID_EBM = 10; - static const int MAX_DCCID_EBM = 27; - static const int MIN_DCCID_EBP = 28; - static const int MAX_DCCID_EBP = 45; - static const int MIN_DCCID_EEP = 46; - static const int MAX_DCCID_EEP = 54; - - static const int DCCID_PHI0_EBM = 10; - static const int DCCID_PHI0_EBP = 28; - - static const int kDCCChannelBoundary = 17; - static const int DCC_EBM = 10; // id of the DCC in EB- which contains phi=0 deg. - static const int DCC_EBP = 28; // id of the DCC in EB+ which contains phi=0 deg. - static const int DCC_EEM = 1; // id of the DCC in EE- which contains phi=0 deg. - static const int DCC_EEP = 46; // id of the DCC in EE+ which contains phi=0 deg. - - /** Equality operator */ - int operator==(const EcalElectronicsId& id) const { return id.EcalElectronicsId_ == EcalElectronicsId_; } - /** Non-Equality operator */ - int operator!=(const EcalElectronicsId& id) const { return id.EcalElectronicsId_ != EcalElectronicsId_; } - /// Compare the id to another id for use in a map - int operator<(const EcalElectronicsId& id) const { return EcalElectronicsId_ < id.EcalElectronicsId_; } - -private: - uint32_t EcalElectronicsId_; -}; - -std::ostream& operator<<(std::ostream&, const EcalElectronicsId&); - +namespace io_v1 { + class EcalElectronicsId { + public: + /** Default constructor -- invalid value */ + EcalElectronicsId(); + /** from raw */ + EcalElectronicsId(uint32_t); + /** Constructor from dcc,tower,channel **/ + EcalElectronicsId(int dccid, int towerid, int stripid, int xtalid); + + uint32_t operator()() { return EcalElectronicsId_; } + uint32_t rawId() const { return EcalElectronicsId_; } + + /// get the DCC (Ecal Local DCC value not global one) id + int dccId() const { return (EcalElectronicsId_ >> 13) & 0x7F; } + /// get the tower id + int towerId() const { return (EcalElectronicsId_ >> 6) & 0x7F; } + /// get the tower id + int stripId() const { return (EcalElectronicsId_ >> 3) & 0x7; } + /// get the channel id + int xtalId() const { return (EcalElectronicsId_ & 0x7); } + + /// zside = +1 or -1 + int zside() const; + + /// get the subdet + EcalSubdetector subdet() const; + + /// get a fast, compact, unique index for linear lookups (maximum value = 4194303) + int linearIndex() const { return (EcalElectronicsId_) & 0x3FFFFF; } + + /// so far for EndCap only : + int channelId() const; // xtal id between 1 and 25 + + static const int MAX_DCCID = 54; //To be updated with correct and final number + static const int MIN_DCCID = 1; + static const int MAX_TOWERID = 70; + static const int MIN_TOWERID = 1; + static const int MAX_STRIPID = 5; + static const int MIN_STRIPID = 1; + static const int MAX_CHANNELID = 25; + static const int MIN_CHANNELID = 1; + static const int MAX_XTALID = 5; + static const int MIN_XTALID = 1; + + static const int MIN_DCCID_EEM = 1; + static const int MAX_DCCID_EEM = 9; + static const int MIN_DCCID_EBM = 10; + static const int MAX_DCCID_EBM = 27; + static const int MIN_DCCID_EBP = 28; + static const int MAX_DCCID_EBP = 45; + static const int MIN_DCCID_EEP = 46; + static const int MAX_DCCID_EEP = 54; + + static const int DCCID_PHI0_EBM = 10; + static const int DCCID_PHI0_EBP = 28; + + static const int kDCCChannelBoundary = 17; + static const int DCC_EBM = 10; // id of the DCC in EB- which contains phi=0 deg. + static const int DCC_EBP = 28; // id of the DCC in EB+ which contains phi=0 deg. + static const int DCC_EEM = 1; // id of the DCC in EE- which contains phi=0 deg. + static const int DCC_EEP = 46; // id of the DCC in EE+ which contains phi=0 deg. + + /** Equality operator */ + int operator==(const EcalElectronicsId& id) const { return id.EcalElectronicsId_ == EcalElectronicsId_; } + /** Non-Equality operator */ + int operator!=(const EcalElectronicsId& id) const { return id.EcalElectronicsId_ != EcalElectronicsId_; } + /// Compare the id to another id for use in a map + int operator<(const EcalElectronicsId& id) const { return EcalElectronicsId_ < id.EcalElectronicsId_; } + + private: + uint32_t EcalElectronicsId_; + }; + + std::ostream& operator<<(std::ostream&, const EcalElectronicsId&); +} // namespace io_v1 +using EcalElectronicsId = io_v1::EcalElectronicsId; #endif diff --git a/DataFormats/EcalDetId/interface/EcalElectronicsIdFwd.h b/DataFormats/EcalDetId/interface/EcalElectronicsIdFwd.h index e080f9ee71fc3..34a6f7a4eab25 100644 --- a/DataFormats/EcalDetId/interface/EcalElectronicsIdFwd.h +++ b/DataFormats/EcalDetId/interface/EcalElectronicsIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_EcalDetId_EcalElectronicsIdFwd_h #define DataFormats_EcalDetId_EcalElectronicsIdFwd_h -class EcalElectronicsId; +namespace io_v1 { + class EcalElectronicsId; +} +using EcalElectronicsId = io_v1::EcalElectronicsId; #endif diff --git a/DataFormats/EcalDetId/src/EBDetId.cc b/DataFormats/EcalDetId/src/EBDetId.cc index d73763dcc9f67..b65612a7a5373 100644 --- a/DataFormats/EcalDetId/src/EBDetId.cc +++ b/DataFormats/EcalDetId/src/EBDetId.cc @@ -142,7 +142,10 @@ float EBDetId::approxEta(const DetId id) { } } +namespace io_v1 { #include -std::ostream& operator<<(std::ostream& s, const EBDetId& id) { - return s << "(EB ieta " << id.ieta() << ", iphi " << id.iphi() << " ; ism " << id.ism() << " , ic " << id.ic() << ')'; -} + std::ostream& operator<<(std::ostream& s, const EBDetId& id) { + return s << "(EB ieta " << id.ieta() << ", iphi " << id.iphi() << " ; ism " << id.ism() << " , ic " << id.ic() + << ')'; + } +} // namespace io_v1 diff --git a/DataFormats/EcalDetId/src/EEDetId.cc b/DataFormats/EcalDetId/src/EEDetId.cc index 3e674974f8283..58e7ed429445a 100644 --- a/DataFormats/EcalDetId/src/EEDetId.cc +++ b/DataFormats/EcalDetId/src/EEDetId.cc @@ -476,6 +476,8 @@ int EEDetId::distanceX(const EEDetId& a, const EEDetId& b) { return abs(a.ix() - int EEDetId::distanceY(const EEDetId& a, const EEDetId& b) { return abs(a.iy() - b.iy()); } #include -std::ostream& operator<<(std::ostream& s, const EEDetId& id) { - return s << "(EE iz " << ((id.zside() > 0) ? ("+ ") : ("- ")) << " ix " << id.ix() << " , iy " << id.iy() << ')'; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const EEDetId& id) { + return s << "(EE iz " << ((id.zside() > 0) ? ("+ ") : ("- ")) << " ix " << id.ix() << " , iy " << id.iy() << ')'; + } +} // namespace io_v1 diff --git a/DataFormats/EcalDetId/src/classes_def.xml b/DataFormats/EcalDetId/src/classes_def.xml index 36b45e8019cb2..2c010ad1f2f51 100644 --- a/DataFormats/EcalDetId/src/classes_def.xml +++ b/DataFormats/EcalDetId/src/classes_def.xml @@ -1,63 +1,51 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - + + - + - - + + - + diff --git a/DataFormats/EcalDigi/interface/EBDigiCollectionFwd.h b/DataFormats/EcalDigi/interface/EBDigiCollectionFwd.h index a2e010a851951..107d96fa31cff 100644 --- a/DataFormats/EcalDigi/interface/EBDigiCollectionFwd.h +++ b/DataFormats/EcalDigi/interface/EBDigiCollectionFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_EcalDigi_EBDigiCollectionFwd_h #define DataFormats_EcalDigi_EBDigiCollectionFwd_h -class EBDigiCollection; +namespace io_v1 { + class EBDigiCollection; +} +using EBDigiCollection = io_v1::EBDigiCollection; #endif diff --git a/DataFormats/EcalDigi/interface/EBSrFlag.h b/DataFormats/EcalDigi/interface/EBSrFlag.h index d08dab0e7c5f6..71d5e173a5851 100644 --- a/DataFormats/EcalDigi/interface/EBSrFlag.h +++ b/DataFormats/EcalDigi/interface/EBSrFlag.h @@ -10,37 +10,40 @@ /** This class holds a Selective Readout Flag (SRF) associated to an * ECAL barrel trigger tower. */ -class EBSrFlag : public EcalSrFlag { -public: - typedef EcalTrigTowerDetId key_type; //key for edm::SortedCollection +namespace io_v1 { + class EBSrFlag : public EcalSrFlag { + public: + typedef EcalTrigTowerDetId key_type; //key for edm::SortedCollection -public: - /** Default constructor. + public: + /** Default constructor. */ - EBSrFlag() {} + EBSrFlag() {} - /** Constructor + /** Constructor * @param tt trigger tower det id. * @param flag the srp flag, an integer in [0,7]. See constants SRF_xxx in EcalSrFlags class. */ - EBSrFlag(const EcalTrigTowerDetId& tt, const int& flag) : ttId_(tt) { - //SRP flag is coded on 3 bits: - if (flag < 0 || flag > 0x7) - throw cms::Exception("InvalidValue", "srp flag greater than 0x7 or negative."); - flag_ = (unsigned char)flag; - } - - /** For edm::SortedCollection. + EBSrFlag(const EcalTrigTowerDetId& tt, const int& flag) : ttId_(tt) { + //SRP flag is coded on 3 bits: + if (flag < 0 || flag > 0x7) + throw cms::Exception("InvalidValue", "srp flag greater than 0x7 or negative."); + flag_ = (unsigned char)flag; + } + + /** For edm::SortedCollection. * @return det id of the trigger tower the flag is assigned to. */ - const EcalTrigTowerDetId& id() const override { return ttId_; } + const EcalTrigTowerDetId& id() const override { return ttId_; } -private: - /** trigger tower id + private: + /** trigger tower id */ - EcalTrigTowerDetId ttId_; -}; + EcalTrigTowerDetId ttId_; + }; -std::ostream& operator<<(std::ostream& s, const EBSrFlag& digi); + std::ostream& operator<<(std::ostream& s, const EBSrFlag& digi); +} // namespace io_v1 +using EBSrFlag = io_v1::EBSrFlag; #endif //EBSRFLAG_H not defined diff --git a/DataFormats/EcalDigi/interface/EEDigiCollectionFwd.h b/DataFormats/EcalDigi/interface/EEDigiCollectionFwd.h index 3ef8513809dae..cc4392244ebdd 100644 --- a/DataFormats/EcalDigi/interface/EEDigiCollectionFwd.h +++ b/DataFormats/EcalDigi/interface/EEDigiCollectionFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_EcalDigi_EEDigiCollectionFwd_h #define DataFormats_EcalDigi_EEDigiCollectionFwd_h -class EEDigiCollection; - +namespace io_v1 { + class EEDigiCollection; +} +using EEDigiCollection = io_v1::EEDigiCollection; #endif diff --git a/DataFormats/EcalDigi/interface/EESrFlag.h b/DataFormats/EcalDigi/interface/EESrFlag.h index f2d59273f53a8..9c2a7ab0669d5 100644 --- a/DataFormats/EcalDigi/interface/EESrFlag.h +++ b/DataFormats/EcalDigi/interface/EESrFlag.h @@ -10,38 +10,41 @@ /** This class holds a Selective Readout Flag (SRF) associated to an * ECAL endcap supercrystal. */ -class EESrFlag : public EcalSrFlag { -public: -public: - typedef EcalScDetId key_type; //key for edm::SortedCollection - -public: - /** Default constructor. +namespace io_v1 { + class EESrFlag : public EcalSrFlag { + public: + public: + typedef EcalScDetId key_type; //key for edm::SortedCollection + + public: + /** Default constructor. */ - EESrFlag() {} + EESrFlag() {} - /** Constructor + /** Constructor * @param sc supercrystal det id * @param flag the srp flag, an integer in [0,7]. See constants SRF_xxx in EcalSrFlags class. */ - EESrFlag(const EcalScDetId& sc, const int& flag) : scId_(sc) { - //SRP flag is coded on 3 bits: - if (flag < 0 || flag > 0x7) - throw cms::Exception("InvalidValue", "srp flag greater than 0x7 or negative."); - flag_ = (unsigned char)flag; - } - - /** For edm::SortedCollection. + EESrFlag(const EcalScDetId& sc, const int& flag) : scId_(sc) { + //SRP flag is coded on 3 bits: + if (flag < 0 || flag > 0x7) + throw cms::Exception("InvalidValue", "srp flag greater than 0x7 or negative."); + flag_ = (unsigned char)flag; + } + + /** For edm::SortedCollection. * @return det id of the trigger tower the flag is assigned to. */ - const EcalScDetId& id() const override { return scId_; } + const EcalScDetId& id() const override { return scId_; } -private: - /** trigger tower id + private: + /** trigger tower id */ - EcalScDetId scId_; -}; + EcalScDetId scId_; + }; -std::ostream& operator<<(std::ostream& s, const EESrFlag& digi); + std::ostream& operator<<(std::ostream& s, const EESrFlag& digi); +} // namespace io_v1 +using EESrFlag = io_v1::EESrFlag; #endif //EESRFLAG_H not defined diff --git a/DataFormats/EcalDigi/interface/ESDigiCollectionFwd.h b/DataFormats/EcalDigi/interface/ESDigiCollectionFwd.h index 99df8428e7dd8..7e5f77b6adbc4 100644 --- a/DataFormats/EcalDigi/interface/ESDigiCollectionFwd.h +++ b/DataFormats/EcalDigi/interface/ESDigiCollectionFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_EcalDigi_ESDigiCollectionFwd_h #define DataFormats_EcalDigi_ESDigiCollectionFwd_h -class ESDigiCollection; +namespace io_v1 { + class ESDigiCollection; +} +using ESDigiCollection = io_v1::ESDigiCollection; #endif diff --git a/DataFormats/EcalDigi/interface/EcalDigiCollections.h b/DataFormats/EcalDigi/interface/EcalDigiCollections.h index 5a86f3a0bf8a5..50fe1179eb41f 100644 --- a/DataFormats/EcalDigi/interface/EcalDigiCollections.h +++ b/DataFormats/EcalDigi/interface/EcalDigiCollections.h @@ -58,71 +58,77 @@ class EcalDigiCollection : public edm::DataFrameContainer { }; // make edm (and ecal client) happy -class EBDigiCollection : public EcalDigiCollection { -public: - typedef edm::DataFrameContainer::size_type size_type; - typedef EBDataFrame Digi; - typedef Digi::key_type DetId; - - EBDigiCollection(size_type istride = MAXSAMPLES) : EcalDigiCollection(istride, EcalBarrel) {} - void swap(EBDigiCollection& other) { this->EcalDigiCollection::swap(other); } - void swap(EBDigiCollection::IdContainer& otherIds, EBDigiCollection::DataContainer& otherData) { - this->EcalDigiCollection::swap(otherIds, otherData); - } - void push_back(const Digi& digi) { DataFrameContainer::push_back(digi.id(), digi.frame().begin()); } - void push_back(id_type iid) { DataFrameContainer::push_back(iid); } - void push_back(id_type iid, data_type const* idata) { DataFrameContainer::push_back(iid, idata); } -}; - -class EEDigiCollection : public EcalDigiCollection { -public: - typedef edm::DataFrameContainer::size_type size_type; - typedef EEDataFrame Digi; - typedef Digi::key_type DetId; - - EEDigiCollection(size_type istride = MAXSAMPLES) : EcalDigiCollection(istride, EcalEndcap) {} - void swap(EEDigiCollection& other) { this->EcalDigiCollection::swap(other); } - void swap(EEDigiCollection::IdContainer& otherIds, EEDigiCollection::DataContainer& otherData) { - this->EcalDigiCollection::swap(otherIds, otherData); - } - void push_back(const Digi& digi) { edm::DataFrameContainer::push_back(digi.id(), digi.frame().begin()); } - void push_back(id_type iid) { DataFrameContainer::push_back(iid); } - void push_back(id_type iid, data_type const* idata) { DataFrameContainer::push_back(iid, idata); } -}; - -class ESDigiCollection : public EcalDigiCollection { -public: - typedef edm::DataFrameContainer::size_type size_type; - typedef ESDataFrame Digi; - typedef Digi::key_type DetId; - - static const size_type NSAMPLE = ESDataFrame::MAXSAMPLES; - ESDigiCollection(size_type istride = NSAMPLE) : EcalDigiCollection(istride, EcalPreshower) {} - void swap(ESDigiCollection& other) { this->EcalDigiCollection::swap(other); } - - void push_back(unsigned int i) { DataFrameContainer::push_back(i); } - - void push_back(const Digi& digi) { - uint16_t esdata[NSAMPLE]; - for (unsigned int i(0); i != NSAMPLE; ++i) { - static const int offset(65536); // for int16 to uint16 - const int16_t dshort(digi[i].raw()); - const int dint((int)dshort + // add offset for uint16 conversion - ((int16_t)0 > dshort ? offset : (int)0)); - esdata[i] = dint; +namespace io_v1 { + class EBDigiCollection : public EcalDigiCollection { + public: + typedef edm::DataFrameContainer::size_type size_type; + typedef EBDataFrame Digi; + typedef Digi::key_type DetId; + + EBDigiCollection(size_type istride = MAXSAMPLES) : EcalDigiCollection(istride, EcalBarrel) {} + void swap(EBDigiCollection& other) { this->EcalDigiCollection::swap(other); } + void swap(EBDigiCollection::IdContainer& otherIds, EBDigiCollection::DataContainer& otherData) { + this->EcalDigiCollection::swap(otherIds, otherData); } - EcalDigiCollection::push_back(digi.id()(), esdata); - } -}; - + void push_back(const Digi& digi) { DataFrameContainer::push_back(digi.id(), digi.frame().begin()); } + void push_back(id_type iid) { DataFrameContainer::push_back(iid); } + void push_back(id_type iid, data_type const* idata) { DataFrameContainer::push_back(iid, idata); } + }; + + class EEDigiCollection : public EcalDigiCollection { + public: + typedef edm::DataFrameContainer::size_type size_type; + typedef EEDataFrame Digi; + typedef Digi::key_type DetId; + + EEDigiCollection(size_type istride = MAXSAMPLES) : EcalDigiCollection(istride, EcalEndcap) {} + void swap(EEDigiCollection& other) { this->EcalDigiCollection::swap(other); } + void swap(EEDigiCollection::IdContainer& otherIds, EEDigiCollection::DataContainer& otherData) { + this->EcalDigiCollection::swap(otherIds, otherData); + } + void push_back(const Digi& digi) { edm::DataFrameContainer::push_back(digi.id(), digi.frame().begin()); } + void push_back(id_type iid) { DataFrameContainer::push_back(iid); } + void push_back(id_type iid, data_type const* idata) { DataFrameContainer::push_back(iid, idata); } + }; + + class ESDigiCollection : public EcalDigiCollection { + public: + typedef edm::DataFrameContainer::size_type size_type; + typedef ESDataFrame Digi; + typedef Digi::key_type DetId; + + static const size_type NSAMPLE = ESDataFrame::MAXSAMPLES; + ESDigiCollection(size_type istride = NSAMPLE) : EcalDigiCollection(istride, EcalPreshower) {} + void swap(ESDigiCollection& other) { this->EcalDigiCollection::swap(other); } + + void push_back(unsigned int i) { DataFrameContainer::push_back(i); } + + void push_back(const Digi& digi) { + uint16_t esdata[NSAMPLE]; + for (unsigned int i(0); i != NSAMPLE; ++i) { + static const int offset(65536); // for int16 to uint16 + const int16_t dshort(digi[i].raw()); + const int dint((int)dshort + // add offset for uint16 conversion + ((int16_t)0 > dshort ? offset : (int)0)); + esdata[i] = dint; + } + EcalDigiCollection::push_back(digi.id()(), esdata); + } + }; +} // namespace io_v1 +using EBDigiCollection = io_v1::EBDigiCollection; +using EEDigiCollection = io_v1::EEDigiCollection; +using ESDigiCollection = io_v1::ESDigiCollection; // Free swap functions inline void swap(EcalDigiCollection& lhs, EcalDigiCollection& rhs) { lhs.swap(rhs); } -inline void swap(EBDigiCollection& lhs, EBDigiCollection& rhs) { lhs.swap(rhs); } +namespace io_v1 { + inline void swap(EBDigiCollection& lhs, EBDigiCollection& rhs) { lhs.swap(rhs); } -inline void swap(EEDigiCollection& lhs, EEDigiCollection& rhs) { lhs.swap(rhs); } + inline void swap(EEDigiCollection& lhs, EEDigiCollection& rhs) { lhs.swap(rhs); } -inline void swap(ESDigiCollection& lhs, ESDigiCollection& rhs) { lhs.swap(rhs); } + inline void swap(ESDigiCollection& lhs, ESDigiCollection& rhs) { lhs.swap(rhs); } +} // namespace io_v1 inline void swap(EcalDigiCollectionPh2& lhs, EcalDigiCollectionPh2& rhs) { lhs.swap(rhs); } diff --git a/DataFormats/EcalDigi/interface/EcalEBTriggerPrimitiveDigi.h b/DataFormats/EcalDigi/interface/EcalEBTriggerPrimitiveDigi.h index f3c586939ce81..8b4bc52b2380e 100644 --- a/DataFormats/EcalDigi/interface/EcalEBTriggerPrimitiveDigi.h +++ b/DataFormats/EcalDigi/interface/EcalEBTriggerPrimitiveDigi.h @@ -11,55 +11,56 @@ */ +namespace io_v1 { + class EcalEBTriggerPrimitiveDigi { + public: + typedef EBDetId key_type; ///< For the sorted collection -class EcalEBTriggerPrimitiveDigi { -public: - typedef EBDetId key_type; ///< For the sorted collection + EcalEBTriggerPrimitiveDigi(); // for persistence + EcalEBTriggerPrimitiveDigi(const EBDetId& id); - EcalEBTriggerPrimitiveDigi(); // for persistence - EcalEBTriggerPrimitiveDigi(const EBDetId& id); + void swap(EcalEBTriggerPrimitiveDigi& rh) { + std::swap(id_, rh.id_); + std::swap(size_, rh.size_); + std::swap(data_, rh.data_); + } - void swap(EcalEBTriggerPrimitiveDigi& rh) { - std::swap(id_, rh.id_); - std::swap(size_, rh.size_); - std::swap(data_, rh.data_); - } + const EBDetId& id() const { return id_; } + int size() const { return size_; } - const EBDetId& id() const { return id_; } - int size() const { return size_; } + const EcalEBTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } + const EcalEBTriggerPrimitiveSample& sample(int i) const { return data_[i]; } - const EcalEBTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } - const EcalEBTriggerPrimitiveSample& sample(int i) const { return data_[i]; } + void setSize(int size); + void setSample(int i, const EcalEBTriggerPrimitiveSample& sam); + void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); } - void setSize(int size); - void setSample(int i, const EcalEBTriggerPrimitiveSample& sam); - void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); } + static const int MAXSAMPLES = 20; - static const int MAXSAMPLES = 20; + /// get the 10 bits Et of interesting sample + int encodedEt() const; - /// get the 10 bits Et of interesting sample - int encodedEt() const; + /// Spike flag + bool l1aSpike() const; - /// Spike flag - bool l1aSpike() const; + /// Time info + int time() const; - /// Time info - int time() const; + /// True if debug mode (# of samples > 1) + bool isDebug() const; - /// True if debug mode (# of samples > 1) - bool isDebug() const; + /// Gets the interesting sample + int sampleOfInterest() const; - /// Gets the interesting sample - int sampleOfInterest() const; + private: + EBDetId id_; + int size_; + std::vector data_; + }; -private: - EBDetId id_; - int size_; - std::vector data_; -}; - -inline void swap(EcalEBTriggerPrimitiveDigi& lh, EcalEBTriggerPrimitiveDigi& rh) { lh.swap(rh); } - -std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveDigi& digi); + inline void swap(EcalEBTriggerPrimitiveDigi& lh, EcalEBTriggerPrimitiveDigi& rh) { lh.swap(rh); } + std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveDigi& digi); +} // namespace io_v1 +using EcalEBTriggerPrimitiveDigi = io_v1::EcalEBTriggerPrimitiveDigi; #endif diff --git a/DataFormats/EcalDigi/interface/EcalPnDiodeDigi.h b/DataFormats/EcalDigi/interface/EcalPnDiodeDigi.h index 3422f89d4839b..45981e66917f8 100644 --- a/DataFormats/EcalDigi/interface/EcalPnDiodeDigi.h +++ b/DataFormats/EcalDigi/interface/EcalPnDiodeDigi.h @@ -10,30 +10,33 @@ */ -class EcalPnDiodeDigi { -public: - typedef EcalPnDiodeDetId key_type; ///< For the sorted collection +namespace io_v1 { + class EcalPnDiodeDigi { + public: + typedef EcalPnDiodeDetId key_type; ///< For the sorted collection - EcalPnDiodeDigi(); // for persistence - explicit EcalPnDiodeDigi(const EcalPnDiodeDetId& id); + EcalPnDiodeDigi(); // for persistence + explicit EcalPnDiodeDigi(const EcalPnDiodeDetId& id); - const EcalPnDiodeDetId& id() const { return id_; } - int size() const { return size_; } + const EcalPnDiodeDetId& id() const { return id_; } + int size() const { return size_; } - const EcalFEMSample& operator[](int i) const { return data_[i]; } - const EcalFEMSample& sample(int i) const { return data_[i]; } + const EcalFEMSample& operator[](int i) const { return data_[i]; } + const EcalFEMSample& sample(int i) const { return data_[i]; } - void setSize(int size); - void setSample(int i, const EcalFEMSample& sam) { data_[i] = sam; } + void setSize(int size); + void setSample(int i, const EcalFEMSample& sam) { data_[i] = sam; } - static const int MAXSAMPLES = 50; + static const int MAXSAMPLES = 50; -private: - EcalPnDiodeDetId id_; - int size_; - std::vector data_; -}; + private: + EcalPnDiodeDetId id_; + int size_; + std::vector data_; + }; -std::ostream& operator<<(std::ostream& s, const EcalPnDiodeDigi& digi); + std::ostream& operator<<(std::ostream& s, const EcalPnDiodeDigi& digi); +} // namespace io_v1 +using EcalPnDiodeDigi = io_v1::EcalPnDiodeDigi; #endif diff --git a/DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h b/DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h index 820fcb063aa20..ac90336a719a3 100644 --- a/DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h +++ b/DataFormats/EcalDigi/interface/EcalPseudoStripInputDigi.h @@ -10,43 +10,45 @@ */ -class EcalPseudoStripInputDigi { -public: - typedef EcalTriggerElectronicsId key_type; ///< For the sorted collection +namespace io_v1 { + class EcalPseudoStripInputDigi { + public: + typedef EcalTriggerElectronicsId key_type; ///< For the sorted collection - EcalPseudoStripInputDigi(); // for persistence - explicit EcalPseudoStripInputDigi(const EcalTriggerElectronicsId& id); + EcalPseudoStripInputDigi(); // for persistence + explicit EcalPseudoStripInputDigi(const EcalTriggerElectronicsId& id); - const EcalTriggerElectronicsId& id() const { return id_; } - int size() const { return size_; } + const EcalTriggerElectronicsId& id() const { return id_; } + int size() const { return size_; } - const EcalPseudoStripInputSample& operator[](int i) const { return data_[i]; } - const EcalPseudoStripInputSample& sample(int i) const { return data_[i]; } + const EcalPseudoStripInputSample& operator[](int i) const { return data_[i]; } + const EcalPseudoStripInputSample& sample(int i) const { return data_[i]; } - void setSize(int size); - void setSample(int i, const EcalPseudoStripInputSample& sam) { data_[i] = sam; } - void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); } + void setSize(int size); + void setSample(int i, const EcalPseudoStripInputSample& sam) { data_[i] = sam; } + void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); } - static const int MAXSAMPLES = 20; + static const int MAXSAMPLES = 20; - /// get the encoded/compressed Et of interesting sample - int pseudoStripInput() const; + /// get the encoded/compressed Et of interesting sample + int pseudoStripInput() const; - /// get the fine-grain bit of interesting sample - bool fineGrain() const; + /// get the fine-grain bit of interesting sample + bool fineGrain() const; - /// True if debug mode (# of samples > 1) - bool isDebug() const; + /// True if debug mode (# of samples > 1) + bool isDebug() const; - /// Gets the interesting sample - int sampleOfInterest() const; + /// Gets the interesting sample + int sampleOfInterest() const; -private: - EcalTriggerElectronicsId id_; - int size_; - std::vector data_; -}; - -std::ostream& operator<<(std::ostream& s, const EcalPseudoStripInputDigi& digi); + private: + EcalTriggerElectronicsId id_; + int size_; + std::vector data_; + }; + std::ostream& operator<<(std::ostream& s, const EcalPseudoStripInputDigi& digi); +} // namespace io_v1 +using EcalPseudoStripInputDigi = io_v1::EcalPseudoStripInputDigi; #endif diff --git a/DataFormats/EcalDigi/interface/EcalTimeDigi.h b/DataFormats/EcalDigi/interface/EcalTimeDigi.h index 88e40a6482ffb..8bf67a0459f27 100644 --- a/DataFormats/EcalDigi/interface/EcalTimeDigi.h +++ b/DataFormats/EcalDigi/interface/EcalTimeDigi.h @@ -5,47 +5,50 @@ #include #include "DataFormats/DetId/interface/DetId.h" -class EcalTimeDigi { -public: - typedef DetId key_type; ///< For the sorted collection - - EcalTimeDigi(); // for persistence - explicit EcalTimeDigi(const DetId& id); - - void swap(EcalTimeDigi& rh) { - std::swap(id_, rh.id_); - std::swap(size_, rh.size_); - std::swap(waveform_, rh.waveform_); - std::swap(data_, rh.data_); - } - - const DetId& id() const { return id_; } - int size() const { return size_; } - - const float& operator[](unsigned int i) const { return data_[i]; } - const float& sample(unsigned int i) const { return data_[i]; } - - void setSize(unsigned int size); - void setWaveform(float* waveform); - void setSample(unsigned int i, const float sam) { data_[i] = sam; } - void setSampleOfInterest(int i) { sampleOfInterest_ = i; } - - /// Gets the BX==0 sample. If =-1 then it means that only OOT hits are present - int sampleOfInterest() const { return sampleOfInterest_; } - std::vector waveform() const { return waveform_; } - - static const unsigned int WAVEFORMSAMPLES = 250; - -private: - DetId id_; - unsigned int size_; - int sampleOfInterest_; - std::vector waveform_; - std::vector data_; -}; - -inline void swap(EcalTimeDigi& lh, EcalTimeDigi& rh) { lh.swap(rh); } - -std::ostream& operator<<(std::ostream& s, const EcalTimeDigi& digi); +namespace io_v1 { + class EcalTimeDigi { + public: + typedef DetId key_type; ///< For the sorted collection + + EcalTimeDigi(); // for persistence + explicit EcalTimeDigi(const DetId& id); + + void swap(EcalTimeDigi& rh) { + std::swap(id_, rh.id_); + std::swap(size_, rh.size_); + std::swap(waveform_, rh.waveform_); + std::swap(data_, rh.data_); + } + + const DetId& id() const { return id_; } + int size() const { return size_; } + + const float& operator[](unsigned int i) const { return data_[i]; } + const float& sample(unsigned int i) const { return data_[i]; } + + void setSize(unsigned int size); + void setWaveform(float* waveform); + void setSample(unsigned int i, const float sam) { data_[i] = sam; } + void setSampleOfInterest(int i) { sampleOfInterest_ = i; } + + /// Gets the BX==0 sample. If =-1 then it means that only OOT hits are present + int sampleOfInterest() const { return sampleOfInterest_; } + std::vector waveform() const { return waveform_; } + + static const unsigned int WAVEFORMSAMPLES = 250; + + private: + DetId id_; + unsigned int size_; + int sampleOfInterest_; + std::vector waveform_; + std::vector data_; + }; + + inline void swap(EcalTimeDigi& lh, EcalTimeDigi& rh) { lh.swap(rh); } + + std::ostream& operator<<(std::ostream& s, const EcalTimeDigi& digi); +} // namespace io_v1 +using EcalTimeDigi = io_v1::EcalTimeDigi; #endif diff --git a/DataFormats/EcalDigi/interface/EcalTrigPrimCompactColl.h b/DataFormats/EcalDigi/interface/EcalTrigPrimCompactColl.h index 05396c6d8dc19..88c7d74e7169f 100644 --- a/DataFormats/EcalDigi/interface/EcalTrigPrimCompactColl.h +++ b/DataFormats/EcalDigi/interface/EcalTrigPrimCompactColl.h @@ -24,74 +24,77 @@ author: Ph. Gras CEA/IRFU Saclay */ -class EcalTrigPrimCompactColl { -private: - static const int nPhiBins = 72; - static const int nEtaBins = 56; - static const int nBins = nPhiBins * nEtaBins; - -private: - static size_t index(int ieta, int iphi) { - size_t r = unsigned(((ieta < 0) ? (ieta + 28) : (ieta + 27)) * nPhiBins + (iphi - 1)); - if (r >= (unsigned)nBins) - throw cms::Exception("Invalid argument") - << "Trigger tower index (" << ieta << "," << iphi << ") are out of range"; - return r; - } - -public: - EcalTrigPrimCompactColl() : formatVers_(0), data_(nBins) {} - - ///Set data - void setValue(int ieta, int iphi, uint16_t sample) { data_[index(ieta, iphi)] = sample; } - - //@{ - /// get the raw word - uint16_t raw(int ieta, int iphi) const { return data_[index(ieta, iphi)]; } - uint16_t raw(const EcalTrigTowerDetId& ttId) const { return raw(ttId.ieta(), ttId.iphi()); } - //@} - - //@{ - /// get the encoded/compressed Et (8 bits) - int compressedEt(int ieta, int iphi) const { return raw(ieta, iphi) & 0xFF; } - int compressedEt(const EcalTrigTowerDetId& ttId) const { return compressedEt(ttId.ieta(), ttId.iphi()); } - //@} - - //@{ - /// get the fine-grain bit (1 bit) - bool fineGrain(int ieta, int iphi) const { return (raw(ieta, iphi) & 0x100) != 0; } - bool fineGrain(const EcalTrigTowerDetId& ttId) const { return fineGrain(ttId.ieta(), ttId.iphi()); } - //@} - - //@{ - /// get the Trigger tower Flag (3 bits) - int ttFlag(int ieta, int iphi) const { return (raw(ieta, iphi) >> 9) & 0x7; } - int ttFlag(const EcalTrigTowerDetId& ttId) const { return ttFlag(ttId.ieta(), ttId.iphi()); } - //@} - - //@{ - /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection - /// @return 0 spike like pattern - /// 1 EM shower like pattern - int sFGVB(int ieta, int iphi) const { return (raw(ieta, iphi) >> 12) & 0x1; } - int sFGVB(const EcalTrigTowerDetId& ttId) const { return sFGVB(ttId.ieta(), ttId.iphi()); } - //@} - - //@{ - /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection - /// Deprecated. Use instead sFGVB() method. Indeed the name of the method being missleading, - /// since it returns 0 for spike-compatible deposit. - /// @return 0 spike-like pattern - /// 1 EM-shower-like pattern - int l1aSpike(int ieta, int iphi) const { return sFGVB(ieta, iphi); } - int l1aSpike(const EcalTrigTowerDetId& ttId) const { return sFGVB(ttId); } - //@} - - void toEcalTrigPrimDigiCollection(EcalTrigPrimDigiCollection& dest) const; - -private: - int16_t formatVers_; - std::vector data_; -}; - +namespace io_v1 { + class EcalTrigPrimCompactColl { + private: + static const int nPhiBins = 72; + static const int nEtaBins = 56; + static const int nBins = nPhiBins * nEtaBins; + + private: + static size_t index(int ieta, int iphi) { + size_t r = unsigned(((ieta < 0) ? (ieta + 28) : (ieta + 27)) * nPhiBins + (iphi - 1)); + if (r >= (unsigned)nBins) + throw cms::Exception("Invalid argument") + << "Trigger tower index (" << ieta << "," << iphi << ") are out of range"; + return r; + } + + public: + EcalTrigPrimCompactColl() : formatVers_(0), data_(nBins) {} + + ///Set data + void setValue(int ieta, int iphi, uint16_t sample) { data_[index(ieta, iphi)] = sample; } + + //@{ + /// get the raw word + uint16_t raw(int ieta, int iphi) const { return data_[index(ieta, iphi)]; } + uint16_t raw(const EcalTrigTowerDetId& ttId) const { return raw(ttId.ieta(), ttId.iphi()); } + //@} + + //@{ + /// get the encoded/compressed Et (8 bits) + int compressedEt(int ieta, int iphi) const { return raw(ieta, iphi) & 0xFF; } + int compressedEt(const EcalTrigTowerDetId& ttId) const { return compressedEt(ttId.ieta(), ttId.iphi()); } + //@} + + //@{ + /// get the fine-grain bit (1 bit) + bool fineGrain(int ieta, int iphi) const { return (raw(ieta, iphi) & 0x100) != 0; } + bool fineGrain(const EcalTrigTowerDetId& ttId) const { return fineGrain(ttId.ieta(), ttId.iphi()); } + //@} + + //@{ + /// get the Trigger tower Flag (3 bits) + int ttFlag(int ieta, int iphi) const { return (raw(ieta, iphi) >> 9) & 0x7; } + int ttFlag(const EcalTrigTowerDetId& ttId) const { return ttFlag(ttId.ieta(), ttId.iphi()); } + //@} + + //@{ + /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection + /// @return 0 spike like pattern + /// 1 EM shower like pattern + int sFGVB(int ieta, int iphi) const { return (raw(ieta, iphi) >> 12) & 0x1; } + int sFGVB(const EcalTrigTowerDetId& ttId) const { return sFGVB(ttId.ieta(), ttId.iphi()); } + //@} + + //@{ + /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection + /// Deprecated. Use instead sFGVB() method. Indeed the name of the method being missleading, + /// since it returns 0 for spike-compatible deposit. + /// @return 0 spike-like pattern + /// 1 EM-shower-like pattern + int l1aSpike(int ieta, int iphi) const { return sFGVB(ieta, iphi); } + int l1aSpike(const EcalTrigTowerDetId& ttId) const { return sFGVB(ttId); } + //@} + + void toEcalTrigPrimDigiCollection(EcalTrigPrimDigiCollection& dest) const; + + private: + int16_t formatVers_; + std::vector data_; + }; +} // namespace io_v1 + +using EcalTrigPrimCompactColl = io_v1::EcalTrigPrimCompactColl; #endif //ECALTRIGPRIMCOMPACTCOLL_H not defined diff --git a/DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h b/DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h index 25f5ad44ce11b..4190bcba8df4e 100644 --- a/DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h +++ b/DataFormats/EcalDigi/interface/EcalTriggerPrimitiveDigi.h @@ -13,65 +13,67 @@ see also EcalTrigPrimCompactColl. */ -class EcalTriggerPrimitiveDigi { -public: - typedef EcalTrigTowerDetId key_type; ///< For the sorted collection +namespace io_v1 { + class EcalTriggerPrimitiveDigi { + public: + typedef EcalTrigTowerDetId key_type; ///< For the sorted collection - EcalTriggerPrimitiveDigi(); // for persistence - explicit EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id); + EcalTriggerPrimitiveDigi(); // for persistence + explicit EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id); - void swap(EcalTriggerPrimitiveDigi& rh) { - std::swap(id_, rh.id_); - std::swap(size_, rh.size_); - std::swap(data_, rh.data_); - } + void swap(EcalTriggerPrimitiveDigi& rh) { + std::swap(id_, rh.id_); + std::swap(size_, rh.size_); + std::swap(data_, rh.data_); + } - const EcalTrigTowerDetId& id() const { return id_; } - int size() const { return size_; } + const EcalTrigTowerDetId& id() const { return id_; } + int size() const { return size_; } - const EcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } - const EcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; } + const EcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } + const EcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; } - void setSize(int size); - void setSample(int i, const EcalTriggerPrimitiveSample& sam) { data_[i] = sam; } - void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); } + void setSize(int size); + void setSample(int i, const EcalTriggerPrimitiveSample& sam) { data_[i] = sam; } + void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); } - static const int MAXSAMPLES = 20; + static const int MAXSAMPLES = 20; - /// get the encoded/compressed Et of interesting sample - int compressedEt() const; + /// get the encoded/compressed Et of interesting sample + int compressedEt() const; - /// get the fine-grain bit of interesting sample - bool fineGrain() const; + /// get the fine-grain bit of interesting sample + bool fineGrain() const; - /// get the Trigger tower Flag of interesting sample - int ttFlag() const; + /// get the Trigger tower Flag of interesting sample + int ttFlag() const; - /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection - /// @return 0 spike like pattern - /// 1 EM shower like pattern - int sFGVB() const; + /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection + /// @return 0 spike like pattern + /// 1 EM shower like pattern + int sFGVB() const; - /// Gets the L1A spike detection flag. Beware the flag is inverted. - /// Deprecated, use instead sFGVB() method, whose name is less missleading - /// @return 0 spike like pattern - /// 1 EM shower like pattern - int l1aSpike() const { return sFGVB(); } + /// Gets the L1A spike detection flag. Beware the flag is inverted. + /// Deprecated, use instead sFGVB() method, whose name is less missleading + /// @return 0 spike like pattern + /// 1 EM shower like pattern + int l1aSpike() const { return sFGVB(); } - /// True if debug mode (# of samples > 1) - bool isDebug() const; + /// True if debug mode (# of samples > 1) + bool isDebug() const; - /// Gets the interesting sample - int sampleOfInterest() const; + /// Gets the interesting sample + int sampleOfInterest() const; -private: - EcalTrigTowerDetId id_; - int size_; - std::vector data_; -}; + private: + EcalTrigTowerDetId id_; + int size_; + std::vector data_; + }; -inline void swap(EcalTriggerPrimitiveDigi& lh, EcalTriggerPrimitiveDigi& rh) { lh.swap(rh); } - -std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi); + inline void swap(EcalTriggerPrimitiveDigi& lh, EcalTriggerPrimitiveDigi& rh) { lh.swap(rh); } + std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi); +} // namespace io_v1 +using EcalTriggerPrimitiveDigi = io_v1::EcalTriggerPrimitiveDigi; #endif diff --git a/DataFormats/EcalDigi/src/EcalEBTriggerPrimitiveDigi.cc b/DataFormats/EcalDigi/src/EcalEBTriggerPrimitiveDigi.cc index f6bf933b8aebb..1cd0322ac10cb 100644 --- a/DataFormats/EcalDigi/src/EcalEBTriggerPrimitiveDigi.cc +++ b/DataFormats/EcalDigi/src/EcalEBTriggerPrimitiveDigi.cc @@ -65,9 +65,11 @@ void EcalEBTriggerPrimitiveDigi::setSize(int size) { size_ = size; } -std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveDigi& digi) { - s << digi.id() << " " << digi.size() << " samples " << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const EcalEBTriggerPrimitiveDigi& digi) { + s << digi.id() << " " << digi.size() << " samples " << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; + } +} // namespace io_v1 diff --git a/DataFormats/EcalDigi/src/EcalTriggerPrimitiveDigi.cc b/DataFormats/EcalDigi/src/EcalTriggerPrimitiveDigi.cc index a26e4136c29cf..ff4418e2a951e 100644 --- a/DataFormats/EcalDigi/src/EcalTriggerPrimitiveDigi.cc +++ b/DataFormats/EcalDigi/src/EcalTriggerPrimitiveDigi.cc @@ -66,9 +66,11 @@ void EcalTriggerPrimitiveDigi::setSize(int size) { size_ = size; } -std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi) { - s << digi.id() << " " << digi.size() << " samples " << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi) { + s << digi.id() << " " << digi.size() << " samples " << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; + } +} // namespace io_v1 diff --git a/DataFormats/EcalDigi/src/classes_def.xml b/DataFormats/EcalDigi/src/classes_def.xml index bbebb272d029a..d1eef47494579 100644 --- a/DataFormats/EcalDigi/src/classes_def.xml +++ b/DataFormats/EcalDigi/src/classes_def.xml @@ -1,71 +1,65 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - - + + - - - + + - - + + - - - - - + + - - - + + @@ -75,15 +69,15 @@ - - - - + + + + - - + + - + @@ -92,59 +86,55 @@ - - - + + - - - + + - - - + + - - - + + - - + + - - - - + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - + + - - - - - + + + + + diff --git a/DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h b/DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h index 27c679ac3c9f7..91a2c2e25a74d 100644 --- a/DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h +++ b/DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h @@ -12,177 +12,179 @@ #define MAX_TCC_SIZE 4 #define MAX_TT_SIZE 70 -class EcalDCCHeaderBlock { -public: - typedef int key_type; ///< For the sorted collection - - enum EcalDCCRuntype { - - // run types pre-global runs - COSMIC = 0, - BEAMH4 = 1, - BEAMH2 = 2, - MTCC = 3, - LASER_STD = 4, - LASER_POWER_SCAN = 5, - LASER_DELAY_SCAN = 6, - TESTPULSE_SCAN_MEM = 7, - TESTPULSE_MGPA = 8, - PEDESTAL_STD = 9, - PEDESTAL_OFFSET_SCAN = 10, - PEDESTAL_25NS_SCAN = 11, - LED_STD = 12, - - // physics triggers in global runs - PHYSICS_GLOBAL = 13, - COSMICS_GLOBAL = 14, - HALO_GLOBAL = 15, - - // gap events in global runs - LASER_GAP = 16, - TESTPULSE_GAP = 17, - PEDESTAL_GAP = 18, - LED_GAP = 19, - - // physics triggers in local runs - PHYSICS_LOCAL = 20, - COSMICS_LOCAL = 21, - HALO_LOCAL = 22, - CALIB_LOCAL = 23 - - }; - - enum EcalBasicTriggerType { - PHYSICS_TRIGGER = 1, - CALIBRATION_TRIGGER = 2, - TEST_TRIGGER = 3, - TECHNICAL_EXTERNAL_TRIGGER = 4 - }; - - enum TTC_DTT_TYPE { TTC_LASER = 4, TTC_LED = 5, TTC_TESTPULSE = 6, TTC_PEDESTAL = 7 }; - - struct EcalDCCEventSettings { - short LaserPower; - short LaserFilter; - short wavelength; - short delay; - short MEMVinj; - short mgpa_content; - short ped_offset; +namespace io_v1 { + class EcalDCCHeaderBlock { + public: + typedef int key_type; ///< For the sorted collection + + enum EcalDCCRuntype { + + // run types pre-global runs + COSMIC = 0, + BEAMH4 = 1, + BEAMH2 = 2, + MTCC = 3, + LASER_STD = 4, + LASER_POWER_SCAN = 5, + LASER_DELAY_SCAN = 6, + TESTPULSE_SCAN_MEM = 7, + TESTPULSE_MGPA = 8, + PEDESTAL_STD = 9, + PEDESTAL_OFFSET_SCAN = 10, + PEDESTAL_25NS_SCAN = 11, + LED_STD = 12, + + // physics triggers in global runs + PHYSICS_GLOBAL = 13, + COSMICS_GLOBAL = 14, + HALO_GLOBAL = 15, + + // gap events in global runs + LASER_GAP = 16, + TESTPULSE_GAP = 17, + PEDESTAL_GAP = 18, + LED_GAP = 19, + + // physics triggers in local runs + PHYSICS_LOCAL = 20, + COSMICS_LOCAL = 21, + HALO_LOCAL = 22, + CALIB_LOCAL = 23 + + }; + + enum EcalBasicTriggerType { + PHYSICS_TRIGGER = 1, + CALIBRATION_TRIGGER = 2, + TEST_TRIGGER = 3, + TECHNICAL_EXTERNAL_TRIGGER = 4 + }; + + enum TTC_DTT_TYPE { TTC_LASER = 4, TTC_LED = 5, TTC_TESTPULSE = 6, TTC_PEDESTAL = 7 }; + + struct EcalDCCEventSettings { + short LaserPower; + short LaserFilter; + short wavelength; + short delay; + short MEMVinj; + short mgpa_content; + short ped_offset; + }; + + EcalDCCHeaderBlock(); + EcalDCCHeaderBlock(const int& dccId); + + // partitional and geometrical: + // CMS: 1-9 EE-, 10-45 EB, 46-54 EE+ + // TB and COSM: 1 (10 in case of EcalRawToDigi) + const int& id() const { return dccId_; } + + // as found in raw data, namely + // CMS: 601-654 TB and COSM: 0-35 + const int fedId() const { return fedId_; } + + void setId(const int& dccId) { dccId_ = dccId; }; + void setFedId(const int& fedId) { fedId_ = fedId; }; + + void setErrors(const int& dccErrors) { dccErrors_ = dccErrors; }; + void setDccInTTCCommand(const int& dccInTTCCommand) { dccInTTCCommand_ = dccInTTCCommand; }; + void setRunNumber(const int& run) { runNumber_ = run; } + void setLV1(const int& LV1) { LV1event_ = LV1; } + void setBX(const int& BX) { BX_ = BX; } + void setOrbit(const int& orbit) { orbitNumber_ = orbit; } + void setEventSettings(const EcalDCCEventSettings& EventSettings) { EventSettings_ = EventSettings; }; + void setRunType(const short& runType) { runType_ = runType; }; + void setZs(const short& zs) { zs_ = zs; }; + void setBasicTriggerType(const short& triggerType) { basic_trigger_type_ = triggerType; }; + //void setSequence(const short& sequence) { sequence_=sequence; } ; + void setRtHalf(const short& rtHalf) { rtHalf_ = rtHalf; }; + void setMgpaGain(const short& mgpaGain) { mgpaGain_ = mgpaGain; }; + void setMemGain(const short& memGain) { memGain_ = memGain; }; + void setSelectiveReadout(const bool& selectiveReadout) { selectiveReadout_ = selectiveReadout; }; + void setZeroSuppression(const bool& zeroSuppression) { zeroSuppression_ = zeroSuppression; }; + void setTestZeroSuppression(const bool& testZeroSuppression) { testZeroSuppression_ = testZeroSuppression; }; + void setSrpStatus(const short& srpStatus) { srpStatus_ = srpStatus; }; + void setTccStatus(const std::vector& tccStatus) { tccStatus_ = tccStatus; }; + void setTriggerTowerFlags(const std::vector& triggerTowerFlag) { triggerTowerFlag_ = triggerTowerFlag; }; + void setFEStatus(const std::vector& feStatus) { feStatus_ = feStatus; }; + + void setFEBx(const std::vector& feBx) { feBx_ = feBx; } + void setTCCBx(const std::vector& tccBx) { tccBx_ = tccBx; } + void setSRPBx(const short& srpBx) { srpBx_ = srpBx; } + + void setFELv1(const std::vector& feLv1) { feLv1_ = feLv1; } + void setTCCLv1(const std::vector& tccLv1) { tccLv1_ = tccLv1; } + void setSRPLv1(const short& srpLv1) { srpLv1_ = srpLv1; } + + //TODO add all the get methods + + int getDCCErrors() const { return dccErrors_; } + int getDccInTCCCommand() const { return dccInTTCCommand_; }; + int getRunNumber() const { return runNumber_; } + int getLV1() const { return LV1event_; } + int getBX() const { return BX_; } + int getOrbit() const { return orbitNumber_; } + EcalDCCEventSettings getEventSettings() const { return EventSettings_; } + short getRunType() const { return runType_; } + short getZs() const { return zs_; } + short getBasicTriggerType() const { return basic_trigger_type_; } + + short getRtHalf() const { return rtHalf_; } + short getMgpaGain() const { return mgpaGain_; } + short getMemGain() const { return memGain_; } + short getSelectiveReadout() const { return selectiveReadout_; } + bool getZeroSuppression() const { return zeroSuppression_; } + bool getTestZeroSuppression() const { return testZeroSuppression_; } + short getSrpStatus() const { return srpStatus_; } + const std::vector& getTccStatus() const { return tccStatus_; } + const std::vector& getTriggerTowerFlag() const { return triggerTowerFlag_; } + const std::vector& getFEStatus() const { return feStatus_; } + + const std::vector& getFEBxs() const { return feBx_; } + const std::vector& getTCCBx() const { return tccBx_; } + short getSRPBx() const { return srpBx_; } + + const std::vector& getFELv1() const { return feLv1_; } + const std::vector& getTCCLv1() const { return tccLv1_; } + short getSRPLv1() const { return srpLv1_; } + + private: + int dccId_; //to be used as the Key + int fedId_; + int dccErrors_; + int dccInTTCCommand_; + int orbitNumber_; + short runType_; + short zs_; + + short basic_trigger_type_; + + int LV1event_; + int runNumber_; + int BX_; + EcalDCCEventSettings EventSettings_; + + short rtHalf_; + short mgpaGain_; + short memGain_; + bool selectiveReadout_; + bool testZeroSuppression_; + bool zeroSuppression_; + + short srpStatus_; + std::vector tccStatus_; + std::vector triggerTowerFlag_; + std::vector feStatus_; + + std::vector feBx_; + std::vector tccBx_; + short srpBx_; + + std::vector feLv1_; + std::vector tccLv1_; + short srpLv1_; }; - - EcalDCCHeaderBlock(); - EcalDCCHeaderBlock(const int& dccId); - - // partitional and geometrical: - // CMS: 1-9 EE-, 10-45 EB, 46-54 EE+ - // TB and COSM: 1 (10 in case of EcalRawToDigi) - const int& id() const { return dccId_; } - - // as found in raw data, namely - // CMS: 601-654 TB and COSM: 0-35 - const int fedId() const { return fedId_; } - - void setId(const int& dccId) { dccId_ = dccId; }; - void setFedId(const int& fedId) { fedId_ = fedId; }; - - void setErrors(const int& dccErrors) { dccErrors_ = dccErrors; }; - void setDccInTTCCommand(const int& dccInTTCCommand) { dccInTTCCommand_ = dccInTTCCommand; }; - void setRunNumber(const int& run) { runNumber_ = run; } - void setLV1(const int& LV1) { LV1event_ = LV1; } - void setBX(const int& BX) { BX_ = BX; } - void setOrbit(const int& orbit) { orbitNumber_ = orbit; } - void setEventSettings(const EcalDCCEventSettings& EventSettings) { EventSettings_ = EventSettings; }; - void setRunType(const short& runType) { runType_ = runType; }; - void setZs(const short& zs) { zs_ = zs; }; - void setBasicTriggerType(const short& triggerType) { basic_trigger_type_ = triggerType; }; - //void setSequence(const short& sequence) { sequence_=sequence; } ; - void setRtHalf(const short& rtHalf) { rtHalf_ = rtHalf; }; - void setMgpaGain(const short& mgpaGain) { mgpaGain_ = mgpaGain; }; - void setMemGain(const short& memGain) { memGain_ = memGain; }; - void setSelectiveReadout(const bool& selectiveReadout) { selectiveReadout_ = selectiveReadout; }; - void setZeroSuppression(const bool& zeroSuppression) { zeroSuppression_ = zeroSuppression; }; - void setTestZeroSuppression(const bool& testZeroSuppression) { testZeroSuppression_ = testZeroSuppression; }; - void setSrpStatus(const short& srpStatus) { srpStatus_ = srpStatus; }; - void setTccStatus(const std::vector& tccStatus) { tccStatus_ = tccStatus; }; - void setTriggerTowerFlags(const std::vector& triggerTowerFlag) { triggerTowerFlag_ = triggerTowerFlag; }; - void setFEStatus(const std::vector& feStatus) { feStatus_ = feStatus; }; - - void setFEBx(const std::vector& feBx) { feBx_ = feBx; } - void setTCCBx(const std::vector& tccBx) { tccBx_ = tccBx; } - void setSRPBx(const short& srpBx) { srpBx_ = srpBx; } - - void setFELv1(const std::vector& feLv1) { feLv1_ = feLv1; } - void setTCCLv1(const std::vector& tccLv1) { tccLv1_ = tccLv1; } - void setSRPLv1(const short& srpLv1) { srpLv1_ = srpLv1; } - - //TODO add all the get methods - - int getDCCErrors() const { return dccErrors_; } - int getDccInTCCCommand() const { return dccInTTCCommand_; }; - int getRunNumber() const { return runNumber_; } - int getLV1() const { return LV1event_; } - int getBX() const { return BX_; } - int getOrbit() const { return orbitNumber_; } - EcalDCCEventSettings getEventSettings() const { return EventSettings_; } - short getRunType() const { return runType_; } - short getZs() const { return zs_; } - short getBasicTriggerType() const { return basic_trigger_type_; } - - short getRtHalf() const { return rtHalf_; } - short getMgpaGain() const { return mgpaGain_; } - short getMemGain() const { return memGain_; } - short getSelectiveReadout() const { return selectiveReadout_; } - bool getZeroSuppression() const { return zeroSuppression_; } - bool getTestZeroSuppression() const { return testZeroSuppression_; } - short getSrpStatus() const { return srpStatus_; } - const std::vector& getTccStatus() const { return tccStatus_; } - const std::vector& getTriggerTowerFlag() const { return triggerTowerFlag_; } - const std::vector& getFEStatus() const { return feStatus_; } - - const std::vector& getFEBxs() const { return feBx_; } - const std::vector& getTCCBx() const { return tccBx_; } - short getSRPBx() const { return srpBx_; } - - const std::vector& getFELv1() const { return feLv1_; } - const std::vector& getTCCLv1() const { return tccLv1_; } - short getSRPLv1() const { return srpLv1_; } - -private: - int dccId_; //to be used as the Key - int fedId_; - int dccErrors_; - int dccInTTCCommand_; - int orbitNumber_; - short runType_; - short zs_; - - short basic_trigger_type_; - - int LV1event_; - int runNumber_; - int BX_; - EcalDCCEventSettings EventSettings_; - - short rtHalf_; - short mgpaGain_; - short memGain_; - bool selectiveReadout_; - bool testZeroSuppression_; - bool zeroSuppression_; - - short srpStatus_; - std::vector tccStatus_; - std::vector triggerTowerFlag_; - std::vector feStatus_; - - std::vector feBx_; - std::vector tccBx_; - short srpBx_; - - std::vector feLv1_; - std::vector tccLv1_; - short srpLv1_; -}; - +} // namespace io_v1 +using EcalDCCHeaderBlock = io_v1::EcalDCCHeaderBlock; #endif diff --git a/DataFormats/EcalRawData/src/classes_def.xml b/DataFormats/EcalRawData/src/classes_def.xml index fc9a5f149fae3..59460d9fb2e94 100644 --- a/DataFormats/EcalRawData/src/classes_def.xml +++ b/DataFormats/EcalRawData/src/classes_def.xml @@ -1,35 +1,35 @@ - - + + - - + + - - - - - - + + + + + + - - + + - - + + - - + + diff --git a/DataFormats/EcalRecHit/interface/EcalRecHit.h b/DataFormats/EcalRecHit/interface/EcalRecHit.h index 338afcb0d31fa..de75b78a00f40 100644 --- a/DataFormats/EcalRecHit/interface/EcalRecHit.h +++ b/DataFormats/EcalRecHit/interface/EcalRecHit.h @@ -13,144 +13,145 @@ * \author P. Meridiani INFN Roma1 */ -class EcalRecHit { -public: - typedef DetId key_type; - - // recHit flags - enum Flags { - kGood = 0, // channel ok, the energy and time measurement are reliable - kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2) - kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time - kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy) - kNoisy, // the channel is very noisy - kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor - kSaturated, // saturated channel (recovery not tried) - kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation - kNeighboursRecovered, // saturated/isolated dead: energy estimated from neighbours - kTowerRecovered, // channel in TT with no data link, info retrieved from Trigger Primitive - kDead, // channel is dead and any recovery fails - kKilled, // MC only flag: the channel is killed in the real detector - kTPSaturated, // the channel is in a region with saturated TP - kL1SpikeFlag, // the channel is in a region with TP with sFGVB = 0 - kWeird, // the signal is believed to originate from an anomalous deposit (spike) - kDiWeird, // the signal is anomalous, and neighbors another anomalous signal - kHasSwitchToGain6, // at least one data frame is in G6 - kHasSwitchToGain1, // at least one data frame is in G1 - // - kUnknown // to ease the interface with functions returning flags. - }; - - // ES recHit flags - enum ESFlags { - kESGood, - kESDead, - kESHot, - kESPassBX, - kESTwoGoodRatios, - kESBadRatioFor12, - kESBadRatioFor23Upper, - kESBadRatioFor23Lower, - kESTS1Largest, - kESTS3Largest, - kESTS3Negative, - kESSaturated, - kESTS2Saturated, - kESTS3Saturated, - kESTS13Sigmas, - kESTS15Sigmas - }; +namespace io_v1 { + class EcalRecHit { + public: + typedef DetId key_type; + + // recHit flags + enum Flags { + kGood = 0, // channel ok, the energy and time measurement are reliable + kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2) + kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time + kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy) + kNoisy, // the channel is very noisy + kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor + kSaturated, // saturated channel (recovery not tried) + kLeadingEdgeRecovered, // saturated channel: energy estimated from the leading edge before saturation + kNeighboursRecovered, // saturated/isolated dead: energy estimated from neighbours + kTowerRecovered, // channel in TT with no data link, info retrieved from Trigger Primitive + kDead, // channel is dead and any recovery fails + kKilled, // MC only flag: the channel is killed in the real detector + kTPSaturated, // the channel is in a region with saturated TP + kL1SpikeFlag, // the channel is in a region with TP with sFGVB = 0 + kWeird, // the signal is believed to originate from an anomalous deposit (spike) + kDiWeird, // the signal is anomalous, and neighbors another anomalous signal + kHasSwitchToGain6, // at least one data frame is in G6 + kHasSwitchToGain1, // at least one data frame is in G1 + // + kUnknown // to ease the interface with functions returning flags. + }; + + // ES recHit flags + enum ESFlags { + kESGood, + kESDead, + kESHot, + kESPassBX, + kESTwoGoodRatios, + kESBadRatioFor12, + kESBadRatioFor23Upper, + kESBadRatioFor23Lower, + kESTS1Largest, + kESTS3Largest, + kESTS3Negative, + kESSaturated, + kESTS2Saturated, + kESTS3Saturated, + kESTS13Sigmas, + kESTS15Sigmas + }; + + EcalRecHit() : energy_(0), time_(0), flagBits_(0) {} + // by default a recHit is greated with no flag + explicit EcalRecHit(const DetId& id, float energy, float time, uint32_t extra = 0, uint32_t flagBits = 0) + : id_(id), energy_(energy), time_(time), flagBits_(flagBits), extra_(extra) {} + + float energy() const { return energy_; } + void setEnergy(float energy) { energy_ = energy; } + float time() const { return time_; } + void setTime(float time) { time_ = time; } + const DetId& detid() const { return id_; } + + /// get the id + // For the moment not returning a specific id for subdetector + // @TODO why this method?! should use detid() + DetId id() const { return DetId(detid()); } + + bool isRecovered() const { + return checkFlag(kLeadingEdgeRecovered) || checkFlag(kNeighboursRecovered) || checkFlag(kTowerRecovered); + } - EcalRecHit() : energy_(0), time_(0), flagBits_(0) {} - // by default a recHit is greated with no flag - explicit EcalRecHit(const DetId& id, float energy, float time, uint32_t extra = 0, uint32_t flagBits = 0) - : id_(id), energy_(energy), time_(time), flagBits_(flagBits), extra_(extra) {} + bool isTimeValid() const { return (this->timeError() > 0); } - float energy() const { return energy_; } - void setEnergy(float energy) { energy_ = energy; } - float time() const { return time_; } - void setTime(float time) { time_ = time; } - const DetId& detid() const { return id_; } + bool isTimeErrorValid() const { + if (!isTimeValid()) + return false; - /// get the id - // For the moment not returning a specific id for subdetector - // @TODO why this method?! should use detid() - DetId id() const { return DetId(detid()); } + if (timeError() >= 10000) + return false; - bool isRecovered() const { - return checkFlag(kLeadingEdgeRecovered) || checkFlag(kNeighboursRecovered) || checkFlag(kTowerRecovered); - } + return true; + } - bool isTimeValid() const { return (this->timeError() > 0); } + static inline uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width) { + return (value >> offset) & ((1 << width) - 1); + } - bool isTimeErrorValid() const { - if (!isTimeValid()) - return false; + static inline uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width) { + const uint32_t mask = ((1 << width) - 1) << offset; + value &= ~mask; + value |= (x & ((1U << width) - 1)) << offset; + return value; + } - if (timeError() >= 10000) - return false; + static inline int getPower10(float e) { + static constexpr float p10[] = {1.e-2f, 1.e-1f, 1.f, 1.e1f, 1.e2f, 1.e3f, 1.e4f, 1.e5f, 1.e6f}; + int b = e < p10[4] ? 0 : 5; + for (; b < 9; ++b) + if (e < p10[b]) + break; + return b; + } - return true; - } - - static inline uint32_t getMasked(uint32_t value, uint32_t offset, uint32_t width) { - return (value >> offset) & ((1 << width) - 1); - } - - static inline uint32_t setMasked(uint32_t value, uint32_t x, uint32_t offset, uint32_t width) { - const uint32_t mask = ((1 << width) - 1) << offset; - value &= ~mask; - value |= (x & ((1U << width) - 1)) << offset; - return value; - } - - static inline int getPower10(float e) { - static constexpr float p10[] = {1.e-2f, 1.e-1f, 1.f, 1.e1f, 1.e2f, 1.e3f, 1.e4f, 1.e5f, 1.e6f}; - int b = e < p10[4] ? 0 : 5; - for (; b < 9; ++b) - if (e < p10[b]) - break; - return b; - } - - /* the new bit structure + /* the new bit structure * 0..6 - chi2 in time events (chi2()), offset=0, width=7 * 8..20 - energy uncertainty, offset=8, width=13 * 24..31 - timeError(), offset=24, width=8 */ - float chi2() const { - uint32_t rawChi2 = getMasked(extra_, 0, 7); - return (float)rawChi2 / (float)((1 << 7) - 1) * 64.; - } - - void setChi2(float chi2) { - // bound the max value of the chi2 - if (chi2 > 64) - chi2 = 64; - - // use 7 bits - uint32_t rawChi2 = lround(chi2 / 64. * ((1 << 7) - 1)); - extra_ = setMasked(extra_, rawChi2, 0, 7); - } - - float energyError() const { - uint32_t rawEnergy = getMasked(extra_, 8, 13); - uint16_t exponent = rawEnergy >> 10; - uint16_t significand = ~(0xE << 9) & rawEnergy; - return (float)significand * pow(10, exponent - 5); - } - - // set the energy uncertainty - // (only energy >= 0 will be stored) - void setEnergyError(float energy) { - uint32_t rawEnergy = 0; - if (energy > 0.001) { - uint16_t exponent = getPower10(energy); - static constexpr float ip10[] = {1.e5f, 1.e4f, 1.e3f, 1.e2f, 1.e1f, 1.e0f, 1.e-1f, 1.e-2f, 1.e-3f, 1.e-4}; - uint16_t significand = lround(energy * ip10[exponent]); - // use 13 bits (3 exponent, 10 significand) - rawEnergy = exponent << 10 | significand; - /* here for doc and regression test + float chi2() const { + uint32_t rawChi2 = getMasked(extra_, 0, 7); + return (float)rawChi2 / (float)((1 << 7) - 1) * 64.; + } + + void setChi2(float chi2) { + // bound the max value of the chi2 + if (chi2 > 64) + chi2 = 64; + + // use 7 bits + uint32_t rawChi2 = lround(chi2 / 64. * ((1 << 7) - 1)); + extra_ = setMasked(extra_, rawChi2, 0, 7); + } + + float energyError() const { + uint32_t rawEnergy = getMasked(extra_, 8, 13); + uint16_t exponent = rawEnergy >> 10; + uint16_t significand = ~(0xE << 9) & rawEnergy; + return (float)significand * pow(10, exponent - 5); + } + + // set the energy uncertainty + // (only energy >= 0 will be stored) + void setEnergyError(float energy) { + uint32_t rawEnergy = 0; + if (energy > 0.001) { + uint16_t exponent = getPower10(energy); + static constexpr float ip10[] = {1.e5f, 1.e4f, 1.e3f, 1.e2f, 1.e1f, 1.e0f, 1.e-1f, 1.e-2f, 1.e-3f, 1.e-4}; + uint16_t significand = lround(energy * ip10[exponent]); + // use 13 bits (3 exponent, 10 significand) + rawEnergy = exponent << 10 | significand; + /* here for doc and regression test uint16_t exponent_old = lround(floor(log10(energy))) + 3; uint16_t significand_old = lround(energy/pow(10, exponent - 5)); std::cout << energy << ' ' << exponent << ' ' << significand @@ -158,88 +159,90 @@ class EcalRecHit { assert(exponent==exponent_old); assert(significand==significand_old); */ - } + } - extra_ = setMasked(extra_, rawEnergy, 8, 13); - } + extra_ = setMasked(extra_, rawEnergy, 8, 13); + } - float timeError() const { - uint32_t timeErrorBits = getMasked(extra_, 24, 8); - // all bits off --> time reco bailed out (return negative value) - if ((0xFF & timeErrorBits) == 0x00) - return -1; - // all bits on --> time error over 5 ns (return large value) - if ((0xFF & timeErrorBits) == 0xFF) - return 10000; + float timeError() const { + uint32_t timeErrorBits = getMasked(extra_, 24, 8); + // all bits off --> time reco bailed out (return negative value) + if ((0xFF & timeErrorBits) == 0x00) + return -1; + // all bits on --> time error over 5 ns (return large value) + if ((0xFF & timeErrorBits) == 0xFF) + return 10000; + + float LSB = 1.26008; + uint8_t exponent = timeErrorBits >> 5; + uint8_t significand = timeErrorBits & ~(0x7 << 5); + return pow(2., exponent) * significand * LSB / 1000.; + } - float LSB = 1.26008; - uint8_t exponent = timeErrorBits >> 5; - uint8_t significand = timeErrorBits & ~(0x7 << 5); - return pow(2., exponent) * significand * LSB / 1000.; - } + void setTimeError(uint8_t timeErrBits) { extra_ = setMasked(extra_, timeErrBits & 0xFF, 24, 8); } - void setTimeError(uint8_t timeErrBits) { extra_ = setMasked(extra_, timeErrBits & 0xFF, 24, 8); } + /// set the flags (from Flags or ESFlags) + void setFlag(int flag) { flagBits_ |= (0x1 << flag); } + void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); } - /// set the flags (from Flags or ESFlags) - void setFlag(int flag) { flagBits_ |= (0x1 << flag); } - void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); } + /// check if the flag is true + bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); } - /// check if the flag is true - bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); } + /// check if one of the flags in a set is true + bool checkFlags(const std::vector& flagsvec) const { + for (std::vector::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end(); + ++flagPtr) { // check if one of the flags is up - /// check if one of the flags in a set is true - bool checkFlags(const std::vector& flagsvec) const { - for (std::vector::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end(); - ++flagPtr) { // check if one of the flags is up + if (checkFlag(*flagPtr)) + return true; + } - if (checkFlag(*flagPtr)) - return true; + return false; } - return false; - } + uint32_t flagsBits() const { return flagBits_; } - uint32_t flagsBits() const { return flagBits_; } + /// apply a bitmask to our flags. Experts only + bool checkFlagMask(uint32_t mask) const { return flagBits_ & mask; } - /// apply a bitmask to our flags. Experts only - bool checkFlagMask(uint32_t mask) const { return flagBits_ & mask; } + /// DEPRECATED provided for temporary backward compatibility + Flags recoFlag() const { + for (int i = kUnknown;; --i) { + if (checkFlag(i)) + return Flags(i); + if (i == 0) + break; + } - /// DEPRECATED provided for temporary backward compatibility - Flags recoFlag() const { - for (int i = kUnknown;; --i) { - if (checkFlag(i)) - return Flags(i); - if (i == 0) - break; + // no flag assigned, assume good + return kGood; } - // no flag assigned, assume good - return kGood; - } - - // For CC Timing reco - float nonCorrectedTime() const { - uint8_t jitterErrorBits = getMasked(extra_, 24, 8); - float encBits = static_cast(jitterErrorBits); - float decTimeDif = ecalcctiming::clockToNS * (ecalcctiming::encodingOffest - encBits / ecalcctiming::encodingValue); - float nonCorrectedTime = - (encBits > 1 && encBits < 254) ? ecalcctiming::nonCorrectedSlope * time_ + decTimeDif : -30.0; - return nonCorrectedTime; - } - -private: - // from calorechit - DetId id_; - float energy_; - float time_; + // For CC Timing reco + float nonCorrectedTime() const { + uint8_t jitterErrorBits = getMasked(extra_, 24, 8); + float encBits = static_cast(jitterErrorBits); + float decTimeDif = + ecalcctiming::clockToNS * (ecalcctiming::encodingOffest - encBits / ecalcctiming::encodingValue); + float nonCorrectedTime = + (encBits > 1 && encBits < 254) ? ecalcctiming::nonCorrectedSlope * time_ + decTimeDif : -30.0; + return nonCorrectedTime; + } - /// store rechit condition (see Flags enum) in a bit-wise way - uint32_t flagBits_; + private: + // from calorechit + DetId id_; + float energy_; + float time_; - // packed uint32_t for timeError, chi2, energyError - uint32_t extra_; -}; + /// store rechit condition (see Flags enum) in a bit-wise way + uint32_t flagBits_; -std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit); + // packed uint32_t for timeError, chi2, energyError + uint32_t extra_; + }; + std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit); +} // namespace io_v1 +using EcalRecHit = io_v1::EcalRecHit; #endif diff --git a/DataFormats/EcalRecHit/interface/EcalRecHitComparison.h b/DataFormats/EcalRecHit/interface/EcalRecHitComparison.h index 11d781796d3cc..f707f3e5f090d 100644 --- a/DataFormats/EcalRecHit/interface/EcalRecHitComparison.h +++ b/DataFormats/EcalRecHit/interface/EcalRecHitComparison.h @@ -5,15 +5,16 @@ //ordering capability mandatory for lazy getter framework // Comparison operators -inline bool operator<(const EcalRecHit& one, const EcalRecHit& other) { - if (one.detid() == other.detid()) { - return one.energy() < other.energy(); +namespace io_v1 { + inline bool operator<(const EcalRecHit& one, const EcalRecHit& other) { + if (one.detid() == other.detid()) { + return one.energy() < other.energy(); + } + return one.detid() < other.detid(); } - return one.detid() < other.detid(); -} -inline bool operator<(const EcalRecHit& one, const uint32_t& detid) { return one.detid() < detid; } - -inline bool operator<(const uint32_t& detid, const EcalRecHit& other) { return detid < other.detid(); } + inline bool operator<(const EcalRecHit& one, const uint32_t& detid) { return one.detid() < detid; } + inline bool operator<(const uint32_t& detid, const EcalRecHit& other) { return detid < other.detid(); } +} // namespace io_v1 #endif diff --git a/DataFormats/EcalRecHit/interface/EcalRecHitFwd.h b/DataFormats/EcalRecHit/interface/EcalRecHitFwd.h index 6f8e6f8e2e70c..be0a6fa491187 100644 --- a/DataFormats/EcalRecHit/interface/EcalRecHitFwd.h +++ b/DataFormats/EcalRecHit/interface/EcalRecHitFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_EcalRecHit_EcalRecHitFwd_h #define DataFormats_EcalRecHit_EcalRecHitFwd_h -class EcalRecHit; +namespace io_v1 { + class EcalRecHit; +} +using EcalRecHit = io_v1::EcalRecHit; #endif diff --git a/DataFormats/EcalRecHit/src/EcalRecHit.cc b/DataFormats/EcalRecHit/src/EcalRecHit.cc index f01316953c5c4..678492ad436f3 100644 --- a/DataFormats/EcalRecHit/src/EcalRecHit.cc +++ b/DataFormats/EcalRecHit/src/EcalRecHit.cc @@ -6,13 +6,15 @@ #include #include -std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit) { - if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalBarrel) - return s << EBDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalEndcap) - return s << EEDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalPreshower) - return s << ESDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else - return s << "EcalRecHit undefined subdetector"; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const EcalRecHit& hit) { + if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalBarrel) + return s << EBDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalEndcap) + return s << EEDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::Ecal && hit.detid().subdetId() == EcalPreshower) + return s << ESDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else + return s << "EcalRecHit undefined subdetector"; + } +} // namespace io_v1 diff --git a/DataFormats/EcalRecHit/src/classes_def.xml b/DataFormats/EcalRecHit/src/classes_def.xml index 1fe49384b3f3d..8752c9b93e777 100644 --- a/DataFormats/EcalRecHit/src/classes_def.xml +++ b/DataFormats/EcalRecHit/src/classes_def.xml @@ -1,7 +1,6 @@ - - - + + @@ -11,34 +10,32 @@ - - - - + + - - + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + diff --git a/DataFormats/EgammaCandidates/interface/Conversion.h b/DataFormats/EgammaCandidates/interface/Conversion.h index 36f9882aa31d1..968b11f971282 100644 --- a/DataFormats/EgammaCandidates/interface/Conversion.h +++ b/DataFormats/EgammaCandidates/interface/Conversion.h @@ -20,228 +20,232 @@ #include "DataFormats/CaloRecHit/interface/CaloClusterCollection.h" namespace reco { - class Conversion { - public: - enum ConversionAlgorithm { undefined = 0, ecalSeeded = 1, trackerOnly = 2, mixed = 3, pflow = 4, algoSize = 5 }; - - enum ConversionQuality { - generalTracksOnly = 0, - arbitratedEcalSeeded = 1, - arbitratedMerged = 2, - arbitratedMergedEcalGeneral = 3, - gsfTracksOpenOnly = 4, - highPurity = 8, - highEfficiency = 9, - ecalMatched1Track = 10, - ecalMatched2Track = 11 + namespace io_v1 { + class Conversion { + public: + enum ConversionAlgorithm { undefined = 0, ecalSeeded = 1, trackerOnly = 2, mixed = 3, pflow = 4, algoSize = 5 }; + + enum ConversionQuality { + generalTracksOnly = 0, + arbitratedEcalSeeded = 1, + arbitratedMerged = 2, + arbitratedMergedEcalGeneral = 3, + gsfTracksOpenOnly = 4, + highPurity = 8, + highEfficiency = 9, + ecalMatched1Track = 10, + ecalMatched2Track = 11 + }; + + static const std::string algoNames[]; + + // Default constructor + Conversion(); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector >& tr, + const std::vector& trackPositionAtEcal, + const reco::Vertex& convVtx, + const std::vector& matchingBC, + const float DCA, + const std::vector& innPoint, + const std::vector& trackPin, + const std::vector& trackPout, + const std::vector& nHitsBeforeVtx, + const std::vector& dlClosestHitToVtx, + uint8_t nSharedHits, + const float mva, + ConversionAlgorithm = undefined); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector& tr, + const std::vector& trackPositionAtEcal, + const reco::Vertex& convVtx, + const std::vector& matchingBC, + const float DCA, + const std::vector& innPoint, + const std::vector& trackPin, + const std::vector& trackPout, + const float mva, + ConversionAlgorithm = undefined); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector& tr, + const reco::Vertex& convVtx, + ConversionAlgorithm = undefined); + + Conversion(const reco::CaloClusterPtrVector& clu, + const std::vector >& tr, + const reco::Vertex& convVtx, + ConversionAlgorithm = undefined); + + /// returns a clone of the candidate + Conversion* clone() const; + /// Pointer to CaloCluster (foe Egamma Conversions it points to a SuperCluster) + reco::CaloClusterPtrVector caloCluster() const { return caloCluster_; } + /// vector of track to base references + std::vector > const& tracks() const; + /// returns the reco conversion vertex + const reco::Vertex& conversionVertex() const { return theConversionVertex_; } + /// Bool flagging objects having track size >0 + bool isConverted() const; + /// Number of tracks= 0,1,2 + unsigned int nTracks() const { return tracks().size(); } + /// get the value of the TMVA output + double MVAout() const { return theMVAout_; } + /// get the MVS output from PF for one leg conversions + std::vector const oneLegMVA() { return theOneLegMVA_; } + /// if nTracks=2 returns the pair invariant mass. Original tracks are used here + double pairInvariantMass() const; + /// Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used + double pairCotThetaSeparation() const; + /// Conversion tracks momentum from the tracks inner momentum + math::XYZVectorF pairMomentum() const; + /// Conversion track pair 4-momentum from the tracks refitted with vertex constraint + math::XYZTLorentzVectorF refittedPair4Momentum() const; + /// Conversion tracks momentum from the tracks refitted with vertex constraint + math::XYZVectorF refittedPairMomentum() const; + /// Super Cluster energy divided by track pair momentum if Standard seeding method. If a pointer to two (or more clusters) + /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum + /// Track innermost momentum is used here + double EoverP() const; + /// Super Cluster energy divided by track pair momentum if Standard seeing method. If a pointer to two (or more clusters) + /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum + /// Track momentum refitted with vertex constraint is used + double EoverPrefittedTracks() const; + // Dist of minimum approach between tracks + double distOfMinimumApproach() const { return theMinDistOfApproach_; } + // deltaPhi tracks at innermost point + double dPhiTracksAtVtx() const; + // deltaPhi tracks at ECAl + double dPhiTracksAtEcal() const; + // deltaEta tracks at ECAl + double dEtaTracksAtEcal() const; + + //impact parameter and decay length computed with respect to given beamspot or vertex + //computed from refittedPairMomentum + + //transverse impact parameter + double dxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //longitudinal impact parameter + double dz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //transverse decay length + double lxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //longitudinal decay length + double lz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; + //z position of intersection with beamspot in rz plane (possible tilt of beamspot is neglected) + double zOfPrimaryVertexFromTracks(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const { + return dz(myBeamSpot) + myBeamSpot.z(); + } + + ///// The following are variables provided per each track + /// positions of the track extrapolation at the ECAL front face + const std::vector& ecalImpactPosition() const { return thePositionAtEcal_; } + // pair of BC matching a posteriori the tracks + const std::vector& bcMatchingWithTracks() const { return theMatchingBCs_; } + /// signed transverse impact parameter for each track + std::vector tracksSigned_d0() const; + /// Vector containing the position of the innermost hit of each track + const std::vector& tracksInnerPosition() const { return theTrackInnerPosition_; } + /// Vector of track momentum measured at the outermost hit + const std::vector& tracksPout() const { return theTrackPout_; } + /// Vector of track momentum measured at the innermost hit + const std::vector& tracksPin() const { return theTrackPin_; } + ///Vector of the number of hits before the vertex along each track trajector + const std::vector& nHitsBeforeVtx() const { return nHitsBeforeVtx_; } + ///Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positions + const std::vector& dlClosestHitToVtx() const { return dlClosestHitToVtx_; } + ///number of shared hits btw the two track + uint8_t nSharedHits() const { return nSharedHits_; } + + /// set the value of the TMVA output + void setMVAout(const float& mva) { theMVAout_ = mva; } + /// set the MVS output from PF for one leg conversions + void setOneLegMVA(const std::vector& mva) { theOneLegMVA_ = mva; } + // Set the ptr to the Super cluster if not set in the constructor + void setMatchingSuperCluster(const reco::CaloClusterPtrVector& sc) { caloCluster_ = sc; } + /// Conversion Track algorithm/provenance + void setConversionAlgorithm(const ConversionAlgorithm a, bool set = true) { + if (set) + algorithm_ = a; + else + algorithm_ = undefined; + } + ConversionAlgorithm algo() const; + std::string algoName() const; + static std::string algoName(ConversionAlgorithm); + static ConversionAlgorithm algoByName(const std::string& name); + + bool quality(ConversionQuality q) const { return (qualityMask_ & (1 << q)) >> q; } + void setQuality(ConversionQuality q, bool b); + + private: + /// vector pointer to a/multiple seed CaloCluster(s) + reco::CaloClusterPtrVector caloCluster_; + /// vector Track RefToBase + std::vector > trackToBaseRefs_; + /// position at the ECAl surface of the track extrapolation + std::vector thePositionAtEcal_; + /// Fitted Kalman conversion vertex + reco::Vertex theConversionVertex_; + /// Clusters mathing the tracks (these are not the seeds) + std::vector theMatchingBCs_; + /// P_in of tracks + std::vector theTrackInnerPosition_; + /// P_in of tracks + std::vector theTrackPin_; + /// P_out of tracks + std::vector theTrackPout_; + ///number of hits before the vertex on each trackerOnly + std::vector nHitsBeforeVtx_; + ///signed decay length and uncertainty from nearest hit on track to conversion vertex + std::vector dlClosestHitToVtx_; + /// vectors of TMVA outputs from pflow for one leg conversions + std::vector theOneLegMVA_; + /// Distance of min approach of the two tracks + float theMinDistOfApproach_; + /// TMVA output + float theMVAout_; + uint16_t qualityMask_; + ///number of shared hits between tracks + uint8_t nSharedHits_; + /// conversion algorithm/provenance + uint8_t algorithm_; }; - static const std::string algoNames[]; - - // Default constructor - Conversion(); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector >& tr, - const std::vector& trackPositionAtEcal, - const reco::Vertex& convVtx, - const std::vector& matchingBC, - const float DCA, - const std::vector& innPoint, - const std::vector& trackPin, - const std::vector& trackPout, - const std::vector& nHitsBeforeVtx, - const std::vector& dlClosestHitToVtx, - uint8_t nSharedHits, - const float mva, - ConversionAlgorithm = undefined); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector& tr, - const std::vector& trackPositionAtEcal, - const reco::Vertex& convVtx, - const std::vector& matchingBC, - const float DCA, - const std::vector& innPoint, - const std::vector& trackPin, - const std::vector& trackPout, - const float mva, - ConversionAlgorithm = undefined); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector& tr, - const reco::Vertex& convVtx, - ConversionAlgorithm = undefined); - - Conversion(const reco::CaloClusterPtrVector& clu, - const std::vector >& tr, - const reco::Vertex& convVtx, - ConversionAlgorithm = undefined); - - /// returns a clone of the candidate - Conversion* clone() const; - /// Pointer to CaloCluster (foe Egamma Conversions it points to a SuperCluster) - reco::CaloClusterPtrVector caloCluster() const { return caloCluster_; } - /// vector of track to base references - std::vector > const& tracks() const; - /// returns the reco conversion vertex - const reco::Vertex& conversionVertex() const { return theConversionVertex_; } - /// Bool flagging objects having track size >0 - bool isConverted() const; - /// Number of tracks= 0,1,2 - unsigned int nTracks() const { return tracks().size(); } - /// get the value of the TMVA output - double MVAout() const { return theMVAout_; } - /// get the MVS output from PF for one leg conversions - std::vector const oneLegMVA() { return theOneLegMVA_; } - /// if nTracks=2 returns the pair invariant mass. Original tracks are used here - double pairInvariantMass() const; - /// Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used - double pairCotThetaSeparation() const; - /// Conversion tracks momentum from the tracks inner momentum - math::XYZVectorF pairMomentum() const; - /// Conversion track pair 4-momentum from the tracks refitted with vertex constraint - math::XYZTLorentzVectorF refittedPair4Momentum() const; - /// Conversion tracks momentum from the tracks refitted with vertex constraint - math::XYZVectorF refittedPairMomentum() const; - /// Super Cluster energy divided by track pair momentum if Standard seeding method. If a pointer to two (or more clusters) - /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum - /// Track innermost momentum is used here - double EoverP() const; - /// Super Cluster energy divided by track pair momentum if Standard seeing method. If a pointer to two (or more clusters) - /// is stored in the conversion, this method returns the energy sum of clusters divided by the track pair momentum - /// Track momentum refitted with vertex constraint is used - double EoverPrefittedTracks() const; - // Dist of minimum approach between tracks - double distOfMinimumApproach() const { return theMinDistOfApproach_; } - // deltaPhi tracks at innermost point - double dPhiTracksAtVtx() const; - // deltaPhi tracks at ECAl - double dPhiTracksAtEcal() const; - // deltaEta tracks at ECAl - double dEtaTracksAtEcal() const; - - //impact parameter and decay length computed with respect to given beamspot or vertex - //computed from refittedPairMomentum - - //transverse impact parameter - double dxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //longitudinal impact parameter - double dz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //transverse decay length - double lxy(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //longitudinal decay length - double lz(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const; - //z position of intersection with beamspot in rz plane (possible tilt of beamspot is neglected) - double zOfPrimaryVertexFromTracks(const math::XYZPoint& myBeamSpot = math::XYZPoint()) const { - return dz(myBeamSpot) + myBeamSpot.z(); + inline Conversion::ConversionAlgorithm Conversion::algo() const { return (ConversionAlgorithm)algorithm_; } + + inline std::string Conversion::algoName() const { + switch (algorithm_) { + case undefined: + return "undefined"; + case ecalSeeded: + return "ecalSeeded"; + case trackerOnly: + return "trackerOnly"; + case mixed: + return "mixed"; + case pflow: + return "pflow"; + } + return "undefined"; } - ///// The following are variables provided per each track - /// positions of the track extrapolation at the ECAL front face - const std::vector& ecalImpactPosition() const { return thePositionAtEcal_; } - // pair of BC matching a posteriori the tracks - const std::vector& bcMatchingWithTracks() const { return theMatchingBCs_; } - /// signed transverse impact parameter for each track - std::vector tracksSigned_d0() const; - /// Vector containing the position of the innermost hit of each track - const std::vector& tracksInnerPosition() const { return theTrackInnerPosition_; } - /// Vector of track momentum measured at the outermost hit - const std::vector& tracksPout() const { return theTrackPout_; } - /// Vector of track momentum measured at the innermost hit - const std::vector& tracksPin() const { return theTrackPin_; } - ///Vector of the number of hits before the vertex along each track trajector - const std::vector& nHitsBeforeVtx() const { return nHitsBeforeVtx_; } - ///Vector of signed decay length with uncertainty from nearest hit on track to the conversion vtx positions - const std::vector& dlClosestHitToVtx() const { return dlClosestHitToVtx_; } - ///number of shared hits btw the two track - uint8_t nSharedHits() const { return nSharedHits_; } - - /// set the value of the TMVA output - void setMVAout(const float& mva) { theMVAout_ = mva; } - /// set the MVS output from PF for one leg conversions - void setOneLegMVA(const std::vector& mva) { theOneLegMVA_ = mva; } - // Set the ptr to the Super cluster if not set in the constructor - void setMatchingSuperCluster(const reco::CaloClusterPtrVector& sc) { caloCluster_ = sc; } - /// Conversion Track algorithm/provenance - void setConversionAlgorithm(const ConversionAlgorithm a, bool set = true) { - if (set) - algorithm_ = a; - else - algorithm_ = undefined; + inline std::string Conversion::algoName(ConversionAlgorithm a) { + if (int(a) < int(algoSize) && int(a) > 0) + return algoNames[int(a)]; + return "undefined"; } - ConversionAlgorithm algo() const; - std::string algoName() const; - static std::string algoName(ConversionAlgorithm); - static ConversionAlgorithm algoByName(const std::string& name); - - bool quality(ConversionQuality q) const { return (qualityMask_ & (1 << q)) >> q; } - void setQuality(ConversionQuality q, bool b); - - private: - /// vector pointer to a/multiple seed CaloCluster(s) - reco::CaloClusterPtrVector caloCluster_; - /// vector Track RefToBase - std::vector > trackToBaseRefs_; - /// position at the ECAl surface of the track extrapolation - std::vector thePositionAtEcal_; - /// Fitted Kalman conversion vertex - reco::Vertex theConversionVertex_; - /// Clusters mathing the tracks (these are not the seeds) - std::vector theMatchingBCs_; - /// P_in of tracks - std::vector theTrackInnerPosition_; - /// P_in of tracks - std::vector theTrackPin_; - /// P_out of tracks - std::vector theTrackPout_; - ///number of hits before the vertex on each trackerOnly - std::vector nHitsBeforeVtx_; - ///signed decay length and uncertainty from nearest hit on track to conversion vertex - std::vector dlClosestHitToVtx_; - /// vectors of TMVA outputs from pflow for one leg conversions - std::vector theOneLegMVA_; - /// Distance of min approach of the two tracks - float theMinDistOfApproach_; - /// TMVA output - float theMVAout_; - uint16_t qualityMask_; - ///number of shared hits between tracks - uint8_t nSharedHits_; - /// conversion algorithm/provenance - uint8_t algorithm_; - }; - - inline Conversion::ConversionAlgorithm Conversion::algo() const { return (ConversionAlgorithm)algorithm_; } - - inline std::string Conversion::algoName() const { - switch (algorithm_) { - case undefined: - return "undefined"; - case ecalSeeded: - return "ecalSeeded"; - case trackerOnly: - return "trackerOnly"; - case mixed: - return "mixed"; - case pflow: - return "pflow"; + + inline void Conversion::setQuality(ConversionQuality q, bool b) { + if (b) //regular OR if setting value to true + qualityMask_ |= (1 << q); + else // doing "half-XOR" if unsetting value + qualityMask_ &= (~(1 << q)); } - return "undefined"; - } - - inline std::string Conversion::algoName(ConversionAlgorithm a) { - if (int(a) < int(algoSize) && int(a) > 0) - return algoNames[int(a)]; - return "undefined"; - } - - inline void Conversion::setQuality(ConversionQuality q, bool b) { - if (b) //regular OR if setting value to true - qualityMask_ |= (1 << q); - else // doing "half-XOR" if unsetting value - qualityMask_ &= (~(1 << q)); - } + + } // namespace io_v1 + using Conversion = io_v1::Conversion; } // namespace reco diff --git a/DataFormats/EgammaCandidates/interface/ConversionFwd.h b/DataFormats/EgammaCandidates/interface/ConversionFwd.h index 7027c229b5201..687e238bdeecc 100644 --- a/DataFormats/EgammaCandidates/interface/ConversionFwd.h +++ b/DataFormats/EgammaCandidates/interface/ConversionFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Conversion; + namespace io_v1 { + class Conversion; + } + using Conversion = io_v1::Conversion; /// collectin of Conversion objects typedef std::vector ConversionCollection; diff --git a/DataFormats/EgammaCandidates/interface/Electron.h b/DataFormats/EgammaCandidates/interface/Electron.h index 647cb074f2867..a300bf5137335 100644 --- a/DataFormats/EgammaCandidates/interface/Electron.h +++ b/DataFormats/EgammaCandidates/interface/Electron.h @@ -12,44 +12,48 @@ #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" namespace reco { + namespace io_v1 { - class Electron : public RecoCandidate { - public: - /// default constructor - Electron() : RecoCandidate() {} - /// constructor from values - Electron(Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0)) - : RecoCandidate(q, p4, vtx, -11 * q) {} - /// destructor - ~Electron() override; - /// returns a clone of the candidate - Electron* clone() const override; - /// reference to a Track - using reco::RecoCandidate::track; // avoid hiding the base - reco::TrackRef track() const override; - /// reference to a SuperCluster - reco::SuperClusterRef superCluster() const override; - /// reference to a GsfTrack - reco::GsfTrackRef gsfTrack() const override; - /// set refrence to Photon component - void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } - /// set refrence to Track component - void setTrack(const reco::TrackRef& r) { track_ = r; } - /// set reference to GsfTrack component - void setGsfTrack(const reco::GsfTrackRef& r) { gsfTrack_ = r; } + class Electron : public RecoCandidate { + public: + /// default constructor + Electron() : RecoCandidate() {} + /// constructor from values + Electron(Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0)) + : RecoCandidate(q, p4, vtx, -11 * q) {} + /// destructor + ~Electron() override; + /// returns a clone of the candidate + Electron* clone() const override; + /// reference to a Track + using reco::RecoCandidate::track; // avoid hiding the base + reco::TrackRef track() const override; + /// reference to a SuperCluster + reco::SuperClusterRef superCluster() const override; + /// reference to a GsfTrack + reco::GsfTrackRef gsfTrack() const override; + /// set refrence to Photon component + void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } + /// set refrence to Track component + void setTrack(const reco::TrackRef& r) { track_ = r; } + /// set reference to GsfTrack component + void setGsfTrack(const reco::GsfTrackRef& r) { gsfTrack_ = r; } - bool isElectron() const override; + bool isElectron() const override; - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to a SuperCluster - reco::SuperClusterRef superCluster_; - /// reference to a Track - reco::TrackRef track_; - /// reference to a GsfTrack; - reco::GsfTrackRef gsfTrack_; - }; + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to a SuperCluster + reco::SuperClusterRef superCluster_; + /// reference to a Track + reco::TrackRef track_; + /// reference to a GsfTrack; + reco::GsfTrackRef gsfTrack_; + }; + + } // namespace io_v1 + using Electron = io_v1::Electron; } // namespace reco diff --git a/DataFormats/EgammaCandidates/interface/ElectronFwd.h b/DataFormats/EgammaCandidates/interface/ElectronFwd.h index f034e039a541f..440c9556ed89c 100644 --- a/DataFormats/EgammaCandidates/interface/ElectronFwd.h +++ b/DataFormats/EgammaCandidates/interface/ElectronFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Electron; + namespace io_v1 { + class Electron; + } + using Electron = io_v1::Electron; /// collectin of Electron objects typedef std::vector ElectronCollection; diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 51fa837f2ef83..f8f8fc4f842f7 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -20,8 +20,9 @@ #include namespace reco { + namespace io_v1 { - /**************************************************************************** + /**************************************************************************** * \class reco::GsfElectron * * An Electron with a GsfTrack seeded from an ElectronSeed. @@ -33,915 +34,919 @@ namespace reco { * ****************************************************************************/ - class GsfElectron : public RecoCandidate { - //======================================================= - // Constructors - // - // The clone() method with arguments, and the copy - // constructor with edm references is designed for - // someone which want to duplicates all - // collections. - //======================================================= - - public: - // some nested structures defined later on - struct ChargeInfo; - struct TrackClusterMatching; - struct TrackExtrapolations; - struct ClosestCtfTrack; - struct FiducialFlags; - struct ShowerShape; - struct IsolationVariables; - struct ConversionRejection; - struct ClassificationVariables; - struct SaturationInfo; - - GsfElectron(); - GsfElectron(const GsfElectronCoreRef &); - GsfElectron(const GsfElectron &, const GsfElectronCoreRef &); - GsfElectron(const GsfElectron &electron, - const GsfElectronCoreRef &core, - const CaloClusterPtr &electronCluster, - const TrackRef &closestCtfTrack, - const TrackBaseRef &conversionPartner, - const GsfTrackRefVector &ambiguousTracks); - GsfElectron(int charge, - const ChargeInfo &, - const GsfElectronCoreRef &, - const TrackClusterMatching &, - const TrackExtrapolations &, - const ClosestCtfTrack &, - const FiducialFlags &, - const ShowerShape &, - const ConversionRejection &); - GsfElectron(int charge, - const ChargeInfo &, - const GsfElectronCoreRef &, - const TrackClusterMatching &, - const TrackExtrapolations &, - const ClosestCtfTrack &, - const FiducialFlags &, - const ShowerShape &, - const ShowerShape &, - const ConversionRejection &, - const SaturationInfo &); - GsfElectron *clone() const override; - GsfElectron *clone(const GsfElectronCoreRef &core, - const CaloClusterPtr &electronCluster, - const TrackRef &closestCtfTrack, - const TrackBaseRef &conversionPartner, - const GsfTrackRefVector &ambiguousTracks) const; - ~GsfElectron() override {} - - private: - void init(); - - //======================================================= - // Candidate methods and complementary information - // - // The gsf electron producer has tried to best evaluate - // the four momentum and charge and given those values to - // the GsfElectron constructor, which forwarded them to - // the Candidate constructor. Those values can be retreived - // with getters inherited from Candidate : p4() and charge(). - //======================================================= - - public: - // Inherited from Candidate - // const LorentzVector & charge() const ; - // const LorentzVector & p4() const ; - - // Complementary struct - struct ChargeInfo { - int scPixCharge; - bool isGsfCtfScPixConsistent; - bool isGsfScPixConsistent; - bool isGsfCtfConsistent; - ChargeInfo() - : scPixCharge(0), isGsfCtfScPixConsistent(false), isGsfScPixConsistent(false), isGsfCtfConsistent(false) {} - }; - - // Charge info accessors - // to get gsf track charge: gsfTrack()->charge() - // to get ctf track charge, if closestCtfTrackRef().isNonnull(): closestCtfTrackRef()->charge() - int scPixCharge() const { return chargeInfo_.scPixCharge; } - bool isGsfCtfScPixChargeConsistent() const { return chargeInfo_.isGsfCtfScPixConsistent; } - bool isGsfScPixChargeConsistent() const { return chargeInfo_.isGsfScPixConsistent; } - bool isGsfCtfChargeConsistent() const { return chargeInfo_.isGsfCtfConsistent; } - const ChargeInfo &chargeInfo() const { return chargeInfo_; } - - // Candidate redefined methods - bool isElectron() const override { return true; } - bool overlap(const Candidate &) const override; - - private: - // Complementary attributes - ChargeInfo chargeInfo_; - - //======================================================= - // Core Attributes - // - // They all have been computed before, when building the - // collection of GsfElectronCore instances. Each GsfElectron - // has a reference toward a GsfElectronCore. - //======================================================= - - public: - // accessors - virtual GsfElectronCoreRef core() const; - void setCore(const reco::GsfElectronCoreRef &core) { core_ = core; } - - // forward core methods - SuperClusterRef superCluster() const override { return core()->superCluster(); } - GsfTrackRef gsfTrack() const override { return core()->gsfTrack(); } - float ctfGsfOverlap() const { return core()->ctfGsfOverlap(); } - bool ecalDrivenSeed() const { return core()->ecalDrivenSeed(); } - bool trackerDrivenSeed() const { return core()->trackerDrivenSeed(); } - virtual SuperClusterRef parentSuperCluster() const { return core()->parentSuperCluster(); } - bool closestCtfTrackRefValid() const { - return closestCtfTrackRef().isAvailable() && closestCtfTrackRef().isNonnull(); - } - //methods used for MVA variables - float closestCtfTrackNormChi2() const { - return closestCtfTrackRefValid() ? closestCtfTrackRef()->normalizedChi2() : 0; - } - int closestCtfTrackNLayers() const { - return closestCtfTrackRefValid() ? closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement() : -1; - } - - // backward compatibility - struct ClosestCtfTrack { - TrackRef ctfTrack; // best matching ctf track - float shFracInnerHits; // fraction of common hits between the ctf and gsf tracks - ClosestCtfTrack() : shFracInnerHits(0.) {} - ClosestCtfTrack(TrackRef track, float sh) : ctfTrack(track), shFracInnerHits(sh) {} - }; - float shFracInnerHits() const { return core()->ctfGsfOverlap(); } - virtual TrackRef closestCtfTrackRef() const { return core()->ctfTrack(); } - virtual ClosestCtfTrack closestCtfTrack() const { - return ClosestCtfTrack(core()->ctfTrack(), core()->ctfGsfOverlap()); - } - - private: - // attributes - GsfElectronCoreRef core_; - - //======================================================= - // Track-Cluster Matching Attributes - //======================================================= - - public: - struct TrackClusterMatching { - CaloClusterPtr electronCluster; // basic cluster best matching gsf track - float eSuperClusterOverP; // the supercluster energy / track momentum at the PCA to the beam spot - float eSeedClusterOverP; // the seed cluster energy / track momentum at the PCA to the beam spot - float eSeedClusterOverPout; // the seed cluster energy / track momentum at calo extrapolated from the outermost track state - float eEleClusterOverPout; // the electron cluster energy / track momentum at calo extrapolated from the outermost track state - float deltaEtaSuperClusterAtVtx; // the supercluster eta - track eta position at calo extrapolated from innermost track state - float deltaEtaSeedClusterAtCalo; // the seed cluster eta - track eta position at calo extrapolated from the outermost track state - float deltaEtaEleClusterAtCalo; // the electron cluster eta - track eta position at calo extrapolated from the outermost state - float deltaPhiEleClusterAtCalo; // the electron cluster phi - track phi position at calo extrapolated from the outermost track state - float deltaPhiSuperClusterAtVtx; // the supercluster phi - track phi position at calo extrapolated from the innermost track state - float deltaPhiSeedClusterAtCalo; // the seed cluster phi - track phi position at calo extrapolated from the outermost track state - TrackClusterMatching() - : eSuperClusterOverP(0.), - eSeedClusterOverP(0.), - eSeedClusterOverPout(0.), - eEleClusterOverPout(0.), - deltaEtaSuperClusterAtVtx(std::numeric_limits::max()), - deltaEtaSeedClusterAtCalo(std::numeric_limits::max()), - deltaEtaEleClusterAtCalo(std::numeric_limits::max()), - deltaPhiEleClusterAtCalo(std::numeric_limits::max()), - deltaPhiSuperClusterAtVtx(std::numeric_limits::max()), - deltaPhiSeedClusterAtCalo(std::numeric_limits::max()) {} - }; - - // accessors - CaloClusterPtr electronCluster() const { return trackClusterMatching_.electronCluster; } - float eSuperClusterOverP() const { return trackClusterMatching_.eSuperClusterOverP; } - float eSeedClusterOverP() const { return trackClusterMatching_.eSeedClusterOverP; } - float eSeedClusterOverPout() const { return trackClusterMatching_.eSeedClusterOverPout; } - float eEleClusterOverPout() const { return trackClusterMatching_.eEleClusterOverPout; } - float deltaEtaSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaEtaSuperClusterAtVtx; } - float deltaEtaSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaSeedClusterAtCalo; } - float deltaEtaEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaEleClusterAtCalo; } - float deltaPhiSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaPhiSuperClusterAtVtx; } - float deltaPhiSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiSeedClusterAtCalo; } - float deltaPhiEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiEleClusterAtCalo; } - float deltaEtaSeedClusterTrackAtVtx() const { - return superCluster().isNonnull() && superCluster()->seed().isNonnull() - ? trackClusterMatching_.deltaEtaSuperClusterAtVtx - superCluster()->eta() + - superCluster()->seed()->eta() - : std::numeric_limits::max(); - } - const TrackClusterMatching &trackClusterMatching() const { return trackClusterMatching_; } - - // for backward compatibility, usefull ? - void setDeltaEtaSuperClusterAtVtx(float de) { trackClusterMatching_.deltaEtaSuperClusterAtVtx = de; } - void setDeltaPhiSuperClusterAtVtx(float dphi) { trackClusterMatching_.deltaPhiSuperClusterAtVtx = dphi; } - - private: - // attributes - TrackClusterMatching trackClusterMatching_; - - //======================================================= - // Track extrapolations - //======================================================= - - public: - struct TrackExtrapolations { - math::XYZPointF positionAtVtx; // the track PCA to the beam spot - math::XYZPointF positionAtCalo; // the track PCA to the supercluster position - math::XYZVectorF momentumAtVtx; // the track momentum at the PCA to the beam spot - // the track momentum extrapolated at the supercluster position from the innermost track state - math::XYZVectorF momentumAtCalo; - // the track momentum extrapolated at the seed cluster position from the outermost track state - math::XYZVectorF momentumOut; - // the track momentum extrapolated at the ele cluster position from the outermost track state - math::XYZVectorF momentumAtEleClus; - math::XYZVectorF momentumAtVtxWithConstraint; // the track momentum at the PCA to the beam spot using bs constraint - }; - - // accessors - math::XYZPointF trackPositionAtVtx() const { return trackExtrapolations_.positionAtVtx; } - math::XYZPointF trackPositionAtCalo() const { return trackExtrapolations_.positionAtCalo; } - math::XYZVectorF trackMomentumAtVtx() const { return trackExtrapolations_.momentumAtVtx; } - math::XYZVectorF trackMomentumAtCalo() const { return trackExtrapolations_.momentumAtCalo; } - math::XYZVectorF trackMomentumOut() const { return trackExtrapolations_.momentumOut; } - math::XYZVectorF trackMomentumAtEleClus() const { return trackExtrapolations_.momentumAtEleClus; } - math::XYZVectorF trackMomentumAtVtxWithConstraint() const { - return trackExtrapolations_.momentumAtVtxWithConstraint; - } - const TrackExtrapolations &trackExtrapolations() const { return trackExtrapolations_; } - - // setter (if you know what you're doing) - void setTrackExtrapolations(const TrackExtrapolations &te) { trackExtrapolations_ = te; } - - // for backward compatibility - math::XYZPointF TrackPositionAtVtx() const { return trackPositionAtVtx(); } - math::XYZPointF TrackPositionAtCalo() const { return trackPositionAtCalo(); } - - private: - // attributes - TrackExtrapolations trackExtrapolations_; - - //======================================================= - // SuperCluster direct access - //======================================================= - - public: - // direct accessors - math::XYZPoint superClusterPosition() const { return superCluster()->position(); } // the super cluster position - int basicClustersSize() const { - return superCluster()->clustersSize(); - } // number of basic clusters inside the supercluster - CaloCluster_iterator basicClustersBegin() const { return superCluster()->clustersBegin(); } - CaloCluster_iterator basicClustersEnd() const { return superCluster()->clustersEnd(); } - - // for backward compatibility - math::XYZPoint caloPosition() const { return superCluster()->position(); } - - //======================================================= - // Fiducial Flags - //======================================================= - - public: - struct FiducialFlags { - bool isEB; // true if particle is in ECAL Barrel - bool isEE; // true if particle is in ECAL Endcaps - bool isEBEEGap; // true if particle is in the crack between EB and EE - bool isEBEtaGap; // true if particle is in EB, and inside the eta gaps between modules - bool isEBPhiGap; // true if particle is in EB, and inside the phi gaps between modules - bool isEEDeeGap; // true if particle is in EE, and inside the gaps between dees - bool isEERingGap; // true if particle is in EE, and inside the gaps between rings - FiducialFlags() - : isEB(false), - isEE(false), - isEBEEGap(false), - isEBEtaGap(false), - isEBPhiGap(false), - isEEDeeGap(false), - isEERingGap(false) {} - }; - - // accessors - bool isEB() const { return fiducialFlags_.isEB; } - bool isEE() const { return fiducialFlags_.isEE; } - bool isGap() const { return ((isEBEEGap()) || (isEBGap()) || (isEEGap())); } - bool isEBEEGap() const { return fiducialFlags_.isEBEEGap; } - bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } - bool isEBEtaGap() const { return fiducialFlags_.isEBEtaGap; } - bool isEBPhiGap() const { return fiducialFlags_.isEBPhiGap; } - bool isEEGap() const { return (isEEDeeGap() || isEERingGap()); } - bool isEEDeeGap() const { return fiducialFlags_.isEEDeeGap; } - bool isEERingGap() const { return fiducialFlags_.isEERingGap; } - const FiducialFlags &fiducialFlags() const { return fiducialFlags_; } - // setters... not necessary in regular situations - // but handy for late stage modifications of electron objects - void setFFlagIsEB(const bool b) { fiducialFlags_.isEB = b; } - void setFFlagIsEE(const bool b) { fiducialFlags_.isEE = b; } - void setFFlagIsEBEEGap(const bool b) { fiducialFlags_.isEBEEGap = b; } - void setFFlagIsEBEtaGap(const bool b) { fiducialFlags_.isEBEtaGap = b; } - void setFFlagIsEBPhiGap(const bool b) { fiducialFlags_.isEBPhiGap = b; } - void setFFlagIsEEDeeGap(const bool b) { fiducialFlags_.isEEDeeGap = b; } - void setFFlagIsEERingGap(const bool b) { fiducialFlags_.isEERingGap = b; } - - private: - // attributes - FiducialFlags fiducialFlags_; - - //======================================================= - // Shower Shape Variables - //======================================================= - - public: - struct ShowerShape { - float sigmaEtaEta; // weighted cluster rms along eta and inside 5x5 (absolute eta) - float sigmaIetaIeta; // weighted cluster rms along eta and inside 5x5 (Xtal eta) - float sigmaIphiIphi; // weighted cluster rms along phi and inside 5x5 (Xtal phi) - float e1x5; // energy inside 1x5 in etaxphi around the seed Xtal - float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) - float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal - float r9; // ratio of the 3x3 energy and supercluster energy - float hcalDepth1OverEcal; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone) - float hcalDepth2OverEcal; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone) - float hcalDepth1OverEcalBc; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters) - float hcalDepth2OverEcalBc; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters) - std::array - hcalOverEcal; // run3 hcal over ecal seed cluster energy per depth (using rechits within a cone) - std::array - hcalOverEcalBc; // run3 hcal over ecal seed cluster energy per depth (using rechits behind clusters) - std::vector hcalTowersBehindClusters; - bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - float sigmaIetaIphi; - float eMax; - float e2nd; - float eTop; - float eLeft; - float eRight; - float eBottom; - float e2x5Top; - float e2x5Left; - float e2x5Right; - float e2x5Bottom; - ShowerShape() - : sigmaEtaEta(std::numeric_limits::max()), - sigmaIetaIeta(std::numeric_limits::max()), - sigmaIphiIphi(std::numeric_limits::max()), - e1x5(0.f), - e2x5Max(0.f), - e5x5(0.f), - r9(-std::numeric_limits::max()), - hcalDepth1OverEcal(0.f), - hcalDepth2OverEcal(0.f), - hcalDepth1OverEcalBc(0.f), - hcalDepth2OverEcalBc(0.f), - hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - invalidHcal(false), - pre7DepthHcal(true), - sigmaIetaIphi(0.f), - eMax(0.f), - e2nd(0.f), - eTop(0.f), - eLeft(0.f), - eRight(0.f), - eBottom(0.f), - e2x5Top(0.f), - e2x5Left(0.f), - e2x5Right(0.f), - e2x5Bottom(0.f) {} - }; - - // accessors - float sigmaEtaEta() const { return showerShape_.sigmaEtaEta; } - float sigmaIetaIeta() const { return showerShape_.sigmaIetaIeta; } - float sigmaIphiIphi() const { return showerShape_.sigmaIphiIphi; } - float e1x5() const { return showerShape_.e1x5; } - float e2x5Max() const { return showerShape_.e2x5Max; } - float e5x5() const { return showerShape_.e5x5; } - float r9() const { return showerShape_.r9; } - float hcalOverEcal(const ShowerShape &ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; - else if (depth == 1) - return ss.hcalDepth1OverEcal; - else if (depth == 2) - return ss.hcalDepth2OverEcal; - - return 0.f; - } else { - const auto &hovere = ss.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + class GsfElectron : public RecoCandidate { + //======================================================= + // Constructors + // + // The clone() method with arguments, and the copy + // constructor with edm references is designed for + // someone which want to duplicates all + // collections. + //======================================================= + + public: + // some nested structures defined later on + struct ChargeInfo; + struct TrackClusterMatching; + struct TrackExtrapolations; + struct ClosestCtfTrack; + struct FiducialFlags; + struct ShowerShape; + struct IsolationVariables; + struct ConversionRejection; + struct ClassificationVariables; + struct SaturationInfo; + + GsfElectron(); + GsfElectron(const GsfElectronCoreRef &); + GsfElectron(const GsfElectron &, const GsfElectronCoreRef &); + GsfElectron(const GsfElectron &electron, + const GsfElectronCoreRef &core, + const CaloClusterPtr &electronCluster, + const TrackRef &closestCtfTrack, + const TrackBaseRef &conversionPartner, + const GsfTrackRefVector &ambiguousTracks); + GsfElectron(int charge, + const ChargeInfo &, + const GsfElectronCoreRef &, + const TrackClusterMatching &, + const TrackExtrapolations &, + const ClosestCtfTrack &, + const FiducialFlags &, + const ShowerShape &, + const ConversionRejection &); + GsfElectron(int charge, + const ChargeInfo &, + const GsfElectronCoreRef &, + const TrackClusterMatching &, + const TrackExtrapolations &, + const ClosestCtfTrack &, + const FiducialFlags &, + const ShowerShape &, + const ShowerShape &, + const ConversionRejection &, + const SaturationInfo &); + GsfElectron *clone() const override; + GsfElectron *clone(const GsfElectronCoreRef &core, + const CaloClusterPtr &electronCluster, + const TrackRef &closestCtfTrack, + const TrackBaseRef &conversionPartner, + const GsfTrackRefVector &ambiguousTracks) const; + ~GsfElectron() override {} + + private: + void init(); + + //======================================================= + // Candidate methods and complementary information + // + // The gsf electron producer has tried to best evaluate + // the four momentum and charge and given those values to + // the GsfElectron constructor, which forwarded them to + // the Candidate constructor. Those values can be retreived + // with getters inherited from Candidate : p4() and charge(). + //======================================================= + + public: + // Inherited from Candidate + // const LorentzVector & charge() const ; + // const LorentzVector & p4() const ; + + // Complementary struct + struct ChargeInfo { + int scPixCharge; + bool isGsfCtfScPixConsistent; + bool isGsfScPixConsistent; + bool isGsfCtfConsistent; + ChargeInfo() + : scPixCharge(0), isGsfCtfScPixConsistent(false), isGsfScPixConsistent(false), isGsfCtfConsistent(false) {} + }; + + // Charge info accessors + // to get gsf track charge: gsfTrack()->charge() + // to get ctf track charge, if closestCtfTrackRef().isNonnull(): closestCtfTrackRef()->charge() + int scPixCharge() const { return chargeInfo_.scPixCharge; } + bool isGsfCtfScPixChargeConsistent() const { return chargeInfo_.isGsfCtfScPixConsistent; } + bool isGsfScPixChargeConsistent() const { return chargeInfo_.isGsfScPixConsistent; } + bool isGsfCtfChargeConsistent() const { return chargeInfo_.isGsfCtfConsistent; } + const ChargeInfo &chargeInfo() const { return chargeInfo_; } + + // Candidate redefined methods + bool isElectron() const override { return true; } + bool overlap(const Candidate &) const override; + + private: + // Complementary attributes + ChargeInfo chargeInfo_; + + //======================================================= + // Core Attributes + // + // They all have been computed before, when building the + // collection of GsfElectronCore instances. Each GsfElectron + // has a reference toward a GsfElectronCore. + //======================================================= + + public: + // accessors + virtual GsfElectronCoreRef core() const; + void setCore(const reco::GsfElectronCoreRef &core) { core_ = core; } + + // forward core methods + SuperClusterRef superCluster() const override { return core()->superCluster(); } + GsfTrackRef gsfTrack() const override { return core()->gsfTrack(); } + float ctfGsfOverlap() const { return core()->ctfGsfOverlap(); } + bool ecalDrivenSeed() const { return core()->ecalDrivenSeed(); } + bool trackerDrivenSeed() const { return core()->trackerDrivenSeed(); } + virtual SuperClusterRef parentSuperCluster() const { return core()->parentSuperCluster(); } + bool closestCtfTrackRefValid() const { + return closestCtfTrackRef().isAvailable() && closestCtfTrackRef().isNonnull(); } - } - float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShape_, depth); } - float hcalOverEcalBc(const ShowerShape &ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; - else if (depth == 1) - return ss.hcalDepth1OverEcalBc; - else if (depth == 2) - return ss.hcalDepth2OverEcalBc; - - return 0.f; - } else { - const auto &hovere = ss.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + //methods used for MVA variables + float closestCtfTrackNormChi2() const { + return closestCtfTrackRefValid() ? closestCtfTrackRef()->normalizedChi2() : 0; + } + int closestCtfTrackNLayers() const { + return closestCtfTrackRefValid() ? closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement() : -1; } - } - float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShape_, depth); } - const std::vector &hcalTowersBehindClusters() const { - return showerShape_.hcalTowersBehindClusters; - } - bool hcalOverEcalValid() const { return !showerShape_.invalidHcal; } - float eLeft() const { return showerShape_.eLeft; } - float eRight() const { return showerShape_.eRight; } - float eTop() const { return showerShape_.eTop; } - float eBottom() const { return showerShape_.eBottom; } - const ShowerShape &showerShape() const { return showerShape_; } - // non-zero-suppressed and no-fractions shower shapes - // ecal energy is always that from the full 5x5 - float full5x5_sigmaEtaEta() const { return full5x5_showerShape_.sigmaEtaEta; } - float full5x5_sigmaIetaIeta() const { return full5x5_showerShape_.sigmaIetaIeta; } - float full5x5_sigmaIphiIphi() const { return full5x5_showerShape_.sigmaIphiIphi; } - float full5x5_e1x5() const { return full5x5_showerShape_.e1x5; } - float full5x5_e2x5Max() const { return full5x5_showerShape_.e2x5Max; } - float full5x5_e5x5() const { return full5x5_showerShape_.e5x5; } - float full5x5_r9() const { return full5x5_showerShape_.r9; } - float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShape_, depth); } - float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShape_, depth); } - bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } - float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } - float full5x5_e2x5Right() const { return full5x5_showerShape_.e2x5Right; } - float full5x5_e2x5Top() const { return full5x5_showerShape_.e2x5Top; } - float full5x5_e2x5Bottom() const { return full5x5_showerShape_.e2x5Bottom; } - float full5x5_eLeft() const { return full5x5_showerShape_.eLeft; } - float full5x5_eRight() const { return full5x5_showerShape_.eRight; } - float full5x5_eTop() const { return full5x5_showerShape_.eTop; } - float full5x5_eBottom() const { return full5x5_showerShape_.eBottom; } - const ShowerShape &full5x5_showerShape() const { return full5x5_showerShape_; } - - // setters (if you know what you're doing) - void setShowerShape(const ShowerShape &s) { showerShape_ = s; } - void full5x5_setShowerShape(const ShowerShape &s) { full5x5_showerShape_ = s; } - - // for backward compatibility (this will only ever be the ZS shapes!) - float scSigmaEtaEta() const { return sigmaEtaEta(); } - float scSigmaIEtaIEta() const { return sigmaIetaIeta(); } - float scE1x5() const { return e1x5(); } - float scE2x5Max() const { return e2x5Max(); } - float scE5x5() const { return e5x5(); } - float hadronicOverEm() const { return hcalOverEcal(); } - - private: - // attributes - ShowerShape showerShape_; - ShowerShape full5x5_showerShape_; - - //======================================================= - // SaturationInfo - //======================================================= - - public: - struct SaturationInfo { - int nSaturatedXtals; - bool isSeedSaturated; - SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} - }; - // accessors - float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } - float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } - const SaturationInfo &saturationInfo() const { return saturationInfo_; } - void setSaturationInfo(const SaturationInfo &s) { saturationInfo_ = s; } - - private: - SaturationInfo saturationInfo_; - - //======================================================= - // Isolation Variables - //======================================================= - - public: - struct IsolationVariables { - float tkSumPt; // track iso with electron footprint removed - float tkSumPtHEEP; // track iso used for the HEEP ID - float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed - float hcalDepth1TowerSumEt; // hcal depth 1 iso deposit with electron footprint removed - float hcalDepth2TowerSumEt; // hcal depth 2 iso deposit with electron footprint removed - float hcalDepth1TowerSumEtBc; // hcal depth 1 iso deposit without towers behind clusters - float hcalDepth2TowerSumEtBc; // hcal depth 2 iso deposit without towers behind clusters - std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed - std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - IsolationVariables() - : tkSumPt(0.), - tkSumPtHEEP(0.), - ecalRecHitSumEt(0.), - hcalDepth1TowerSumEt(0.f), - hcalDepth2TowerSumEt(0.f), - hcalDepth1TowerSumEtBc(0.f), - hcalDepth2TowerSumEtBc(0.f), - hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - pre7DepthHcal(true) {} - }; + // backward compatibility + struct ClosestCtfTrack { + TrackRef ctfTrack; // best matching ctf track + float shFracInnerHits; // fraction of common hits between the ctf and gsf tracks + ClosestCtfTrack() : shFracInnerHits(0.) {} + ClosestCtfTrack(TrackRef track, float sh) : ctfTrack(track), shFracInnerHits(sh) {} + }; + float shFracInnerHits() const { return core()->ctfGsfOverlap(); } + virtual TrackRef closestCtfTrackRef() const { return core()->ctfTrack(); } + virtual ClosestCtfTrack closestCtfTrack() const { + return ClosestCtfTrack(core()->ctfTrack(), core()->ctfGsfOverlap()); + } - // 03 accessors - float dr03TkSumPt() const { return dr03_.tkSumPt; } - float dr03TkSumPtHEEP() const { return dr03_.tkSumPtHEEP; } - float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } - float hcalTowerSumEt(const IsolationVariables &iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalDepth1TowerSumEt + iv.hcalDepth2TowerSumEt; - else if (depth == 1) - return iv.hcalDepth1TowerSumEt; - else if (depth == 2) - return iv.hcalDepth2TowerSumEt; - - return 0.f; - } else { - const auto &hcaliso = iv.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + private: + // attributes + GsfElectronCoreRef core_; + + //======================================================= + // Track-Cluster Matching Attributes + //======================================================= + + public: + struct TrackClusterMatching { + CaloClusterPtr electronCluster; // basic cluster best matching gsf track + float eSuperClusterOverP; // the supercluster energy / track momentum at the PCA to the beam spot + float eSeedClusterOverP; // the seed cluster energy / track momentum at the PCA to the beam spot + float eSeedClusterOverPout; // the seed cluster energy / track momentum at calo extrapolated from the outermost track state + float eEleClusterOverPout; // the electron cluster energy / track momentum at calo extrapolated from the outermost track state + float deltaEtaSuperClusterAtVtx; // the supercluster eta - track eta position at calo extrapolated from innermost track state + float deltaEtaSeedClusterAtCalo; // the seed cluster eta - track eta position at calo extrapolated from the outermost track state + float deltaEtaEleClusterAtCalo; // the electron cluster eta - track eta position at calo extrapolated from the outermost state + float deltaPhiEleClusterAtCalo; // the electron cluster phi - track phi position at calo extrapolated from the outermost track state + float deltaPhiSuperClusterAtVtx; // the supercluster phi - track phi position at calo extrapolated from the innermost track state + float deltaPhiSeedClusterAtCalo; // the seed cluster phi - track phi position at calo extrapolated from the outermost track state + TrackClusterMatching() + : eSuperClusterOverP(0.), + eSeedClusterOverP(0.), + eSeedClusterOverPout(0.), + eEleClusterOverPout(0.), + deltaEtaSuperClusterAtVtx(std::numeric_limits::max()), + deltaEtaSeedClusterAtCalo(std::numeric_limits::max()), + deltaEtaEleClusterAtCalo(std::numeric_limits::max()), + deltaPhiEleClusterAtCalo(std::numeric_limits::max()), + deltaPhiSuperClusterAtVtx(std::numeric_limits::max()), + deltaPhiSeedClusterAtCalo(std::numeric_limits::max()) {} + }; + + // accessors + CaloClusterPtr electronCluster() const { return trackClusterMatching_.electronCluster; } + float eSuperClusterOverP() const { return trackClusterMatching_.eSuperClusterOverP; } + float eSeedClusterOverP() const { return trackClusterMatching_.eSeedClusterOverP; } + float eSeedClusterOverPout() const { return trackClusterMatching_.eSeedClusterOverPout; } + float eEleClusterOverPout() const { return trackClusterMatching_.eEleClusterOverPout; } + float deltaEtaSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaEtaSuperClusterAtVtx; } + float deltaEtaSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaSeedClusterAtCalo; } + float deltaEtaEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaEtaEleClusterAtCalo; } + float deltaPhiSuperClusterTrackAtVtx() const { return trackClusterMatching_.deltaPhiSuperClusterAtVtx; } + float deltaPhiSeedClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiSeedClusterAtCalo; } + float deltaPhiEleClusterTrackAtCalo() const { return trackClusterMatching_.deltaPhiEleClusterAtCalo; } + float deltaEtaSeedClusterTrackAtVtx() const { + return superCluster().isNonnull() && superCluster()->seed().isNonnull() + ? trackClusterMatching_.deltaEtaSuperClusterAtVtx - superCluster()->eta() + + superCluster()->seed()->eta() + : std::numeric_limits::max(); } - } - float dr03HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr03_, depth); } - float hcalTowerSumEtBc(const IsolationVariables &iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalDepth1TowerSumEtBc + iv.hcalDepth2TowerSumEtBc; - else if (depth == 1) - return iv.hcalDepth1TowerSumEtBc; - else if (depth == 2) - return iv.hcalDepth2TowerSumEtBc; - - return 0.f; - } else { - const auto &hcaliso = iv.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + const TrackClusterMatching &trackClusterMatching() const { return trackClusterMatching_; } + + // for backward compatibility, usefull ? + void setDeltaEtaSuperClusterAtVtx(float de) { trackClusterMatching_.deltaEtaSuperClusterAtVtx = de; } + void setDeltaPhiSuperClusterAtVtx(float dphi) { trackClusterMatching_.deltaPhiSuperClusterAtVtx = dphi; } + + private: + // attributes + TrackClusterMatching trackClusterMatching_; + + //======================================================= + // Track extrapolations + //======================================================= + + public: + struct TrackExtrapolations { + math::XYZPointF positionAtVtx; // the track PCA to the beam spot + math::XYZPointF positionAtCalo; // the track PCA to the supercluster position + math::XYZVectorF momentumAtVtx; // the track momentum at the PCA to the beam spot + // the track momentum extrapolated at the supercluster position from the innermost track state + math::XYZVectorF momentumAtCalo; + // the track momentum extrapolated at the seed cluster position from the outermost track state + math::XYZVectorF momentumOut; + // the track momentum extrapolated at the ele cluster position from the outermost track state + math::XYZVectorF momentumAtEleClus; + math::XYZVectorF + momentumAtVtxWithConstraint; // the track momentum at the PCA to the beam spot using bs constraint + }; + + // accessors + math::XYZPointF trackPositionAtVtx() const { return trackExtrapolations_.positionAtVtx; } + math::XYZPointF trackPositionAtCalo() const { return trackExtrapolations_.positionAtCalo; } + math::XYZVectorF trackMomentumAtVtx() const { return trackExtrapolations_.momentumAtVtx; } + math::XYZVectorF trackMomentumAtCalo() const { return trackExtrapolations_.momentumAtCalo; } + math::XYZVectorF trackMomentumOut() const { return trackExtrapolations_.momentumOut; } + math::XYZVectorF trackMomentumAtEleClus() const { return trackExtrapolations_.momentumAtEleClus; } + math::XYZVectorF trackMomentumAtVtxWithConstraint() const { + return trackExtrapolations_.momentumAtVtxWithConstraint; } - } - float dr03HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr03_, depth); } - const IsolationVariables &dr03IsolationVariables() const { return dr03_; } - - // 04 accessors - float dr04TkSumPt() const { return dr04_.tkSumPt; } - float dr04TkSumPtHEEP() const { return dr04_.tkSumPtHEEP; } - float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } - float dr04HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr04_, depth); } - float dr04HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr04_, depth); } - const IsolationVariables &dr04IsolationVariables() const { return dr04_; } - - // setters ?!? - void setDr03Isolation(const IsolationVariables &dr03) { dr03_ = dr03; } - void setDr04Isolation(const IsolationVariables &dr04) { dr04_ = dr04; } - - // for backward compatibility - void setIsolation03(const IsolationVariables &dr03) { dr03_ = dr03; } - void setIsolation04(const IsolationVariables &dr04) { dr04_ = dr04; } - const IsolationVariables &isolationVariables03() const { return dr03_; } - const IsolationVariables &isolationVariables04() const { return dr04_; } - - // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest - void hcalToRun2EffDepth(); - - private: - // attributes - IsolationVariables dr03_; - IsolationVariables dr04_; - - //======================================================= - // Conversion Rejection Information - //======================================================= - - public: - struct ConversionRejection { - int flags; // -max:not-computed, other: as computed by Puneeth conversion code - TrackBaseRef partner; // conversion partner - float dist; // distance to the conversion partner - float dcot; // difference of cot(angle) with the conversion partner track - float radius; // signed conversion radius - float vtxFitProb; //fit probablity (chi2/ndof) of the matched conversion vtx - ConversionRejection() - : flags(-1), - dist(std::numeric_limits::max()), - dcot(std::numeric_limits::max()), - radius(std::numeric_limits::max()), - vtxFitProb(std::numeric_limits::max()) {} - }; - - // accessors - int convFlags() const { return conversionRejection_.flags; } - TrackBaseRef convPartner() const { return conversionRejection_.partner; } - float convDist() const { return conversionRejection_.dist; } - float convDcot() const { return conversionRejection_.dcot; } - float convRadius() const { return conversionRejection_.radius; } - float convVtxFitProb() const { return conversionRejection_.vtxFitProb; } - const ConversionRejection &conversionRejectionVariables() const { return conversionRejection_; } - void setConversionRejectionVariables(const ConversionRejection &convRej) { conversionRejection_ = convRej; } - - private: - // attributes - ConversionRejection conversionRejection_; - - //======================================================= - // Pflow Information - //======================================================= - - public: - struct PflowIsolationVariables { - //first three data members that changed names, according to DataFormats/MuonReco/interface/MuonPFIsolation.h - float sumChargedHadronPt; //!< sum-pt of charged Hadron // old float chargedHadronIso ; - float sumNeutralHadronEt; //!< sum pt of neutral hadrons // old float neutralHadronIso ; - float sumPhotonEt; //!< sum pt of PF photons // old float photonIso ; - //then four new data members, corresponding to DataFormats/MuonReco/interface/MuonPFIsolation.h - float sumChargedParticlePt; //!< sum-pt of charged Particles(inludes e/mu) - float sumNeutralHadronEtHighThreshold; //!< sum pt of neutral hadrons with a higher threshold - float sumPhotonEtHighThreshold; //!< sum pt of PF photons with a higher threshold - float sumPUPt; //!< sum pt of charged Particles not from PV (for Pu corrections) - //new pf cluster based isolation values - float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of electron - float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of electron - PflowIsolationVariables() - : sumChargedHadronPt(0), - sumNeutralHadronEt(0), - sumPhotonEt(0), - sumChargedParticlePt(0), - sumNeutralHadronEtHighThreshold(0), - sumPhotonEtHighThreshold(0), - sumPUPt(0), - sumEcalClusterEt(0), - sumHcalClusterEt(0) {} - }; - - struct MvaInput { - int earlyBrem; // Early Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) - int lateBrem; // Late Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) - float sigmaEtaEta; // Sigma-eta-eta with the PF cluster - float hadEnergy; // Associated PF Had Cluster energy - float deltaEta; // PF-cluster GSF track delta-eta - int nClusterOutsideMustache; // -2 => unknown, -1 =>could not be evaluated, 0 and more => number of clusters - float etOutsideMustache; - MvaInput() - : earlyBrem(-2), - lateBrem(-2), - sigmaEtaEta(std::numeric_limits::max()), - hadEnergy(0.), - deltaEta(std::numeric_limits::max()), - nClusterOutsideMustache(-2), - etOutsideMustache(-std::numeric_limits::max()) {} - }; - - static constexpr float mvaPlaceholder = -999999999.; - - struct MvaOutput { - int status; // see PFCandidateElectronExtra::StatusFlag - float mva_Isolated; - float mva_e_pi; - float mvaByPassForIsolated; // complementary MVA used in preselection - float dnn_e_sigIsolated; - float dnn_e_sigNonIsolated; - float dnn_e_bkgNonIsolated; - float dnn_e_bkgTau; - float dnn_e_bkgPhoton; - MvaOutput() - : status(-1), - mva_Isolated(mvaPlaceholder), - mva_e_pi(mvaPlaceholder), - mvaByPassForIsolated(mvaPlaceholder), - dnn_e_sigIsolated(mvaPlaceholder), - dnn_e_sigNonIsolated(mvaPlaceholder), - dnn_e_bkgNonIsolated(mvaPlaceholder), - dnn_e_bkgTau(mvaPlaceholder), - dnn_e_bkgPhoton(mvaPlaceholder) {} - }; - - // accessors - const PflowIsolationVariables &pfIsolationVariables() const { return pfIso_; } - //backwards compat functions for pat::Electron - float ecalPFClusterIso() const { return pfIso_.sumEcalClusterEt; }; - float hcalPFClusterIso() const { return pfIso_.sumHcalClusterEt; }; - - const MvaInput &mvaInput() const { return mvaInput_; } - const MvaOutput &mvaOutput() const { return mvaOutput_; } - - // setters - void setPfIsolationVariables(const PflowIsolationVariables &iso) { pfIso_ = iso; } - void setMvaInput(const MvaInput &mi) { mvaInput_ = mi; } - void setMvaOutput(const MvaOutput &mo) { mvaOutput_ = mo; } - - // for backward compatibility - float mva_Isolated() const { return mvaOutput_.mva_Isolated; } - float mva_e_pi() const { return mvaOutput_.mva_e_pi; } - float dnn_signal_Isolated() const { return mvaOutput_.dnn_e_sigIsolated; } - float dnn_signal_nonIsolated() const { return mvaOutput_.dnn_e_sigNonIsolated; } - float dnn_bkg_nonIsolated() const { return mvaOutput_.dnn_e_bkgNonIsolated; } - float dnn_bkg_Tau() const { return mvaOutput_.dnn_e_bkgTau; } - float dnn_bkg_Photon() const { return mvaOutput_.dnn_e_bkgPhoton; } - - private: - PflowIsolationVariables pfIso_; - MvaInput mvaInput_; - MvaOutput mvaOutput_; - - //======================================================= - // Preselection and Ambiguity - //======================================================= - - public: - // accessors - bool ecalDriven() const; // return true if ecalDrivenSeed() and passingCutBasedPreselection() - bool passingCutBasedPreselection() const { return passCutBasedPreselection_; } - bool passingPflowPreselection() const { return passPflowPreselection_; } - bool ambiguous() const { return ambiguous_; } - GsfTrackRefVector::size_type ambiguousGsfTracksSize() const { return ambiguousGsfTracks_.size(); } - auto const &ambiguousGsfTracks() const { return ambiguousGsfTracks_; } - - // setters - void setPassCutBasedPreselection(bool flag) { passCutBasedPreselection_ = flag; } - void setPassPflowPreselection(bool flag) { passPflowPreselection_ = flag; } - void setAmbiguous(bool flag) { ambiguous_ = flag; } - void clearAmbiguousGsfTracks() { ambiguousGsfTracks_.clear(); } - void addAmbiguousGsfTrack(const reco::GsfTrackRef &t) { ambiguousGsfTracks_.push_back(t); } - - // backward compatibility - void setPassMvaPreselection(bool flag) { passMvaPreslection_ = flag; } - bool passingMvaPreselection() const { return passMvaPreslection_; } - - private: - // attributes - bool passCutBasedPreselection_; - bool passPflowPreselection_; - bool passMvaPreslection_; // to be removed : passPflowPreslection_ - bool ambiguous_; - GsfTrackRefVector ambiguousGsfTracks_; // ambiguous gsf tracks - - //======================================================= - // Brem Fractions and Classification - //======================================================= - - public: - struct ClassificationVariables { - float trackFbrem; // the brem fraction from gsf fit: (track momentum in - track momentum out) / track momentum in - float superClusterFbrem; // the brem fraction from supercluster: (supercluster energy - electron cluster energy) / supercluster energy - constexpr static float kDefaultValue = -1.e30; - ClassificationVariables() : trackFbrem(kDefaultValue), superClusterFbrem(kDefaultValue) {} - }; - enum Classification { UNKNOWN = -1, GOLDEN = 0, BIGBREM = 1, BADTRACK = 2, SHOWERING = 3, GAP = 4 }; - - // accessors - float trackFbrem() const { return classVariables_.trackFbrem; } - float superClusterFbrem() const { return classVariables_.superClusterFbrem; } - const ClassificationVariables &classificationVariables() const { return classVariables_; } - Classification classification() const { return class_; } - - // utilities - int numberOfBrems() const { return basicClustersSize() - 1; } - float fbrem() const { return trackFbrem(); } - - // setters - void setTrackFbrem(float fbrem) { classVariables_.trackFbrem = fbrem; } - void setSuperClusterFbrem(float fbrem) { classVariables_.superClusterFbrem = fbrem; } - void setClassificationVariables(const ClassificationVariables &cv) { classVariables_ = cv; } - void setClassification(Classification myclass) { class_ = myclass; } - - private: - // attributes - ClassificationVariables classVariables_; - Classification class_; // fbrem and number of clusters based electron classification - - //======================================================= - // Corrections - // - // The only methods, with classification, which modify - // the electrons after they have been constructed. - // They change a given characteristic, such as the super-cluster - // energy, and propagate the change consistently - // to all the depending attributes. - // We expect the methods to be called in a given order - // and so to store specific kind of corrections - // 1) classify() - // 2) correctEcalEnergy() : depending on classification and eta - // 3) correctMomemtum() : depending on classification and ecal energy and tracker momentum errors - // - // Beware that correctEcalEnergy() is modifying few attributes which - // were potentially used for preselection, whose value used in - // preselection will not be available any more : - // hcalOverEcal, eSuperClusterOverP, - // eSeedClusterOverP, eEleClusterOverPout. - //======================================================= - - public: - enum P4Kind { P4_UNKNOWN = -1, P4_FROM_SUPER_CLUSTER = 0, P4_COMBINATION = 1, P4_PFLOW_COMBINATION = 2 }; - - struct Corrections { - bool isEcalEnergyCorrected; // true if ecal energy has been corrected - float correctedEcalEnergy; // corrected energy (if !isEcalEnergyCorrected this value is identical to the supercluster energy) - float correctedEcalEnergyError; // error on energy - //bool isMomentumCorrected ; // DEPRECATED - float trackMomentumError; // track momentum error from gsf fit + const TrackExtrapolations &trackExtrapolations() const { return trackExtrapolations_; } + + // setter (if you know what you're doing) + void setTrackExtrapolations(const TrackExtrapolations &te) { trackExtrapolations_ = te; } + + // for backward compatibility + math::XYZPointF TrackPositionAtVtx() const { return trackPositionAtVtx(); } + math::XYZPointF TrackPositionAtCalo() const { return trackPositionAtCalo(); } + + private: + // attributes + TrackExtrapolations trackExtrapolations_; + + //======================================================= + // SuperCluster direct access + //======================================================= + + public: + // direct accessors + math::XYZPoint superClusterPosition() const { return superCluster()->position(); } // the super cluster position + int basicClustersSize() const { + return superCluster()->clustersSize(); + } // number of basic clusters inside the supercluster + CaloCluster_iterator basicClustersBegin() const { return superCluster()->clustersBegin(); } + CaloCluster_iterator basicClustersEnd() const { return superCluster()->clustersEnd(); } + + // for backward compatibility + math::XYZPoint caloPosition() const { return superCluster()->position(); } + + //======================================================= + // Fiducial Flags + //======================================================= + + public: + struct FiducialFlags { + bool isEB; // true if particle is in ECAL Barrel + bool isEE; // true if particle is in ECAL Endcaps + bool isEBEEGap; // true if particle is in the crack between EB and EE + bool isEBEtaGap; // true if particle is in EB, and inside the eta gaps between modules + bool isEBPhiGap; // true if particle is in EB, and inside the phi gaps between modules + bool isEEDeeGap; // true if particle is in EE, and inside the gaps between dees + bool isEERingGap; // true if particle is in EE, and inside the gaps between rings + FiducialFlags() + : isEB(false), + isEE(false), + isEBEEGap(false), + isEBEtaGap(false), + isEBPhiGap(false), + isEEDeeGap(false), + isEERingGap(false) {} + }; + + // accessors + bool isEB() const { return fiducialFlags_.isEB; } + bool isEE() const { return fiducialFlags_.isEE; } + bool isGap() const { return ((isEBEEGap()) || (isEBGap()) || (isEEGap())); } + bool isEBEEGap() const { return fiducialFlags_.isEBEEGap; } + bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } + bool isEBEtaGap() const { return fiducialFlags_.isEBEtaGap; } + bool isEBPhiGap() const { return fiducialFlags_.isEBPhiGap; } + bool isEEGap() const { return (isEEDeeGap() || isEERingGap()); } + bool isEEDeeGap() const { return fiducialFlags_.isEEDeeGap; } + bool isEERingGap() const { return fiducialFlags_.isEERingGap; } + const FiducialFlags &fiducialFlags() const { return fiducialFlags_; } + // setters... not necessary in regular situations + // but handy for late stage modifications of electron objects + void setFFlagIsEB(const bool b) { fiducialFlags_.isEB = b; } + void setFFlagIsEE(const bool b) { fiducialFlags_.isEE = b; } + void setFFlagIsEBEEGap(const bool b) { fiducialFlags_.isEBEEGap = b; } + void setFFlagIsEBEtaGap(const bool b) { fiducialFlags_.isEBEtaGap = b; } + void setFFlagIsEBPhiGap(const bool b) { fiducialFlags_.isEBPhiGap = b; } + void setFFlagIsEEDeeGap(const bool b) { fiducialFlags_.isEEDeeGap = b; } + void setFFlagIsEERingGap(const bool b) { fiducialFlags_.isEERingGap = b; } + + private: + // attributes + FiducialFlags fiducialFlags_; + + //======================================================= + // Shower Shape Variables + //======================================================= + + public: + struct ShowerShape { + float sigmaEtaEta; // weighted cluster rms along eta and inside 5x5 (absolute eta) + float sigmaIetaIeta; // weighted cluster rms along eta and inside 5x5 (Xtal eta) + float sigmaIphiIphi; // weighted cluster rms along phi and inside 5x5 (Xtal phi) + float e1x5; // energy inside 1x5 in etaxphi around the seed Xtal + float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) + float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal + float r9; // ratio of the 3x3 energy and supercluster energy + float hcalDepth1OverEcal; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone) + float hcalDepth2OverEcal; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone) + float hcalDepth1OverEcalBc; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters) + float hcalDepth2OverEcalBc; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters) + std::array + hcalOverEcal; // run3 hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // run3 hcal over ecal seed cluster energy per depth (using rechits behind clusters) + std::vector hcalTowersBehindClusters; + bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + float sigmaIetaIphi; + float eMax; + float e2nd; + float eTop; + float eLeft; + float eRight; + float eBottom; + float e2x5Top; + float e2x5Left; + float e2x5Right; + float e2x5Bottom; + ShowerShape() + : sigmaEtaEta(std::numeric_limits::max()), + sigmaIetaIeta(std::numeric_limits::max()), + sigmaIphiIphi(std::numeric_limits::max()), + e1x5(0.f), + e2x5Max(0.f), + e5x5(0.f), + r9(-std::numeric_limits::max()), + hcalDepth1OverEcal(0.f), + hcalDepth2OverEcal(0.f), + hcalDepth1OverEcalBc(0.f), + hcalDepth2OverEcalBc(0.f), + hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + invalidHcal(false), + pre7DepthHcal(true), + sigmaIetaIphi(0.f), + eMax(0.f), + e2nd(0.f), + eTop(0.f), + eLeft(0.f), + eRight(0.f), + eBottom(0.f), + e2x5Top(0.f), + e2x5Left(0.f), + e2x5Right(0.f), + e2x5Bottom(0.f) {} + }; + + // accessors + float sigmaEtaEta() const { return showerShape_.sigmaEtaEta; } + float sigmaIetaIeta() const { return showerShape_.sigmaIetaIeta; } + float sigmaIphiIphi() const { return showerShape_.sigmaIphiIphi; } + float e1x5() const { return showerShape_.e1x5; } + float e2x5Max() const { return showerShape_.e2x5Max; } + float e5x5() const { return showerShape_.e5x5; } + float r9() const { return showerShape_.r9; } + float hcalOverEcal(const ShowerShape &ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; + else if (depth == 1) + return ss.hcalDepth1OverEcal; + else if (depth == 2) + return ss.hcalDepth2OverEcal; + + return 0.f; + } else { + const auto &hovere = ss.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } + } + float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShape_, depth); } + float hcalOverEcalBc(const ShowerShape &ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; + else if (depth == 1) + return ss.hcalDepth1OverEcalBc; + else if (depth == 2) + return ss.hcalDepth2OverEcalBc; + + return 0.f; + } else { + const auto &hovere = ss.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } + } + float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShape_, depth); } + const std::vector &hcalTowersBehindClusters() const { + return showerShape_.hcalTowersBehindClusters; + } + bool hcalOverEcalValid() const { return !showerShape_.invalidHcal; } + float eLeft() const { return showerShape_.eLeft; } + float eRight() const { return showerShape_.eRight; } + float eTop() const { return showerShape_.eTop; } + float eBottom() const { return showerShape_.eBottom; } + const ShowerShape &showerShape() const { return showerShape_; } + // non-zero-suppressed and no-fractions shower shapes + // ecal energy is always that from the full 5x5 + float full5x5_sigmaEtaEta() const { return full5x5_showerShape_.sigmaEtaEta; } + float full5x5_sigmaIetaIeta() const { return full5x5_showerShape_.sigmaIetaIeta; } + float full5x5_sigmaIphiIphi() const { return full5x5_showerShape_.sigmaIphiIphi; } + float full5x5_e1x5() const { return full5x5_showerShape_.e1x5; } + float full5x5_e2x5Max() const { return full5x5_showerShape_.e2x5Max; } + float full5x5_e5x5() const { return full5x5_showerShape_.e5x5; } + float full5x5_r9() const { return full5x5_showerShape_.r9; } + float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShape_, depth); } + float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShape_, depth); } + bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } + float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } + float full5x5_e2x5Right() const { return full5x5_showerShape_.e2x5Right; } + float full5x5_e2x5Top() const { return full5x5_showerShape_.e2x5Top; } + float full5x5_e2x5Bottom() const { return full5x5_showerShape_.e2x5Bottom; } + float full5x5_eLeft() const { return full5x5_showerShape_.eLeft; } + float full5x5_eRight() const { return full5x5_showerShape_.eRight; } + float full5x5_eTop() const { return full5x5_showerShape_.eTop; } + float full5x5_eBottom() const { return full5x5_showerShape_.eBottom; } + const ShowerShape &full5x5_showerShape() const { return full5x5_showerShape_; } + + // setters (if you know what you're doing) + void setShowerShape(const ShowerShape &s) { showerShape_ = s; } + void full5x5_setShowerShape(const ShowerShape &s) { full5x5_showerShape_ = s; } + + // for backward compatibility (this will only ever be the ZS shapes!) + float scSigmaEtaEta() const { return sigmaEtaEta(); } + float scSigmaIEtaIEta() const { return sigmaIetaIeta(); } + float scE1x5() const { return e1x5(); } + float scE2x5Max() const { return e2x5Max(); } + float scE5x5() const { return e5x5(); } + float hadronicOverEm() const { return hcalOverEcal(); } + + private: + // attributes + ShowerShape showerShape_; + ShowerShape full5x5_showerShape_; + + //======================================================= + // SaturationInfo + //======================================================= + + public: + struct SaturationInfo { + int nSaturatedXtals; + bool isSeedSaturated; + SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} + }; + + // accessors + float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } + float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } + const SaturationInfo &saturationInfo() const { return saturationInfo_; } + void setSaturationInfo(const SaturationInfo &s) { saturationInfo_ = s; } + + private: + SaturationInfo saturationInfo_; + + //======================================================= + // Isolation Variables + //======================================================= + + public: + struct IsolationVariables { + float tkSumPt; // track iso with electron footprint removed + float tkSumPtHEEP; // track iso used for the HEEP ID + float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed + float hcalDepth1TowerSumEt; // hcal depth 1 iso deposit with electron footprint removed + float hcalDepth2TowerSumEt; // hcal depth 2 iso deposit with electron footprint removed + float hcalDepth1TowerSumEtBc; // hcal depth 1 iso deposit without towers behind clusters + float hcalDepth2TowerSumEtBc; // hcal depth 2 iso deposit without towers behind clusters + std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + IsolationVariables() + : tkSumPt(0.), + tkSumPtHEEP(0.), + ecalRecHitSumEt(0.), + hcalDepth1TowerSumEt(0.f), + hcalDepth2TowerSumEt(0.f), + hcalDepth1TowerSumEtBc(0.f), + hcalDepth2TowerSumEtBc(0.f), + hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + pre7DepthHcal(true) {} + }; + + // 03 accessors + float dr03TkSumPt() const { return dr03_.tkSumPt; } + float dr03TkSumPtHEEP() const { return dr03_.tkSumPtHEEP; } + float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } + float hcalTowerSumEt(const IsolationVariables &iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalDepth1TowerSumEt + iv.hcalDepth2TowerSumEt; + else if (depth == 1) + return iv.hcalDepth1TowerSumEt; + else if (depth == 2) + return iv.hcalDepth2TowerSumEt; + + return 0.f; + } else { + const auto &hcaliso = iv.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float dr03HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr03_, depth); } + float hcalTowerSumEtBc(const IsolationVariables &iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalDepth1TowerSumEtBc + iv.hcalDepth2TowerSumEtBc; + else if (depth == 1) + return iv.hcalDepth1TowerSumEtBc; + else if (depth == 2) + return iv.hcalDepth2TowerSumEtBc; + + return 0.f; + } else { + const auto &hcaliso = iv.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float dr03HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr03_, depth); } + const IsolationVariables &dr03IsolationVariables() const { return dr03_; } + + // 04 accessors + float dr04TkSumPt() const { return dr04_.tkSumPt; } + float dr04TkSumPtHEEP() const { return dr04_.tkSumPtHEEP; } + float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } + float dr04HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr04_, depth); } + float dr04HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr04_, depth); } + const IsolationVariables &dr04IsolationVariables() const { return dr04_; } + + // setters ?!? + void setDr03Isolation(const IsolationVariables &dr03) { dr03_ = dr03; } + void setDr04Isolation(const IsolationVariables &dr04) { dr04_ = dr04; } + + // for backward compatibility + void setIsolation03(const IsolationVariables &dr03) { dr03_ = dr03; } + void setIsolation04(const IsolationVariables &dr04) { dr04_ = dr04; } + const IsolationVariables &isolationVariables03() const { return dr03_; } + const IsolationVariables &isolationVariables04() const { return dr04_; } + + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + void hcalToRun2EffDepth(); + + private: + // attributes + IsolationVariables dr03_; + IsolationVariables dr04_; + + //======================================================= + // Conversion Rejection Information + //======================================================= + + public: + struct ConversionRejection { + int flags; // -max:not-computed, other: as computed by Puneeth conversion code + TrackBaseRef partner; // conversion partner + float dist; // distance to the conversion partner + float dcot; // difference of cot(angle) with the conversion partner track + float radius; // signed conversion radius + float vtxFitProb; //fit probablity (chi2/ndof) of the matched conversion vtx + ConversionRejection() + : flags(-1), + dist(std::numeric_limits::max()), + dcot(std::numeric_limits::max()), + radius(std::numeric_limits::max()), + vtxFitProb(std::numeric_limits::max()) {} + }; + + // accessors + int convFlags() const { return conversionRejection_.flags; } + TrackBaseRef convPartner() const { return conversionRejection_.partner; } + float convDist() const { return conversionRejection_.dist; } + float convDcot() const { return conversionRejection_.dcot; } + float convRadius() const { return conversionRejection_.radius; } + float convVtxFitProb() const { return conversionRejection_.vtxFitProb; } + const ConversionRejection &conversionRejectionVariables() const { return conversionRejection_; } + void setConversionRejectionVariables(const ConversionRejection &convRej) { conversionRejection_ = convRej; } + + private: + // attributes + ConversionRejection conversionRejection_; + + //======================================================= + // Pflow Information + //======================================================= + + public: + struct PflowIsolationVariables { + //first three data members that changed names, according to DataFormats/MuonReco/interface/MuonPFIsolation.h + float sumChargedHadronPt; //!< sum-pt of charged Hadron // old float chargedHadronIso ; + float sumNeutralHadronEt; //!< sum pt of neutral hadrons // old float neutralHadronIso ; + float sumPhotonEt; //!< sum pt of PF photons // old float photonIso ; + //then four new data members, corresponding to DataFormats/MuonReco/interface/MuonPFIsolation.h + float sumChargedParticlePt; //!< sum-pt of charged Particles(inludes e/mu) + float sumNeutralHadronEtHighThreshold; //!< sum pt of neutral hadrons with a higher threshold + float sumPhotonEtHighThreshold; //!< sum pt of PF photons with a higher threshold + float sumPUPt; //!< sum pt of charged Particles not from PV (for Pu corrections) + //new pf cluster based isolation values + float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of electron + float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of electron + PflowIsolationVariables() + : sumChargedHadronPt(0), + sumNeutralHadronEt(0), + sumPhotonEt(0), + sumChargedParticlePt(0), + sumNeutralHadronEtHighThreshold(0), + sumPhotonEtHighThreshold(0), + sumPUPt(0), + sumEcalClusterEt(0), + sumHcalClusterEt(0) {} + }; + + struct MvaInput { + int earlyBrem; // Early Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) + int lateBrem; // Late Brem detected (-2=>unknown,-1=>could not be evaluated,0=>wrong,1=>true) + float sigmaEtaEta; // Sigma-eta-eta with the PF cluster + float hadEnergy; // Associated PF Had Cluster energy + float deltaEta; // PF-cluster GSF track delta-eta + int nClusterOutsideMustache; // -2 => unknown, -1 =>could not be evaluated, 0 and more => number of clusters + float etOutsideMustache; + MvaInput() + : earlyBrem(-2), + lateBrem(-2), + sigmaEtaEta(std::numeric_limits::max()), + hadEnergy(0.), + deltaEta(std::numeric_limits::max()), + nClusterOutsideMustache(-2), + etOutsideMustache(-std::numeric_limits::max()) {} + }; + + static constexpr float mvaPlaceholder = -999999999.; + + struct MvaOutput { + int status; // see PFCandidateElectronExtra::StatusFlag + float mva_Isolated; + float mva_e_pi; + float mvaByPassForIsolated; // complementary MVA used in preselection + float dnn_e_sigIsolated; + float dnn_e_sigNonIsolated; + float dnn_e_bkgNonIsolated; + float dnn_e_bkgTau; + float dnn_e_bkgPhoton; + MvaOutput() + : status(-1), + mva_Isolated(mvaPlaceholder), + mva_e_pi(mvaPlaceholder), + mvaByPassForIsolated(mvaPlaceholder), + dnn_e_sigIsolated(mvaPlaceholder), + dnn_e_sigNonIsolated(mvaPlaceholder), + dnn_e_bkgNonIsolated(mvaPlaceholder), + dnn_e_bkgTau(mvaPlaceholder), + dnn_e_bkgPhoton(mvaPlaceholder) {} + }; + + // accessors + const PflowIsolationVariables &pfIsolationVariables() const { return pfIso_; } + //backwards compat functions for pat::Electron + float ecalPFClusterIso() const { return pfIso_.sumEcalClusterEt; }; + float hcalPFClusterIso() const { return pfIso_.sumHcalClusterEt; }; + + const MvaInput &mvaInput() const { return mvaInput_; } + const MvaOutput &mvaOutput() const { return mvaOutput_; } + + // setters + void setPfIsolationVariables(const PflowIsolationVariables &iso) { pfIso_ = iso; } + void setMvaInput(const MvaInput &mi) { mvaInput_ = mi; } + void setMvaOutput(const MvaOutput &mo) { mvaOutput_ = mo; } + + // for backward compatibility + float mva_Isolated() const { return mvaOutput_.mva_Isolated; } + float mva_e_pi() const { return mvaOutput_.mva_e_pi; } + float dnn_signal_Isolated() const { return mvaOutput_.dnn_e_sigIsolated; } + float dnn_signal_nonIsolated() const { return mvaOutput_.dnn_e_sigNonIsolated; } + float dnn_bkg_nonIsolated() const { return mvaOutput_.dnn_e_bkgNonIsolated; } + float dnn_bkg_Tau() const { return mvaOutput_.dnn_e_bkgTau; } + float dnn_bkg_Photon() const { return mvaOutput_.dnn_e_bkgPhoton; } + + private: + PflowIsolationVariables pfIso_; + MvaInput mvaInput_; + MvaOutput mvaOutput_; + + //======================================================= + // Preselection and Ambiguity + //======================================================= + + public: + // accessors + bool ecalDriven() const; // return true if ecalDrivenSeed() and passingCutBasedPreselection() + bool passingCutBasedPreselection() const { return passCutBasedPreselection_; } + bool passingPflowPreselection() const { return passPflowPreselection_; } + bool ambiguous() const { return ambiguous_; } + GsfTrackRefVector::size_type ambiguousGsfTracksSize() const { return ambiguousGsfTracks_.size(); } + auto const &ambiguousGsfTracks() const { return ambiguousGsfTracks_; } + + // setters + void setPassCutBasedPreselection(bool flag) { passCutBasedPreselection_ = flag; } + void setPassPflowPreselection(bool flag) { passPflowPreselection_ = flag; } + void setAmbiguous(bool flag) { ambiguous_ = flag; } + void clearAmbiguousGsfTracks() { ambiguousGsfTracks_.clear(); } + void addAmbiguousGsfTrack(const reco::GsfTrackRef &t) { ambiguousGsfTracks_.push_back(t); } + + // backward compatibility + void setPassMvaPreselection(bool flag) { passMvaPreslection_ = flag; } + bool passingMvaPreselection() const { return passMvaPreslection_; } + + private: + // attributes + bool passCutBasedPreselection_; + bool passPflowPreselection_; + bool passMvaPreslection_; // to be removed : passPflowPreslection_ + bool ambiguous_; + GsfTrackRefVector ambiguousGsfTracks_; // ambiguous gsf tracks + + //======================================================= + // Brem Fractions and Classification + //======================================================= + + public: + struct ClassificationVariables { + float trackFbrem; // the brem fraction from gsf fit: (track momentum in - track momentum out) / track momentum in + float superClusterFbrem; // the brem fraction from supercluster: (supercluster energy - electron cluster energy) / supercluster energy + constexpr static float kDefaultValue = -1.e30; + ClassificationVariables() : trackFbrem(kDefaultValue), superClusterFbrem(kDefaultValue) {} + }; + enum Classification { UNKNOWN = -1, GOLDEN = 0, BIGBREM = 1, BADTRACK = 2, SHOWERING = 3, GAP = 4 }; + + // accessors + float trackFbrem() const { return classVariables_.trackFbrem; } + float superClusterFbrem() const { return classVariables_.superClusterFbrem; } + const ClassificationVariables &classificationVariables() const { return classVariables_; } + Classification classification() const { return class_; } + + // utilities + int numberOfBrems() const { return basicClustersSize() - 1; } + float fbrem() const { return trackFbrem(); } + + // setters + void setTrackFbrem(float fbrem) { classVariables_.trackFbrem = fbrem; } + void setSuperClusterFbrem(float fbrem) { classVariables_.superClusterFbrem = fbrem; } + void setClassificationVariables(const ClassificationVariables &cv) { classVariables_ = cv; } + void setClassification(Classification myclass) { class_ = myclass; } + + private: + // attributes + ClassificationVariables classVariables_; + Classification class_; // fbrem and number of clusters based electron classification + + //======================================================= + // Corrections // - LorentzVector fromSuperClusterP4; // for P4_FROM_SUPER_CLUSTER - float fromSuperClusterP4Error; // for P4_FROM_SUPER_CLUSTER - LorentzVector combinedP4; // for P4_COMBINATION - float combinedP4Error; // for P4_COMBINATION - LorentzVector pflowP4; // for P4_PFLOW_COMBINATION - float pflowP4Error; // for P4_PFLOW_COMBINATION - P4Kind candidateP4Kind; // say which momentum has been stored in reco::Candidate + // The only methods, with classification, which modify + // the electrons after they have been constructed. + // They change a given characteristic, such as the super-cluster + // energy, and propagate the change consistently + // to all the depending attributes. + // We expect the methods to be called in a given order + // and so to store specific kind of corrections + // 1) classify() + // 2) correctEcalEnergy() : depending on classification and eta + // 3) correctMomemtum() : depending on classification and ecal energy and tracker momentum errors // - Corrections() - : isEcalEnergyCorrected(false), - correctedEcalEnergy(0.), - correctedEcalEnergyError(999.), - /*isMomentumCorrected(false),*/ trackMomentumError(999.), - fromSuperClusterP4Error(999.), - combinedP4Error(999.), - pflowP4Error(999.), - candidateP4Kind(P4_UNKNOWN) {} - }; + // Beware that correctEcalEnergy() is modifying few attributes which + // were potentially used for preselection, whose value used in + // preselection will not be available any more : + // hcalOverEcal, eSuperClusterOverP, + // eSeedClusterOverP, eEleClusterOverPout. + //======================================================= + + public: + enum P4Kind { P4_UNKNOWN = -1, P4_FROM_SUPER_CLUSTER = 0, P4_COMBINATION = 1, P4_PFLOW_COMBINATION = 2 }; + + struct Corrections { + bool isEcalEnergyCorrected; // true if ecal energy has been corrected + float correctedEcalEnergy; // corrected energy (if !isEcalEnergyCorrected this value is identical to the supercluster energy) + float correctedEcalEnergyError; // error on energy + //bool isMomentumCorrected ; // DEPRECATED + float trackMomentumError; // track momentum error from gsf fit + // + LorentzVector fromSuperClusterP4; // for P4_FROM_SUPER_CLUSTER + float fromSuperClusterP4Error; // for P4_FROM_SUPER_CLUSTER + LorentzVector combinedP4; // for P4_COMBINATION + float combinedP4Error; // for P4_COMBINATION + LorentzVector pflowP4; // for P4_PFLOW_COMBINATION + float pflowP4Error; // for P4_PFLOW_COMBINATION + P4Kind candidateP4Kind; // say which momentum has been stored in reco::Candidate + // + Corrections() + : isEcalEnergyCorrected(false), + correctedEcalEnergy(0.), + correctedEcalEnergyError(999.), + /*isMomentumCorrected(false),*/ trackMomentumError(999.), + fromSuperClusterP4Error(999.), + combinedP4Error(999.), + pflowP4Error(999.), + candidateP4Kind(P4_UNKNOWN) {} + }; + + // setters + void setCorrectedEcalEnergyError(float newEnergyError); + void setCorrectedEcalEnergy(float newEnergy); + void setCorrectedEcalEnergy(float newEnergy, bool rescaleDependentValues); + void setTrackMomentumError(float trackMomentumError); + void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate); + using RecoCandidate::setP4; + + // accessors + bool isEcalEnergyCorrected() const { return corrections_.isEcalEnergyCorrected; } + float correctedEcalEnergy() const { return corrections_.correctedEcalEnergy; } + float correctedEcalEnergyError() const { return corrections_.correctedEcalEnergyError; } + float trackMomentumError() const { return corrections_.trackMomentumError; } + const LorentzVector &p4(P4Kind kind) const; + using RecoCandidate::p4; + float p4Error(P4Kind kind) const; + P4Kind candidateP4Kind() const { return corrections_.candidateP4Kind; } + const Corrections &corrections() const { return corrections_; } + + // bare setter (if you know what you're doing) + void setCorrections(const Corrections &c) { corrections_ = c; } + + // for backward compatibility + void setEcalEnergyError(float energyError) { setCorrectedEcalEnergyError(energyError); } + float ecalEnergy() const { return correctedEcalEnergy(); } + float ecalEnergyError() const { return correctedEcalEnergyError(); } + //bool isMomentumCorrected() const { return corrections_.isMomentumCorrected ; } + float caloEnergy() const { return correctedEcalEnergy(); } + bool isEnergyScaleCorrected() const { return isEcalEnergyCorrected(); } + void correctEcalEnergy(float newEnergy, float newEnergyError, bool corrEovP = true) { + setCorrectedEcalEnergy(newEnergy, corrEovP); + setEcalEnergyError(newEnergyError); + } + void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error) { + setTrackMomentumError(trackMomentumError); + setP4(P4_COMBINATION, p4, p4Error, true); + } - // setters - void setCorrectedEcalEnergyError(float newEnergyError); - void setCorrectedEcalEnergy(float newEnergy); - void setCorrectedEcalEnergy(float newEnergy, bool rescaleDependentValues); - void setTrackMomentumError(float trackMomentumError); - void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate); - using RecoCandidate::setP4; - - // accessors - bool isEcalEnergyCorrected() const { return corrections_.isEcalEnergyCorrected; } - float correctedEcalEnergy() const { return corrections_.correctedEcalEnergy; } - float correctedEcalEnergyError() const { return corrections_.correctedEcalEnergyError; } - float trackMomentumError() const { return corrections_.trackMomentumError; } - const LorentzVector &p4(P4Kind kind) const; - using RecoCandidate::p4; - float p4Error(P4Kind kind) const; - P4Kind candidateP4Kind() const { return corrections_.candidateP4Kind; } - const Corrections &corrections() const { return corrections_; } - - // bare setter (if you know what you're doing) - void setCorrections(const Corrections &c) { corrections_ = c; } - - // for backward compatibility - void setEcalEnergyError(float energyError) { setCorrectedEcalEnergyError(energyError); } - float ecalEnergy() const { return correctedEcalEnergy(); } - float ecalEnergyError() const { return correctedEcalEnergyError(); } - //bool isMomentumCorrected() const { return corrections_.isMomentumCorrected ; } - float caloEnergy() const { return correctedEcalEnergy(); } - bool isEnergyScaleCorrected() const { return isEcalEnergyCorrected(); } - void correctEcalEnergy(float newEnergy, float newEnergyError, bool corrEovP = true) { - setCorrectedEcalEnergy(newEnergy, corrEovP); - setEcalEnergyError(newEnergyError); - } - void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error) { - setTrackMomentumError(trackMomentumError); - setP4(P4_COMBINATION, p4, p4Error, true); - } - - private: - // attributes - Corrections corrections_; - - public: - struct PixelMatchVariables { - //! Pixel match variable: deltaPhi for innermost hit - float dPhi1; - //! Pixel match variable: deltaPhi for second hit - float dPhi2; - //! Pixel match variable: deltaRz for innermost hit - float dRz1; - //! Pixel match variable: deltaRz for second hit - float dRz2; - //! Subdetectors for first and second pixel hit - unsigned char subdetectors; - PixelMatchVariables() : dPhi1(-999), dPhi2(-999), dRz1(-999), dRz2(-999), subdetectors(0) {} - ~PixelMatchVariables() {} + private: + // attributes + Corrections corrections_; + + public: + struct PixelMatchVariables { + //! Pixel match variable: deltaPhi for innermost hit + float dPhi1; + //! Pixel match variable: deltaPhi for second hit + float dPhi2; + //! Pixel match variable: deltaRz for innermost hit + float dRz1; + //! Pixel match variable: deltaRz for second hit + float dRz2; + //! Subdetectors for first and second pixel hit + unsigned char subdetectors; + PixelMatchVariables() : dPhi1(-999), dPhi2(-999), dRz1(-999), dRz2(-999), subdetectors(0) {} + ~PixelMatchVariables() {} + }; + void setPixelMatchSubdetectors(int sd1, int sd2) { pixelMatchVariables_.subdetectors = 10 * sd1 + sd2; } + void setPixelMatchDPhi1(float dPhi1) { pixelMatchVariables_.dPhi1 = dPhi1; } + void setPixelMatchDPhi2(float dPhi2) { pixelMatchVariables_.dPhi2 = dPhi2; } + void setPixelMatchDRz1(float dRz1) { pixelMatchVariables_.dRz1 = dRz1; } + void setPixelMatchDRz2(float dRz2) { pixelMatchVariables_.dRz2 = dRz2; } + + int pixelMatchSubdetector1() const { return pixelMatchVariables_.subdetectors / 10; } + int pixelMatchSubdetector2() const { return pixelMatchVariables_.subdetectors % 10; } + float pixelMatchDPhi1() const { return pixelMatchVariables_.dPhi1; } + float pixelMatchDPhi2() const { return pixelMatchVariables_.dPhi2; } + float pixelMatchDRz1() const { return pixelMatchVariables_.dRz1; } + float pixelMatchDRz2() const { return pixelMatchVariables_.dRz2; } + + private: + PixelMatchVariables pixelMatchVariables_; }; - void setPixelMatchSubdetectors(int sd1, int sd2) { pixelMatchVariables_.subdetectors = 10 * sd1 + sd2; } - void setPixelMatchDPhi1(float dPhi1) { pixelMatchVariables_.dPhi1 = dPhi1; } - void setPixelMatchDPhi2(float dPhi2) { pixelMatchVariables_.dPhi2 = dPhi2; } - void setPixelMatchDRz1(float dRz1) { pixelMatchVariables_.dRz1 = dRz1; } - void setPixelMatchDRz2(float dRz2) { pixelMatchVariables_.dRz2 = dRz2; } - - int pixelMatchSubdetector1() const { return pixelMatchVariables_.subdetectors / 10; } - int pixelMatchSubdetector2() const { return pixelMatchVariables_.subdetectors % 10; } - float pixelMatchDPhi1() const { return pixelMatchVariables_.dPhi1; } - float pixelMatchDPhi2() const { return pixelMatchVariables_.dPhi2; } - float pixelMatchDRz1() const { return pixelMatchVariables_.dRz1; } - float pixelMatchDRz2() const { return pixelMatchVariables_.dRz2; } - - private: - PixelMatchVariables pixelMatchVariables_; - }; + + } // namespace io_v1 + using GsfElectron = io_v1::GsfElectron; } // namespace reco diff --git a/DataFormats/EgammaCandidates/interface/GsfElectronCore.h b/DataFormats/EgammaCandidates/interface/GsfElectronCore.h index 7589efd89f537..8e2af1fe1dabb 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectronCore.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectronCore.h @@ -21,65 +21,68 @@ ****************************************************************************/ namespace reco { + namespace io_v1 { - class GsfElectronCore { - public: - // construction - GsfElectronCore(); - GsfElectronCore(const GsfTrackRef&); - GsfElectronCore* clone() const; - ~GsfElectronCore() {} + class GsfElectronCore { + public: + // construction + GsfElectronCore(); + GsfElectronCore(const GsfTrackRef&); + GsfElectronCore* clone() const; + ~GsfElectronCore() {} - // accessors - const GsfTrackRef& gsfTrack() const { return gsfTrack_; } - const SuperClusterRef& superCluster() const { - return (superCluster_.isNull() ? parentSuperCluster_ : superCluster_); - } - TrackRef ctfTrack() const { - return closestCtfTrack_; - } // get the CTF track best matching the GTF associated to this electron - float ctfGsfOverlap() const { - return ctfGsfOverlap_; - } // measure the fraction of common hits between the GSF and CTF tracks - bool ecalDrivenSeed() const { return isEcalDrivenSeed_; } - bool trackerDrivenSeed() const { return isTrackerDrivenSeed_; } + // accessors + const GsfTrackRef& gsfTrack() const { return gsfTrack_; } + const SuperClusterRef& superCluster() const { + return (superCluster_.isNull() ? parentSuperCluster_ : superCluster_); + } + TrackRef ctfTrack() const { + return closestCtfTrack_; + } // get the CTF track best matching the GTF associated to this electron + float ctfGsfOverlap() const { + return ctfGsfOverlap_; + } // measure the fraction of common hits between the GSF and CTF tracks + bool ecalDrivenSeed() const { return isEcalDrivenSeed_; } + bool trackerDrivenSeed() const { return isTrackerDrivenSeed_; } - /// get vector of references to Conversion's - reco::ConversionRefVector conversions() const { return conversions_; } - /// get vector of references to one leg Conversion's - reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } + /// get vector of references to Conversion's + reco::ConversionRefVector conversions() const { return conversions_; } + /// get vector of references to one leg Conversion's + reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } - // setters - void setGsfTrack(const GsfTrackRef& gsfTrack) { gsfTrack_ = gsfTrack; } - void setSuperCluster(const SuperClusterRef& scl) { superCluster_ = scl; } - void setCtfTrack(const TrackRef& closestCtfTrack, float ctfGsfOverlap) { - closestCtfTrack_ = closestCtfTrack; - ctfGsfOverlap_ = ctfGsfOverlap; - } + // setters + void setGsfTrack(const GsfTrackRef& gsfTrack) { gsfTrack_ = gsfTrack; } + void setSuperCluster(const SuperClusterRef& scl) { superCluster_ = scl; } + void setCtfTrack(const TrackRef& closestCtfTrack, float ctfGsfOverlap) { + closestCtfTrack_ = closestCtfTrack; + ctfGsfOverlap_ = ctfGsfOverlap; + } - /// add single ConversionRef to the vector of Refs - void addConversion(const reco::ConversionRef& r) { conversions_.push_back(r); } - /// add single ConversionRef to the vector of Refs - void addOneLegConversion(const reco::ConversionRef& r) { conversionsOneLeg_.push_back(r); } + /// add single ConversionRef to the vector of Refs + void addConversion(const reco::ConversionRef& r) { conversions_.push_back(r); } + /// add single ConversionRef to the vector of Refs + void addOneLegConversion(const reco::ConversionRef& r) { conversionsOneLeg_.push_back(r); } - // pflow eventual additionnal info - const SuperClusterRef& parentSuperCluster() const { return parentSuperCluster_; } - void setParentSuperCluster(const SuperClusterRef& scl) { parentSuperCluster_ = scl; } + // pflow eventual additionnal info + const SuperClusterRef& parentSuperCluster() const { return parentSuperCluster_; } + void setParentSuperCluster(const SuperClusterRef& scl) { parentSuperCluster_ = scl; } - private: - GsfTrackRef gsfTrack_; - SuperClusterRef superCluster_; - SuperClusterRef parentSuperCluster_; - TrackRef closestCtfTrack_; // best matching ctf track - // vector of references to Conversions - reco::ConversionRefVector conversions_; - //vector of references for 1-leg - reco::ConversionRefVector conversionsOneLeg_; - float ctfGsfOverlap_; // fraction of common hits between the ctf and gsf tracks - bool isEcalDrivenSeed_; - bool isTrackerDrivenSeed_; - }; + private: + GsfTrackRef gsfTrack_; + SuperClusterRef superCluster_; + SuperClusterRef parentSuperCluster_; + TrackRef closestCtfTrack_; // best matching ctf track + // vector of references to Conversions + reco::ConversionRefVector conversions_; + //vector of references for 1-leg + reco::ConversionRefVector conversionsOneLeg_; + float ctfGsfOverlap_; // fraction of common hits between the ctf and gsf tracks + bool isEcalDrivenSeed_; + bool isTrackerDrivenSeed_; + }; + } // namespace io_v1 + using GsfElectronCore = io_v1::GsfElectronCore; } // namespace reco //***************************************************************************** diff --git a/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h b/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h index 5ceaaf1d0ed98..5591209471c46 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectronCoreFwd.h @@ -9,7 +9,10 @@ namespace reco { - class GsfElectronCore; + namespace io_v1 { + class GsfElectronCore; + } + using GsfElectronCore = io_v1::GsfElectronCore; typedef std::vector GsfElectronCoreCollection; typedef edm::Ref GsfElectronCoreRef; typedef edm::RefProd GsfElectronCoreRefProd; diff --git a/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h b/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h index 18d72eac4a2e5..65df24902bde4 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectronFwd.h @@ -10,9 +10,10 @@ #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" namespace reco { - - class GsfElectron; - + namespace io_v1 { + class GsfElectron; + } + using GsfElectron = io_v1::GsfElectron; /// collection of GsfElectron objects typedef std::vector GsfElectronCollection; //typedef GsfElectronCollection PixelMatchGsfElectronCollection ; diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 7cddf80e5b98d..c1d18100036c9 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -18,602 +18,611 @@ #include namespace reco { + namespace io_v1 { + + class Photon : public RecoCandidate { + public: + /// Forward declaration of data structures included in the object + struct FiducialFlags; + struct IsolationVariables; + struct ShowerShape; + struct MIPVariables; + struct SaturationInfo; + + /// default constructor + Photon() : RecoCandidate() { + pixelSeed_ = false; + haloTaggerMVAVal_ = 99; + } - class Photon : public RecoCandidate { - public: - /// Forward declaration of data structures included in the object - struct FiducialFlags; - struct IsolationVariables; - struct ShowerShape; - struct MIPVariables; - struct SaturationInfo; - - /// default constructor - Photon() : RecoCandidate() { - pixelSeed_ = false; - haloTaggerMVAVal_ = 99; - } - - /// copy constructor - Photon(const Photon&); - - /// constructor from values - Photon(const LorentzVector& p4, const Point& caloPos, const PhotonCoreRef& core, const Point& vtx = Point(0, 0, 0)); - - /// assignment operator - Photon& operator=(const Photon&) = default; - - /// destructor - ~Photon() override; - - /// returns a clone of the candidate - Photon* clone() const override; - - /// returns a reference to the core photon object - reco::PhotonCoreRef photonCore() const { return photonCore_; } - void setPhotonCore(const reco::PhotonCoreRef& photonCore) { photonCore_ = photonCore; } - - // - /// Retrieve photonCore attributes - // - // retrieve provenance - bool isPFlowPhoton() const { return this->photonCore()->isPFlowPhoton(); } - bool isStandardPhoton() const { return this->photonCore()->isStandardPhoton(); } - /// Ref to SuperCluster - reco::SuperClusterRef superCluster() const override; - /// Ref to PFlow SuperCluster - reco::SuperClusterRef parentSuperCluster() const { return this->photonCore()->parentSuperCluster(); } - /// vector of references to Conversion's - reco::ConversionRefVector conversions() const { return this->photonCore()->conversions(); } - enum ConversionProvenance { egamma = 0, pflow = 1, both = 2 }; - - /// vector of references to one leg Conversion's - reco::ConversionRefVector conversionsOneLeg() const { return this->photonCore()->conversionsOneLeg(); } - /// Bool flagging photons with a vector of refereces to conversions with size >0 - bool hasConversionTracks() const { - if (!this->photonCore()->conversions().empty() || !this->photonCore()->conversionsOneLeg().empty()) - return true; - else - return false; - } - /// reference to electron Pixel seed - reco::ElectronSeedRefVector electronPixelSeeds() const { return this->photonCore()->electronPixelSeeds(); } - /// Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds - bool hasPixelSeed() const { - if (!(this->photonCore()->electronPixelSeeds()).empty()) - return true; - else - return false; - } - int conversionTrackProvenance(const edm::RefToBase& convTrack) const; - - /// position in ECAL: this is th SC position if r9<0.93. If r8>0.93 is position of seed BasicCluster taking shower depth for unconverted photon - math::XYZPointF caloPosition() const { return caloPosition_; } - /// set primary event vertex used to define photon direction - void setVertex(const Point& vertex) override; - /// Implement Candidate method for particle species - bool isPhoton() const override { return true; } - - //======================================================= - // Fiducial Flags - //======================================================= - struct FiducialFlags { - //Fiducial flags - bool isEB; //Photon is in EB - bool isEE; //Photon is in EE - bool isEBEtaGap; //Photon is in supermodule/supercrystal eta gap in EB - bool isEBPhiGap; //Photon is in supermodule/supercrystal phi gap in EB - bool isEERingGap; //Photon is in crystal ring gap in EE - bool isEEDeeGap; //Photon is in crystal dee gap in EE - bool isEBEEGap; //Photon is in border between EB and EE. - - FiducialFlags() - : isEB(false), - isEE(false), - isEBEtaGap(false), - isEBPhiGap(false), - isEERingGap(false), - isEEDeeGap(false), - isEBEEGap(false) - - {} - }; - - /// set flags for photons in the ECAL fiducial volume - void setFiducialVolumeFlags(const FiducialFlags& a) { fiducialFlagBlock_ = a; } - /// Ritrievs fiducial flags - /// true if photon is in ECAL barrel - bool isEB() const { return fiducialFlagBlock_.isEB; } - // true if photon is in ECAL endcap - bool isEE() const { return fiducialFlagBlock_.isEE; } - /// true if photon is in EB, and inside the boundaries in super crystals/modules - bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } - bool isEBEtaGap() const { return fiducialFlagBlock_.isEBEtaGap; } - bool isEBPhiGap() const { return fiducialFlagBlock_.isEBPhiGap; } - /// true if photon is in EE, and inside the boundaries in supercrystal/D - bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); } - bool isEERingGap() const { return fiducialFlagBlock_.isEERingGap; } - bool isEEDeeGap() const { return fiducialFlagBlock_.isEEDeeGap; } - /// true if photon is in boundary between EB and EE - bool isEBEEGap() const { return fiducialFlagBlock_.isEBEEGap; } - - //======================================================= - // Shower Shape Variables - //======================================================= - - struct ShowerShape { - float sigmaEtaEta; - float sigmaIetaIeta; - float e1x5; - float e2x5; - float e3x3; - float e5x5; - float maxEnergyXtal; - float hcalDepth1OverEcal; // hcal over ecal energy using first hcal depth - float hcalDepth2OverEcal; // hcal over ecal energy using 2nd hcal depth - float hcalDepth1OverEcalBc; - float hcalDepth2OverEcalBc; - std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) - std::array - hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) - std::vector hcalTowersBehindClusters; - bool invalidHcal; - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - float effSigmaRR; - float sigmaIetaIphi; - float sigmaIphiIphi; - float e2nd; - float eTop; - float eLeft; - float eRight; - float eBottom; - float e1x3; - float e2x2; - float e2x5Max; - float e2x5Left; - float e2x5Right; - float e2x5Top; - float e2x5Bottom; - float smMajor; - float smMinor; - float smAlpha; - ShowerShape() - : sigmaEtaEta(std::numeric_limits::max()), - sigmaIetaIeta(std::numeric_limits::max()), - e1x5(0.f), - e2x5(0.f), - e3x3(0.f), - e5x5(0.f), - maxEnergyXtal(0.f), - hcalDepth1OverEcal(0.f), - hcalDepth2OverEcal(0.f), - hcalDepth1OverEcalBc(0.f), - hcalDepth2OverEcalBc(0.f), - hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - invalidHcal(false), - pre7DepthHcal(true), - effSigmaRR(std::numeric_limits::max()), - sigmaIetaIphi(std::numeric_limits::max()), - sigmaIphiIphi(std::numeric_limits::max()), - e2nd(0.f), - eTop(0.f), - eLeft(0.f), - eRight(0.f), - eBottom(0.f), - e1x3(0.f), - e2x2(0.f), - e2x5Max(0.f), - e2x5Left(0.f), - e2x5Right(0.f), - e2x5Top(0.f), - e2x5Bottom(0.f), - smMajor(0.f), - smMinor(0.f), - smAlpha(0.f) {} - }; - const ShowerShape& showerShapeVariables() const { return showerShapeBlock_; } - const ShowerShape& full5x5_showerShapeVariables() const { return full5x5_showerShapeBlock_; } - - void setShowerShapeVariables(const ShowerShape& a) { showerShapeBlock_ = a; } - void full5x5_setShowerShapeVariables(const ShowerShape& a) { full5x5_showerShapeBlock_ = a; } - - /// the total hadronic over electromagnetic fraction - float hcalOverEcal(const ShowerShape& ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; - else if (depth == 1) - return ss.hcalDepth1OverEcal; - else if (depth == 2) - return ss.hcalDepth2OverEcal; - - return 0.f; - } else { - const auto& hovere = ss.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + /// copy constructor + Photon(const Photon&); + + /// constructor from values + Photon(const LorentzVector& p4, + const Point& caloPos, + const PhotonCoreRef& core, + const Point& vtx = Point(0, 0, 0)); + + /// assignment operator + Photon& operator=(const Photon&) = default; + + /// destructor + ~Photon() override; + + /// returns a clone of the candidate + Photon* clone() const override; + + /// returns a reference to the core photon object + reco::PhotonCoreRef photonCore() const { return photonCore_; } + void setPhotonCore(const reco::PhotonCoreRef& photonCore) { photonCore_ = photonCore; } + + // + /// Retrieve photonCore attributes + // + // retrieve provenance + bool isPFlowPhoton() const { return this->photonCore()->isPFlowPhoton(); } + bool isStandardPhoton() const { return this->photonCore()->isStandardPhoton(); } + /// Ref to SuperCluster + reco::SuperClusterRef superCluster() const override; + /// Ref to PFlow SuperCluster + reco::SuperClusterRef parentSuperCluster() const { return this->photonCore()->parentSuperCluster(); } + /// vector of references to Conversion's + reco::ConversionRefVector conversions() const { return this->photonCore()->conversions(); } + enum ConversionProvenance { egamma = 0, pflow = 1, both = 2 }; + + /// vector of references to one leg Conversion's + reco::ConversionRefVector conversionsOneLeg() const { return this->photonCore()->conversionsOneLeg(); } + /// Bool flagging photons with a vector of refereces to conversions with size >0 + bool hasConversionTracks() const { + if (!this->photonCore()->conversions().empty() || !this->photonCore()->conversionsOneLeg().empty()) + return true; + else + return false; } - } - float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShapeBlock_, depth); } - float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } - - /// the ratio of total energy of hcal rechits behind the SC and the SC energy - float hcalOverEcalBc(const ShowerShape& ss, int depth) const { - if (ss.pre7DepthHcal) { - if (depth == 0) - return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; - else if (depth == 1) - return ss.hcalDepth1OverEcalBc; - else if (depth == 2) - return ss.hcalDepth2OverEcalBc; - - return 0.f; - } else { - const auto& hovere = ss.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + /// reference to electron Pixel seed + reco::ElectronSeedRefVector electronPixelSeeds() const { return this->photonCore()->electronPixelSeeds(); } + /// Bool flagging photons having a non-zero size vector of Ref to electornPixel seeds + bool hasPixelSeed() const { + if (!(this->photonCore()->electronPixelSeeds()).empty()) + return true; + else + return false; } - } - float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShapeBlock_, depth); } - float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } - - const std::vector& hcalTowersBehindClusters() const { - return showerShapeBlock_.hcalTowersBehindClusters; - } - - /// returns false if H/E is not reliably estimated (e.g. because hcal was off or masked) - bool hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } - bool hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } - - /// Shower shape variables - float e1x5() const { return showerShapeBlock_.e1x5; } - float e2x5() const { return showerShapeBlock_.e2x5; } - float e3x3() const { return showerShapeBlock_.e3x3; } - float e5x5() const { return showerShapeBlock_.e5x5; } - float maxEnergyXtal() const { return showerShapeBlock_.maxEnergyXtal; } - float sigmaEtaEta() const { return showerShapeBlock_.sigmaEtaEta; } - float sigmaIetaIeta() const { return showerShapeBlock_.sigmaIetaIeta; } - float r1x5() const { return showerShapeBlock_.e1x5 / showerShapeBlock_.e5x5; } - float r2x5() const { return showerShapeBlock_.e2x5 / showerShapeBlock_.e5x5; } - float r9() const { return showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } - - ///full5x5 Shower shape variables - float full5x5_e1x5() const { return full5x5_showerShapeBlock_.e1x5; } - float full5x5_e2x5() const { return full5x5_showerShapeBlock_.e2x5; } - float full5x5_e3x3() const { return full5x5_showerShapeBlock_.e3x3; } - float full5x5_e5x5() const { return full5x5_showerShapeBlock_.e5x5; } - float full5x5_maxEnergyXtal() const { return full5x5_showerShapeBlock_.maxEnergyXtal; } - float full5x5_sigmaEtaEta() const { return full5x5_showerShapeBlock_.sigmaEtaEta; } - float full5x5_sigmaIetaIeta() const { return full5x5_showerShapeBlock_.sigmaIetaIeta; } - float full5x5_r1x5() const { return full5x5_showerShapeBlock_.e1x5 / full5x5_showerShapeBlock_.e5x5; } - float full5x5_r2x5() const { return full5x5_showerShapeBlock_.e2x5 / full5x5_showerShapeBlock_.e5x5; } - float full5x5_r9() const { return full5x5_showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } - - /// the total hadronic over electromagnetic fraction - float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShapeBlock_, depth); } - float full5x5_hadronicOverEm(int depth = 0) const { return full5x5_hcalOverEcal(depth); } - - /// the ratio of total energy of hcal rechits behind the SC and the SC energy - float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShapeBlock_, depth); } - float full5x5_hadTowOverEm(int depth = 0) const { return full5x5_hcalOverEcalBc(depth); } - - //======================================================= - // SaturationInfo - //======================================================= - - struct SaturationInfo { - int nSaturatedXtals; - bool isSeedSaturated; - SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} - }; - - // accessors - float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } - float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } - const SaturationInfo& saturationInfo() const { return saturationInfo_; } - void setSaturationInfo(const SaturationInfo& s) { saturationInfo_ = s; } - - //======================================================= - // Energy Determinations - //======================================================= - enum P4type { undefined = -1, ecal_standard = 0, ecal_photons = 1, regression1 = 2, regression2 = 3 }; - - struct EnergyCorrections { - float scEcalEnergy; - float scEcalEnergyError; - LorentzVector scEcalP4; - float phoEcalEnergy; - float phoEcalEnergyError; - LorentzVector phoEcalP4; - float regression1Energy; - float regression1EnergyError; - LorentzVector regression1P4; - float regression2Energy; - float regression2EnergyError; - LorentzVector regression2P4; - P4type candidateP4type; - EnergyCorrections() - : scEcalEnergy(0.), - scEcalEnergyError(999.), - scEcalP4(0., 0., 0., 0.), - phoEcalEnergy(0.), - phoEcalEnergyError(999.), - phoEcalP4(0., 0., 0., 0.), - regression1Energy(0.), - regression1EnergyError(999.), - regression1P4(0., 0., 0., 0.), - regression2Energy(0.), - regression2EnergyError(999.), - regression2P4(0., 0., 0., 0.), - candidateP4type(undefined) {} - }; - - using RecoCandidate::p4; - using RecoCandidate::setP4; - - //sets both energy and its uncertainty - void setCorrectedEnergy(P4type type, float E, float dE, bool toCand = true); - void setP4(P4type type, const LorentzVector& p4, float p4Error, bool setToRecoCandidate); - void setEnergyCorrections(const EnergyCorrections& e) { eCorrections_ = e; } - void setCandidateP4type(const P4type type) { eCorrections_.candidateP4type = type; } - - float getCorrectedEnergy(P4type type) const; - float getCorrectedEnergyError(P4type type) const; - P4type getCandidateP4type() const { return eCorrections_.candidateP4type; } - const LorentzVector& p4(P4type type) const; - const EnergyCorrections& energyCorrections() const { return eCorrections_; } - - //======================================================= - // MIP Variables - //======================================================= - - struct MIPVariables { - float mipChi2; - float mipTotEnergy; - float mipSlope; - float mipIntercept; - int mipNhitCone; - bool mipIsHalo; - - MIPVariables() - : - - mipChi2(0), - mipTotEnergy(0), - mipSlope(0), - mipIntercept(0), - mipNhitCone(0), - mipIsHalo(false) {} - }; - - /// MIP variables - float mipChi2() const { return mipVariableBlock_.mipChi2; } - float mipTotEnergy() const { return mipVariableBlock_.mipTotEnergy; } - float mipSlope() const { return mipVariableBlock_.mipSlope; } - float mipIntercept() const { return mipVariableBlock_.mipIntercept; } - int mipNhitCone() const { return mipVariableBlock_.mipNhitCone; } - bool mipIsHalo() const { return mipVariableBlock_.mipIsHalo; } - - ///set mip Variables - void setMIPVariables(const MIPVariables& mipVar) { mipVariableBlock_ = mipVar; } - - //======================================================= - // Isolation Variables - //======================================================= - - struct IsolationVariables { - //These are analysis quantities calculated in the PhotonIDAlgo class - - //EcalRecHit isolation - float ecalRecHitSumEt; - //HcalTower isolation - float hcalTowerSumEt; - //HcalDepth1Tower isolation - float hcalDepth1TowerSumEt; - //HcalDepth2Tower isolation - float hcalDepth2TowerSumEt; - //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalTowerSumEtBc; - //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth1TowerSumEtBc; - //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth2TowerSumEtBc; - std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed - std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed - bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files - //Sum of track pT in a cone of dR - float trkSumPtSolidCone; - //Sum of track pT in a hollow cone of outer radius, inner radius - float trkSumPtHollowCone; - //Number of tracks in a cone of dR - int nTrkSolidCone; - //Number of tracks in a hollow cone of outer radius, inner radius - int nTrkHollowCone; - IsolationVariables() - : - - ecalRecHitSumEt(0.f), - hcalTowerSumEt(0.f), - hcalDepth1TowerSumEt(0.f), - hcalDepth2TowerSumEt(0.f), - hcalTowerSumEtBc(0.f), - hcalDepth1TowerSumEtBc(0.f), - hcalDepth2TowerSumEtBc(0.f), - hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - pre7DepthHcal(true), - trkSumPtSolidCone(0.f), - trkSumPtHollowCone(0.f), - nTrkSolidCone(0), - nTrkHollowCone(0) {} - }; - - /// set relevant isolation variables - void setIsolationVariables(const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) { - isolationR04_ = isolInDr04; - isolationR03_ = isolInDr03; - } - - /// Egamma Isolation variables in cone dR=0.4 - ///Ecal isolation sum calculated from recHits - float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() - float hcalTowerSumEt(const IsolationVariables& iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalTowerSumEt; - else if (depth == 1) - return iv.hcalDepth1TowerSumEt; - else if (depth == 2) - return iv.hcalDepth2TowerSumEt; - - return 0.f; - } else { - const auto& hcaliso = iv.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + int conversionTrackProvenance(const edm::RefToBase& convTrack) const; + + /// position in ECAL: this is th SC position if r9<0.93. If r8>0.93 is position of seed BasicCluster taking shower depth for unconverted photon + math::XYZPointF caloPosition() const { return caloPosition_; } + /// set primary event vertex used to define photon direction + void setVertex(const Point& vertex) override; + /// Implement Candidate method for particle species + bool isPhoton() const override { return true; } + + //======================================================= + // Fiducial Flags + //======================================================= + struct FiducialFlags { + //Fiducial flags + bool isEB; //Photon is in EB + bool isEE; //Photon is in EE + bool isEBEtaGap; //Photon is in supermodule/supercrystal eta gap in EB + bool isEBPhiGap; //Photon is in supermodule/supercrystal phi gap in EB + bool isEERingGap; //Photon is in crystal ring gap in EE + bool isEEDeeGap; //Photon is in crystal dee gap in EE + bool isEBEEGap; //Photon is in border between EB and EE. + + FiducialFlags() + : isEB(false), + isEE(false), + isEBEtaGap(false), + isEBPhiGap(false), + isEERingGap(false), + isEEDeeGap(false), + isEBEEGap(false) + + {} + }; + + /// set flags for photons in the ECAL fiducial volume + void setFiducialVolumeFlags(const FiducialFlags& a) { fiducialFlagBlock_ = a; } + /// Ritrievs fiducial flags + /// true if photon is in ECAL barrel + bool isEB() const { return fiducialFlagBlock_.isEB; } + // true if photon is in ECAL endcap + bool isEE() const { return fiducialFlagBlock_.isEE; } + /// true if photon is in EB, and inside the boundaries in super crystals/modules + bool isEBGap() const { return (isEBEtaGap() || isEBPhiGap()); } + bool isEBEtaGap() const { return fiducialFlagBlock_.isEBEtaGap; } + bool isEBPhiGap() const { return fiducialFlagBlock_.isEBPhiGap; } + /// true if photon is in EE, and inside the boundaries in supercrystal/D + bool isEEGap() const { return (isEERingGap() || isEEDeeGap()); } + bool isEERingGap() const { return fiducialFlagBlock_.isEERingGap; } + bool isEEDeeGap() const { return fiducialFlagBlock_.isEEDeeGap; } + /// true if photon is in boundary between EB and EE + bool isEBEEGap() const { return fiducialFlagBlock_.isEBEEGap; } + + //======================================================= + // Shower Shape Variables + //======================================================= + + struct ShowerShape { + float sigmaEtaEta; + float sigmaIetaIeta; + float e1x5; + float e2x5; + float e3x3; + float e5x5; + float maxEnergyXtal; + float hcalDepth1OverEcal; // hcal over ecal energy using first hcal depth + float hcalDepth2OverEcal; // hcal over ecal energy using 2nd hcal depth + float hcalDepth1OverEcalBc; + float hcalDepth2OverEcalBc; + std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) + std::vector hcalTowersBehindClusters; + bool invalidHcal; + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + float effSigmaRR; + float sigmaIetaIphi; + float sigmaIphiIphi; + float e2nd; + float eTop; + float eLeft; + float eRight; + float eBottom; + float e1x3; + float e2x2; + float e2x5Max; + float e2x5Left; + float e2x5Right; + float e2x5Top; + float e2x5Bottom; + float smMajor; + float smMinor; + float smAlpha; + ShowerShape() + : sigmaEtaEta(std::numeric_limits::max()), + sigmaIetaIeta(std::numeric_limits::max()), + e1x5(0.f), + e2x5(0.f), + e3x3(0.f), + e5x5(0.f), + maxEnergyXtal(0.f), + hcalDepth1OverEcal(0.f), + hcalDepth2OverEcal(0.f), + hcalDepth1OverEcalBc(0.f), + hcalDepth2OverEcalBc(0.f), + hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + invalidHcal(false), + pre7DepthHcal(true), + effSigmaRR(std::numeric_limits::max()), + sigmaIetaIphi(std::numeric_limits::max()), + sigmaIphiIphi(std::numeric_limits::max()), + e2nd(0.f), + eTop(0.f), + eLeft(0.f), + eRight(0.f), + eBottom(0.f), + e1x3(0.f), + e2x2(0.f), + e2x5Max(0.f), + e2x5Left(0.f), + e2x5Right(0.f), + e2x5Top(0.f), + e2x5Bottom(0.f), + smMajor(0.f), + smMinor(0.f), + smAlpha(0.f) {} + }; + const ShowerShape& showerShapeVariables() const { return showerShapeBlock_; } + const ShowerShape& full5x5_showerShapeVariables() const { return full5x5_showerShapeBlock_; } + + void setShowerShapeVariables(const ShowerShape& a) { showerShapeBlock_ = a; } + void full5x5_setShowerShapeVariables(const ShowerShape& a) { full5x5_showerShapeBlock_ = a; } + + /// the total hadronic over electromagnetic fraction + float hcalOverEcal(const ShowerShape& ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; + else if (depth == 1) + return ss.hcalDepth1OverEcal; + else if (depth == 2) + return ss.hcalDepth2OverEcal; + + return 0.f; + } else { + const auto& hovere = ss.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } - } - float hcalTowerSumEtConeDR04(int depth = 0) const { return hcalTowerSumEt(isolationR04_, depth); } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() - float hcalTowerSumEtBc(const IsolationVariables& iv, int depth) const { - if (iv.pre7DepthHcal) { - if (depth == 0) - return iv.hcalTowerSumEtBc; - else if (depth == 1) - return iv.hcalDepth1TowerSumEtBc; - else if (depth == 2) - return iv.hcalDepth2TowerSumEtBc; - - return 0.f; - } else { - const auto& hcaliso = iv.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShapeBlock_, depth); } + float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } + + /// the ratio of total energy of hcal rechits behind the SC and the SC energy + float hcalOverEcalBc(const ShowerShape& ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; + else if (depth == 1) + return ss.hcalDepth1OverEcalBc; + else if (depth == 2) + return ss.hcalDepth2OverEcalBc; + + return 0.f; + } else { + const auto& hovere = ss.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } - } - float hcalTowerSumEtBcConeDR04(int depth = 0) const { return hcalTowerSumEtBc(isolationR04_, depth); } - // Track pT sum - float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } - //As above, excluding the core at the center of the cone - float trkSumPtHollowConeDR04() const { return isolationR04_.trkSumPtHollowCone; } - //Returns number of tracks in a cone of dR - int nTrkSolidConeDR04() const { return isolationR04_.nTrkSolidCone; } - //As above, excluding the core at the center of the cone - int nTrkHollowConeDR04() const { return isolationR04_.nTrkHollowCone; } - // - /// Isolation variables in cone dR=0.3 - float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() - float hcalTowerSumEtConeDR03(int depth = 0) const { return hcalTowerSumEt(isolationR03_, depth); } - /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() - float hcalTowerSumEtBcConeDR03(int depth = 0) const { return hcalTowerSumEtBc(isolationR03_, depth); } - // Track pT sum c - float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } - //As above, excluding the core at the center of the cone - float trkSumPtHollowConeDR03() const { return isolationR03_.trkSumPtHollowCone; } - //Returns number of tracks in a cone of dR - int nTrkSolidConeDR03() const { return isolationR03_.nTrkSolidCone; } - //As above, excluding the core at the center of the cone - int nTrkHollowConeDR03() const { return isolationR03_.nTrkHollowCone; } - - //======================================================= - // PFlow based Isolation Variables - //======================================================= - - struct PflowIsolationVariables { - float chargedHadronIso; //charged hadron isolation with dxy,dz match to pv - float chargedHadronWorstVtxIso; //max charged hadron isolation when dxy/dz matching to given vtx - float chargedHadronWorstVtxGeomVetoIso; //as chargedHadronWorstVtxIso but an additional geometry based veto cone - float chargedHadronPFPVIso; //only considers particles assigned to the primary vertex (PV) by particle flow, corresponds to <10_6 chargedHadronIso - float neutralHadronIso; - float photonIso; - float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of photon - float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of photon - PflowIsolationVariables() - : - - chargedHadronIso(0.), - chargedHadronWorstVtxIso(0.), - chargedHadronWorstVtxGeomVetoIso(0.), - chargedHadronPFPVIso(0.), - neutralHadronIso(0.), - photonIso(0.), - sumEcalClusterEt(0.), - sumHcalClusterEt(0.) {} - }; - - /// Accessors for Particle Flow Isolation variables - float chargedHadronIso() const { return pfIsolation_.chargedHadronIso; } - float chargedHadronWorstVtxIso() const { return pfIsolation_.chargedHadronWorstVtxIso; } - float chargedHadronWorstVtxGeomVetoIso() const { return pfIsolation_.chargedHadronWorstVtxGeomVetoIso; } - float chargedHadronPFPVIso() const { return pfIsolation_.chargedHadronPFPVIso; } - float neutralHadronIso() const { return pfIsolation_.neutralHadronIso; } - float photonIso() const { return pfIsolation_.photonIso; } - - //backwards compat functions for pat::Photon - float ecalPFClusterIso() const { return pfIsolation_.sumEcalClusterEt; }; - float hcalPFClusterIso() const { return pfIsolation_.sumHcalClusterEt; }; - - /// Get Particle Flow Isolation variables block - const PflowIsolationVariables& getPflowIsolationVariables() const { return pfIsolation_; } - - /// Set Particle Flow Isolation variables - void setPflowIsolationVariables(const PflowIsolationVariables& pfisol) { pfIsolation_ = pfisol; } + float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShapeBlock_, depth); } + float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } - static constexpr float mvaPlaceholder = -999999999.; + const std::vector& hcalTowersBehindClusters() const { + return showerShapeBlock_.hcalTowersBehindClusters; + } - struct PflowIDVariables { - int nClusterOutsideMustache; - float etOutsideMustache; - float mva; - float dnn; + /// returns false if H/E is not reliably estimated (e.g. because hcal was off or masked) + bool hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + bool hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + + /// Shower shape variables + float e1x5() const { return showerShapeBlock_.e1x5; } + float e2x5() const { return showerShapeBlock_.e2x5; } + float e3x3() const { return showerShapeBlock_.e3x3; } + float e5x5() const { return showerShapeBlock_.e5x5; } + float maxEnergyXtal() const { return showerShapeBlock_.maxEnergyXtal; } + float sigmaEtaEta() const { return showerShapeBlock_.sigmaEtaEta; } + float sigmaIetaIeta() const { return showerShapeBlock_.sigmaIetaIeta; } + float r1x5() const { return showerShapeBlock_.e1x5 / showerShapeBlock_.e5x5; } + float r2x5() const { return showerShapeBlock_.e2x5 / showerShapeBlock_.e5x5; } + float r9() const { return showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } + + ///full5x5 Shower shape variables + float full5x5_e1x5() const { return full5x5_showerShapeBlock_.e1x5; } + float full5x5_e2x5() const { return full5x5_showerShapeBlock_.e2x5; } + float full5x5_e3x3() const { return full5x5_showerShapeBlock_.e3x3; } + float full5x5_e5x5() const { return full5x5_showerShapeBlock_.e5x5; } + float full5x5_maxEnergyXtal() const { return full5x5_showerShapeBlock_.maxEnergyXtal; } + float full5x5_sigmaEtaEta() const { return full5x5_showerShapeBlock_.sigmaEtaEta; } + float full5x5_sigmaIetaIeta() const { return full5x5_showerShapeBlock_.sigmaIetaIeta; } + float full5x5_r1x5() const { return full5x5_showerShapeBlock_.e1x5 / full5x5_showerShapeBlock_.e5x5; } + float full5x5_r2x5() const { return full5x5_showerShapeBlock_.e2x5 / full5x5_showerShapeBlock_.e5x5; } + float full5x5_r9() const { return full5x5_showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } + + /// the total hadronic over electromagnetic fraction + float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShapeBlock_, depth); } + float full5x5_hadronicOverEm(int depth = 0) const { return full5x5_hcalOverEcal(depth); } + + /// the ratio of total energy of hcal rechits behind the SC and the SC energy + float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShapeBlock_, depth); } + float full5x5_hadTowOverEm(int depth = 0) const { return full5x5_hcalOverEcalBc(depth); } + + //======================================================= + // SaturationInfo + //======================================================= + + struct SaturationInfo { + int nSaturatedXtals; + bool isSeedSaturated; + SaturationInfo() : nSaturatedXtals(0), isSeedSaturated(false) {} + }; + + // accessors + float nSaturatedXtals() const { return saturationInfo_.nSaturatedXtals; } + float isSeedSaturated() const { return saturationInfo_.isSeedSaturated; } + const SaturationInfo& saturationInfo() const { return saturationInfo_; } + void setSaturationInfo(const SaturationInfo& s) { saturationInfo_ = s; } + + //======================================================= + // Energy Determinations + //======================================================= + enum P4type { undefined = -1, ecal_standard = 0, ecal_photons = 1, regression1 = 2, regression2 = 3 }; + + struct EnergyCorrections { + float scEcalEnergy; + float scEcalEnergyError; + LorentzVector scEcalP4; + float phoEcalEnergy; + float phoEcalEnergyError; + LorentzVector phoEcalP4; + float regression1Energy; + float regression1EnergyError; + LorentzVector regression1P4; + float regression2Energy; + float regression2EnergyError; + LorentzVector regression2P4; + P4type candidateP4type; + EnergyCorrections() + : scEcalEnergy(0.), + scEcalEnergyError(999.), + scEcalP4(0., 0., 0., 0.), + phoEcalEnergy(0.), + phoEcalEnergyError(999.), + phoEcalP4(0., 0., 0., 0.), + regression1Energy(0.), + regression1EnergyError(999.), + regression1P4(0., 0., 0., 0.), + regression2Energy(0.), + regression2EnergyError(999.), + regression2P4(0., 0., 0., 0.), + candidateP4type(undefined) {} + }; + + using RecoCandidate::p4; + using RecoCandidate::setP4; + + //sets both energy and its uncertainty + void setCorrectedEnergy(P4type type, float E, float dE, bool toCand = true); + void setP4(P4type type, const LorentzVector& p4, float p4Error, bool setToRecoCandidate); + void setEnergyCorrections(const EnergyCorrections& e) { eCorrections_ = e; } + void setCandidateP4type(const P4type type) { eCorrections_.candidateP4type = type; } + + float getCorrectedEnergy(P4type type) const; + float getCorrectedEnergyError(P4type type) const; + P4type getCandidateP4type() const { return eCorrections_.candidateP4type; } + const LorentzVector& p4(P4type type) const; + const EnergyCorrections& energyCorrections() const { return eCorrections_; } + + //======================================================= + // MIP Variables + //======================================================= + + struct MIPVariables { + float mipChi2; + float mipTotEnergy; + float mipSlope; + float mipIntercept; + int mipNhitCone; + bool mipIsHalo; + + MIPVariables() + : + + mipChi2(0), + mipTotEnergy(0), + mipSlope(0), + mipIntercept(0), + mipNhitCone(0), + mipIsHalo(false) {} + }; + + /// MIP variables + float mipChi2() const { return mipVariableBlock_.mipChi2; } + float mipTotEnergy() const { return mipVariableBlock_.mipTotEnergy; } + float mipSlope() const { return mipVariableBlock_.mipSlope; } + float mipIntercept() const { return mipVariableBlock_.mipIntercept; } + int mipNhitCone() const { return mipVariableBlock_.mipNhitCone; } + bool mipIsHalo() const { return mipVariableBlock_.mipIsHalo; } + + ///set mip Variables + void setMIPVariables(const MIPVariables& mipVar) { mipVariableBlock_ = mipVar; } + + //======================================================= + // Isolation Variables + //======================================================= + + struct IsolationVariables { + //These are analysis quantities calculated in the PhotonIDAlgo class + + //EcalRecHit isolation + float ecalRecHitSumEt; + //HcalTower isolation + float hcalTowerSumEt; + //HcalDepth1Tower isolation + float hcalDepth1TowerSumEt; + //HcalDepth2Tower isolation + float hcalDepth2TowerSumEt; + //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalTowerSumEtBc; + //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalDepth1TowerSumEtBc; + //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalDepth2TowerSumEtBc; + std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files + //Sum of track pT in a cone of dR + float trkSumPtSolidCone; + //Sum of track pT in a hollow cone of outer radius, inner radius + float trkSumPtHollowCone; + //Number of tracks in a cone of dR + int nTrkSolidCone; + //Number of tracks in a hollow cone of outer radius, inner radius + int nTrkHollowCone; + IsolationVariables() + : + + ecalRecHitSumEt(0.f), + hcalTowerSumEt(0.f), + hcalDepth1TowerSumEt(0.f), + hcalDepth2TowerSumEt(0.f), + hcalTowerSumEtBc(0.f), + hcalDepth1TowerSumEtBc(0.f), + hcalDepth2TowerSumEtBc(0.f), + hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + pre7DepthHcal(true), + trkSumPtSolidCone(0.f), + trkSumPtHollowCone(0.f), + nTrkSolidCone(0), + nTrkHollowCone(0) {} + }; + + /// set relevant isolation variables + void setIsolationVariables(const IsolationVariables& isolInDr04, const IsolationVariables& isolInDr03) { + isolationR04_ = isolInDr04; + isolationR03_ = isolInDr03; + } - PflowIDVariables() - : nClusterOutsideMustache(-1), etOutsideMustache(mvaPlaceholder), mva(mvaPlaceholder), dnn(mvaPlaceholder) {} + /// Egamma Isolation variables in cone dR=0.4 + ///Ecal isolation sum calculated from recHits + float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() + float hcalTowerSumEt(const IsolationVariables& iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalTowerSumEt; + else if (depth == 1) + return iv.hcalDepth1TowerSumEt; + else if (depth == 2) + return iv.hcalDepth2TowerSumEt; + + return 0.f; + } else { + const auto& hcaliso = iv.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float hcalTowerSumEtConeDR04(int depth = 0) const { return hcalTowerSumEt(isolationR04_, depth); } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() + float hcalTowerSumEtBc(const IsolationVariables& iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalTowerSumEtBc; + else if (depth == 1) + return iv.hcalDepth1TowerSumEtBc; + else if (depth == 2) + return iv.hcalDepth2TowerSumEtBc; + + return 0.f; + } else { + const auto& hcaliso = iv.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } + } + float hcalTowerSumEtBcConeDR04(int depth = 0) const { return hcalTowerSumEtBc(isolationR04_, depth); } + // Track pT sum + float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } + //As above, excluding the core at the center of the cone + float trkSumPtHollowConeDR04() const { return isolationR04_.trkSumPtHollowCone; } + //Returns number of tracks in a cone of dR + int nTrkSolidConeDR04() const { return isolationR04_.nTrkSolidCone; } + //As above, excluding the core at the center of the cone + int nTrkHollowConeDR04() const { return isolationR04_.nTrkHollowCone; } + // + /// Isolation variables in cone dR=0.3 + float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() + float hcalTowerSumEtConeDR03(int depth = 0) const { return hcalTowerSumEt(isolationR03_, depth); } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() + float hcalTowerSumEtBcConeDR03(int depth = 0) const { return hcalTowerSumEtBc(isolationR03_, depth); } + // Track pT sum c + float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } + //As above, excluding the core at the center of the cone + float trkSumPtHollowConeDR03() const { return isolationR03_.trkSumPtHollowCone; } + //Returns number of tracks in a cone of dR + int nTrkSolidConeDR03() const { return isolationR03_.nTrkSolidCone; } + //As above, excluding the core at the center of the cone + int nTrkHollowConeDR03() const { return isolationR03_.nTrkHollowCone; } + + //======================================================= + // PFlow based Isolation Variables + //======================================================= + + struct PflowIsolationVariables { + float chargedHadronIso; //charged hadron isolation with dxy,dz match to pv + float chargedHadronWorstVtxIso; //max charged hadron isolation when dxy/dz matching to given vtx + float chargedHadronWorstVtxGeomVetoIso; //as chargedHadronWorstVtxIso but an additional geometry based veto cone + float chargedHadronPFPVIso; //only considers particles assigned to the primary vertex (PV) by particle flow, corresponds to <10_6 chargedHadronIso + float neutralHadronIso; + float photonIso; + float sumEcalClusterEt; //sum pt of ecal clusters, vetoing clusters part of photon + float sumHcalClusterEt; //sum pt of hcal clusters, vetoing clusters part of photon + PflowIsolationVariables() + : + + chargedHadronIso(0.), + chargedHadronWorstVtxIso(0.), + chargedHadronWorstVtxGeomVetoIso(0.), + chargedHadronPFPVIso(0.), + neutralHadronIso(0.), + photonIso(0.), + sumEcalClusterEt(0.), + sumHcalClusterEt(0.) {} + }; + + /// Accessors for Particle Flow Isolation variables + float chargedHadronIso() const { return pfIsolation_.chargedHadronIso; } + float chargedHadronWorstVtxIso() const { return pfIsolation_.chargedHadronWorstVtxIso; } + float chargedHadronWorstVtxGeomVetoIso() const { return pfIsolation_.chargedHadronWorstVtxGeomVetoIso; } + float chargedHadronPFPVIso() const { return pfIsolation_.chargedHadronPFPVIso; } + float neutralHadronIso() const { return pfIsolation_.neutralHadronIso; } + float photonIso() const { return pfIsolation_.photonIso; } + + //backwards compat functions for pat::Photon + float ecalPFClusterIso() const { return pfIsolation_.sumEcalClusterEt; }; + float hcalPFClusterIso() const { return pfIsolation_.sumHcalClusterEt; }; + + /// Get Particle Flow Isolation variables block + const PflowIsolationVariables& getPflowIsolationVariables() const { return pfIsolation_; } + + /// Set Particle Flow Isolation variables + void setPflowIsolationVariables(const PflowIsolationVariables& pfisol) { pfIsolation_ = pfisol; } + + static constexpr float mvaPlaceholder = -999999999.; + + struct PflowIDVariables { + int nClusterOutsideMustache; + float etOutsideMustache; + float mva; + float dnn; + + PflowIDVariables() + : nClusterOutsideMustache(-1), + etOutsideMustache(mvaPlaceholder), + mva(mvaPlaceholder), + dnn(mvaPlaceholder) {} + }; + + // getters + int nClusterOutsideMustache() const { return pfID_.nClusterOutsideMustache; } + float etOutsideMustache() const { return pfID_.etOutsideMustache; } + float pfMVA() const { return pfID_.mva; } + float pfDNN() const { return pfID_.dnn; } + // setters + void setPflowIDVariables(const PflowIDVariables& pfid) { pfID_ = pfid; } + + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + void hcalToRun2EffDepth(); + + ///MVA based beam halo tagger - trained for EE and for pT > 200 GeV + float haloTaggerMVAVal() const { return haloTaggerMVAVal_; } + + ///set the haloTaggerMVAVal here + void setHaloTaggerMVAVal(float x) { haloTaggerMVAVal_ = x; } + + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// position of seed BasicCluster for shower depth of unconverted photon + math::XYZPointF caloPosition_; + /// reference to the PhotonCore + reco::PhotonCoreRef photonCore_; + // + bool pixelSeed_; + // + FiducialFlags fiducialFlagBlock_; + IsolationVariables isolationR04_; + IsolationVariables isolationR03_; + ShowerShape showerShapeBlock_; + ShowerShape full5x5_showerShapeBlock_; + SaturationInfo saturationInfo_; + EnergyCorrections eCorrections_; + MIPVariables mipVariableBlock_; + PflowIsolationVariables pfIsolation_; + PflowIDVariables pfID_; + float haloTaggerMVAVal_; }; - // getters - int nClusterOutsideMustache() const { return pfID_.nClusterOutsideMustache; } - float etOutsideMustache() const { return pfID_.etOutsideMustache; } - float pfMVA() const { return pfID_.mva; } - float pfDNN() const { return pfID_.dnn; } - // setters - void setPflowIDVariables(const PflowIDVariables& pfid) { pfID_ = pfid; } - - // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest - void hcalToRun2EffDepth(); - - ///MVA based beam halo tagger - trained for EE and for pT > 200 GeV - float haloTaggerMVAVal() const { return haloTaggerMVAVal_; } - - ///set the haloTaggerMVAVal here - void setHaloTaggerMVAVal(float x) { haloTaggerMVAVal_ = x; } - - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// position of seed BasicCluster for shower depth of unconverted photon - math::XYZPointF caloPosition_; - /// reference to the PhotonCore - reco::PhotonCoreRef photonCore_; - // - bool pixelSeed_; - // - FiducialFlags fiducialFlagBlock_; - IsolationVariables isolationR04_; - IsolationVariables isolationR03_; - ShowerShape showerShapeBlock_; - ShowerShape full5x5_showerShapeBlock_; - SaturationInfo saturationInfo_; - EnergyCorrections eCorrections_; - MIPVariables mipVariableBlock_; - PflowIsolationVariables pfIsolation_; - PflowIDVariables pfID_; - float haloTaggerMVAVal_; - }; - + } // namespace io_v1 + using Photon = io_v1::Photon; } // namespace reco #endif diff --git a/DataFormats/EgammaCandidates/interface/PhotonCore.h b/DataFormats/EgammaCandidates/interface/PhotonCore.h index 725aa3cc98ad7..bbf5b3d415ff4 100644 --- a/DataFormats/EgammaCandidates/interface/PhotonCore.h +++ b/DataFormats/EgammaCandidates/interface/PhotonCore.h @@ -20,82 +20,86 @@ #include "DataFormats/EgammaReco/interface/ElectronSeedFwd.h" namespace reco { + namespace io_v1 { - class PhotonCore { - public: - /// default constructor - // PhotonCore() { } + class PhotonCore { + public: + /// default constructor + // PhotonCore() { } - /// To be deleted: Internal comment for Florian - /// I would reserve this constructor to build the standard photons, as it was before, plus I add the initialization of the provenance - PhotonCore(const reco::SuperClusterRef &scl) : superCluster_(scl), isPFlowPhoton_(false), isStandardPhoton_(true) {} + /// To be deleted: Internal comment for Florian + /// I would reserve this constructor to build the standard photons, as it was before, plus I add the initialization of the provenance + PhotonCore(const reco::SuperClusterRef &scl) + : superCluster_(scl), isPFlowPhoton_(false), isStandardPhoton_(true) {} - // while for building photons from pf I would use the default constructor - PhotonCore() : isPFlowPhoton_(false), isStandardPhoton_(false) {} - // followed by the setters of the provenance and of the Ref to the wanted supercluster - // at that point if in PF you have found a photon which correspond to a standard SC yuo can - // set both supercluster and the two flags to true - // if you have found an object which does not have a standard SC associated you set only the - // one from pflow. - // How does this sound ? + // while for building photons from pf I would use the default constructor + PhotonCore() : isPFlowPhoton_(false), isStandardPhoton_(false) {} + // followed by the setters of the provenance and of the Ref to the wanted supercluster + // at that point if in PF you have found a photon which correspond to a standard SC yuo can + // set both supercluster and the two flags to true + // if you have found an object which does not have a standard SC associated you set only the + // one from pflow. + // How does this sound ? - /// destructor - virtual ~PhotonCore() {} + /// destructor + virtual ~PhotonCore() {} - PhotonCore *clone() const { return new PhotonCore(*this); } + PhotonCore *clone() const { return new PhotonCore(*this); } - /// set reference to SuperCluster - void setSuperCluster(const reco::SuperClusterRef &r) { superCluster_ = r; } - /// set reference to PFlow SuperCluster - void setParentSuperCluster(const reco::SuperClusterRef &r) { parentSuperCluster_ = r; } - /// add single ConversionRef to the vector of Refs - void addConversion(const reco::ConversionRef &r) { conversions_.push_back(r); } - /// add single ConversionRef to the vector of Refs - void addOneLegConversion(const reco::ConversionRef &r) { conversionsOneLeg_.push_back(r); } - /// set electron pixel seed ref - void addElectronPixelSeed(const reco::ElectronSeedRef &r) { electronSeed_.push_back(r); } - /// set the provenance - void setPFlowPhoton(const bool prov) { isPFlowPhoton_ = prov; } - void setStandardPhoton(const bool prov) { isStandardPhoton_ = prov; } + /// set reference to SuperCluster + void setSuperCluster(const reco::SuperClusterRef &r) { superCluster_ = r; } + /// set reference to PFlow SuperCluster + void setParentSuperCluster(const reco::SuperClusterRef &r) { parentSuperCluster_ = r; } + /// add single ConversionRef to the vector of Refs + void addConversion(const reco::ConversionRef &r) { conversions_.push_back(r); } + /// add single ConversionRef to the vector of Refs + void addOneLegConversion(const reco::ConversionRef &r) { conversionsOneLeg_.push_back(r); } + /// set electron pixel seed ref + void addElectronPixelSeed(const reco::ElectronSeedRef &r) { electronSeed_.push_back(r); } + /// set the provenance + void setPFlowPhoton(const bool prov) { isPFlowPhoton_ = prov; } + void setStandardPhoton(const bool prov) { isStandardPhoton_ = prov; } - /// get reference to SuperCluster - reco::SuperClusterRef superCluster() const { return superCluster_; } - /// get reference to PFlow SuperCluster - reco::SuperClusterRef parentSuperCluster() const { return parentSuperCluster_; } + /// get reference to SuperCluster + reco::SuperClusterRef superCluster() const { return superCluster_; } + /// get reference to PFlow SuperCluster + reco::SuperClusterRef parentSuperCluster() const { return parentSuperCluster_; } - //// comment for Florian. I have seen that in GsfElectronCore they have a getter for the supercluster - // which returns the pfSuperCluster only if the standard supeclsuter is not null - // But I had udnerstood from you when we spke last time that we wish to be free - // to have both SCs available. Or not ? + //// comment for Florian. I have seen that in GsfElectronCore they have a getter for the supercluster + // which returns the pfSuperCluster only if the standard supeclsuter is not null + // But I had udnerstood from you when we spke last time that we wish to be free + // to have both SCs available. Or not ? - /// get vector of references to Conversion's - reco::ConversionRefVector conversions() const { return conversions_; } - /// get vector of references to one leg Conversion's - reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } + /// get vector of references to Conversion's + reco::ConversionRefVector conversions() const { return conversions_; } + /// get vector of references to one leg Conversion's + reco::ConversionRefVector conversionsOneLeg() const { return conversionsOneLeg_; } - void setConversions(const reco::ConversionRefVector &conversions) { conversions_ = conversions; } - void setConversionsOneLeg(const reco::ConversionRefVector &conversions) { conversionsOneLeg_ = conversions; } + void setConversions(const reco::ConversionRefVector &conversions) { conversions_ = conversions; } + void setConversionsOneLeg(const reco::ConversionRefVector &conversions) { conversionsOneLeg_ = conversions; } - /// get reference to electron seed if existing - reco::ElectronSeedRefVector electronPixelSeeds() const { return electronSeed_; } - bool isPFlowPhoton() const { return isPFlowPhoton_; } - bool isStandardPhoton() const { return isStandardPhoton_; } + /// get reference to electron seed if existing + reco::ElectronSeedRefVector electronPixelSeeds() const { return electronSeed_; } + bool isPFlowPhoton() const { return isPFlowPhoton_; } + bool isStandardPhoton() const { return isStandardPhoton_; } - private: - /// reference to a SuperCluster - reco::SuperClusterRef superCluster_; - // vector of references to Conversions - reco::ConversionRefVector conversions_; - //vector of references for 1-leg - reco::ConversionRefVector conversionsOneLeg_; - // vector of references to ElectronPixelSeeds - reco::ElectronSeedRefVector electronSeed_; - /// reference to a Particle flow SuperCluster - reco::SuperClusterRef parentSuperCluster_; - bool isPFlowPhoton_; - bool isStandardPhoton_; - }; + private: + /// reference to a SuperCluster + reco::SuperClusterRef superCluster_; + // vector of references to Conversions + reco::ConversionRefVector conversions_; + //vector of references for 1-leg + reco::ConversionRefVector conversionsOneLeg_; + // vector of references to ElectronPixelSeeds + reco::ElectronSeedRefVector electronSeed_; + /// reference to a Particle flow SuperCluster + reco::SuperClusterRef parentSuperCluster_; + bool isPFlowPhoton_; + bool isStandardPhoton_; + }; + } // namespace io_v1 + using PhotonCore = io_v1::PhotonCore; } // namespace reco #endif diff --git a/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h b/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h index c4f42fbdd299e..47e4b776d4a00 100644 --- a/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h +++ b/DataFormats/EgammaCandidates/interface/PhotonCoreFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class PhotonCore; + namespace io_v1 { + class PhotonCore; + } + using PhotonCore = io_v1::PhotonCore; /// collectin of PhotonCore objects typedef std::vector PhotonCoreCollection; diff --git a/DataFormats/EgammaCandidates/interface/PhotonFwd.h b/DataFormats/EgammaCandidates/interface/PhotonFwd.h index fbd53d29598f7..40e24ee8b2f1a 100644 --- a/DataFormats/EgammaCandidates/interface/PhotonFwd.h +++ b/DataFormats/EgammaCandidates/interface/PhotonFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Photon; + namespace io_v1 { + class Photon; + } + using Photon = io_v1::Photon; /// collectin of Photon objects typedef std::vector PhotonCollection; diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 0cb2b519e2d76..ec9c5dba3054a 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -1,290 +1,199 @@ - - - - - - - - - - - - - - - - - - - - - - - onfile.trackToBaseRefs_.size()) { for(auto const& t: onfile.tracks_) { trackToBaseRefs_.emplace_back(t);} }]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -294,18 +203,18 @@ - + - - + + - + - - + + @@ -330,27 +239,27 @@ - + - + - + - + - + - - + + - - + + - - + + diff --git a/DataFormats/EgammaReco/interface/ElectronSeed.h b/DataFormats/EgammaReco/interface/ElectronSeed.h index 60c0fd4f99a7b..b0d72f9632fd8 100644 --- a/DataFormats/EgammaReco/interface/ElectronSeed.h +++ b/DataFormats/EgammaReco/interface/ElectronSeed.h @@ -47,112 +47,115 @@ #include namespace reco { - - class ElectronSeed : public TrajectorySeed { - public: - struct PMVars { - float dRZPos; - float dRZNeg; - float dPhiPos; - float dPhiNeg; - int detId; //this is already stored as the hit is stored in traj seed but a useful sanity check - int layerOrDiskNr; //redundant as stored in detId but its a huge pain to hence why its saved here - - PMVars(); - - void setDPhi(float pos, float neg); - void setDRZ(float pos, float neg); - void setDet(int iDetId, int iLayerOrDiskNr); + namespace io_v1 { + + class ElectronSeed : public TrajectorySeed { + public: + struct PMVars { + float dRZPos; + float dRZNeg; + float dPhiPos; + float dPhiNeg; + int detId; //this is already stored as the hit is stored in traj seed but a useful sanity check + int layerOrDiskNr; //redundant as stored in detId but its a huge pain to hence why its saved here + + PMVars(); + + void setDPhi(float pos, float neg); + void setDRZ(float pos, float neg); + void setDet(int iDetId, int iLayerOrDiskNr); + }; + + typedef edm::RefToBase CaloClusterRef; + typedef edm::Ref CtfTrackRef; + + static std::string const& name() { + static std::string const name_("ElectronSeed"); + return name_; + } + + //! Construction of base attributes + ElectronSeed(); + ElectronSeed(const TrajectorySeed&); + ElectronSeed(PTrajectoryStateOnDet& pts, RecHitContainer& rh, PropagationDirection& dir); + ElectronSeed* clone() const override { return new ElectronSeed(*this); } + ~ElectronSeed() override; + + //! Set additional info + void setCtfTrack(const CtfTrackRef&); + void setCaloCluster(const CaloClusterRef& clus) { + caloCluster_ = clus; + isEcalDriven_ = true; + } + void addHitInfo(const PMVars& hitVars) { hitInfo_.push_back(hitVars); } + void setNrLayersAlongTraj(int val) { nrLayersAlongTraj_ = val; } + //! Accessors + const CtfTrackRef& ctfTrack() const { return ctfTrack_; } + const CaloClusterRef& caloCluster() const { return caloCluster_; } + + //! Utility + TrackCharge getCharge() const { return startingState().parameters().charge(); } + + bool isEcalDriven() const { return isEcalDriven_; } + bool isTrackerDriven() const { return isTrackerDriven_; } + + const std::vector& hitInfo() const { return hitInfo_; } + float dPhiNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiNeg); } + float dPhiPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiPos); } + float dPhiBest(size_t hitNr) const { return bestVal(dPhiNeg(hitNr), dPhiPos(hitNr)); } + float dRZPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZPos); } + float dRZNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZNeg); } + float dRZBest(size_t hitNr) const { return bestVal(dRZNeg(hitNr), dRZPos(hitNr)); } + int detId(size_t hitNr) const { return hitNr < hitInfo_.size() ? hitInfo_[hitNr].detId : 0; } + int subDet(size_t hitNr) const { return DetId(detId(hitNr)).subdetId(); } + int layerOrDiskNr(size_t hitNr) const { return getVal(hitNr, &PMVars::layerOrDiskNr); } + int nrLayersAlongTraj() const { return nrLayersAlongTraj_; } + + unsigned int hitsMask() const; + void initTwoHitSeed(const unsigned char hitMask); + void setNegAttributes(const float dRZ2 = std::numeric_limits::max(), + const float dPhi2 = std::numeric_limits::max(), + const float dRZ1 = std::numeric_limits::max(), + const float dPhi1 = std::numeric_limits::max()); + void setPosAttributes(const float dRZ2 = std::numeric_limits::max(), + const float dPhi2 = std::numeric_limits::max(), + const float dRZ1 = std::numeric_limits::max(), + const float dPhi1 = std::numeric_limits::max()); + + //this is a backwards compatible function designed to + //convert old format ElectronSeeds to the new format + //only public due to root io rules, not intended for any other use + //also in theory not necessary to part of this class + static std::vector createHitInfo(const float dPhi1Pos, + const float dPhi1Neg, + const float dRZ1Pos, + const float dRZ1Neg, + const float dPhi2Pos, + const float dPhi2Neg, + const float dRZ2Pos, + const float dRZ2Neg, + const char hitMask, + TrajectorySeed::RecHitRange const& recHits); + + private: + static float bestVal(float val1, float val2) { return std::abs(val1) < std::abs(val2) ? val1 : val2; } + template + T getVal(unsigned int hitNr, T PMVars::* val) const { + return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits::max(); + } + static std::vector hitNrsFromMask(unsigned int hitMask); + + private: + CtfTrackRef ctfTrack_; + CaloClusterRef caloCluster_; + std::vector hitInfo_; + int nrLayersAlongTraj_; + + bool isEcalDriven_; + bool isTrackerDriven_; }; - - typedef edm::RefToBase CaloClusterRef; - typedef edm::Ref CtfTrackRef; - - static std::string const& name() { - static std::string const name_("ElectronSeed"); - return name_; - } - - //! Construction of base attributes - ElectronSeed(); - ElectronSeed(const TrajectorySeed&); - ElectronSeed(PTrajectoryStateOnDet& pts, RecHitContainer& rh, PropagationDirection& dir); - ElectronSeed* clone() const override { return new ElectronSeed(*this); } - ~ElectronSeed() override; - - //! Set additional info - void setCtfTrack(const CtfTrackRef&); - void setCaloCluster(const CaloClusterRef& clus) { - caloCluster_ = clus; - isEcalDriven_ = true; - } - void addHitInfo(const PMVars& hitVars) { hitInfo_.push_back(hitVars); } - void setNrLayersAlongTraj(int val) { nrLayersAlongTraj_ = val; } - //! Accessors - const CtfTrackRef& ctfTrack() const { return ctfTrack_; } - const CaloClusterRef& caloCluster() const { return caloCluster_; } - - //! Utility - TrackCharge getCharge() const { return startingState().parameters().charge(); } - - bool isEcalDriven() const { return isEcalDriven_; } - bool isTrackerDriven() const { return isTrackerDriven_; } - - const std::vector& hitInfo() const { return hitInfo_; } - float dPhiNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiNeg); } - float dPhiPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dPhiPos); } - float dPhiBest(size_t hitNr) const { return bestVal(dPhiNeg(hitNr), dPhiPos(hitNr)); } - float dRZPos(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZPos); } - float dRZNeg(size_t hitNr) const { return getVal(hitNr, &PMVars::dRZNeg); } - float dRZBest(size_t hitNr) const { return bestVal(dRZNeg(hitNr), dRZPos(hitNr)); } - int detId(size_t hitNr) const { return hitNr < hitInfo_.size() ? hitInfo_[hitNr].detId : 0; } - int subDet(size_t hitNr) const { return DetId(detId(hitNr)).subdetId(); } - int layerOrDiskNr(size_t hitNr) const { return getVal(hitNr, &PMVars::layerOrDiskNr); } - int nrLayersAlongTraj() const { return nrLayersAlongTraj_; } - - unsigned int hitsMask() const; - void initTwoHitSeed(const unsigned char hitMask); - void setNegAttributes(const float dRZ2 = std::numeric_limits::max(), - const float dPhi2 = std::numeric_limits::max(), - const float dRZ1 = std::numeric_limits::max(), - const float dPhi1 = std::numeric_limits::max()); - void setPosAttributes(const float dRZ2 = std::numeric_limits::max(), - const float dPhi2 = std::numeric_limits::max(), - const float dRZ1 = std::numeric_limits::max(), - const float dPhi1 = std::numeric_limits::max()); - - //this is a backwards compatible function designed to - //convert old format ElectronSeeds to the new format - //only public due to root io rules, not intended for any other use - //also in theory not necessary to part of this class - static std::vector createHitInfo(const float dPhi1Pos, - const float dPhi1Neg, - const float dRZ1Pos, - const float dRZ1Neg, - const float dPhi2Pos, - const float dPhi2Neg, - const float dRZ2Pos, - const float dRZ2Neg, - const char hitMask, - TrajectorySeed::RecHitRange const& recHits); - - private: - static float bestVal(float val1, float val2) { return std::abs(val1) < std::abs(val2) ? val1 : val2; } - template - T getVal(unsigned int hitNr, T PMVars::* val) const { - return hitNr < hitInfo_.size() ? hitInfo_[hitNr].*val : std::numeric_limits::max(); - } - static std::vector hitNrsFromMask(unsigned int hitMask); - - private: - CtfTrackRef ctfTrack_; - CaloClusterRef caloCluster_; - std::vector hitInfo_; - int nrLayersAlongTraj_; - - bool isEcalDriven_; - bool isTrackerDriven_; - }; + } // namespace io_v1 + using ElectronSeed = io_v1::ElectronSeed; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/ElectronSeedFwd.h b/DataFormats/EgammaReco/interface/ElectronSeedFwd.h index a14cbbf7e9ce4..912baa650c06a 100644 --- a/DataFormats/EgammaReco/interface/ElectronSeedFwd.h +++ b/DataFormats/EgammaReco/interface/ElectronSeedFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class ElectronSeed; + namespace io_v1 { + class ElectronSeed; + } + using ElectronSeed = io_v1::ElectronSeed; /// collection of ElectronSeed objects typedef std::vector ElectronSeedCollection; /// reference to an object in a collection of ElectronSeed objects diff --git a/DataFormats/EgammaReco/interface/HFEMClusterShape.h b/DataFormats/EgammaReco/interface/HFEMClusterShape.h index 50885a19c2c03..738bdf8d37e2c 100644 --- a/DataFormats/EgammaReco/interface/HFEMClusterShape.h +++ b/DataFormats/EgammaReco/interface/HFEMClusterShape.h @@ -16,57 +16,60 @@ */ namespace reco { + namespace io_v1 { - class HFEMClusterShape { - public: - HFEMClusterShape() {} + class HFEMClusterShape { + public: + HFEMClusterShape() {} - HFEMClusterShape(double eLong1x1, - double eShort1x1, - double eLong3x3, - double eShort3x3, - double eLong5x5, - double eShort5x5, - double eLongCore, - double CellEta, - double CellPhi, - DetId seed); + HFEMClusterShape(double eLong1x1, + double eShort1x1, + double eLong3x3, + double eShort3x3, + double eLong5x5, + double eShort5x5, + double eLongCore, + double CellEta, + double CellPhi, + DetId seed); - //energy in long or short fibers various cluster sizes - double eLong1x1() const { return eLong1x1_; } - double eShort1x1() const { return eShort1x1_; } - double eLong3x3() const { return eLong3x3_; } - double eShort3x3() const { return eShort3x3_; } - double eLong5x5() const { return eLong5x5_; } - double eShort5x5() const { return eShort5x5_; } + //energy in long or short fibers various cluster sizes + double eLong1x1() const { return eLong1x1_; } + double eShort1x1() const { return eShort1x1_; } + double eLong3x3() const { return eLong3x3_; } + double eShort3x3() const { return eShort3x3_; } + double eLong5x5() const { return eLong5x5_; } + double eShort5x5() const { return eShort5x5_; } - //total energy in various clusters - double e1x1() const; - double e3x3() const; - double e5x5() const; + //total energy in various clusters + double e1x1() const; + double e3x3() const; + double e5x5() const; - //Identification Variables - //Longetudinal variable: E(3x3,short fibers)/E(3x3,long fibers) - double eSeL() const; - //Transverse Variable: E(Core of cluster)/E(3x3) - double eCOREe9() const; - //Shower Exclusion Variable: E(3x3)/E(5x5) - double e9e25() const; + //Identification Variables + //Longetudinal variable: E(3x3,short fibers)/E(3x3,long fibers) + double eSeL() const; + //Transverse Variable: E(Core of cluster)/E(3x3) + double eCOREe9() const; + //Shower Exclusion Variable: E(3x3)/E(5x5) + double e9e25() const; - //energy in central highest energy cells (at least 50% energy of previous total energy startign with seed cell) - double eCore() const { return eLongCore_; } + //energy in central highest energy cells (at least 50% energy of previous total energy startign with seed cell) + double eCore() const { return eLongCore_; } - double CellEta() const { return CellEta_; } - double CellPhi() const { return CellPhi_; } + double CellEta() const { return CellEta_; } + double CellPhi() const { return CellPhi_; } - //seed cell of cluster DetId - DetId seed() const { return seed_; } + //seed cell of cluster DetId + DetId seed() const { return seed_; } - private: - double eLong1x1_, eShort1x1_, eLong3x3_, eShort3x3_, eLong5x5_, eShort5x5_, eLongCore_, CellEta_, CellPhi_; - DetId seed_; - }; + private: + double eLong1x1_, eShort1x1_, eLong3x3_, eShort3x3_, eLong5x5_, eShort5x5_, eLongCore_, CellEta_, CellPhi_; + DetId seed_; + }; + } // namespace io_v1 + using HFEMClusterShape = io_v1::HFEMClusterShape; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h b/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h index 0a76dd1c350c6..12db1d83307bd 100644 --- a/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h +++ b/DataFormats/EgammaReco/interface/HFEMClusterShapeFwd.h @@ -5,7 +5,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class HFEMClusterShape; + namespace io_v1 { + class HFEMClusterShape; + } + using HFEMClusterShape = io_v1::HFEMClusterShape; // collection of HFEMClusterShape objects typedef std::vector HFEMClusterShapeCollection; diff --git a/DataFormats/EgammaReco/interface/PreshowerCluster.h b/DataFormats/EgammaReco/interface/PreshowerCluster.h index bcd59e401abdd..86a43b6801e81 100644 --- a/DataFormats/EgammaReco/interface/PreshowerCluster.h +++ b/DataFormats/EgammaReco/interface/PreshowerCluster.h @@ -13,53 +13,56 @@ #include namespace reco { + namespace io_v1 { - class PreshowerCluster : public CaloCluster { - public: - typedef math::XYZPoint Point; + class PreshowerCluster : public CaloCluster { + public: + typedef math::XYZPoint Point; - /// default constructor - PreshowerCluster() : CaloCluster(0., Point(0., 0., 0.)) {} + /// default constructor + PreshowerCluster() : CaloCluster(0., Point(0., 0., 0.)) {} - ~PreshowerCluster() override; + ~PreshowerCluster() override; - /// Constructor from EcalRecHits - PreshowerCluster(const double E, - const Point& pos, - const std::vector >& usedHits, - const int plane); + /// Constructor from EcalRecHits + PreshowerCluster(const double E, + const Point& pos, + const std::vector >& usedHits, + const int plane); - /// Constructor from cluster - PreshowerCluster(const PreshowerCluster&); + /// Constructor from cluster + PreshowerCluster(const PreshowerCluster&); - /// Number of RecHits the cluster - int nhits() const { return hitsAndFractions_.size(); } + /// Number of RecHits the cluster + int nhits() const { return hitsAndFractions_.size(); } - /// Preshower plane - int plane() const { return plane_; } + /// Preshower plane + int plane() const { return plane_; } - double et() const { return energy() / cosh(eta()); } + double et() const { return energy() / cosh(eta()); } - /// Comparisons - bool operator==(const PreshowerCluster&) const; - bool operator<(const PreshowerCluster&) const; + /// Comparisons + bool operator==(const PreshowerCluster&) const; + bool operator<(const PreshowerCluster&) const; - /// Associated basic cluster; - CaloClusterPtr basicCluster() const { return bc_ref_; } + /// Associated basic cluster; + CaloClusterPtr basicCluster() const { return bc_ref_; } - /// DetIds of component RecHits -- now inherited from CaloCluster - //std::vector getHitsByDetId() const { return usedHits_; } + /// DetIds of component RecHits -- now inherited from CaloCluster + //std::vector getHitsByDetId() const { return usedHits_; } - void setBCRef(const CaloClusterPtr& r) { bc_ref_ = r; } + void setBCRef(const CaloClusterPtr& r) { bc_ref_ = r; } - private: - int plane_; + private: + int plane_; - /// Associated basic cluster; - CaloClusterPtr bc_ref_; + /// Associated basic cluster; + CaloClusterPtr bc_ref_; - /// used hits by detId -- now inherited from CaloCluster - //std::vector usedHits_; - }; + /// used hits by detId -- now inherited from CaloCluster + //std::vector usedHits_; + }; + } // namespace io_v1 + using PreshowerCluster = io_v1::PreshowerCluster; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h b/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h index 0300ff66ca250..5c7c178577da9 100644 --- a/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h +++ b/DataFormats/EgammaReco/interface/PreshowerClusterFwd.h @@ -9,7 +9,10 @@ #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" namespace reco { - class PreshowerCluster; + namespace io_v1 { + class PreshowerCluster; + } + using PreshowerCluster = io_v1::PreshowerCluster; /// collection of PreshowerCluster objects typedef std::vector PreshowerClusterCollection; diff --git a/DataFormats/EgammaReco/interface/PreshowerClusterShape.h b/DataFormats/EgammaReco/interface/PreshowerClusterShape.h index ef72ee0791d77..d8f6e823dd090 100644 --- a/DataFormats/EgammaReco/interface/PreshowerClusterShape.h +++ b/DataFormats/EgammaReco/interface/PreshowerClusterShape.h @@ -10,39 +10,42 @@ #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" namespace reco { + namespace io_v1 { - class PreshowerClusterShape { - public: - /// default constructor - PreshowerClusterShape() {} + class PreshowerClusterShape { + public: + /// default constructor + PreshowerClusterShape() {} - virtual ~PreshowerClusterShape(); + virtual ~PreshowerClusterShape(); - /// constructor from strip energies - PreshowerClusterShape(const std::vector& stripEnergies, const int plane); + /// constructor from strip energies + PreshowerClusterShape(const std::vector& stripEnergies, const int plane); - /// Copy contructor - PreshowerClusterShape(const PreshowerClusterShape&); + /// Copy contructor + PreshowerClusterShape(const PreshowerClusterShape&); - /// Preshower plane - int plane() const { return plane_; } + /// Preshower plane + int plane() const { return plane_; } - /// Associated SuperCluster; - SuperClusterRef superCluster() const { return sc_ref_; } + /// Associated SuperCluster; + SuperClusterRef superCluster() const { return sc_ref_; } - /// Energies of component strips - virtual std::vector getStripEnergies() const { return stripEnergies_; } + /// Energies of component strips + virtual std::vector getStripEnergies() const { return stripEnergies_; } - void setSCRef(const SuperClusterRef& r) { sc_ref_ = r; } + void setSCRef(const SuperClusterRef& r) { sc_ref_ = r; } - private: - int plane_; + private: + int plane_; - /// Associated super cluster; - SuperClusterRef sc_ref_; + /// Associated super cluster; + SuperClusterRef sc_ref_; - /// used strip energies - std::vector stripEnergies_; - }; + /// used strip energies + std::vector stripEnergies_; + }; + } // namespace io_v1 + using PreshowerClusterShape = io_v1::PreshowerClusterShape; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h b/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h index 058d44464b6ce..efed326765e80 100644 --- a/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h +++ b/DataFormats/EgammaReco/interface/PreshowerClusterShapeFwd.h @@ -10,7 +10,10 @@ #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" namespace reco { - class PreshowerClusterShape; + namespace io_v1 { + class PreshowerClusterShape; + } + using PreshowerClusterShape = io_v1::PreshowerClusterShape; /// collection of PreshowerClusterShape objects typedef std::vector PreshowerClusterShapeCollection; diff --git a/DataFormats/EgammaReco/interface/SuperCluster.h b/DataFormats/EgammaReco/interface/SuperCluster.h index 738b5495a07aa..1f50fda8b484a 100644 --- a/DataFormats/EgammaReco/interface/SuperCluster.h +++ b/DataFormats/EgammaReco/interface/SuperCluster.h @@ -17,187 +17,190 @@ #include "DataFormats/EcalDetId/interface/EBDetId.h" namespace reco { - class SuperCluster : public CaloCluster { - public: - typedef math::XYZPoint Point; - - /// default constructor - SuperCluster() - : CaloCluster(0., Point(0., 0., 0.)), - preshowerEnergy_(0), - rawEnergy_(-1.), - phiWidth_(0), - etaWidth_(0), - preshowerEnergy1_(0), - preshowerEnergy2_(0) {} - - /// constructor defined by CaloCluster - will have to use setSeed and add() separately - SuperCluster(double energy, const Point& position); - - SuperCluster(double energy, - const Point& position, - const CaloClusterPtr& seed, - const CaloClusterPtrVector& clusters, - double Epreshower = 0., - double phiWidth = 0., - double etaWidth = 0., - double Epreshower1 = 0., - double Epreshower2 = 0.); - - // to be merged in the previous one? -- FIXME - SuperCluster(double energy, - const Point& position, - const CaloClusterPtr& seed, - const CaloClusterPtrVector& clusters, - const CaloClusterPtrVector& preshowerClusters, - double Epreshower = 0., - double phiWidth = 0., - double etaWidth = 0., - double Epreshower1 = 0., - double Epreshower2 = 0.); - - /// raw uncorrected energy (sum of energies of component BasicClusters) - double rawEnergy() const { return rawEnergy_; } - - /// energy deposited in preshower - double preshowerEnergy() const { return preshowerEnergy_; } - double preshowerEnergyPlane1() const { return preshowerEnergy1_; } - double preshowerEnergyPlane2() const { return preshowerEnergy2_; } - - /// obtain phi and eta width of the Super Cluster - double phiWidth() const { return phiWidth_; } - double etaWidth() const { return etaWidth_; } - - //Assign new variables to supercluster - void setPreshowerEnergy(double preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }; - void setPreshowerEnergyPlane1(double preshowerEnergy1) { preshowerEnergy1_ = preshowerEnergy1; }; - void setPreshowerEnergyPlane2(double preshowerEnergy2) { preshowerEnergy2_ = preshowerEnergy2; }; - void setPhiWidth(double pw) { phiWidth_ = pw; } - void setEtaWidth(double ew) { etaWidth_ = ew; } - - /// seed BasicCluster - const CaloClusterPtr& seed() const { return seed_; } - - /// const access to the cluster list itself - const CaloClusterPtrVector& clusters() const { return clusters_; } - - /// const access to the preshower cluster list itself - const CaloClusterPtrVector& preshowerClusters() const { return preshowerClusters_; } - - /// fist iterator over BasicCluster constituents - CaloCluster_iterator clustersBegin() const { return clusters_.begin(); } - - /// last iterator over BasicCluster constituents - CaloCluster_iterator clustersEnd() const { return clusters_.end(); } - - /// fist iterator over PreshowerCluster constituents - CaloCluster_iterator preshowerClustersBegin() const { return preshowerClusters_.begin(); } - - /// last iterator over PreshowerCluster constituents - CaloCluster_iterator preshowerClustersEnd() const { return preshowerClusters_.end(); } - - /// number of BasicCluster constituents - size_t clustersSize() const { return clusters_.size(); } - - /// number of BasicCluster PreShower constituents - size_t preshowerClustersSize() const { return preshowerClusters_.size(); } - - /// list of used xtals by DetId // now inherited by CaloCluster - //std::vector getHitsByDetId() const { return usedHits_; } - - /// set reference to seed BasicCluster - void setSeed(const CaloClusterPtr& r) { seed_ = r; } - - //(re)-set clusters - void setClusters(const CaloClusterPtrVector& clusters) { - clusters_ = clusters; - computeRawEnergy(); - } - - //(re)-set preshower clusters - void setPreshowerClusters(const CaloClusterPtrVector& clusters) { preshowerClusters_ = clusters; } - - //clear hits and fractions vector (for slimming) - void clearHitsAndFractions() { hitsAndFractions_.clear(); } - - /// add reference to constituent BasicCluster - void addCluster(const CaloClusterPtr& r) { - clusters_.push_back(r); - computeRawEnergy(); - } - - /// add reference to constituent BasicCluster - void addPreshowerCluster(const CaloClusterPtr& r) { preshowerClusters_.push_back(r); } - - /** Set preshower planes status : + namespace io_v1 { + class SuperCluster : public CaloCluster { + public: + typedef math::XYZPoint Point; + + /// default constructor + SuperCluster() + : CaloCluster(0., Point(0., 0., 0.)), + preshowerEnergy_(0), + rawEnergy_(-1.), + phiWidth_(0), + etaWidth_(0), + preshowerEnergy1_(0), + preshowerEnergy2_(0) {} + + /// constructor defined by CaloCluster - will have to use setSeed and add() separately + SuperCluster(double energy, const Point& position); + + SuperCluster(double energy, + const Point& position, + const CaloClusterPtr& seed, + const CaloClusterPtrVector& clusters, + double Epreshower = 0., + double phiWidth = 0., + double etaWidth = 0., + double Epreshower1 = 0., + double Epreshower2 = 0.); + + // to be merged in the previous one? -- FIXME + SuperCluster(double energy, + const Point& position, + const CaloClusterPtr& seed, + const CaloClusterPtrVector& clusters, + const CaloClusterPtrVector& preshowerClusters, + double Epreshower = 0., + double phiWidth = 0., + double etaWidth = 0., + double Epreshower1 = 0., + double Epreshower2 = 0.); + + /// raw uncorrected energy (sum of energies of component BasicClusters) + double rawEnergy() const { return rawEnergy_; } + + /// energy deposited in preshower + double preshowerEnergy() const { return preshowerEnergy_; } + double preshowerEnergyPlane1() const { return preshowerEnergy1_; } + double preshowerEnergyPlane2() const { return preshowerEnergy2_; } + + /// obtain phi and eta width of the Super Cluster + double phiWidth() const { return phiWidth_; } + double etaWidth() const { return etaWidth_; } + + //Assign new variables to supercluster + void setPreshowerEnergy(double preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; }; + void setPreshowerEnergyPlane1(double preshowerEnergy1) { preshowerEnergy1_ = preshowerEnergy1; }; + void setPreshowerEnergyPlane2(double preshowerEnergy2) { preshowerEnergy2_ = preshowerEnergy2; }; + void setPhiWidth(double pw) { phiWidth_ = pw; } + void setEtaWidth(double ew) { etaWidth_ = ew; } + + /// seed BasicCluster + const CaloClusterPtr& seed() const { return seed_; } + + /// const access to the cluster list itself + const CaloClusterPtrVector& clusters() const { return clusters_; } + + /// const access to the preshower cluster list itself + const CaloClusterPtrVector& preshowerClusters() const { return preshowerClusters_; } + + /// fist iterator over BasicCluster constituents + CaloCluster_iterator clustersBegin() const { return clusters_.begin(); } + + /// last iterator over BasicCluster constituents + CaloCluster_iterator clustersEnd() const { return clusters_.end(); } + + /// fist iterator over PreshowerCluster constituents + CaloCluster_iterator preshowerClustersBegin() const { return preshowerClusters_.begin(); } + + /// last iterator over PreshowerCluster constituents + CaloCluster_iterator preshowerClustersEnd() const { return preshowerClusters_.end(); } + + /// number of BasicCluster constituents + size_t clustersSize() const { return clusters_.size(); } + + /// number of BasicCluster PreShower constituents + size_t preshowerClustersSize() const { return preshowerClusters_.size(); } + + /// list of used xtals by DetId // now inherited by CaloCluster + //std::vector getHitsByDetId() const { return usedHits_; } + + /// set reference to seed BasicCluster + void setSeed(const CaloClusterPtr& r) { seed_ = r; } + + //(re)-set clusters + void setClusters(const CaloClusterPtrVector& clusters) { + clusters_ = clusters; + computeRawEnergy(); + } + + //(re)-set preshower clusters + void setPreshowerClusters(const CaloClusterPtrVector& clusters) { preshowerClusters_ = clusters; } + + //clear hits and fractions vector (for slimming) + void clearHitsAndFractions() { hitsAndFractions_.clear(); } + + /// add reference to constituent BasicCluster + void addCluster(const CaloClusterPtr& r) { + clusters_.push_back(r); + computeRawEnergy(); + } + + /// add reference to constituent BasicCluster + void addPreshowerCluster(const CaloClusterPtr& r) { preshowerClusters_.push_back(r); } + + /** Set preshower planes status : 0 : both planes working 1 : only first plane working 2 : only second plane working 3 : both planes dead */ - void setPreshowerPlanesStatus(const uint32_t& status) { - uint32_t flags = flags_ & flagsMask_; - flags_ = flags | (status << flagsOffset_); - } + void setPreshowerPlanesStatus(const uint32_t& status) { + uint32_t flags = flags_ & flagsMask_; + flags_ = flags | (status << flagsOffset_); + } - /** Get preshower planes status : + /** Get preshower planes status : 0 : both planes working 1 : only first plane working 2 : only second plane working 3 : both planes dead */ - const int getPreshowerPlanesStatus() const { return (flags_ >> flagsOffset_); } - - const int seedCrysIEtaOrIx() const { - auto detid = seed_->seed(); - int ietaorix = 0; - if (detid.subdetId() == EcalBarrel) { - EBDetId ebdetid(detid); - ietaorix = ebdetid.ieta(); - } else if (detid.subdetId() == EcalEndcap) { - EEDetId eedetid(detid); - ietaorix = eedetid.ix(); + const int getPreshowerPlanesStatus() const { return (flags_ >> flagsOffset_); } + + const int seedCrysIEtaOrIx() const { + auto detid = seed_->seed(); + int ietaorix = 0; + if (detid.subdetId() == EcalBarrel) { + EBDetId ebdetid(detid); + ietaorix = ebdetid.ieta(); + } else if (detid.subdetId() == EcalEndcap) { + EEDetId eedetid(detid); + ietaorix = eedetid.ix(); + } + return ietaorix; } - return ietaorix; - } - - const int seedCrysIPhiOrIy() const { - auto detid = seed_->seed(); - int iphioriy = 0; - if (detid.subdetId() == EcalBarrel) { - EBDetId ebdetid(detid); - iphioriy = ebdetid.iphi(); - } else if (detid.subdetId() == EcalEndcap) { - EEDetId eedetid(detid); - iphioriy = eedetid.iy(); + + const int seedCrysIPhiOrIy() const { + auto detid = seed_->seed(); + int iphioriy = 0; + if (detid.subdetId() == EcalBarrel) { + EBDetId ebdetid(detid); + iphioriy = ebdetid.iphi(); + } else if (detid.subdetId() == EcalEndcap) { + EEDetId eedetid(detid); + iphioriy = eedetid.iy(); + } + return iphioriy; } - return iphioriy; - } - private: - void computeRawEnergy(); + private: + void computeRawEnergy(); - /// reference to BasicCluster seed - CaloClusterPtr seed_; + /// reference to BasicCluster seed + CaloClusterPtr seed_; - /// references to BasicCluster constitunets - CaloClusterPtrVector clusters_; + /// references to BasicCluster constitunets + CaloClusterPtrVector clusters_; - /// references to BasicCluster constitunets - CaloClusterPtrVector preshowerClusters_; + /// references to BasicCluster constitunets + CaloClusterPtrVector preshowerClusters_; - /// used hits by detId - retrieved from BC constituents -- now inherited from CaloCluster - //std::vector usedHits_; + /// used hits by detId - retrieved from BC constituents -- now inherited from CaloCluster + //std::vector usedHits_; - double preshowerEnergy_; + double preshowerEnergy_; - double rawEnergy_; + double rawEnergy_; - double phiWidth_; - double etaWidth_; + double phiWidth_; + double etaWidth_; - double preshowerEnergy1_; - double preshowerEnergy2_; - }; + double preshowerEnergy1_; + double preshowerEnergy2_; + }; + } // namespace io_v1 + using SuperCluster = io_v1::SuperCluster; } // namespace reco #endif diff --git a/DataFormats/EgammaReco/interface/SuperClusterFwd.h b/DataFormats/EgammaReco/interface/SuperClusterFwd.h index 0d47af5f0c183..94a5cb87906ff 100644 --- a/DataFormats/EgammaReco/interface/SuperClusterFwd.h +++ b/DataFormats/EgammaReco/interface/SuperClusterFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class SuperCluster; + namespace io_v1 { + class SuperCluster; + } + using SuperCluster = io_v1::SuperCluster; /// collection of SuperCluser objectr typedef std::vector SuperClusterCollection; diff --git a/DataFormats/EgammaReco/src/classes_def.xml b/DataFormats/EgammaReco/src/classes_def.xml index 1da78ca4d821b..781a233719119 100644 --- a/DataFormats/EgammaReco/src/classes_def.xml +++ b/DataFormats/EgammaReco/src/classes_def.xml @@ -1,12 +1,12 @@ - - - + + + - - - + + + @@ -17,33 +17,27 @@ - - - - - - - + + - - - - - - - - - - + + + + + + + + + + - - - + + @@ -72,94 +66,84 @@ - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + - - recHits());]]> - - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + - - + + - + - - + + - - + + - - + + - - + + - - + + diff --git a/DataFormats/FEDRawData/src/classes_def.xml b/DataFormats/FEDRawData/src/classes_def.xml index 8c3dda39517db..cdf24beb18e11 100644 --- a/DataFormats/FEDRawData/src/classes_def.xml +++ b/DataFormats/FEDRawData/src/classes_def.xml @@ -8,22 +8,20 @@ - - + + - - - + + - - - + + - - + + - - + + diff --git a/DataFormats/FTLDigi/interface/BTLSample.h b/DataFormats/FTLDigi/interface/BTLSample.h index 0f97075ae64e6..ce306e70e35f6 100644 --- a/DataFormats/FTLDigi/interface/BTLSample.h +++ b/DataFormats/FTLDigi/interface/BTLSample.h @@ -9,80 +9,81 @@ @class BTLSample @short wrapper for a data word */ +namespace io_v1 { + class BTLSample { + public: + enum BTLSampleDataMasks { kToA2Mask = 0x3ff, kToAMask = 0x3ff, kDataMask = 0x3ff }; + enum BTLSampleDataShifts { kToA2Shift = 20, kToAShift = 10, kDataShift = 0 }; -class BTLSample { -public: - enum BTLSampleDataMasks { kToA2Mask = 0x3ff, kToAMask = 0x3ff, kDataMask = 0x3ff }; - enum BTLSampleDataShifts { kToA2Shift = 20, kToAShift = 10, kDataShift = 0 }; + enum BTLSampleFlagMasks { kThreshMask = 0x1, kModeMask = 0x1 }; + enum BTLSampleFlagShifts { kThreshShift = 1, kModeShift = 0 }; - enum BTLSampleFlagMasks { kThreshMask = 0x1, kModeMask = 0x1 }; - enum BTLSampleFlagShifts { kThreshShift = 1, kModeShift = 0 }; - - /** + /** @short CTOR */ - BTLSample() : value_(0), flag_(0), row_(0), col_(0) {} - BTLSample(uint32_t value, uint16_t flag, uint8_t row, uint8_t col) - : value_(value), flag_(flag), row_(row), col_(col) {} - BTLSample(const BTLSample& o) : value_(o.value_), flag_(o.flag_), row_(o.row_), col_(o.col_) {} - BTLSample& operator=(const BTLSample&) = default; + BTLSample() : value_(0), flag_(0), row_(0), col_(0) {} + BTLSample(uint32_t value, uint16_t flag, uint8_t row, uint8_t col) + : value_(value), flag_(flag), row_(row), col_(col) {} + BTLSample(const BTLSample& o) : value_(o.value_), flag_(o.flag_), row_(o.row_), col_(o.col_) {} + BTLSample& operator=(const BTLSample&) = default; - /** + /** @short setters */ - void setThreshold(bool thr) { setFlagWord(thr, kThreshMask, kThreshShift); } - void setMode(bool mode) { setFlagWord(mode, kModeMask, kModeShift); } - void setToA(uint16_t toa) { setDataWord(toa, kToAMask, kToAShift); } - void setToA2(uint16_t toa2) { setDataWord(toa2, kToA2Mask, kToA2Shift); } - void setData(uint16_t data) { setDataWord(data, kDataMask, kDataShift); } - void set(bool thr, bool mode, uint16_t toa2, uint16_t toa, uint16_t data, uint8_t row, uint8_t col) { - flag_ = (((uint16_t)thr & kThreshMask) << kThreshShift | ((uint16_t)mode & kModeMask) << kModeShift); + void setThreshold(bool thr) { setFlagWord(thr, kThreshMask, kThreshShift); } + void setMode(bool mode) { setFlagWord(mode, kModeMask, kModeShift); } + void setToA(uint16_t toa) { setDataWord(toa, kToAMask, kToAShift); } + void setToA2(uint16_t toa2) { setDataWord(toa2, kToA2Mask, kToA2Shift); } + void setData(uint16_t data) { setDataWord(data, kDataMask, kDataShift); } + void set(bool thr, bool mode, uint16_t toa2, uint16_t toa, uint16_t data, uint8_t row, uint8_t col) { + flag_ = (((uint16_t)thr & kThreshMask) << kThreshShift | ((uint16_t)mode & kModeMask) << kModeShift); - value_ = (((uint32_t)toa2 & kToA2Mask) << kToA2Shift | ((uint32_t)toa & kToAMask) << kToAShift | - ((uint32_t)data & kDataMask) << kDataShift); - row_ = row; - col_ = col; - } - void print(std::ostream& out = std::cout) { - out << "THR: " << threshold() << " Mode: " << mode() << " ToA2: " << toa2() << " ToA: " << toa() - << " Data: " << data() << " Row: " << (uint32_t)row() << " Column: " << (uint32_t)column() << " Raw Flag=0x" - << std::hex << raw_flag() << std::dec << " Raw Data=0x" << std::hex << raw_data() << std::dec << std::endl; - } + value_ = (((uint32_t)toa2 & kToA2Mask) << kToA2Shift | ((uint32_t)toa & kToAMask) << kToAShift | + ((uint32_t)data & kDataMask) << kDataShift); + row_ = row; + col_ = col; + } + void print(std::ostream& out = std::cout) { + out << "THR: " << threshold() << " Mode: " << mode() << " ToA2: " << toa2() << " ToA: " << toa() + << " Data: " << data() << " Row: " << (uint32_t)row() << " Column: " << (uint32_t)column() << " Raw Flag=0x" + << std::hex << raw_flag() << std::dec << " Raw Data=0x" << std::hex << raw_data() << std::dec << std::endl; + } - /** + /** @short getters */ - uint32_t raw_data() const { return value_; } - uint16_t raw_flag() const { return flag_; } - bool threshold() const { return ((flag_ >> kThreshShift) & kThreshMask); } - bool mode() const { return ((flag_ >> kModeShift) & kModeMask); } - uint32_t toa() const { return ((value_ >> kToAShift) & kToAMask); } - uint32_t toa2() const { return ((value_ >> kToA2Shift) & kToA2Mask); } - uint32_t data() const { return ((value_ >> kDataShift) & kDataMask); } - uint8_t row() const { return row_; } - uint8_t column() const { return col_; } + uint32_t raw_data() const { return value_; } + uint16_t raw_flag() const { return flag_; } + bool threshold() const { return ((flag_ >> kThreshShift) & kThreshMask); } + bool mode() const { return ((flag_ >> kModeShift) & kModeMask); } + uint32_t toa() const { return ((value_ >> kToAShift) & kToAMask); } + uint32_t toa2() const { return ((value_ >> kToA2Shift) & kToA2Mask); } + uint32_t data() const { return ((value_ >> kDataShift) & kDataMask); } + uint8_t row() const { return row_; } + uint8_t column() const { return col_; } -private: - /** + private: + /** @short wrapper to reset words at a given position */ - void setDataWord(uint32_t word, uint32_t mask, uint32_t pos) { - //clear required bits - value_ &= ~(mask << pos); - //now set the new value - value_ |= ((word & mask) << pos); - } - void setFlagWord(uint16_t word, uint16_t mask, uint16_t pos) { - //clear required bits - flag_ &= ~(mask << pos); - //now set the new value - flag_ |= ((word & mask) << pos); - } - - // bit-words for data and flags - uint32_t value_; - uint16_t flag_; - uint8_t row_, col_; -}; + void setDataWord(uint32_t word, uint32_t mask, uint32_t pos) { + //clear required bits + value_ &= ~(mask << pos); + //now set the new value + value_ |= ((word & mask) << pos); + } + void setFlagWord(uint16_t word, uint16_t mask, uint16_t pos) { + //clear required bits + flag_ &= ~(mask << pos); + //now set the new value + flag_ |= ((word & mask) << pos); + } + // bit-words for data and flags + uint32_t value_; + uint16_t flag_; + uint8_t row_, col_; + }; +} // namespace io_v1 +using BTLSample = io_v1::BTLSample; #endif diff --git a/DataFormats/FTLDigi/interface/ETLSample.h b/DataFormats/FTLDigi/interface/ETLSample.h index 849f43e91d497..0ab790ddb999c 100644 --- a/DataFormats/FTLDigi/interface/ETLSample.h +++ b/DataFormats/FTLDigi/interface/ETLSample.h @@ -9,93 +9,94 @@ @class ETLSample @short wrapper for a data word */ +namespace io_v1 { + class ETLSample { + public: + enum ETLSampleMasks { + kThreshMask = 0x1, + kModeMask = 0x1, + kColumnMask = 0x1f, + kRowMask = 0x3f, + kToAMask = 0x7ff, + kDataMask = 0xff, + kToTMask = 0x7ff + }; + enum ETLSampleShifts { + kThreshShift = 31, + kModeShift = 30, + kColumnShift = 25, + kRowShift = 19, + kToAShift = 8, + kDataShift = 0, + kToTShift = 0 + }; -class ETLSample { -public: - enum ETLSampleMasks { - kThreshMask = 0x1, - kModeMask = 0x1, - kColumnMask = 0x1f, - kRowMask = 0x3f, - kToAMask = 0x7ff, - kDataMask = 0xff, - kToTMask = 0x7ff - }; - enum ETLSampleShifts { - kThreshShift = 31, - kModeShift = 30, - kColumnShift = 25, - kRowShift = 19, - kToAShift = 8, - kDataShift = 0, - kToTShift = 0 - }; - - /** + /** @short CTOR */ - ETLSample() : value_(0), valueToT_(0) {} - ETLSample(uint32_t value) : value_(value), valueToT_(0) {} - ETLSample(uint32_t value, uint32_t valueToT) : value_(value), valueToT_(valueToT) {} - ETLSample(const ETLSample& o) : value_(o.value_), valueToT_(o.valueToT_) {} - ETLSample& operator=(const ETLSample&) = default; + ETLSample() : value_(0), valueToT_(0) {} + ETLSample(uint32_t value) : value_(value), valueToT_(0) {} + ETLSample(uint32_t value, uint32_t valueToT) : value_(value), valueToT_(valueToT) {} + ETLSample(const ETLSample& o) : value_(o.value_), valueToT_(o.valueToT_) {} + ETLSample& operator=(const ETLSample&) = default; - /** + /** @short setters */ - void setThreshold(bool thr) { setWord(thr, kThreshMask, kThreshShift); } - void setMode(bool mode) { setWord(mode, kModeMask, kModeShift); } - void setColumn(uint8_t col) { setWord(col, kColumnMask, kColumnShift); } - void setRow(uint8_t row) { setWord(row, kRowMask, kRowShift); } - void setToA(uint16_t toa) { setWord(toa, kToAMask, kToAShift); } - void setToT(uint16_t tot) { setWordToT(tot, kToTMask, kToTShift); } - void setData(uint16_t data) { setWord(data, kDataMask, kDataShift); } - void set(bool thr, bool mode, uint16_t toa, uint16_t tot, uint16_t data, uint8_t row, uint8_t col) { - value_ = (((uint32_t)thr & kThreshMask) << kThreshShift | ((uint32_t)mode & kModeMask) << kModeShift | - ((uint32_t)col & kColumnMask) << kColumnShift | ((uint32_t)row & kRowMask) << kRowShift | - ((uint32_t)toa & kToAMask) << kToAShift | ((uint32_t)data & kDataMask) << kDataShift); - valueToT_ = ((uint32_t)tot & kToTMask) << kToTShift; - } - void print(std::ostream& out = std::cout) { - out << "(row,col) : (" << row() << ',' << column() << ") " - << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " ToT: " << tot() - << " Data: " << data() << " Raw=0x" << std::hex << raw() << std::dec << std::endl; - } + void setThreshold(bool thr) { setWord(thr, kThreshMask, kThreshShift); } + void setMode(bool mode) { setWord(mode, kModeMask, kModeShift); } + void setColumn(uint8_t col) { setWord(col, kColumnMask, kColumnShift); } + void setRow(uint8_t row) { setWord(row, kRowMask, kRowShift); } + void setToA(uint16_t toa) { setWord(toa, kToAMask, kToAShift); } + void setToT(uint16_t tot) { setWordToT(tot, kToTMask, kToTShift); } + void setData(uint16_t data) { setWord(data, kDataMask, kDataShift); } + void set(bool thr, bool mode, uint16_t toa, uint16_t tot, uint16_t data, uint8_t row, uint8_t col) { + value_ = (((uint32_t)thr & kThreshMask) << kThreshShift | ((uint32_t)mode & kModeMask) << kModeShift | + ((uint32_t)col & kColumnMask) << kColumnShift | ((uint32_t)row & kRowMask) << kRowShift | + ((uint32_t)toa & kToAMask) << kToAShift | ((uint32_t)data & kDataMask) << kDataShift); + valueToT_ = ((uint32_t)tot & kToTMask) << kToTShift; + } + void print(std::ostream& out = std::cout) { + out << "(row,col) : (" << row() << ',' << column() << ") " + << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " ToT: " << tot() + << " Data: " << data() << " Raw=0x" << std::hex << raw() << std::dec << std::endl; + } - /** + /** @short getters */ - uint32_t raw() const { return value_; } - bool threshold() const { return ((value_ >> kThreshShift) & kThreshMask); } - bool mode() const { return ((value_ >> kModeShift) & kModeMask); } - uint32_t column() const { return ((value_ >> kColumnShift) & kColumnMask); } - uint32_t row() const { return ((value_ >> kRowShift) & kRowMask); } - uint32_t toa() const { return ((value_ >> kToAShift) & kToAMask); } - uint32_t tot() const { return ((valueToT_ >> kToTShift) & kToTMask); } - uint32_t data() const { return ((value_ >> kDataShift) & kDataMask); } - uint32_t operator()() { return value_; } + uint32_t raw() const { return value_; } + bool threshold() const { return ((value_ >> kThreshShift) & kThreshMask); } + bool mode() const { return ((value_ >> kModeShift) & kModeMask); } + uint32_t column() const { return ((value_ >> kColumnShift) & kColumnMask); } + uint32_t row() const { return ((value_ >> kRowShift) & kRowMask); } + uint32_t toa() const { return ((value_ >> kToAShift) & kToAMask); } + uint32_t tot() const { return ((valueToT_ >> kToTShift) & kToTMask); } + uint32_t data() const { return ((value_ >> kDataShift) & kDataMask); } + uint32_t operator()() { return value_; } -private: - /** + private: + /** @short wrapper to reset words at a given position */ - void setWord(uint32_t word, uint32_t mask, uint32_t pos) { - //clear required bits - value_ &= ~(mask << pos); - //now set the new value - value_ |= ((word & mask) << pos); - } + void setWord(uint32_t word, uint32_t mask, uint32_t pos) { + //clear required bits + value_ &= ~(mask << pos); + //now set the new value + value_ |= ((word & mask) << pos); + } - void setWordToT(uint32_t word, uint32_t mask, uint32_t pos) { - //clear required bits - valueToT_ &= ~(mask << pos); - //now set the new value - valueToT_ |= ((word & mask) << pos); - } - - // a 32-bit word - uint32_t value_; - uint32_t valueToT_; -}; + void setWordToT(uint32_t word, uint32_t mask, uint32_t pos) { + //clear required bits + valueToT_ &= ~(mask << pos); + //now set the new value + valueToT_ |= ((word & mask) << pos); + } + // a 32-bit word + uint32_t value_; + uint32_t valueToT_; + }; +} // namespace io_v1 +using ETLSample = io_v1::ETLSample; #endif diff --git a/DataFormats/FTLDigi/interface/PMTDSimAccumulator.h b/DataFormats/FTLDigi/interface/PMTDSimAccumulator.h index 6f4cad64c3f93..df380ae5a7b49 100644 --- a/DataFormats/FTLDigi/interface/PMTDSimAccumulator.h +++ b/DataFormats/FTLDigi/interface/PMTDSimAccumulator.h @@ -6,149 +6,152 @@ #include #include -class PMTDSimAccumulator { -public: - // These two structs are public only because of dictionary generation - class DetIdSize { +namespace io_v1 { + class PMTDSimAccumulator { public: - DetIdSize() {} - DetIdSize(unsigned int detId, unsigned char row, unsigned char col) : detId_(detId), row_(row), column_(col) {} - - void increaseSize() { ++size_; } - - unsigned int detId() const { return detId_; } - unsigned char row() const { return row_; } - unsigned char column() const { return column_; } - unsigned int size() const { return size_; } - - private: - unsigned int detId_ = 0; - unsigned char row_ = 0; - unsigned char column_ = 0; - unsigned char size_ = 0; - }; - class Data { - public: - constexpr static unsigned energyOffset = 4; - constexpr static unsigned energyMask = 0x3; - constexpr static unsigned sampleMask = 0xf; - constexpr static unsigned dataMask = 0xffff; - - Data() : data_(0), indices_(0) {} - Data(unsigned short ei, unsigned short si, unsigned short d) : data_(d), indices_((ei << energyOffset) | si) {} - - unsigned int energyIndex() const { return indices_ >> energyOffset; } - unsigned int sampleIndex() const { return indices_ & sampleMask; } - unsigned int data() const { return data_ & dataMask; } - - private: - unsigned short data_; - unsigned char indices_; - }; - - PMTDSimAccumulator() = default; - ~PMTDSimAccumulator() = default; - - void reserve(size_t size) { - detIdSize_.reserve(size); - data_.reserve(size); - } + // These two structs are public only because of dictionary generation + class DetIdSize { + public: + DetIdSize() {} + DetIdSize(unsigned int detId, unsigned char row, unsigned char col) : detId_(detId), row_(row), column_(col) {} + + void increaseSize() { ++size_; } + + unsigned int detId() const { return detId_; } + unsigned char row() const { return row_; } + unsigned char column() const { return column_; } + unsigned int size() const { return size_; } + + private: + unsigned int detId_ = 0; + unsigned char row_ = 0; + unsigned char column_ = 0; + unsigned char size_ = 0; + }; + class Data { + public: + constexpr static unsigned energyOffset = 4; + constexpr static unsigned energyMask = 0x3; + constexpr static unsigned sampleMask = 0xf; + constexpr static unsigned dataMask = 0xffff; + + Data() : data_(0), indices_(0) {} + Data(unsigned short ei, unsigned short si, unsigned short d) : data_(d), indices_((ei << energyOffset) | si) {} + + unsigned int energyIndex() const { return indices_ >> energyOffset; } + unsigned int sampleIndex() const { return indices_ & sampleMask; } + unsigned int data() const { return data_ & dataMask; } + + private: + unsigned short data_; + unsigned char indices_; + }; + + PMTDSimAccumulator() = default; + ~PMTDSimAccumulator() = default; + + void reserve(size_t size) { + detIdSize_.reserve(size); + data_.reserve(size); + } - void shrink_to_fit() { - detIdSize_.shrink_to_fit(); - data_.shrink_to_fit(); - } + void shrink_to_fit() { + detIdSize_.shrink_to_fit(); + data_.shrink_to_fit(); + } - /** + /** * Adds data for a given detId, energyIndex, and sampleIndex. * * It is the caller's responsibility to ensure that energyIndex, * sampleIndex, and data fit in the space reserved for them in the * Data bitfield above. */ - void emplace_back(unsigned int detId, - unsigned char row, - unsigned char column, - unsigned short energyIndex, - unsigned short sampleIndex, - unsigned short data) { - if (detIdSize_.empty() || detIdSize_.back().detId() != detId || detIdSize_.back().row() != row || - detIdSize_.back().column() != column) { - detIdSize_.emplace_back(detId, row, column); + void emplace_back(unsigned int detId, + unsigned char row, + unsigned char column, + unsigned short energyIndex, + unsigned short sampleIndex, + unsigned short data) { + if (detIdSize_.empty() || detIdSize_.back().detId() != detId || detIdSize_.back().row() != row || + detIdSize_.back().column() != column) { + detIdSize_.emplace_back(detId, row, column); + } + data_.emplace_back(energyIndex, sampleIndex, data); + detIdSize_.back().increaseSize(); } - data_.emplace_back(energyIndex, sampleIndex, data); - detIdSize_.back().increaseSize(); - } - class TmpElem { - public: - TmpElem(unsigned int detId, unsigned char row, unsigned char column, Data data) - : detId_(detId), data_(data), row_(row), column_(column) {} - - unsigned int detId() const { return detId_; } - unsigned char row() const { return row_; } - unsigned char column() const { return column_; } - unsigned short energyIndex() const { return data_.energyIndex(); } - unsigned short sampleIndex() const { return data_.sampleIndex(); } - unsigned short data() const { return data_.data(); } + class TmpElem { + public: + TmpElem(unsigned int detId, unsigned char row, unsigned char column, Data data) + : detId_(detId), data_(data), row_(row), column_(column) {} + + unsigned int detId() const { return detId_; } + unsigned char row() const { return row_; } + unsigned char column() const { return column_; } + unsigned short energyIndex() const { return data_.energyIndex(); } + unsigned short sampleIndex() const { return data_.sampleIndex(); } + unsigned short data() const { return data_.data(); } + + private: + unsigned int detId_; + Data data_; + unsigned char row_; + unsigned char column_; + }; + + class const_iterator { + public: + // begin + const_iterator(const PMTDSimAccumulator* acc) + : acc_(acc), iDet_(0), iData_(0), endData_(acc->detIdSize_.empty() ? 0 : acc->detIdSize_.front().size()) {} + + // end + const_iterator(const PMTDSimAccumulator* acc, unsigned int detSize, unsigned int dataSize) + : acc_(acc), iDet_(detSize), iData_(dataSize), endData_(0) {} + + bool operator==(const const_iterator& other) const { return iDet_ == other.iDet_ && iData_ == other.iData_; } + bool operator!=(const const_iterator& other) const { return !operator==(other); } + const_iterator& operator++() { + ++iData_; + if (iData_ == endData_) { + ++iDet_; + endData_ += (iDet_ == acc_->detIdSize_.size()) ? 0 : acc_->detIdSize_[iDet_].size(); + } + return *this; + } + const_iterator operator++(int) { + auto tmp = *this; + ++(*this); + return tmp; + } + TmpElem operator*() { + const auto& id = acc_->detIdSize_[iDet_]; + return TmpElem(id.detId(), id.row(), id.column(), acc_->data_[iData_]); + } - private: - unsigned int detId_; - Data data_; - unsigned char row_; - unsigned char column_; - }; + private: + const PMTDSimAccumulator* acc_; + unsigned int iDet_; + unsigned int iData_; + unsigned int endData_; + }; - class const_iterator { - public: - // begin - const_iterator(const PMTDSimAccumulator* acc) - : acc_(acc), iDet_(0), iData_(0), endData_(acc->detIdSize_.empty() ? 0 : acc->detIdSize_.front().size()) {} - - // end - const_iterator(const PMTDSimAccumulator* acc, unsigned int detSize, unsigned int dataSize) - : acc_(acc), iDet_(detSize), iData_(dataSize), endData_(0) {} - - bool operator==(const const_iterator& other) const { return iDet_ == other.iDet_ && iData_ == other.iData_; } - bool operator!=(const const_iterator& other) const { return !operator==(other); } - const_iterator& operator++() { - ++iData_; - if (iData_ == endData_) { - ++iDet_; - endData_ += (iDet_ == acc_->detIdSize_.size()) ? 0 : acc_->detIdSize_[iDet_].size(); - } - return *this; - } - const_iterator operator++(int) { - auto tmp = *this; - ++(*this); - return tmp; - } - TmpElem operator*() { - const auto& id = acc_->detIdSize_[iDet_]; - return TmpElem(id.detId(), id.row(), id.column(), acc_->data_[iData_]); + TmpElem back() const { + const auto& id = detIdSize_.back(); + return TmpElem(id.detId(), id.row(), id.column(), data_.back()); } + const_iterator cbegin() const { return const_iterator(this); } + const_iterator begin() const { return cbegin(); } + const_iterator cend() const { return const_iterator(this, detIdSize_.size(), data_.size()); } + const_iterator end() const { return cend(); } + private: - const PMTDSimAccumulator* acc_; - unsigned int iDet_; - unsigned int iData_; - unsigned int endData_; + std::vector detIdSize_; + std::vector data_; }; - - TmpElem back() const { - const auto& id = detIdSize_.back(); - return TmpElem(id.detId(), id.row(), id.column(), data_.back()); - } - - const_iterator cbegin() const { return const_iterator(this); } - const_iterator begin() const { return cbegin(); } - const_iterator cend() const { return const_iterator(this, detIdSize_.size(), data_.size()); } - const_iterator end() const { return cend(); } - -private: - std::vector detIdSize_; - std::vector data_; -}; +} // namespace io_v1 +using PMTDSimAccumulator = io_v1::PMTDSimAccumulator; #endif diff --git a/DataFormats/FTLDigi/src/classes_def.xml b/DataFormats/FTLDigi/src/classes_def.xml index 97670b805850c..d550e794c63b0 100644 --- a/DataFormats/FTLDigi/src/classes_def.xml +++ b/DataFormats/FTLDigi/src/classes_def.xml @@ -5,13 +5,14 @@ - + + + - - - + + - + @@ -21,10 +22,16 @@ - - - - - - + + + + + + + + + + + + diff --git a/DataFormats/FTLRecHit/interface/FTLCluster.h b/DataFormats/FTLRecHit/interface/FTLCluster.h index 473a856dd1498..67fa515ee0864 100644 --- a/DataFormats/FTLRecHit/interface/FTLCluster.h +++ b/DataFormats/FTLRecHit/interface/FTLCluster.h @@ -17,276 +17,278 @@ #include "DataFormats/DetId/interface/DetId.h" -class FTLCluster { -public: - typedef DetId key_type; - - class FTLHit { +namespace io_v1 { + class FTLCluster { public: - constexpr FTLHit() : x_(0), y_(0), energy_(0), time_(0), time_error_(0) {} - constexpr FTLHit(uint16_t hit_x, uint16_t hit_y, float hit_energy, float hit_time, float hit_time_error) - : x_(hit_x), y_(hit_y), energy_(hit_energy), time_(hit_time), time_error_(hit_time_error) {} - constexpr uint16_t x() { return x_; } - constexpr uint16_t y() { return y_; } - constexpr uint16_t energy() { return energy_; } - constexpr uint16_t time() { return time_; } - constexpr uint16_t time_error() { return time_error_; } - - private: - uint16_t x_; //row - uint16_t y_; //col - float energy_; - float time_; - float time_error_; - }; - - //--- Integer shift in x and y directions. - class Shift { - public: - constexpr Shift(int dx, int dy) : dx_(dx), dy_(dy) {} - constexpr Shift() : dx_(0), dy_(0) {} - constexpr int dx() const { return dx_; } - constexpr int dy() const { return dy_; } + typedef DetId key_type; + + class FTLHit { + public: + constexpr FTLHit() : x_(0), y_(0), energy_(0), time_(0), time_error_(0) {} + constexpr FTLHit(uint16_t hit_x, uint16_t hit_y, float hit_energy, float hit_time, float hit_time_error) + : x_(hit_x), y_(hit_y), energy_(hit_energy), time_(hit_time), time_error_(hit_time_error) {} + constexpr uint16_t x() { return x_; } + constexpr uint16_t y() { return y_; } + constexpr uint16_t energy() { return energy_; } + constexpr uint16_t time() { return time_; } + constexpr uint16_t time_error() { return time_error_; } + + private: + uint16_t x_; //row + uint16_t y_; //col + float energy_; + float time_; + float time_error_; + }; - private: - int dx_; - int dy_; - }; + //--- Integer shift in x and y directions. + class Shift { + public: + constexpr Shift(int dx, int dy) : dx_(dx), dy_(dy) {} + constexpr Shift() : dx_(0), dy_(0) {} + constexpr int dx() const { return dx_; } + constexpr int dy() const { return dy_; } + + private: + int dx_; + int dy_; + }; - //--- Position of a FTL Hit - class FTLHitPos { - public: - constexpr FTLHitPos() : row_(0), col_(0) {} - constexpr FTLHitPos(int row, int col) : row_(row), col_(col) {} - constexpr int row() const { return row_; } - constexpr int col() const { return col_; } - constexpr FTLHitPos operator+(const Shift& shift) const { - return FTLHitPos(row() + shift.dx(), col() + shift.dy()); - } + //--- Position of a FTL Hit + class FTLHitPos { + public: + constexpr FTLHitPos() : row_(0), col_(0) {} + constexpr FTLHitPos(int row, int col) : row_(row), col_(col) {} + constexpr int row() const { return row_; } + constexpr int col() const { return col_; } + constexpr FTLHitPos operator+(const Shift& shift) const { + return FTLHitPos(row() + shift.dx(), col() + shift.dy()); + } - private: - int row_; - int col_; - }; + private: + int row_; + int col_; + }; - static constexpr unsigned int MAXSPAN = 255; - static constexpr unsigned int MAXPOS = 2047; + static constexpr unsigned int MAXSPAN = 255; + static constexpr unsigned int MAXPOS = 2047; - /** Construct from a range of digis that form a cluster and from + /** Construct from a range of digis that form a cluster and from * a DetID. The range is assumed to be non-empty. */ - FTLCluster() {} - - FTLCluster(DetId id, - unsigned int isize, - float const* energys, - float const* times, - float const* time_errors, - uint16_t const* xpos, - uint16_t const* ypos, - uint16_t const xmin, - uint16_t const ymin) - : theid(id), - theHitOffset(2 * isize), - theHitENERGY(energys, energys + isize), - theHitTIME(times, times + isize), - theHitTIME_ERROR(time_errors, time_errors + isize) { - uint16_t maxCol = 0; - uint16_t maxRow = 0; - int maxHit = -1; - float maxEnergy = -99999; - for (unsigned int i = 0; i != isize; ++i) { - uint16_t xoffset = xpos[i] - xmin; - uint16_t yoffset = ypos[i] - ymin; - theHitOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset); - theHitOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset); - if (xoffset > maxRow) - maxRow = xoffset; - if (yoffset > maxCol) - maxCol = yoffset; - if (theHitENERGY[i] > maxEnergy) { - maxHit = i; - maxEnergy = theHitENERGY[i]; + FTLCluster() {} + + FTLCluster(DetId id, + unsigned int isize, + float const* energys, + float const* times, + float const* time_errors, + uint16_t const* xpos, + uint16_t const* ypos, + uint16_t const xmin, + uint16_t const ymin) + : theid(id), + theHitOffset(2 * isize), + theHitENERGY(energys, energys + isize), + theHitTIME(times, times + isize), + theHitTIME_ERROR(time_errors, time_errors + isize) { + uint16_t maxCol = 0; + uint16_t maxRow = 0; + int maxHit = -1; + float maxEnergy = -99999; + for (unsigned int i = 0; i != isize; ++i) { + uint16_t xoffset = xpos[i] - xmin; + uint16_t yoffset = ypos[i] - ymin; + theHitOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset); + theHitOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset); + if (xoffset > maxRow) + maxRow = xoffset; + if (yoffset > maxCol) + maxCol = yoffset; + if (theHitENERGY[i] > maxEnergy) { + maxHit = i; + maxEnergy = theHitENERGY[i]; + } } + packRow(xmin, maxRow); + packCol(ymin, maxCol); + + if (maxHit >= 0) + seed_ = std::min(uint8_t(MAXSPAN), uint8_t(maxHit)); } - packRow(xmin, maxRow); - packCol(ymin, maxCol); - if (maxHit >= 0) - seed_ = std::min(uint8_t(MAXSPAN), uint8_t(maxHit)); - } + // linear average position (barycenter) + inline float x() const { + auto x_pos = [this](unsigned int i) { return this->theHitOffset[i * 2] + minHitRow(); }; + return weighted_mean(this->theHitENERGY, x_pos); + } - // linear average position (barycenter) - inline float x() const { - auto x_pos = [this](unsigned int i) { return this->theHitOffset[i * 2] + minHitRow(); }; - return weighted_mean(this->theHitENERGY, x_pos); - } + inline float y() const { + auto y_pos = [this](unsigned int i) { return this->theHitOffset[i * 2 + 1] + minHitCol(); }; + return weighted_mean(this->theHitENERGY, y_pos); + } - inline float y() const { - auto y_pos = [this](unsigned int i) { return this->theHitOffset[i * 2 + 1] + minHitCol(); }; - return weighted_mean(this->theHitENERGY, y_pos); - } + inline float positionError(const float sigmaPos) const { + float sumW2(0.f), sumW(0.f); + for (const auto& hitW : theHitENERGY) { + sumW2 += hitW * hitW; + sumW += hitW; + } + if (sumW > 0) + return sigmaPos * std::sqrt(sumW2) / sumW; + else + return -999.f; + } - inline float positionError(const float sigmaPos) const { - float sumW2(0.f), sumW(0.f); - for (const auto& hitW : theHitENERGY) { - sumW2 += hitW * hitW; - sumW += hitW; + inline float time() const { + auto t = [this](unsigned int i) { return this->theHitTIME[i]; }; + return weighted_mean(this->theHitENERGY, t); } - if (sumW > 0) - return sigmaPos * std::sqrt(sumW2) / sumW; - else - return -999.f; - } - inline float time() const { - auto t = [this](unsigned int i) { return this->theHitTIME[i]; }; - return weighted_mean(this->theHitENERGY, t); - } + inline float timeError() const { + auto t_err = [this](unsigned int i) { return this->theHitTIME_ERROR[i]; }; + return weighted_mean_error(this->theHitENERGY, t_err); + } - inline float timeError() const { - auto t_err = [this](unsigned int i) { return this->theHitTIME_ERROR[i]; }; - return weighted_mean_error(this->theHitENERGY, t_err); - } + // Return number of hits. + inline int size() const { return theHitENERGY.size(); } - // Return number of hits. - inline int size() const { return theHitENERGY.size(); } + // Return cluster dimension in the x direction. + inline int sizeX() const { return rowSpan() + 1; } - // Return cluster dimension in the x direction. - inline int sizeX() const { return rowSpan() + 1; } + // Return cluster dimension in the y direction. + inline int sizeY() const { return colSpan() + 1; } - // Return cluster dimension in the y direction. - inline int sizeY() const { return colSpan() + 1; } + inline float energy() const { + return std::accumulate(theHitENERGY.begin(), theHitENERGY.end(), 0.f); + } // Return total cluster energy. - inline float energy() const { - return std::accumulate(theHitENERGY.begin(), theHitENERGY.end(), 0.f); - } // Return total cluster energy. + inline int minHitRow() const { return theMinHitRow; } // The min x index. + inline int maxHitRow() const { return minHitRow() + rowSpan(); } // The max x index. + inline int minHitCol() const { return theMinHitCol; } // The min y index. + inline int maxHitCol() const { return minHitCol() + colSpan(); } // The max y index. - inline int minHitRow() const { return theMinHitRow; } // The min x index. - inline int maxHitRow() const { return minHitRow() + rowSpan(); } // The max x index. - inline int minHitCol() const { return theMinHitCol; } // The min y index. - inline int maxHitCol() const { return minHitCol() + colSpan(); } // The max y index. + const std::vector& hitOffset() const { return theHitOffset; } + const std::vector& hitENERGY() const { return theHitENERGY; } + const std::vector& hitTIME() const { return theHitTIME; } + const std::vector& hitTIME_ERROR() const { return theHitTIME_ERROR; } - const std::vector& hitOffset() const { return theHitOffset; } - const std::vector& hitENERGY() const { return theHitENERGY; } - const std::vector& hitTIME() const { return theHitTIME; } - const std::vector& hitTIME_ERROR() const { return theHitTIME_ERROR; } + // infinite faster than above... + FTLHit hit(int i) const { + return FTLHit(minHitRow() + theHitOffset[i * 2], + minHitCol() + theHitOffset[i * 2 + 1], + theHitENERGY[i], + theHitTIME[i], + theHitTIME_ERROR[i]); + } - // infinite faster than above... - FTLHit hit(int i) const { - return FTLHit(minHitRow() + theHitOffset[i * 2], - minHitCol() + theHitOffset[i * 2 + 1], - theHitENERGY[i], - theHitTIME[i], - theHitTIME_ERROR[i]); - } + FTLHit seed() const { return hit(seed_); } - FTLHit seed() const { return hit(seed_); } + int colSpan() const { return theHitColSpan; } - int colSpan() const { return theHitColSpan; } + int rowSpan() const { return theHitRowSpan; } - int rowSpan() const { return theHitRowSpan; } + const DetId& id() const { return theid; } + const DetId& detid() const { return id(); } - const DetId& id() const { return theid; } - const DetId& detid() const { return id(); } + bool overflowCol() const { return overflow_(theHitColSpan); } - bool overflowCol() const { return overflow_(theHitColSpan); } + bool overflowRow() const { return overflow_(theHitRowSpan); } - bool overflowRow() const { return overflow_(theHitRowSpan); } + bool overflow() const { return overflowCol() || overflowRow(); } - bool overflow() const { return overflowCol() || overflowRow(); } + void packCol(uint16_t ymin, uint16_t yspan) { + theMinHitCol = ymin; + theHitColSpan = std::min(yspan, uint16_t(MAXSPAN)); + } + void packRow(uint16_t xmin, uint16_t xspan) { + theMinHitRow = xmin; + theHitRowSpan = std::min(xspan, uint16_t(MAXSPAN)); + } - void packCol(uint16_t ymin, uint16_t yspan) { - theMinHitCol = ymin; - theHitColSpan = std::min(yspan, uint16_t(MAXSPAN)); - } - void packRow(uint16_t xmin, uint16_t xspan) { - theMinHitRow = xmin; - theHitRowSpan = std::min(xspan, uint16_t(MAXSPAN)); - } + void setClusterPosX(float posx) { pos_x = posx; } + void setClusterErrorX(float errx) { err_x = errx; } + void setClusterErrorTime(float errtime) { err_time = errtime; } + float getClusterPosX() const { return pos_x; } + float getClusterErrorX() const { return err_x; } + float getClusterErrorTime() const { return err_time; } - void setClusterPosX(float posx) { pos_x = posx; } - void setClusterErrorX(float errx) { err_x = errx; } - void setClusterErrorTime(float errtime) { err_time = errtime; } - float getClusterPosX() const { return pos_x; } - float getClusterErrorX() const { return err_x; } - float getClusterErrorTime() const { return err_time; } - -private: - DetId theid; - - std::vector theHitOffset; - std::vector theHitENERGY; - std::vector theHitTIME; - std::vector theHitTIME_ERROR; - - uint16_t theMinHitRow = MAXPOS; // Minimum hit index in the x direction (low edge). - uint16_t theMinHitCol = MAXPOS; // Minimum hit index in the y direction (left edge). - uint8_t theHitRowSpan = 0; // Span hit index in the x direction (low edge). - uint8_t theHitColSpan = 0; // Span hit index in the y direction (left edge). - - float pos_x = -99999.9f; // For pixels with internal position information in one coordinate (i.e. BTL crystals) - float err_x = -99999.9f; // For pixels with internal position information in one coordinate (i.e. BTL crystals) - float err_time = -99999.9f; - - uint8_t seed_; - - template - float weighted_sum(const std::vector& weights, SumFunc&& sumFunc, OutFunc&& outFunc) const { - float tot = 0; - float sumW = 0; - for (unsigned int i = 0; i < weights.size(); ++i) { - tot += sumFunc(i); - sumW += weights[i]; + private: + DetId theid; + + std::vector theHitOffset; + std::vector theHitENERGY; + std::vector theHitTIME; + std::vector theHitTIME_ERROR; + + uint16_t theMinHitRow = MAXPOS; // Minimum hit index in the x direction (low edge). + uint16_t theMinHitCol = MAXPOS; // Minimum hit index in the y direction (left edge). + uint8_t theHitRowSpan = 0; // Span hit index in the x direction (low edge). + uint8_t theHitColSpan = 0; // Span hit index in the y direction (left edge). + + float pos_x = -99999.9f; // For pixels with internal position information in one coordinate (i.e. BTL crystals) + float err_x = -99999.9f; // For pixels with internal position information in one coordinate (i.e. BTL crystals) + float err_time = -99999.9f; + + uint8_t seed_; + + template + float weighted_sum(const std::vector& weights, SumFunc&& sumFunc, OutFunc&& outFunc) const { + float tot = 0; + float sumW = 0; + for (unsigned int i = 0; i < weights.size(); ++i) { + tot += sumFunc(i); + sumW += weights[i]; + } + return outFunc(tot, sumW); } - return outFunc(tot, sumW); - } - template - float weighted_mean(const std::vector& weights, Value&& value) const { - auto sumFunc = [&weights, value](unsigned int i) { return weights[i] * value(i); }; - auto outFunc = [](float x, float y) { - if (y > 0) - return (float)x / y; - else - return -999.f; - }; - return weighted_sum(weights, sumFunc, outFunc); - } + template + float weighted_mean(const std::vector& weights, Value&& value) const { + auto sumFunc = [&weights, value](unsigned int i) { return weights[i] * value(i); }; + auto outFunc = [](float x, float y) { + if (y > 0) + return (float)x / y; + else + return -999.f; + }; + return weighted_sum(weights, sumFunc, outFunc); + } - template - float weighted_mean_error(const std::vector& weights, Err&& err) const { - auto sumFunc = [&weights, err](unsigned int i) { return weights[i] * weights[i] * err(i) * err(i); }; - auto outFunc = [](float x, float y) { - if (y > 0) - return (float)sqrt(x) / y; - else - return -999.f; - }; - return weighted_sum(weights, sumFunc, outFunc); - } + template + float weighted_mean_error(const std::vector& weights, Err&& err) const { + auto sumFunc = [&weights, err](unsigned int i) { return weights[i] * weights[i] * err(i) * err(i); }; + auto outFunc = [](float x, float y) { + if (y > 0) + return (float)sqrt(x) / y; + else + return -999.f; + }; + return weighted_sum(weights, sumFunc, outFunc); + } + + static int overflow_(uint16_t span) { return span == uint16_t(MAXSPAN); } + }; - static int overflow_(uint16_t span) { return span == uint16_t(MAXSPAN); } -}; - -// Comparison operators (needed by DetSetVector & SortedCollection ) -inline bool operator<(const FTLCluster& one, const FTLCluster& other) { - if (one.detid() == other.detid()) { - if (one.minHitRow() < other.minHitRow()) { - return true; - } else if (one.minHitRow() > other.minHitRow()) { - return false; - } else if (one.minHitCol() < other.minHitCol()) { - return true; - } else { - return false; + // Comparison operators (needed by DetSetVector & SortedCollection ) + inline bool operator<(const FTLCluster& one, const FTLCluster& other) { + if (one.detid() == other.detid()) { + if (one.minHitRow() < other.minHitRow()) { + return true; + } else if (one.minHitRow() > other.minHitRow()) { + return false; + } else if (one.minHitCol() < other.minHitCol()) { + return true; + } else { + return false; + } } + return one.detid() < other.detid(); } - return one.detid() < other.detid(); -} - -inline bool operator<(const FTLCluster& one, const uint32_t& detid) { return one.detid() < detid; } -inline bool operator<(const uint32_t& detid, const FTLCluster& other) { return detid < other.detid(); } + inline bool operator<(const FTLCluster& one, const uint32_t& detid) { return one.detid() < detid; } + inline bool operator<(const uint32_t& detid, const FTLCluster& other) { return detid < other.detid(); } +} // namespace io_v1 +using FTLCluster = io_v1::FTLCluster; #endif diff --git a/DataFormats/FTLRecHit/interface/FTLRecHit.h b/DataFormats/FTLRecHit/interface/FTLRecHit.h index 1f5c793a9e32a..61b76b8eebe26 100644 --- a/DataFormats/FTLRecHit/interface/FTLRecHit.h +++ b/DataFormats/FTLRecHit/interface/FTLRecHit.h @@ -12,18 +12,19 @@ * \author Lindsey Gray */ -class FTLRecHit { -public: - typedef DetId key_type; - - // FTLEE recHit flags - enum Flags { - kGood = 0, // channel ok, the energy and time measurement are reliable - kKilled, // MC only flag: the channel is killed in the real detector - kUnknown // to ease the interface with functions returning flags. - }; - - /** bit structure of CaloRecHit::flags_ used in FTLRecHit: +namespace io_v1 { + class FTLRecHit { + public: + typedef DetId key_type; + + // FTLEE recHit flags + enum Flags { + kGood = 0, // channel ok, the energy and time measurement are reliable + kKilled, // MC only flag: the channel is killed in the real detector + kUnknown // to ease the interface with functions returning flags. + }; + + /** bit structure of CaloRecHit::flags_ used in FTLRecHit: * * | 32 | 31...25 | 24...12 | 11...5 | 4...1 | * | | | | | @@ -34,79 +35,80 @@ class FTLRecHit { * +--> spare ( 1 bit ) */ - FTLRecHit(); - // by default a recHit is greated with no flag - FTLRecHit(const DetId& id, - uint8_t row, - uint8_t column, - float energy, - float time, - float timeError, - float position, - float positionError, - uint32_t flagBits = 0); - - FTLRecHit(const DetId& id, - float energy, - float time, - float timeError, - float position, - float positionError, - uint32_t flagBits = 0); - - /// get the id - - float energy() const { return energy_; } - void setEnergy(float energy) { energy_ = energy; } - - const DetId& id() const { return id_; } - const DetId& detid() const { return id(); } - - const MTDDetId mtdId() const { return MTDDetId(id_); } - - int row() const { return row_; } - int column() const { return column_; } - - float time() const { return time_; } - void setTime(float time) { time_ = time; } - - float position() const { return position_; } - void setPosition(float position) { position_ = position; } - - bool isTimeValid() const; - bool isTimeErrorValid() const; - - float timeError() const { return timeError_; } - void setTimeError(float err) { timeError_ = err; } - - float positionError() const { return positionError_; } - void setPositionError(float poserr) { positionError_ = poserr; } - - /// set the flags (from Flags or ESFlags) - void setFlag(int flag) { flagBits_ |= (0x1 << flag); } - void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); } - - /// check if the flag is true - bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); } - - /// check if one of the flags in a set is true - bool checkFlags(const std::vector& flagsvec) const; - -private: - DetId id_; - float energy_; - float time_; - float timeError_; - /// position is the distance from the center of the bar to hit - float position_; - float positionError_; - uint8_t row_; - uint8_t column_; - - /// store rechit condition (see Flags enum) in a bit-wise way - unsigned char flagBits_; -}; - -std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit); + FTLRecHit(); + // by default a recHit is greated with no flag + FTLRecHit(const DetId& id, + uint8_t row, + uint8_t column, + float energy, + float time, + float timeError, + float position, + float positionError, + uint32_t flagBits = 0); + + FTLRecHit(const DetId& id, + float energy, + float time, + float timeError, + float position, + float positionError, + uint32_t flagBits = 0); + + /// get the id + + float energy() const { return energy_; } + void setEnergy(float energy) { energy_ = energy; } + + const DetId& id() const { return id_; } + const DetId& detid() const { return id(); } + + const MTDDetId mtdId() const { return MTDDetId(id_); } + + int row() const { return row_; } + int column() const { return column_; } + + float time() const { return time_; } + void setTime(float time) { time_ = time; } + + float position() const { return position_; } + void setPosition(float position) { position_ = position; } + + bool isTimeValid() const; + bool isTimeErrorValid() const; + + float timeError() const { return timeError_; } + void setTimeError(float err) { timeError_ = err; } + + float positionError() const { return positionError_; } + void setPositionError(float poserr) { positionError_ = poserr; } + + /// set the flags (from Flags or ESFlags) + void setFlag(int flag) { flagBits_ |= (0x1 << flag); } + void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); } + + /// check if the flag is true + bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); } + + /// check if one of the flags in a set is true + bool checkFlags(const std::vector& flagsvec) const; + + private: + DetId id_; + float energy_; + float time_; + float timeError_; + /// position is the distance from the center of the bar to hit + float position_; + float positionError_; + uint8_t row_; + uint8_t column_; + + /// store rechit condition (see Flags enum) in a bit-wise way + unsigned char flagBits_; + }; + std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit); +} // namespace io_v1 +using FTLRecHit = io_v1::FTLRecHit; #endif diff --git a/DataFormats/FTLRecHit/interface/FTLRecHitComparison.h b/DataFormats/FTLRecHit/interface/FTLRecHitComparison.h index 7595e5f3cffbb..e457df78a41ea 100644 --- a/DataFormats/FTLRecHit/interface/FTLRecHitComparison.h +++ b/DataFormats/FTLRecHit/interface/FTLRecHitComparison.h @@ -5,15 +5,16 @@ //ordering capability mandatory for lazy getter framework // Comparison operators -inline bool operator<(const FTLRecHit& one, const FTLRecHit& other) { - if (one.detid() == other.detid()) { - return one.energy() < other.energy(); +namespace io_v1 { + inline bool operator<(const FTLRecHit& one, const FTLRecHit& other) { + if (one.detid() == other.detid()) { + return one.energy() < other.energy(); + } + return one.detid() < other.detid(); } - return one.detid() < other.detid(); -} -inline bool operator<(const FTLRecHit& one, const uint32_t& detid) { return one.detid() < detid; } - -inline bool operator<(const uint32_t& detid, const FTLRecHit& other) { return detid < other.detid(); } + inline bool operator<(const FTLRecHit& one, const uint32_t& detid) { return one.detid() < detid; } + inline bool operator<(const uint32_t& detid, const FTLRecHit& other) { return detid < other.detid(); } +} // namespace io_v1 #endif diff --git a/DataFormats/FTLRecHit/interface/FTLUncalibratedRecHit.h b/DataFormats/FTLRecHit/interface/FTLUncalibratedRecHit.h index 5a5396c893295..47c2f1b9b539c 100644 --- a/DataFormats/FTLRecHit/interface/FTLUncalibratedRecHit.h +++ b/DataFormats/FTLRecHit/interface/FTLUncalibratedRecHit.h @@ -4,75 +4,77 @@ #include #include "DataFormats/DetId/interface/DetId.h" -class FTLUncalibratedRecHit { -public: - typedef DetId key_type; +namespace io_v1 { + class FTLUncalibratedRecHit { + public: + typedef DetId key_type; - enum Flags { - kGood = -1, // channel is good (mutually exclusive with other states) setFlagBit(kGood) reset flags_ to zero - kPoorReco, // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.) - kSaturated, // saturated channel - kOutOfTime // channel out of time - }; - - FTLUncalibratedRecHit(); - FTLUncalibratedRecHit(const DetId& detId, - uint8_t row, - uint8_t column, - std::pair ampl, - std::pair time, - float timeError, - float position, - float positionError, - unsigned char flags = 0); - FTLUncalibratedRecHit(const DetId& detId, - std::pair ampl, - std::pair time, - float timeError, - float position, - float positionError, - unsigned char flags = 0); + enum Flags { + kGood = -1, // channel is good (mutually exclusive with other states) setFlagBit(kGood) reset flags_ to zero + kPoorReco, // channel has been badly reconstructed (e.g. bad shape, bad chi2 etc.) + kSaturated, // saturated channel + kOutOfTime // channel out of time + }; - ~FTLUncalibratedRecHit() = default; - std::pair amplitude() const { return amplitude_; } - std::pair time() const { return time_; } - float position() const { return position_; } + FTLUncalibratedRecHit(); + FTLUncalibratedRecHit(const DetId& detId, + uint8_t row, + uint8_t column, + std::pair ampl, + std::pair time, + float timeError, + float position, + float positionError, + unsigned char flags = 0); + FTLUncalibratedRecHit(const DetId& detId, + std::pair ampl, + std::pair time, + float timeError, + float position, + float positionError, + unsigned char flags = 0); - float timeError() const { return timeError_; } - float positionError() const { return positionError_; } + ~FTLUncalibratedRecHit() = default; + std::pair amplitude() const { return amplitude_; } + std::pair time() const { return time_; } + float position() const { return position_; } - unsigned char flags() const { return flags_; }; + float timeError() const { return timeError_; } + float positionError() const { return positionError_; } - DetId id() const { return id_; } - int row() const { return row_; } - int column() const { return column_; } + unsigned char flags() const { return flags_; }; - void setAmplitude(std::pair amplitude) { amplitude_ = amplitude; } - void setTime(std::pair time) { time_ = time; } + DetId id() const { return id_; } + int row() const { return row_; } + int column() const { return column_; } - void setTimeError(float timeErr) { timeError_ = timeErr; } - void setId(DetId id) { id_ = id; } - void setFlagBit(Flags flag); - bool checkFlag(Flags flag) const; + void setAmplitude(std::pair amplitude) { amplitude_ = amplitude; } + void setTime(std::pair time) { time_ = time; } - void setPosition(float position) { position_ = position; } - void setPositionError(float positionErr) { positionError_ = positionErr; } + void setTimeError(float timeErr) { timeError_ = timeErr; } + void setId(DetId id) { id_ = id; } + void setFlagBit(Flags flag); + bool checkFlag(Flags flag) const; - bool isTimeValid() const; - bool isTimeErrorValid() const; + void setPosition(float position) { position_ = position; } + void setPositionError(float positionErr) { positionError_ = positionErr; } - bool isSaturated() const; + bool isTimeValid() const; + bool isTimeErrorValid() const; -private: - std::pair amplitude_; - std::pair time_; - float timeError_; - float position_; /// distance from the center of the bar to the hit - float positionError_; - DetId id_; - uint8_t row_; - uint8_t column_; - unsigned char flags_; -}; + bool isSaturated() const; + private: + std::pair amplitude_; + std::pair time_; + float timeError_; + float position_; /// distance from the center of the bar to the hit + float positionError_; + DetId id_; + uint8_t row_; + uint8_t column_; + unsigned char flags_; + }; +} // namespace io_v1 +using FTLUncalibratedRecHit = io_v1::FTLUncalibratedRecHit; #endif diff --git a/DataFormats/FTLRecHit/src/FTLRecHit.cc b/DataFormats/FTLRecHit/src/FTLRecHit.cc index dfa5d2bbce188..6d3dcb1ac60d3 100644 --- a/DataFormats/FTLRecHit/src/FTLRecHit.cc +++ b/DataFormats/FTLRecHit/src/FTLRecHit.cc @@ -6,62 +6,63 @@ namespace { constexpr float timereso_max = 10000; } +namespace io_v1 { + FTLRecHit::FTLRecHit() + : FTLRecHit(DetId(), 0, 0, -1.f, -1.f, -1.f, -1.f, -1.f, std::numeric_limits::max()) {} -FTLRecHit::FTLRecHit() - : FTLRecHit(DetId(), 0, 0, -1.f, -1.f, -1.f, -1.f, -1.f, std::numeric_limits::max()) {} + FTLRecHit::FTLRecHit(const DetId& id, + uint8_t row, + uint8_t column, + float energy, + float time, + float timeError, + float position, + float positionError, + uint32_t flagBits) + : id_(id), + energy_(energy), + time_(time), + timeError_(timeError), + position_(position), + positionError_(positionError), + row_(row), + column_(column), + flagBits_(flagBits) {} -FTLRecHit::FTLRecHit(const DetId& id, - uint8_t row, - uint8_t column, - float energy, - float time, - float timeError, - float position, - float positionError, - uint32_t flagBits) - : id_(id), - energy_(energy), - time_(time), - timeError_(timeError), - position_(position), - positionError_(positionError), - row_(row), - column_(column), - flagBits_(flagBits) {} + FTLRecHit::FTLRecHit( + const DetId& id, float energy, float time, float timeError, float position, float positionError, uint32_t flagBits) + : FTLRecHit(id, 0, 0, energy, time, timeError, position, positionError, flagBits) {} -FTLRecHit::FTLRecHit( - const DetId& id, float energy, float time, float timeError, float position, float positionError, uint32_t flagBits) - : FTLRecHit(id, 0, 0, energy, time, timeError, position, positionError, flagBits) {} + bool FTLRecHit::isTimeValid() const { + if (timeError() < 0) + return false; + else + return true; + } + + bool FTLRecHit::isTimeErrorValid() const { + if (!isTimeValid()) + return false; + if (timeError() >= timereso_max) + return false; -bool FTLRecHit::isTimeValid() const { - if (timeError() < 0) - return false; - else return true; -} + } -bool FTLRecHit::isTimeErrorValid() const { - if (!isTimeValid()) - return false; - if (timeError() >= timereso_max) + /// check if one of the flags in a set is true + bool FTLRecHit::checkFlags(const std::vector& flagsvec) const { + for (std::vector::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end(); + ++flagPtr) { // check if one of the flags is up + if (checkFlag(*flagPtr)) + return true; + } return false; - - return true; -} - -/// check if one of the flags in a set is true -bool FTLRecHit::checkFlags(const std::vector& flagsvec) const { - for (std::vector::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end(); - ++flagPtr) { // check if one of the flags is up - if (checkFlag(*flagPtr)) - return true; } - return false; -} -std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit) { - if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == FastTime) - return s << MTDDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else - return s << "FTLRecHit undefined subdetector"; -} + std::ostream& operator<<(std::ostream& s, const FTLRecHit& hit) { + if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == FastTime) + return s << MTDDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else + return s << "FTLRecHit undefined subdetector"; + } +} // namespace io_v1 diff --git a/DataFormats/FTLRecHit/src/classes_def.xml b/DataFormats/FTLRecHit/src/classes_def.xml index 3e786d54f51f4..75774b1b7c309 100644 --- a/DataFormats/FTLRecHit/src/classes_def.xml +++ b/DataFormats/FTLRecHit/src/classes_def.xml @@ -1,58 +1,53 @@ - - - - + + - + - - - - + + - + - - - + + - + - + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - + diff --git a/DataFormats/FWLite/src/classes_def.xml b/DataFormats/FWLite/src/classes_def.xml index 2796cb1c9c61a..b1fac92b19bb6 100644 --- a/DataFormats/FWLite/src/classes_def.xml +++ b/DataFormats/FWLite/src/classes_def.xml @@ -1,22 +1,19 @@ - - - + + - - + + - - - + + - - - + + diff --git a/DataFormats/ForwardDetId/interface/BTLDetId.h b/DataFormats/ForwardDetId/interface/BTLDetId.h index af51035630a05..3136a52d2016a 100644 --- a/DataFormats/ForwardDetId/interface/BTLDetId.h +++ b/DataFormats/ForwardDetId/interface/BTLDetId.h @@ -26,201 +26,204 @@ bit 4-0 : Crystal number in a SM ( 1 - 16 ) */ -class BTLDetId : public MTDDetId { -public: - // old BTLDetID - static constexpr uint32_t kBTLoldModuleOffset = 10; - static constexpr uint32_t kBTLoldModuleMask = 0x3F; - static constexpr uint32_t kBTLoldModTypeOffset = 8; - static constexpr uint32_t kBTLoldModTypeMask = 0x3; - static constexpr uint32_t kBTLoldRUOffset = 6; - static constexpr uint32_t kBTLoldRUMask = 0x3; - static constexpr uint32_t kBTLoldCrystalOffset = 0; - static constexpr uint32_t kBTLoldCrystalMask = 0x3F; - - // New BTLDetID - static constexpr uint32_t kBTLRodOffset = 16; - static constexpr uint32_t kBTLRodMask = 0x3F; - static constexpr uint32_t kBTLRUOffset = 10; - static constexpr uint32_t kBTLRUMask = 0x7; - static constexpr uint32_t kBTLdetectorModOffset = 6; - static constexpr uint32_t kBTLdetectorModMask = 0xF; - static constexpr uint32_t kBTLsensorModOffset = 5; - static constexpr uint32_t kBTLsensorModMask = 0x1; - static constexpr uint32_t kBTLCrystalOffset = 0; - static constexpr uint32_t kBTLCrystalMask = 0x1F; - - /// range constants, need two sets for the time being (one for tiles and one for bars) - static constexpr uint32_t HALF_ROD = 36; - static constexpr uint32_t kRUPerTypeV2 = 2; - static constexpr uint32_t kRUPerRod = 6; - static constexpr uint32_t kModulesPerRUV2 = 24; - static constexpr uint32_t kDModulesPerRU = 12; - static constexpr uint32_t kSModulesPerDM = 2; - static constexpr uint32_t kDModulesInRUCol = 3; - static constexpr uint32_t kDModulesInRURow = 4; - static constexpr uint32_t kSModulesInDM = 2; - static constexpr uint32_t kCrystalsPerModuleV2 = 16; - static constexpr uint32_t kModulesPerTrkV2 = 3; - static constexpr uint32_t kCrystalTypes = 3; - - // conversion - static constexpr uint32_t kBTLoldFieldMask = 0x3FFFFF; - static constexpr uint32_t kBTLNewFormat = 1 << 15; - - // - - // Number of crystals in BTL according to TDR design, valid also for barphiflat scenario: - // 16 crystals x 24 modules x 2 readout units/type x 3 types x 36 rods/side x 2 sides - // - static constexpr uint32_t kCrystalsBTL = - kCrystalsPerModuleV2 * kModulesPerRUV2 * kRUPerTypeV2 * kCrystalTypes * HALF_ROD * 2; - - enum class CrysLayout { tile = 1, bar = 2, barzflat = 3, barphiflat = 4, v2 = 5, v3 = 6, v4 = 7 }; - - // ---------- Constructors, enumerated types ---------- - - /** Construct a null id */ - BTLDetId() : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset; - } - - /** Construct from a raw value */ - BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { id_ = MTDDetId(raw_id).rawId(); } - - /** Construct from generic DetId */ - BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { id_ = MTDDetId(det_id.rawId()).rawId(); } - - /** Construct from complete geometry information v2, v3 **/ - /** Geometry v1 is obsolete and not supported **/ - BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal, bool v2v3) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (rod & kRodRingMask) << kRodRingOffset | (module & kBTLoldModuleMask) << kBTLoldModuleOffset | - (modtyp & kBTLoldModTypeMask) << kBTLoldModTypeOffset | (runit & kBTLoldRUMask) << kBTLoldRUOffset | - ((crystal - 1) & kBTLoldCrystalMask) << kBTLoldCrystalOffset; - } - - /** Construct from complete geometry information v4 **/ - BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodule, uint32_t crystal) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - //RU, DM, SM & Xtal numbers start from 0 - id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (rod & kRodRingMask) << kRodRingOffset | (runit & kBTLRUMask) << kBTLRUOffset | - (dmodule & kBTLdetectorModMask) << kBTLdetectorModOffset | - (smodule & kBTLsensorModMask) << kBTLsensorModOffset | (crystal & kBTLCrystalMask) << kBTLCrystalOffset; - id_ |= kBTLNewFormat; - } - - // ---------- Common methods ---------- - - /** Returns BTL crystal number. */ - inline int crystal() const { - if (id_ & kBTLNewFormat) { - return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); - } else { - return ((id_ >> kBTLoldCrystalOffset) & kBTLoldCrystalMask) + 1; +namespace io_v1 { + class BTLDetId : public MTDDetId { + public: + // old BTLDetID + static constexpr uint32_t kBTLoldModuleOffset = 10; + static constexpr uint32_t kBTLoldModuleMask = 0x3F; + static constexpr uint32_t kBTLoldModTypeOffset = 8; + static constexpr uint32_t kBTLoldModTypeMask = 0x3; + static constexpr uint32_t kBTLoldRUOffset = 6; + static constexpr uint32_t kBTLoldRUMask = 0x3; + static constexpr uint32_t kBTLoldCrystalOffset = 0; + static constexpr uint32_t kBTLoldCrystalMask = 0x3F; + + // New BTLDetID + static constexpr uint32_t kBTLRodOffset = 16; + static constexpr uint32_t kBTLRodMask = 0x3F; + static constexpr uint32_t kBTLRUOffset = 10; + static constexpr uint32_t kBTLRUMask = 0x7; + static constexpr uint32_t kBTLdetectorModOffset = 6; + static constexpr uint32_t kBTLdetectorModMask = 0xF; + static constexpr uint32_t kBTLsensorModOffset = 5; + static constexpr uint32_t kBTLsensorModMask = 0x1; + static constexpr uint32_t kBTLCrystalOffset = 0; + static constexpr uint32_t kBTLCrystalMask = 0x1F; + + /// range constants, need two sets for the time being (one for tiles and one for bars) + static constexpr uint32_t HALF_ROD = 36; + static constexpr uint32_t kRUPerTypeV2 = 2; + static constexpr uint32_t kRUPerRod = 6; + static constexpr uint32_t kModulesPerRUV2 = 24; + static constexpr uint32_t kDModulesPerRU = 12; + static constexpr uint32_t kSModulesPerDM = 2; + static constexpr uint32_t kDModulesInRUCol = 3; + static constexpr uint32_t kDModulesInRURow = 4; + static constexpr uint32_t kSModulesInDM = 2; + static constexpr uint32_t kCrystalsPerModuleV2 = 16; + static constexpr uint32_t kModulesPerTrkV2 = 3; + static constexpr uint32_t kCrystalTypes = 3; + + // conversion + static constexpr uint32_t kBTLoldFieldMask = 0x3FFFFF; + static constexpr uint32_t kBTLNewFormat = 1 << 15; + + // + + // Number of crystals in BTL according to TDR design, valid also for barphiflat scenario: + // 16 crystals x 24 modules x 2 readout units/type x 3 types x 36 rods/side x 2 sides + // + static constexpr uint32_t kCrystalsBTL = + kCrystalsPerModuleV2 * kModulesPerRUV2 * kRUPerTypeV2 * kCrystalTypes * HALF_ROD * 2; + + enum class CrysLayout { tile = 1, bar = 2, barzflat = 3, barphiflat = 4, v2 = 5, v3 = 6, v4 = 7 }; + + // ---------- Constructors, enumerated types ---------- + + /** Construct a null id */ + BTLDetId() : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset; } - } - /** Returns BTL crystal number in construction database. */ - inline int crystalConsDB() const { - if (((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) == kCrystalsPerModuleV2) { - return -1; + /** Construct from a raw value */ + BTLDetId(const uint32_t& raw_id) : MTDDetId(raw_id) { id_ = MTDDetId(raw_id).rawId(); } + + /** Construct from generic DetId */ + BTLDetId(const DetId& det_id) : MTDDetId(det_id.rawId()) { id_ = MTDDetId(det_id.rawId()).rawId(); } + + /** Construct from complete geometry information v2, v3 **/ + /** Geometry v1 is obsolete and not supported **/ + BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t module, uint32_t modtyp, uint32_t crystal, bool v2v3) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (rod & kRodRingMask) << kRodRingOffset | (module & kBTLoldModuleMask) << kBTLoldModuleOffset | + (modtyp & kBTLoldModTypeMask) << kBTLoldModTypeOffset | (runit & kBTLoldRUMask) << kBTLoldRUOffset | + ((crystal - 1) & kBTLoldCrystalMask) << kBTLoldCrystalOffset; + } + + /** Construct from complete geometry information v4 **/ + BTLDetId(uint32_t zside, uint32_t rod, uint32_t runit, uint32_t dmodule, uint32_t smodule, uint32_t crystal) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + //RU, DM, SM & Xtal numbers start from 0 + id_ |= (MTDType::BTL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (rod & kRodRingMask) << kRodRingOffset | (runit & kBTLRUMask) << kBTLRUOffset | + (dmodule & kBTLdetectorModMask) << kBTLdetectorModOffset | + (smodule & kBTLsensorModMask) << kBTLsensorModOffset | (crystal & kBTLCrystalMask) << kBTLCrystalOffset; + id_ |= kBTLNewFormat; } - if (smodule() == 0) { - return kCrystalsPerModuleV2 - 1 - ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); - } else { - return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + + // ---------- Common methods ---------- + + /** Returns BTL crystal number. */ + inline int crystal() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + } else { + return ((id_ >> kBTLoldCrystalOffset) & kBTLoldCrystalMask) + 1; + } + } + + /** Returns BTL crystal number in construction database. */ + inline int crystalConsDB() const { + if (((id_ >> kBTLCrystalOffset) & kBTLCrystalMask) == kCrystalsPerModuleV2) { + return -1; + } + if (smodule() == 0) { + return kCrystalsPerModuleV2 - 1 - ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + } else { + return ((id_ >> kBTLCrystalOffset) & kBTLCrystalMask); + } } - } - - /** Returns BTL detector module number. */ - inline int dmodule() const { - if (id_ & kBTLNewFormat) { - return ((id_ >> kBTLdetectorModOffset) & kBTLdetectorModMask); - } else { - uint32_t oldModule = (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; - uint32_t detModule = - int((oldModule - 1) % (kDModulesInRUCol)) * kDModulesInRURow + - int((oldModule - 1) / (kDModulesInRUCol * kSModulesInDM)); // in old scenario module number starts from 1 - return detModule; + + /** Returns BTL detector module number. */ + inline int dmodule() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLdetectorModOffset) & kBTLdetectorModMask); + } else { + uint32_t oldModule = (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + uint32_t detModule = + int((oldModule - 1) % (kDModulesInRUCol)) * kDModulesInRURow + + int((oldModule - 1) / (kDModulesInRUCol * kSModulesInDM)); // in old scenario module number starts from 1 + return detModule; + } } - } - - /** Returns BTL sensor module number. */ - inline int smodule() const { - if (id_ & kBTLNewFormat) { - return ((id_ >> kBTLsensorModOffset) & kBTLsensorModMask); - } else { - uint32_t oldModule = (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; - uint32_t senModule = - int((oldModule - 1) / kDModulesInRUCol) % kSModulesInDM; // in old scenario module number starts from 1 - return senModule; + + /** Returns BTL sensor module number. */ + inline int smodule() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLsensorModOffset) & kBTLsensorModMask); + } else { + uint32_t oldModule = (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + uint32_t senModule = + int((oldModule - 1) / kDModulesInRUCol) % kSModulesInDM; // in old scenario module number starts from 1 + return senModule; + } } - } - - /** Returns BTL module number [1-24] (OLD BTL NUMBERING). */ - inline int module() const { - if (id_ & kBTLNewFormat) { - return ((dmodule() % kDModulesInRURow) * (kSModulesInDM * kDModulesInRUCol) + int(dmodule() / kDModulesInRURow) + - kDModulesInRUCol * smodule()) + - 1; - } else { - return (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + + /** Returns BTL module number [1-24] (OLD BTL NUMBERING). */ + inline int module() const { + if (id_ & kBTLNewFormat) { + return ((dmodule() % kDModulesInRURow) * (kSModulesInDM * kDModulesInRUCol) + + int(dmodule() / kDModulesInRURow) + kDModulesInRUCol * smodule()) + + 1; + } else { + return (id_ >> kBTLoldModuleOffset) & kBTLoldModuleMask; + } } - } - - /** Returns BTL crystal type number [1-3] (OLD BTL NUMBERING). */ - inline int modType() const { - if (id_ & kBTLNewFormat) { - return int(runit() / kRUPerTypeV2 + 1); - } else { - return (id_ >> kBTLoldModTypeOffset) & kBTLoldModTypeMask; + + /** Returns BTL crystal type number [1-3] (OLD BTL NUMBERING). */ + inline int modType() const { + if (id_ & kBTLNewFormat) { + return int(runit() / kRUPerTypeV2 + 1); + } else { + return (id_ >> kBTLoldModTypeOffset) & kBTLoldModTypeMask; + } } - } - - /** Returns BTL global readout unit number. */ - inline int runit() const { - if (id_ & kBTLNewFormat) { - return ((id_ >> kBTLRUOffset) & kBTLRUMask); - } else { - return (modType() - 1) * kRUPerTypeV2 + int((id_ >> kBTLoldRUOffset) & kBTLoldRUMask); + + /** Returns BTL global readout unit number. */ + inline int runit() const { + if (id_ & kBTLNewFormat) { + return ((id_ >> kBTLRUOffset) & kBTLRUMask); + } else { + return (modType() - 1) * kRUPerTypeV2 + int((id_ >> kBTLoldRUOffset) & kBTLoldRUMask); + } } - } - - /** Returns BTL readout unit number per type [1-2], from Global RU number [1-6]. */ - inline int runitByType() const { - if (id_ & kBTLNewFormat) { - return ((runit() % kRUPerTypeV2) + 1); - } else { - return (((runit() - 1) % kRUPerTypeV2) + 1); + + /** Returns BTL readout unit number per type [1-2], from Global RU number [1-6]. */ + inline int runitByType() const { + if (id_ & kBTLNewFormat) { + return ((runit() % kRUPerTypeV2) + 1); + } else { + return (((runit() - 1) % kRUPerTypeV2) + 1); + } } - } - - /** return the row in GeomDet language **/ - inline int row(unsigned nrows = kCrystalsPerModuleV2) const { - if (id_ & kBTLNewFormat) { - return crystal() % nrows; - } else { - return (crystal() - 1) % nrows; + + /** return the row in GeomDet language **/ + inline int row(unsigned nrows = kCrystalsPerModuleV2) const { + if (id_ & kBTLNewFormat) { + return crystal() % nrows; + } else { + return (crystal() - 1) % nrows; + } } - } - - /** return the column in GeomDetLanguage **/ - inline int column(unsigned nrows = kCrystalsPerModuleV2) const { - if (id_ & kBTLNewFormat) { - return crystal() / nrows; - } else { - return (crystal() - 1) / nrows; + + /** return the column in GeomDetLanguage **/ + inline int column(unsigned nrows = kCrystalsPerModuleV2) const { + if (id_ & kBTLNewFormat) { + return crystal() / nrows; + } else { + return (crystal() - 1) / nrows; + } } - } - /** create a Geographical DetId for Tracking **/ - BTLDetId geographicalId(CrysLayout lay) const; -}; + /** create a Geographical DetId for Tracking **/ + BTLDetId geographicalId(CrysLayout lay) const; + }; -std::ostream& operator<<(std::ostream&, const BTLDetId&); + std::ostream& operator<<(std::ostream&, const BTLDetId&); +} // namespace io_v1 +using BTLDetId = io_v1::BTLDetId; std::stringstream printBTLSMDetId(uint32_t detId); diff --git a/DataFormats/ForwardDetId/interface/ETLDetId.h b/DataFormats/ForwardDetId/interface/ETLDetId.h index 95dad717e4129..e1ed0fd8103ae 100644 --- a/DataFormats/ForwardDetId/interface/ETLDetId.h +++ b/DataFormats/ForwardDetId/interface/ETLDetId.h @@ -26,242 +26,245 @@ */ -class ETLDetId : public MTDDetId { -private: - // for conversion from old to new module bit field - static constexpr uint32_t kETLoldToNewShift = 2; - static constexpr uint32_t kETLoldFieldMask = 0x7FFF; - static constexpr uint32_t kETLformatV2 = 1; - -public: - static constexpr uint32_t kETLmoduleOffset = 5; - static constexpr uint32_t kETLmoduleMask = 0x7FF; - static constexpr uint32_t kETLmodTypeOffset = 3; - static constexpr uint32_t kETLmodTypeMask = 0x3; - static constexpr uint32_t kETLsensorOffset = 1; - static constexpr uint32_t kETLsensorMask = 0x3; - - static constexpr int kETLv1maxRing = 11; - static constexpr int kETLv1maxModule = 176; - static constexpr int kETLv1nDisc = 1; - - /// constants for the TDR ETL model - static constexpr uint32_t kETLnDiscOffset = 3; - static constexpr uint32_t kETLnDiscMask = 0x1; - static constexpr uint32_t kETLdiscSideOffset = 2; - static constexpr uint32_t kETLdiscSideMask = 0x1; - static constexpr uint32_t kETLsectorMask = 0x3; - - static constexpr int kETLv4maxRing = 16; - static constexpr int kETLv4maxSector = 4; - static constexpr int kETLv4maxModule = 248; - static constexpr int kETLv4nDisc = 2; - - static constexpr int kETLv5maxRing = 14; - static constexpr int kETLv5maxSector = 2; - static constexpr int kETLv5maxModule = 517; - static constexpr int kETLv5nDisc = kETLv4nDisc; - - static constexpr uint32_t kSoff = 4; - - /// constants for new ETLDetId format (from v11 onwards) - static constexpr uint32_t kETLservicetypMask = 0x3; - static constexpr uint32_t kETLserviceCopyMask = 0x3F; - static constexpr uint32_t kETLmodCopyv11Mask = 0x7; - static constexpr uint32_t kETLmodTypev11Mask = 0x1; - static constexpr uint32_t kETLsensorv11Mask = 0x1; - - static constexpr uint32_t kETLVersionOffset = 15; - static constexpr uint32_t kETLservicetypOffset = 11; - static constexpr uint32_t kETLserviceCopyOffset = 5; - static constexpr uint32_t kETLmodCopyv11Offset = 2; - static constexpr uint32_t kETLmodTypev11Offset = 1; - - // ---------- Constructors, enumerated types ---------- - - /** Construct a null id */ - ETLDetId() : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset; - id_ |= kETLformatV2; - } - - /** Construct from a raw value (applies a change in the Id if bit0 is 0 and bit15 is 0) */ - ETLDetId(const uint32_t& raw_id) { - uint32_t tmpId = raw_id; - if (((tmpId >> kETLVersionOffset) & 0x1) == 0 && (tmpId & kETLformatV2) == 0) { - tmpId = newForm(tmpId); +namespace io_v1 { + class ETLDetId : public MTDDetId { + private: + // for conversion from old to new module bit field + static constexpr uint32_t kETLoldToNewShift = 2; + static constexpr uint32_t kETLoldFieldMask = 0x7FFF; + static constexpr uint32_t kETLformatV2 = 1; + + public: + static constexpr uint32_t kETLmoduleOffset = 5; + static constexpr uint32_t kETLmoduleMask = 0x7FF; + static constexpr uint32_t kETLmodTypeOffset = 3; + static constexpr uint32_t kETLmodTypeMask = 0x3; + static constexpr uint32_t kETLsensorOffset = 1; + static constexpr uint32_t kETLsensorMask = 0x3; + + static constexpr int kETLv1maxRing = 11; + static constexpr int kETLv1maxModule = 176; + static constexpr int kETLv1nDisc = 1; + + /// constants for the TDR ETL model + static constexpr uint32_t kETLnDiscOffset = 3; + static constexpr uint32_t kETLnDiscMask = 0x1; + static constexpr uint32_t kETLdiscSideOffset = 2; + static constexpr uint32_t kETLdiscSideMask = 0x1; + static constexpr uint32_t kETLsectorMask = 0x3; + + static constexpr int kETLv4maxRing = 16; + static constexpr int kETLv4maxSector = 4; + static constexpr int kETLv4maxModule = 248; + static constexpr int kETLv4nDisc = 2; + + static constexpr int kETLv5maxRing = 14; + static constexpr int kETLv5maxSector = 2; + static constexpr int kETLv5maxModule = 517; + static constexpr int kETLv5nDisc = kETLv4nDisc; + + static constexpr uint32_t kSoff = 4; + + /// constants for new ETLDetId format (from v11 onwards) + static constexpr uint32_t kETLservicetypMask = 0x3; + static constexpr uint32_t kETLserviceCopyMask = 0x3F; + static constexpr uint32_t kETLmodCopyv11Mask = 0x7; + static constexpr uint32_t kETLmodTypev11Mask = 0x1; + static constexpr uint32_t kETLsensorv11Mask = 0x1; + + static constexpr uint32_t kETLVersionOffset = 15; + static constexpr uint32_t kETLservicetypOffset = 11; + static constexpr uint32_t kETLserviceCopyOffset = 5; + static constexpr uint32_t kETLmodCopyv11Offset = 2; + static constexpr uint32_t kETLmodTypev11Offset = 1; + + // ---------- Constructors, enumerated types ---------- + + /** Construct a null id */ + ETLDetId() : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset; + id_ |= kETLformatV2; } - id_ = MTDDetId(tmpId).rawId(); - } - - /** Construct from generic DetId (applies a change in the Id if bit0 is 0 and bit15 is 0)*/ - ETLDetId(const DetId& det_id) { - uint32_t tmpId = det_id.rawId(); - if (((tmpId >> kETLVersionOffset) & 0x1) == 0 && (tmpId & kETLformatV2) == 0) { - tmpId = newForm(tmpId); + + /** Construct from a raw value (applies a change in the Id if bit0 is 0 and bit15 is 0) */ + ETLDetId(const uint32_t& raw_id) { + uint32_t tmpId = raw_id; + if (((tmpId >> kETLVersionOffset) & 0x1) == 0 && (tmpId & kETLformatV2) == 0) { + tmpId = newForm(tmpId); + } + id_ = MTDDetId(tmpId).rawId(); + } + + /** Construct from generic DetId (applies a change in the Id if bit0 is 0 and bit15 is 0)*/ + ETLDetId(const DetId& det_id) { + uint32_t tmpId = det_id.rawId(); + if (((tmpId >> kETLVersionOffset) & 0x1) == 0 && (tmpId & kETLformatV2) == 0) { + tmpId = newForm(tmpId); + } + id_ = MTDDetId(tmpId).rawId(); } - id_ = MTDDetId(tmpId).rawId(); - } - - /** Construct and fill only the det and sub-det fields. */ - // pre v8 - ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (ring & kRodRingMask) << kRodRingOffset | (module & kETLmoduleMask) << kETLmoduleOffset | - (modtyp & kETLmodTypeMask) << kETLmodTypeOffset; - id_ |= kETLformatV2; - } - // v8 - v10 - ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp, uint32_t sensor) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (ring & kRodRingMask) << kRodRingOffset | (module & kETLmoduleMask) << kETLmoduleOffset | - (modtyp & kETLmodTypeMask) << kETLmodTypeOffset | (sensor & kETLsensorMask) << kETLsensorOffset; - id_ |= kETLformatV2; - } - // from v11 - ETLDetId(uint32_t zside, - uint32_t ring, - uint32_t version, - uint32_t servicetyp, - uint32_t serviceCopy, - uint32_t module, - uint32_t modtyp, - uint32_t sensor) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (ring & kRodRingMask) << kRodRingOffset | version << kETLVersionOffset | - (servicetyp & kETLservicetypMask) << kETLservicetypOffset | - (serviceCopy & kETLserviceCopyMask) << kETLserviceCopyOffset | - (module & kETLmodCopyv11Mask) << kETLmodCopyv11Offset | - (modtyp & kETLmodTypev11Mask) << kETLmodTypev11Offset | (sensor & kETLsensorv11Mask); - } - - /** ETL TDR Construct and fill only the det and sub-det fields. */ - /** input disc runs from 0 to 1 */ - - inline uint32_t encodeSector(uint32_t& disc, uint32_t& discside, uint32_t& sector) const { - return (sector + discside * kSoff + 2 * kSoff * disc); - } - - /** decode encoded "ring" field, disc numbered from 1 to 2, as in dedicated method */ - - static void decodeSector(const uint32_t rr, uint32_t& nDisc, uint32_t& discSide, uint32_t& sector) { - nDisc = (((rr - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1; - discSide = ((rr - 1) >> kETLdiscSideOffset) & kETLdiscSideMask; - sector = ((rr - 1) & kETLsectorMask) + 1; - } - - // pre v8 - ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset | - (module & kETLmoduleMask) << kETLmoduleOffset | (modtyp & kETLmodTypeMask) << kETLmodTypeOffset; - id_ |= kETLformatV2; - } - // v8 - v10 - ETLDetId(uint32_t zside, - uint32_t disc, - uint32_t discside, - uint32_t sector, - uint32_t module, - uint32_t modtyp, - uint32_t sensor) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset | - (module & kETLmoduleMask) << kETLmoduleOffset | (modtyp & kETLmodTypeMask) << kETLmodTypeOffset | - (sensor & kETLsensorMask) << kETLsensorOffset; - id_ |= kETLformatV2; - } - // from v11 - ETLDetId(uint32_t zside, - uint32_t disc, - uint32_t discside, - uint32_t sector, - uint32_t version, - uint32_t servicetyp, - uint32_t serviceCopy, - uint32_t module, - uint32_t modtyp, - uint32_t sensor) - : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { - id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | - (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset | version << kETLVersionOffset | - (servicetyp & kETLservicetypMask) << kETLservicetypOffset | - (serviceCopy & kETLserviceCopyMask) << kETLserviceCopyOffset | - (module & kETLmodCopyv11Mask) << kETLmodCopyv11Offset | - (modtyp & kETLmodTypev11Mask) << kETLmodTypev11Offset | (sensor & kETLsensorv11Mask); - } - - // ---------- Common methods ---------- - - /** Returns 1 if bit15 is 1 (version 11 onwards) 0 if not. */ - inline int version() const { return (id_ >> kETLVersionOffset) & 0x1; } - - /** Returns ETL service hybrid type from v11 onwards. */ - inline int servType() const { return version() == 1 ? (id_ >> kETLservicetypOffset) & kETLservicetypMask : 0; } - - /** Returns ETL service hybrid number from v11 onwards. */ - inline int servCopy() const { return version() == 1 ? (id_ >> kETLserviceCopyOffset) & kETLserviceCopyMask : 0; } - - /** Returns ETL module number. Uses version bit to decide between pre-v11 and v11+. */ - inline int module() const { - if (version() == 1) { - return (id_ >> kETLmodCopyv11Offset) & kETLmodCopyv11Mask; - } else { - return (id_ >> kETLmoduleOffset) & kETLmoduleMask; + + /** Construct and fill only the det and sub-det fields. */ + // pre v8 + ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (ring & kRodRingMask) << kRodRingOffset | (module & kETLmoduleMask) << kETLmoduleOffset | + (modtyp & kETLmodTypeMask) << kETLmodTypeOffset; + id_ |= kETLformatV2; } - } - - /** Returns ETL module type number. Uses version bit to decide between pre-v11 and v11+. */ - inline int modType() const { - if (version() == 1) { - int mt = (id_ >> kETLmodTypev11Offset) & kETLmodTypev11Mask; - return (mt == 0 ? 2 : 1); - } else { - return (id_ >> kETLmodTypeOffset) & kETLmodTypeMask; + // v8 - v10 + ETLDetId(uint32_t zside, uint32_t ring, uint32_t module, uint32_t modtyp, uint32_t sensor) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (ring & kRodRingMask) << kRodRingOffset | (module & kETLmoduleMask) << kETLmoduleOffset | + (modtyp & kETLmodTypeMask) << kETLmodTypeOffset | (sensor & kETLsensorMask) << kETLsensorOffset; + id_ |= kETLformatV2; + } + // from v11 + ETLDetId(uint32_t zside, + uint32_t ring, + uint32_t version, + uint32_t servicetyp, + uint32_t serviceCopy, + uint32_t module, + uint32_t modtyp, + uint32_t sensor) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (ring & kRodRingMask) << kRodRingOffset | version << kETLVersionOffset | + (servicetyp & kETLservicetypMask) << kETLservicetypOffset | + (serviceCopy & kETLserviceCopyMask) << kETLserviceCopyOffset | + (module & kETLmodCopyv11Mask) << kETLmodCopyv11Offset | + (modtyp & kETLmodTypev11Mask) << kETLmodTypev11Offset | (sensor & kETLsensorv11Mask); + } + + /** ETL TDR Construct and fill only the det and sub-det fields. */ + /** input disc runs from 0 to 1 */ + + inline uint32_t encodeSector(uint32_t& disc, uint32_t& discside, uint32_t& sector) const { + return (sector + discside * kSoff + 2 * kSoff * disc); } - } - - /** Returns ETL module sensor number. Uses version bit to decide between pre-v11 and v11+. */ - inline int sensor() const { - if (version() == 1) { - int s = (id_ & kETLsensorv11Mask); - return (s == 0 ? 2 : 1); - } else { - return (id_ >> kETLsensorOffset) & kETLsensorMask; + + /** decode encoded "ring" field, disc numbered from 1 to 2, as in dedicated method */ + + static void decodeSector(const uint32_t rr, uint32_t& nDisc, uint32_t& discSide, uint32_t& sector) { + nDisc = (((rr - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1; + discSide = ((rr - 1) >> kETLdiscSideOffset) & kETLdiscSideMask; + sector = ((rr - 1) & kETLsectorMask) + 1; } - } - ETLDetId geographicalId() const { return id_; } + // pre v8 + ETLDetId(uint32_t zside, uint32_t disc, uint32_t discside, uint32_t sector, uint32_t module, uint32_t modtyp) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset | + (module & kETLmoduleMask) << kETLmoduleOffset | (modtyp & kETLmodTypeMask) << kETLmodTypeOffset; + id_ |= kETLformatV2; + } + // v8 - v10 + ETLDetId(uint32_t zside, + uint32_t disc, + uint32_t discside, + uint32_t sector, + uint32_t module, + uint32_t modtyp, + uint32_t sensor) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset | + (module & kETLmoduleMask) << kETLmoduleOffset | (modtyp & kETLmodTypeMask) << kETLmodTypeOffset | + (sensor & kETLsensorMask) << kETLsensorOffset; + id_ |= kETLformatV2; + } + // from v11 + ETLDetId(uint32_t zside, + uint32_t disc, + uint32_t discside, + uint32_t sector, + uint32_t version, + uint32_t servicetyp, + uint32_t serviceCopy, + uint32_t module, + uint32_t modtyp, + uint32_t sensor) + : MTDDetId(DetId::Forward, ForwardSubdetector::FastTime) { + id_ |= (MTDType::ETL & kMTDsubdMask) << kMTDsubdOffset | (zside & kZsideMask) << kZsideOffset | + (encodeSector(disc, discside, sector) & kRodRingMask) << kRodRingOffset | version << kETLVersionOffset | + (servicetyp & kETLservicetypMask) << kETLservicetypOffset | + (serviceCopy & kETLserviceCopyMask) << kETLserviceCopyOffset | + (module & kETLmodCopyv11Mask) << kETLmodCopyv11Offset | + (modtyp & kETLmodTypev11Mask) << kETLmodTypev11Offset | (sensor & kETLsensorv11Mask); + } - // --------- Methods for the TDR ETL model only ----------- - // meaningless for TP model + // ---------- Common methods ---------- - // starting from 1 - inline int sector() const { return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) & kETLsectorMask) + 1; } + /** Returns 1 if bit15 is 1 (version 11 onwards) 0 if not. */ + inline int version() const { return (id_ >> kETLVersionOffset) & 0x1; } - // 0 = front, 1 = back - inline int discSide() const { - return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLdiscSideOffset) & kETLdiscSideMask; - } + /** Returns ETL service hybrid type from v11 onwards. */ + inline int servType() const { return version() == 1 ? (id_ >> kETLservicetypOffset) & kETLservicetypMask : 0; } - // starting from 1 - inline int nDisc() const { - return (((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1; - } + /** Returns ETL service hybrid number from v11 onwards. */ + inline int servCopy() const { return version() == 1 ? (id_ >> kETLserviceCopyOffset) & kETLserviceCopyMask : 0; } - uint32_t newForm(const uint32_t& rawid) { - uint32_t fixedP = rawid & (0xFFFFFFFF - kETLoldFieldMask); // unchanged part of id - uint32_t shiftP = (rawid & kETLoldFieldMask) >> kETLoldToNewShift; // shifted part - return ((fixedP | shiftP) | kETLformatV2); - } -}; + /** Returns ETL module number. Uses version bit to decide between pre-v11 and v11+. */ + inline int module() const { + if (version() == 1) { + return (id_ >> kETLmodCopyv11Offset) & kETLmodCopyv11Mask; + } else { + return (id_ >> kETLmoduleOffset) & kETLmoduleMask; + } + } + + /** Returns ETL module type number. Uses version bit to decide between pre-v11 and v11+. */ + inline int modType() const { + if (version() == 1) { + int mt = (id_ >> kETLmodTypev11Offset) & kETLmodTypev11Mask; + return (mt == 0 ? 2 : 1); + } else { + return (id_ >> kETLmodTypeOffset) & kETLmodTypeMask; + } + } + + /** Returns ETL module sensor number. Uses version bit to decide between pre-v11 and v11+. */ + inline int sensor() const { + if (version() == 1) { + int s = (id_ & kETLsensorv11Mask); + return (s == 0 ? 2 : 1); + } else { + return (id_ >> kETLsensorOffset) & kETLsensorMask; + } + } + + ETLDetId geographicalId() const { return id_; } + + // --------- Methods for the TDR ETL model only ----------- + // meaningless for TP model + + // starting from 1 + inline int sector() const { return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) & kETLsectorMask) + 1; } + + // 0 = front, 1 = back + inline int discSide() const { + return ((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLdiscSideOffset) & kETLdiscSideMask; + } + + // starting from 1 + inline int nDisc() const { + return (((((id_ >> kRodRingOffset) & kRodRingMask) - 1) >> kETLnDiscOffset) & kETLnDiscMask) + 1; + } + + uint32_t newForm(const uint32_t& rawid) { + uint32_t fixedP = rawid & (0xFFFFFFFF - kETLoldFieldMask); // unchanged part of id + uint32_t shiftP = (rawid & kETLoldFieldMask) >> kETLoldToNewShift; // shifted part + return ((fixedP | shiftP) | kETLformatV2); + } + }; -std::ostream& operator<<(std::ostream&, const ETLDetId&); + std::ostream& operator<<(std::ostream&, const ETLDetId&); +} // namespace io_v1 +using ETLDetId = io_v1::ETLDetId; std::stringstream printETLDetId(uint32_t detId); diff --git a/DataFormats/ForwardDetId/interface/MTDDetId.h b/DataFormats/ForwardDetId/interface/MTDDetId.h index 3564a8eb63a9b..dd03214147cef 100644 --- a/DataFormats/ForwardDetId/interface/MTDDetId.h +++ b/DataFormats/ForwardDetId/interface/MTDDetId.h @@ -18,67 +18,69 @@ */ -class MTDDetId : public DetId { -public: - /** Enumerated type for Forward sub-deteector systems. */ - enum SubDetector { subUNKNOWN = 0, FastTime = 1 }; - - /** Enumerated type for MTD sub-deteector systems. */ - enum MTDType { typeUNKNOWN = 0, BTL = 1, ETL = 2 }; - - static const uint32_t kMTDOffset = 25; - static const uint32_t kMTDsubdOffset = 23; - static const uint32_t kMTDsubdMask = 0x3; - static const uint32_t kZsideOffset = 22; - static const uint32_t kZsideMask = 0x1; - static const uint32_t kRodRingOffset = 16; - static const uint32_t kRodRingMask = 0x3F; - - static constexpr uint32_t kMTDMask = 0x31; // DetId::Detector::Forward && MTDDetId::SubDetector::FastTime - static constexpr uint32_t kBTLMask = 0xc5; // isMTD && MTDDetId::MTDType::BTL - static constexpr uint32_t kETLMask = 0xc6; // isMTD && MTDDetId::MTDType::ETL - - // ---------- Constructors, enumerated types ---------- - - /** Construct a null id */ - MTDDetId() : DetId() { ; } - - /** Construct from a raw value */ - MTDDetId(const uint32_t& raw_id) : DetId(raw_id) { ; } - - /** Construct from generic DetId */ - MTDDetId(const DetId& det_id) : DetId(det_id.rawId()) { ; } - - /** Construct and fill only the det and sub-det fields. */ - MTDDetId(Detector det, int subdet) : DetId(det, subdet) { ; } - - // ---------- Common methods ---------- - - /** Returns enumerated type specifying MTD sub-detector. */ - inline SubDetector subDetector() const { return static_cast(subdetId()); } - - /** Returns enumerated type specifying MTD sub-detector, i.e. BTL or ETL. */ - inline int mtdSubDetector() const { return (id_ >> kMTDsubdOffset) & kMTDsubdMask; } - - static inline bool const testForMTD(const DetId& id) { - return (id.rawId() >> MTDDetId::kMTDOffset) == MTDDetId::kMTDMask; - } - static inline bool const testForBTL(const DetId& id) { - return (id.rawId() >> MTDDetId::kMTDsubdOffset) == MTDDetId::kBTLMask; - } - static inline bool const testForETL(const DetId& id) { - return (id.rawId() >> MTDDetId::kMTDsubdOffset) == MTDDetId::kETLMask; - } - - /** Returns MTD side, i.e. Z-=0 or Z+=1. */ - inline int mtdSide() const { return (id_ >> kZsideOffset) & kZsideMask; } - /** Return MTD side, i.e. Z-=-1 or Z+=1. */ - inline int zside() const { return (mtdSide() == 1 ? (1) : (-1)); } - - /** Returns MTD rod/ring number. */ - inline int mtdRR() const { return (id_ >> kRodRingOffset) & kRodRingMask; } -}; - -std::ostream& operator<<(std::ostream&, const MTDDetId&); - +namespace io_v1 { + class MTDDetId : public DetId { + public: + /** Enumerated type for Forward sub-deteector systems. */ + enum SubDetector { subUNKNOWN = 0, FastTime = 1 }; + + /** Enumerated type for MTD sub-deteector systems. */ + enum MTDType { typeUNKNOWN = 0, BTL = 1, ETL = 2 }; + + static const uint32_t kMTDOffset = 25; + static const uint32_t kMTDsubdOffset = 23; + static const uint32_t kMTDsubdMask = 0x3; + static const uint32_t kZsideOffset = 22; + static const uint32_t kZsideMask = 0x1; + static const uint32_t kRodRingOffset = 16; + static const uint32_t kRodRingMask = 0x3F; + + static constexpr uint32_t kMTDMask = 0x31; // DetId::Detector::Forward && MTDDetId::SubDetector::FastTime + static constexpr uint32_t kBTLMask = 0xc5; // isMTD && MTDDetId::MTDType::BTL + static constexpr uint32_t kETLMask = 0xc6; // isMTD && MTDDetId::MTDType::ETL + + // ---------- Constructors, enumerated types ---------- + + /** Construct a null id */ + MTDDetId() : DetId() { ; } + + /** Construct from a raw value */ + MTDDetId(const uint32_t& raw_id) : DetId(raw_id) { ; } + + /** Construct from generic DetId */ + MTDDetId(const DetId& det_id) : DetId(det_id.rawId()) { ; } + + /** Construct and fill only the det and sub-det fields. */ + MTDDetId(Detector det, int subdet) : DetId(det, subdet) { ; } + + // ---------- Common methods ---------- + + /** Returns enumerated type specifying MTD sub-detector. */ + inline SubDetector subDetector() const { return static_cast(subdetId()); } + + /** Returns enumerated type specifying MTD sub-detector, i.e. BTL or ETL. */ + inline int mtdSubDetector() const { return (id_ >> kMTDsubdOffset) & kMTDsubdMask; } + + static inline bool const testForMTD(const DetId& id) { + return (id.rawId() >> MTDDetId::kMTDOffset) == MTDDetId::kMTDMask; + } + static inline bool const testForBTL(const DetId& id) { + return (id.rawId() >> MTDDetId::kMTDsubdOffset) == MTDDetId::kBTLMask; + } + static inline bool const testForETL(const DetId& id) { + return (id.rawId() >> MTDDetId::kMTDsubdOffset) == MTDDetId::kETLMask; + } + + /** Returns MTD side, i.e. Z-=0 or Z+=1. */ + inline int mtdSide() const { return (id_ >> kZsideOffset) & kZsideMask; } + /** Return MTD side, i.e. Z-=-1 or Z+=1. */ + inline int zside() const { return (mtdSide() == 1 ? (1) : (-1)); } + + /** Returns MTD rod/ring number. */ + inline int mtdRR() const { return (id_ >> kRodRingOffset) & kRodRingMask; } + }; + + std::ostream& operator<<(std::ostream&, const MTDDetId&); +} // namespace io_v1 +using MTDDetId = io_v1::MTDDetId; #endif // DataFormats_MTDDetId_MTDDetId_h diff --git a/DataFormats/ForwardDetId/src/BTLDetId.cc b/DataFormats/ForwardDetId/src/BTLDetId.cc index 3cd52885b6388..0039bb1254887 100644 --- a/DataFormats/ForwardDetId/src/BTLDetId.cc +++ b/DataFormats/ForwardDetId/src/BTLDetId.cc @@ -17,21 +17,23 @@ BTLDetId BTLDetId::geographicalId(CrysLayout lay) const { #include -std::ostream& operator<<(std::ostream& os, const BTLDetId& id) { - os << (MTDDetId&)id; - os << " BTL " << std::endl - << " Side : " << id.mtdSide() << std::endl - << " Rod : " << id.mtdRR() << std::endl - << " Crystal type: " << id.modType() << std::endl - << " Readout unit: " << id.runit() << std::endl - << " Readout unit by type: " << id.runitByType() << std::endl - << " Detector Module: " << id.dmodule() << std::endl - << " Sensor Module: " << id.smodule() << std::endl - << " Module : " << id.module() << std::endl - << " Crystal : " << id.crystal() << std::endl - << " Crystal in DB: " << id.crystalConsDB() << std::endl; - return os; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const BTLDetId& id) { + os << (MTDDetId&)id; + os << " BTL " << std::endl + << " Side : " << id.mtdSide() << std::endl + << " Rod : " << id.mtdRR() << std::endl + << " Crystal type: " << id.modType() << std::endl + << " Readout unit: " << id.runit() << std::endl + << " Readout unit by type: " << id.runitByType() << std::endl + << " Detector Module: " << id.dmodule() << std::endl + << " Sensor Module: " << id.smodule() << std::endl + << " Module : " << id.module() << std::endl + << " Crystal : " << id.crystal() << std::endl + << " Crystal in DB: " << id.crystalConsDB() << std::endl; + return os; + } +} // namespace io_v1 std::stringstream printBTLSMDetId(uint32_t detId) { std::stringstream ss; diff --git a/DataFormats/ForwardDetId/src/ETLDetId.cc b/DataFormats/ForwardDetId/src/ETLDetId.cc index 067633145f758..7bb8f0f5bda98 100644 --- a/DataFormats/ForwardDetId/src/ETLDetId.cc +++ b/DataFormats/ForwardDetId/src/ETLDetId.cc @@ -1,20 +1,22 @@ #include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include -std::ostream& operator<<(std::ostream& os, const ETLDetId& id) { - os << (MTDDetId&)id; - os << " ETL " << std::endl - << " Side : " << id.mtdSide() << std::endl - << " Disc : " << id.nDisc() << std::endl - << " Disc Side : " << id.discSide() << std::endl - << " Sector : " << id.sector() << std::endl - << " Service Hybrid Type : " << id.servType() << std::endl - << " Service Hybrid Number : " << id.servCopy() << std::endl - << " Module Number : " << id.module() << std::endl - << " Module Type : " << id.modType() << std::endl - << " Sensor : " << id.sensor() << std::endl; - return os; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const ETLDetId& id) { + os << (MTDDetId&)id; + os << " ETL " << std::endl + << " Side : " << id.mtdSide() << std::endl + << " Disc : " << id.nDisc() << std::endl + << " Disc Side : " << id.discSide() << std::endl + << " Sector : " << id.sector() << std::endl + << " Service Hybrid Type : " << id.servType() << std::endl + << " Service Hybrid Number : " << id.servCopy() << std::endl + << " Module Number : " << id.module() << std::endl + << " Module Type : " << id.modType() << std::endl + << " Sensor : " << id.sensor() << std::endl; + return os; + } +} // namespace io_v1 std::stringstream printETLDetId(uint32_t detId) { std::stringstream ss; diff --git a/DataFormats/ForwardDetId/src/MTDDetId.cc b/DataFormats/ForwardDetId/src/MTDDetId.cc index 06fcbfa248da6..759eca644a3dc 100644 --- a/DataFormats/ForwardDetId/src/MTDDetId.cc +++ b/DataFormats/ForwardDetId/src/MTDDetId.cc @@ -2,21 +2,23 @@ #include #include -std::ostream& operator<<(std::ostream& os, const MTDDetId& id) { - return os << "[MTDDetId::print] " - << " " << std::bitset<4>((id.rawId() >> 28) & 0xF).to_string() << " " - << std::bitset<4>((id.rawId() >> 24) & 0xF).to_string() << " " - << std::bitset<4>((id.rawId() >> 20) & 0xF).to_string() << " " - << std::bitset<4>((id.rawId() >> 16) & 0xF).to_string() << " " - << std::bitset<4>((id.rawId() >> 12) & 0xF).to_string() << " " - << std::bitset<4>((id.rawId() >> 8) & 0xF).to_string() << " " - << std::bitset<4>((id.rawId() >> 4) & 0xF).to_string() << " " - << std::bitset<4>(id.rawId() & 0xF).to_string() << std::endl - << " rawId : 0x" << std::hex << std::setfill('0') << std::setw(8) << id.rawId() << std::dec << " / " - << id.rawId() << std::endl - << " bits[0:24] : " << std::hex << std::setfill('0') << std::setw(8) << (0x01FFFFFF & id.rawId()) - << std::dec << std::endl - << " Detector : " << id.det() << std::endl - << " SubDetector : " << id.subdetId() << std::endl - << " MTD subdetector : " << id.mtdSubDetector() << std::endl; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const MTDDetId& id) { + return os << "[MTDDetId::print] " + << " " << std::bitset<4>((id.rawId() >> 28) & 0xF).to_string() << " " + << std::bitset<4>((id.rawId() >> 24) & 0xF).to_string() << " " + << std::bitset<4>((id.rawId() >> 20) & 0xF).to_string() << " " + << std::bitset<4>((id.rawId() >> 16) & 0xF).to_string() << " " + << std::bitset<4>((id.rawId() >> 12) & 0xF).to_string() << " " + << std::bitset<4>((id.rawId() >> 8) & 0xF).to_string() << " " + << std::bitset<4>((id.rawId() >> 4) & 0xF).to_string() << " " + << std::bitset<4>(id.rawId() & 0xF).to_string() << std::endl + << " rawId : 0x" << std::hex << std::setfill('0') << std::setw(8) << id.rawId() << std::dec << " / " + << id.rawId() << std::endl + << " bits[0:24] : " << std::hex << std::setfill('0') << std::setw(8) << (0x01FFFFFF & id.rawId()) + << std::dec << std::endl + << " Detector : " << id.det() << std::endl + << " SubDetector : " << id.subdetId() << std::endl + << " MTD subdetector : " << id.mtdSubDetector() << std::endl; + } +} // namespace io_v1 diff --git a/DataFormats/ForwardDetId/src/classes_def.xml b/DataFormats/ForwardDetId/src/classes_def.xml index d0b706542f770..b1f877bfb0549 100644 --- a/DataFormats/ForwardDetId/src/classes_def.xml +++ b/DataFormats/ForwardDetId/src/classes_def.xml @@ -1,40 +1,35 @@ - - + + - - - + + - - - + + - - - + + - - + + - - + + - - + + - - + + - - - + + - - + + - - - + + diff --git a/DataFormats/GEMDigi/interface/GEMAMC13Status.h b/DataFormats/GEMDigi/interface/GEMAMC13Status.h index a1ad46fcc86c7..06f51099ac5ff 100644 --- a/DataFormats/GEMDigi/interface/GEMAMC13Status.h +++ b/DataFormats/GEMDigi/interface/GEMAMC13Status.h @@ -7,66 +7,71 @@ #include #include -class GEMAMC13Status { -public: - union Errors { - uint8_t codes; - struct { - uint8_t InValidSize : 1; - uint8_t failTrailerCheck : 1; - uint8_t failFragmentLength : 1; - uint8_t failTrailerMatch : 1; - uint8_t moreTrailers : 1; - uint8_t crcModified : 1; - uint8_t slinkError : 1; - uint8_t wrongFedId : 1; +namespace io_v1 { + + class GEMAMC13Status { + public: + union Errors { + uint8_t codes; + struct { + uint8_t InValidSize : 1; + uint8_t failTrailerCheck : 1; + uint8_t failFragmentLength : 1; + uint8_t failTrailerMatch : 1; + uint8_t moreTrailers : 1; + uint8_t crcModified : 1; + uint8_t slinkError : 1; + uint8_t wrongFedId : 1; + }; }; - }; - union Warnings { - uint8_t wcodes; - struct { - uint8_t InValidAMC : 1; // error for AMC but cant display when not found. + union Warnings { + uint8_t wcodes; + struct { + uint8_t InValidAMC : 1; // error for AMC but cant display when not found. + }; }; - }; - GEMAMC13Status() {} - GEMAMC13Status(const FEDRawData& fedData) { - Errors error{0}; - if ((fedData.size() / sizeof(uint64_t)) < 5) { - error.InValidSize = 1; - } else { - FEDTrailer trailer(fedData.data() + fedData.size() - FEDTrailer::length); - error.failTrailerCheck = !trailer.check(); - error.failFragmentLength = (trailer.fragmentLength() * sizeof(uint64_t) != fedData.size()); - error.moreTrailers = trailer.moreTrailers(); - error.crcModified = trailer.crcModified(); - error.slinkError = trailer.slinkError(); - error.wrongFedId = trailer.wrongFedId(); + GEMAMC13Status() {} + GEMAMC13Status(const FEDRawData& fedData) { + Errors error{0}; + if ((fedData.size() / sizeof(uint64_t)) < 5) { + error.InValidSize = 1; + } else { + FEDTrailer trailer(fedData.data() + fedData.size() - FEDTrailer::length); + error.failTrailerCheck = !trailer.check(); + error.failFragmentLength = (trailer.fragmentLength() * sizeof(uint64_t) != fedData.size()); + error.moreTrailers = trailer.moreTrailers(); + error.crcModified = trailer.crcModified(); + error.slinkError = trailer.slinkError(); + error.wrongFedId = trailer.wrongFedId(); + } + errors_ = error.codes; + + Warnings warn{0}; + warnings_ = warn.wcodes; + } + void inValidAMC() { + Warnings warn{warnings_}; + warn.InValidAMC = 1; + warnings_ = warn.wcodes; } - errors_ = error.codes; - Warnings warn{0}; - warnings_ = warn.wcodes; - } - void inValidAMC() { - Warnings warn{warnings_}; - warn.InValidAMC = 1; - warnings_ = warn.wcodes; - } + bool isBad() const { return errors_ != 0; } + uint8_t errors() const { return errors_; } + uint8_t warnings() const { return warnings_; } - bool isBad() const { return errors_ != 0; } - uint8_t errors() const { return errors_; } - uint8_t warnings() const { return warnings_; } + private: + uint8_t errors_; + uint8_t warnings_; + }; -private: - uint8_t errors_; - uint8_t warnings_; -}; + inline std::ostream& operator<<(std::ostream& out, const GEMAMC13Status& status) { + out << "GEMAMC13Status errors " << std::bitset<8>(status.errors()) << " warnings " + << std::bitset<8>(status.warnings()); + return out; + } -inline std::ostream& operator<<(std::ostream& out, const GEMAMC13Status& status) { - out << "GEMAMC13Status errors " << std::bitset<8>(status.errors()) << " warnings " - << std::bitset<8>(status.warnings()); - return out; -} +} // namespace io_v1 +using GEMAMC13Status = io_v1::GEMAMC13Status; #endif diff --git a/DataFormats/GEMDigi/interface/GEMAMCStatus.h b/DataFormats/GEMDigi/interface/GEMAMCStatus.h index dade9816b4e30..4a1659f55dcf6 100644 --- a/DataFormats/GEMDigi/interface/GEMAMCStatus.h +++ b/DataFormats/GEMDigi/interface/GEMAMCStatus.h @@ -5,85 +5,90 @@ #include #include -class GEMAMCStatus { -public: - union Errors { - uint16_t ecodes; - struct { - uint16_t badEC : 1; // event counter - uint16_t badBC : 1; // bunch crossing - uint16_t badOC : 1; // orbit number - uint16_t badRunType : 1; - uint16_t badCRC : 1; - uint16_t MMCMlocked : 1; - uint16_t DAQclocklocked : 1; - uint16_t DAQnotReday : 1; - uint16_t BC0locked : 1; - uint16_t badFEDId : 1; - uint16_t L1AFull : 1; +namespace io_v1 { + + class GEMAMCStatus { + public: + union Errors { + uint16_t ecodes; + struct { + uint16_t badEC : 1; // event counter + uint16_t badBC : 1; // bunch crossing + uint16_t badOC : 1; // orbit number + uint16_t badRunType : 1; + uint16_t badCRC : 1; + uint16_t MMCMlocked : 1; + uint16_t DAQclocklocked : 1; + uint16_t DAQnotReday : 1; + uint16_t BC0locked : 1; + uint16_t badFEDId : 1; + uint16_t L1AFull : 1; + }; }; - }; - union Warnings { - uint8_t wcodes; - struct { - uint8_t InValidOH : 1; - uint8_t backPressure : 1; - uint8_t L1ANearFull : 1; + union Warnings { + uint8_t wcodes; + struct { + uint8_t InValidOH : 1; + uint8_t backPressure : 1; + uint8_t L1ANearFull : 1; + }; }; - }; - GEMAMCStatus() {} - GEMAMCStatus(const GEMAMC13* amc13, const GEMAMC& amc) { - amcNum_ = amc.amcNum(); - Errors error{0}; - error.badEC = (amc13->lv1Id() != amc.lv1Id()); - // Last BC in AMC13 is different to TCDS, AMC, and VFAT - error.badBC = !((amc13->bunchCrossing() == amc.bunchCrossing()) || - (amc13->bunchCrossing() == 0 && amc.bunchCrossing() == GEMAMC13::lastBC)); - error.badRunType = amc.runType() != 0x1; - // Last OC in AMC13 is different to TCDS, AMC, and VFAT - if (amc.formatVer() == 0) - error.badOC = - !((uint16_t(amc13->orbitNumber()) == amc.orbitNumber()) || - (amc13->bunchCrossing() == 0 && uint16_t(amc.orbitNumber() + 1) == uint16_t(amc13->orbitNumber()))); - else - error.badOC = !((amc13->orbitNumber() == (amc.orbitNumber() + 1)) || - (amc13->bunchCrossing() == 0 && amc13->orbitNumber() == (amc.orbitNumber() + 2))); - error.MMCMlocked = !amc.mmcmLocked(); - error.DAQclocklocked = !amc.daqClockLocked(); - error.DAQnotReday = !amc.daqReady(); - error.BC0locked = !amc.bc0locked(); - error.badFEDId = (amc13->sourceId() != amc.softSrcId() and amc.formatVer() != 0); - error.L1AFull = (amc.l1aF() and amc.formatVer() != 0); - errors_ = error.ecodes; + GEMAMCStatus() {} + GEMAMCStatus(const GEMAMC13* amc13, const GEMAMC& amc) { + amcNum_ = amc.amcNum(); + Errors error{0}; + error.badEC = (amc13->lv1Id() != amc.lv1Id()); + // Last BC in AMC13 is different to TCDS, AMC, and VFAT + error.badBC = !((amc13->bunchCrossing() == amc.bunchCrossing()) || + (amc13->bunchCrossing() == 0 && amc.bunchCrossing() == GEMAMC13::lastBC)); + error.badRunType = amc.runType() != 0x1; + // Last OC in AMC13 is different to TCDS, AMC, and VFAT + if (amc.formatVer() == 0) + error.badOC = + !((uint16_t(amc13->orbitNumber()) == amc.orbitNumber()) || + (amc13->bunchCrossing() == 0 && uint16_t(amc.orbitNumber() + 1) == uint16_t(amc13->orbitNumber()))); + else + error.badOC = !((amc13->orbitNumber() == (amc.orbitNumber() + 1)) || + (amc13->bunchCrossing() == 0 && amc13->orbitNumber() == (amc.orbitNumber() + 2))); + error.MMCMlocked = !amc.mmcmLocked(); + error.DAQclocklocked = !amc.daqClockLocked(); + error.DAQnotReday = !amc.daqReady(); + error.BC0locked = !amc.bc0locked(); + error.badFEDId = (amc13->sourceId() != amc.softSrcId() and amc.formatVer() != 0); + error.L1AFull = (amc.l1aF() and amc.formatVer() != 0); + errors_ = error.ecodes; - Warnings warn{0}; - warn.backPressure = amc.backPressure(); - warn.L1ANearFull = (amc.l1aNF() and amc.formatVer() != 0); - warnings_ = warn.wcodes; - } + Warnings warn{0}; + warn.backPressure = amc.backPressure(); + warn.L1ANearFull = (amc.l1aNF() and amc.formatVer() != 0); + warnings_ = warn.wcodes; + } - void inValidOH() { - Warnings warn{warnings_}; - warn.InValidOH = 1; - warnings_ = warn.wcodes; - } + void inValidOH() { + Warnings warn{warnings_}; + warn.InValidOH = 1; + warnings_ = warn.wcodes; + } + + uint8_t amcNumber() const { return amcNum_; }; + bool isBad() const { return errors_ != 0; } + uint16_t errors() const { return errors_; } + uint8_t warnings() const { return warnings_; } - uint8_t amcNumber() const { return amcNum_; }; - bool isBad() const { return errors_ != 0; } - uint16_t errors() const { return errors_; } - uint8_t warnings() const { return warnings_; } + private: + uint8_t amcNum_; + uint16_t errors_; + uint8_t warnings_; + }; -private: - uint8_t amcNum_; - uint16_t errors_; - uint8_t warnings_; -}; + inline std::ostream& operator<<(std::ostream& out, const GEMAMCStatus& status) { + out << "GEMAMCStatus errors " << std::bitset<16>(status.errors()) << " warnings " + << std::bitset<8>(status.warnings()); + return out; + } -inline std::ostream& operator<<(std::ostream& out, const GEMAMCStatus& status) { - out << "GEMAMCStatus errors " << std::bitset<16>(status.errors()) << " warnings " - << std::bitset<8>(status.warnings()); - return out; -} +} // namespace io_v1 +using GEMAMCStatus = io_v1::GEMAMCStatus; #endif diff --git a/DataFormats/GEMDigi/interface/GEMCoPadDigi.h b/DataFormats/GEMDigi/interface/GEMCoPadDigi.h index 7a30b62822c80..ec7418e01f807 100644 --- a/DataFormats/GEMDigi/interface/GEMCoPadDigi.h +++ b/DataFormats/GEMDigi/interface/GEMCoPadDigi.h @@ -13,30 +13,35 @@ #include #include -class GEMCoPadDigi { -public: - explicit GEMCoPadDigi(uint8_t roll, GEMPadDigi pad1, GEMPadDigi pad2); - GEMCoPadDigi(); +namespace io_v1 { - bool operator==(const GEMCoPadDigi& digi) const; - bool operator!=(const GEMCoPadDigi& digi) const; - bool isValid() const; + class GEMCoPadDigi { + public: + explicit GEMCoPadDigi(uint8_t roll, GEMPadDigi pad1, GEMPadDigi pad2); + GEMCoPadDigi(); - int roll() const { return roll_; } - int pad(int l) const; - int bx(int l) const; + bool operator==(const GEMCoPadDigi& digi) const; + bool operator!=(const GEMCoPadDigi& digi) const; + bool isValid() const; - GEMPadDigi first() const { return first_; } - GEMPadDigi second() const { return second_; } + int roll() const { return roll_; } + int pad(int l) const; + int bx(int l) const; - void print() const; + GEMPadDigi first() const { return first_; } + GEMPadDigi second() const { return second_; } -private: - uint8_t roll_; - GEMPadDigi first_; - GEMPadDigi second_; -}; + void print() const; -std::ostream& operator<<(std::ostream& o, const GEMCoPadDigi& digi); + private: + uint8_t roll_; + GEMPadDigi first_; + GEMPadDigi second_; + }; + + std::ostream& operator<<(std::ostream& o, const GEMCoPadDigi& digi); + +} // namespace io_v1 +using GEMCoPadDigi = io_v1::GEMCoPadDigi; #endif diff --git a/DataFormats/GEMDigi/interface/GEMDigi.h b/DataFormats/GEMDigi/interface/GEMDigi.h index 096549c5be44a..46dfc86f932fe 100644 --- a/DataFormats/GEMDigi/interface/GEMDigi.h +++ b/DataFormats/GEMDigi/interface/GEMDigi.h @@ -12,27 +12,32 @@ #include #include -class GEMDigi { -public: - explicit GEMDigi(uint16_t strip, int16_t bx); - GEMDigi(); +namespace io_v1 { - bool operator==(const GEMDigi& digi) const; - bool operator!=(const GEMDigi& digi) const; - bool operator<(const GEMDigi& digi) const; - bool isValid() const; + class GEMDigi { + public: + explicit GEMDigi(uint16_t strip, int16_t bx); + GEMDigi(); - // return the strip number. counts from 0. - uint16_t strip() const { return strip_; } - int16_t bx() const { return bx_; } + bool operator==(const GEMDigi& digi) const; + bool operator!=(const GEMDigi& digi) const; + bool operator<(const GEMDigi& digi) const; + bool isValid() const; - void print() const; + // return the strip number. counts from 0. + uint16_t strip() const { return strip_; } + int16_t bx() const { return bx_; } -private: - uint16_t strip_; - int16_t bx_; -}; + void print() const; -std::ostream& operator<<(std::ostream& o, const GEMDigi& digi); + private: + uint16_t strip_; + int16_t bx_; + }; + + std::ostream& operator<<(std::ostream& o, const GEMDigi& digi); + +} // namespace io_v1 +using GEMDigi = io_v1::GEMDigi; #endif diff --git a/DataFormats/GEMDigi/interface/GEMOHStatus.h b/DataFormats/GEMDigi/interface/GEMOHStatus.h index 3aa3e5d85255d..668117d5ecd76 100644 --- a/DataFormats/GEMDigi/interface/GEMOHStatus.h +++ b/DataFormats/GEMDigi/interface/GEMOHStatus.h @@ -4,94 +4,100 @@ #include #include -// GEM OptoHybrid status -class GEMOHStatus { -public: - union Errors { - uint16_t codes; - struct { - uint16_t EvtF : 1; // Event FIFO full - uint16_t InF : 1; // Input FIFO full - uint16_t L1aF : 1; // L1A FIFO full - uint16_t EvtSzOFW : 1; // Event size overflow - uint16_t Inv : 1; // Invalid event - uint16_t OOScAvV : 1; // Out of Sync (EC mismatch) AMC vs VFAT - uint16_t OOScVvV : 1; // Out of Sync (EC mismatch) VFAT vs VFAT - uint16_t BxmAvV : 1; // BX mismatch AMC vs VFAT - uint16_t BxmVvV : 1; // 1st bit BX mismatch VFAT vs VFAT - uint16_t InUfw : 1; // Input FIFO underflow - uint16_t badVFatCount : 1; +namespace io_v1 { + + // GEM OptoHybrid status + class GEMOHStatus { + public: + union Errors { + uint16_t codes; + struct { + uint16_t EvtF : 1; // Event FIFO full + uint16_t InF : 1; // Input FIFO full + uint16_t L1aF : 1; // L1A FIFO full + uint16_t EvtSzOFW : 1; // Event size overflow + uint16_t Inv : 1; // Invalid event + uint16_t OOScAvV : 1; // Out of Sync (EC mismatch) AMC vs VFAT + uint16_t OOScVvV : 1; // Out of Sync (EC mismatch) VFAT vs VFAT + uint16_t BxmAvV : 1; // BX mismatch AMC vs VFAT + uint16_t BxmVvV : 1; // 1st bit BX mismatch VFAT vs VFAT + uint16_t InUfw : 1; // Input FIFO underflow + uint16_t badVFatCount : 1; + }; }; - }; - union Warnings { - uint8_t wcodes; - struct { - uint8_t EvtNF : 1; // Event FIFO near full - uint8_t InNF : 1; // Input FIFO near full - uint8_t L1aNF : 1; // L1A FIFO near full - uint8_t EvtSzW : 1; // Event size warning - uint8_t InValidVFAT : 1; - uint8_t missingVFAT : 1; + union Warnings { + uint8_t wcodes; + struct { + uint8_t EvtNF : 1; // Event FIFO near full + uint8_t InNF : 1; // Input FIFO near full + uint8_t L1aNF : 1; // L1A FIFO near full + uint8_t EvtSzW : 1; // Event size warning + uint8_t InValidVFAT : 1; + uint8_t missingVFAT : 1; + }; }; - }; - GEMOHStatus() {} - GEMOHStatus(const GEMOptoHybrid& oh, int chamberType) : chamberType_(chamberType) { - Errors error{0}; - error.EvtF = oh.evtF(); - error.InF = oh.inF(); - error.L1aF = (oh.l1aF() and (oh.version() == 0)); - error.EvtSzOFW = oh.evtSzOFW(); - error.Inv = oh.inv(); - error.OOScAvV = oh.oOScAvV(); - error.OOScVvV = oh.oOScVvV(); - error.BxmAvV = oh.bxmAvV(); - error.BxmVvV = oh.bxmVvV(); - error.InUfw = oh.inUfw(); - error.badVFatCount = oh.vfatWordCnt() != oh.vfatWordCntT(); - errors_ = error.codes; + GEMOHStatus() {} + GEMOHStatus(const GEMOptoHybrid& oh, int chamberType) : chamberType_(chamberType) { + Errors error{0}; + error.EvtF = oh.evtF(); + error.InF = oh.inF(); + error.L1aF = (oh.l1aF() and (oh.version() == 0)); + error.EvtSzOFW = oh.evtSzOFW(); + error.Inv = oh.inv(); + error.OOScAvV = oh.oOScAvV(); + error.OOScVvV = oh.oOScVvV(); + error.BxmAvV = oh.bxmAvV(); + error.BxmVvV = oh.bxmVvV(); + error.InUfw = oh.inUfw(); + error.badVFatCount = oh.vfatWordCnt() != oh.vfatWordCntT(); + errors_ = error.codes; - Warnings warn{0}; - existVFATs_ = oh.existVFATs(); - vfatMask_ = oh.vfatMask(); - zsMask_ = oh.zsMask(); - missingVFATs_ = (existVFATs_ ^ 0xffffff) & (vfatMask_ & (zsMask_ ^ 0xffffff)); - warn.EvtNF = oh.evtNF(); - warn.InNF = oh.inNF(); - warn.L1aNF = (oh.l1aNF() and (oh.version() == 0)); - warn.EvtSzW = oh.evtSzW(); - warn.missingVFAT = (oh.version() != 0) and (missingVFATs_ != 0); - warnings_ = warn.wcodes; - } + Warnings warn{0}; + existVFATs_ = oh.existVFATs(); + vfatMask_ = oh.vfatMask(); + zsMask_ = oh.zsMask(); + missingVFATs_ = (existVFATs_ ^ 0xffffff) & (vfatMask_ & (zsMask_ ^ 0xffffff)); + warn.EvtNF = oh.evtNF(); + warn.InNF = oh.inNF(); + warn.L1aNF = (oh.l1aNF() and (oh.version() == 0)); + warn.EvtSzW = oh.evtSzW(); + warn.missingVFAT = (oh.version() != 0) and (missingVFATs_ != 0); + warnings_ = warn.wcodes; + } - void inValidVFAT() { - Warnings warn{warnings_}; - warn.InValidVFAT = 1; - warnings_ = warn.wcodes; - } + void inValidVFAT() { + Warnings warn{warnings_}; + warn.InValidVFAT = 1; + warnings_ = warn.wcodes; + } + + bool isBad() const { return errors_ != 0; } + uint16_t errors() const { return errors_; } + uint8_t warnings() const { return warnings_; } + uint32_t missingVFATs() const { return missingVFATs_; } + uint32_t vfatMask() const { return vfatMask_; } + uint32_t zsMask() const { return zsMask_; } + uint32_t existVFATs() const { return existVFATs_; } + int chamberType() const { return chamberType_; } - bool isBad() const { return errors_ != 0; } - uint16_t errors() const { return errors_; } - uint8_t warnings() const { return warnings_; } - uint32_t missingVFATs() const { return missingVFATs_; } - uint32_t vfatMask() const { return vfatMask_; } - uint32_t zsMask() const { return zsMask_; } - uint32_t existVFATs() const { return existVFATs_; } - int chamberType() const { return chamberType_; } + private: + int chamberType_; + uint16_t errors_; + uint8_t warnings_; + uint32_t missingVFATs_; + uint32_t vfatMask_; + uint32_t zsMask_; + uint32_t existVFATs_; + }; -private: - int chamberType_; - uint16_t errors_; - uint8_t warnings_; - uint32_t missingVFATs_; - uint32_t vfatMask_; - uint32_t zsMask_; - uint32_t existVFATs_; -}; + inline std::ostream& operator<<(std::ostream& out, const GEMOHStatus& status) { + out << "GEMOHStatus errors " << std::bitset<16>(status.errors()) << " warnings " + << std::bitset<8>(status.warnings()); + return out; + } -inline std::ostream& operator<<(std::ostream& out, const GEMOHStatus& status) { - out << "GEMOHStatus errors " << std::bitset<16>(status.errors()) << " warnings " << std::bitset<8>(status.warnings()); - return out; -} +} // namespace io_v1 +using GEMOHStatus = io_v1::GEMOHStatus; #endif diff --git a/DataFormats/GEMDigi/interface/GEMPadDigi.h b/DataFormats/GEMDigi/interface/GEMPadDigi.h index 72b4a00f0e611..f5419e28a4650 100644 --- a/DataFormats/GEMDigi/interface/GEMPadDigi.h +++ b/DataFormats/GEMDigi/interface/GEMPadDigi.h @@ -14,42 +14,47 @@ #include #include -class GEMPadDigi { -public: - enum InValid { ME0InValid = 255, GE11InValid = 255, GE21InValid = 511 }; - // Newer GE2/1 geometries will have 16 eta partitions - // instead of the usual 8. - enum NumberPartitions { ME0 = 8, GE11 = 8, GE21 = 8, GE21SplitStrip = 16 }; - - explicit GEMPadDigi(uint16_t pad, - int16_t bx, - enum GEMSubDetId::Station station = GEMSubDetId::Station::GE11, - unsigned nPart = NumberPartitions::GE11); - GEMPadDigi(); - - bool operator==(const GEMPadDigi& digi) const; - bool operator!=(const GEMPadDigi& digi) const; - bool operator<(const GEMPadDigi& digi) const; - // only depends on the "InValid" enum so it also - // works on unpacked data - bool isValid() const; - - // return the pad number. counts from 0. - uint16_t pad() const { return pad_; } - int16_t bx() const { return bx_; } - GEMSubDetId::Station station() const { return station_; } - - unsigned nPartitions() const { return part_; } - void print() const; - -private: - uint16_t pad_; - int16_t bx_; - GEMSubDetId::Station station_; - // number of eta partitions - unsigned part_; -}; - -std::ostream& operator<<(std::ostream& o, const GEMPadDigi& digi); +namespace io_v1 { + + class GEMPadDigi { + public: + enum InValid { ME0InValid = 255, GE11InValid = 255, GE21InValid = 511 }; + // Newer GE2/1 geometries will have 16 eta partitions + // instead of the usual 8. + enum NumberPartitions { ME0 = 8, GE11 = 8, GE21 = 8, GE21SplitStrip = 16 }; + + explicit GEMPadDigi(uint16_t pad, + int16_t bx, + enum GEMSubDetId::Station station = GEMSubDetId::Station::GE11, + unsigned nPart = NumberPartitions::GE11); + GEMPadDigi(); + + bool operator==(const GEMPadDigi& digi) const; + bool operator!=(const GEMPadDigi& digi) const; + bool operator<(const GEMPadDigi& digi) const; + // only depends on the "InValid" enum so it also + // works on unpacked data + bool isValid() const; + + // return the pad number. counts from 0. + uint16_t pad() const { return pad_; } + int16_t bx() const { return bx_; } + GEMSubDetId::Station station() const { return station_; } + + unsigned nPartitions() const { return part_; } + void print() const; + + private: + uint16_t pad_; + int16_t bx_; + GEMSubDetId::Station station_; + // number of eta partitions + unsigned part_; + }; + + std::ostream& operator<<(std::ostream& o, const GEMPadDigi& digi); + +} // namespace io_v1 +using GEMPadDigi = io_v1::GEMPadDigi; #endif diff --git a/DataFormats/GEMDigi/interface/GEMPadDigiCluster.h b/DataFormats/GEMDigi/interface/GEMPadDigiCluster.h index 32e84477898a1..cfa01d01cf24f 100644 --- a/DataFormats/GEMDigi/interface/GEMPadDigiCluster.h +++ b/DataFormats/GEMDigi/interface/GEMPadDigiCluster.h @@ -16,46 +16,51 @@ #include #include -class GEMPadDigiCluster { -public: - enum InValid { GE11InValid = 255, GE21InValid = 511 }; - // Newer GE2/1 geometries will have 16 eta partitions - // instead of the usual 8. - enum NumberPartitions { ME0 = 8, GE11 = 8, GE21 = 8, GE21SplitStrip = 16 }; - - explicit GEMPadDigiCluster(std::vector pads, - int16_t bx, - enum GEMSubDetId::Station station = GEMSubDetId::Station::GE11, - unsigned nPart = NumberPartitions::GE11); - GEMPadDigiCluster(); - - bool operator==(const GEMPadDigiCluster& digi) const; - bool operator!=(const GEMPadDigiCluster& digi) const; - bool operator<(const GEMPadDigiCluster& digi) const; - // only depends on the "InValid" enum so it also - // works on unpacked data - bool isValid() const; - - const std::vector& pads() const { return v_; } - int bx() const { return bx_; } - - GEMSubDetId::Station station() const { return station_; } - - unsigned nPartitions() const { return part_; } - void print() const; - - int alctMatchTime() const { return alctMatchTime_; } - void setAlctMatchTime(int matchWin) { alctMatchTime_ = matchWin; } - -private: - std::vector v_; - int32_t bx_; - int alctMatchTime_ = -1; - GEMSubDetId::Station station_; - // number of eta partitions - unsigned part_; -}; - -std::ostream& operator<<(std::ostream& o, const GEMPadDigiCluster& digi); +namespace io_v1 { + + class GEMPadDigiCluster { + public: + enum InValid { GE11InValid = 255, GE21InValid = 511 }; + // Newer GE2/1 geometries will have 16 eta partitions + // instead of the usual 8. + enum NumberPartitions { ME0 = 8, GE11 = 8, GE21 = 8, GE21SplitStrip = 16 }; + + explicit GEMPadDigiCluster(std::vector pads, + int16_t bx, + enum GEMSubDetId::Station station = GEMSubDetId::Station::GE11, + unsigned nPart = NumberPartitions::GE11); + GEMPadDigiCluster(); + + bool operator==(const GEMPadDigiCluster& digi) const; + bool operator!=(const GEMPadDigiCluster& digi) const; + bool operator<(const GEMPadDigiCluster& digi) const; + // only depends on the "InValid" enum so it also + // works on unpacked data + bool isValid() const; + + const std::vector& pads() const { return v_; } + int bx() const { return bx_; } + + GEMSubDetId::Station station() const { return station_; } + + unsigned nPartitions() const { return part_; } + void print() const; + + int alctMatchTime() const { return alctMatchTime_; } + void setAlctMatchTime(int matchWin) { alctMatchTime_ = matchWin; } + + private: + std::vector v_; + int32_t bx_; + int alctMatchTime_ = -1; + GEMSubDetId::Station station_; + // number of eta partitions + unsigned part_; + }; + + std::ostream& operator<<(std::ostream& o, const GEMPadDigiCluster& digi); + +} // namespace io_v1 +using GEMPadDigiCluster = io_v1::GEMPadDigiCluster; #endif diff --git a/DataFormats/GEMDigi/interface/GEMPadDigiClusterFwd.h b/DataFormats/GEMDigi/interface/GEMPadDigiClusterFwd.h index eec4b97a9348e..357aae722e419 100644 --- a/DataFormats/GEMDigi/interface/GEMPadDigiClusterFwd.h +++ b/DataFormats/GEMDigi/interface/GEMPadDigiClusterFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_GEMDigi_GEMPadDigiClusterFwd_h #define DataFormats_GEMDigi_GEMPadDigiClusterFwd_h -class GEMPadDigiCluster; +namespace io_v1 { + class GEMPadDigiCluster; +} // namespace io_v1 +using GEMPadDigiCluster = io_v1::GEMPadDigiCluster; #endif diff --git a/DataFormats/GEMDigi/interface/GEMVFATStatus.h b/DataFormats/GEMDigi/interface/GEMVFATStatus.h index 591f714c728a5..88449a62608bb 100644 --- a/DataFormats/GEMDigi/interface/GEMVFATStatus.h +++ b/DataFormats/GEMDigi/interface/GEMVFATStatus.h @@ -6,77 +6,83 @@ #include #include -class GEMVFATStatus { -public: - union Errors { - uint8_t codes; - struct { - uint8_t vc : 1; // VFAT CRC error - uint8_t InValidHeader : 1; - uint8_t EC : 1; // does not match AMC EC - uint8_t BC : 1; // does not match AMC BC - uint8_t vfatMask : 1; // VFAT mask error - uint8_t zsMask : 1; // Zero Suppression mask error +namespace io_v1 { + + class GEMVFATStatus { + public: + union Errors { + uint8_t codes; + struct { + uint8_t vc : 1; // VFAT CRC error + uint8_t InValidHeader : 1; + uint8_t EC : 1; // does not match AMC EC + uint8_t BC : 1; // does not match AMC BC + uint8_t vfatMask : 1; // VFAT mask error + uint8_t zsMask : 1; // Zero Suppression mask error + }; }; - }; - union Warnings { - uint8_t wcodes; - struct { - uint8_t basicOFW : 1; // Basic overflow warning - uint8_t zeroSupOFW : 1; // Zero-sup overflow warning + union Warnings { + uint8_t wcodes; + struct { + uint8_t basicOFW : 1; // Basic overflow warning + uint8_t zeroSupOFW : 1; // Zero-sup overflow warning + }; }; - }; - GEMVFATStatus() {} - GEMVFATStatus(const GEMAMC& amc, const GEMOptoHybrid& oh, const GEMVFAT& vfat, int chamberType, bool readMultiBX) - : chamberType_(chamberType) { - Errors error{0}; - Warnings warn{0}; + GEMVFATStatus() {} + GEMVFATStatus(const GEMAMC& amc, const GEMOptoHybrid& oh, const GEMVFAT& vfat, int chamberType, bool readMultiBX) + : chamberType_(chamberType) { + Errors error{0}; + Warnings warn{0}; - error.EC = vfat.ec() != amc.lv1Idt(); - if (!readMultiBX) - error.BC = vfat.bc() != amc.bunchCrossing(); + error.EC = vfat.ec() != amc.lv1Idt(); + if (!readMultiBX) + error.BC = vfat.bc() != amc.bunchCrossing(); - if (oh.version() != 0) { - error.vfatMask = (oh.vfatMask() >> vfat.vfatId()) ^ 0x1; - error.zsMask = (oh.zsMask() >> vfat.vfatId()) & 0x1; - } + if (oh.version() != 0) { + error.vfatMask = (oh.vfatMask() >> vfat.vfatId()) ^ 0x1; + error.zsMask = (oh.zsMask() >> vfat.vfatId()) & 0x1; + } + + if (vfat.version() > 2) { + error.vc = vfat.vc(); + if (vfat.header() == 0x1E) + warn.basicOFW = 0; + else if (vfat.header() == 0x5E) + warn.basicOFW = 1; + else if (vfat.header() == 0x1A) + warn.zeroSupOFW = 0; + else if (vfat.header() == 0x56) + warn.zeroSupOFW = 1; + else + error.InValidHeader = 1; + } + vfatPosition_ = vfat.vfatId(); - if (vfat.version() > 2) { - error.vc = vfat.vc(); - if (vfat.header() == 0x1E) - warn.basicOFW = 0; - else if (vfat.header() == 0x5E) - warn.basicOFW = 1; - else if (vfat.header() == 0x1A) - warn.zeroSupOFW = 0; - else if (vfat.header() == 0x56) - warn.zeroSupOFW = 1; - else - error.InValidHeader = 1; + errors_ = error.codes; + warnings_ = warn.wcodes; } - vfatPosition_ = vfat.vfatId(); - errors_ = error.codes; - warnings_ = warn.wcodes; - } + uint16_t vfatPosition() const { return vfatPosition_; } + bool isBad() const { return errors_ != 0; } + uint8_t errors() const { return errors_; } + uint8_t warnings() const { return warnings_; } + int chamberType() const { return chamberType_; } + + private: + int chamberType_; + uint16_t vfatPosition_; + uint8_t errors_; + uint8_t warnings_; + }; - uint16_t vfatPosition() const { return vfatPosition_; } - bool isBad() const { return errors_ != 0; } - uint8_t errors() const { return errors_; } - uint8_t warnings() const { return warnings_; } - int chamberType() const { return chamberType_; } + inline std::ostream& operator<<(std::ostream& out, const GEMVFATStatus& status) { + out << "GEMVFATStatus errors " << std::bitset<8>(status.errors()) << " warnings " + << std::bitset<8>(status.warnings()); + return out; + } -private: - int chamberType_; - uint16_t vfatPosition_; - uint8_t errors_; - uint8_t warnings_; -}; +} // namespace io_v1 +using GEMVFATStatus = io_v1::GEMVFATStatus; -inline std::ostream& operator<<(std::ostream& out, const GEMVFATStatus& status) { - out << "GEMVFATStatus errors " << std::bitset<8>(status.errors()) << " warnings " - << std::bitset<8>(status.warnings()); - return out; -} #endif diff --git a/DataFormats/GEMDigi/src/GEMCoPadDigi.cc b/DataFormats/GEMDigi/src/GEMCoPadDigi.cc index 0ac6d9eb7a930..c3072cc59198e 100644 --- a/DataFormats/GEMDigi/src/GEMCoPadDigi.cc +++ b/DataFormats/GEMDigi/src/GEMCoPadDigi.cc @@ -1,45 +1,49 @@ #include "DataFormats/GEMDigi/interface/GEMCoPadDigi.h" #include -GEMCoPadDigi::GEMCoPadDigi(uint8_t roll, GEMPadDigi f, GEMPadDigi s) : roll_(roll), first_(f), second_(s) {} - -GEMCoPadDigi::GEMCoPadDigi() : roll_(0), first_(GEMPadDigi()), second_(GEMPadDigi()) {} - -// Comparison -bool GEMCoPadDigi::operator==(const GEMCoPadDigi& digi) const { - return digi.first() == first_ and digi.second() == second_ and digi.roll() == roll_; -} - -// Comparison -bool GEMCoPadDigi::operator!=(const GEMCoPadDigi& digi) const { - return digi.first() != first_ or digi.second() != second_ or digi.roll() != roll_; -} - -bool GEMCoPadDigi::isValid() const { return first_.isValid() and second_.isValid(); } - -int GEMCoPadDigi::pad(int l) const { - if (l == 1) - return first_.pad(); - else if (l == 2) - return second_.pad(); - else - return -99; // invalid -} - -int GEMCoPadDigi::bx(int l) const { - if (l == 1) - return first_.bx(); - else if (l == 2) - return second_.bx(); - else - return -99; // invalid -} - -void GEMCoPadDigi::print() const { - std::cout << "Roll " << roll_ << ", pad1 " << first_.pad() << " bx1 " << first_.bx() << ", Pad2 " << second_.pad() - << " bx2 " << second_.bx() << std::endl; -} - -std::ostream& operator<<(std::ostream& o, const GEMCoPadDigi& digi) { - return o << "Roll: " << digi.roll() << " layer1:" << digi.first() << ", layer2:" << digi.second(); -} +namespace io_v1 { + + GEMCoPadDigi::GEMCoPadDigi(uint8_t roll, GEMPadDigi f, GEMPadDigi s) : roll_(roll), first_(f), second_(s) {} + + GEMCoPadDigi::GEMCoPadDigi() : roll_(0), first_(GEMPadDigi()), second_(GEMPadDigi()) {} + + // Comparison + bool GEMCoPadDigi::operator==(const GEMCoPadDigi& digi) const { + return digi.first() == first_ and digi.second() == second_ and digi.roll() == roll_; + } + + // Comparison + bool GEMCoPadDigi::operator!=(const GEMCoPadDigi& digi) const { + return digi.first() != first_ or digi.second() != second_ or digi.roll() != roll_; + } + + bool GEMCoPadDigi::isValid() const { return first_.isValid() and second_.isValid(); } + + int GEMCoPadDigi::pad(int l) const { + if (l == 1) + return first_.pad(); + else if (l == 2) + return second_.pad(); + else + return -99; // invalid + } + + int GEMCoPadDigi::bx(int l) const { + if (l == 1) + return first_.bx(); + else if (l == 2) + return second_.bx(); + else + return -99; // invalid + } + + void GEMCoPadDigi::print() const { + std::cout << "Roll " << roll_ << ", pad1 " << first_.pad() << " bx1 " << first_.bx() << ", Pad2 " << second_.pad() + << " bx2 " << second_.bx() << std::endl; + } + + std::ostream& operator<<(std::ostream& o, const GEMCoPadDigi& digi) { + return o << "Roll: " << digi.roll() << " layer1:" << digi.first() << ", layer2:" << digi.second(); + } + +} // namespace io_v1 diff --git a/DataFormats/GEMDigi/src/GEMDigi.cc b/DataFormats/GEMDigi/src/GEMDigi.cc index f5972243dd5a6..e121e1d85a916 100644 --- a/DataFormats/GEMDigi/src/GEMDigi.cc +++ b/DataFormats/GEMDigi/src/GEMDigi.cc @@ -1,28 +1,32 @@ #include "DataFormats/GEMDigi/interface/GEMDigi.h" #include -GEMDigi::GEMDigi(uint16_t strip, int16_t bx) : strip_(strip), bx_(bx) {} +namespace io_v1 { -GEMDigi::GEMDigi() : strip_(65535), bx_(-99) {} + GEMDigi::GEMDigi(uint16_t strip, int16_t bx) : strip_(strip), bx_(bx) {} -// Comparison -bool GEMDigi::operator==(const GEMDigi& digi) const { return strip_ == digi.strip() and bx_ == digi.bx(); } + GEMDigi::GEMDigi() : strip_(65535), bx_(-99) {} -// Comparison -bool GEMDigi::operator!=(const GEMDigi& digi) const { return strip_ != digi.strip() or bx_ != digi.bx(); } + // Comparison + bool GEMDigi::operator==(const GEMDigi& digi) const { return strip_ == digi.strip() and bx_ == digi.bx(); } -///Precedence operator -bool GEMDigi::operator<(const GEMDigi& digi) const { - if (digi.bx() == bx_) - return digi.strip() < strip_; - else - return digi.bx() < bx_; -} + // Comparison + bool GEMDigi::operator!=(const GEMDigi& digi) const { return strip_ != digi.strip() or bx_ != digi.bx(); } -bool GEMDigi::isValid() const { return bx_ != -99 and strip_ != 65535; } + ///Precedence operator + bool GEMDigi::operator<(const GEMDigi& digi) const { + if (digi.bx() == bx_) + return digi.strip() < strip_; + else + return digi.bx() < bx_; + } -std::ostream& operator<<(std::ostream& o, const GEMDigi& digi) { - return o << " GEMDigi strip = " << digi.strip() << " bx = " << digi.bx(); -} + bool GEMDigi::isValid() const { return bx_ != -99 and strip_ != 65535; } -void GEMDigi::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; } + std::ostream& operator<<(std::ostream& o, const GEMDigi& digi) { + return o << " GEMDigi strip = " << digi.strip() << " bx = " << digi.bx(); + } + + void GEMDigi::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; } + +} // namespace io_v1 diff --git a/DataFormats/GEMDigi/src/GEMPadDigi.cc b/DataFormats/GEMDigi/src/GEMPadDigi.cc index cf8fab868e230..f125ba201654f 100644 --- a/DataFormats/GEMDigi/src/GEMPadDigi.cc +++ b/DataFormats/GEMDigi/src/GEMPadDigi.cc @@ -1,40 +1,44 @@ #include "DataFormats/GEMDigi/interface/GEMPadDigi.h" #include -GEMPadDigi::GEMPadDigi(uint16_t pad, int16_t bx, enum GEMSubDetId::Station station, unsigned nPart) - : pad_(pad), bx_(bx), station_(station), part_(nPart) {} - -GEMPadDigi::GEMPadDigi() - : pad_(GE11InValid), bx_(-99), station_(GEMSubDetId::Station::GE11), part_(NumberPartitions::GE11) {} - -// Comparison -bool GEMPadDigi::operator==(const GEMPadDigi& digi) const { - return pad_ == digi.pad() and bx_ == digi.bx() and station_ == digi.station(); -} - -// Comparison -bool GEMPadDigi::operator!=(const GEMPadDigi& digi) const { return pad_ != digi.pad() or bx_ != digi.bx(); } - -///Precedence operator -bool GEMPadDigi::operator<(const GEMPadDigi& digi) const { - if (digi.bx() == bx_) - return digi.pad() < pad_; - else - return digi.bx() < bx_; -} - -bool GEMPadDigi::isValid() const { - uint16_t invalid = GE11InValid; - if (station_ == GEMSubDetId::Station::ME0) { - invalid = ME0InValid; - } else if (station_ == GEMSubDetId::Station::GE21) { - invalid = GE21InValid; +namespace io_v1 { + + GEMPadDigi::GEMPadDigi(uint16_t pad, int16_t bx, enum GEMSubDetId::Station station, unsigned nPart) + : pad_(pad), bx_(bx), station_(station), part_(nPart) {} + + GEMPadDigi::GEMPadDigi() + : pad_(GE11InValid), bx_(-99), station_(GEMSubDetId::Station::GE11), part_(NumberPartitions::GE11) {} + + // Comparison + bool GEMPadDigi::operator==(const GEMPadDigi& digi) const { + return pad_ == digi.pad() and bx_ == digi.bx() and station_ == digi.station(); + } + + // Comparison + bool GEMPadDigi::operator!=(const GEMPadDigi& digi) const { return pad_ != digi.pad() or bx_ != digi.bx(); } + + ///Precedence operator + bool GEMPadDigi::operator<(const GEMPadDigi& digi) const { + if (digi.bx() == bx_) + return digi.pad() < pad_; + else + return digi.bx() < bx_; + } + + bool GEMPadDigi::isValid() const { + uint16_t invalid = GE11InValid; + if (station_ == GEMSubDetId::Station::ME0) { + invalid = ME0InValid; + } else if (station_ == GEMSubDetId::Station::GE21) { + invalid = GE21InValid; + } + return pad_ != invalid; + } + + std::ostream& operator<<(std::ostream& o, const GEMPadDigi& digi) { + return o << " GEMPadDigi Pad = " << digi.pad() << " bx = " << digi.bx(); } - return pad_ != invalid; -} -std::ostream& operator<<(std::ostream& o, const GEMPadDigi& digi) { - return o << " GEMPadDigi Pad = " << digi.pad() << " bx = " << digi.bx(); -} + void GEMPadDigi::print() const { std::cout << "Pad " << pad() << " bx " << bx() << std::endl; } -void GEMPadDigi::print() const { std::cout << "Pad " << pad() << " bx " << bx() << std::endl; } +} // namespace io_v1 diff --git a/DataFormats/GEMDigi/src/GEMPadDigiCluster.cc b/DataFormats/GEMDigi/src/GEMPadDigiCluster.cc index 1decb9b160ac3..f983d43402dda 100644 --- a/DataFormats/GEMDigi/src/GEMPadDigiCluster.cc +++ b/DataFormats/GEMDigi/src/GEMPadDigiCluster.cc @@ -1,56 +1,60 @@ #include "DataFormats/GEMDigi/interface/GEMPadDigiCluster.h" #include -GEMPadDigiCluster::GEMPadDigiCluster(std::vector pads, - int16_t bx, - enum GEMSubDetId::Station station, - unsigned nPart) - : v_(pads), bx_(bx), station_(station), part_(nPart) {} - -GEMPadDigiCluster::GEMPadDigiCluster() - : v_(std::vector()), bx_(-99), station_(GEMSubDetId::Station::GE11), part_(NumberPartitions::GE11) {} - -// Comparison -bool GEMPadDigiCluster::operator==(const GEMPadDigiCluster& digi) const { - return v_ == digi.pads() and bx_ == digi.bx() and station_ == digi.station(); -} - -// Comparison -bool GEMPadDigiCluster::operator!=(const GEMPadDigiCluster& digi) const { - return v_ != digi.pads() or bx_ != digi.bx(); -} - -///Precedence operator -bool GEMPadDigiCluster::operator<(const GEMPadDigiCluster& digi) const { - if (digi.bx() == bx_) - return digi.pads().front() < v_.front(); - else - return digi.bx() < bx_; -} - -bool GEMPadDigiCluster::isValid() const { - // empty clusters are always invalid - if (v_.empty()) - return false; - - uint16_t invalid = GE11InValid; - if (station_ == GEMSubDetId::Station::GE21) { - invalid = GE21InValid; +namespace io_v1 { + + GEMPadDigiCluster::GEMPadDigiCluster(std::vector pads, + int16_t bx, + enum GEMSubDetId::Station station, + unsigned nPart) + : v_(pads), bx_(bx), station_(station), part_(nPart) {} + + GEMPadDigiCluster::GEMPadDigiCluster() + : v_(std::vector()), bx_(-99), station_(GEMSubDetId::Station::GE11), part_(NumberPartitions::GE11) {} + + // Comparison + bool GEMPadDigiCluster::operator==(const GEMPadDigiCluster& digi) const { + return v_ == digi.pads() and bx_ == digi.bx() and station_ == digi.station(); + } + + // Comparison + bool GEMPadDigiCluster::operator!=(const GEMPadDigiCluster& digi) const { + return v_ != digi.pads() or bx_ != digi.bx(); + } + + ///Precedence operator + bool GEMPadDigiCluster::operator<(const GEMPadDigiCluster& digi) const { + if (digi.bx() == bx_) + return digi.pads().front() < v_.front(); + else + return digi.bx() < bx_; } - return v_[0] != invalid; -} - -std::ostream& operator<<(std::ostream& o, const GEMPadDigiCluster& digi) { - o << " bx: " << digi.bx() << " pads: ["; - for (auto p : digi.pads()) - o << " " << p; - o << "]"; - return o; -} - -void GEMPadDigiCluster::print() const { - std::cout << " bx: " << bx() << " pads: "; - for (auto p : pads()) - std::cout << " " << p; - std::cout << std::endl; -} + + bool GEMPadDigiCluster::isValid() const { + // empty clusters are always invalid + if (v_.empty()) + return false; + + uint16_t invalid = GE11InValid; + if (station_ == GEMSubDetId::Station::GE21) { + invalid = GE21InValid; + } + return v_[0] != invalid; + } + + std::ostream& operator<<(std::ostream& o, const GEMPadDigiCluster& digi) { + o << " bx: " << digi.bx() << " pads: ["; + for (auto p : digi.pads()) + o << " " << p; + o << "]"; + return o; + } + + void GEMPadDigiCluster::print() const { + std::cout << " bx: " << bx() << " pads: "; + for (auto p : pads()) + std::cout << " " << p; + std::cout << std::endl; + } + +} // namespace io_v1 diff --git a/DataFormats/GEMDigi/src/classes_def.xml b/DataFormats/GEMDigi/src/classes_def.xml index 4f1414b2d244e..54b441a35cc09 100644 --- a/DataFormats/GEMDigi/src/classes_def.xml +++ b/DataFormats/GEMDigi/src/classes_def.xml @@ -1,93 +1,79 @@ - - - + + - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + + + + + @@ -99,8 +85,8 @@ - - + + @@ -108,8 +94,8 @@ - - + + @@ -117,8 +103,8 @@ - - + + @@ -126,10 +112,8 @@ - - - - + + @@ -138,7 +122,7 @@ - + diff --git a/DataFormats/GEMRecHit/interface/GEMCSCSegment.h b/DataFormats/GEMRecHit/interface/GEMCSCSegment.h index 42aed0cd6150f..a6b249d5b806a 100644 --- a/DataFormats/GEMRecHit/interface/GEMCSCSegment.h +++ b/DataFormats/GEMRecHit/interface/GEMCSCSegment.h @@ -20,72 +20,77 @@ #include -class GEMCSCSegment final : public RecSegment { -public: - /// Default constructor - GEMCSCSegment() : theChi2(0.) {} +namespace io_v1 { - /// Constructor - GEMCSCSegment(const CSCSegment* csc_segment, - const std::vector gem_rhs, - LocalPoint origin, - LocalVector direction, - AlgebraicSymMatrix errors, - double chi2); + class GEMCSCSegment final : public RecSegment { + public: + /// Default constructor + GEMCSCSegment() : theChi2(0.) {} - /// Destructor - ~GEMCSCSegment() override; + /// Constructor + GEMCSCSegment(const CSCSegment* csc_segment, + const std::vector gem_rhs, + LocalPoint origin, + LocalVector direction, + AlgebraicSymMatrix errors, + double chi2); - //--- Base class interface - GEMCSCSegment* clone() const override { return new GEMCSCSegment(*this); } + /// Destructor + ~GEMCSCSegment() override; - LocalPoint localPosition() const override { return theOrigin; } - LocalError localPositionError() const override; + //--- Base class interface + GEMCSCSegment* clone() const override { return new GEMCSCSegment(*this); } - LocalVector localDirection() const override { return theLocalDirection; } - LocalError localDirectionError() const override; + LocalPoint localPosition() const override { return theOrigin; } + LocalError localPositionError() const override; - /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) - AlgebraicVector parameters() const override; + LocalVector localDirection() const override { return theLocalDirection; } + LocalError localDirectionError() const override; - /// Covariance matrix of parameters() - AlgebraicSymMatrix parametersError() const override { return theCovMatrix; } + /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) + AlgebraicVector parameters() const override; - /// The projection matrix relates the trajectory state parameters to the segment parameters(). - AlgebraicMatrix projectionMatrix() const override; + /// Covariance matrix of parameters() + AlgebraicSymMatrix parametersError() const override { return theCovMatrix; } - double chi2() const override { return theChi2; }; + /// The projection matrix relates the trajectory state parameters to the segment parameters(). + AlgebraicMatrix projectionMatrix() const override; - int dimension() const override { return 4; } + double chi2() const override { return theChi2; }; - int degreesOfFreedom() const override { return 2 * nRecHits() - 4; } + int dimension() const override { return 4; } - int nRecHits() const { return (theGEMRecHits.size() + theCSCSegment.specificRecHits().size()); } + int degreesOfFreedom() const override { return 2 * nRecHits() - 4; } - //--- Return the constituents in different ways - const CSCSegment cscSegment() const { return theCSCSegment; } - const std::vector& gemRecHits() const { return theGEMRecHits; } - const std::vector& cscRecHits() const { return theCSCSegment.specificRecHits(); } - std::vector recHits() const override; - std::vector recHits() override; + int nRecHits() const { return (theGEMRecHits.size() + theCSCSegment.specificRecHits().size()); } - CSCDetId cscDetId() const { return geographicalId(); } + //--- Return the constituents in different ways + const CSCSegment cscSegment() const { return theCSCSegment; } + const std::vector& gemRecHits() const { return theGEMRecHits; } + const std::vector& cscRecHits() const { return theCSCSegment.specificRecHits(); } + std::vector recHits() const override; + std::vector recHits() override; - void print() const; + CSCDetId cscDetId() const { return geographicalId(); } -private: - std::vector theGEMRecHits; // store GEM Rechits - CSCSegment theCSCSegment; // store CSC RecHits and store CSC Segment - // eventually we have to disentangle if later on we decide - // not to have a one-to-one relationship anymore - // i.e. if we allow the GEMCSC segment to modify the - // (selection of the rechits of the) CSC segment - LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system - LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system - AlgebraicSymMatrix theCovMatrix; // the covariance matrix - double theChi2; -}; + void print() const; -std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg); + private: + std::vector theGEMRecHits; // store GEM Rechits + CSCSegment theCSCSegment; // store CSC RecHits and store CSC Segment + // eventually we have to disentangle if later on we decide + // not to have a one-to-one relationship anymore + // i.e. if we allow the GEMCSC segment to modify the + // (selection of the rechits of the) CSC segment + LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system + LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system + AlgebraicSymMatrix theCovMatrix; // the covariance matrix + double theChi2; + }; + + std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg); + +} // namespace io_v1 +using GEMCSCSegment = io_v1::GEMCSCSegment; #endif diff --git a/DataFormats/GEMRecHit/interface/GEMCSCSegmentCollection.h b/DataFormats/GEMRecHit/interface/GEMCSCSegmentCollection.h index 154399891b919..91ff529bef264 100644 --- a/DataFormats/GEMRecHit/interface/GEMCSCSegmentCollection.h +++ b/DataFormats/GEMRecHit/interface/GEMCSCSegmentCollection.h @@ -13,11 +13,9 @@ #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include "DataFormats/GEMRecHit/interface/GEMCSCSegment.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap > GEMCSCSegmentCollection; +typedef edm::IdToHitRange GEMCSCSegmentCollection; #include "DataFormats/Common/interface/Ref.h" typedef edm::Ref GEMCSCSegmentRef; diff --git a/DataFormats/GEMRecHit/interface/GEMRecHit.h b/DataFormats/GEMRecHit/interface/GEMRecHit.h index 9a0799f3db968..a17eaa776c899 100644 --- a/DataFormats/GEMRecHit/interface/GEMRecHit.h +++ b/DataFormats/GEMRecHit/interface/GEMRecHit.h @@ -11,78 +11,84 @@ #include "DataFormats/TrackingRecHit/interface/RecHit2DLocalPos.h" #include "DataFormats/MuonDetId/interface/GEMDetId.h" -class GEMRecHit : public RecHit2DLocalPos { -public: - GEMRecHit(const GEMDetId& gemId, int bx); +namespace io_v1 { - /// Default constructor - GEMRecHit(); + class GEMRecHit : public RecHit2DLocalPos { + public: + GEMRecHit(const GEMDetId& gemId, int bx); - /// Constructor from a local position, gemId and digi time. - /// The 3-dimensional local error is defined as - /// resolution (the cell resolution) for the coordinate being measured - /// and 0 for the two other coordinates - GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos); + /// Default constructor + GEMRecHit(); - /// Constructor from a local position and error, gemId and bx. - GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos, const LocalError& err); + /// Constructor from a local position, gemId and digi time. + /// The 3-dimensional local error is defined as + /// resolution (the cell resolution) for the coordinate being measured + /// and 0 for the two other coordinates + GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos); - /// Constructor from a local position and error, gemId, bx, frist strip of cluster and cluster size. - GEMRecHit(const GEMDetId& gemId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err); + /// Constructor from a local position and error, gemId and bx. + GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos, const LocalError& err); - /// Destructor - ~GEMRecHit() override; + /// Constructor from a local position and error, gemId, bx, frist strip of cluster and cluster size. + GEMRecHit( + const GEMDetId& gemId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err); - /// Return the 3-dimensional local position - LocalPoint localPosition() const override { return theLocalPosition; } + /// Destructor + ~GEMRecHit() override; - /// Return the 3-dimensional error on the local position - LocalError localPositionError() const override { return theLocalError; } + /// Return the 3-dimensional local position + LocalPoint localPosition() const override { return theLocalPosition; } - GEMRecHit* clone() const override; + /// Return the 3-dimensional error on the local position + LocalError localPositionError() const override { return theLocalError; } - /// Access to component RecHits. - /// No components rechits: it returns a null vector - std::vector recHits() const override; + GEMRecHit* clone() const override; - /// Non-const access to component RecHits. - /// No components rechits: it returns a null vector - std::vector recHits() override; + /// Access to component RecHits. + /// No components rechits: it returns a null vector + std::vector recHits() const override; - /// Set local position - void setPosition(LocalPoint pos) { theLocalPosition = pos; } + /// Non-const access to component RecHits. + /// No components rechits: it returns a null vector + std::vector recHits() override; - /// Set local position error - void setError(LocalError err) { theLocalError = err; } + /// Set local position + void setPosition(LocalPoint pos) { theLocalPosition = pos; } - /// Set the local position and its error - void setPositionAndError(LocalPoint pos, LocalError err) { - theLocalPosition = pos; - theLocalError = err; - } + /// Set local position error + void setError(LocalError err) { theLocalError = err; } - /// Return the gemId - GEMDetId gemId() const { return theGEMId; } + /// Set the local position and its error + void setPositionAndError(LocalPoint pos, LocalError err) { + theLocalPosition = pos; + theLocalError = err; + } - int BunchX() const { return theBx; } + /// Return the gemId + GEMDetId gemId() const { return theGEMId; } - int firstClusterStrip() const { return theFirstStrip; } + int BunchX() const { return theBx; } - int clusterSize() const { return theClusterSize; } + int firstClusterStrip() const { return theFirstStrip; } - /// Comparison operator, based on the gemId and the digi time - bool operator==(const GEMRecHit& hit) const; + int clusterSize() const { return theClusterSize; } -private: - GEMDetId theGEMId; - int theBx; - int theFirstStrip; - int theClusterSize; - // Position and error in the Local Ref. Frame of the GEMLayer - LocalPoint theLocalPosition; - LocalError theLocalError; -}; -#endif + /// Comparison operator, based on the gemId and the digi time + bool operator==(const GEMRecHit& hit) const; + + private: + GEMDetId theGEMId; + int theBx; + int theFirstStrip; + int theClusterSize; + // Position and error in the Local Ref. Frame of the GEMLayer + LocalPoint theLocalPosition; + LocalError theLocalError; + }; + + std::ostream& operator<<(std::ostream& os, const GEMRecHit& hit); -/// The ostream operator -std::ostream& operator<<(std::ostream& os, const GEMRecHit& hit); +} // namespace io_v1 +using GEMRecHit = io_v1::GEMRecHit; + +#endif diff --git a/DataFormats/GEMRecHit/interface/GEMRecHitCollection.h b/DataFormats/GEMRecHit/interface/GEMRecHitCollection.h index ab18be839a33a..e24b46be14377 100644 --- a/DataFormats/GEMRecHit/interface/GEMRecHitCollection.h +++ b/DataFormats/GEMRecHit/interface/GEMRecHitCollection.h @@ -9,12 +9,9 @@ #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include "DataFormats/GEMRecHit/interface/GEMRecHit.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" -#include +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap >, edm::ClonePolicy > - GEMRecHitCollection; +using GEMRecHitCollection = edm::IdToHitRange; +; #endif diff --git a/DataFormats/GEMRecHit/interface/GEMSegment.h b/DataFormats/GEMRecHit/interface/GEMSegment.h index 0604e1d3ffc4d..0ff4400ad7a5e 100644 --- a/DataFormats/GEMRecHit/interface/GEMSegment.h +++ b/DataFormats/GEMRecHit/interface/GEMSegment.h @@ -15,88 +15,93 @@ #include -class GEMSegment final : public RecSegment { -public: - /// Default constructor - GEMSegment() : theChi2(0.) {} +namespace io_v1 { - /// Constructor - GEMSegment(const std::vector& proto_segment, - const LocalPoint& origin, - const LocalVector& direction, - const AlgebraicSymMatrix& errors, - double chi2); + class GEMSegment final : public RecSegment { + public: + /// Default constructor + GEMSegment() : theChi2(0.) {} - GEMSegment(const std::vector& proto_segment, - const LocalPoint& origin, - const LocalVector& direction, - const AlgebraicSymMatrix& errors, - double chi2, - float bx); + /// Constructor + GEMSegment(const std::vector& proto_segment, + const LocalPoint& origin, + const LocalVector& direction, + const AlgebraicSymMatrix& errors, + double chi2); - GEMSegment(const std::vector& proto_segment, - const LocalPoint& origin, - const LocalVector& direction, - const AlgebraicSymMatrix& errors, - double chi2, - float bx, - float deltaPhi); + GEMSegment(const std::vector& proto_segment, + const LocalPoint& origin, + const LocalVector& direction, + const AlgebraicSymMatrix& errors, + double chi2, + float bx); - /// Destructor - ~GEMSegment() override; + GEMSegment(const std::vector& proto_segment, + const LocalPoint& origin, + const LocalVector& direction, + const AlgebraicSymMatrix& errors, + double chi2, + float bx, + float deltaPhi); - //--- Base class interface - GEMSegment* clone() const override { return new GEMSegment(*this); } + /// Destructor + ~GEMSegment() override; - LocalPoint localPosition() const override { return theOrigin; } - LocalError localPositionError() const override; + //--- Base class interface + GEMSegment* clone() const override { return new GEMSegment(*this); } - LocalVector localDirection() const override { return theLocalDirection; } - LocalError localDirectionError() const override; + LocalPoint localPosition() const override { return theOrigin; } + LocalError localPositionError() const override; - /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) - AlgebraicVector parameters() const override; + LocalVector localDirection() const override { return theLocalDirection; } + LocalError localDirectionError() const override; - /// Covariance matrix of parameters() - AlgebraicSymMatrix parametersError() const override { return theCovMatrix; } + /// Parameters of the segment, for the track fit in the order (dx/dz, dy/dz, x, y ) + AlgebraicVector parameters() const override; - /// The projection matrix relates the trajectory state parameters to the segment parameters(). - AlgebraicMatrix projectionMatrix() const override; + /// Covariance matrix of parameters() + AlgebraicSymMatrix parametersError() const override { return theCovMatrix; } - std::vector recHits() const override; + /// The projection matrix relates the trajectory state parameters to the segment parameters(). + AlgebraicMatrix projectionMatrix() const override; - std::vector recHits() override; + std::vector recHits() const override; - double chi2() const override { return theChi2; }; + std::vector recHits() override; - int dimension() const override { return 4; } + double chi2() const override { return theChi2; }; - int degreesOfFreedom() const override { return 2 * nRecHits() - 4; } + int dimension() const override { return 4; } - //--- Extension of the interface + int degreesOfFreedom() const override { return 2 * nRecHits() - 4; } - const std::vector& specificRecHits() const { return theGEMRecHits; } + //--- Extension of the interface - int nRecHits() const { return theGEMRecHits.size(); } + const std::vector& specificRecHits() const { return theGEMRecHits; } - GEMDetId gemDetId() const { return geographicalId(); } + int nRecHits() const { return theGEMRecHits.size(); } - float bunchX() const { return theBX; } + GEMDetId gemDetId() const { return geographicalId(); } - float deltaPhi() const { return theDeltaPhi; } + float bunchX() const { return theBX; } - void print() const; + float deltaPhi() const { return theDeltaPhi; } -private: - std::vector theGEMRecHits; - LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system - LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system - AlgebraicSymMatrix theCovMatrix; // the covariance matrix - double theChi2; // the Chi squared of the segment fit - float theBX; // the bunch crossing - float theDeltaPhi; // Difference in segment phi position: outer layer - inner lay -}; + void print() const; -std::ostream& operator<<(std::ostream& os, const GEMSegment& seg); + private: + std::vector theGEMRecHits; + LocalPoint theOrigin; // in chamber frame - the GeomDet local coordinate system + LocalVector theLocalDirection; // in chamber frame - the GeomDet local coordinate system + AlgebraicSymMatrix theCovMatrix; // the covariance matrix + double theChi2; // the Chi squared of the segment fit + float theBX; // the bunch crossing + float theDeltaPhi; // Difference in segment phi position: outer layer - inner lay + }; + + std::ostream& operator<<(std::ostream& os, const GEMSegment& seg); + +} // namespace io_v1 +using GEMSegment = io_v1::GEMSegment; #endif diff --git a/DataFormats/GEMRecHit/interface/GEMSegmentCollection.h b/DataFormats/GEMRecHit/interface/GEMSegmentCollection.h index 25f70f7a70c0e..50e12b853af34 100644 --- a/DataFormats/GEMRecHit/interface/GEMSegmentCollection.h +++ b/DataFormats/GEMRecHit/interface/GEMSegmentCollection.h @@ -7,17 +7,14 @@ * * \author Piet Verwilligen */ - #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include "DataFormats/GEMRecHit/interface/GEMSegment.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap > GEMSegmentCollection; +using GEMSegmentCollection = edm::IdToHitRange; #include "DataFormats/Common/interface/Ref.h" -typedef edm::Ref GEMSegmentRef; +using GEMSegmentRef = edm::Ref; #endif diff --git a/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h b/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h index d5b5ad6fb76db..1b4b1ed81a96d 100644 --- a/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h +++ b/DataFormats/GEMRecHit/interface/ME0RecHitCollection.h @@ -11,12 +11,8 @@ #include "DataFormats/MuonDetId/interface/ME0DetId.h" #include "DataFormats/GEMRecHit/interface/ME0RecHit.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/IdToHitRange.h" #include -typedef edm::RangeMap >, edm::ClonePolicy > - ME0RecHitCollection; - +using ME0RecHitCollection = edm::IdToHitRange; #endif diff --git a/DataFormats/GEMRecHit/interface/ME0SegmentCollection.h b/DataFormats/GEMRecHit/interface/ME0SegmentCollection.h index 0ca4c0f43403e..362a4d82ab548 100644 --- a/DataFormats/GEMRecHit/interface/ME0SegmentCollection.h +++ b/DataFormats/GEMRecHit/interface/ME0SegmentCollection.h @@ -12,11 +12,9 @@ #include "DataFormats/MuonDetId/interface/ME0DetId.h" #include "DataFormats/GEMRecHit/interface/ME0Segment.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap > ME0SegmentCollection; +typedef edm::IdToHitRange ME0SegmentCollection; #include "DataFormats/Common/interface/Ref.h" typedef edm::Ref ME0SegmentRef; diff --git a/DataFormats/GEMRecHit/src/GEMCSCSegment.cc b/DataFormats/GEMRecHit/src/GEMCSCSegment.cc index a0876d2aac9cc..83ff9cae9aa85 100644 --- a/DataFormats/GEMRecHit/src/GEMCSCSegment.cc +++ b/DataFormats/GEMRecHit/src/GEMCSCSegment.cc @@ -8,112 +8,116 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include -namespace { - // Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id - inline DetId buildDetId(CSCDetId id) { return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0); } -} // namespace - -class ProjectionMatrixDiag { - // Aider class to make the return of the projection Matrix thread-safe -protected: - AlgebraicMatrix theProjectionMatrix; - -public: - ProjectionMatrixDiag() : theProjectionMatrix(4, 5, 0) { - theProjectionMatrix[0][1] = 1; - theProjectionMatrix[1][2] = 1; - theProjectionMatrix[2][3] = 1; - theProjectionMatrix[3][4] = 1; +namespace io_v1 { + + namespace { + // Get CSCDetId from one of the rechits, but then remove the layer part so it's a _chamber_ id + inline DetId buildDetId(CSCDetId id) { return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), 0); } + } // namespace + + class ProjectionMatrixDiag { + // Aider class to make the return of the projection Matrix thread-safe + protected: + AlgebraicMatrix theProjectionMatrix; + + public: + ProjectionMatrixDiag() : theProjectionMatrix(4, 5, 0) { + theProjectionMatrix[0][1] = 1; + theProjectionMatrix[1][2] = 1; + theProjectionMatrix[2][3] = 1; + theProjectionMatrix[3][4] = 1; + } + const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); } + }; + + GEMCSCSegment::GEMCSCSegment(const CSCSegment* csc_segment, + const std::vector gem_rhs, + LocalPoint origin, + LocalVector direction, + AlgebraicSymMatrix errors, + double chi2) + : + + RecSegment(buildDetId(csc_segment->cscDetId())), + theOrigin(origin), + theLocalDirection(direction), + theCovMatrix(errors), + theChi2(chi2) { + for (unsigned int i = 0; i < gem_rhs.size(); ++i) { + theGEMRecHits.push_back((*gem_rhs[i])); + } + theCSCSegment = *csc_segment; + // LogDebug + edm::LogVerbatim("GEMCSCSegment") + << "[GEMCSCSegment :: ctor] CSCDetId: " << csc_segment->cscDetId() + << " CSC RecHits: " << csc_segment->specificRecHits().size() << " GEM RecHits: " << gem_rhs.size() + << "\n" // << " Fit chi2: "< gem_rhs, - LocalPoint origin, - LocalVector direction, - AlgebraicSymMatrix errors, - double chi2) - : - - RecSegment(buildDetId(csc_segment->cscDetId())), - theOrigin(origin), - theLocalDirection(direction), - theCovMatrix(errors), - theChi2(chi2) { - for (unsigned int i = 0; i < gem_rhs.size(); ++i) { - theGEMRecHits.push_back((*gem_rhs[i])); + + GEMCSCSegment::~GEMCSCSegment() {} + + std::vector GEMCSCSegment::recHits() const { + std::vector pointersOfRecHits; + for (std::vector::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + for (std::vector::const_iterator irh = theCSCSegment.specificRecHits().begin(); + irh != theCSCSegment.specificRecHits().end(); + ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + return pointersOfRecHits; } - theCSCSegment = *csc_segment; - // LogDebug - edm::LogVerbatim("GEMCSCSegment") - << "[GEMCSCSegment :: ctor] CSCDetId: " << csc_segment->cscDetId() - << " CSC RecHits: " << csc_segment->specificRecHits().size() << " GEM RecHits: " << gem_rhs.size() - << "\n" // << " Fit chi2: "< GEMCSCSegment::recHits() const { - std::vector pointersOfRecHits; - for (std::vector::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { - pointersOfRecHits.push_back(&(*irh)); + + std::vector GEMCSCSegment::recHits() { + std::vector pointersOfRecHits; + for (std::vector::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + return pointersOfRecHits; } - for (std::vector::const_iterator irh = theCSCSegment.specificRecHits().begin(); - irh != theCSCSegment.specificRecHits().end(); - ++irh) { - pointersOfRecHits.push_back(&(*irh)); + + LocalError GEMCSCSegment::localPositionError() const { + return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); } - return pointersOfRecHits; -} -std::vector GEMCSCSegment::recHits() { - std::vector pointersOfRecHits; - for (std::vector::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { - pointersOfRecHits.push_back(&(*irh)); + LocalError GEMCSCSegment::localDirectionError() const { + return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); } - return pointersOfRecHits; -} -LocalError GEMCSCSegment::localPositionError() const { - return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); -} + AlgebraicVector GEMCSCSegment::parameters() const { + // For consistency with DT, CSC and what we require for the TrackingRecHit interface, + // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) -LocalError GEMCSCSegment::localDirectionError() const { - return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); -} + AlgebraicVector result(4); + if (theLocalDirection.z() != 0) { + result[0] = theLocalDirection.x() / theLocalDirection.z(); + result[1] = theLocalDirection.y() / theLocalDirection.z(); + } + result[2] = theOrigin.x(); + result[3] = theOrigin.y(); + return result; + } -AlgebraicVector GEMCSCSegment::parameters() const { - // For consistency with DT, CSC and what we require for the TrackingRecHit interface, - // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) + AlgebraicMatrix GEMCSCSegment::projectionMatrix() const { + static const ProjectionMatrixDiag theProjectionMatrix; + return (theProjectionMatrix.getMatrix()); + } - AlgebraicVector result(4); - if (theLocalDirection.z() != 0) { - result[0] = theLocalDirection.x() / theLocalDirection.z(); - result[1] = theLocalDirection.y() / theLocalDirection.z(); + std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg) { + os << "GEMCSCSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) + << "," << sqrt(seg.localPositionError().yy()) << "0,)\n" + << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << "," + << sqrt(seg.localDirectionError().yy()) << "0,)\n" + << " chi2/ndf = " + << ((seg.degreesOfFreedom() != 0) ? (seg.chi2() / double(seg.degreesOfFreedom())) : 0.0) + << " #rechits = " << seg.nRecHits(); + return os; } - result[2] = theOrigin.x(); - result[3] = theOrigin.y(); - return result; -} - -AlgebraicMatrix GEMCSCSegment::projectionMatrix() const { - static const ProjectionMatrixDiag theProjectionMatrix; - return (theProjectionMatrix.getMatrix()); -} - -std::ostream& operator<<(std::ostream& os, const GEMCSCSegment& seg) { - os << "GEMCSCSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) - << "," << sqrt(seg.localPositionError().yy()) << "0,)\n" - << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << "," - << sqrt(seg.localDirectionError().yy()) << "0,)\n" - << " chi2/ndf = " - << ((seg.degreesOfFreedom() != 0) ? (seg.chi2() / double(seg.degreesOfFreedom())) : 0.0) - << " #rechits = " << seg.nRecHits(); - return os; -} + +} // namespace io_v1 diff --git a/DataFormats/GEMRecHit/src/GEMRecHit.cc b/DataFormats/GEMRecHit/src/GEMRecHit.cc index 97dc6ff38567f..8b05a71677cbf 100644 --- a/DataFormats/GEMRecHit/src/GEMRecHit.cc +++ b/DataFormats/GEMRecHit/src/GEMRecHit.cc @@ -6,77 +6,86 @@ #include "DataFormats/GEMRecHit/interface/GEMRecHit.h" -GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx) - : RecHit2DLocalPos(gemId), - theGEMId(gemId), - theBx(bx), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(), - theLocalError() {} +namespace io_v1 { -GEMRecHit::GEMRecHit() - : RecHit2DLocalPos(), - theGEMId(), - theBx(99), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(), - theLocalError() {} + GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx) + : RecHit2DLocalPos(gemId), + theGEMId(gemId), + theBx(bx), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(), + theLocalError() {} -GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos) - : RecHit2DLocalPos(gemId), theGEMId(gemId), theBx(bx), theFirstStrip(99), theClusterSize(99), theLocalPosition(pos) { - float stripResolution = 3.0; //cm this sould be taken from trimmed cluster size times strip size - // taken out from geometry service i.e. topology - theLocalError = LocalError(stripResolution * stripResolution, 0., 0.); //FIXME: is it really needed? -} + GEMRecHit::GEMRecHit() + : RecHit2DLocalPos(), + theGEMId(), + theBx(99), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(), + theLocalError() {} -// Constructor from a local position and error, wireId and digi time. -GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos, const LocalError& err) - : RecHit2DLocalPos(gemId), - theGEMId(gemId), - theBx(bx), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(pos), - theLocalError(err) {} + GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos) + : RecHit2DLocalPos(gemId), + theGEMId(gemId), + theBx(bx), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(pos) { + float stripResolution = 3.0; //cm this sould be taken from trimmed cluster size times strip size + // taken out from geometry service i.e. topology + theLocalError = LocalError(stripResolution * stripResolution, 0., 0.); //FIXME: is it really needed? + } -// Constructor from a local position and error, wireId, bx and cluster size. -GEMRecHit::GEMRecHit( - const GEMDetId& gemId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err) - : RecHit2DLocalPos(gemId), - theGEMId(gemId), - theBx(bx), - theFirstStrip(firstStrip), - theClusterSize(clustSize), - theLocalPosition(pos), - theLocalError(err) {} + // Constructor from a local position and error, wireId and digi time. + GEMRecHit::GEMRecHit(const GEMDetId& gemId, int bx, const LocalPoint& pos, const LocalError& err) + : RecHit2DLocalPos(gemId), + theGEMId(gemId), + theBx(bx), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(pos), + theLocalError(err) {} -// Destructor -GEMRecHit::~GEMRecHit() {} + // Constructor from a local position and error, wireId, bx and cluster size. + GEMRecHit::GEMRecHit( + const GEMDetId& gemId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err) + : RecHit2DLocalPos(gemId), + theGEMId(gemId), + theBx(bx), + theFirstStrip(firstStrip), + theClusterSize(clustSize), + theLocalPosition(pos), + theLocalError(err) {} -GEMRecHit* GEMRecHit::clone() const { return new GEMRecHit(*this); } + // Destructor + GEMRecHit::~GEMRecHit() {} -// Access to component RecHits. -// No components rechits: it returns a null vector -std::vector GEMRecHit::recHits() const { - std::vector nullvector; - return nullvector; -} + GEMRecHit* GEMRecHit::clone() const { return new GEMRecHit(*this); } -// Non-const access to component RecHits. -// No components rechits: it returns a null vector -std::vector GEMRecHit::recHits() { - std::vector nullvector; - return nullvector; -} + // Access to component RecHits. + // No components rechits: it returns a null vector + std::vector GEMRecHit::recHits() const { + std::vector nullvector; + return nullvector; + } -// Comparison operator, based on the wireId and the digi time -bool GEMRecHit::operator==(const GEMRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); } + // Non-const access to component RecHits. + // No components rechits: it returns a null vector + std::vector GEMRecHit::recHits() { + std::vector nullvector; + return nullvector; + } -// The ostream operator -std::ostream& operator<<(std::ostream& os, const GEMRecHit& hit) { - os << "pos: " << hit.localPosition().x(); - os << " +/- " << sqrt(hit.localPositionError().xx()); - return os; -} + // Comparison operator, based on the wireId and the digi time + bool GEMRecHit::operator==(const GEMRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); } + + // The ostream operator + std::ostream& operator<<(std::ostream& os, const GEMRecHit& hit) { + os << "pos: " << hit.localPosition().x(); + os << " +/- " << sqrt(hit.localPositionError().xx()); + return os; + } + +} // namespace io_v1 diff --git a/DataFormats/GEMRecHit/src/GEMSegment.cc b/DataFormats/GEMRecHit/src/GEMSegment.cc index bfbe971df4721..67974cde99d5e 100644 --- a/DataFormats/GEMRecHit/src/GEMSegment.cc +++ b/DataFormats/GEMRecHit/src/GEMSegment.cc @@ -6,134 +6,140 @@ #include "DataFormats/GEMRecHit/interface/GEMSegment.h" #include -namespace { - // create reference GEM Chamber ID for segment - inline DetId buildDetId(GEMDetId id) { return GEMDetId(id.superChamberId()); } -} // namespace - -class ProjectionMatrixDiag { - // Aider class to make the return of the projection Matrix thread-safe -protected: - AlgebraicMatrix theProjectionMatrix; - -public: - ProjectionMatrixDiag() : theProjectionMatrix(4, 5, 0) { - theProjectionMatrix[0][1] = 1; - theProjectionMatrix[1][2] = 1; - theProjectionMatrix[2][3] = 1; - theProjectionMatrix[3][4] = 1; +namespace io_v1 { + + namespace { + // create reference GEM Chamber ID for segment + inline DetId buildDetId(GEMDetId id) { return GEMDetId(id.superChamberId()); } + } // namespace + + class ProjectionMatrixDiag { + // Aider class to make the return of the projection Matrix thread-safe + protected: + AlgebraicMatrix theProjectionMatrix; + + public: + ProjectionMatrixDiag() : theProjectionMatrix(4, 5, 0) { + theProjectionMatrix[0][1] = 1; + theProjectionMatrix[1][2] = 1; + theProjectionMatrix[2][3] = 1; + theProjectionMatrix[3][4] = 1; + } + const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); } + }; + + GEMSegment::GEMSegment(const std::vector& proto_segment, + const LocalPoint& origin, + const LocalVector& direction, + const AlgebraicSymMatrix& errors, + double chi2) + : RecSegment(buildDetId(proto_segment.front()->gemId())), + theOrigin(origin), + theLocalDirection(direction), + theCovMatrix(errors), + theChi2(chi2) { + theBX = -10.0; + theDeltaPhi = -10.0; + for (unsigned int i = 0; i < proto_segment.size(); ++i) + theGEMRecHits.push_back(*proto_segment[i]); } - const AlgebraicMatrix& getMatrix() const { return (theProjectionMatrix); } -}; - -GEMSegment::GEMSegment(const std::vector& proto_segment, - const LocalPoint& origin, - const LocalVector& direction, - const AlgebraicSymMatrix& errors, - double chi2) - : RecSegment(buildDetId(proto_segment.front()->gemId())), - theOrigin(origin), - theLocalDirection(direction), - theCovMatrix(errors), - theChi2(chi2) { - theBX = -10.0; - theDeltaPhi = -10.0; - for (unsigned int i = 0; i < proto_segment.size(); ++i) - theGEMRecHits.push_back(*proto_segment[i]); -} - -GEMSegment::GEMSegment(const std::vector& proto_segment, - const LocalPoint& origin, - const LocalVector& direction, - const AlgebraicSymMatrix& errors, - double chi2, - float bx) - : RecSegment(buildDetId(proto_segment.front()->gemId())), - theOrigin(origin), - theLocalDirection(direction), - theCovMatrix(errors), - theChi2(chi2), - theBX(bx) { - theDeltaPhi = -10.0; - for (unsigned int i = 0; i < proto_segment.size(); ++i) - theGEMRecHits.push_back(*proto_segment[i]); -} - -GEMSegment::GEMSegment(const std::vector& proto_segment, - const LocalPoint& origin, - const LocalVector& direction, - const AlgebraicSymMatrix& errors, - double chi2, - float bx, - float deltaPhi) - : RecSegment(buildDetId(proto_segment.front()->gemId())), - theOrigin(origin), - theLocalDirection(direction), - theCovMatrix(errors), - theChi2(chi2), - theBX(bx), - theDeltaPhi(deltaPhi) { - for (unsigned int i = 0; i < proto_segment.size(); ++i) - theGEMRecHits.push_back(*proto_segment[i]); -} - -GEMSegment::~GEMSegment() {} - -std::vector GEMSegment::recHits() const { - std::vector pointersOfRecHits; - for (std::vector::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { - pointersOfRecHits.push_back(&(*irh)); + + GEMSegment::GEMSegment(const std::vector& proto_segment, + const LocalPoint& origin, + const LocalVector& direction, + const AlgebraicSymMatrix& errors, + double chi2, + float bx) + : RecSegment(buildDetId(proto_segment.front()->gemId())), + theOrigin(origin), + theLocalDirection(direction), + theCovMatrix(errors), + theChi2(chi2), + theBX(bx) { + theDeltaPhi = -10.0; + for (unsigned int i = 0; i < proto_segment.size(); ++i) + theGEMRecHits.push_back(*proto_segment[i]); + } + + GEMSegment::GEMSegment(const std::vector& proto_segment, + const LocalPoint& origin, + const LocalVector& direction, + const AlgebraicSymMatrix& errors, + double chi2, + float bx, + float deltaPhi) + : RecSegment(buildDetId(proto_segment.front()->gemId())), + theOrigin(origin), + theLocalDirection(direction), + theCovMatrix(errors), + theChi2(chi2), + theBX(bx), + theDeltaPhi(deltaPhi) { + for (unsigned int i = 0; i < proto_segment.size(); ++i) + theGEMRecHits.push_back(*proto_segment[i]); + } + + GEMSegment::~GEMSegment() {} + + std::vector GEMSegment::recHits() const { + std::vector pointersOfRecHits; + for (std::vector::const_iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + return pointersOfRecHits; + } + + std::vector GEMSegment::recHits() { + std::vector pointersOfRecHits; + for (std::vector::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { + pointersOfRecHits.push_back(&(*irh)); + } + return pointersOfRecHits; } - return pointersOfRecHits; -} -std::vector GEMSegment::recHits() { - std::vector pointersOfRecHits; - for (std::vector::iterator irh = theGEMRecHits.begin(); irh != theGEMRecHits.end(); ++irh) { - pointersOfRecHits.push_back(&(*irh)); + LocalError GEMSegment::localPositionError() const { + return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); } - return pointersOfRecHits; -} -LocalError GEMSegment::localPositionError() const { - return LocalError(theCovMatrix[2][2], theCovMatrix[2][3], theCovMatrix[3][3]); -} + LocalError GEMSegment::localDirectionError() const { + return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); + } + + AlgebraicVector GEMSegment::parameters() const { + // For consistency with DT and CSC and what we require for the TrackingRecHit interface, + // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) + + AlgebraicVector result(4); + + if (theLocalDirection.z() != 0) { + result[0] = theLocalDirection.x() / theLocalDirection.z(); + result[1] = theLocalDirection.y() / theLocalDirection.z(); + } + result[2] = theOrigin.x(); + result[3] = theOrigin.y(); -LocalError GEMSegment::localDirectionError() const { - return LocalError(theCovMatrix[0][0], theCovMatrix[0][1], theCovMatrix[1][1]); -} + return result; + } + + AlgebraicMatrix GEMSegment::projectionMatrix() const { + static const ProjectionMatrixDiag theProjectionMatrix; + return (theProjectionMatrix.getMatrix()); + } -AlgebraicVector GEMSegment::parameters() const { - // For consistency with DT and CSC and what we require for the TrackingRecHit interface, - // the order of the parameters in the returned vector should be (dx/dz, dy/dz, x, z) + // + void GEMSegment::print() const { LogDebug("GEMSegment") << *this; } - AlgebraicVector result(4); + std::ostream& operator<<(std::ostream& os, const GEMSegment& seg) { + os << "GEMSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) + << "," << sqrt(seg.localPositionError().yy()) << "0,)\n" + << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << "," + << sqrt(seg.localDirectionError().yy()) << "0,)\n" + << " chi2/ndf = " + << ((seg.degreesOfFreedom() != 0.) ? seg.chi2() / double(seg.degreesOfFreedom()) : 0) + << " #rechits = " << seg.specificRecHits().size() << " bx = " << seg.bunchX() + << " deltaPhi = " << seg.deltaPhi(); - if (theLocalDirection.z() != 0) { - result[0] = theLocalDirection.x() / theLocalDirection.z(); - result[1] = theLocalDirection.y() / theLocalDirection.z(); + return os; } - result[2] = theOrigin.x(); - result[3] = theOrigin.y(); - - return result; -} - -AlgebraicMatrix GEMSegment::projectionMatrix() const { - static const ProjectionMatrixDiag theProjectionMatrix; - return (theProjectionMatrix.getMatrix()); -} - -// -void GEMSegment::print() const { LogDebug("GEMSegment") << *this; } - -std::ostream& operator<<(std::ostream& os, const GEMSegment& seg) { - os << "GEMSegment: local pos = " << seg.localPosition() << " posErr = (" << sqrt(seg.localPositionError().xx()) << "," - << sqrt(seg.localPositionError().yy()) << "0,)\n" - << " dir = " << seg.localDirection() << " dirErr = (" << sqrt(seg.localDirectionError().xx()) << "," - << sqrt(seg.localDirectionError().yy()) << "0,)\n" - << " chi2/ndf = " << ((seg.degreesOfFreedom() != 0.) ? seg.chi2() / double(seg.degreesOfFreedom()) : 0) - << " #rechits = " << seg.specificRecHits().size() << " bx = " << seg.bunchX() << " deltaPhi = " << seg.deltaPhi(); - - return os; -} + +} // namespace io_v1 diff --git a/DataFormats/GEMRecHit/src/classes_def.xml b/DataFormats/GEMRecHit/src/classes_def.xml index 192431923bf08..ea90823079a12 100644 --- a/DataFormats/GEMRecHit/src/classes_def.xml +++ b/DataFormats/GEMRecHit/src/classes_def.xml @@ -1,22 +1,22 @@ - - - + + - - + + - - - - + + + + + + - - - + + @@ -25,56 +25,58 @@ + + - - - - + + - - - - + + + + + + + - - - - - - + + - - - - - - + + + + + + + + + - - - - - + + + - + + + - + - + diff --git a/DataFormats/GeometryCommonDetAlgo/src/classes_def.xml b/DataFormats/GeometryCommonDetAlgo/src/classes_def.xml index a080d5dd2de03..b75bfb67925cd 100644 --- a/DataFormats/GeometryCommonDetAlgo/src/classes_def.xml +++ b/DataFormats/GeometryCommonDetAlgo/src/classes_def.xml @@ -1,9 +1,9 @@ - - + + - - + + diff --git a/DataFormats/GeometrySurface/src/classes_def.xml b/DataFormats/GeometrySurface/src/classes_def.xml index 52791c5f724fd..8e2cd398af2e1 100644 --- a/DataFormats/GeometrySurface/src/classes_def.xml +++ b/DataFormats/GeometrySurface/src/classes_def.xml @@ -1,5 +1,5 @@ - - + + diff --git a/DataFormats/GeometryVector/src/classes_def.xml b/DataFormats/GeometryVector/src/classes_def.xml index e7b291b49fffc..caa0577977376 100644 --- a/DataFormats/GeometryVector/src/classes_def.xml +++ b/DataFormats/GeometryVector/src/classes_def.xml @@ -1,18 +1,18 @@ - - + + - - + + - - + + - - + + - - + + @@ -20,111 +20,99 @@ - - + + - - + + - - + + - + - + - - + + - + - + - - + + - - + + - - + + - - + + - - - + + - - - + + - - - + + - - - + + - - + + - - + + - - + + - - + + - - - + + - - - + + - - - + + - - - + + - - + + - - + + - - + + - - + + - - - + + - - - + + - - - + + - - - + + diff --git a/DataFormats/GsfTrackReco/interface/GsfTrack.h b/DataFormats/GsfTrackReco/interface/GsfTrack.h index a4d43789f73bc..534073444f57d 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrack.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrack.h @@ -8,107 +8,111 @@ #include "FWCore/Utilities/interface/thread_safety_macros.h" namespace reco { + namespace io_v1 { - class GsfTrack : public Track { - public: - /// parameter dimension mode - enum { dimensionMode = 3 }; - /// error matrix size mode - enum { covarianceSizeMode = dimensionMode * (dimensionMode + 1) / 2 }; - /// parameter vector (momentum part) from mode - typedef math::Vector::type ParameterVectorMode; - /// 3 parameter covariance matrix (momentum part) from mode - typedef math::Error::type CovarianceMatrixMode; - /// default constructor - GsfTrack(); - /// constructor from fit parameters and error matrix - /// notice that the reference point must be - /// the point of closest approch to the beamline. - GsfTrack(double chi2, double ndof, const Point&, const Vector&, int charge, const CovarianceMatrix&); - /// set reference to GSF "extra" object - void setGsfExtra(const GsfTrackExtraRef& ref) { gsfExtra_ = ref; } - /// reference to "extra" object - const GsfTrackExtraRef& gsfExtra() const { return gsfExtra_; } + class GsfTrack : public Track { + public: + /// parameter dimension mode + enum { dimensionMode = 3 }; + /// error matrix size mode + enum { covarianceSizeMode = dimensionMode * (dimensionMode + 1) / 2 }; + /// parameter vector (momentum part) from mode + typedef math::Vector::type ParameterVectorMode; + /// 3 parameter covariance matrix (momentum part) from mode + typedef math::Error::type CovarianceMatrixMode; + /// default constructor + GsfTrack(); + /// constructor from fit parameters and error matrix + /// notice that the reference point must be + /// the point of closest approch to the beamline. + GsfTrack(double chi2, double ndof, const Point&, const Vector&, int charge, const CovarianceMatrix&); + /// set reference to GSF "extra" object + void setGsfExtra(const GsfTrackExtraRef& ref) { gsfExtra_ = ref; } + /// reference to "extra" object + const GsfTrackExtraRef& gsfExtra() const { return gsfExtra_; } - /// set mode parameters - void setMode(int chargeMode, const Vector& momentumMode, const CovarianceMatrixMode& covarianceMode); + /// set mode parameters + void setMode(int chargeMode, const Vector& momentumMode, const CovarianceMatrixMode& covarianceMode); - /// track electric charge from mode - int chargeMode() const { return chargeMode_; } - /// q/p from mode - double qoverpMode() const { return chargeMode() / pMode(); } - /// polar angle from mode - double thetaMode() const { return momentumMode_.theta(); } - /// Lambda angle from mode - double lambdaMode() const { return M_PI / 2 - momentumMode_.theta(); } - /// momentum vector magnitude from mode - double pMode() const { return momentumMode_.R(); } - /// track transverse momentum from mode - double ptMode() const { return sqrt(momentumMode_.Perp2()); } - /// x coordinate of momentum vector from mode - double pxMode() const { return momentumMode_.x(); } - /// y coordinate of momentum vector from mode - double pyMode() const { return momentumMode_.y(); } - /// z coordinate of momentum vector from mode - double pzMode() const { return momentumMode_.z(); } - /// azimuthal angle of momentum vector from mode - double phiMode() const { return momentumMode_.Phi(); } - /// pseudorapidity of momentum vector from mode - double etaMode() const { return momentumMode_.Eta(); } + /// track electric charge from mode + int chargeMode() const { return chargeMode_; } + /// q/p from mode + double qoverpMode() const { return chargeMode() / pMode(); } + /// polar angle from mode + double thetaMode() const { return momentumMode_.theta(); } + /// Lambda angle from mode + double lambdaMode() const { return M_PI / 2 - momentumMode_.theta(); } + /// momentum vector magnitude from mode + double pMode() const { return momentumMode_.R(); } + /// track transverse momentum from mode + double ptMode() const { return sqrt(momentumMode_.Perp2()); } + /// x coordinate of momentum vector from mode + double pxMode() const { return momentumMode_.x(); } + /// y coordinate of momentum vector from mode + double pyMode() const { return momentumMode_.y(); } + /// z coordinate of momentum vector from mode + double pzMode() const { return momentumMode_.z(); } + /// azimuthal angle of momentum vector from mode + double phiMode() const { return momentumMode_.Phi(); } + /// pseudorapidity of momentum vector from mode + double etaMode() const { return momentumMode_.Eta(); } - /// track momentum vector from mode - const Vector& momentumMode() const { return momentumMode_; } + /// track momentum vector from mode + const Vector& momentumMode() const { return momentumMode_; } - /// Track parameters with one-to-one correspondence to the covariance matrix from mode - ParameterVectorMode parametersMode() const { return ParameterVectorMode(qoverpMode(), lambdaMode(), phiMode()); } - /// return track covariance matrix from mode - CovarianceMatrixMode covarianceMode() const { - CovarianceMatrixMode m; - fill(m); - return m; - } + /// Track parameters with one-to-one correspondence to the covariance matrix from mode + ParameterVectorMode parametersMode() const { return ParameterVectorMode(qoverpMode(), lambdaMode(), phiMode()); } + /// return track covariance matrix from mode + CovarianceMatrixMode covarianceMode() const { + CovarianceMatrixMode m; + fill(m); + return m; + } - /// i-th parameter ( i = 0, ... 2 ) from mode - double parameterMode(int i) const { return parametersMode()[i]; } - /// (i,j)-th element of covarianve matrix ( i, j = 0, ... 2 ) from mode - double covarianceMode(int i, int j) const { return covarianceMode_[covIndex(i, j)]; } - /// error on specified element from mode - double errorMode(int i) const { return sqrt(covarianceMode_[covIndex(i, i)]); } + /// i-th parameter ( i = 0, ... 2 ) from mode + double parameterMode(int i) const { return parametersMode()[i]; } + /// (i,j)-th element of covarianve matrix ( i, j = 0, ... 2 ) from mode + double covarianceMode(int i, int j) const { return covarianceMode_[covIndex(i, j)]; } + /// error on specified element from mode + double errorMode(int i) const { return sqrt(covarianceMode_[covIndex(i, i)]); } - /// error on signed transverse curvature from mode - double qoverpModeError() const { return errorMode(i_qoverp); } - /// error on Pt (set to 1000 TeV if charge==0 for safety) from mode - double ptModeError() const { - return (chargeMode() != 0) - ? sqrt(ptMode() * ptMode() * pMode() * pMode() / chargeMode() / chargeMode() * - covarianceMode(i_qoverp, i_qoverp) + - 2 * ptMode() * pMode() / chargeMode() * pzMode() * covarianceMode(i_qoverp, i_lambda) + - pzMode() * pzMode() * covarianceMode(i_lambda, i_lambda)) - : 1.e6; - } - /// error on theta from mode - double thetaModeError() const { return errorMode(i_lambda); } - /// error on lambda from mode - double lambdaModeError() const { return errorMode(i_lambda); } - /// error on eta from mode - double etaModeError() const { return errorMode(i_lambda) * pMode() / ptMode(); } - /// error on phi from mode - double phiModeError() const { return errorMode(i_phi); } + /// error on signed transverse curvature from mode + double qoverpModeError() const { return errorMode(i_qoverp); } + /// error on Pt (set to 1000 TeV if charge==0 for safety) from mode + double ptModeError() const { + return (chargeMode() != 0) + ? sqrt(ptMode() * ptMode() * pMode() * pMode() / chargeMode() / chargeMode() * + covarianceMode(i_qoverp, i_qoverp) + + 2 * ptMode() * pMode() / chargeMode() * pzMode() * covarianceMode(i_qoverp, i_lambda) + + pzMode() * pzMode() * covarianceMode(i_lambda, i_lambda)) + : 1.e6; + } + /// error on theta from mode + double thetaModeError() const { return errorMode(i_lambda); } + /// error on lambda from mode + double lambdaModeError() const { return errorMode(i_lambda); } + /// error on eta from mode + double etaModeError() const { return errorMode(i_lambda) * pMode() / ptMode(); } + /// error on phi from mode + double phiModeError() const { return errorMode(i_phi); } - private: - /// fill 3x3 SMatrix - CovarianceMatrixMode& fill CMS_THREAD_SAFE(CovarianceMatrixMode& v) const; + private: + /// fill 3x3 SMatrix + CovarianceMatrixMode& fill CMS_THREAD_SAFE(CovarianceMatrixMode& v) const; - private: - /// reference to GSF "extra" extension - GsfTrackExtraRef gsfExtra_; - /// electric charge from mode - char chargeMode_; - /// momentum vector from mode - Vector momentumMode_; - /// 3x3 momentum part of covariance (in q/p, lambda, phi) - float covarianceMode_[covarianceSizeMode]; - }; + private: + /// reference to GSF "extra" extension + GsfTrackExtraRef gsfExtra_; + /// electric charge from mode + char chargeMode_; + /// momentum vector from mode + Vector momentumMode_; + /// 3x3 momentum part of covariance (in q/p, lambda, phi) + float covarianceMode_[covarianceSizeMode]; + }; + + } // namespace io_v1 + using GsfTrack = io_v1::GsfTrack; } // namespace reco diff --git a/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h b/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h index 008e39284fc8b..647924a4547b7 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrackExtra.h @@ -13,74 +13,78 @@ #include namespace reco { - class GsfTrackExtra { - public: - /// parameter dimension - enum { dimension = 5 }; - /// local parameter vector - typedef math::Vector::type LocalParameterVector; - /// local covariance matrix - typedef math::Error::type LocalCovarianceMatrix; - /// point in the space - typedef math::XYZPoint Point; - /// spatial vector - typedef math::XYZVector Vector; + namespace io_v1 { + class GsfTrackExtra { + public: + /// parameter dimension + enum { dimension = 5 }; + /// local parameter vector + typedef math::Vector::type LocalParameterVector; + /// local covariance matrix + typedef math::Error::type LocalCovarianceMatrix; + /// point in the space + typedef math::XYZPoint Point; + /// spatial vector + typedef math::XYZVector Vector; - /// default constructor - GsfTrackExtra() {} - /// constructor from outermost position and momentum - GsfTrackExtra(const std::vector& outerStates, - const double& outerLocalPzSign, - const std::vector& innerStates, - const double& innerLocalPzSign, - const std::vector& tangents); - /// sign of local P_z at outermost state - double outerStateLocalPzSign() const { return positiveOuterStatePz_ ? 1. : -1.; } - /// weights at outermost state - std::vector outerStateWeights() const { return weights(outerStates_); } - /// local parameters at outermost state - std::vector outerStateLocalParameters() const { return parameters(outerStates_); } - /// local covariance matrices at outermost state - std::vector outerStateCovariances() const { return covariances(outerStates_); } - /// sign of local P_z at innermost state - double innerStateLocalPzSign() const { return positiveInnerStatePz_ ? 1. : -1.; } - /// weights at innermost state - std::vector innerStateWeights() const { return weights(innerStates_); } - /// local parameters at innermost state - std::vector innerStateLocalParameters() const { return parameters(innerStates_); } - /// local covariance matrices at innermost state - std::vector innerStateCovariances() const { return covariances(innerStates_); } - /// number of objects with information for tangents to the electron track - inline unsigned int tangentsSize() const { return tangents_.size(); } - /// access to tangent information - const std::vector& tangents() const { return tangents_; } - /// global position for tangent - const Point& tangentPosition(unsigned int index) const { return tangents_[index].position(); } - /// global momentum for tangent - const Vector& tangentMomentum(unsigned int index) const { return tangents_[index].momentum(); } - /// deltaP for tangent - Measurement1D tangentDeltaP(unsigned int index) const { return tangents_[index].deltaP(); } + /// default constructor + GsfTrackExtra() {} + /// constructor from outermost position and momentum + GsfTrackExtra(const std::vector& outerStates, + const double& outerLocalPzSign, + const std::vector& innerStates, + const double& innerLocalPzSign, + const std::vector& tangents); + /// sign of local P_z at outermost state + double outerStateLocalPzSign() const { return positiveOuterStatePz_ ? 1. : -1.; } + /// weights at outermost state + std::vector outerStateWeights() const { return weights(outerStates_); } + /// local parameters at outermost state + std::vector outerStateLocalParameters() const { return parameters(outerStates_); } + /// local covariance matrices at outermost state + std::vector outerStateCovariances() const { return covariances(outerStates_); } + /// sign of local P_z at innermost state + double innerStateLocalPzSign() const { return positiveInnerStatePz_ ? 1. : -1.; } + /// weights at innermost state + std::vector innerStateWeights() const { return weights(innerStates_); } + /// local parameters at innermost state + std::vector innerStateLocalParameters() const { return parameters(innerStates_); } + /// local covariance matrices at innermost state + std::vector innerStateCovariances() const { return covariances(innerStates_); } + /// number of objects with information for tangents to the electron track + inline unsigned int tangentsSize() const { return tangents_.size(); } + /// access to tangent information + const std::vector& tangents() const { return tangents_; } + /// global position for tangent + const Point& tangentPosition(unsigned int index) const { return tangents_[index].position(); } + /// global momentum for tangent + const Vector& tangentMomentum(unsigned int index) const { return tangents_[index].momentum(); } + /// deltaP for tangent + Measurement1D tangentDeltaP(unsigned int index) const { return tangents_[index].deltaP(); } - private: - /// extract weights from states - std::vector weights(const std::vector& states) const; - /// extract parameters from states - std::vector parameters(const std::vector& states) const; - /// extract covariance matrices from states - std::vector covariances(const std::vector& states) const; + private: + /// extract weights from states + std::vector weights(const std::vector& states) const; + /// extract parameters from states + std::vector parameters(const std::vector& states) const; + /// extract covariance matrices from states + std::vector covariances(const std::vector& states) const; - private: - /// states at outermost point - std::vector outerStates_; - /// positive sign of P_z(local) at outermost State? - bool positiveOuterStatePz_; - /// states at innermost point - std::vector innerStates_; - /// positive sign of P_z(local) at innermost State? - bool positiveInnerStatePz_; - /// information for tangents - std::vector tangents_; - }; + private: + /// states at outermost point + std::vector outerStates_; + /// positive sign of P_z(local) at outermost State? + bool positiveOuterStatePz_; + /// states at innermost point + std::vector innerStates_; + /// positive sign of P_z(local) at innermost State? + bool positiveInnerStatePz_; + /// information for tangents + std::vector tangents_; + }; + + } // namespace io_v1 + using GsfTrackExtra = io_v1::GsfTrackExtra; } // namespace reco diff --git a/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h b/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h index 4dc2d7e4d06ef..385ed923becfd 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrackExtraFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class GsfTrackExtra; + namespace io_v1 { + class GsfTrackExtra; + } + using GsfTrackExtra = io_v1::GsfTrackExtra; /// collection of GsfTrackExtra objects typedef std::vector GsfTrackExtraCollection; /// persistent reference to a GsfTrackExtra diff --git a/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h b/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h index 3256ad0c3a5a2..19b4a3f2ef0eb 100644 --- a/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h +++ b/DataFormats/GsfTrackReco/interface/GsfTrackFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class GsfTrack; + namespace io_v1 { + class GsfTrack; + } + using GsfTrack = io_v1::GsfTrack; /// collection of GsfTracks typedef std::vector GsfTrackCollection; /// persistent reference to a GsfTrack diff --git a/DataFormats/GsfTrackReco/src/classes_def.xml b/DataFormats/GsfTrackReco/src/classes_def.xml index e154533e99312..c43e46c0b3e7a 100644 --- a/DataFormats/GsfTrackReco/src/classes_def.xml +++ b/DataFormats/GsfTrackReco/src/classes_def.xml @@ -1,12 +1,11 @@ - - + + - - - + + @@ -15,50 +14,41 @@ - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + - - - - - - + + + + + + - + - + - + - - - + + + diff --git a/DataFormats/HGCDigi/interface/HGCSample.h b/DataFormats/HGCDigi/interface/HGCSample.h index 425fb39ad7339..51f4c7d45bc49 100644 --- a/DataFormats/HGCDigi/interface/HGCSample.h +++ b/DataFormats/HGCDigi/interface/HGCSample.h @@ -10,118 +10,120 @@ @short wrapper for a data word */ -class HGCSample { -public: - enum HGCSampleMasks { - kThreshMask = 0x1, - kModeMask = 0x1, - kToAValidMask = 0x1, - kGainMask = 0xf, - kToAMask = 0x3ff, - kDataMask = 0xfff - }; - enum HGCSampleShifts { - kThreshShift = 31, - kModeShift = 30, - kToAValidShift = 29, - kToGainShift = 22, - kToAShift = 12, - kDataShift = 0 - }; - - /** +namespace io_v1 { + class HGCSample { + public: + enum HGCSampleMasks { + kThreshMask = 0x1, + kModeMask = 0x1, + kToAValidMask = 0x1, + kGainMask = 0xf, + kToAMask = 0x3ff, + kDataMask = 0xfff + }; + enum HGCSampleShifts { + kThreshShift = 31, + kModeShift = 30, + kToAValidShift = 29, + kToGainShift = 22, + kToAShift = 12, + kDataShift = 0 + }; + + /** @short CTOR */ - HGCSample() : value_(0) {} - HGCSample(uint32_t value) : value_(value) {} - HGCSample(const HGCSample& o) : value_(o.value_) {} - HGCSample& operator=(const HGCSample&) = default; + HGCSample() : value_(0) {} + HGCSample(uint32_t value) : value_(value) {} + HGCSample(const HGCSample& o) : value_(o.value_) {} + HGCSample& operator=(const HGCSample&) = default; - /** + /** @short setters */ - void setThreshold(bool thr) { setWord(thr, kThreshMask, kThreshShift); } - void setMode(bool mode) { setWord(mode, kModeMask, kModeShift); } - void setGain(uint16_t gain) { setWord(gain, kGainMask, kToGainShift); } - void setToA(uint16_t toa) { setWord(toa, kToAMask, kToAShift); } - void setData(uint16_t data) { setWord(data, kDataMask, kDataShift); } - void setToAValid(bool toaFired) { setWord(toaFired, kToAValidMask, kToAValidShift); } - - void set(bool thr, bool mode, uint16_t gain, uint16_t toa, uint16_t data) { - setThreshold(thr); - setMode(mode); - setGain(gain); - setToA(toa); - setData(data); - } - - void print(std::ostream& out = std::cout) { - out << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " Data: " << data() << " Raw=0x" - << std::hex << raw() << std::dec << std::endl; - } - - /** + void setThreshold(bool thr) { setWord(thr, kThreshMask, kThreshShift); } + void setMode(bool mode) { setWord(mode, kModeMask, kModeShift); } + void setGain(uint16_t gain) { setWord(gain, kGainMask, kToGainShift); } + void setToA(uint16_t toa) { setWord(toa, kToAMask, kToAShift); } + void setData(uint16_t data) { setWord(data, kDataMask, kDataShift); } + void setToAValid(bool toaFired) { setWord(toaFired, kToAValidMask, kToAValidShift); } + + void set(bool thr, bool mode, uint16_t gain, uint16_t toa, uint16_t data) { + setThreshold(thr); + setMode(mode); + setGain(gain); + setToA(toa); + setData(data); + } + + void print(std::ostream& out = std::cout) { + out << "THR: " << threshold() << " Mode: " << mode() << " ToA: " << toa() << " Data: " << data() << " Raw=0x" + << std::hex << raw() << std::dec << std::endl; + } + + /** @short getters */ - uint32_t raw() const { return value_; } - bool threshold() const { return getWord(kThreshMask, kThreshShift); } - bool mode() const { return getWord(kModeMask, kModeShift); } - uint16_t gain() const { return getWord(kGainMask, kToGainShift); } - uint16_t toa() const { return getWord(kToAMask, kToAShift); } - uint16_t data() const { return getWord(kDataMask, kDataShift); } - bool getToAValid() const { return getWord(kToAValidMask, kToAValidShift); } - uint32_t operator()() { return value_; } - - /** + uint32_t raw() const { return value_; } + bool threshold() const { return getWord(kThreshMask, kThreshShift); } + bool mode() const { return getWord(kModeMask, kModeShift); } + uint16_t gain() const { return getWord(kGainMask, kToGainShift); } + uint16_t toa() const { return getWord(kToAMask, kToAShift); } + uint16_t data() const { return getWord(kDataMask, kDataShift); } + bool getToAValid() const { return getWord(kToAValidMask, kToAValidShift); } + uint32_t operator()() { return value_; } + + /** @short Data Model Evolution */ - static uint32_t convertV9ToV10(uint32_t valueOldForm, bool toaFiredOldForm) { - // combine value&toaFired from the dataformat V9-or-earlier - // from persisted objects - // to produce a value_ compatible w/ the V10 format - // i.e. - // 1) shift the 10 toa bits by 1 bit - // 2) insert the toaFired into _value - // NOTE: nothing can be done for the gain bits: - // info about gain was not preswent in V9-or-earlier, and will be left to 0 in V10 - // root doc: https://root.cern.ch/root/html/io/DataModelEvolution.html - // see PR 28349 for more info - - // V9 Format: tm--------tttttttttt-dddddddddddd - uint32_t valueNewForm(valueOldForm); - - // set to 0 the 17 bits bits (between 13 and 29 - both included) - valueNewForm &= ~(0x3FFFF << kToAShift); - - // copy toa to start from bit 13 - valueNewForm |= ((valueOldForm >> 13) & kToAMask) << kToAShift; - - // set 1 bit toaFiredOldForm in position 30 - valueNewForm |= (toaFiredOldForm & kToAValidMask) << kToAValidShift; - - return valueNewForm; - } - -private: - /** + static uint32_t convertV9ToV10(uint32_t valueOldForm, bool toaFiredOldForm) { + // combine value&toaFired from the dataformat V9-or-earlier + // from persisted objects + // to produce a value_ compatible w/ the V10 format + // i.e. + // 1) shift the 10 toa bits by 1 bit + // 2) insert the toaFired into _value + // NOTE: nothing can be done for the gain bits: + // info about gain was not preswent in V9-or-earlier, and will be left to 0 in V10 + // root doc: https://root.cern.ch/root/html/io/DataModelEvolution.html + // see PR 28349 for more info + + // V9 Format: tm--------tttttttttt-dddddddddddd + uint32_t valueNewForm(valueOldForm); + + // set to 0 the 17 bits bits (between 13 and 29 - both included) + valueNewForm &= ~(0x3FFFF << kToAShift); + + // copy toa to start from bit 13 + valueNewForm |= ((valueOldForm >> 13) & kToAMask) << kToAShift; + + // set 1 bit toaFiredOldForm in position 30 + valueNewForm |= (toaFiredOldForm & kToAValidMask) << kToAValidShift; + + return valueNewForm; + } + + private: + /** @short wrapper to reset words at a given position */ - void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift) { - // mask and shift bits - const uint32_t masked_word = (word & mask) << shift; + void setWord(uint16_t word, HGCSampleMasks mask, HGCSampleShifts shift) { + // mask and shift bits + const uint32_t masked_word = (word & mask) << shift; - //clear to 0 bits which will be set by word - value_ &= ~(mask << shift); + //clear to 0 bits which will be set by word + value_ &= ~(mask << shift); - //now set bits - value_ |= (masked_word); - } + //now set bits + value_ |= (masked_word); + } - uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const { return ((value_ >> shift) & mask); } - - // a 32-bit word - // V10 Format: tmt---ggggttttttttttdddddddddddd - uint32_t value_; -}; + uint32_t getWord(HGCSampleMasks mask, HGCSampleShifts shift) const { return ((value_ >> shift) & mask); } + // a 32-bit word + // V10 Format: tmt---ggggttttttttttdddddddddddd + uint32_t value_; + }; +} // namespace io_v1 +using HGCSample = io_v1::HGCSample; #endif diff --git a/DataFormats/HGCDigi/src/classes_def.xml b/DataFormats/HGCDigi/src/classes_def.xml index cd2cf75d348f2..e0f7f95985281 100644 --- a/DataFormats/HGCDigi/src/classes_def.xml +++ b/DataFormats/HGCDigi/src/classes_def.xml @@ -1,20 +1,14 @@ - - - - - + + - + - - - - + + + + diff --git a/DataFormats/HGCRecHit/interface/HGCRecHit.h b/DataFormats/HGCRecHit/interface/HGCRecHit.h index 1a46965a89393..f898979ff5c50 100644 --- a/DataFormats/HGCRecHit/interface/HGCRecHit.h +++ b/DataFormats/HGCRecHit/interface/HGCRecHit.h @@ -11,50 +11,51 @@ * \author Valeri Andreev */ -class HGCRecHit : public CaloRecHit { -public: - typedef DetId key_type; - - // HGCEE recHit flags - enum Flags { - kGood = 0, // channel ok, the energy and time measurement are reliable - kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2) - kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time - kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy) - kNoisy, // the channel is very noisy - kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor - kSaturated, // saturated channel (recovery not tried) - kDead, // channel is dead and any recovery fails - kKilled, // MC only flag: the channel is killed in the real detector - kWeird, // the signal is believed to originate from an anomalous deposit (spike) - kDiWeird, // the signal is anomalous, and neighbors another anomalous signal - // - kUnknown // to ease the interface with functions returning flags. - }; - - // HGCfhe recHit flags - enum HGCfheFlags { kHGCfheGood, kHGCfheDead, kHGCfheHot, kHGCfhePassBX, kHGCfheSaturated }; - - // HGCbhe recHit flags - enum HGCbheFlags { kHGCbheGood, kHGCbheDead, kHGCbheHot, kHGCbhePassBX, kHGCbheSaturated }; - - // HFnose rechit flags - enum HFNoseFlags { - kHFNoseGood, - kHFNosePoorReco, - kHFNoseOutOfTime, - kHFNoseFaultyHardware, - kHFNoseNoisy, - kHFNosePoorCalib, - kHFNoseSaturated, - kHFNoseDead, - kHFNoseKilled, - kHFNoseWeird, - kHFNoseDiWeird, - kHFNoseUnknown - }; - - /** bit structure of CaloRecHit::flags_ used in EcalRecHit: +namespace io_v1 { + class HGCRecHit : public CaloRecHit { + public: + typedef DetId key_type; + + // HGCEE recHit flags + enum Flags { + kGood = 0, // channel ok, the energy and time measurement are reliable + kPoorReco, // the energy is available from the UncalibRecHit, but approximate (bad shape, large chi2) + kOutOfTime, // the energy is available from the UncalibRecHit (sync reco), but the event is out of time + kFaultyHardware, // The energy is available from the UncalibRecHit, channel is faulty at some hardware level (e.g. noisy) + kNoisy, // the channel is very noisy + kPoorCalib, // the energy is available from the UncalibRecHit, but the calibration of the channel is poor + kSaturated, // saturated channel (recovery not tried) + kDead, // channel is dead and any recovery fails + kKilled, // MC only flag: the channel is killed in the real detector + kWeird, // the signal is believed to originate from an anomalous deposit (spike) + kDiWeird, // the signal is anomalous, and neighbors another anomalous signal + // + kUnknown // to ease the interface with functions returning flags. + }; + + // HGCfhe recHit flags + enum HGCfheFlags { kHGCfheGood, kHGCfheDead, kHGCfheHot, kHGCfhePassBX, kHGCfheSaturated }; + + // HGCbhe recHit flags + enum HGCbheFlags { kHGCbheGood, kHGCbheDead, kHGCbheHot, kHGCbhePassBX, kHGCbheSaturated }; + + // HFnose rechit flags + enum HFNoseFlags { + kHFNoseGood, + kHFNosePoorReco, + kHFNoseOutOfTime, + kHFNoseFaultyHardware, + kHFNoseNoisy, + kHFNosePoorCalib, + kHFNoseSaturated, + kHFNoseDead, + kHFNoseKilled, + kHFNoseWeird, + kHFNoseDiWeird, + kHFNoseUnknown + }; + + /** bit structure of CaloRecHit::flags_ used in EcalRecHit: * * | 32 | 31...25 | 24...12 | 11...5 | 4...1 | * | | | | | @@ -65,69 +66,70 @@ class HGCRecHit : public CaloRecHit { * +--> spare ( 1 bit ) */ - HGCRecHit(); - // by default a recHit is greated with no flag - HGCRecHit(const DetId& id, - float energy, - float time, - uint32_t flags = 0, - uint32_t flagBits = 0, - uint8_t son = 0, - float timeError = 0.f); - /// get the id - // For the moment not returning a specific id for subdetector - DetId id() const { return DetId(detid()); } - ///// bool isRecovered() const; - bool isTimeValid() const; - bool isTimeErrorValid() const; - - float chi2() const; - float outOfTimeChi2() const; - float signalOverSigmaNoise() const; - - // set the energy for out of time events - // (only energy >= 0 will be stored) - float outOfTimeEnergy() const; - float timeError() const; - - void setChi2(float chi2); - void setOutOfTimeChi2(float chi2); - void setOutOfTimeEnergy(float energy); - void setSignalOverSigmaNoise(float sOverNoise); - - void setTimeError(float timeErr); - - /// set the flags (from Flags or ESFlags) - void setFlag(int flag) { flagBits_ |= (0x1 << flag); } - void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); } - - /// check if the flag is true - bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); } - - /// check if one of the flags in a set is true - bool checkFlags(const std::vector& flagsvec) const; - - //added for validation - uint32_t flagBits() const { return flagBits_; } - - //define operator== for std::find - bool operator==(const HGCRecHit& hit) const { return id().rawId() == hit.id().rawId(); } - bool operator==(const DetId& otherid) const { return id().rawId() == otherid.rawId(); } - - //define operator< for std::sort - bool operator<(const HGCRecHit& hit) const { - if (id().rawId() == hit.id().rawId()) - return energy() < hit.energy(); - return id().rawId() < hit.id().rawId(); - } - -private: - /// store rechit condition (see Flags enum) in a bit-wise way - uint32_t flagBits_; - uint8_t signalOverSigmaNoise_; - float timeError_; -}; - -std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit); + HGCRecHit(); + // by default a recHit is greated with no flag + HGCRecHit(const DetId& id, + float energy, + float time, + uint32_t flags = 0, + uint32_t flagBits = 0, + uint8_t son = 0, + float timeError = 0.f); + /// get the id + // For the moment not returning a specific id for subdetector + DetId id() const { return DetId(detid()); } + ///// bool isRecovered() const; + bool isTimeValid() const; + bool isTimeErrorValid() const; + + float chi2() const; + float outOfTimeChi2() const; + float signalOverSigmaNoise() const; + + // set the energy for out of time events + // (only energy >= 0 will be stored) + float outOfTimeEnergy() const; + float timeError() const; + + void setChi2(float chi2); + void setOutOfTimeChi2(float chi2); + void setOutOfTimeEnergy(float energy); + void setSignalOverSigmaNoise(float sOverNoise); + + void setTimeError(float timeErr); + + /// set the flags (from Flags or ESFlags) + void setFlag(int flag) { flagBits_ |= (0x1 << flag); } + void unsetFlag(int flag) { flagBits_ &= ~(0x1 << flag); } + + /// check if the flag is true + bool checkFlag(int flag) const { return flagBits_ & (0x1 << flag); } + + /// check if one of the flags in a set is true + bool checkFlags(const std::vector& flagsvec) const; + + //added for validation + uint32_t flagBits() const { return flagBits_; } + + //define operator== for std::find + bool operator==(const HGCRecHit& hit) const { return id().rawId() == hit.id().rawId(); } + bool operator==(const DetId& otherid) const { return id().rawId() == otherid.rawId(); } + + //define operator< for std::sort + bool operator<(const HGCRecHit& hit) const { + if (id().rawId() == hit.id().rawId()) + return energy() < hit.energy(); + return id().rawId() < hit.id().rawId(); + } + + private: + /// store rechit condition (see Flags enum) in a bit-wise way + uint32_t flagBits_; + uint8_t signalOverSigmaNoise_; + float timeError_; + }; + std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit); +} // namespace io_v1 +using HGCRecHit = io_v1::HGCRecHit; #endif diff --git a/DataFormats/HGCRecHit/src/HGCRecHit.cc b/DataFormats/HGCRecHit/src/HGCRecHit.cc index 43bed27394082..b60af7abaf0a2 100644 --- a/DataFormats/HGCRecHit/src/HGCRecHit.cc +++ b/DataFormats/HGCRecHit/src/HGCRecHit.cc @@ -7,116 +7,118 @@ #include #include -HGCRecHit::HGCRecHit() : CaloRecHit(), flagBits_(0) {} - -HGCRecHit::HGCRecHit( - const DetId& id, float energy, float time, uint32_t flags, uint32_t flagBits, uint8_t son, float timeError) - : CaloRecHit(id, energy, time, flags), flagBits_(flagBits), signalOverSigmaNoise_(son), timeError_(timeError) {} - -float HGCRecHit::chi2() const { - uint32_t rawChi2 = 0x7F & (flags() >> 4); - return (float)rawChi2 / (float)((1 << 7) - 1) * 64.f; -} - -float HGCRecHit::outOfTimeChi2() const { - uint32_t rawChi2Prob = 0x7F & (flags() >> 24); - return (float)rawChi2Prob / (float)((1 << 7) - 1) * 64.f; -} - -float HGCRecHit::outOfTimeEnergy() const { - uint32_t rawEnergy = (0x1FFF & flags() >> 11); - uint16_t exponent = rawEnergy >> 10; - uint16_t significand = ~(0xE << 9) & rawEnergy; - return (float)significand * pow(10, exponent - 5); -} - -void HGCRecHit::setChi2(float chi2) { - // bound the max value of the chi2 - if (chi2 > 64) - chi2 = 64; - // use 7 bits - uint32_t rawChi2 = lround(chi2 / 64.f * ((1 << 7) - 1)); - // shift by 4 bits (recoFlag) - setFlags((~(0x7F << 4) & flags()) | ((rawChi2 & 0x7F) << 4)); -} - -void HGCRecHit::setOutOfTimeEnergy(float energy) { - if (energy > 0.001f) { - uint16_t exponent = lround(floor(log10(energy))) + 3; - uint16_t significand = lround(energy / pow(10, exponent - 5)); - // use 13 bits (3 exponent, 10 significand) - uint32_t rawEnergy = exponent << 10 | significand; - // shift by 11 bits (recoFlag + chi2) - setFlags((~(0x1FFF << 11) & flags()) | ((rawEnergy & 0x1FFF) << 11)); +namespace io_v1 { + HGCRecHit::HGCRecHit() : CaloRecHit(), flagBits_(0) {} + + HGCRecHit::HGCRecHit( + const DetId& id, float energy, float time, uint32_t flags, uint32_t flagBits, uint8_t son, float timeError) + : CaloRecHit(id, energy, time, flags), flagBits_(flagBits), signalOverSigmaNoise_(son), timeError_(timeError) {} + + float HGCRecHit::chi2() const { + uint32_t rawChi2 = 0x7F & (flags() >> 4); + return (float)rawChi2 / (float)((1 << 7) - 1) * 64.f; } -} - -void HGCRecHit::setOutOfTimeChi2(float chi2) { - // bound the max value of chi2 - if (chi2 > 64) - chi2 = 64; - // use 7 bits - uint32_t rawChi2 = lround(chi2 / 64.f * ((1 << 7) - 1)); - // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy) - setFlags((~(0x7F << 24) & flags()) | ((rawChi2 & 0x7F) << 24)); -} - -void HGCRecHit::setSignalOverSigmaNoise(float sOverNoise) { - // bound the max value of sOverNoise - if (sOverNoise > 32.f) - sOverNoise = 32.f; - //use 8 bits - signalOverSigmaNoise_ = lround(sOverNoise / 32.f * ((1 << 8) - 1)); -} - -float HGCRecHit::signalOverSigmaNoise() const { return (float)signalOverSigmaNoise_ * 0.125f; } - -void HGCRecHit::setTimeError(float timeErr) { - //expected resolution on single cell for that given S/N - timeError_ = timeErr; -} - -float HGCRecHit::timeError() const { return timeError_; } - -bool HGCRecHit::isTimeValid() const { - if (timeError() <= 0) - return false; - else - return true; -} -bool HGCRecHit::isTimeErrorValid() const { - if (!isTimeValid()) - return false; - if (timeError() >= 10000) - return false; + float HGCRecHit::outOfTimeChi2() const { + uint32_t rawChi2Prob = 0x7F & (flags() >> 24); + return (float)rawChi2Prob / (float)((1 << 7) - 1) * 64.f; + } - return true; -} + float HGCRecHit::outOfTimeEnergy() const { + uint32_t rawEnergy = (0x1FFF & flags() >> 11); + uint16_t exponent = rawEnergy >> 10; + uint16_t significand = ~(0xE << 9) & rawEnergy; + return (float)significand * pow(10, exponent - 5); + } -/// check if one of the flags in a set is true -bool HGCRecHit::checkFlags(const std::vector& flagsvec) const { - for (std::vector::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end(); - ++flagPtr) { // check if one of the flags is up - if (checkFlag(*flagPtr)) + void HGCRecHit::setChi2(float chi2) { + // bound the max value of the chi2 + if (chi2 > 64) + chi2 = 64; + // use 7 bits + uint32_t rawChi2 = lround(chi2 / 64.f * ((1 << 7) - 1)); + // shift by 4 bits (recoFlag) + setFlags((~(0x7F << 4) & flags()) | ((rawChi2 & 0x7F) << 4)); + } + + void HGCRecHit::setOutOfTimeEnergy(float energy) { + if (energy > 0.001f) { + uint16_t exponent = lround(floor(log10(energy))) + 3; + uint16_t significand = lround(energy / pow(10, exponent - 5)); + // use 13 bits (3 exponent, 10 significand) + uint32_t rawEnergy = exponent << 10 | significand; + // shift by 11 bits (recoFlag + chi2) + setFlags((~(0x1FFF << 11) & flags()) | ((rawEnergy & 0x1FFF) << 11)); + } + } + + void HGCRecHit::setOutOfTimeChi2(float chi2) { + // bound the max value of chi2 + if (chi2 > 64) + chi2 = 64; + // use 7 bits + uint32_t rawChi2 = lround(chi2 / 64.f * ((1 << 7) - 1)); + // shift by 24 bits (recoFlag + chi2 + outOfTimeEnergy) + setFlags((~(0x7F << 24) & flags()) | ((rawChi2 & 0x7F) << 24)); + } + + void HGCRecHit::setSignalOverSigmaNoise(float sOverNoise) { + // bound the max value of sOverNoise + if (sOverNoise > 32.f) + sOverNoise = 32.f; + //use 8 bits + signalOverSigmaNoise_ = lround(sOverNoise / 32.f * ((1 << 8) - 1)); + } + + float HGCRecHit::signalOverSigmaNoise() const { return (float)signalOverSigmaNoise_ * 0.125f; } + + void HGCRecHit::setTimeError(float timeErr) { + //expected resolution on single cell for that given S/N + timeError_ = timeErr; + } + + float HGCRecHit::timeError() const { return timeError_; } + + bool HGCRecHit::isTimeValid() const { + if (timeError() <= 0) + return false; + else return true; } - return false; -} - -std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit) { - if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == HGCEE) - return s << HGCalDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == HGCHEF) - return s << HGCalDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::Hcal && hit.detid().subdetId() == HcalEndcap) - return s << HcalDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::HGCalEE || hit.detid().det() == DetId::HGCalHSi) - return s << HGCSiliconDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::HGCalHSc) - return s << HGCScintillatorDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == HFNose) - return s << HFNoseDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; - else - return s << "HGCRecHit undefined subdetector"; -} + + bool HGCRecHit::isTimeErrorValid() const { + if (!isTimeValid()) + return false; + if (timeError() >= 10000) + return false; + + return true; + } + + /// check if one of the flags in a set is true + bool HGCRecHit::checkFlags(const std::vector& flagsvec) const { + for (std::vector::const_iterator flagPtr = flagsvec.begin(); flagPtr != flagsvec.end(); + ++flagPtr) { // check if one of the flags is up + if (checkFlag(*flagPtr)) + return true; + } + return false; + } + + std::ostream& operator<<(std::ostream& s, const HGCRecHit& hit) { + if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == HGCEE) + return s << HGCalDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == HGCHEF) + return s << HGCalDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::Hcal && hit.detid().subdetId() == HcalEndcap) + return s << HcalDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::HGCalEE || hit.detid().det() == DetId::HGCalHSi) + return s << HGCSiliconDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::HGCalHSc) + return s << HGCScintillatorDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else if (hit.detid().det() == DetId::Forward && hit.detid().subdetId() == HFNose) + return s << HFNoseDetId(hit.detid()) << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + else + return s << "HGCRecHit undefined subdetector"; + } +} // namespace io_v1 diff --git a/DataFormats/HGCRecHit/src/classes_def.xml b/DataFormats/HGCRecHit/src/classes_def.xml index 683d9ce272310..3eebc67bfd0bf 100644 --- a/DataFormats/HGCRecHit/src/classes_def.xml +++ b/DataFormats/HGCRecHit/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + @@ -9,38 +9,35 @@ - - - - - + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + - - - + + + diff --git a/DataFormats/HGCalDigi/interface/PHGCSimAccumulator.h b/DataFormats/HGCalDigi/interface/PHGCSimAccumulator.h index 1addf33a8a90c..2fdca0461f8e3 100644 --- a/DataFormats/HGCalDigi/interface/PHGCSimAccumulator.h +++ b/DataFormats/HGCalDigi/interface/PHGCSimAccumulator.h @@ -5,145 +5,148 @@ #include #include -class PHGCSimAccumulator { -public: - class DetIdSize { +namespace io_v1 { + class PHGCSimAccumulator { public: - DetIdSize() {} - DetIdSize(unsigned int detId) : detId_(detId) {} - void increaseSize() { ++size_; } - unsigned int detId() const { return detId_; } - unsigned int size() const { return size_; } - - private: - unsigned int detId_ = 0; - unsigned char size_ = 0; - }; - - class SimHitCollection { - public: - constexpr static unsigned energyOffset = 15; - constexpr static unsigned energyMask = 0x1; - constexpr static unsigned sampleOffset = 11; - constexpr static unsigned sampleMask = 0xf; - constexpr static unsigned dataOffset = 0; - constexpr static unsigned dataMask = 0x7ff; - - SimHitCollection() {} - SimHitCollection(unsigned int nhits) : nhits_(nhits) {} - SimHitCollection(const unsigned short si, - const std::vector& accCharge, - const std::vector& time) - : nhits_(accCharge.size()) { - chargeArray_.reserve(nhits_); - timeArray_.reserve(nhits_); - for (size_t i = 0; i < nhits_; ++i) { - unsigned short ei = 0; - unsigned short d = accCharge[i]; - unsigned short data = ((ei << energyOffset) | (si << sampleOffset) | d); - chargeArray_.emplace_back(data); - } - for (size_t i = 0; i < nhits_; ++i) { - unsigned short ei = 1; - unsigned short d = time[i]; - unsigned short data = ((ei << energyOffset) | (si << sampleOffset) | d); - timeArray_.emplace_back(data); + class DetIdSize { + public: + DetIdSize() {} + DetIdSize(unsigned int detId) : detId_(detId) {} + void increaseSize() { ++size_; } + unsigned int detId() const { return detId_; } + unsigned int size() const { return size_; } + + private: + unsigned int detId_ = 0; + unsigned char size_ = 0; + }; + + class SimHitCollection { + public: + constexpr static unsigned energyOffset = 15; + constexpr static unsigned energyMask = 0x1; + constexpr static unsigned sampleOffset = 11; + constexpr static unsigned sampleMask = 0xf; + constexpr static unsigned dataOffset = 0; + constexpr static unsigned dataMask = 0x7ff; + + SimHitCollection() {} + SimHitCollection(unsigned int nhits) : nhits_(nhits) {} + SimHitCollection(const unsigned short si, + const std::vector& accCharge, + const std::vector& time) + : nhits_(accCharge.size()) { + chargeArray_.reserve(nhits_); + timeArray_.reserve(nhits_); + for (size_t i = 0; i < nhits_; ++i) { + unsigned short ei = 0; + unsigned short d = accCharge[i]; + unsigned short data = ((ei << energyOffset) | (si << sampleOffset) | d); + chargeArray_.emplace_back(data); + } + for (size_t i = 0; i < nhits_; ++i) { + unsigned short ei = 1; + unsigned short d = time[i]; + unsigned short data = ((ei << energyOffset) | (si << sampleOffset) | d); + timeArray_.emplace_back(data); + } } + unsigned int nhits() const { return nhits_; } + unsigned int sampleIndex() const { return (chargeArray_[0] >> sampleOffset) & sampleMask; } + const std::vector& chargeArray() const { return chargeArray_; } + const std::vector& timeArray() const { return timeArray_; } + + private: + unsigned int nhits_; + std::vector chargeArray_; + std::vector timeArray_; + }; + + PHGCSimAccumulator() = default; + ~PHGCSimAccumulator() = default; + + void reserve(size_t size) { + detIdSize_.reserve(size); + simhitCollection_.reserve(size); + } + void shrink_to_fit() { + detIdSize_.shrink_to_fit(); + simhitCollection_.shrink_to_fit(); } - unsigned int nhits() const { return nhits_; } - unsigned int sampleIndex() const { return (chargeArray_[0] >> sampleOffset) & sampleMask; } - const std::vector& chargeArray() const { return chargeArray_; } - const std::vector& timeArray() const { return timeArray_; } - - private: - unsigned int nhits_; - std::vector chargeArray_; - std::vector timeArray_; - }; - PHGCSimAccumulator() = default; - ~PHGCSimAccumulator() = default; - - void reserve(size_t size) { - detIdSize_.reserve(size); - simhitCollection_.reserve(size); - } - void shrink_to_fit() { - detIdSize_.shrink_to_fit(); - simhitCollection_.shrink_to_fit(); - } - - void emplace_back(unsigned int detId, - unsigned short sampleIndex, - const std::vector& accCharge, - const std::vector& timing) { - if (detIdSize_.empty() || detIdSize_.back().detId() != detId) { - detIdSize_.emplace_back(detId); + void emplace_back(unsigned int detId, + unsigned short sampleIndex, + const std::vector& accCharge, + const std::vector& timing) { + if (detIdSize_.empty() || detIdSize_.back().detId() != detId) { + detIdSize_.emplace_back(detId); + } + simhitCollection_.emplace_back(sampleIndex, accCharge, timing); + detIdSize_.back().increaseSize(); } - simhitCollection_.emplace_back(sampleIndex, accCharge, timing); - detIdSize_.back().increaseSize(); - } - class TmpElem { - public: - TmpElem(const unsigned int detId, const SimHitCollection& simhitCollection) - : detId_(detId), simhitcollection_(simhitCollection) {} + class TmpElem { + public: + TmpElem(const unsigned int detId, const SimHitCollection& simhitCollection) + : detId_(detId), simhitcollection_(simhitCollection) {} + + unsigned int detId() const { return detId_; } + unsigned short sampleIndex() const { return simhitcollection_.sampleIndex(); } + unsigned int nhits() const { return simhitcollection_.nhits(); } + const std::vector chargeArray() const { return simhitcollection_.chargeArray(); } + const std::vector timeArray() const { return simhitcollection_.timeArray(); } + + private: + unsigned int detId_; + SimHitCollection simhitcollection_; + }; + + class const_iterator { + public: + // begin + const_iterator(const PHGCSimAccumulator* ncc) + : ncc_(ncc), iDet_(0), iData_(0), endData_(ncc->detIdSize_.empty() ? 0 : ncc->detIdSize_.front().size()) {} + // end + const_iterator(const PHGCSimAccumulator* ncc, unsigned int detSize, unsigned int dataSize) + : ncc_(ncc), iDet_(detSize), iData_(dataSize), endData_(0) {} + + bool operator==(const const_iterator& other) const { return iDet_ == other.iDet_ && iData_ == other.iData_; } + bool operator!=(const const_iterator& other) const { return !operator==(other); } + const_iterator& operator++() { + ++iData_; + if (iData_ == endData_) { + ++iDet_; + endData_ += (iDet_ == ncc_->detIdSize_.size()) ? 0 : ncc_->detIdSize_[iDet_].size(); + } + return *this; + } + const_iterator operator++(int) { + auto tmp = *this; + ++(*this); + return tmp; + } - unsigned int detId() const { return detId_; } - unsigned short sampleIndex() const { return simhitcollection_.sampleIndex(); } - unsigned int nhits() const { return simhitcollection_.nhits(); } - const std::vector chargeArray() const { return simhitcollection_.chargeArray(); } - const std::vector timeArray() const { return simhitcollection_.timeArray(); } + TmpElem operator*() { return TmpElem(ncc_->detIdSize_[iDet_].detId(), ncc_->simhitCollection_[iData_]); } - private: - unsigned int detId_; - SimHitCollection simhitcollection_; - }; + private: + const PHGCSimAccumulator* ncc_; + unsigned int iDet_; + unsigned int iData_; + unsigned int endData_; + }; - class const_iterator { - public: - // begin - const_iterator(const PHGCSimAccumulator* ncc) - : ncc_(ncc), iDet_(0), iData_(0), endData_(ncc->detIdSize_.empty() ? 0 : ncc->detIdSize_.front().size()) {} - // end - const_iterator(const PHGCSimAccumulator* ncc, unsigned int detSize, unsigned int dataSize) - : ncc_(ncc), iDet_(detSize), iData_(dataSize), endData_(0) {} - - bool operator==(const const_iterator& other) const { return iDet_ == other.iDet_ && iData_ == other.iData_; } - bool operator!=(const const_iterator& other) const { return !operator==(other); } - const_iterator& operator++() { - ++iData_; - if (iData_ == endData_) { - ++iDet_; - endData_ += (iDet_ == ncc_->detIdSize_.size()) ? 0 : ncc_->detIdSize_[iDet_].size(); - } - return *this; - } - const_iterator operator++(int) { - auto tmp = *this; - ++(*this); - return tmp; - } + TmpElem back() const { return TmpElem(detIdSize_.back().detId(), simhitCollection_.back()); } - TmpElem operator*() { return TmpElem(ncc_->detIdSize_[iDet_].detId(), ncc_->simhitCollection_[iData_]); } + const_iterator cbegin() const { return const_iterator(this); } + const_iterator begin() const { return cbegin(); } + const_iterator cend() const { return const_iterator(this, detIdSize_.size(), simhitCollection_.size()); } + const_iterator end() const { return cend(); } private: - const PHGCSimAccumulator* ncc_; - unsigned int iDet_; - unsigned int iData_; - unsigned int endData_; + std::vector detIdSize_; + std::vector simhitCollection_; }; - - TmpElem back() const { return TmpElem(detIdSize_.back().detId(), simhitCollection_.back()); } - - const_iterator cbegin() const { return const_iterator(this); } - const_iterator begin() const { return cbegin(); } - const_iterator cend() const { return const_iterator(this, detIdSize_.size(), simhitCollection_.size()); } - const_iterator end() const { return cend(); } - -private: - std::vector detIdSize_; - std::vector simhitCollection_; -}; +} // namespace io_v1 +using PHGCSimAccumulator = io_v1::PHGCSimAccumulator; #endif diff --git a/DataFormats/HGCalDigi/src/classes_def.xml b/DataFormats/HGCalDigi/src/classes_def.xml index a9df2fa71e6f6..7600980de2933 100644 --- a/DataFormats/HGCalDigi/src/classes_def.xml +++ b/DataFormats/HGCalDigi/src/classes_def.xml @@ -20,12 +20,18 @@ - - - - - - + + + + + + + + + + + + diff --git a/DataFormats/HGCalReco/interface/TICLCandidate.h b/DataFormats/HGCalReco/interface/TICLCandidate.h index 14acca492b4bc..5809f2e111d66 100644 --- a/DataFormats/HGCalReco/interface/TICLCandidate.h +++ b/DataFormats/HGCalReco/interface/TICLCandidate.h @@ -14,143 +14,146 @@ // A TICLCandidate is a lightweight physics object made from one or multiple Tracksters. -class TICLCandidate : public reco::LeafCandidate { -public: - typedef ticl::Trackster::ParticleType ParticleType; - - TICLCandidate(Charge q, const LorentzVector& p4) - : LeafCandidate(q, p4), idProbabilities_{}, time_(0.f), timeError_(-1.f), rawEnergy_(0.f) {} - - TICLCandidate() - : LeafCandidate(), - idProbabilities_{}, - time_(0.f), - timeError_(-1.f), - MTDtime_{0.f}, - MTDtimeError_{-1.f}, - rawEnergy_(0.f) {} - - TICLCandidate(const edm::Ptr& trackster) - : LeafCandidate(), - tracksters_({trackster}), - idProbabilities_{}, - time_(trackster->time()), - timeError_(trackster->timeError()), - MTDtime_{0.f}, - MTDtimeError_{-1.f}, - rawEnergy_(0.f) {} - - TICLCandidate(const edm::Ptr trackPtr, const edm::Ptr& tracksterPtr) - : LeafCandidate(), tracksters_{}, trackPtrs_{}, time_(0.f), timeError_(-1.f) { - if (trackPtr.isNull() and tracksterPtr.isNull()) - throw cms::Exception("NullPointerError") - << "TICLCandidate constructor: at least one between track and trackster must be valid"; - - if (tracksterPtr.isNonnull()) { - tracksters_.push_back(tracksterPtr); - auto const& trackster = tracksters_[0].get(); - idProbabilities_ = trackster->id_probabilities(); - if (trackPtr.isNonnull()) { +namespace io_v1 { + class TICLCandidate : public reco::LeafCandidate { + public: + typedef ticl::Trackster::ParticleType ParticleType; + + TICLCandidate(Charge q, const LorentzVector& p4) + : LeafCandidate(q, p4), idProbabilities_{}, time_(0.f), timeError_(-1.f), rawEnergy_(0.f) {} + + TICLCandidate() + : LeafCandidate(), + idProbabilities_{}, + time_(0.f), + timeError_(-1.f), + MTDtime_{0.f}, + MTDtimeError_{-1.f}, + rawEnergy_(0.f) {} + + TICLCandidate(const edm::Ptr& trackster) + : LeafCandidate(), + tracksters_({trackster}), + idProbabilities_{}, + time_(trackster->time()), + timeError_(trackster->timeError()), + MTDtime_{0.f}, + MTDtimeError_{-1.f}, + rawEnergy_(0.f) {} + + TICLCandidate(const edm::Ptr trackPtr, const edm::Ptr& tracksterPtr) + : LeafCandidate(), tracksters_{}, trackPtrs_{}, time_(0.f), timeError_(-1.f) { + if (trackPtr.isNull() and tracksterPtr.isNull()) + throw cms::Exception("NullPointerError") + << "TICLCandidate constructor: at least one between track and trackster must be valid"; + + if (tracksterPtr.isNonnull()) { + tracksters_.push_back(tracksterPtr); + auto const& trackster = tracksters_[0].get(); + idProbabilities_ = trackster->id_probabilities(); + if (trackPtr.isNonnull()) { + trackPtrs_.push_back(trackPtr); + auto pdgId = trackster->isHadronic() ? 211 : 11; + auto const& tk = trackPtr.get(); + setPdgId(pdgId * tk->charge()); + setCharge(tk->charge()); + rawEnergy_ = trackster->raw_energy(); + auto const& regrE = trackster->regressed_energy(); + math::XYZTLorentzVector p4(regrE * tk->momentum().unit().x(), + regrE * tk->momentum().unit().y(), + regrE * tk->momentum().unit().z(), + regrE); + setP4(p4); + + } else { + auto pdgId = trackster->isHadronic() ? 130 : 22; + setPdgId(pdgId); + setCharge(0); + rawEnergy_ = trackster->raw_energy(); + const float& regrE = trackster->regressed_energy(); + math::XYZTLorentzVector p4(regrE * trackster->barycenter().unit().x(), + regrE * trackster->barycenter().unit().y(), + regrE * trackster->barycenter().unit().z(), + regrE); + setP4(p4); + } + } else { + //candidate from track only trackPtrs_.push_back(trackPtr); - auto pdgId = trackster->isHadronic() ? 211 : 11; auto const& tk = trackPtr.get(); - setPdgId(pdgId * tk->charge()); + setPdgId(211 * tk->charge()); setCharge(tk->charge()); - rawEnergy_ = trackster->raw_energy(); - auto const& regrE = trackster->regressed_energy(); - math::XYZTLorentzVector p4(regrE * tk->momentum().unit().x(), - regrE * tk->momentum().unit().y(), - regrE * tk->momentum().unit().z(), - regrE); - setP4(p4); - - } else { - auto pdgId = trackster->isHadronic() ? 130 : 22; - setPdgId(pdgId); - setCharge(0); - rawEnergy_ = trackster->raw_energy(); - const float& regrE = trackster->regressed_energy(); - math::XYZTLorentzVector p4(regrE * trackster->barycenter().unit().x(), - regrE * trackster->barycenter().unit().y(), - regrE * trackster->barycenter().unit().z(), - regrE); - setP4(p4); + const float energy = std::sqrt(tk->p() * tk->p() + ticl::mpion2); + setRawEnergy(energy); + math::PtEtaPhiMLorentzVector p4Polar(tk->pt(), tk->eta(), tk->phi(), ticl::mpion); + setP4(p4Polar); } - } else { - //candidate from track only - trackPtrs_.push_back(trackPtr); - auto const& tk = trackPtr.get(); - setPdgId(211 * tk->charge()); - setCharge(tk->charge()); - const float energy = std::sqrt(tk->p() * tk->p() + ticl::mpion2); - setRawEnergy(energy); - math::PtEtaPhiMLorentzVector p4Polar(tk->pt(), tk->eta(), tk->phi(), ticl::mpion); - setP4(p4Polar); } - } - inline float time() const { return time_; } - inline float timeError() const { return timeError_; } + inline float time() const { return time_; } + inline float timeError() const { return timeError_; } - void setTime(float time, float timeError) { - time_ = time; - timeError_ = timeError; - }; + void setTime(float time, float timeError) { + time_ = time; + timeError_ = timeError; + }; - inline float MTDtime() const { return MTDtime_; } - inline float MTDtimeError() const { return MTDtimeError_; } + inline float MTDtime() const { return MTDtime_; } + inline float MTDtimeError() const { return MTDtimeError_; } - void setMTDTime(float time, float timeError) { - MTDtime_ = time; - MTDtimeError_ = timeError; - }; + void setMTDTime(float time, float timeError) { + MTDtime_ = time; + MTDtimeError_ = timeError; + }; + + inline const edm::Ptr trackPtr(int index = 0) const { + return trackPtrs_.empty() ? edm::Ptr() : trackPtrs_[index]; + } + inline const std::vector> trackPtrs() const { return trackPtrs_; } + void addTrackPtr(const edm::Ptr& trackPtr) { trackPtrs_.push_back(trackPtr); } + + inline float rawEnergy() const { return rawEnergy_; } + void setRawEnergy(float rawEnergy) { rawEnergy_ = rawEnergy; } - inline const edm::Ptr trackPtr(int index = 0) const { - return trackPtrs_.empty() ? edm::Ptr() : trackPtrs_[index]; - } - inline const std::vector> trackPtrs() const { return trackPtrs_; } - void addTrackPtr(const edm::Ptr& trackPtr) { trackPtrs_.push_back(trackPtr); } - - inline float rawEnergy() const { return rawEnergy_; } - void setRawEnergy(float rawEnergy) { rawEnergy_ = rawEnergy; } - - inline const std::vector> tracksters() const { return tracksters_; }; - - void setTracksters(const std::vector>& tracksters) { tracksters_ = tracksters; } - void addTrackster(const edm::Ptr& trackster) { - tracksters_.push_back(trackster); - time_ = trackster->time(); - timeError_ = trackster->timeError(); - } - // convenience method to return the ID probability for a certain particle type - inline float id_probability(ParticleType type) const { - // probabilities are stored in the same order as defined in the ParticleType enum - return idProbabilities_[(int)type]; - } - - inline const std::array& idProbabilities() const { return idProbabilities_; } - - void zeroProbabilities() { - for (auto& p : idProbabilities_) { - p = 0.f; + inline const std::vector> tracksters() const { return tracksters_; }; + + void setTracksters(const std::vector>& tracksters) { tracksters_ = tracksters; } + void addTrackster(const edm::Ptr& trackster) { + tracksters_.push_back(trackster); + time_ = trackster->time(); + timeError_ = trackster->timeError(); + } + // convenience method to return the ID probability for a certain particle type + inline float id_probability(ParticleType type) const { + // probabilities are stored in the same order as defined in the ParticleType enum + return idProbabilities_[(int)type]; + } + + inline const std::array& idProbabilities() const { return idProbabilities_; } + + void zeroProbabilities() { + for (auto& p : idProbabilities_) { + p = 0.f; + } } - } - - void setIdProbabilities(const std::array& idProbs) { idProbabilities_ = idProbs; } - inline void setIdProbability(ParticleType type, float value) { idProbabilities_[int(type)] = value; } - -private: - // vector of Ptr so Tracksters can come from different collections - // and there can be derived classes - std::vector> tracksters_; - std::vector> trackPtrs_; - // Since it contains multiple tracksters, duplicate the probability interface - std::array idProbabilities_; - - float time_; - float timeError_; - float MTDtime_; - float MTDtimeError_; - float rawEnergy_; -}; + + void setIdProbabilities(const std::array& idProbs) { idProbabilities_ = idProbs; } + inline void setIdProbability(ParticleType type, float value) { idProbabilities_[int(type)] = value; } + + private: + // vector of Ptr so Tracksters can come from different collections + // and there can be derived classes + std::vector> tracksters_; + std::vector> trackPtrs_; + // Since it contains multiple tracksters, duplicate the probability interface + std::array idProbabilities_; + + float time_; + float timeError_; + float MTDtime_; + float MTDtimeError_; + float rawEnergy_; + }; +} // namespace io_v1 +using TICLCandidate = io_v1::TICLCandidate; #endif diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index 79ab555f078ca..3b7f0d97ad2c6 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -18,271 +18,274 @@ // layer clusters together in a 3D object. namespace ticl { - class Trackster { - public: - typedef math::XYZVectorF Vector; + namespace io_v1 { + class Trackster { + public: + typedef math::XYZVectorF Vector; - enum IterationIndex { TRKEM = 0, EM, TRKHAD, HAD, MIP, SIM, SIM_CP }; + enum IterationIndex { TRKEM = 0, EM, TRKHAD, HAD, MIP, SIM, SIM_CP }; - // types considered by the particle identification - enum class ParticleType { - photon = 0, - electron, - muon, - neutral_pion, - charged_hadron, - neutral_hadron, - ambiguous, - unknown, - }; - - enum class PCAOrdering { ascending = 0, descending }; - - Trackster() - : barycenter_({0.f, 0.f, 0.f}), - regressed_energy_(0.f), - raw_energy_(0.f), - boundTime_(0.f), - time_(0.f), - timeError_(-1.f), - id_probabilities_{}, - raw_pt_(0.f), - raw_em_pt_(0.f), - raw_em_energy_(0.f), - seedIndex_(-1), - eigenvalues_{}, - sigmas_{}, - sigmasPCA_{}, - iterationIndex_(0) {} + // types considered by the particle identification + enum class ParticleType { + photon = 0, + electron, + muon, + neutral_pion, + charged_hadron, + neutral_hadron, + ambiguous, + unknown, + }; - inline void setIteration(const Trackster::IterationIndex i) { iterationIndex_ = i; } - std::vector &vertices() { return vertices_; } - std::vector &vertex_multiplicity() { return vertex_multiplicity_; } - std::vector > &edges() { return edges_; } - inline void setSeed(edm::ProductID pid, int index) { - seedID_ = pid; - seedIndex_ = index; - } - inline void setTimeAndError(float t, float tError) { - time_ = t; - timeError_ = tError; - } - inline void setRegressedEnergy(float value) { regressed_energy_ = value; } - inline void setRawEnergy(float value) { raw_energy_ = value; } - inline void addToRawEnergy(float value) { raw_energy_ += value; } - inline void setRawEmEnergy(float value) { raw_em_energy_ = value; } - inline void addToRawEmEnergy(float value) { raw_em_energy_ += value; } - inline void setRawPt(float value) { raw_pt_ = value; } - inline void calculateRawPt() { raw_pt_ = raw_energy_ / std::cosh(barycenter_.eta()); } - inline void setRawEmPt(float value) { raw_em_pt_ = value; } - inline void calculateRawEmPt() { raw_em_pt_ = raw_em_energy_ / std::cosh(barycenter_.eta()); } - inline void setBarycenter(Vector value) { barycenter_ = value; } - inline void addTrackIdx(int index) { track_idxs_.push_back(index); } - int trackIdx(int index = 0) const { return track_idxs_.empty() ? -1 : track_idxs_[index]; } - inline bool isHadronic(float th = 0.5f) const { - return id_probability(Trackster::ParticleType::photon) + id_probability(Trackster::ParticleType::electron) < th; - } + enum class PCAOrdering { ascending = 0, descending }; - inline void mergeTracksters(const Trackster &other) { - *this += other; + Trackster() + : barycenter_({0.f, 0.f, 0.f}), + regressed_energy_(0.f), + raw_energy_(0.f), + boundTime_(0.f), + time_(0.f), + timeError_(-1.f), + id_probabilities_{}, + raw_pt_(0.f), + raw_em_pt_(0.f), + raw_em_energy_(0.f), + seedIndex_(-1), + eigenvalues_{}, + sigmas_{}, + sigmasPCA_{}, + iterationIndex_(0) {} - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } + inline void setIteration(const Trackster::IterationIndex i) { iterationIndex_ = i; } + std::vector &vertices() { return vertices_; } + std::vector &vertex_multiplicity() { return vertex_multiplicity_; } + std::vector > &edges() { return edges_; } + inline void setSeed(edm::ProductID pid, int index) { + seedID_ = pid; + seedIndex_ = index; + } + inline void setTimeAndError(float t, float tError) { + time_ = t; + timeError_ = tError; + } + inline void setRegressedEnergy(float value) { regressed_energy_ = value; } + inline void setRawEnergy(float value) { raw_energy_ = value; } + inline void addToRawEnergy(float value) { raw_energy_ += value; } + inline void setRawEmEnergy(float value) { raw_em_energy_ = value; } + inline void addToRawEmEnergy(float value) { raw_em_energy_ += value; } + inline void setRawPt(float value) { raw_pt_ = value; } + inline void calculateRawPt() { raw_pt_ = raw_energy_ / std::cosh(barycenter_.eta()); } + inline void setRawEmPt(float value) { raw_em_pt_ = value; } + inline void calculateRawEmPt() { raw_em_pt_ = raw_em_energy_ / std::cosh(barycenter_.eta()); } + inline void setBarycenter(Vector value) { barycenter_ = value; } + inline void addTrackIdx(int index) { track_idxs_.push_back(index); } + int trackIdx(int index = 0) const { return track_idxs_.empty() ? -1 : track_idxs_[index]; } + inline bool isHadronic(float th = 0.5f) const { + return id_probability(Trackster::ParticleType::photon) + id_probability(Trackster::ParticleType::electron) < th; + } - inline void mergeTracksters(const std::vector &others) { - for (auto &other : others) { + inline void mergeTracksters(const Trackster &other) { *this += other; + + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); } - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } - template - inline void mergeTracksters(const std::vector &allTracksters, const std::vector &others) { - for (auto &other : others) { - *this += allTracksters[other]; + inline void mergeTracksters(const std::vector &others) { + for (auto &other : others) { + *this += other; + } + + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); } + template + inline void mergeTracksters(const std::vector &allTracksters, const std::vector &others) { + for (auto &other : others) { + *this += allTracksters[other]; + } - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } - template - inline void mergeTracksters(const edm::MultiSpan &allTracksters, const std::vector &others) { - for (auto &other : others) { - *this += allTracksters[other]; + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); } + template + inline void mergeTracksters(const edm::MultiSpan &allTracksters, const std::vector &others) { + for (auto &other : others) { + *this += allTracksters[other]; + } - //remove duplicates - removeDuplicates(); - zeroProbabilities(); - calculateRawPt(); - calculateRawEmPt(); - } + //remove duplicates + removeDuplicates(); + zeroProbabilities(); + calculateRawPt(); + calculateRawEmPt(); + } - inline void fillPCAVariables(Eigen::Vector3f const &eigenvalues, - Eigen::Matrix3f const &eigenvectors, - Eigen::Vector3f const &sigmas, - Eigen::Vector3f const &sigmasEigen, - size_t pcadimension, - PCAOrdering order) { - int original_index = 0; - for (size_t i = 0; i < pcadimension; ++i) { - sigmas_[i] = std::sqrt(sigmas[i]); - // Reverse the order, since Eigen gives back the eigevalues in - // **increasing order** while we store them in **descreasing order**. - original_index = i; + inline void fillPCAVariables(Eigen::Vector3f const &eigenvalues, + Eigen::Matrix3f const &eigenvectors, + Eigen::Vector3f const &sigmas, + Eigen::Vector3f const &sigmasEigen, + size_t pcadimension, + PCAOrdering order) { + int original_index = 0; + for (size_t i = 0; i < pcadimension; ++i) { + sigmas_[i] = std::sqrt(sigmas[i]); + // Reverse the order, since Eigen gives back the eigevalues in + // **increasing order** while we store them in **descreasing order**. + original_index = i; + if (order == PCAOrdering::ascending) + original_index = pcadimension - i - 1; + eigenvalues_[i] = (float)eigenvalues[original_index]; + eigenvectors_[i] = ticl::io_v1::Trackster::Vector( + eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); + sigmasPCA_[i] = std::sqrt(sigmasEigen[original_index]); + } + original_index = 0; if (order == PCAOrdering::ascending) - original_index = pcadimension - i - 1; - eigenvalues_[i] = (float)eigenvalues[original_index]; - eigenvectors_[i] = ticl::Trackster::Vector( - eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); - sigmasPCA_[i] = std::sqrt(sigmasEigen[original_index]); - } - original_index = 0; - if (order == PCAOrdering::ascending) - original_index = pcadimension - 1; - if (eigenvectors_[0].z() * barycenter_.z() < 0.0) { - eigenvectors_[0] = -ticl::Trackster::Vector( - eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); - } + original_index = pcadimension - 1; + if (eigenvectors_[0].z() * barycenter_.z() < 0.0) { + eigenvectors_[0] = -ticl::io_v1::Trackster::Vector( + eigenvectors(0, original_index), eigenvectors(1, original_index), eigenvectors(2, original_index)); + } - // Now also update the pt part of the Trackster, using the PCA as direction - // raw_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_energy_).perp2()); - // raw_em_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_em_energy_).perp2()); - } - void zeroProbabilities() { - for (auto &p : id_probabilities_) { - p = 0.f; + // Now also update the pt part of the Trackster, using the PCA as direction + // raw_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_energy_).perp2()); + // raw_em_pt_ = std::sqrt((eigenvectors_[0].Unit() * raw_em_energy_).perp2()); } - } - inline void setProbabilities(float *probs) { - for (float &p : id_probabilities_) { - p = *(probs++); + void zeroProbabilities() { + for (auto &p : id_probabilities_) { + p = 0.f; + } } - } - inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = value; } + inline void setProbabilities(float *probs) { + for (float &p : id_probabilities_) { + p = *(probs++); + } + } + inline void setIdProbability(ParticleType type, float value) { id_probabilities_[int(type)] = value; } - inline void setBoundaryTime(float t) { boundTime_ = t; }; + inline void setBoundaryTime(float t) { boundTime_ = t; }; - inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } - inline const std::vector &vertices() const { return vertices_; } - inline const unsigned int vertices(int index) const { return vertices_[index]; } - inline const std::vector &vertex_multiplicity() const { return vertex_multiplicity_; } - inline const float vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } - inline const std::vector > &edges() const { return edges_; } - inline const edm::ProductID &seedID() const { return seedID_; } - inline const int seedIndex() const { return seedIndex_; } - inline const float time() const { return time_; } - inline const float timeError() const { return timeError_; } - inline const float regressed_energy() const { return regressed_energy_; } - inline const float raw_energy() const { return raw_energy_; } - inline const float raw_em_energy() const { return raw_em_energy_; } - inline const float raw_pt() const { return raw_pt_; } - inline const float raw_em_pt() const { return raw_em_pt_; } - inline const float boundaryTime() const { return boundTime_; }; - inline const Vector &barycenter() const { return barycenter_; } - inline const std::array &eigenvalues() const { return eigenvalues_; } - inline const std::array &eigenvectors() const { return eigenvectors_; } - inline const Vector &eigenvectors(int index) const { return eigenvectors_[index]; } - inline const std::array &sigmas() const { return sigmas_; } - inline const std::array &sigmasPCA() const { return sigmasPCA_; } - inline const std::array &id_probabilities() const { return id_probabilities_; } - inline const float id_probabilities(int index) const { return id_probabilities_[index]; } - inline const std::vector &trackIdxs() const { return track_idxs_; } + inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } + inline const std::vector &vertices() const { return vertices_; } + inline const unsigned int vertices(int index) const { return vertices_[index]; } + inline const std::vector &vertex_multiplicity() const { return vertex_multiplicity_; } + inline const float vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } + inline const std::vector > &edges() const { return edges_; } + inline const edm::ProductID &seedID() const { return seedID_; } + inline const int seedIndex() const { return seedIndex_; } + inline const float time() const { return time_; } + inline const float timeError() const { return timeError_; } + inline const float regressed_energy() const { return regressed_energy_; } + inline const float raw_energy() const { return raw_energy_; } + inline const float raw_em_energy() const { return raw_em_energy_; } + inline const float raw_pt() const { return raw_pt_; } + inline const float raw_em_pt() const { return raw_em_pt_; } + inline const float boundaryTime() const { return boundTime_; }; + inline const Vector &barycenter() const { return barycenter_; } + inline const std::array &eigenvalues() const { return eigenvalues_; } + inline const std::array &eigenvectors() const { return eigenvectors_; } + inline const Vector &eigenvectors(int index) const { return eigenvectors_[index]; } + inline const std::array &sigmas() const { return sigmas_; } + inline const std::array &sigmasPCA() const { return sigmasPCA_; } + inline const std::array &id_probabilities() const { return id_probabilities_; } + inline const float id_probabilities(int index) const { return id_probabilities_[index]; } + inline const std::vector &trackIdxs() const { return track_idxs_; } - // convenience method to return the ID probability for a certain particle type - inline float id_probability(ParticleType type) const { - // probabilities are stored in the same order as defined in the ParticleType enum - return id_probabilities_[(int)type]; - } + // convenience method to return the ID probability for a certain particle type + inline float id_probability(ParticleType type) const { + // probabilities are stored in the same order as defined in the ParticleType enum + return id_probabilities_[(int)type]; + } - private: - Vector barycenter_; - float regressed_energy_ = 0.f; - float raw_energy_ = 0.f; - // -99, -1 if not available. ns units otherwise - float boundTime_; - float time_; - float timeError_; + private: + Vector barycenter_; + float regressed_energy_ = 0.f; + float raw_energy_ = 0.f; + // -99, -1 if not available. ns units otherwise + float boundTime_; + float time_; + float timeError_; - // trackster ID probabilities - std::array id_probabilities_; + // trackster ID probabilities + std::array id_probabilities_; - // The vertices of the DAG are the indices of the - // 2d objects in the global collection - std::vector vertices_; - std::vector vertex_multiplicity_; - float raw_pt_ = 0.f; - float raw_em_pt_ = 0.f; - float raw_em_energy_ = 0.f; + // The vertices of the DAG are the indices of the + // 2d objects in the global collection + std::vector vertices_; + std::vector vertex_multiplicity_; + float raw_pt_ = 0.f; + float raw_em_pt_ = 0.f; + float raw_em_energy_ = 0.f; - // Product ID of the seeding collection used to create the Trackster. - // For GlobalSeeding the ProductID is set to 0. For track-based seeding - // this is the ProductID of the track-collection used to create the - // seeding-regions. - edm::ProductID seedID_; + // Product ID of the seeding collection used to create the Trackster. + // For GlobalSeeding the ProductID is set to 0. For track-based seeding + // this is the ProductID of the track-collection used to create the + // seeding-regions. + edm::ProductID seedID_; - // For Global Seeding the index is fixed to one. For track-based seeding, - // the index is the index of the track originating the seeding region that - // created the trackster. For track-based seeding the pointer to the track - // can be cooked using the previous ProductID and this index. - int seedIndex_; - std::vector track_idxs_; + // For Global Seeding the index is fixed to one. For track-based seeding, + // the index is the index of the track originating the seeding region that + // created the trackster. For track-based seeding the pointer to the track + // can be cooked using the previous ProductID and this index. + int seedIndex_; + std::vector track_idxs_; - std::array eigenvectors_; - std::array eigenvalues_; - std::array sigmas_; - std::array sigmasPCA_; + std::array eigenvectors_; + std::array eigenvalues_; + std::array sigmas_; + std::array sigmasPCA_; - // The edges connect two vertices together in a directed doublet - // ATTENTION: order matters! - // A doublet generator should create edges in which: - // the first element is on the inner layer and - // the outer element is on the outer layer. - std::vector > edges_; + // The edges connect two vertices together in a directed doublet + // ATTENTION: order matters! + // A doublet generator should create edges in which: + // the first element is on the inner layer and + // the outer element is on the outer layer. + std::vector > edges_; - // TICL iteration producing the trackster - uint8_t iterationIndex_; - inline void removeDuplicates() { - auto vtx_sorted{vertices_}; - std::sort(std::begin(vtx_sorted), std::end(vtx_sorted)); - for (unsigned int iLC = 1; iLC < vtx_sorted.size(); ++iLC) { - if (vtx_sorted[iLC] == vtx_sorted[iLC - 1]) { - // Clean up duplicate LCs - const auto lcIdx = vtx_sorted[iLC]; - const auto firstEl = std::find(vertices_.begin(), vertices_.end(), lcIdx); - const auto firstPos = std::distance(std::begin(vertices_), firstEl); - auto iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); - while (iDup != vertices_.end()) { - vertex_multiplicity_.erase(vertex_multiplicity_.begin() + std::distance(std::begin(vertices_), iDup)); - vertices_.erase(iDup); - vertex_multiplicity_[firstPos] -= 1; - iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); - }; + // TICL iteration producing the trackster + uint8_t iterationIndex_; + inline void removeDuplicates() { + auto vtx_sorted{vertices_}; + std::sort(std::begin(vtx_sorted), std::end(vtx_sorted)); + for (unsigned int iLC = 1; iLC < vtx_sorted.size(); ++iLC) { + if (vtx_sorted[iLC] == vtx_sorted[iLC - 1]) { + // Clean up duplicate LCs + const auto lcIdx = vtx_sorted[iLC]; + const auto firstEl = std::find(vertices_.begin(), vertices_.end(), lcIdx); + const auto firstPos = std::distance(std::begin(vertices_), firstEl); + auto iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); + while (iDup != vertices_.end()) { + vertex_multiplicity_.erase(vertex_multiplicity_.begin() + std::distance(std::begin(vertices_), iDup)); + vertices_.erase(iDup); + vertex_multiplicity_[firstPos] -= 1; + iDup = std::find(std::next(firstEl), vertices_.end(), lcIdx); + }; + } } } - } - inline void operator+=(const Trackster &other) { - // use getters on other - raw_energy_ += other.raw_energy(); - raw_em_energy_ += other.raw_em_energy(); - // add vertices and multiplicities - std::copy(std::begin(other.vertices()), std::end(other.vertices()), std::back_inserter(vertices_)); - std::copy(std::begin(other.vertex_multiplicity()), - std::end(other.vertex_multiplicity()), - std::back_inserter(vertex_multiplicity_)); - } - }; + inline void operator+=(const Trackster &other) { + // use getters on other + raw_energy_ += other.raw_energy(); + raw_em_energy_ += other.raw_em_energy(); + // add vertices and multiplicities + std::copy(std::begin(other.vertices()), std::end(other.vertices()), std::back_inserter(vertices_)); + std::copy(std::begin(other.vertex_multiplicity()), + std::end(other.vertex_multiplicity()), + std::back_inserter(vertex_multiplicity_)); + } + }; + } // namespace io_v1 + using Trackster = io_v1::Trackster; typedef std::vector TracksterCollection; } // namespace ticl diff --git a/DataFormats/HGCalReco/interface/TracksterFwd.h b/DataFormats/HGCalReco/interface/TracksterFwd.h index 24c16078cf84d..8c178d8fc8c54 100644 --- a/DataFormats/HGCalReco/interface/TracksterFwd.h +++ b/DataFormats/HGCalReco/interface/TracksterFwd.h @@ -2,7 +2,10 @@ #define DataFormats_HGCalReco_TracksterFwd_h namespace ticl { - class Trackster; -} + namespace io_v1 { + class Trackster; + } + using Trackster = io_v1::Trackster; +} // namespace ticl #endif diff --git a/DataFormats/HGCalReco/src/classes_def.xml b/DataFormats/HGCalReco/src/classes_def.xml index 1f1a574ea44ac..60f599f6128f2 100644 --- a/DataFormats/HGCalReco/src/classes_def.xml +++ b/DataFormats/HGCalReco/src/classes_def.xml @@ -1,22 +1,13 @@ - - - - - - - - - - - + + - - - - - + + + + + @@ -67,14 +58,12 @@ - - - - + + - - - + + + diff --git a/DataFormats/HLTReco/interface/TriggerEventWithRefs.h b/DataFormats/HLTReco/interface/TriggerEventWithRefs.h index f9e0c6877438b..bb32b575797cc 100644 --- a/DataFormats/HLTReco/interface/TriggerEventWithRefs.h +++ b/DataFormats/HLTReco/interface/TriggerEventWithRefs.h @@ -20,757 +20,760 @@ #include namespace trigger { + namespace io_v1 { - /// The single EDProduct to be saved in addition for each event - /// - but only in the "RAW" case: for a fraction of all events + /// The single EDProduct to be saved in addition for each event + /// - but only in the "RAW" case: for a fraction of all events - class TriggerEventWithRefs : public TriggerRefsCollections, public edm::DoNotRecordParents { - public: - /// Helper class: trigger objects firing a single filter - class TriggerFilterObject { + class TriggerEventWithRefs : public TriggerRefsCollections, public edm::DoNotRecordParents { public: - /// encoded InputTag of filter product - std::string filterTag_; - /// 1-after-end (std C++) indices into linearised vector of Refs - /// (-> first start index is always 0) - size_type photons_; - size_type electrons_; - size_type muons_; - size_type jets_; - size_type composites_; - size_type basemets_; - size_type calomets_; - size_type pixtracks_; - size_type l1em_; - size_type l1muon_; - size_type l1jet_; - size_type l1etmiss_; - size_type l1hfrings_; - size_type pfjets_; - size_type pftaus_; - size_type pfmets_; - size_type l1tmuon_; - size_type l1tmuonShower_; - size_type l1tegamma_; - size_type l1tjet_; - size_type l1ttkmuon_; - size_type l1ttkele_; - size_type l1ttkem_; - size_type l1tpfjet_; - size_type l1tpftau_; - size_type l1thpspftau_; - size_type l1tpftrack_; - size_type l1tp2etsum_; - size_type l1ttau_; - size_type l1tetsum_; - size_type l1tp2gtcand_; - - /// constructor - TriggerFilterObject() - : filterTag_(), - photons_(0), - electrons_(0), - muons_(0), - jets_(0), - composites_(0), - basemets_(0), - calomets_(0), - pixtracks_(0), - l1em_(0), - l1muon_(0), - l1jet_(0), - l1etmiss_(0), - l1hfrings_(0), - pfjets_(0), - pftaus_(0), - pfmets_(0), - l1tmuon_(0), - l1tmuonShower_(0), - l1tegamma_(0), - l1tjet_(0), - l1ttkmuon_(0), - l1ttkele_(0), - l1ttkem_(0), - l1tpfjet_(0), - l1tpftau_(0), - l1thpspftau_(0), - l1tpftrack_(0), - l1tp2etsum_(0), - l1ttau_(0), - l1tetsum_(0), - l1tp2gtcand_(0) { - filterTag_ = edm::InputTag().encode(); - } - TriggerFilterObject(const edm::InputTag& filterTag, - size_type np, - size_type ne, - size_type nm, - size_type nj, - size_type nc, - size_type nB, - size_type nC, - size_type nt, - size_type l1em, - size_type l1muon, - size_type l1jet, - size_type l1etmiss, - size_type l1hfrings, - size_type pfjets, - size_type pftaus, - size_type pfmets, - size_type l1tmuon, - size_type l1tmuonShower, - size_type l1tegamma, - size_type l1tjet, - size_type l1ttkmuon, - size_type l1ttkele, - size_type l1ttkem, - size_type l1tpfjet, - size_type l1tpftau, - size_type l1thpspftau, - size_type l1tpftrack, - size_type l1tp2etsum, - size_type l1ttau, - size_type l1tetsum, - size_type l1tp2gtcand) - : filterTag_(filterTag.encode()), - photons_(np), - electrons_(ne), - muons_(nm), - jets_(nj), - composites_(nc), - basemets_(nB), - calomets_(nC), - pixtracks_(nt), - l1em_(l1em), - l1muon_(l1muon), - l1jet_(l1jet), - l1etmiss_(l1etmiss), - l1hfrings_(l1hfrings), - pfjets_(pfjets), - pftaus_(pftaus), - pfmets_(pfmets), - l1tmuon_(l1tmuon), - l1tmuonShower_(l1tmuonShower), - l1tegamma_(l1tegamma), - l1tjet_(l1tjet), - l1ttkmuon_(l1ttkmuon), - l1ttkele_(l1ttkele), - l1ttkem_(l1ttkem), - l1tpfjet_(l1tpfjet), - l1tpftau_(l1tpftau), - l1thpspftau_(l1thpspftau), - l1tpftrack_(l1tpftrack), - l1tp2etsum_(l1tp2etsum), - l1ttau_(l1ttau), - l1tetsum_(l1tetsum), - l1tp2gtcand_(l1tp2gtcand) {} - }; + /// Helper class: trigger objects firing a single filter + class TriggerFilterObject { + public: + /// encoded InputTag of filter product + std::string filterTag_; + /// 1-after-end (std C++) indices into linearised vector of Refs + /// (-> first start index is always 0) + size_type photons_; + size_type electrons_; + size_type muons_; + size_type jets_; + size_type composites_; + size_type basemets_; + size_type calomets_; + size_type pixtracks_; + size_type l1em_; + size_type l1muon_; + size_type l1jet_; + size_type l1etmiss_; + size_type l1hfrings_; + size_type pfjets_; + size_type pftaus_; + size_type pfmets_; + size_type l1tmuon_; + size_type l1tmuonShower_; + size_type l1tegamma_; + size_type l1tjet_; + size_type l1ttkmuon_; + size_type l1ttkele_; + size_type l1ttkem_; + size_type l1tpfjet_; + size_type l1tpftau_; + size_type l1thpspftau_; + size_type l1tpftrack_; + size_type l1tp2etsum_; + size_type l1ttau_; + size_type l1tetsum_; + size_type l1tp2gtcand_; + + /// constructor + TriggerFilterObject() + : filterTag_(), + photons_(0), + electrons_(0), + muons_(0), + jets_(0), + composites_(0), + basemets_(0), + calomets_(0), + pixtracks_(0), + l1em_(0), + l1muon_(0), + l1jet_(0), + l1etmiss_(0), + l1hfrings_(0), + pfjets_(0), + pftaus_(0), + pfmets_(0), + l1tmuon_(0), + l1tmuonShower_(0), + l1tegamma_(0), + l1tjet_(0), + l1ttkmuon_(0), + l1ttkele_(0), + l1ttkem_(0), + l1tpfjet_(0), + l1tpftau_(0), + l1thpspftau_(0), + l1tpftrack_(0), + l1tp2etsum_(0), + l1ttau_(0), + l1tetsum_(0), + l1tp2gtcand_(0) { + filterTag_ = edm::InputTag().encode(); + } + TriggerFilterObject(const edm::InputTag& filterTag, + size_type np, + size_type ne, + size_type nm, + size_type nj, + size_type nc, + size_type nB, + size_type nC, + size_type nt, + size_type l1em, + size_type l1muon, + size_type l1jet, + size_type l1etmiss, + size_type l1hfrings, + size_type pfjets, + size_type pftaus, + size_type pfmets, + size_type l1tmuon, + size_type l1tmuonShower, + size_type l1tegamma, + size_type l1tjet, + size_type l1ttkmuon, + size_type l1ttkele, + size_type l1ttkem, + size_type l1tpfjet, + size_type l1tpftau, + size_type l1thpspftau, + size_type l1tpftrack, + size_type l1tp2etsum, + size_type l1ttau, + size_type l1tetsum, + size_type l1tp2gtcand) + : filterTag_(filterTag.encode()), + photons_(np), + electrons_(ne), + muons_(nm), + jets_(nj), + composites_(nc), + basemets_(nB), + calomets_(nC), + pixtracks_(nt), + l1em_(l1em), + l1muon_(l1muon), + l1jet_(l1jet), + l1etmiss_(l1etmiss), + l1hfrings_(l1hfrings), + pfjets_(pfjets), + pftaus_(pftaus), + pfmets_(pfmets), + l1tmuon_(l1tmuon), + l1tmuonShower_(l1tmuonShower), + l1tegamma_(l1tegamma), + l1tjet_(l1tjet), + l1ttkmuon_(l1ttkmuon), + l1ttkele_(l1ttkele), + l1ttkem_(l1ttkem), + l1tpfjet_(l1tpfjet), + l1tpftau_(l1tpftau), + l1thpspftau_(l1thpspftau), + l1tpftrack_(l1tpftrack), + l1tp2etsum_(l1tp2etsum), + l1ttau_(l1ttau), + l1tetsum_(l1tetsum), + l1tp2gtcand_(l1tp2gtcand) {} + }; + + /// data members + private: + /// processName used to select products packed up + std::string usedProcessName_; + /// the filters recorded here + std::vector filterObjects_; + + /// methods + public: + /// constructors + TriggerEventWithRefs() : TriggerRefsCollections(), usedProcessName_(), filterObjects_() {} + TriggerEventWithRefs(const std::string& usedProcessName, size_type n) + : TriggerRefsCollections(), usedProcessName_(usedProcessName), filterObjects_() { + filterObjects_.reserve(n); + } + + /// setters - to build EDProduct + void addFilterObject(const edm::InputTag& filterTag, const TriggerFilterObjectWithRefs& tfowr) { + filterObjects_.push_back( + + TriggerFilterObject(filterTag, + addObjects(tfowr.photonIds(), tfowr.photonRefs()), + addObjects(tfowr.electronIds(), tfowr.electronRefs()), + addObjects(tfowr.muonIds(), tfowr.muonRefs()), + addObjects(tfowr.jetIds(), tfowr.jetRefs()), + addObjects(tfowr.compositeIds(), tfowr.compositeRefs()), + addObjects(tfowr.basemetIds(), tfowr.basemetRefs()), + addObjects(tfowr.calometIds(), tfowr.calometRefs()), + addObjects(tfowr.pixtrackIds(), tfowr.pixtrackRefs()), + addObjects(tfowr.l1emIds(), tfowr.l1emRefs()), + addObjects(tfowr.l1muonIds(), tfowr.l1muonRefs()), + addObjects(tfowr.l1jetIds(), tfowr.l1jetRefs()), + addObjects(tfowr.l1etmissIds(), tfowr.l1etmissRefs()), + addObjects(tfowr.l1hfringsIds(), tfowr.l1hfringsRefs()), + addObjects(tfowr.pfjetIds(), tfowr.pfjetRefs()), + addObjects(tfowr.pftauIds(), tfowr.pftauRefs()), + addObjects(tfowr.pfmetIds(), tfowr.pfmetRefs()), + addObjects(tfowr.l1tmuonIds(), tfowr.l1tmuonRefs()), + addObjects(tfowr.l1tmuonShowerIds(), tfowr.l1tmuonShowerRefs()), + addObjects(tfowr.l1tegammaIds(), tfowr.l1tegammaRefs()), + addObjects(tfowr.l1tjetIds(), tfowr.l1tjetRefs()), + addObjects(tfowr.l1ttkmuonIds(), tfowr.l1ttkmuonRefs()), + addObjects(tfowr.l1ttkeleIds(), tfowr.l1ttkeleRefs()), + addObjects(tfowr.l1ttkemIds(), tfowr.l1ttkemRefs()), + addObjects(tfowr.l1tpfjetIds(), tfowr.l1tpfjetRefs()), + addObjects(tfowr.l1tpftauIds(), tfowr.l1tpftauRefs()), + addObjects(tfowr.l1thpspftauIds(), tfowr.l1thpspftauRefs()), + addObjects(tfowr.l1tpftrackIds(), tfowr.l1tpftrackRefs()), + addObjects(tfowr.l1tp2etsumIds(), tfowr.l1tp2etsumRefs()), + addObjects(tfowr.l1ttauIds(), tfowr.l1ttauRefs()), + addObjects(tfowr.l1tetsumIds(), tfowr.l1tetsumRefs()), + addObjects(tfowr.l1tp2gtcandIds(), tfowr.l1tp2gtcandRefs())) + + ); + } + + /// getters - for user access + const std::string& usedProcessName() const { return usedProcessName_; } + + /// number of filters + size_type size() const { return filterObjects_.size(); } + + /// tag from index + const edm::InputTag filterTag(size_type filterIndex) const { + return edm::InputTag(filterObjects_.at(filterIndex).filterTag_); + } - /// data members - private: - /// processName used to select products packed up - std::string usedProcessName_; - /// the filters recorded here - std::vector filterObjects_; - - /// methods - public: - /// constructors - TriggerEventWithRefs() : TriggerRefsCollections(), usedProcessName_(), filterObjects_() {} - TriggerEventWithRefs(const std::string& usedProcessName, size_type n) - : TriggerRefsCollections(), usedProcessName_(usedProcessName), filterObjects_() { - filterObjects_.reserve(n); - } - - /// setters - to build EDProduct - void addFilterObject(const edm::InputTag& filterTag, const TriggerFilterObjectWithRefs& tfowr) { - filterObjects_.push_back( - - TriggerFilterObject(filterTag, - addObjects(tfowr.photonIds(), tfowr.photonRefs()), - addObjects(tfowr.electronIds(), tfowr.electronRefs()), - addObjects(tfowr.muonIds(), tfowr.muonRefs()), - addObjects(tfowr.jetIds(), tfowr.jetRefs()), - addObjects(tfowr.compositeIds(), tfowr.compositeRefs()), - addObjects(tfowr.basemetIds(), tfowr.basemetRefs()), - addObjects(tfowr.calometIds(), tfowr.calometRefs()), - addObjects(tfowr.pixtrackIds(), tfowr.pixtrackRefs()), - addObjects(tfowr.l1emIds(), tfowr.l1emRefs()), - addObjects(tfowr.l1muonIds(), tfowr.l1muonRefs()), - addObjects(tfowr.l1jetIds(), tfowr.l1jetRefs()), - addObjects(tfowr.l1etmissIds(), tfowr.l1etmissRefs()), - addObjects(tfowr.l1hfringsIds(), tfowr.l1hfringsRefs()), - addObjects(tfowr.pfjetIds(), tfowr.pfjetRefs()), - addObjects(tfowr.pftauIds(), tfowr.pftauRefs()), - addObjects(tfowr.pfmetIds(), tfowr.pfmetRefs()), - addObjects(tfowr.l1tmuonIds(), tfowr.l1tmuonRefs()), - addObjects(tfowr.l1tmuonShowerIds(), tfowr.l1tmuonShowerRefs()), - addObjects(tfowr.l1tegammaIds(), tfowr.l1tegammaRefs()), - addObjects(tfowr.l1tjetIds(), tfowr.l1tjetRefs()), - addObjects(tfowr.l1ttkmuonIds(), tfowr.l1ttkmuonRefs()), - addObjects(tfowr.l1ttkeleIds(), tfowr.l1ttkeleRefs()), - addObjects(tfowr.l1ttkemIds(), tfowr.l1ttkemRefs()), - addObjects(tfowr.l1tpfjetIds(), tfowr.l1tpfjetRefs()), - addObjects(tfowr.l1tpftauIds(), tfowr.l1tpftauRefs()), - addObjects(tfowr.l1thpspftauIds(), tfowr.l1thpspftauRefs()), - addObjects(tfowr.l1tpftrackIds(), tfowr.l1tpftrackRefs()), - addObjects(tfowr.l1tp2etsumIds(), tfowr.l1tp2etsumRefs()), - addObjects(tfowr.l1ttauIds(), tfowr.l1ttauRefs()), - addObjects(tfowr.l1tetsumIds(), tfowr.l1tetsumRefs()), - addObjects(tfowr.l1tp2gtcandIds(), tfowr.l1tp2gtcandRefs())) - - ); - } - - /// getters - for user access - const std::string& usedProcessName() const { return usedProcessName_; } - - /// number of filters - size_type size() const { return filterObjects_.size(); } - - /// tag from index - const edm::InputTag filterTag(size_type filterIndex) const { - return edm::InputTag(filterObjects_.at(filterIndex).filterTag_); - } - - /// index from tag - size_type filterIndex(const edm::InputTag& filterTag) const { - const std::string encodedFilterTag(filterTag.encode()); - const size_type n(filterObjects_.size()); - for (size_type i = 0; i != n; ++i) { - if (encodedFilterTag == filterObjects_[i].filterTag_) { - return i; + /// index from tag + size_type filterIndex(const edm::InputTag& filterTag) const { + const std::string encodedFilterTag(filterTag.encode()); + const size_type n(filterObjects_.size()); + for (size_type i = 0; i != n; ++i) { + if (encodedFilterTag == filterObjects_[i].filterTag_) { + return i; + } } + return n; + } + + /// slices of objects for a specific filter: [begin,end[ + + std::pair photonSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).photons_); + const size_type end(filterObjects_.at(filter).photons_); + return std::pair(begin, end); + } + + std::pair electronSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).electrons_); + const size_type end(filterObjects_.at(filter).electrons_); + return std::pair(begin, end); + } + + std::pair muonSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).muons_); + const size_type end(filterObjects_.at(filter).muons_); + return std::pair(begin, end); + } + + std::pair jetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).jets_); + const size_type end(filterObjects_.at(filter).jets_); + return std::pair(begin, end); + } + + std::pair compositeSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).composites_); + const size_type end(filterObjects_.at(filter).composites_); + return std::pair(begin, end); + } + + std::pair basemetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).basemets_); + const size_type end(filterObjects_.at(filter).basemets_); + return std::pair(begin, end); + } + + std::pair calometSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).calomets_); + const size_type end(filterObjects_.at(filter).calomets_); + return std::pair(begin, end); + } + + std::pair pixtrackSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pixtracks_); + const size_type end(filterObjects_.at(filter).pixtracks_); + return std::pair(begin, end); + } + + std::pair l1emSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1em_); + const size_type end(filterObjects_.at(filter).l1em_); + return std::pair(begin, end); + } + + std::pair l1muonSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1muon_); + const size_type end(filterObjects_.at(filter).l1muon_); + return std::pair(begin, end); + } + + std::pair l1jetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1jet_); + const size_type end(filterObjects_.at(filter).l1jet_); + return std::pair(begin, end); + } + + std::pair l1etmissSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1etmiss_); + const size_type end(filterObjects_.at(filter).l1etmiss_); + return std::pair(begin, end); + } + + std::pair l1hfringsSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1hfrings_); + const size_type end(filterObjects_.at(filter).l1hfrings_); + return std::pair(begin, end); + } + + std::pair pfjetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pfjets_); + const size_type end(filterObjects_.at(filter).pfjets_); + return std::pair(begin, end); + } + + std::pair pftauSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pftaus_); + const size_type end(filterObjects_.at(filter).pftaus_); + return std::pair(begin, end); + } + + std::pair pfmetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pfmets_); + const size_type end(filterObjects_.at(filter).pfmets_); + return std::pair(begin, end); + } + + std::pair l1tmuonSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tmuon_); + const size_type end(filterObjects_.at(filter).l1tmuon_); + return std::pair(begin, end); + } + std::pair l1tmuonShowerSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tmuonShower_); + const size_type end(filterObjects_.at(filter).l1tmuonShower_); + return std::pair(begin, end); + } + std::pair l1tegammaSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tegamma_); + const size_type end(filterObjects_.at(filter).l1tegamma_); + return std::pair(begin, end); + } + std::pair l1tjetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tjet_); + const size_type end(filterObjects_.at(filter).l1tjet_); + return std::pair(begin, end); + } + + /* Phase-2 */ + std::pair l1ttkmuonSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttkmuon_); + const size_type end(filterObjects_.at(filter).l1ttkmuon_); + return std::pair(begin, end); + } + std::pair l1ttkeleSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttkele_); + const size_type end(filterObjects_.at(filter).l1ttkele_); + return std::pair(begin, end); + } + std::pair l1ttkemSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttkem_); + const size_type end(filterObjects_.at(filter).l1ttkem_); + return std::pair(begin, end); + } + std::pair l1tpfjetSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tpfjet_); + const size_type end(filterObjects_.at(filter).l1tpfjet_); + return std::pair(begin, end); + } + std::pair l1tpftauSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tpftau_); + const size_type end(filterObjects_.at(filter).l1tpftau_); + return std::pair(begin, end); + } + std::pair l1thpspftauSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1thpspftau_); + const size_type end(filterObjects_.at(filter).l1thpspftau_); + return std::pair(begin, end); + } + std::pair l1tpftrackSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tpftrack_); + const size_type end(filterObjects_.at(filter).l1tpftrack_); + return std::pair(begin, end); + } + + std::pair l1tp2etsumSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tp2etsum_); + const size_type end(filterObjects_.at(filter).l1tp2etsum_); + return std::pair(begin, end); + } + + std::pair l1ttauSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttau_); + const size_type end(filterObjects_.at(filter).l1ttau_); + return std::pair(begin, end); + } + + std::pair l1tetsumSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tetsum_); + const size_type end(filterObjects_.at(filter).l1tetsum_); + return std::pair(begin, end); + } + + std::pair l1tp2gtcandSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tp2gtcand_); + const size_type end(filterObjects_.at(filter).l1tp2gtcand_); + return std::pair(begin, end); + } + + /// extract Refs for a specific filter and of specific physics type + + void getObjects(size_type filter, Vids& ids, VRphoton& photons) const { + const size_type begin(photonSlice(filter).first); + const size_type end(photonSlice(filter).second); + TriggerRefsCollections::getObjects(ids, photons, begin, end); + } + void getObjects(size_type filter, int id, VRphoton& photons) const { + const size_type begin(photonSlice(filter).first); + const size_type end(photonSlice(filter).second); + TriggerRefsCollections::getObjects(id, photons, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRelectron& electrons) const { + const size_type begin(electronSlice(filter).first); + const size_type end(electronSlice(filter).second); + TriggerRefsCollections::getObjects(ids, electrons, begin, end); + } + void getObjects(size_type filter, int id, VRelectron& electrons) const { + const size_type begin(electronSlice(filter).first); + const size_type end(electronSlice(filter).second); + TriggerRefsCollections::getObjects(id, electrons, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRmuon& muons) const { + const size_type begin(muonSlice(filter).first); + const size_type end(muonSlice(filter).second); + TriggerRefsCollections::getObjects(ids, muons, begin, end); + } + void getObjects(size_type filter, int id, VRmuon& muons) const { + const size_type begin(muonSlice(filter).first); + const size_type end(muonSlice(filter).second); + TriggerRefsCollections::getObjects(id, muons, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRjet& jets) const { + const size_type begin(jetSlice(filter).first); + const size_type end(jetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, jets, begin, end); + } + void getObjects(size_type filter, int id, VRjet& jets) const { + const size_type begin(jetSlice(filter).first); + const size_type end(jetSlice(filter).second); + TriggerRefsCollections::getObjects(id, jets, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const { + const size_type begin(compositeSlice(filter).first); + const size_type end(compositeSlice(filter).second); + TriggerRefsCollections::getObjects(ids, composites, begin, end); + } + void getObjects(size_type filter, int id, VRcomposite& composites) const { + const size_type begin(compositeSlice(filter).first); + const size_type end(compositeSlice(filter).second); + TriggerRefsCollections::getObjects(id, composites, begin, end); } - return n; - } - - /// slices of objects for a specific filter: [begin,end[ - - std::pair photonSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).photons_); - const size_type end(filterObjects_.at(filter).photons_); - return std::pair(begin, end); - } - - std::pair electronSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).electrons_); - const size_type end(filterObjects_.at(filter).electrons_); - return std::pair(begin, end); - } - - std::pair muonSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).muons_); - const size_type end(filterObjects_.at(filter).muons_); - return std::pair(begin, end); - } - - std::pair jetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).jets_); - const size_type end(filterObjects_.at(filter).jets_); - return std::pair(begin, end); - } - - std::pair compositeSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).composites_); - const size_type end(filterObjects_.at(filter).composites_); - return std::pair(begin, end); - } - - std::pair basemetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).basemets_); - const size_type end(filterObjects_.at(filter).basemets_); - return std::pair(begin, end); - } - - std::pair calometSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).calomets_); - const size_type end(filterObjects_.at(filter).calomets_); - return std::pair(begin, end); - } - - std::pair pixtrackSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pixtracks_); - const size_type end(filterObjects_.at(filter).pixtracks_); - return std::pair(begin, end); - } - - std::pair l1emSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1em_); - const size_type end(filterObjects_.at(filter).l1em_); - return std::pair(begin, end); - } - - std::pair l1muonSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1muon_); - const size_type end(filterObjects_.at(filter).l1muon_); - return std::pair(begin, end); - } - - std::pair l1jetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1jet_); - const size_type end(filterObjects_.at(filter).l1jet_); - return std::pair(begin, end); - } - - std::pair l1etmissSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1etmiss_); - const size_type end(filterObjects_.at(filter).l1etmiss_); - return std::pair(begin, end); - } - - std::pair l1hfringsSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1hfrings_); - const size_type end(filterObjects_.at(filter).l1hfrings_); - return std::pair(begin, end); - } - - std::pair pfjetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pfjets_); - const size_type end(filterObjects_.at(filter).pfjets_); - return std::pair(begin, end); - } - - std::pair pftauSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pftaus_); - const size_type end(filterObjects_.at(filter).pftaus_); - return std::pair(begin, end); - } - - std::pair pfmetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).pfmets_); - const size_type end(filterObjects_.at(filter).pfmets_); - return std::pair(begin, end); - } - - std::pair l1tmuonSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tmuon_); - const size_type end(filterObjects_.at(filter).l1tmuon_); - return std::pair(begin, end); - } - std::pair l1tmuonShowerSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tmuonShower_); - const size_type end(filterObjects_.at(filter).l1tmuonShower_); - return std::pair(begin, end); - } - std::pair l1tegammaSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tegamma_); - const size_type end(filterObjects_.at(filter).l1tegamma_); - return std::pair(begin, end); - } - std::pair l1tjetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tjet_); - const size_type end(filterObjects_.at(filter).l1tjet_); - return std::pair(begin, end); - } - - /* Phase-2 */ - std::pair l1ttkmuonSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttkmuon_); - const size_type end(filterObjects_.at(filter).l1ttkmuon_); - return std::pair(begin, end); - } - std::pair l1ttkeleSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttkele_); - const size_type end(filterObjects_.at(filter).l1ttkele_); - return std::pair(begin, end); - } - std::pair l1ttkemSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttkem_); - const size_type end(filterObjects_.at(filter).l1ttkem_); - return std::pair(begin, end); - } - std::pair l1tpfjetSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tpfjet_); - const size_type end(filterObjects_.at(filter).l1tpfjet_); - return std::pair(begin, end); - } - std::pair l1tpftauSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tpftau_); - const size_type end(filterObjects_.at(filter).l1tpftau_); - return std::pair(begin, end); - } - std::pair l1thpspftauSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1thpspftau_); - const size_type end(filterObjects_.at(filter).l1thpspftau_); - return std::pair(begin, end); - } - std::pair l1tpftrackSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tpftrack_); - const size_type end(filterObjects_.at(filter).l1tpftrack_); - return std::pair(begin, end); - } - - std::pair l1tp2etsumSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tp2etsum_); - const size_type end(filterObjects_.at(filter).l1tp2etsum_); - return std::pair(begin, end); - } - - std::pair l1ttauSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttau_); - const size_type end(filterObjects_.at(filter).l1ttau_); - return std::pair(begin, end); - } - - std::pair l1tetsumSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tetsum_); - const size_type end(filterObjects_.at(filter).l1tetsum_); - return std::pair(begin, end); - } - - std::pair l1tp2gtcandSlice(size_type filter) const { - const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tp2gtcand_); - const size_type end(filterObjects_.at(filter).l1tp2gtcand_); - return std::pair(begin, end); - } - - /// extract Refs for a specific filter and of specific physics type - - void getObjects(size_type filter, Vids& ids, VRphoton& photons) const { - const size_type begin(photonSlice(filter).first); - const size_type end(photonSlice(filter).second); - TriggerRefsCollections::getObjects(ids, photons, begin, end); - } - void getObjects(size_type filter, int id, VRphoton& photons) const { - const size_type begin(photonSlice(filter).first); - const size_type end(photonSlice(filter).second); - TriggerRefsCollections::getObjects(id, photons, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRelectron& electrons) const { - const size_type begin(electronSlice(filter).first); - const size_type end(electronSlice(filter).second); - TriggerRefsCollections::getObjects(ids, electrons, begin, end); - } - void getObjects(size_type filter, int id, VRelectron& electrons) const { - const size_type begin(electronSlice(filter).first); - const size_type end(electronSlice(filter).second); - TriggerRefsCollections::getObjects(id, electrons, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRmuon& muons) const { - const size_type begin(muonSlice(filter).first); - const size_type end(muonSlice(filter).second); - TriggerRefsCollections::getObjects(ids, muons, begin, end); - } - void getObjects(size_type filter, int id, VRmuon& muons) const { - const size_type begin(muonSlice(filter).first); - const size_type end(muonSlice(filter).second); - TriggerRefsCollections::getObjects(id, muons, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRjet& jets) const { - const size_type begin(jetSlice(filter).first); - const size_type end(jetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, jets, begin, end); - } - void getObjects(size_type filter, int id, VRjet& jets) const { - const size_type begin(jetSlice(filter).first); - const size_type end(jetSlice(filter).second); - TriggerRefsCollections::getObjects(id, jets, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRcomposite& composites) const { - const size_type begin(compositeSlice(filter).first); - const size_type end(compositeSlice(filter).second); - TriggerRefsCollections::getObjects(ids, composites, begin, end); - } - void getObjects(size_type filter, int id, VRcomposite& composites) const { - const size_type begin(compositeSlice(filter).first); - const size_type end(compositeSlice(filter).second); - TriggerRefsCollections::getObjects(id, composites, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const { - const size_type begin(basemetSlice(filter).first); - const size_type end(basemetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, basemets, begin, end); - } - void getObjects(size_type filter, int id, VRbasemet& basemets) const { - const size_type begin(basemetSlice(filter).first); - const size_type end(basemetSlice(filter).second); - TriggerRefsCollections::getObjects(id, basemets, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const { - const size_type begin(calometSlice(filter).first); - const size_type end(calometSlice(filter).second); - TriggerRefsCollections::getObjects(ids, calomets, begin, end); - } - void getObjects(size_type filter, int id, VRcalomet& calomets) const { - const size_type begin(calometSlice(filter).first); - const size_type end(calometSlice(filter).second); - TriggerRefsCollections::getObjects(id, calomets, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const { - const size_type begin(pixtrackSlice(filter).first); - const size_type end(pixtrackSlice(filter).second); - TriggerRefsCollections::getObjects(ids, pixtracks, begin, end); - } - void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const { - const size_type begin(pixtrackSlice(filter).first); - const size_type end(pixtrackSlice(filter).second); - TriggerRefsCollections::getObjects(id, pixtracks, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const { - const size_type begin(l1emSlice(filter).first); - const size_type end(l1emSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1em, begin, end); - } - void getObjects(size_type filter, int id, VRl1em& l1em) const { - const size_type begin(l1emSlice(filter).first); - const size_type end(l1emSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1em, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const { - const size_type begin(l1muonSlice(filter).first); - const size_type end(l1muonSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1muon, begin, end); - } - void getObjects(size_type filter, int id, VRl1muon& l1muon) const { - const size_type begin(l1muonSlice(filter).first); - const size_type end(l1muonSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1muon, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const { - const size_type begin(l1jetSlice(filter).first); - const size_type end(l1jetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1jet, begin, end); - } - void getObjects(size_type filter, int id, VRl1jet& l1jet) const { - const size_type begin(l1jetSlice(filter).first); - const size_type end(l1jetSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1jet, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const { - const size_type begin(l1etmissSlice(filter).first); - const size_type end(l1etmissSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1etmiss, begin, end); - } - void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const { - const size_type begin(l1etmissSlice(filter).first); - const size_type end(l1etmissSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1etmiss, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const { - const size_type begin(l1hfringsSlice(filter).first); - const size_type end(l1hfringsSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1hfrings, begin, end); - } - void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const { - const size_type begin(l1hfringsSlice(filter).first); - const size_type end(l1hfringsSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1hfrings, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRpfjet& pfjets) const { - const size_type begin(pfjetSlice(filter).first); - const size_type end(pfjetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, pfjets, begin, end); - } - void getObjects(size_type filter, int id, VRpfjet& pfjets) const { - const size_type begin(pfjetSlice(filter).first); - const size_type end(pfjetSlice(filter).second); - TriggerRefsCollections::getObjects(id, pfjets, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRpftau& pftaus) const { - const size_type begin(pftauSlice(filter).first); - const size_type end(pftauSlice(filter).second); - TriggerRefsCollections::getObjects(ids, pftaus, begin, end); - } - void getObjects(size_type filter, int id, VRpftau& pftaus) const { - const size_type begin(pftauSlice(filter).first); - const size_type end(pftauSlice(filter).second); - TriggerRefsCollections::getObjects(id, pftaus, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRpfmet& pfmets) const { - const size_type begin(pfmetSlice(filter).first); - const size_type end(pfmetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, pfmets, begin, end); - } - void getObjects(size_type filter, int id, VRpfmet& pfmets) const { - const size_type begin(pfmetSlice(filter).first); - const size_type end(pfmetSlice(filter).second); - TriggerRefsCollections::getObjects(id, pfmets, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tmuon& l1tmuon) const { - const size_type begin(l1tmuonSlice(filter).first); - const size_type end(l1tmuonSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tmuon, begin, end); - } - void getObjects(size_type filter, int id, VRl1tmuon& l1tmuon) const { - const size_type begin(l1tmuonSlice(filter).first); - const size_type end(l1tmuonSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tmuon, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tmuonShower& l1tmuonShower) const { - const size_type begin(l1tmuonShowerSlice(filter).first); - const size_type end(l1tmuonShowerSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tmuonShower, begin, end); - } - void getObjects(size_type filter, int id, VRl1tmuonShower& l1tmuonShower) const { - const size_type begin(l1tmuonShowerSlice(filter).first); - const size_type end(l1tmuonShowerSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tmuonShower, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tegamma& l1tegamma) const { - const size_type begin(l1tegammaSlice(filter).first); - const size_type end(l1tegammaSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tegamma, begin, end); - } - void getObjects(size_type filter, int id, VRl1tegamma& l1tegamma) const { - const size_type begin(l1tegammaSlice(filter).first); - const size_type end(l1tegammaSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tegamma, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tjet& l1tjet) const { - const size_type begin(l1tjetSlice(filter).first); - const size_type end(l1tjetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tjet, begin, end); - } - void getObjects(size_type filter, int id, VRl1tjet& l1tjet) const { - const size_type begin(l1tjetSlice(filter).first); - const size_type end(l1tjetSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tjet, begin, end); - } - - /* Phase-2 */ - void getObjects(size_type filter, Vids& ids, VRl1ttkmuon& l1ttkmuon) const { - const size_type begin(l1ttkmuonSlice(filter).first); - const size_type end(l1ttkmuonSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1ttkmuon, begin, end); - } - void getObjects(size_type filter, int id, VRl1ttkmuon& l1ttkmuon) const { - const size_type begin(l1ttkmuonSlice(filter).first); - const size_type end(l1ttkmuonSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1ttkmuon, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1ttkele& l1ttkele) const { - const size_type begin(l1ttkeleSlice(filter).first); - const size_type end(l1ttkeleSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1ttkele, begin, end); - } - void getObjects(size_type filter, int id, VRl1ttkele& l1ttkele) const { - const size_type begin(l1ttkeleSlice(filter).first); - const size_type end(l1ttkeleSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1ttkele, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1ttkem& l1ttkem) const { - const size_type begin(l1ttkemSlice(filter).first); - const size_type end(l1ttkemSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1ttkem, begin, end); - } - void getObjects(size_type filter, int id, VRl1ttkem& l1ttkem) const { - const size_type begin(l1ttkemSlice(filter).first); - const size_type end(l1ttkemSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1ttkem, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tpfjet& l1tpfjet) const { - const size_type begin(l1tpfjetSlice(filter).first); - const size_type end(l1tpfjetSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tpfjet, begin, end); - } - void getObjects(size_type filter, int id, VRl1tpfjet& l1tpfjet) const { - const size_type begin(l1tpfjetSlice(filter).first); - const size_type end(l1tpfjetSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tpfjet, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tpftau& l1tpftau) const { - const size_type begin(l1tpftauSlice(filter).first); - const size_type end(l1tpftauSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tpftau, begin, end); - } - void getObjects(size_type filter, int id, VRl1tpftau& l1tpftau) const { - const size_type begin(l1tpftauSlice(filter).first); - const size_type end(l1tpftauSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tpftau, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1thpspftau& l1thpspftau) const { - const size_type begin(l1thpspftauSlice(filter).first); - const size_type end(l1thpspftauSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1thpspftau, begin, end); - } - void getObjects(size_type filter, int id, VRl1thpspftau& l1thpspftau) const { - const size_type begin(l1thpspftauSlice(filter).first); - const size_type end(l1thpspftauSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1thpspftau, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tpftrack& l1tpftrack) const { - const size_type begin(l1tpftrackSlice(filter).first); - const size_type end(l1tpftrackSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tpftrack, begin, end); - } - void getObjects(size_type filter, int id, VRl1tpftrack& l1tpftrack) const { - const size_type begin(l1tpftrackSlice(filter).first); - const size_type end(l1tpftrackSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tpftrack, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tp2etsum& l1tp2etsum) const { - const size_type begin(l1tp2etsumSlice(filter).first); - const size_type end(l1tp2etsumSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tp2etsum, begin, end); - } - void getObjects(size_type filter, int id, VRl1tp2etsum& l1tp2etsum) const { - const size_type begin(l1tp2etsumSlice(filter).first); - const size_type end(l1tp2etsumSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tp2etsum, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1ttau& l1ttau) const { - const size_type begin(l1ttauSlice(filter).first); - const size_type end(l1ttauSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1ttau, begin, end); - } - void getObjects(size_type filter, int id, VRl1ttau& l1ttau) const { - const size_type begin(l1ttauSlice(filter).first); - const size_type end(l1ttauSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1ttau, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tetsum& l1tetsum) const { - const size_type begin(l1tetsumSlice(filter).first); - const size_type end(l1tetsumSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tetsum, begin, end); - } - void getObjects(size_type filter, int id, VRl1tetsum& l1tetsum) const { - const size_type begin(l1tetsumSlice(filter).first); - const size_type end(l1tetsumSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tetsum, begin, end); - } - - void getObjects(size_type filter, Vids& ids, VRl1tp2gtcand& l1tp2gtcand) const { - const size_type begin(l1tp2gtcandSlice(filter).first); - const size_type end(l1tp2gtcandSlice(filter).second); - TriggerRefsCollections::getObjects(ids, l1tp2gtcand, begin, end); - } - void getObjects(size_type filter, int id, VRl1tp2gtcand& l1tp2gtcand) const { - const size_type begin(l1tp2gtcandSlice(filter).first); - const size_type end(l1tp2gtcandSlice(filter).second); - TriggerRefsCollections::getObjects(id, l1tp2gtcand, begin, end); - } - }; + void getObjects(size_type filter, Vids& ids, VRbasemet& basemets) const { + const size_type begin(basemetSlice(filter).first); + const size_type end(basemetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, basemets, begin, end); + } + void getObjects(size_type filter, int id, VRbasemet& basemets) const { + const size_type begin(basemetSlice(filter).first); + const size_type end(basemetSlice(filter).second); + TriggerRefsCollections::getObjects(id, basemets, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRcalomet& calomets) const { + const size_type begin(calometSlice(filter).first); + const size_type end(calometSlice(filter).second); + TriggerRefsCollections::getObjects(ids, calomets, begin, end); + } + void getObjects(size_type filter, int id, VRcalomet& calomets) const { + const size_type begin(calometSlice(filter).first); + const size_type end(calometSlice(filter).second); + TriggerRefsCollections::getObjects(id, calomets, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRpixtrack& pixtracks) const { + const size_type begin(pixtrackSlice(filter).first); + const size_type end(pixtrackSlice(filter).second); + TriggerRefsCollections::getObjects(ids, pixtracks, begin, end); + } + void getObjects(size_type filter, int id, VRpixtrack& pixtracks) const { + const size_type begin(pixtrackSlice(filter).first); + const size_type end(pixtrackSlice(filter).second); + TriggerRefsCollections::getObjects(id, pixtracks, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1em& l1em) const { + const size_type begin(l1emSlice(filter).first); + const size_type end(l1emSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1em, begin, end); + } + void getObjects(size_type filter, int id, VRl1em& l1em) const { + const size_type begin(l1emSlice(filter).first); + const size_type end(l1emSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1em, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1muon& l1muon) const { + const size_type begin(l1muonSlice(filter).first); + const size_type end(l1muonSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1muon, begin, end); + } + void getObjects(size_type filter, int id, VRl1muon& l1muon) const { + const size_type begin(l1muonSlice(filter).first); + const size_type end(l1muonSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1muon, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1jet& l1jet) const { + const size_type begin(l1jetSlice(filter).first); + const size_type end(l1jetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1jet, begin, end); + } + void getObjects(size_type filter, int id, VRl1jet& l1jet) const { + const size_type begin(l1jetSlice(filter).first); + const size_type end(l1jetSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1jet, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1etmiss& l1etmiss) const { + const size_type begin(l1etmissSlice(filter).first); + const size_type end(l1etmissSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1etmiss, begin, end); + } + void getObjects(size_type filter, int id, VRl1etmiss& l1etmiss) const { + const size_type begin(l1etmissSlice(filter).first); + const size_type end(l1etmissSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1etmiss, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1hfrings& l1hfrings) const { + const size_type begin(l1hfringsSlice(filter).first); + const size_type end(l1hfringsSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1hfrings, begin, end); + } + void getObjects(size_type filter, int id, VRl1hfrings& l1hfrings) const { + const size_type begin(l1hfringsSlice(filter).first); + const size_type end(l1hfringsSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1hfrings, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRpfjet& pfjets) const { + const size_type begin(pfjetSlice(filter).first); + const size_type end(pfjetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, pfjets, begin, end); + } + void getObjects(size_type filter, int id, VRpfjet& pfjets) const { + const size_type begin(pfjetSlice(filter).first); + const size_type end(pfjetSlice(filter).second); + TriggerRefsCollections::getObjects(id, pfjets, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRpftau& pftaus) const { + const size_type begin(pftauSlice(filter).first); + const size_type end(pftauSlice(filter).second); + TriggerRefsCollections::getObjects(ids, pftaus, begin, end); + } + void getObjects(size_type filter, int id, VRpftau& pftaus) const { + const size_type begin(pftauSlice(filter).first); + const size_type end(pftauSlice(filter).second); + TriggerRefsCollections::getObjects(id, pftaus, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRpfmet& pfmets) const { + const size_type begin(pfmetSlice(filter).first); + const size_type end(pfmetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, pfmets, begin, end); + } + void getObjects(size_type filter, int id, VRpfmet& pfmets) const { + const size_type begin(pfmetSlice(filter).first); + const size_type end(pfmetSlice(filter).second); + TriggerRefsCollections::getObjects(id, pfmets, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tmuon& l1tmuon) const { + const size_type begin(l1tmuonSlice(filter).first); + const size_type end(l1tmuonSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tmuon, begin, end); + } + void getObjects(size_type filter, int id, VRl1tmuon& l1tmuon) const { + const size_type begin(l1tmuonSlice(filter).first); + const size_type end(l1tmuonSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tmuon, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tmuonShower& l1tmuonShower) const { + const size_type begin(l1tmuonShowerSlice(filter).first); + const size_type end(l1tmuonShowerSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tmuonShower, begin, end); + } + void getObjects(size_type filter, int id, VRl1tmuonShower& l1tmuonShower) const { + const size_type begin(l1tmuonShowerSlice(filter).first); + const size_type end(l1tmuonShowerSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tmuonShower, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tegamma& l1tegamma) const { + const size_type begin(l1tegammaSlice(filter).first); + const size_type end(l1tegammaSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tegamma, begin, end); + } + void getObjects(size_type filter, int id, VRl1tegamma& l1tegamma) const { + const size_type begin(l1tegammaSlice(filter).first); + const size_type end(l1tegammaSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tegamma, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tjet& l1tjet) const { + const size_type begin(l1tjetSlice(filter).first); + const size_type end(l1tjetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tjet, begin, end); + } + void getObjects(size_type filter, int id, VRl1tjet& l1tjet) const { + const size_type begin(l1tjetSlice(filter).first); + const size_type end(l1tjetSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tjet, begin, end); + } + + /* Phase-2 */ + void getObjects(size_type filter, Vids& ids, VRl1ttkmuon& l1ttkmuon) const { + const size_type begin(l1ttkmuonSlice(filter).first); + const size_type end(l1ttkmuonSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1ttkmuon, begin, end); + } + void getObjects(size_type filter, int id, VRl1ttkmuon& l1ttkmuon) const { + const size_type begin(l1ttkmuonSlice(filter).first); + const size_type end(l1ttkmuonSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1ttkmuon, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1ttkele& l1ttkele) const { + const size_type begin(l1ttkeleSlice(filter).first); + const size_type end(l1ttkeleSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1ttkele, begin, end); + } + void getObjects(size_type filter, int id, VRl1ttkele& l1ttkele) const { + const size_type begin(l1ttkeleSlice(filter).first); + const size_type end(l1ttkeleSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1ttkele, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1ttkem& l1ttkem) const { + const size_type begin(l1ttkemSlice(filter).first); + const size_type end(l1ttkemSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1ttkem, begin, end); + } + void getObjects(size_type filter, int id, VRl1ttkem& l1ttkem) const { + const size_type begin(l1ttkemSlice(filter).first); + const size_type end(l1ttkemSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1ttkem, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tpfjet& l1tpfjet) const { + const size_type begin(l1tpfjetSlice(filter).first); + const size_type end(l1tpfjetSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tpfjet, begin, end); + } + void getObjects(size_type filter, int id, VRl1tpfjet& l1tpfjet) const { + const size_type begin(l1tpfjetSlice(filter).first); + const size_type end(l1tpfjetSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tpfjet, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tpftau& l1tpftau) const { + const size_type begin(l1tpftauSlice(filter).first); + const size_type end(l1tpftauSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tpftau, begin, end); + } + void getObjects(size_type filter, int id, VRl1tpftau& l1tpftau) const { + const size_type begin(l1tpftauSlice(filter).first); + const size_type end(l1tpftauSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tpftau, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1thpspftau& l1thpspftau) const { + const size_type begin(l1thpspftauSlice(filter).first); + const size_type end(l1thpspftauSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1thpspftau, begin, end); + } + void getObjects(size_type filter, int id, VRl1thpspftau& l1thpspftau) const { + const size_type begin(l1thpspftauSlice(filter).first); + const size_type end(l1thpspftauSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1thpspftau, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tpftrack& l1tpftrack) const { + const size_type begin(l1tpftrackSlice(filter).first); + const size_type end(l1tpftrackSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tpftrack, begin, end); + } + void getObjects(size_type filter, int id, VRl1tpftrack& l1tpftrack) const { + const size_type begin(l1tpftrackSlice(filter).first); + const size_type end(l1tpftrackSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tpftrack, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tp2etsum& l1tp2etsum) const { + const size_type begin(l1tp2etsumSlice(filter).first); + const size_type end(l1tp2etsumSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tp2etsum, begin, end); + } + void getObjects(size_type filter, int id, VRl1tp2etsum& l1tp2etsum) const { + const size_type begin(l1tp2etsumSlice(filter).first); + const size_type end(l1tp2etsumSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tp2etsum, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1ttau& l1ttau) const { + const size_type begin(l1ttauSlice(filter).first); + const size_type end(l1ttauSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1ttau, begin, end); + } + void getObjects(size_type filter, int id, VRl1ttau& l1ttau) const { + const size_type begin(l1ttauSlice(filter).first); + const size_type end(l1ttauSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1ttau, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tetsum& l1tetsum) const { + const size_type begin(l1tetsumSlice(filter).first); + const size_type end(l1tetsumSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tetsum, begin, end); + } + void getObjects(size_type filter, int id, VRl1tetsum& l1tetsum) const { + const size_type begin(l1tetsumSlice(filter).first); + const size_type end(l1tetsumSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tetsum, begin, end); + } + + void getObjects(size_type filter, Vids& ids, VRl1tp2gtcand& l1tp2gtcand) const { + const size_type begin(l1tp2gtcandSlice(filter).first); + const size_type end(l1tp2gtcandSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tp2gtcand, begin, end); + } + void getObjects(size_type filter, int id, VRl1tp2gtcand& l1tp2gtcand) const { + const size_type begin(l1tp2gtcandSlice(filter).first); + const size_type end(l1tp2gtcandSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tp2gtcand, begin, end); + } + }; + + } // namespace io_v1 + using TriggerEventWithRefs = io_v1::TriggerEventWithRefs; } // namespace trigger #endif diff --git a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h index 559ca9d08b364..4c73ff74f14cb 100644 --- a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h +++ b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h @@ -27,55 +27,59 @@ namespace trigger { - /// Transient book-keeping EDProduct filled by HLTFilter module to - /// record physics objects firing the filter (never persistet in - /// production; same functionality but different implementation - /// compared to the old HLT data model's HLTFilterObjectWithRefs - /// class) - class TriggerFilterObjectWithRefs : public TriggerRefsCollections { - /// data members - private: - int path_; - int module_; - std::vector collectionTags_; - - /// methods - public: - /// constructors - TriggerFilterObjectWithRefs() : TriggerRefsCollections(), path_(-9), module_(-9), collectionTags_() {} - - TriggerFilterObjectWithRefs(int path, int module) - : TriggerRefsCollections(), path_(path), module_(module), collectionTags_() {} - - /// accessors - int path() const { return path_; } - int module() const { return module_; } - - /// collectionTags - void addCollectionTag(const edm::InputTag& collectionTag) { collectionTags_.push_back(collectionTag.encode()); } - - void getCollectionTags(std::vector& collectionTags) const { - const trigger::size_type n(collectionTags_.size()); - collectionTags.resize(n); - for (trigger::size_type i = 0; i != n; ++i) { - collectionTags[i] = edm::InputTag(collectionTags_[i]); + namespace io_v1 { + /// Transient book-keeping EDProduct filled by HLTFilter module to + /// record physics objects firing the filter (never persistet in + /// production; same functionality but different implementation + /// compared to the old HLT data model's HLTFilterObjectWithRefs + /// class) + class TriggerFilterObjectWithRefs : public TriggerRefsCollections { + /// data members + private: + int path_; + int module_; + std::vector collectionTags_; + + /// methods + public: + /// constructors + TriggerFilterObjectWithRefs() : TriggerRefsCollections(), path_(-9), module_(-9), collectionTags_() {} + + TriggerFilterObjectWithRefs(int path, int module) + : TriggerRefsCollections(), path_(path), module_(module), collectionTags_() {} + + /// accessors + int path() const { return path_; } + int module() const { return module_; } + + /// collectionTags + void addCollectionTag(const edm::InputTag& collectionTag) { collectionTags_.push_back(collectionTag.encode()); } + + void getCollectionTags(std::vector& collectionTags) const { + const trigger::size_type n(collectionTags_.size()); + collectionTags.resize(n); + for (trigger::size_type i = 0; i != n; ++i) { + collectionTags[i] = edm::InputTag(collectionTags_[i]); + } } - } - - /// low-level technical accessor - const std::vector& getCollectionTagsAsStrings() const { return collectionTags_; } - - /// utility - void swap(TriggerFilterObjectWithRefs& other) { - TriggerRefsCollections::swap(other); // swap base instance - std::swap(path_, other.path_); - std::swap(module_, other.module_); - std::swap(collectionTags_, other.collectionTags_); // use specialized version for STL containers - } - }; - - // picked up via argument dependent lookup, e-g- by boost::swap() - inline void swap(TriggerFilterObjectWithRefs& first, TriggerFilterObjectWithRefs& second) { first.swap(second); } + + /// low-level technical accessor + const std::vector& getCollectionTagsAsStrings() const { return collectionTags_; } + + /// utility + void swap(TriggerFilterObjectWithRefs& other) { + TriggerRefsCollections::swap(other); // swap base instance + std::swap(path_, other.path_); + std::swap(module_, other.module_); + std::swap(collectionTags_, other.collectionTags_); // use specialized version for STL containers + } + }; + + // picked up via argument dependent lookup, e-g- by boost::swap() + inline void swap(TriggerFilterObjectWithRefs& first, TriggerFilterObjectWithRefs& second) { first.swap(second); } + } // namespace io_v1 + + using TriggerFilterObjectWithRefs = io_v1::TriggerFilterObjectWithRefs; } // namespace trigger diff --git a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h index 5029b91eb2ece..b0759b6be1ceb 100644 --- a/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h +++ b/DataFormats/HLTReco/interface/TriggerFilterObjectWithRefsFwd.h @@ -2,7 +2,11 @@ #define HLTReco_TriggerFilterObjectWithRefsFwd_h namespace trigger { - class TriggerFilterObjectWithRefs; -} + namespace io_v1 { + class TriggerFilterObjectWithRefs; + } + using TriggerFilterObjectWithRefs = io_v1::TriggerFilterObjectWithRefs; + +} // namespace trigger #endif diff --git a/DataFormats/HLTReco/interface/TriggerRefsCollections.h b/DataFormats/HLTReco/interface/TriggerRefsCollections.h index 0fced2acffa85..1831b87057a55 100644 --- a/DataFormats/HLTReco/interface/TriggerRefsCollections.h +++ b/DataFormats/HLTReco/interface/TriggerRefsCollections.h @@ -106,1762 +106,1766 @@ namespace trigger { typedef l1t::P2GTCandidateVectorRef VRl1tp2gtcand; - class TriggerRefsCollections { - /// data members - private: - /// physics type ids and Refs - Vids photonIds_; - VRphoton photonRefs_; - Vids electronIds_; - VRelectron electronRefs_; - Vids muonIds_; - VRmuon muonRefs_; - Vids jetIds_; - VRjet jetRefs_; - Vids compositeIds_; - VRcomposite compositeRefs_; - Vids basemetIds_; - VRbasemet basemetRefs_; - Vids calometIds_; - VRcalomet calometRefs_; - Vids pixtrackIds_; - VRpixtrack pixtrackRefs_; - - Vids l1emIds_; - VRl1em l1emRefs_; - Vids l1muonIds_; - VRl1muon l1muonRefs_; - Vids l1jetIds_; - VRl1jet l1jetRefs_; - Vids l1etmissIds_; - VRl1etmiss l1etmissRefs_; - Vids l1hfringsIds_; - VRl1hfrings l1hfringsRefs_; - - Vids l1tmuonIds_; - VRl1tmuon l1tmuonRefs_; - Vids l1tmuonShowerIds_; - VRl1tmuonShower l1tmuonShowerRefs_; - Vids l1tegammaIds_; - VRl1tegamma l1tegammaRefs_; - Vids l1tjetIds_; - VRl1tjet l1tjetRefs_; - Vids l1ttauIds_; - VRl1ttau l1ttauRefs_; - Vids l1tetsumIds_; - VRl1tetsum l1tetsumRefs_; - - /* Phase-2 */ - Vids l1ttkmuonIds_; - VRl1ttkmuon l1ttkmuonRefs_; - Vids l1ttkeleIds_; - VRl1ttkele l1ttkeleRefs_; - Vids l1ttkemIds_; - VRl1ttkem l1ttkemRefs_; - Vids l1tpfjetIds_; - VRl1tpfjet l1tpfjetRefs_; - Vids l1tpftauIds_; - VRl1tpftau l1tpftauRefs_; - Vids l1thpspftauIds_; - VRl1thpspftau l1thpspftauRefs_; - Vids l1tpftrackIds_; - VRl1tpftrack l1tpftrackRefs_; - Vids l1tp2etsumIds_; - VRl1tp2etsum l1tp2etsumRefs_; - - Vids pfjetIds_; - VRpfjet pfjetRefs_; - Vids pftauIds_; - VRpftau pftauRefs_; - Vids pfmetIds_; - VRpfmet pfmetRefs_; - - Vids l1tp2gtcandIds_; - VRl1tp2gtcand l1tp2gtcandRefs_; - - /// methods - public: - /// constructors - TriggerRefsCollections() - : photonIds_(), - photonRefs_(), - electronIds_(), - electronRefs_(), - muonIds_(), - muonRefs_(), - jetIds_(), - jetRefs_(), - compositeIds_(), - compositeRefs_(), - basemetIds_(), - basemetRefs_(), - calometIds_(), - calometRefs_(), - pixtrackIds_(), - pixtrackRefs_(), - - l1emIds_(), - l1emRefs_(), - l1muonIds_(), - l1muonRefs_(), - l1jetIds_(), - l1jetRefs_(), - l1etmissIds_(), - l1etmissRefs_(), - l1hfringsIds_(), - l1hfringsRefs_(), - - l1tmuonIds_(), - l1tmuonRefs_(), - l1tmuonShowerIds_(), - l1tmuonShowerRefs_(), - l1tegammaIds_(), - l1tegammaRefs_(), - l1tjetIds_(), - l1tjetRefs_(), - l1ttauIds_(), - l1ttauRefs_(), - l1tetsumIds_(), - l1tetsumRefs_(), - - /* Phase-2 */ - l1ttkmuonIds_(), - l1ttkmuonRefs_(), - l1ttkeleIds_(), - l1ttkeleRefs_(), - l1ttkemIds_(), - l1ttkemRefs_(), - l1tpfjetIds_(), - l1tpfjetRefs_(), - l1tpftauIds_(), - l1tpftauRefs_(), - l1thpspftauIds_(), - l1thpspftauRefs_(), - l1tpftrackIds_(), - l1tpftrackRefs_(), - l1tp2etsumIds_(), - l1tp2etsumRefs_(), - - pfjetIds_(), - pfjetRefs_(), - pftauIds_(), - pftauRefs_(), - pfmetIds_(), - pfmetRefs_(), - - l1tp2gtcandIds_(), - l1tp2gtcandRefs_() {} - - /// utility - void swap(TriggerRefsCollections& other) { - std::swap(photonIds_, other.photonIds_); - std::swap(photonRefs_, other.photonRefs_); - std::swap(electronIds_, other.electronIds_); - std::swap(electronRefs_, other.electronRefs_); - std::swap(muonIds_, other.muonIds_); - std::swap(muonRefs_, other.muonRefs_); - std::swap(jetIds_, other.jetIds_); - std::swap(jetRefs_, other.jetRefs_); - std::swap(compositeIds_, other.compositeIds_); - std::swap(compositeRefs_, other.compositeRefs_); - std::swap(basemetIds_, other.basemetIds_); - std::swap(basemetRefs_, other.basemetRefs_); - std::swap(calometIds_, other.calometIds_); - std::swap(calometRefs_, other.calometRefs_); - std::swap(pixtrackIds_, other.pixtrackIds_); - std::swap(pixtrackRefs_, other.pixtrackRefs_); - - std::swap(l1emIds_, other.l1emIds_); - std::swap(l1emRefs_, other.l1emRefs_); - std::swap(l1muonIds_, other.l1muonIds_); - std::swap(l1muonRefs_, other.l1muonRefs_); - std::swap(l1jetIds_, other.l1jetIds_); - std::swap(l1jetRefs_, other.l1jetRefs_); - std::swap(l1etmissIds_, other.l1etmissIds_); - std::swap(l1etmissRefs_, other.l1etmissRefs_); - std::swap(l1hfringsIds_, other.l1hfringsIds_); - std::swap(l1hfringsRefs_, other.l1hfringsRefs_); - - std::swap(l1tmuonIds_, other.l1tmuonIds_); - std::swap(l1tmuonRefs_, other.l1tmuonRefs_); - std::swap(l1tmuonShowerIds_, other.l1tmuonShowerIds_); - std::swap(l1tmuonShowerRefs_, other.l1tmuonShowerRefs_); - std::swap(l1tegammaIds_, other.l1tegammaIds_); - std::swap(l1tegammaRefs_, other.l1tegammaRefs_); - std::swap(l1tjetIds_, other.l1tjetIds_); - std::swap(l1tjetRefs_, other.l1tjetRefs_); - std::swap(l1ttauIds_, other.l1ttauIds_); - std::swap(l1ttauRefs_, other.l1ttauRefs_); - std::swap(l1tetsumIds_, other.l1tetsumIds_); - std::swap(l1tetsumRefs_, other.l1tetsumRefs_); + namespace io_v1 { + class TriggerRefsCollections { + /// data members + private: + /// physics type ids and Refs + Vids photonIds_; + VRphoton photonRefs_; + Vids electronIds_; + VRelectron electronRefs_; + Vids muonIds_; + VRmuon muonRefs_; + Vids jetIds_; + VRjet jetRefs_; + Vids compositeIds_; + VRcomposite compositeRefs_; + Vids basemetIds_; + VRbasemet basemetRefs_; + Vids calometIds_; + VRcalomet calometRefs_; + Vids pixtrackIds_; + VRpixtrack pixtrackRefs_; + + Vids l1emIds_; + VRl1em l1emRefs_; + Vids l1muonIds_; + VRl1muon l1muonRefs_; + Vids l1jetIds_; + VRl1jet l1jetRefs_; + Vids l1etmissIds_; + VRl1etmiss l1etmissRefs_; + Vids l1hfringsIds_; + VRl1hfrings l1hfringsRefs_; + + Vids l1tmuonIds_; + VRl1tmuon l1tmuonRefs_; + Vids l1tmuonShowerIds_; + VRl1tmuonShower l1tmuonShowerRefs_; + Vids l1tegammaIds_; + VRl1tegamma l1tegammaRefs_; + Vids l1tjetIds_; + VRl1tjet l1tjetRefs_; + Vids l1ttauIds_; + VRl1ttau l1ttauRefs_; + Vids l1tetsumIds_; + VRl1tetsum l1tetsumRefs_; /* Phase-2 */ - std::swap(l1ttkmuonIds_, other.l1ttkmuonIds_); - std::swap(l1ttkmuonRefs_, other.l1ttkmuonRefs_); - std::swap(l1ttkeleIds_, other.l1ttkeleIds_); - std::swap(l1ttkeleRefs_, other.l1ttkeleRefs_); - std::swap(l1ttkemIds_, other.l1ttkemIds_); - std::swap(l1ttkemRefs_, other.l1ttkemRefs_); - std::swap(l1tpfjetIds_, other.l1tpfjetIds_); - std::swap(l1tpfjetRefs_, other.l1tpfjetRefs_); - std::swap(l1tpftauIds_, other.l1tpftauIds_); - std::swap(l1tpftauRefs_, other.l1tpftauRefs_); - std::swap(l1thpspftauIds_, other.l1thpspftauIds_); - std::swap(l1thpspftauRefs_, other.l1thpspftauRefs_); - std::swap(l1tpftrackIds_, other.l1tpftrackIds_); - std::swap(l1tpftrackRefs_, other.l1tpftrackRefs_); - std::swap(l1tp2etsumIds_, other.l1tp2etsumIds_); - std::swap(l1tp2etsumRefs_, other.l1tp2etsumRefs_); - - std::swap(pfjetIds_, other.pfjetIds_); - std::swap(pfjetRefs_, other.pfjetRefs_); - std::swap(pftauIds_, other.pftauIds_); - std::swap(pftauRefs_, other.pftauRefs_); - std::swap(pfmetIds_, other.pfmetIds_); - std::swap(pfmetRefs_, other.pfmetRefs_); - - std::swap(l1tp2gtcandIds_, other.l1tp2gtcandIds_); - std::swap(l1tp2gtcandRefs_, other.l1tp2gtcandRefs_); - } - - /// setters for L3 collections: (id=physics type, and Ref) - void addObject(int id, const reco::RecoEcalCandidateRef& ref) { - photonIds_.push_back(id); - photonRefs_.push_back(ref); - } - void addObject(int id, const reco::ElectronRef& ref) { - electronIds_.push_back(id); - electronRefs_.push_back(ref); - } - void addObject(int id, const reco::RecoChargedCandidateRef& ref) { - muonIds_.push_back(id); - muonRefs_.push_back(ref); - } - void addObject(int id, const reco::CaloJetRef& ref) { - jetIds_.push_back(id); - jetRefs_.push_back(ref); - } - void addObject(int id, const reco::CompositeCandidateRef& ref) { - compositeIds_.push_back(id); - compositeRefs_.push_back(ref); - } - void addObject(int id, const reco::METRef& ref) { - basemetIds_.push_back(id); - basemetRefs_.push_back(ref); - } - void addObject(int id, const reco::CaloMETRef& ref) { - calometIds_.push_back(id); - calometRefs_.push_back(ref); - } - void addObject(int id, const reco::IsolatedPixelTrackCandidateRef& ref) { - pixtrackIds_.push_back(id); - pixtrackRefs_.push_back(ref); - } - - void addObject(int id, const l1extra::L1EmParticleRef& ref) { - l1emIds_.push_back(id); - l1emRefs_.push_back(ref); - } - void addObject(int id, const l1extra::L1MuonParticleRef& ref) { - l1muonIds_.push_back(id); - l1muonRefs_.push_back(ref); - } - void addObject(int id, const l1extra::L1JetParticleRef& ref) { - l1jetIds_.push_back(id); - l1jetRefs_.push_back(ref); - } - void addObject(int id, const l1extra::L1EtMissParticleRef& ref) { - l1etmissIds_.push_back(id); - l1etmissRefs_.push_back(ref); - } - void addObject(int id, const l1extra::L1HFRingsRef& ref) { - l1hfringsIds_.push_back(id); - l1hfringsRefs_.push_back(ref); - } - void addObject(int id, const l1t::MuonRef& ref) { - l1tmuonIds_.push_back(id); - l1tmuonRefs_.push_back(ref); - } - void addObject(int id, const l1t::MuonShowerRef& ref) { - l1tmuonShowerIds_.push_back(id); - l1tmuonShowerRefs_.push_back(ref); - } - void addObject(int id, const l1t::EGammaRef& ref) { - l1tegammaIds_.push_back(id); - l1tegammaRefs_.push_back(ref); - } - void addObject(int id, const l1t::JetRef& ref) { - l1tjetIds_.push_back(id); - l1tjetRefs_.push_back(ref); - } - void addObject(int id, const l1t::TauRef& ref) { - l1ttauIds_.push_back(id); - l1ttauRefs_.push_back(ref); - } - void addObject(int id, const l1t::EtSumRef& ref) { - l1tetsumIds_.push_back(id); - l1tetsumRefs_.push_back(ref); - } - - /* Phase-2 */ - void addObject(int id, const l1t::TrackerMuonRef& ref) { - l1ttkmuonIds_.push_back(id); - l1ttkmuonRefs_.push_back(ref); - } - void addObject(int id, const l1t::TkElectronRef& ref) { - l1ttkeleIds_.push_back(id); - l1ttkeleRefs_.push_back(ref); - } - void addObject(int id, const l1t::TkEmRef& ref) { - l1ttkemIds_.push_back(id); - l1ttkemRefs_.push_back(ref); - } - void addObject(int id, const l1t::PFJetRef& ref) { - l1tpfjetIds_.push_back(id); - l1tpfjetRefs_.push_back(ref); - } - void addObject(int id, const l1t::PFTauRef& ref) { - l1tpftauIds_.push_back(id); - l1tpftauRefs_.push_back(ref); - } - void addObject(int id, const l1t::HPSPFTauRef& ref) { - l1thpspftauIds_.push_back(id); - l1thpspftauRefs_.push_back(ref); - } - void addObject(int id, const l1t::PFTrackRef& ref) { - l1tpftrackIds_.push_back(id); - l1tpftrackRefs_.push_back(ref); - } - void addObject(int id, const l1t::EtSumP2Ref& ref) { - l1tp2etsumIds_.push_back(id); - l1tp2etsumRefs_.push_back(ref); - } - void addObject(int id, const reco::PFJetRef& ref) { - pfjetIds_.push_back(id); - pfjetRefs_.push_back(ref); - } - void addObject(int id, const reco::PFTauRef& ref) { - pftauIds_.push_back(id); - pftauRefs_.push_back(ref); - } - void addObject(int id, const reco::PFMETRef& ref) { - pfmetIds_.push_back(id); - pfmetRefs_.push_back(ref); - } - void addObject(int id, const l1t::P2GTCandidateRef& ref) { - l1tp2gtcandIds_.push_back(id); - l1tp2gtcandRefs_.push_back(ref); - } - - /// - size_type addObjects(const Vids& ids, const VRphoton& refs) { - assert(ids.size() == refs.size()); - photonIds_.insert(photonIds_.end(), ids.begin(), ids.end()); - photonRefs_.insert(photonRefs_.end(), refs.begin(), refs.end()); - return photonIds_.size(); - } - size_type addObjects(const Vids& ids, const VRelectron& refs) { - assert(ids.size() == refs.size()); - electronIds_.insert(electronIds_.end(), ids.begin(), ids.end()); - electronRefs_.insert(electronRefs_.end(), refs.begin(), refs.end()); - return electronIds_.size(); - } - size_type addObjects(const Vids& ids, const VRmuon& refs) { - assert(ids.size() == refs.size()); - muonIds_.insert(muonIds_.end(), ids.begin(), ids.end()); - muonRefs_.insert(muonRefs_.end(), refs.begin(), refs.end()); - return muonIds_.size(); - } - size_type addObjects(const Vids& ids, const VRjet& refs) { - assert(ids.size() == refs.size()); - jetIds_.insert(jetIds_.end(), ids.begin(), ids.end()); - jetRefs_.insert(jetRefs_.end(), refs.begin(), refs.end()); - return jetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRcomposite& refs) { - assert(ids.size() == refs.size()); - compositeIds_.insert(compositeIds_.end(), ids.begin(), ids.end()); - compositeRefs_.insert(compositeRefs_.end(), refs.begin(), refs.end()); - return compositeIds_.size(); - } - size_type addObjects(const Vids& ids, const VRbasemet& refs) { - assert(ids.size() == refs.size()); - basemetIds_.insert(basemetIds_.end(), ids.begin(), ids.end()); - basemetRefs_.insert(basemetRefs_.end(), refs.begin(), refs.end()); - return basemetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRcalomet& refs) { - assert(ids.size() == refs.size()); - calometIds_.insert(calometIds_.end(), ids.begin(), ids.end()); - calometRefs_.insert(calometRefs_.end(), refs.begin(), refs.end()); - return calometIds_.size(); - } - size_type addObjects(const Vids& ids, const VRpixtrack& refs) { - assert(ids.size() == refs.size()); - pixtrackIds_.insert(pixtrackIds_.end(), ids.begin(), ids.end()); - pixtrackRefs_.insert(pixtrackRefs_.end(), refs.begin(), refs.end()); - return pixtrackIds_.size(); - } - - size_type addObjects(const Vids& ids, const VRl1em& refs) { - assert(ids.size() == refs.size()); - l1emIds_.insert(l1emIds_.end(), ids.begin(), ids.end()); - l1emRefs_.insert(l1emRefs_.end(), refs.begin(), refs.end()); - return l1emIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1muon& refs) { - assert(ids.size() == refs.size()); - l1muonIds_.insert(l1muonIds_.end(), ids.begin(), ids.end()); - l1muonRefs_.insert(l1muonRefs_.end(), refs.begin(), refs.end()); - return l1muonIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1jet& refs) { - assert(ids.size() == refs.size()); - l1jetIds_.insert(l1jetIds_.end(), ids.begin(), ids.end()); - l1jetRefs_.insert(l1jetRefs_.end(), refs.begin(), refs.end()); - return l1jetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1etmiss& refs) { - assert(ids.size() == refs.size()); - l1etmissIds_.insert(l1etmissIds_.end(), ids.begin(), ids.end()); - l1etmissRefs_.insert(l1etmissRefs_.end(), refs.begin(), refs.end()); - return l1etmissIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tmuon& refs) { - assert(ids.size() == refs.size()); - l1tmuonIds_.insert(l1tmuonIds_.end(), ids.begin(), ids.end()); - l1tmuonRefs_.insert(l1tmuonRefs_.end(), refs.begin(), refs.end()); - return l1tmuonIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tmuonShower& refs) { - assert(ids.size() == refs.size()); - l1tmuonShowerIds_.insert(l1tmuonShowerIds_.end(), ids.begin(), ids.end()); - l1tmuonShowerRefs_.insert(l1tmuonShowerRefs_.end(), refs.begin(), refs.end()); - return l1tmuonShowerIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tegamma& refs) { - assert(ids.size() == refs.size()); - l1tegammaIds_.insert(l1tegammaIds_.end(), ids.begin(), ids.end()); - l1tegammaRefs_.insert(l1tegammaRefs_.end(), refs.begin(), refs.end()); - return l1tegammaIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tjet& refs) { - assert(ids.size() == refs.size()); - l1tjetIds_.insert(l1tjetIds_.end(), ids.begin(), ids.end()); - l1tjetRefs_.insert(l1tjetRefs_.end(), refs.begin(), refs.end()); - return l1tjetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1ttau& refs) { - assert(ids.size() == refs.size()); - l1ttauIds_.insert(l1ttauIds_.end(), ids.begin(), ids.end()); - l1ttauRefs_.insert(l1ttauRefs_.end(), refs.begin(), refs.end()); - return l1ttauIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tetsum& refs) { - assert(ids.size() == refs.size()); - l1tetsumIds_.insert(l1tetsumIds_.end(), ids.begin(), ids.end()); - l1tetsumRefs_.insert(l1tetsumRefs_.end(), refs.begin(), refs.end()); - return l1tetsumIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1hfrings& refs) { - assert(ids.size() == refs.size()); - l1hfringsIds_.insert(l1hfringsIds_.end(), ids.begin(), ids.end()); - l1hfringsRefs_.insert(l1hfringsRefs_.end(), refs.begin(), refs.end()); - return l1hfringsIds_.size(); - } - - /* Phase-2 */ - size_type addObjects(const Vids& ids, const VRl1ttkmuon& refs) { - assert(ids.size() == refs.size()); - l1ttkmuonIds_.insert(l1ttkmuonIds_.end(), ids.begin(), ids.end()); - l1ttkmuonRefs_.insert(l1ttkmuonRefs_.end(), refs.begin(), refs.end()); - return l1ttkmuonIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1ttkele& refs) { - assert(ids.size() == refs.size()); - l1ttkeleIds_.insert(l1ttkeleIds_.end(), ids.begin(), ids.end()); - l1ttkeleRefs_.insert(l1ttkeleRefs_.end(), refs.begin(), refs.end()); - return l1ttkeleIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1ttkem& refs) { - assert(ids.size() == refs.size()); - l1ttkemIds_.insert(l1ttkemIds_.end(), ids.begin(), ids.end()); - l1ttkemRefs_.insert(l1ttkemRefs_.end(), refs.begin(), refs.end()); - return l1ttkemIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tpfjet& refs) { - assert(ids.size() == refs.size()); - l1tpfjetIds_.insert(l1tpfjetIds_.end(), ids.begin(), ids.end()); - l1tpfjetRefs_.insert(l1tpfjetRefs_.end(), refs.begin(), refs.end()); - return l1tpfjetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tpftau& refs) { - assert(ids.size() == refs.size()); - l1tpftauIds_.insert(l1tpftauIds_.end(), ids.begin(), ids.end()); - l1tpftauRefs_.insert(l1tpftauRefs_.end(), refs.begin(), refs.end()); - return l1tpftauIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1thpspftau& refs) { - assert(ids.size() == refs.size()); - l1thpspftauIds_.insert(l1thpspftauIds_.end(), ids.begin(), ids.end()); - l1thpspftauRefs_.insert(l1thpspftauRefs_.end(), refs.begin(), refs.end()); - return l1thpspftauIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tpftrack& refs) { - assert(ids.size() == refs.size()); - l1tpftrackIds_.insert(l1tpftrackIds_.end(), ids.begin(), ids.end()); - l1tpftrackRefs_.insert(l1tpftrackRefs_.end(), refs.begin(), refs.end()); - return l1tpftrackIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tp2etsum& refs) { - assert(ids.size() == refs.size()); - l1tp2etsumIds_.insert(l1tp2etsumIds_.end(), ids.begin(), ids.end()); - l1tp2etsumRefs_.insert(l1tp2etsumRefs_.end(), refs.begin(), refs.end()); - return l1tp2etsumIds_.size(); - } - - size_type addObjects(const Vids& ids, const VRpfjet& refs) { - assert(ids.size() == refs.size()); - pfjetIds_.insert(pfjetIds_.end(), ids.begin(), ids.end()); - pfjetRefs_.insert(pfjetRefs_.end(), refs.begin(), refs.end()); - return pfjetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRpftau& refs) { - assert(ids.size() == refs.size()); - pftauIds_.insert(pftauIds_.end(), ids.begin(), ids.end()); - pftauRefs_.insert(pftauRefs_.end(), refs.begin(), refs.end()); - return pftauIds_.size(); - } - size_type addObjects(const Vids& ids, const VRpfmet& refs) { - assert(ids.size() == refs.size()); - pfmetIds_.insert(pfmetIds_.end(), ids.begin(), ids.end()); - pfmetRefs_.insert(pfmetRefs_.end(), refs.begin(), refs.end()); - return pfmetIds_.size(); - } - size_type addObjects(const Vids& ids, const VRl1tp2gtcand& refs) { - assert(ids.size() == refs.size()); - l1tp2gtcandIds_.insert(l1tp2gtcandIds_.end(), ids.begin(), ids.end()); - l1tp2gtcandRefs_.insert(l1tp2gtcandRefs_.end(), refs.begin(), refs.end()); - return l1tp2gtcandIds_.size(); - } - - /// various physics-level getters: - void getObjects(Vids& ids, VRphoton& refs) const { getObjects(ids, refs, 0, photonIds_.size()); } - void getObjects(Vids& ids, VRphoton& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= photonIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = photonIds_[i]; - refs[j] = photonRefs_[i]; - ++j; - } - } - void getObjects(int id, VRphoton& refs) const { getObjects(id, refs, 0, photonIds_.size()); } - void getObjects(int id, VRphoton& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= photonIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == photonIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == photonIds_[i]) { + Vids l1ttkmuonIds_; + VRl1ttkmuon l1ttkmuonRefs_; + Vids l1ttkeleIds_; + VRl1ttkele l1ttkeleRefs_; + Vids l1ttkemIds_; + VRl1ttkem l1ttkemRefs_; + Vids l1tpfjetIds_; + VRl1tpfjet l1tpfjetRefs_; + Vids l1tpftauIds_; + VRl1tpftau l1tpftauRefs_; + Vids l1thpspftauIds_; + VRl1thpspftau l1thpspftauRefs_; + Vids l1tpftrackIds_; + VRl1tpftrack l1tpftrackRefs_; + Vids l1tp2etsumIds_; + VRl1tp2etsum l1tp2etsumRefs_; + + Vids pfjetIds_; + VRpfjet pfjetRefs_; + Vids pftauIds_; + VRpftau pftauRefs_; + Vids pfmetIds_; + VRpfmet pfmetRefs_; + + Vids l1tp2gtcandIds_; + VRl1tp2gtcand l1tp2gtcandRefs_; + + /// methods + public: + /// constructors + TriggerRefsCollections() + : photonIds_(), + photonRefs_(), + electronIds_(), + electronRefs_(), + muonIds_(), + muonRefs_(), + jetIds_(), + jetRefs_(), + compositeIds_(), + compositeRefs_(), + basemetIds_(), + basemetRefs_(), + calometIds_(), + calometRefs_(), + pixtrackIds_(), + pixtrackRefs_(), + + l1emIds_(), + l1emRefs_(), + l1muonIds_(), + l1muonRefs_(), + l1jetIds_(), + l1jetRefs_(), + l1etmissIds_(), + l1etmissRefs_(), + l1hfringsIds_(), + l1hfringsRefs_(), + + l1tmuonIds_(), + l1tmuonRefs_(), + l1tmuonShowerIds_(), + l1tmuonShowerRefs_(), + l1tegammaIds_(), + l1tegammaRefs_(), + l1tjetIds_(), + l1tjetRefs_(), + l1ttauIds_(), + l1ttauRefs_(), + l1tetsumIds_(), + l1tetsumRefs_(), + + /* Phase-2 */ + l1ttkmuonIds_(), + l1ttkmuonRefs_(), + l1ttkeleIds_(), + l1ttkeleRefs_(), + l1ttkemIds_(), + l1ttkemRefs_(), + l1tpfjetIds_(), + l1tpfjetRefs_(), + l1tpftauIds_(), + l1tpftauRefs_(), + l1thpspftauIds_(), + l1thpspftauRefs_(), + l1tpftrackIds_(), + l1tpftrackRefs_(), + l1tp2etsumIds_(), + l1tp2etsumRefs_(), + + pfjetIds_(), + pfjetRefs_(), + pftauIds_(), + pftauRefs_(), + pfmetIds_(), + pfmetRefs_(), + + l1tp2gtcandIds_(), + l1tp2gtcandRefs_() {} + + /// utility + void swap(TriggerRefsCollections& other) { + std::swap(photonIds_, other.photonIds_); + std::swap(photonRefs_, other.photonRefs_); + std::swap(electronIds_, other.electronIds_); + std::swap(electronRefs_, other.electronRefs_); + std::swap(muonIds_, other.muonIds_); + std::swap(muonRefs_, other.muonRefs_); + std::swap(jetIds_, other.jetIds_); + std::swap(jetRefs_, other.jetRefs_); + std::swap(compositeIds_, other.compositeIds_); + std::swap(compositeRefs_, other.compositeRefs_); + std::swap(basemetIds_, other.basemetIds_); + std::swap(basemetRefs_, other.basemetRefs_); + std::swap(calometIds_, other.calometIds_); + std::swap(calometRefs_, other.calometRefs_); + std::swap(pixtrackIds_, other.pixtrackIds_); + std::swap(pixtrackRefs_, other.pixtrackRefs_); + + std::swap(l1emIds_, other.l1emIds_); + std::swap(l1emRefs_, other.l1emRefs_); + std::swap(l1muonIds_, other.l1muonIds_); + std::swap(l1muonRefs_, other.l1muonRefs_); + std::swap(l1jetIds_, other.l1jetIds_); + std::swap(l1jetRefs_, other.l1jetRefs_); + std::swap(l1etmissIds_, other.l1etmissIds_); + std::swap(l1etmissRefs_, other.l1etmissRefs_); + std::swap(l1hfringsIds_, other.l1hfringsIds_); + std::swap(l1hfringsRefs_, other.l1hfringsRefs_); + + std::swap(l1tmuonIds_, other.l1tmuonIds_); + std::swap(l1tmuonRefs_, other.l1tmuonRefs_); + std::swap(l1tmuonShowerIds_, other.l1tmuonShowerIds_); + std::swap(l1tmuonShowerRefs_, other.l1tmuonShowerRefs_); + std::swap(l1tegammaIds_, other.l1tegammaIds_); + std::swap(l1tegammaRefs_, other.l1tegammaRefs_); + std::swap(l1tjetIds_, other.l1tjetIds_); + std::swap(l1tjetRefs_, other.l1tjetRefs_); + std::swap(l1ttauIds_, other.l1ttauIds_); + std::swap(l1ttauRefs_, other.l1ttauRefs_); + std::swap(l1tetsumIds_, other.l1tetsumIds_); + std::swap(l1tetsumRefs_, other.l1tetsumRefs_); + + /* Phase-2 */ + std::swap(l1ttkmuonIds_, other.l1ttkmuonIds_); + std::swap(l1ttkmuonRefs_, other.l1ttkmuonRefs_); + std::swap(l1ttkeleIds_, other.l1ttkeleIds_); + std::swap(l1ttkeleRefs_, other.l1ttkeleRefs_); + std::swap(l1ttkemIds_, other.l1ttkemIds_); + std::swap(l1ttkemRefs_, other.l1ttkemRefs_); + std::swap(l1tpfjetIds_, other.l1tpfjetIds_); + std::swap(l1tpfjetRefs_, other.l1tpfjetRefs_); + std::swap(l1tpftauIds_, other.l1tpftauIds_); + std::swap(l1tpftauRefs_, other.l1tpftauRefs_); + std::swap(l1thpspftauIds_, other.l1thpspftauIds_); + std::swap(l1thpspftauRefs_, other.l1thpspftauRefs_); + std::swap(l1tpftrackIds_, other.l1tpftrackIds_); + std::swap(l1tpftrackRefs_, other.l1tpftrackRefs_); + std::swap(l1tp2etsumIds_, other.l1tp2etsumIds_); + std::swap(l1tp2etsumRefs_, other.l1tp2etsumRefs_); + + std::swap(pfjetIds_, other.pfjetIds_); + std::swap(pfjetRefs_, other.pfjetRefs_); + std::swap(pftauIds_, other.pftauIds_); + std::swap(pftauRefs_, other.pftauRefs_); + std::swap(pfmetIds_, other.pfmetIds_); + std::swap(pfmetRefs_, other.pfmetRefs_); + + std::swap(l1tp2gtcandIds_, other.l1tp2gtcandIds_); + std::swap(l1tp2gtcandRefs_, other.l1tp2gtcandRefs_); + } + + /// setters for L3 collections: (id=physics type, and Ref) + void addObject(int id, const reco::RecoEcalCandidateRef& ref) { + photonIds_.push_back(id); + photonRefs_.push_back(ref); + } + void addObject(int id, const reco::ElectronRef& ref) { + electronIds_.push_back(id); + electronRefs_.push_back(ref); + } + void addObject(int id, const reco::RecoChargedCandidateRef& ref) { + muonIds_.push_back(id); + muonRefs_.push_back(ref); + } + void addObject(int id, const reco::CaloJetRef& ref) { + jetIds_.push_back(id); + jetRefs_.push_back(ref); + } + void addObject(int id, const reco::CompositeCandidateRef& ref) { + compositeIds_.push_back(id); + compositeRefs_.push_back(ref); + } + void addObject(int id, const reco::METRef& ref) { + basemetIds_.push_back(id); + basemetRefs_.push_back(ref); + } + void addObject(int id, const reco::CaloMETRef& ref) { + calometIds_.push_back(id); + calometRefs_.push_back(ref); + } + void addObject(int id, const reco::IsolatedPixelTrackCandidateRef& ref) { + pixtrackIds_.push_back(id); + pixtrackRefs_.push_back(ref); + } + + void addObject(int id, const l1extra::L1EmParticleRef& ref) { + l1emIds_.push_back(id); + l1emRefs_.push_back(ref); + } + void addObject(int id, const l1extra::L1MuonParticleRef& ref) { + l1muonIds_.push_back(id); + l1muonRefs_.push_back(ref); + } + void addObject(int id, const l1extra::L1JetParticleRef& ref) { + l1jetIds_.push_back(id); + l1jetRefs_.push_back(ref); + } + void addObject(int id, const l1extra::L1EtMissParticleRef& ref) { + l1etmissIds_.push_back(id); + l1etmissRefs_.push_back(ref); + } + void addObject(int id, const l1extra::L1HFRingsRef& ref) { + l1hfringsIds_.push_back(id); + l1hfringsRefs_.push_back(ref); + } + void addObject(int id, const l1t::MuonRef& ref) { + l1tmuonIds_.push_back(id); + l1tmuonRefs_.push_back(ref); + } + void addObject(int id, const l1t::MuonShowerRef& ref) { + l1tmuonShowerIds_.push_back(id); + l1tmuonShowerRefs_.push_back(ref); + } + void addObject(int id, const l1t::EGammaRef& ref) { + l1tegammaIds_.push_back(id); + l1tegammaRefs_.push_back(ref); + } + void addObject(int id, const l1t::JetRef& ref) { + l1tjetIds_.push_back(id); + l1tjetRefs_.push_back(ref); + } + void addObject(int id, const l1t::TauRef& ref) { + l1ttauIds_.push_back(id); + l1ttauRefs_.push_back(ref); + } + void addObject(int id, const l1t::EtSumRef& ref) { + l1tetsumIds_.push_back(id); + l1tetsumRefs_.push_back(ref); + } + + /* Phase-2 */ + void addObject(int id, const l1t::TrackerMuonRef& ref) { + l1ttkmuonIds_.push_back(id); + l1ttkmuonRefs_.push_back(ref); + } + void addObject(int id, const l1t::TkElectronRef& ref) { + l1ttkeleIds_.push_back(id); + l1ttkeleRefs_.push_back(ref); + } + void addObject(int id, const l1t::TkEmRef& ref) { + l1ttkemIds_.push_back(id); + l1ttkemRefs_.push_back(ref); + } + void addObject(int id, const l1t::PFJetRef& ref) { + l1tpfjetIds_.push_back(id); + l1tpfjetRefs_.push_back(ref); + } + void addObject(int id, const l1t::PFTauRef& ref) { + l1tpftauIds_.push_back(id); + l1tpftauRefs_.push_back(ref); + } + void addObject(int id, const l1t::HPSPFTauRef& ref) { + l1thpspftauIds_.push_back(id); + l1thpspftauRefs_.push_back(ref); + } + void addObject(int id, const l1t::PFTrackRef& ref) { + l1tpftrackIds_.push_back(id); + l1tpftrackRefs_.push_back(ref); + } + void addObject(int id, const l1t::EtSumP2Ref& ref) { + l1tp2etsumIds_.push_back(id); + l1tp2etsumRefs_.push_back(ref); + } + void addObject(int id, const reco::PFJetRef& ref) { + pfjetIds_.push_back(id); + pfjetRefs_.push_back(ref); + } + void addObject(int id, const reco::PFTauRef& ref) { + pftauIds_.push_back(id); + pftauRefs_.push_back(ref); + } + void addObject(int id, const reco::PFMETRef& ref) { + pfmetIds_.push_back(id); + pfmetRefs_.push_back(ref); + } + void addObject(int id, const l1t::P2GTCandidateRef& ref) { + l1tp2gtcandIds_.push_back(id); + l1tp2gtcandRefs_.push_back(ref); + } + + /// + size_type addObjects(const Vids& ids, const VRphoton& refs) { + assert(ids.size() == refs.size()); + photonIds_.insert(photonIds_.end(), ids.begin(), ids.end()); + photonRefs_.insert(photonRefs_.end(), refs.begin(), refs.end()); + return photonIds_.size(); + } + size_type addObjects(const Vids& ids, const VRelectron& refs) { + assert(ids.size() == refs.size()); + electronIds_.insert(electronIds_.end(), ids.begin(), ids.end()); + electronRefs_.insert(electronRefs_.end(), refs.begin(), refs.end()); + return electronIds_.size(); + } + size_type addObjects(const Vids& ids, const VRmuon& refs) { + assert(ids.size() == refs.size()); + muonIds_.insert(muonIds_.end(), ids.begin(), ids.end()); + muonRefs_.insert(muonRefs_.end(), refs.begin(), refs.end()); + return muonIds_.size(); + } + size_type addObjects(const Vids& ids, const VRjet& refs) { + assert(ids.size() == refs.size()); + jetIds_.insert(jetIds_.end(), ids.begin(), ids.end()); + jetRefs_.insert(jetRefs_.end(), refs.begin(), refs.end()); + return jetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRcomposite& refs) { + assert(ids.size() == refs.size()); + compositeIds_.insert(compositeIds_.end(), ids.begin(), ids.end()); + compositeRefs_.insert(compositeRefs_.end(), refs.begin(), refs.end()); + return compositeIds_.size(); + } + size_type addObjects(const Vids& ids, const VRbasemet& refs) { + assert(ids.size() == refs.size()); + basemetIds_.insert(basemetIds_.end(), ids.begin(), ids.end()); + basemetRefs_.insert(basemetRefs_.end(), refs.begin(), refs.end()); + return basemetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRcalomet& refs) { + assert(ids.size() == refs.size()); + calometIds_.insert(calometIds_.end(), ids.begin(), ids.end()); + calometRefs_.insert(calometRefs_.end(), refs.begin(), refs.end()); + return calometIds_.size(); + } + size_type addObjects(const Vids& ids, const VRpixtrack& refs) { + assert(ids.size() == refs.size()); + pixtrackIds_.insert(pixtrackIds_.end(), ids.begin(), ids.end()); + pixtrackRefs_.insert(pixtrackRefs_.end(), refs.begin(), refs.end()); + return pixtrackIds_.size(); + } + + size_type addObjects(const Vids& ids, const VRl1em& refs) { + assert(ids.size() == refs.size()); + l1emIds_.insert(l1emIds_.end(), ids.begin(), ids.end()); + l1emRefs_.insert(l1emRefs_.end(), refs.begin(), refs.end()); + return l1emIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1muon& refs) { + assert(ids.size() == refs.size()); + l1muonIds_.insert(l1muonIds_.end(), ids.begin(), ids.end()); + l1muonRefs_.insert(l1muonRefs_.end(), refs.begin(), refs.end()); + return l1muonIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1jet& refs) { + assert(ids.size() == refs.size()); + l1jetIds_.insert(l1jetIds_.end(), ids.begin(), ids.end()); + l1jetRefs_.insert(l1jetRefs_.end(), refs.begin(), refs.end()); + return l1jetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1etmiss& refs) { + assert(ids.size() == refs.size()); + l1etmissIds_.insert(l1etmissIds_.end(), ids.begin(), ids.end()); + l1etmissRefs_.insert(l1etmissRefs_.end(), refs.begin(), refs.end()); + return l1etmissIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tmuon& refs) { + assert(ids.size() == refs.size()); + l1tmuonIds_.insert(l1tmuonIds_.end(), ids.begin(), ids.end()); + l1tmuonRefs_.insert(l1tmuonRefs_.end(), refs.begin(), refs.end()); + return l1tmuonIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tmuonShower& refs) { + assert(ids.size() == refs.size()); + l1tmuonShowerIds_.insert(l1tmuonShowerIds_.end(), ids.begin(), ids.end()); + l1tmuonShowerRefs_.insert(l1tmuonShowerRefs_.end(), refs.begin(), refs.end()); + return l1tmuonShowerIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tegamma& refs) { + assert(ids.size() == refs.size()); + l1tegammaIds_.insert(l1tegammaIds_.end(), ids.begin(), ids.end()); + l1tegammaRefs_.insert(l1tegammaRefs_.end(), refs.begin(), refs.end()); + return l1tegammaIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tjet& refs) { + assert(ids.size() == refs.size()); + l1tjetIds_.insert(l1tjetIds_.end(), ids.begin(), ids.end()); + l1tjetRefs_.insert(l1tjetRefs_.end(), refs.begin(), refs.end()); + return l1tjetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1ttau& refs) { + assert(ids.size() == refs.size()); + l1ttauIds_.insert(l1ttauIds_.end(), ids.begin(), ids.end()); + l1ttauRefs_.insert(l1ttauRefs_.end(), refs.begin(), refs.end()); + return l1ttauIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tetsum& refs) { + assert(ids.size() == refs.size()); + l1tetsumIds_.insert(l1tetsumIds_.end(), ids.begin(), ids.end()); + l1tetsumRefs_.insert(l1tetsumRefs_.end(), refs.begin(), refs.end()); + return l1tetsumIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1hfrings& refs) { + assert(ids.size() == refs.size()); + l1hfringsIds_.insert(l1hfringsIds_.end(), ids.begin(), ids.end()); + l1hfringsRefs_.insert(l1hfringsRefs_.end(), refs.begin(), refs.end()); + return l1hfringsIds_.size(); + } + + /* Phase-2 */ + size_type addObjects(const Vids& ids, const VRl1ttkmuon& refs) { + assert(ids.size() == refs.size()); + l1ttkmuonIds_.insert(l1ttkmuonIds_.end(), ids.begin(), ids.end()); + l1ttkmuonRefs_.insert(l1ttkmuonRefs_.end(), refs.begin(), refs.end()); + return l1ttkmuonIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1ttkele& refs) { + assert(ids.size() == refs.size()); + l1ttkeleIds_.insert(l1ttkeleIds_.end(), ids.begin(), ids.end()); + l1ttkeleRefs_.insert(l1ttkeleRefs_.end(), refs.begin(), refs.end()); + return l1ttkeleIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1ttkem& refs) { + assert(ids.size() == refs.size()); + l1ttkemIds_.insert(l1ttkemIds_.end(), ids.begin(), ids.end()); + l1ttkemRefs_.insert(l1ttkemRefs_.end(), refs.begin(), refs.end()); + return l1ttkemIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tpfjet& refs) { + assert(ids.size() == refs.size()); + l1tpfjetIds_.insert(l1tpfjetIds_.end(), ids.begin(), ids.end()); + l1tpfjetRefs_.insert(l1tpfjetRefs_.end(), refs.begin(), refs.end()); + return l1tpfjetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tpftau& refs) { + assert(ids.size() == refs.size()); + l1tpftauIds_.insert(l1tpftauIds_.end(), ids.begin(), ids.end()); + l1tpftauRefs_.insert(l1tpftauRefs_.end(), refs.begin(), refs.end()); + return l1tpftauIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1thpspftau& refs) { + assert(ids.size() == refs.size()); + l1thpspftauIds_.insert(l1thpspftauIds_.end(), ids.begin(), ids.end()); + l1thpspftauRefs_.insert(l1thpspftauRefs_.end(), refs.begin(), refs.end()); + return l1thpspftauIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tpftrack& refs) { + assert(ids.size() == refs.size()); + l1tpftrackIds_.insert(l1tpftrackIds_.end(), ids.begin(), ids.end()); + l1tpftrackRefs_.insert(l1tpftrackRefs_.end(), refs.begin(), refs.end()); + return l1tpftrackIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tp2etsum& refs) { + assert(ids.size() == refs.size()); + l1tp2etsumIds_.insert(l1tp2etsumIds_.end(), ids.begin(), ids.end()); + l1tp2etsumRefs_.insert(l1tp2etsumRefs_.end(), refs.begin(), refs.end()); + return l1tp2etsumIds_.size(); + } + + size_type addObjects(const Vids& ids, const VRpfjet& refs) { + assert(ids.size() == refs.size()); + pfjetIds_.insert(pfjetIds_.end(), ids.begin(), ids.end()); + pfjetRefs_.insert(pfjetRefs_.end(), refs.begin(), refs.end()); + return pfjetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRpftau& refs) { + assert(ids.size() == refs.size()); + pftauIds_.insert(pftauIds_.end(), ids.begin(), ids.end()); + pftauRefs_.insert(pftauRefs_.end(), refs.begin(), refs.end()); + return pftauIds_.size(); + } + size_type addObjects(const Vids& ids, const VRpfmet& refs) { + assert(ids.size() == refs.size()); + pfmetIds_.insert(pfmetIds_.end(), ids.begin(), ids.end()); + pfmetRefs_.insert(pfmetRefs_.end(), refs.begin(), refs.end()); + return pfmetIds_.size(); + } + size_type addObjects(const Vids& ids, const VRl1tp2gtcand& refs) { + assert(ids.size() == refs.size()); + l1tp2gtcandIds_.insert(l1tp2gtcandIds_.end(), ids.begin(), ids.end()); + l1tp2gtcandRefs_.insert(l1tp2gtcandRefs_.end(), refs.begin(), refs.end()); + return l1tp2gtcandIds_.size(); + } + + /// various physics-level getters: + void getObjects(Vids& ids, VRphoton& refs) const { getObjects(ids, refs, 0, photonIds_.size()); } + void getObjects(Vids& ids, VRphoton& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= photonIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = photonIds_[i]; refs[j] = photonRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRelectron& refs) const { getObjects(ids, refs, 0, electronIds_.size()); } - void getObjects(Vids& ids, VRelectron& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= electronIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = electronIds_[i]; - refs[j] = electronRefs_[i]; - ++j; - } - } - void getObjects(int id, VRelectron& refs) const { getObjects(id, refs, 0, electronIds_.size()); } - void getObjects(int id, VRelectron& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= electronIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == electronIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == electronIds_[i]) { + void getObjects(int id, VRphoton& refs) const { getObjects(id, refs, 0, photonIds_.size()); } + void getObjects(int id, VRphoton& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= photonIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == photonIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == photonIds_[i]) { + refs[j] = photonRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRelectron& refs) const { getObjects(ids, refs, 0, electronIds_.size()); } + void getObjects(Vids& ids, VRelectron& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= electronIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = electronIds_[i]; refs[j] = electronRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRmuon& refs) const { getObjects(ids, refs, 0, muonIds_.size()); } - void getObjects(Vids& ids, VRmuon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= muonIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = muonIds_[i]; - refs[j] = muonRefs_[i]; - ++j; - } - } - void getObjects(int id, VRmuon& refs) const { getObjects(id, refs, 0, muonIds_.size()); } - void getObjects(int id, VRmuon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= muonIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == muonIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == muonIds_[i]) { + void getObjects(int id, VRelectron& refs) const { getObjects(id, refs, 0, electronIds_.size()); } + void getObjects(int id, VRelectron& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= electronIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == electronIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == electronIds_[i]) { + refs[j] = electronRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRmuon& refs) const { getObjects(ids, refs, 0, muonIds_.size()); } + void getObjects(Vids& ids, VRmuon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= muonIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = muonIds_[i]; refs[j] = muonRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRjet& refs) const { getObjects(ids, refs, 0, jetIds_.size()); } - void getObjects(Vids& ids, VRjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= jetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = jetIds_[i]; - refs[j] = jetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRjet& refs) const { getObjects(id, refs, 0, jetIds_.size()); } - void getObjects(int id, VRjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= jetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == jetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == jetIds_[i]) { + void getObjects(int id, VRmuon& refs) const { getObjects(id, refs, 0, muonIds_.size()); } + void getObjects(int id, VRmuon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= muonIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == muonIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == muonIds_[i]) { + refs[j] = muonRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRjet& refs) const { getObjects(ids, refs, 0, jetIds_.size()); } + void getObjects(Vids& ids, VRjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= jetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = jetIds_[i]; refs[j] = jetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRcomposite& refs) const { getObjects(ids, refs, 0, compositeIds_.size()); } - void getObjects(Vids& ids, VRcomposite& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= compositeIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = compositeIds_[i]; - refs[j] = compositeRefs_[i]; - ++j; - } - } - void getObjects(int id, VRcomposite& refs) const { getObjects(id, refs, 0, compositeIds_.size()); } - void getObjects(int id, VRcomposite& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= compositeIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == compositeIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == compositeIds_[i]) { + void getObjects(int id, VRjet& refs) const { getObjects(id, refs, 0, jetIds_.size()); } + void getObjects(int id, VRjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= jetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == jetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == jetIds_[i]) { + refs[j] = jetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRcomposite& refs) const { getObjects(ids, refs, 0, compositeIds_.size()); } + void getObjects(Vids& ids, VRcomposite& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= compositeIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = compositeIds_[i]; refs[j] = compositeRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRbasemet& refs) const { getObjects(ids, refs, 0, basemetIds_.size()); } - void getObjects(Vids& ids, VRbasemet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= basemetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = basemetIds_[i]; - refs[j] = basemetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRbasemet& refs) const { getObjects(id, refs, 0, basemetIds_.size()); } - void getObjects(int id, VRbasemet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= basemetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == basemetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == basemetIds_[i]) { + void getObjects(int id, VRcomposite& refs) const { getObjects(id, refs, 0, compositeIds_.size()); } + void getObjects(int id, VRcomposite& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= compositeIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == compositeIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == compositeIds_[i]) { + refs[j] = compositeRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRbasemet& refs) const { getObjects(ids, refs, 0, basemetIds_.size()); } + void getObjects(Vids& ids, VRbasemet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= basemetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = basemetIds_[i]; refs[j] = basemetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRcalomet& refs) const { getObjects(ids, refs, 0, calometIds_.size()); } - void getObjects(Vids& ids, VRcalomet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= calometIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = calometIds_[i]; - refs[j] = calometRefs_[i]; - ++j; - } - } - void getObjects(int id, VRcalomet& refs) const { getObjects(id, refs, 0, calometIds_.size()); } - void getObjects(int id, VRcalomet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= calometIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == calometIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == calometIds_[i]) { + void getObjects(int id, VRbasemet& refs) const { getObjects(id, refs, 0, basemetIds_.size()); } + void getObjects(int id, VRbasemet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= basemetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == basemetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == basemetIds_[i]) { + refs[j] = basemetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRcalomet& refs) const { getObjects(ids, refs, 0, calometIds_.size()); } + void getObjects(Vids& ids, VRcalomet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= calometIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = calometIds_[i]; refs[j] = calometRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRpixtrack& refs) const { getObjects(ids, refs, 0, pixtrackIds_.size()); } - void getObjects(Vids& ids, VRpixtrack& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pixtrackIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = pixtrackIds_[i]; - refs[j] = pixtrackRefs_[i]; - ++j; - } - } - void getObjects(int id, VRpixtrack& refs) const { getObjects(id, refs, 0, pixtrackIds_.size()); } - void getObjects(int id, VRpixtrack& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pixtrackIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == pixtrackIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == pixtrackIds_[i]) { + void getObjects(int id, VRcalomet& refs) const { getObjects(id, refs, 0, calometIds_.size()); } + void getObjects(int id, VRcalomet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= calometIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == calometIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == calometIds_[i]) { + refs[j] = calometRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRpixtrack& refs) const { getObjects(ids, refs, 0, pixtrackIds_.size()); } + void getObjects(Vids& ids, VRpixtrack& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pixtrackIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = pixtrackIds_[i]; refs[j] = pixtrackRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1em& refs) const { getObjects(ids, refs, 0, l1emIds_.size()); } - void getObjects(Vids& ids, VRl1em& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1emIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1emIds_[i]; - refs[j] = l1emRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1em& refs) const { getObjects(id, refs, 0, l1emIds_.size()); } - void getObjects(int id, VRl1em& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1emIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1emIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1emIds_[i]) { + void getObjects(int id, VRpixtrack& refs) const { getObjects(id, refs, 0, pixtrackIds_.size()); } + void getObjects(int id, VRpixtrack& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pixtrackIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == pixtrackIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == pixtrackIds_[i]) { + refs[j] = pixtrackRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1em& refs) const { getObjects(ids, refs, 0, l1emIds_.size()); } + void getObjects(Vids& ids, VRl1em& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1emIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1emIds_[i]; refs[j] = l1emRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1muon& refs) const { getObjects(ids, refs, 0, l1muonIds_.size()); } - void getObjects(Vids& ids, VRl1muon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1muonIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1muonIds_[i]; - refs[j] = l1muonRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1muon& refs) const { getObjects(id, refs, 0, l1muonIds_.size()); } - void getObjects(int id, VRl1muon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1muonIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1muonIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1muonIds_[i]) { + void getObjects(int id, VRl1em& refs) const { getObjects(id, refs, 0, l1emIds_.size()); } + void getObjects(int id, VRl1em& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1emIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1emIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1emIds_[i]) { + refs[j] = l1emRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1muon& refs) const { getObjects(ids, refs, 0, l1muonIds_.size()); } + void getObjects(Vids& ids, VRl1muon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1muonIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1muonIds_[i]; refs[j] = l1muonRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1jet& refs) const { getObjects(ids, refs, 0, l1jetIds_.size()); } - void getObjects(Vids& ids, VRl1jet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1jetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1jetIds_[i]; - refs[j] = l1jetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1jet& refs) const { getObjects(id, refs, 0, l1jetIds_.size()); } - void getObjects(int id, VRl1jet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1jetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1jetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1jetIds_[i]) { + void getObjects(int id, VRl1muon& refs) const { getObjects(id, refs, 0, l1muonIds_.size()); } + void getObjects(int id, VRl1muon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1muonIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1muonIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1muonIds_[i]) { + refs[j] = l1muonRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1jet& refs) const { getObjects(ids, refs, 0, l1jetIds_.size()); } + void getObjects(Vids& ids, VRl1jet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1jetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1jetIds_[i]; refs[j] = l1jetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1etmiss& refs) const { getObjects(ids, refs, 0, l1etmissIds_.size()); } - void getObjects(Vids& ids, VRl1etmiss& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1etmissIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1etmissIds_[i]; - refs[j] = l1etmissRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1etmiss& refs) const { getObjects(id, refs, 0, l1etmissIds_.size()); } - void getObjects(int id, VRl1etmiss& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1etmissIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1etmissIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1etmissIds_[i]) { + void getObjects(int id, VRl1jet& refs) const { getObjects(id, refs, 0, l1jetIds_.size()); } + void getObjects(int id, VRl1jet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1jetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1jetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1jetIds_[i]) { + refs[j] = l1jetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1etmiss& refs) const { getObjects(ids, refs, 0, l1etmissIds_.size()); } + void getObjects(Vids& ids, VRl1etmiss& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1etmissIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1etmissIds_[i]; refs[j] = l1etmissRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1hfrings& refs) const { getObjects(ids, refs, 0, l1hfringsIds_.size()); } - void getObjects(Vids& ids, VRl1hfrings& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1hfringsIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1hfringsIds_[i]; - refs[j] = l1hfringsRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1hfrings& refs) const { getObjects(id, refs, 0, l1hfringsIds_.size()); } - void getObjects(int id, VRl1hfrings& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1hfringsIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1hfringsIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1hfringsIds_[i]) { + void getObjects(int id, VRl1etmiss& refs) const { getObjects(id, refs, 0, l1etmissIds_.size()); } + void getObjects(int id, VRl1etmiss& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1etmissIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1etmissIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1etmissIds_[i]) { + refs[j] = l1etmissRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1hfrings& refs) const { getObjects(ids, refs, 0, l1hfringsIds_.size()); } + void getObjects(Vids& ids, VRl1hfrings& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1hfringsIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1hfringsIds_[i]; refs[j] = l1hfringsRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tmuon& refs) const { getObjects(ids, refs, 0, l1tmuonIds_.size()); } - void getObjects(Vids& ids, VRl1tmuon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tmuonIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tmuonIds_[i]; - refs[j] = l1tmuonRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tmuon& refs) const { getObjects(id, refs, 0, l1tmuonIds_.size()); } - void getObjects(int id, VRl1tmuon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tmuonIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tmuonIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tmuonIds_[i]) { + void getObjects(int id, VRl1hfrings& refs) const { getObjects(id, refs, 0, l1hfringsIds_.size()); } + void getObjects(int id, VRl1hfrings& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1hfringsIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1hfringsIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1hfringsIds_[i]) { + refs[j] = l1hfringsRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tmuon& refs) const { getObjects(ids, refs, 0, l1tmuonIds_.size()); } + void getObjects(Vids& ids, VRl1tmuon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tmuonIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tmuonIds_[i]; refs[j] = l1tmuonRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tmuonShower& refs) const { getObjects(ids, refs, 0, l1tmuonShowerIds_.size()); } - void getObjects(Vids& ids, VRl1tmuonShower& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tmuonShowerIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tmuonShowerIds_[i]; - refs[j] = l1tmuonShowerRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tmuonShower& refs) const { getObjects(id, refs, 0, l1tmuonShowerIds_.size()); } - void getObjects(int id, VRl1tmuonShower& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tmuonShowerIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tmuonShowerIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tmuonShowerIds_[i]) { + void getObjects(int id, VRl1tmuon& refs) const { getObjects(id, refs, 0, l1tmuonIds_.size()); } + void getObjects(int id, VRl1tmuon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tmuonIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tmuonIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tmuonIds_[i]) { + refs[j] = l1tmuonRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tmuonShower& refs) const { getObjects(ids, refs, 0, l1tmuonShowerIds_.size()); } + void getObjects(Vids& ids, VRl1tmuonShower& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tmuonShowerIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tmuonShowerIds_[i]; refs[j] = l1tmuonShowerRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tegamma& refs) const { getObjects(ids, refs, 0, l1tegammaIds_.size()); } - void getObjects(Vids& ids, VRl1tegamma& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tegammaIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tegammaIds_[i]; - refs[j] = l1tegammaRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tegamma& refs) const { getObjects(id, refs, 0, l1tegammaIds_.size()); } - void getObjects(int id, VRl1tegamma& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tegammaIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tegammaIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tegammaIds_[i]) { + void getObjects(int id, VRl1tmuonShower& refs) const { getObjects(id, refs, 0, l1tmuonShowerIds_.size()); } + void getObjects(int id, VRl1tmuonShower& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tmuonShowerIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tmuonShowerIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tmuonShowerIds_[i]) { + refs[j] = l1tmuonShowerRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tegamma& refs) const { getObjects(ids, refs, 0, l1tegammaIds_.size()); } + void getObjects(Vids& ids, VRl1tegamma& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tegammaIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tegammaIds_[i]; refs[j] = l1tegammaRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tjet& refs) const { getObjects(ids, refs, 0, l1tjetIds_.size()); } - void getObjects(Vids& ids, VRl1tjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tjetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tjetIds_[i]; - refs[j] = l1tjetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tjet& refs) const { getObjects(id, refs, 0, l1tjetIds_.size()); } - void getObjects(int id, VRl1tjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tjetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tjetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tjetIds_[i]) { + void getObjects(int id, VRl1tegamma& refs) const { getObjects(id, refs, 0, l1tegammaIds_.size()); } + void getObjects(int id, VRl1tegamma& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tegammaIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tegammaIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tegammaIds_[i]) { + refs[j] = l1tegammaRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tjet& refs) const { getObjects(ids, refs, 0, l1tjetIds_.size()); } + void getObjects(Vids& ids, VRl1tjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tjetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tjetIds_[i]; refs[j] = l1tjetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1ttau& refs) const { getObjects(ids, refs, 0, l1ttauIds_.size()); } - void getObjects(Vids& ids, VRl1ttau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttauIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1ttauIds_[i]; - refs[j] = l1ttauRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1ttau& refs) const { getObjects(id, refs, 0, l1ttauIds_.size()); } - void getObjects(int id, VRl1ttau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttauIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttauIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttauIds_[i]) { + void getObjects(int id, VRl1tjet& refs) const { getObjects(id, refs, 0, l1tjetIds_.size()); } + void getObjects(int id, VRl1tjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tjetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tjetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tjetIds_[i]) { + refs[j] = l1tjetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1ttau& refs) const { getObjects(ids, refs, 0, l1ttauIds_.size()); } + void getObjects(Vids& ids, VRl1ttau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttauIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1ttauIds_[i]; refs[j] = l1ttauRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tetsum& refs) const { getObjects(ids, refs, 0, l1tetsumIds_.size()); } - void getObjects(Vids& ids, VRl1tetsum& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tetsumIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tetsumIds_[i]; - refs[j] = l1tetsumRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tetsum& refs) const { getObjects(id, refs, 0, l1tetsumIds_.size()); } - void getObjects(int id, VRl1tetsum& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tetsumIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tetsumIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tetsumIds_[i]) { + void getObjects(int id, VRl1ttau& refs) const { getObjects(id, refs, 0, l1ttauIds_.size()); } + void getObjects(int id, VRl1ttau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttauIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttauIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttauIds_[i]) { + refs[j] = l1ttauRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tetsum& refs) const { getObjects(ids, refs, 0, l1tetsumIds_.size()); } + void getObjects(Vids& ids, VRl1tetsum& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tetsumIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tetsumIds_[i]; refs[j] = l1tetsumRefs_[i]; ++j; } } - return; - } - - /* Phase-2 */ - void getObjects(Vids& ids, VRl1ttkmuon& refs) const { getObjects(ids, refs, 0, l1ttkmuonIds_.size()); } - void getObjects(Vids& ids, VRl1ttkmuon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttkmuonIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1ttkmuonIds_[i]; - refs[j] = l1ttkmuonRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1ttkmuon& refs) const { getObjects(id, refs, 0, l1ttkmuonIds_.size()); } - void getObjects(int id, VRl1ttkmuon& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttkmuonIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttkmuonIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttkmuonIds_[i]) { + void getObjects(int id, VRl1tetsum& refs) const { getObjects(id, refs, 0, l1tetsumIds_.size()); } + void getObjects(int id, VRl1tetsum& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tetsumIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tetsumIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tetsumIds_[i]) { + refs[j] = l1tetsumRefs_[i]; + ++j; + } + } + return; + } + + /* Phase-2 */ + void getObjects(Vids& ids, VRl1ttkmuon& refs) const { getObjects(ids, refs, 0, l1ttkmuonIds_.size()); } + void getObjects(Vids& ids, VRl1ttkmuon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttkmuonIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1ttkmuonIds_[i]; refs[j] = l1ttkmuonRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1ttkele& refs) const { getObjects(ids, refs, 0, l1ttkeleIds_.size()); } - void getObjects(Vids& ids, VRl1ttkele& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttkeleIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1ttkeleIds_[i]; - refs[j] = l1ttkeleRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1ttkele& refs) const { getObjects(id, refs, 0, l1ttkeleIds_.size()); } - void getObjects(int id, VRl1ttkele& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttkeleIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttkeleIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttkeleIds_[i]) { + void getObjects(int id, VRl1ttkmuon& refs) const { getObjects(id, refs, 0, l1ttkmuonIds_.size()); } + void getObjects(int id, VRl1ttkmuon& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttkmuonIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttkmuonIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttkmuonIds_[i]) { + refs[j] = l1ttkmuonRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1ttkele& refs) const { getObjects(ids, refs, 0, l1ttkeleIds_.size()); } + void getObjects(Vids& ids, VRl1ttkele& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttkeleIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1ttkeleIds_[i]; refs[j] = l1ttkeleRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1ttkem& refs) const { getObjects(ids, refs, 0, l1ttkemIds_.size()); } - void getObjects(Vids& ids, VRl1ttkem& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttkemIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1ttkemIds_[i]; - refs[j] = l1ttkemRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1ttkem& refs) const { getObjects(id, refs, 0, l1ttkemIds_.size()); } - void getObjects(int id, VRl1ttkem& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1ttkemIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttkemIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1ttkemIds_[i]) { + void getObjects(int id, VRl1ttkele& refs) const { getObjects(id, refs, 0, l1ttkeleIds_.size()); } + void getObjects(int id, VRl1ttkele& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttkeleIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttkeleIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttkeleIds_[i]) { + refs[j] = l1ttkeleRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1ttkem& refs) const { getObjects(ids, refs, 0, l1ttkemIds_.size()); } + void getObjects(Vids& ids, VRl1ttkem& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttkemIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1ttkemIds_[i]; refs[j] = l1ttkemRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tpfjet& refs) const { getObjects(ids, refs, 0, l1tpfjetIds_.size()); } - void getObjects(Vids& ids, VRl1tpfjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tpfjetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tpfjetIds_[i]; - refs[j] = l1tpfjetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tpfjet& refs) const { getObjects(id, refs, 0, l1tpfjetIds_.size()); } - void getObjects(int id, VRl1tpfjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tpfjetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tpfjetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tpfjetIds_[i]) { + void getObjects(int id, VRl1ttkem& refs) const { getObjects(id, refs, 0, l1ttkemIds_.size()); } + void getObjects(int id, VRl1ttkem& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1ttkemIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttkemIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1ttkemIds_[i]) { + refs[j] = l1ttkemRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tpfjet& refs) const { getObjects(ids, refs, 0, l1tpfjetIds_.size()); } + void getObjects(Vids& ids, VRl1tpfjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tpfjetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tpfjetIds_[i]; refs[j] = l1tpfjetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tpftau& refs) const { getObjects(ids, refs, 0, l1tpftauIds_.size()); } - void getObjects(Vids& ids, VRl1tpftau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tpftauIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tpftauIds_[i]; - refs[j] = l1tpftauRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tpftau& refs) const { getObjects(id, refs, 0, l1tpftauIds_.size()); } - void getObjects(int id, VRl1tpftau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tpftauIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tpftauIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tpftauIds_[i]) { + void getObjects(int id, VRl1tpfjet& refs) const { getObjects(id, refs, 0, l1tpfjetIds_.size()); } + void getObjects(int id, VRl1tpfjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tpfjetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tpfjetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tpfjetIds_[i]) { + refs[j] = l1tpfjetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tpftau& refs) const { getObjects(ids, refs, 0, l1tpftauIds_.size()); } + void getObjects(Vids& ids, VRl1tpftau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tpftauIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tpftauIds_[i]; refs[j] = l1tpftauRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1thpspftau& refs) const { getObjects(ids, refs, 0, l1thpspftauIds_.size()); } - void getObjects(Vids& ids, VRl1thpspftau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1thpspftauIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1thpspftauIds_[i]; - refs[j] = l1thpspftauRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1thpspftau& refs) const { getObjects(id, refs, 0, l1thpspftauIds_.size()); } - void getObjects(int id, VRl1thpspftau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1thpspftauIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1thpspftauIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1thpspftauIds_[i]) { + void getObjects(int id, VRl1tpftau& refs) const { getObjects(id, refs, 0, l1tpftauIds_.size()); } + void getObjects(int id, VRl1tpftau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tpftauIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tpftauIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tpftauIds_[i]) { + refs[j] = l1tpftauRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1thpspftau& refs) const { getObjects(ids, refs, 0, l1thpspftauIds_.size()); } + void getObjects(Vids& ids, VRl1thpspftau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1thpspftauIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1thpspftauIds_[i]; refs[j] = l1thpspftauRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tpftrack& refs) const { getObjects(ids, refs, 0, l1tpftrackIds_.size()); } - void getObjects(Vids& ids, VRl1tpftrack& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tpftrackIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tpftrackIds_[i]; - refs[j] = l1tpftrackRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tpftrack& refs) const { getObjects(id, refs, 0, l1tpftrackIds_.size()); } - void getObjects(int id, VRl1tpftrack& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tpftrackIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tpftrackIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tpftrackIds_[i]) { + void getObjects(int id, VRl1thpspftau& refs) const { getObjects(id, refs, 0, l1thpspftauIds_.size()); } + void getObjects(int id, VRl1thpspftau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1thpspftauIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1thpspftauIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1thpspftauIds_[i]) { + refs[j] = l1thpspftauRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tpftrack& refs) const { getObjects(ids, refs, 0, l1tpftrackIds_.size()); } + void getObjects(Vids& ids, VRl1tpftrack& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tpftrackIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tpftrackIds_[i]; refs[j] = l1tpftrackRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tp2etsum& refs) const { getObjects(ids, refs, 0, l1tp2etsumIds_.size()); } - void getObjects(Vids& ids, VRl1tp2etsum& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tp2etsumIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tp2etsumIds_[i]; - refs[j] = l1tp2etsumRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tp2etsum& refs) const { getObjects(id, refs, 0, l1tp2etsumIds_.size()); } - void getObjects(int id, VRl1tp2etsum& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tp2etsumIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tp2etsumIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tp2etsumIds_[i]) { + void getObjects(int id, VRl1tpftrack& refs) const { getObjects(id, refs, 0, l1tpftrackIds_.size()); } + void getObjects(int id, VRl1tpftrack& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tpftrackIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tpftrackIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tpftrackIds_[i]) { + refs[j] = l1tpftrackRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tp2etsum& refs) const { getObjects(ids, refs, 0, l1tp2etsumIds_.size()); } + void getObjects(Vids& ids, VRl1tp2etsum& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tp2etsumIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tp2etsumIds_[i]; refs[j] = l1tp2etsumRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRpfjet& refs) const { getObjects(ids, refs, 0, pfjetIds_.size()); } - void getObjects(Vids& ids, VRpfjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pfjetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = pfjetIds_[i]; - refs[j] = pfjetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRpfjet& refs) const { getObjects(id, refs, 0, pfjetIds_.size()); } - void getObjects(int id, VRpfjet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pfjetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == pfjetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == pfjetIds_[i]) { + void getObjects(int id, VRl1tp2etsum& refs) const { getObjects(id, refs, 0, l1tp2etsumIds_.size()); } + void getObjects(int id, VRl1tp2etsum& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tp2etsumIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tp2etsumIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tp2etsumIds_[i]) { + refs[j] = l1tp2etsumRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRpfjet& refs) const { getObjects(ids, refs, 0, pfjetIds_.size()); } + void getObjects(Vids& ids, VRpfjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pfjetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = pfjetIds_[i]; refs[j] = pfjetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRpftau& refs) const { getObjects(ids, refs, 0, pftauIds_.size()); } - void getObjects(Vids& ids, VRpftau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pftauIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = pftauIds_[i]; - refs[j] = pftauRefs_[i]; - ++j; - } - } - void getObjects(int id, VRpftau& refs) const { getObjects(id, refs, 0, pftauIds_.size()); } - void getObjects(int id, VRpftau& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pftauIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == pftauIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == pftauIds_[i]) { + void getObjects(int id, VRpfjet& refs) const { getObjects(id, refs, 0, pfjetIds_.size()); } + void getObjects(int id, VRpfjet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pfjetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == pfjetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == pfjetIds_[i]) { + refs[j] = pfjetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRpftau& refs) const { getObjects(ids, refs, 0, pftauIds_.size()); } + void getObjects(Vids& ids, VRpftau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pftauIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = pftauIds_[i]; refs[j] = pftauRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRpfmet& refs) const { getObjects(ids, refs, 0, pfmetIds_.size()); } - void getObjects(Vids& ids, VRpfmet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pfmetIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = pfmetIds_[i]; - refs[j] = pfmetRefs_[i]; - ++j; - } - } - void getObjects(int id, VRpfmet& refs) const { getObjects(id, refs, 0, pfmetIds_.size()); } - void getObjects(int id, VRpfmet& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= pfmetIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == pfmetIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == pfmetIds_[i]) { + void getObjects(int id, VRpftau& refs) const { getObjects(id, refs, 0, pftauIds_.size()); } + void getObjects(int id, VRpftau& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pftauIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == pftauIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == pftauIds_[i]) { + refs[j] = pftauRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRpfmet& refs) const { getObjects(ids, refs, 0, pfmetIds_.size()); } + void getObjects(Vids& ids, VRpfmet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pfmetIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = pfmetIds_[i]; refs[j] = pfmetRefs_[i]; ++j; } } - return; - } - - void getObjects(Vids& ids, VRl1tp2gtcand& refs) const { getObjects(ids, refs, 0, l1tp2gtcandIds_.size()); } - void getObjects(Vids& ids, VRl1tp2gtcand& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tp2gtcandIds_.size()); - const size_type n(end - begin); - ids.resize(n); - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - ids[j] = l1tp2gtcandIds_[i]; - refs[j] = l1tp2gtcandRefs_[i]; - ++j; - } - } - void getObjects(int id, VRl1tp2gtcand& refs) const { getObjects(id, refs, 0, l1tp2gtcandIds_.size()); } - void getObjects(int id, VRl1tp2gtcand& refs, size_type begin, size_type end) const { - assert(begin <= end); - assert(end <= l1tp2gtcandIds_.size()); - size_type n(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tp2gtcandIds_[i]) { - ++n; - } - } - refs.resize(n); - size_type j(0); - for (size_type i = begin; i != end; ++i) { - if (id == l1tp2gtcandIds_[i]) { + void getObjects(int id, VRpfmet& refs) const { getObjects(id, refs, 0, pfmetIds_.size()); } + void getObjects(int id, VRpfmet& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= pfmetIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == pfmetIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == pfmetIds_[i]) { + refs[j] = pfmetRefs_[i]; + ++j; + } + } + return; + } + + void getObjects(Vids& ids, VRl1tp2gtcand& refs) const { getObjects(ids, refs, 0, l1tp2gtcandIds_.size()); } + void getObjects(Vids& ids, VRl1tp2gtcand& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tp2gtcandIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tp2gtcandIds_[i]; refs[j] = l1tp2gtcandRefs_[i]; ++j; } } - return; - } + void getObjects(int id, VRl1tp2gtcand& refs) const { getObjects(id, refs, 0, l1tp2gtcandIds_.size()); } + void getObjects(int id, VRl1tp2gtcand& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tp2gtcandIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tp2gtcandIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tp2gtcandIds_[i]) { + refs[j] = l1tp2gtcandRefs_[i]; + ++j; + } + } + return; + } - /// low-level getters for data members - size_type photonSize() const { return photonIds_.size(); } - const Vids& photonIds() const { return photonIds_; } - const VRphoton& photonRefs() const { return photonRefs_; } + /// low-level getters for data members + size_type photonSize() const { return photonIds_.size(); } + const Vids& photonIds() const { return photonIds_; } + const VRphoton& photonRefs() const { return photonRefs_; } - size_type electronSize() const { return electronIds_.size(); } - const Vids& electronIds() const { return electronIds_; } - const VRelectron& electronRefs() const { return electronRefs_; } + size_type electronSize() const { return electronIds_.size(); } + const Vids& electronIds() const { return electronIds_; } + const VRelectron& electronRefs() const { return electronRefs_; } - size_type muonSize() const { return muonIds_.size(); } - const Vids& muonIds() const { return muonIds_; } - const VRmuon& muonRefs() const { return muonRefs_; } + size_type muonSize() const { return muonIds_.size(); } + const Vids& muonIds() const { return muonIds_; } + const VRmuon& muonRefs() const { return muonRefs_; } - size_type jetSize() const { return jetIds_.size(); } - const Vids& jetIds() const { return jetIds_; } - const VRjet& jetRefs() const { return jetRefs_; } + size_type jetSize() const { return jetIds_.size(); } + const Vids& jetIds() const { return jetIds_; } + const VRjet& jetRefs() const { return jetRefs_; } - size_type compositeSize() const { return compositeIds_.size(); } - const Vids& compositeIds() const { return compositeIds_; } - const VRcomposite& compositeRefs() const { return compositeRefs_; } + size_type compositeSize() const { return compositeIds_.size(); } + const Vids& compositeIds() const { return compositeIds_; } + const VRcomposite& compositeRefs() const { return compositeRefs_; } - size_type basemetSize() const { return basemetIds_.size(); } - const Vids& basemetIds() const { return basemetIds_; } - const VRbasemet& basemetRefs() const { return basemetRefs_; } + size_type basemetSize() const { return basemetIds_.size(); } + const Vids& basemetIds() const { return basemetIds_; } + const VRbasemet& basemetRefs() const { return basemetRefs_; } - size_type calometSize() const { return calometIds_.size(); } - const Vids& calometIds() const { return calometIds_; } - const VRcalomet& calometRefs() const { return calometRefs_; } + size_type calometSize() const { return calometIds_.size(); } + const Vids& calometIds() const { return calometIds_; } + const VRcalomet& calometRefs() const { return calometRefs_; } - size_type pixtrackSize() const { return pixtrackIds_.size(); } - const Vids& pixtrackIds() const { return pixtrackIds_; } - const VRpixtrack& pixtrackRefs() const { return pixtrackRefs_; } + size_type pixtrackSize() const { return pixtrackIds_.size(); } + const Vids& pixtrackIds() const { return pixtrackIds_; } + const VRpixtrack& pixtrackRefs() const { return pixtrackRefs_; } - size_type l1emSize() const { return l1emIds_.size(); } - const Vids& l1emIds() const { return l1emIds_; } - const VRl1em& l1emRefs() const { return l1emRefs_; } + size_type l1emSize() const { return l1emIds_.size(); } + const Vids& l1emIds() const { return l1emIds_; } + const VRl1em& l1emRefs() const { return l1emRefs_; } - size_type l1muonSize() const { return l1muonIds_.size(); } - const Vids& l1muonIds() const { return l1muonIds_; } - const VRl1muon& l1muonRefs() const { return l1muonRefs_; } + size_type l1muonSize() const { return l1muonIds_.size(); } + const Vids& l1muonIds() const { return l1muonIds_; } + const VRl1muon& l1muonRefs() const { return l1muonRefs_; } - size_type l1jetSize() const { return l1jetIds_.size(); } - const Vids& l1jetIds() const { return l1jetIds_; } - const VRl1jet& l1jetRefs() const { return l1jetRefs_; } + size_type l1jetSize() const { return l1jetIds_.size(); } + const Vids& l1jetIds() const { return l1jetIds_; } + const VRl1jet& l1jetRefs() const { return l1jetRefs_; } - size_type l1etmissSize() const { return l1etmissIds_.size(); } - const Vids& l1etmissIds() const { return l1etmissIds_; } - const VRl1etmiss& l1etmissRefs() const { return l1etmissRefs_; } + size_type l1etmissSize() const { return l1etmissIds_.size(); } + const Vids& l1etmissIds() const { return l1etmissIds_; } + const VRl1etmiss& l1etmissRefs() const { return l1etmissRefs_; } - size_type l1hfringsSize() const { return l1hfringsIds_.size(); } - const Vids& l1hfringsIds() const { return l1hfringsIds_; } - const VRl1hfrings& l1hfringsRefs() const { return l1hfringsRefs_; } + size_type l1hfringsSize() const { return l1hfringsIds_.size(); } + const Vids& l1hfringsIds() const { return l1hfringsIds_; } + const VRl1hfrings& l1hfringsRefs() const { return l1hfringsRefs_; } - size_type pfjetSize() const { return pfjetIds_.size(); } - const Vids& pfjetIds() const { return pfjetIds_; } - const VRpfjet& pfjetRefs() const { return pfjetRefs_; } + size_type pfjetSize() const { return pfjetIds_.size(); } + const Vids& pfjetIds() const { return pfjetIds_; } + const VRpfjet& pfjetRefs() const { return pfjetRefs_; } - size_type pftauSize() const { return pftauIds_.size(); } - const Vids& pftauIds() const { return pftauIds_; } - const VRpftau& pftauRefs() const { return pftauRefs_; } + size_type pftauSize() const { return pftauIds_.size(); } + const Vids& pftauIds() const { return pftauIds_; } + const VRpftau& pftauRefs() const { return pftauRefs_; } - size_type pfmetSize() const { return pfmetIds_.size(); } - const Vids& pfmetIds() const { return pfmetIds_; } - const VRpfmet& pfmetRefs() const { return pfmetRefs_; } + size_type pfmetSize() const { return pfmetIds_.size(); } + const Vids& pfmetIds() const { return pfmetIds_; } + const VRpfmet& pfmetRefs() const { return pfmetRefs_; } - size_type l1tmuonSize() const { return l1tmuonIds_.size(); } - const Vids& l1tmuonIds() const { return l1tmuonIds_; } - const VRl1tmuon& l1tmuonRefs() const { return l1tmuonRefs_; } + size_type l1tmuonSize() const { return l1tmuonIds_.size(); } + const Vids& l1tmuonIds() const { return l1tmuonIds_; } + const VRl1tmuon& l1tmuonRefs() const { return l1tmuonRefs_; } - size_type l1tmuonShowerSize() const { return l1tmuonShowerIds_.size(); } - const Vids& l1tmuonShowerIds() const { return l1tmuonShowerIds_; } - const VRl1tmuonShower& l1tmuonShowerRefs() const { return l1tmuonShowerRefs_; } + size_type l1tmuonShowerSize() const { return l1tmuonShowerIds_.size(); } + const Vids& l1tmuonShowerIds() const { return l1tmuonShowerIds_; } + const VRl1tmuonShower& l1tmuonShowerRefs() const { return l1tmuonShowerRefs_; } - size_type l1tegammaSize() const { return l1tegammaIds_.size(); } - const Vids& l1tegammaIds() const { return l1tegammaIds_; } - const VRl1tegamma& l1tegammaRefs() const { return l1tegammaRefs_; } + size_type l1tegammaSize() const { return l1tegammaIds_.size(); } + const Vids& l1tegammaIds() const { return l1tegammaIds_; } + const VRl1tegamma& l1tegammaRefs() const { return l1tegammaRefs_; } - size_type l1tjetSize() const { return l1tjetIds_.size(); } - const Vids& l1tjetIds() const { return l1tjetIds_; } - const VRl1tjet& l1tjetRefs() const { return l1tjetRefs_; } + size_type l1tjetSize() const { return l1tjetIds_.size(); } + const Vids& l1tjetIds() const { return l1tjetIds_; } + const VRl1tjet& l1tjetRefs() const { return l1tjetRefs_; } + + /* Phase-2 */ - /* Phase-2 */ + size_type l1ttkmuonSize() const { return l1ttkmuonIds_.size(); } + const Vids& l1ttkmuonIds() const { return l1ttkmuonIds_; } + const VRl1ttkmuon& l1ttkmuonRefs() const { return l1ttkmuonRefs_; } - size_type l1ttkmuonSize() const { return l1ttkmuonIds_.size(); } - const Vids& l1ttkmuonIds() const { return l1ttkmuonIds_; } - const VRl1ttkmuon& l1ttkmuonRefs() const { return l1ttkmuonRefs_; } + size_type l1ttkeleSize() const { return l1ttkeleIds_.size(); } + const Vids& l1ttkeleIds() const { return l1ttkeleIds_; } + const VRl1ttkele& l1ttkeleRefs() const { return l1ttkeleRefs_; } - size_type l1ttkeleSize() const { return l1ttkeleIds_.size(); } - const Vids& l1ttkeleIds() const { return l1ttkeleIds_; } - const VRl1ttkele& l1ttkeleRefs() const { return l1ttkeleRefs_; } + size_type l1ttkemSize() const { return l1ttkemIds_.size(); } + const Vids& l1ttkemIds() const { return l1ttkemIds_; } + const VRl1ttkem& l1ttkemRefs() const { return l1ttkemRefs_; } - size_type l1ttkemSize() const { return l1ttkemIds_.size(); } - const Vids& l1ttkemIds() const { return l1ttkemIds_; } - const VRl1ttkem& l1ttkemRefs() const { return l1ttkemRefs_; } + size_type l1tpfjetSize() const { return l1tpfjetIds_.size(); } + const Vids& l1tpfjetIds() const { return l1tpfjetIds_; } + const VRl1tpfjet& l1tpfjetRefs() const { return l1tpfjetRefs_; } - size_type l1tpfjetSize() const { return l1tpfjetIds_.size(); } - const Vids& l1tpfjetIds() const { return l1tpfjetIds_; } - const VRl1tpfjet& l1tpfjetRefs() const { return l1tpfjetRefs_; } + size_type l1tpftauSize() const { return l1tpftauIds_.size(); } + const Vids& l1tpftauIds() const { return l1tpftauIds_; } + const VRl1tpftau& l1tpftauRefs() const { return l1tpftauRefs_; } - size_type l1tpftauSize() const { return l1tpftauIds_.size(); } - const Vids& l1tpftauIds() const { return l1tpftauIds_; } - const VRl1tpftau& l1tpftauRefs() const { return l1tpftauRefs_; } + size_type l1thpspftauSize() const { return l1thpspftauIds_.size(); } + const Vids& l1thpspftauIds() const { return l1thpspftauIds_; } + const VRl1thpspftau& l1thpspftauRefs() const { return l1thpspftauRefs_; } - size_type l1thpspftauSize() const { return l1thpspftauIds_.size(); } - const Vids& l1thpspftauIds() const { return l1thpspftauIds_; } - const VRl1thpspftau& l1thpspftauRefs() const { return l1thpspftauRefs_; } + size_type l1tpftrackSize() const { return l1tpftrackIds_.size(); } + const Vids& l1tpftrackIds() const { return l1tpftrackIds_; } + const VRl1tpftrack& l1tpftrackRefs() const { return l1tpftrackRefs_; } - size_type l1tpftrackSize() const { return l1tpftrackIds_.size(); } - const Vids& l1tpftrackIds() const { return l1tpftrackIds_; } - const VRl1tpftrack& l1tpftrackRefs() const { return l1tpftrackRefs_; } + size_type l1tp2etsumSize() const { return l1tp2etsumIds_.size(); } + const Vids& l1tp2etsumIds() const { return l1tp2etsumIds_; } + const VRl1tp2etsum& l1tp2etsumRefs() const { return l1tp2etsumRefs_; } - size_type l1tp2etsumSize() const { return l1tp2etsumIds_.size(); } - const Vids& l1tp2etsumIds() const { return l1tp2etsumIds_; } - const VRl1tp2etsum& l1tp2etsumRefs() const { return l1tp2etsumRefs_; } + size_type l1ttauSize() const { return l1ttauIds_.size(); } + const Vids& l1ttauIds() const { return l1ttauIds_; } + const VRl1ttau& l1ttauRefs() const { return l1ttauRefs_; } - size_type l1ttauSize() const { return l1ttauIds_.size(); } - const Vids& l1ttauIds() const { return l1ttauIds_; } - const VRl1ttau& l1ttauRefs() const { return l1ttauRefs_; } + size_type l1tetsumSize() const { return l1tetsumIds_.size(); } + const Vids& l1tetsumIds() const { return l1tetsumIds_; } + const VRl1tetsum& l1tetsumRefs() const { return l1tetsumRefs_; } - size_type l1tetsumSize() const { return l1tetsumIds_.size(); } - const Vids& l1tetsumIds() const { return l1tetsumIds_; } - const VRl1tetsum& l1tetsumRefs() const { return l1tetsumRefs_; } + size_type l1tp2gtcandSize() const { return l1tp2gtcandIds_.size(); } + const Vids& l1tp2gtcandIds() const { return l1tp2gtcandIds_; } + const VRl1tp2gtcand& l1tp2gtcandRefs() const { return l1tp2gtcandRefs_; } + }; - size_type l1tp2gtcandSize() const { return l1tp2gtcandIds_.size(); } - const Vids& l1tp2gtcandIds() const { return l1tp2gtcandIds_; } - const VRl1tp2gtcand& l1tp2gtcandRefs() const { return l1tp2gtcandRefs_; } - }; + // picked up via argument dependent lookup, e-g- by boost::swap() + inline void swap(TriggerRefsCollections& first, TriggerRefsCollections& second) { first.swap(second); } - // picked up via argument dependent lookup, e-g- by boost::swap() - inline void swap(TriggerRefsCollections& first, TriggerRefsCollections& second) { first.swap(second); } + } // namespace io_v1 + using TriggerRefsCollections = io_v1::TriggerRefsCollections; } // namespace trigger diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index a104854bce32d..73c22f25322c4 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -1,39 +1,31 @@ - - + + - - + + - - + + - - + + - - - + + - - - - - - - @@ -43,68 +35,43 @@ - - - - - - - - + + - - - - - - - - - + + + - - - - - - - - + + - - - - - - - - - - + + + - + - + - - + + - + diff --git a/DataFormats/HcalCalibObjects/src/classes_def.xml b/DataFormats/HcalCalibObjects/src/classes_def.xml index b4b2507b51660..5cfdd444477f3 100644 --- a/DataFormats/HcalCalibObjects/src/classes_def.xml +++ b/DataFormats/HcalCalibObjects/src/classes_def.xml @@ -1,29 +1,21 @@ - - - + + - - - - - - - - + + - - - + + - - + + diff --git a/DataFormats/HcalDetId/src/classes_def.xml b/DataFormats/HcalDetId/src/classes_def.xml index 943ec363bf4eb..bbd632a847101 100644 --- a/DataFormats/HcalDetId/src/classes_def.xml +++ b/DataFormats/HcalDetId/src/classes_def.xml @@ -1,56 +1,33 @@ - - - - - - - - - - - - rawId())); - *newObj=tmp; - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - rawId())); - *newObj=tmp; - ]]> - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/HcalDigi/interface/HBHEDataFrame.h b/DataFormats/HcalDigi/interface/HBHEDataFrame.h index c8c2ad54a2957..a558b6c4d0216 100644 --- a/DataFormats/HcalDigi/interface/HBHEDataFrame.h +++ b/DataFormats/HcalDigi/interface/HBHEDataFrame.h @@ -11,97 +11,99 @@ Precision readout digi for HB and HE. */ -class HBHEDataFrame { -public: - typedef HcalDetId key_type; ///< For the sorted collection +namespace io_v1 { + class HBHEDataFrame { + public: + typedef HcalDetId key_type; ///< For the sorted collection - constexpr HBHEDataFrame() : id_(0), size_(0), hcalPresamples_(0) {} - constexpr explicit HBHEDataFrame(const HcalDetId& id) : id_(id), size_(0), hcalPresamples_(0) { - // TODO : test id for HcalBarrel or HcalEndcap - } - - constexpr const HcalDetId& id() const { return id_; } - constexpr const HcalElectronicsId& elecId() const { return electronicsId_; } + constexpr HBHEDataFrame() : id_(0), size_(0), hcalPresamples_(0) {} + constexpr explicit HBHEDataFrame(const HcalDetId& id) : id_(id), size_(0), hcalPresamples_(0) { + // TODO : test id for HcalBarrel or HcalEndcap + } - /// total number of samples in the digi - constexpr int size() const { return size_ & 0xF; } - /// number of samples before the sample from the triggered beam crossing (according to the hardware) - constexpr int presamples() const { return hcalPresamples_ & 0xF; } - /// was ZS MarkAndPass? - constexpr bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } - /// was ZS unsuppressed? - constexpr bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } - /// zs crossing mask (which sums considered) - constexpr uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } + constexpr const HcalDetId& id() const { return id_; } + constexpr const HcalElectronicsId& elecId() const { return electronicsId_; } - /// access a sample - constexpr HcalQIESample const& operator[](int i) const { return data_[i]; } - /// access a sample - constexpr HcalQIESample const& sample(int i) const { return data_[i]; } + /// total number of samples in the digi + constexpr int size() const { return size_ & 0xF; } + /// number of samples before the sample from the triggered beam crossing (according to the hardware) + constexpr int presamples() const { return hcalPresamples_ & 0xF; } + /// was ZS MarkAndPass? + constexpr bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } + /// was ZS unsuppressed? + constexpr bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } + /// zs crossing mask (which sums considered) + constexpr uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } - /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) - constexpr int fiberIdleOffset() const { - int val = (hcalPresamples_ & 0xF00) >> 8; - return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); - } + /// access a sample + constexpr HcalQIESample const& operator[](int i) const { return data_[i]; } + /// access a sample + constexpr HcalQIESample const& sample(int i) const { return data_[i]; } - /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) - constexpr bool validate(int firstSample = 0, int nSamples = 100) const { - int capid = -1; - bool ok = true; - for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { - if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) - ok = false; - if (i == 0) - capid = data_[i + firstSample].capid(); - if (capid != data_[i + firstSample].capid()) - ok = false; - capid = (capid + 1) % 4; + /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) + constexpr int fiberIdleOffset() const { + int val = (hcalPresamples_ & 0xF00) >> 8; + return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); } - return ok; - } - constexpr void setSize(int size) { - if (size > MAXSAMPLES) - size_ = MAXSAMPLES; - else if (size <= 0) - size_ = 0; - else - size_ = size; - } - constexpr void setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } - constexpr void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0) { - hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset - if (markAndPass) - hcalPresamples_ |= 0x10; - if (unsuppressed) - hcalPresamples_ |= 0x20; - hcalPresamples_ |= (crossingMask & 0x3FF) << 12; - } - constexpr void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } - constexpr void setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } - constexpr void setFiberIdleOffset(int offset) { - hcalPresamples_ &= 0x7FFFF0FF; - if (offset >= 7) - hcalPresamples_ |= 0xF00; - else if (offset >= 0) - hcalPresamples_ |= (0x800) | (offset << 8); - else if (offset >= -7) - hcalPresamples_ |= ((-offset) << 8); - else - hcalPresamples_ |= 0x700; - } + /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) + constexpr bool validate(int firstSample = 0, int nSamples = 100) const { + int capid = -1; + bool ok = true; + for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { + if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) + ok = false; + if (i == 0) + capid = data_[i + firstSample].capid(); + if (capid != data_[i + firstSample].capid()) + ok = false; + capid = (capid + 1) % 4; + } + return ok; + } - static const int MAXSAMPLES = 10; + constexpr void setSize(int size) { + if (size > MAXSAMPLES) + size_ = MAXSAMPLES; + else if (size <= 0) + size_ = 0; + else + size_ = size; + } + constexpr void setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } + constexpr void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0) { + hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset + if (markAndPass) + hcalPresamples_ |= 0x10; + if (unsuppressed) + hcalPresamples_ |= 0x20; + hcalPresamples_ |= (crossingMask & 0x3FF) << 12; + } + constexpr void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } + constexpr void setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } + constexpr void setFiberIdleOffset(int offset) { + hcalPresamples_ &= 0x7FFFF0FF; + if (offset >= 7) + hcalPresamples_ |= 0xF00; + else if (offset >= 0) + hcalPresamples_ |= (0x800) | (offset << 8); + else if (offset >= -7) + hcalPresamples_ |= ((-offset) << 8); + else + hcalPresamples_ |= 0x700; + } -private: - HcalDetId id_; - HcalElectronicsId electronicsId_; - int size_; - int hcalPresamples_; - HcalQIESample data_[MAXSAMPLES]; -}; + static const int MAXSAMPLES = 10; -std::ostream& operator<<(std::ostream&, const HBHEDataFrame&); + private: + HcalDetId id_; + HcalElectronicsId electronicsId_; + int size_; + int hcalPresamples_; + HcalQIESample data_[MAXSAMPLES]; + }; + std::ostream& operator<<(std::ostream&, const HBHEDataFrame&); +} // namespace io_v1 +using HBHEDataFrame = io_v1::HBHEDataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/HBHEDataFrameFwd.h b/DataFormats/HcalDigi/interface/HBHEDataFrameFwd.h index b35111146c1fb..db119c215b823 100644 --- a/DataFormats/HcalDigi/interface/HBHEDataFrameFwd.h +++ b/DataFormats/HcalDigi/interface/HBHEDataFrameFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_HcalDigi_HBHEDataFrameFwd_h #define DataFormats_HcalDigi_HBHEDataFrameFwd_h -class HBHEDataFrame; +namespace io_v1 { + class HBHEDataFrame; +} +using HBHEDataFrame = io_v1::HBHEDataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/HFDataFrame.h b/DataFormats/HcalDigi/interface/HFDataFrame.h index 12157e574b0b7..ea08c3447b8d0 100644 --- a/DataFormats/HcalDigi/interface/HFDataFrame.h +++ b/DataFormats/HcalDigi/interface/HFDataFrame.h @@ -11,97 +11,99 @@ Precision readout digi for HF */ -class HFDataFrame { -public: - typedef HcalDetId key_type; ///< For the sorted collection +namespace io_v1 { + class HFDataFrame { + public: + typedef HcalDetId key_type; ///< For the sorted collection - constexpr HFDataFrame() : id_(0), size_(0), hcalPresamples_(0) {} - constexpr explicit HFDataFrame(const HcalDetId& id) - : id_(id), size_(0), hcalPresamples_(0) { // TODO : test id for HcalForward - } - - constexpr HcalDetId const& id() const { return id_; } - constexpr HcalElectronicsId const& elecId() const { return electronicsId_; } + constexpr HFDataFrame() : id_(0), size_(0), hcalPresamples_(0) {} + constexpr explicit HFDataFrame(const HcalDetId& id) + : id_(id), size_(0), hcalPresamples_(0) { // TODO : test id for HcalForward + } - /// total number of samples in the digi - constexpr int size() const { return size_ & 0xF; } - /// number of samples before the sample from the triggered beam crossing (according to the hardware) - constexpr int presamples() const { return hcalPresamples_ & 0xF; } - /// was ZS MarkAndPass? - constexpr bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } - /// was ZS unsuppressed? - constexpr bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } - /// zs crossing mask (which sums considered) - constexpr uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } + constexpr HcalDetId const& id() const { return id_; } + constexpr HcalElectronicsId const& elecId() const { return electronicsId_; } - /// access a sample - constexpr HcalQIESample const& operator[](int i) const { return data_[i]; } - /// access a sample - constexpr HcalQIESample const& sample(int i) const { return data_[i]; } + /// total number of samples in the digi + constexpr int size() const { return size_ & 0xF; } + /// number of samples before the sample from the triggered beam crossing (according to the hardware) + constexpr int presamples() const { return hcalPresamples_ & 0xF; } + /// was ZS MarkAndPass? + constexpr bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } + /// was ZS unsuppressed? + constexpr bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } + /// zs crossing mask (which sums considered) + constexpr uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } - /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) - constexpr int fiberIdleOffset() const { - int val = (hcalPresamples_ & 0xF00) >> 8; - return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); - } + /// access a sample + constexpr HcalQIESample const& operator[](int i) const { return data_[i]; } + /// access a sample + constexpr HcalQIESample const& sample(int i) const { return data_[i]; } - /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) - constexpr bool validate(int firstSample = 0, int nSamples = 100) const { - int capid = -1; - bool ok = true; - for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { - if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) - ok = false; - if (i == 0) - capid = data_[i + firstSample].capid(); - if (capid != data_[i + firstSample].capid()) - ok = false; - capid = (capid + 1) % 4; + /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) + constexpr int fiberIdleOffset() const { + int val = (hcalPresamples_ & 0xF00) >> 8; + return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); } - return ok; - } - constexpr void setSize(int size) { - if (size > MAXSAMPLES) - size_ = MAXSAMPLES; - else if (size <= 0) - size_ = 0; - else - size_ = size; - } - constexpr void setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } - constexpr void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0) { - hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset - if (markAndPass) - hcalPresamples_ |= 0x10; - if (unsuppressed) - hcalPresamples_ |= 0x20; - hcalPresamples_ |= (crossingMask & 0x3FF) << 12; - } - constexpr void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } - constexpr void setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } - constexpr void setFiberIdleOffset(int offset) { - hcalPresamples_ &= 0x7FFFF0FF; - if (offset >= 7) - hcalPresamples_ |= 0xF00; - else if (offset >= 0) - hcalPresamples_ |= (0x800) | (offset << 8); - else if (offset >= -7) - hcalPresamples_ |= ((-offset) << 8); - else - hcalPresamples_ |= 0x700; - } + /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) + constexpr bool validate(int firstSample = 0, int nSamples = 100) const { + int capid = -1; + bool ok = true; + for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { + if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) + ok = false; + if (i == 0) + capid = data_[i + firstSample].capid(); + if (capid != data_[i + firstSample].capid()) + ok = false; + capid = (capid + 1) % 4; + } + return ok; + } - static const int MAXSAMPLES = 10; + constexpr void setSize(int size) { + if (size > MAXSAMPLES) + size_ = MAXSAMPLES; + else if (size <= 0) + size_ = 0; + else + size_ = size; + } + constexpr void setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } + constexpr void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0) { + hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset + if (markAndPass) + hcalPresamples_ |= 0x10; + if (unsuppressed) + hcalPresamples_ |= 0x20; + hcalPresamples_ |= (crossingMask & 0x3FF) << 12; + } + constexpr void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } + constexpr void setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } + constexpr void setFiberIdleOffset(int offset) { + hcalPresamples_ &= 0x7FFFF0FF; + if (offset >= 7) + hcalPresamples_ |= 0xF00; + else if (offset >= 0) + hcalPresamples_ |= (0x800) | (offset << 8); + else if (offset >= -7) + hcalPresamples_ |= ((-offset) << 8); + else + hcalPresamples_ |= 0x700; + } -private: - HcalDetId id_; - HcalElectronicsId electronicsId_; - int size_; - int hcalPresamples_; - HcalQIESample data_[MAXSAMPLES]; -}; + static const int MAXSAMPLES = 10; -std::ostream& operator<<(std::ostream&, const HFDataFrame&); + private: + HcalDetId id_; + HcalElectronicsId electronicsId_; + int size_; + int hcalPresamples_; + HcalQIESample data_[MAXSAMPLES]; + }; + std::ostream& operator<<(std::ostream&, const HFDataFrame&); +} // namespace io_v1 +using HFDataFrame = io_v1::HFDataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/HFDataFrameFwd.h b/DataFormats/HcalDigi/interface/HFDataFrameFwd.h index 0365b03775c87..7e8d4b4ebac04 100644 --- a/DataFormats/HcalDigi/interface/HFDataFrameFwd.h +++ b/DataFormats/HcalDigi/interface/HFDataFrameFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_HcalDigi_HFDataFrameFwd_h #define DataFormats_HcalDigi_HFDataFrameFwd_h -class HFDataFrame; - +namespace io_v1 { + class HFDataFrame; +} +using HFDataFrame = io_v1::HFDataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/HODataFrame.h b/DataFormats/HcalDigi/interface/HODataFrame.h index 593b29cced06e..72d94c29850c7 100644 --- a/DataFormats/HcalDigi/interface/HODataFrame.h +++ b/DataFormats/HcalDigi/interface/HODataFrame.h @@ -11,97 +11,99 @@ Precision readout digi for HO */ -class HODataFrame { -public: - typedef HcalDetId key_type; ///< For the sorted collection +namespace io_v1 { + class HODataFrame { + public: + typedef HcalDetId key_type; ///< For the sorted collection - HODataFrame() : id_(0), size_(0), hcalPresamples_(0) {} - explicit constexpr HODataFrame(const HcalDetId& id) - : id_(id), size_(0), hcalPresamples_(0) { // TODO : test id for HcalOuter - } - - constexpr HcalDetId const& id() const { return id_; } - constexpr HcalElectronicsId const& elecId() const { return electronicsId_; } + HODataFrame() : id_(0), size_(0), hcalPresamples_(0) {} + explicit constexpr HODataFrame(const HcalDetId& id) + : id_(id), size_(0), hcalPresamples_(0) { // TODO : test id for HcalOuter + } - /// total number of samples in the digi - constexpr int size() const { return size_ & 0xF; } - /// number of samples before the sample from the triggered beam crossing (according to the hardware) - constexpr int presamples() const { return hcalPresamples_ & 0xF; } - /// was ZS MarkAndPass? - constexpr bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } - /// was ZS unsuppressed? - constexpr bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } - /// zs crossing mask (which sums considered) - constexpr uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } + constexpr HcalDetId const& id() const { return id_; } + constexpr HcalElectronicsId const& elecId() const { return electronicsId_; } - /// access a sample - constexpr const HcalQIESample& operator[](int i) const { return data_[i]; } - /// access a sample - constexpr const HcalQIESample& sample(int i) const { return data_[i]; } + /// total number of samples in the digi + constexpr int size() const { return size_ & 0xF; } + /// number of samples before the sample from the triggered beam crossing (according to the hardware) + constexpr int presamples() const { return hcalPresamples_ & 0xF; } + /// was ZS MarkAndPass? + constexpr bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } + /// was ZS unsuppressed? + constexpr bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } + /// zs crossing mask (which sums considered) + constexpr uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } - /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) - constexpr int fiberIdleOffset() const { - int val = (hcalPresamples_ & 0xF00) >> 8; - return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); - } + /// access a sample + constexpr const HcalQIESample& operator[](int i) const { return data_[i]; } + /// access a sample + constexpr const HcalQIESample& sample(int i) const { return data_[i]; } - /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) - constexpr bool validate(int firstSample = 0, int nSamples = 100) const { - int capid = -1; - bool ok = true; - for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { - if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) - ok = false; - if (i == 0) - capid = data_[i + firstSample].capid(); - if (capid != data_[i + firstSample].capid()) - ok = false; - capid = (capid + 1) % 4; + /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) + constexpr int fiberIdleOffset() const { + int val = (hcalPresamples_ & 0xF00) >> 8; + return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); } - return ok; - } - constexpr void setSize(int size) { - if (size > MAXSAMPLES) - size_ = MAXSAMPLES; - else if (size <= 0) - size_ = 0; - else - size_ = size; - } - constexpr void setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } - constexpr void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0) { - hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset - if (markAndPass) - hcalPresamples_ |= 0x10; - if (unsuppressed) - hcalPresamples_ |= 0x20; - hcalPresamples_ |= (crossingMask & 0x3FF) << 12; - } - constexpr void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } - constexpr void setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } - constexpr void setFiberIdleOffset(int offset) { - hcalPresamples_ &= 0xFFFF0FF; - if (offset >= 7) - hcalPresamples_ |= 0xF00; - else if (offset >= 0) - hcalPresamples_ |= (0x800) | (offset << 8); - else if (offset >= -7) - hcalPresamples_ |= ((-offset) << 8); - else - hcalPresamples_ |= 0x700; - } + /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) + constexpr bool validate(int firstSample = 0, int nSamples = 100) const { + int capid = -1; + bool ok = true; + for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { + if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) + ok = false; + if (i == 0) + capid = data_[i + firstSample].capid(); + if (capid != data_[i + firstSample].capid()) + ok = false; + capid = (capid + 1) % 4; + } + return ok; + } - static const int MAXSAMPLES = 10; + constexpr void setSize(int size) { + if (size > MAXSAMPLES) + size_ = MAXSAMPLES; + else if (size <= 0) + size_ = 0; + else + size_ = size; + } + constexpr void setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } + constexpr void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0) { + hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset + if (markAndPass) + hcalPresamples_ |= 0x10; + if (unsuppressed) + hcalPresamples_ |= 0x20; + hcalPresamples_ |= (crossingMask & 0x3FF) << 12; + } + constexpr void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } + constexpr void setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } + constexpr void setFiberIdleOffset(int offset) { + hcalPresamples_ &= 0xFFFF0FF; + if (offset >= 7) + hcalPresamples_ |= 0xF00; + else if (offset >= 0) + hcalPresamples_ |= (0x800) | (offset << 8); + else if (offset >= -7) + hcalPresamples_ |= ((-offset) << 8); + else + hcalPresamples_ |= 0x700; + } -private: - HcalDetId id_; - HcalElectronicsId electronicsId_; - int size_; - int hcalPresamples_; - HcalQIESample data_[MAXSAMPLES]; -}; + static const int MAXSAMPLES = 10; -std::ostream& operator<<(std::ostream&, const HODataFrame&); + private: + HcalDetId id_; + HcalElectronicsId electronicsId_; + int size_; + int hcalPresamples_; + HcalQIESample data_[MAXSAMPLES]; + }; + std::ostream& operator<<(std::ostream&, const HODataFrame&); +} // namespace io_v1 +using HODataFrame = io_v1::HODataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/HODataFrameFwd.h b/DataFormats/HcalDigi/interface/HODataFrameFwd.h index e037c8db34a86..d58d7a29f75c6 100644 --- a/DataFormats/HcalDigi/interface/HODataFrameFwd.h +++ b/DataFormats/HcalDigi/interface/HODataFrameFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_HcalDigi_HODataFrameFwd_h #define DataFormats_HcalDigi_HODataFrameFwd_h -class HODataFrame; - +namespace io_v1 { + class HODataFrame; +} +using HODataFrame = io_v1::HODataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h b/DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h index d667a12fa4f8a..d394796bf7fb5 100644 --- a/DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h +++ b/DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h @@ -10,47 +10,49 @@ \author J. Mans - Minnesota */ -class HcalTriggerPrimitiveDigi { -public: - typedef HcalTrigTowerDetId key_type; ///< For the sorted collection - - HcalTriggerPrimitiveDigi(); // for persistence - explicit HcalTriggerPrimitiveDigi(const HcalTrigTowerDetId& id); - - const HcalTrigTowerDetId& id() const { return id_; } - int size() const { return (size_ & 0xF); } - int presamples() const { return hcalPresamples_ & 0xF; } - - /// was ZS MarkAndPass? - bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } - /// was ZS unsuppressed? - bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } - - void setZSInfo(bool unsuppressed, bool markAndPass); - - const HcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } - const HcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; } - - /// Full "Sample of Interest" - const HcalTriggerPrimitiveSample& t0() const { return data_[presamples()]; } - /// Fine-grain bit for the "Sample of Interest" - bool SOI_fineGrain(int i = 0) const { return t0().fineGrain(i); } - /// Compressed ET for the "Sample of Interest" - int SOI_compressedEt() const { return t0().compressedEt(); } - - void setSize(int size); - void setPresamples(int ps); - void setSample(int i, const HcalTriggerPrimitiveSample& sam) { data_[i] = sam; } - - static const int MAXSAMPLES = 10; - -private: - HcalTrigTowerDetId id_; - int size_; - int hcalPresamples_; - HcalTriggerPrimitiveSample data_[MAXSAMPLES]; -}; - -std::ostream& operator<<(std::ostream& s, const HcalTriggerPrimitiveDigi& digi); - +namespace io_v1 { + class HcalTriggerPrimitiveDigi { + public: + typedef HcalTrigTowerDetId key_type; ///< For the sorted collection + + HcalTriggerPrimitiveDigi(); // for persistence + explicit HcalTriggerPrimitiveDigi(const HcalTrigTowerDetId& id); + + const HcalTrigTowerDetId& id() const { return id_; } + int size() const { return (size_ & 0xF); } + int presamples() const { return hcalPresamples_ & 0xF; } + + /// was ZS MarkAndPass? + bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } + /// was ZS unsuppressed? + bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } + + void setZSInfo(bool unsuppressed, bool markAndPass); + + const HcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } + const HcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; } + + /// Full "Sample of Interest" + const HcalTriggerPrimitiveSample& t0() const { return data_[presamples()]; } + /// Fine-grain bit for the "Sample of Interest" + bool SOI_fineGrain(int i = 0) const { return t0().fineGrain(i); } + /// Compressed ET for the "Sample of Interest" + int SOI_compressedEt() const { return t0().compressedEt(); } + + void setSize(int size); + void setPresamples(int ps); + void setSample(int i, const HcalTriggerPrimitiveSample& sam) { data_[i] = sam; } + + static const int MAXSAMPLES = 10; + + private: + HcalTrigTowerDetId id_; + int size_; + int hcalPresamples_; + HcalTriggerPrimitiveSample data_[MAXSAMPLES]; + }; + + std::ostream& operator<<(std::ostream& s, const HcalTriggerPrimitiveDigi& digi); +} // namespace io_v1 +using HcalTriggerPrimitiveDigi = io_v1::HcalTriggerPrimitiveDigi; #endif diff --git a/DataFormats/HcalDigi/interface/HcalUnpackerReport.h b/DataFormats/HcalDigi/interface/HcalUnpackerReport.h index 75a493d0a48de..a689be45b6dd7 100644 --- a/DataFormats/HcalDigi/interface/HcalUnpackerReport.h +++ b/DataFormats/HcalDigi/interface/HcalUnpackerReport.h @@ -11,75 +11,77 @@ * * \author J. Mans - Minnesota */ -class HcalUnpackerReport { -public: - HcalUnpackerReport(); - const std::vector& getFedsUnpacked() const { return FEDsUnpacked_; } - const std::vector& getFedsError() const { return FEDsError_; } - bool errorFree() const; - bool anyValidHCAL() const; - int unmappedDigis() const { return unmappedDigis_; } - int unmappedTPDigis() const { return unmappedTPDigis_; } - int spigotFormatErrors() const { return spigotFormatErrors_; } - int badQualityDigis() const { return badqualityDigis_; } - int totalDigis() const { return totalDigis_; } - int totalTPDigis() const { return totalTPDigis_; } - int totalHOTPDigis() const { return totalHOTPDigis_; } - int emptyEventSpigots() const { return emptyEventSpigots_; } - int OFWSpigots() const { return ofwSpigots_; } - int busySpigots() const { return busySpigots_; } +namespace io_v1 { + class HcalUnpackerReport { + public: + HcalUnpackerReport(); + const std::vector& getFedsUnpacked() const { return FEDsUnpacked_; } + const std::vector& getFedsError() const { return FEDsError_; } + bool errorFree() const; + bool anyValidHCAL() const; + int unmappedDigis() const { return unmappedDigis_; } + int unmappedTPDigis() const { return unmappedTPDigis_; } + int spigotFormatErrors() const { return spigotFormatErrors_; } + int badQualityDigis() const { return badqualityDigis_; } + int totalDigis() const { return totalDigis_; } + int totalTPDigis() const { return totalTPDigis_; } + int totalHOTPDigis() const { return totalHOTPDigis_; } + int emptyEventSpigots() const { return emptyEventSpigots_; } + int OFWSpigots() const { return ofwSpigots_; } + int busySpigots() const { return busySpigots_; } - bool unsuppressedChannels() const { return unsuppressed_; } + bool unsuppressedChannels() const { return unsuppressed_; } - bool hasFedWithCalib() const { return !fedInfo_.empty(); } - HcalCalibrationEventType fedCalibType(uint16_t fed) const; + bool hasFedWithCalib() const { return !fedInfo_.empty(); } + HcalCalibrationEventType fedCalibType(uint16_t fed) const; - void setFedCalibInfo(uint16_t fed, HcalCalibrationEventType ctype); + void setFedCalibInfo(uint16_t fed, HcalCalibrationEventType ctype); - typedef std::vector DetIdVector; - typedef std::vector ElectronicsIdVector; + typedef std::vector DetIdVector; + typedef std::vector ElectronicsIdVector; - DetIdVector::const_iterator bad_quality_begin() const { return badqualityIds_.begin(); } - DetIdVector::const_iterator bad_quality_end() const { return badqualityIds_.end(); } - ElectronicsIdVector::const_iterator unmapped_begin() const { return unmappedIds_.begin(); } - ElectronicsIdVector::const_iterator unmapped_end() const { return unmappedIds_.end(); } + DetIdVector::const_iterator bad_quality_begin() const { return badqualityIds_.begin(); } + DetIdVector::const_iterator bad_quality_end() const { return badqualityIds_.end(); } + ElectronicsIdVector::const_iterator unmapped_begin() const { return unmappedIds_.begin(); } + ElectronicsIdVector::const_iterator unmapped_end() const { return unmappedIds_.end(); } - bool hasReportInfo(const std::string& name) const; - std::string getReportInfo(const std::string& name) const; - std::vector getReportKeys() const; + bool hasReportInfo(const std::string& name) const; + std::string getReportInfo(const std::string& name) const; + std::vector getReportKeys() const; - // setters - void addUnpacked(int fed); - void addError(int fed); - void countDigi(); - void countTPDigi(bool ho = false); - void countUnmappedDigi(); - void countUnmappedTPDigi(); - void countSpigotFormatError(); - void countBadQualityDigi(); - void countEmptyEventSpigot(); - void countOFWSpigot(); - void countBusySpigot(); - void countUnmappedDigi(const HcalElectronicsId& eid); - void countUnmappedTPDigi(const HcalElectronicsId& eid); - void countBadQualityDigi(const DetId& did); - void setUnsuppressed(bool isSup); - void setReportInfo(const std::string& name, const std::string& value); + // setters + void addUnpacked(int fed); + void addError(int fed); + void countDigi(); + void countTPDigi(bool ho = false); + void countUnmappedDigi(); + void countUnmappedTPDigi(); + void countSpigotFormatError(); + void countBadQualityDigi(); + void countEmptyEventSpigot(); + void countOFWSpigot(); + void countBusySpigot(); + void countUnmappedDigi(const HcalElectronicsId& eid); + void countUnmappedTPDigi(const HcalElectronicsId& eid); + void countBadQualityDigi(const DetId& did); + void setUnsuppressed(bool isSup); + void setReportInfo(const std::string& name, const std::string& value); -private: - std::vector FEDsUnpacked_; - std::vector FEDsError_; - int unmappedDigis_, unmappedTPDigis_; - int spigotFormatErrors_, badqualityDigis_; - int totalDigis_, totalTPDigis_, totalHOTPDigis_; - DetIdVector badqualityIds_; - ElectronicsIdVector unmappedIds_; - bool unsuppressed_; + private: + std::vector FEDsUnpacked_; + std::vector FEDsError_; + int unmappedDigis_, unmappedTPDigis_; + int spigotFormatErrors_, badqualityDigis_; + int totalDigis_, totalTPDigis_, totalHOTPDigis_; + DetIdVector badqualityIds_; + ElectronicsIdVector unmappedIds_; + bool unsuppressed_; - std::vector reportInfo_; - std::vector fedInfo_; // first is fed, second is type - - int emptyEventSpigots_, ofwSpigots_, busySpigots_; -}; + std::vector reportInfo_; + std::vector fedInfo_; // first is fed, second is type + int emptyEventSpigots_, ofwSpigots_, busySpigots_; + }; +} // namespace io_v1 +using HcalUnpackerReport = io_v1::HcalUnpackerReport; #endif diff --git a/DataFormats/HcalDigi/interface/QIE10DataFrame.h b/DataFormats/HcalDigi/interface/QIE10DataFrame.h index 15892a9db8aed..dcf4faadafac3 100644 --- a/DataFormats/HcalDigi/interface/QIE10DataFrame.h +++ b/DataFormats/HcalDigi/interface/QIE10DataFrame.h @@ -8,129 +8,137 @@ /** Precision readout digi from QIE10 including TDC information */ -class QIE10DataFrame { -public: - static const int WORDS_PER_SAMPLE = 2; - static const int HEADER_WORDS = 1; - static const int FLAG_WORDS = 1; +namespace io_v1 { + class QIE10DataFrame { + public: + static const int WORDS_PER_SAMPLE = 2; + static const int HEADER_WORDS = 1; + static const int FLAG_WORDS = 1; - constexpr QIE10DataFrame() {} - constexpr QIE10DataFrame(edm::DataFrame const& df) : m_data(df) {} + constexpr QIE10DataFrame() {} + constexpr QIE10DataFrame(edm::DataFrame const& df) : m_data(df) {} - class Sample { - public: - typedef uint32_t wide_type; + class Sample { + public: + typedef uint32_t wide_type; - constexpr Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) - : word1_(frame[i]), word2_(frame[i + 1]) {} - constexpr Sample(const edm::DataFrame::data_type& word1, const edm::DataFrame::data_type& word2) - : word1_(word1), word2_(word2) {} - explicit Sample(const wide_type wide) : word1_{0}, word2_{0} { - static_assert(sizeof(wide) == 2 * sizeof(word1_), "The wide input type must be able to contain two words"); - const edm::DataFrame::data_type* ptr = reinterpret_cast(&wide); - word1_ = ptr[0]; - word2_ = ptr[1]; - } + constexpr Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) + : word1_(frame[i]), word2_(frame[i + 1]) {} + constexpr Sample(const edm::DataFrame::data_type& word1, const edm::DataFrame::data_type& word2) + : word1_(word1), word2_(word2) {} + explicit Sample(const wide_type wide) : word1_{0}, word2_{0} { + static_assert(sizeof(wide) == 2 * sizeof(word1_), "The wide input type must be able to contain two words"); + const edm::DataFrame::data_type* ptr = reinterpret_cast(&wide); + word1_ = ptr[0]; + word2_ = ptr[1]; + } - static const int MASK_ADC = 0xFF; - static const int MASK_LE_TDC = 0x3F; - static const int MASK_TE_TDC = 0x1F; - static const int OFFSET_TE_TDC = 6; - static const int MASK_SOI = 0x2000; - static const int MASK_OK = 0x1000; - static const int MASK_CAPID = 0x3; - static const int OFFSET_CAPID = 12; + static const int MASK_ADC = 0xFF; + static const int MASK_LE_TDC = 0x3F; + static const int MASK_TE_TDC = 0x1F; + static const int OFFSET_TE_TDC = 6; + static const int MASK_SOI = 0x2000; + static const int MASK_OK = 0x1000; + static const int MASK_CAPID = 0x3; + static const int OFFSET_CAPID = 12; - constexpr inline int adc() const { return word1_ & MASK_ADC; } - constexpr inline int le_tdc() const { return word2_ & MASK_LE_TDC; } - constexpr inline int te_tdc() const { return (word2_ >> OFFSET_TE_TDC) & MASK_TE_TDC; } - constexpr inline bool ok() const { return word1_ & MASK_OK; } - constexpr inline bool soi() const { return word1_ & MASK_SOI; } - constexpr inline int capid() const { return (word2_ >> OFFSET_CAPID) & MASK_CAPID; } - constexpr inline edm::DataFrame::data_type raw(edm::DataFrame::size_type i) const { - return (i > WORDS_PER_SAMPLE) ? 0 : ((i == 1) ? word2_ : word1_); - } - QIE10DataFrame::Sample::wide_type wideRaw() const { - static_assert(sizeof(QIE10DataFrame::Sample::wide_type) == 2 * sizeof(word1_), - "The wide result type must be able to contain two words"); - wide_type result = 0; - edm::DataFrame::data_type* ptr = reinterpret_cast(&result); - ptr[0] = word1_; - ptr[1] = word2_; - return result; - } + constexpr inline int adc() const { return word1_ & MASK_ADC; } + constexpr inline int le_tdc() const { return word2_ & MASK_LE_TDC; } + constexpr inline int te_tdc() const { return (word2_ >> OFFSET_TE_TDC) & MASK_TE_TDC; } + constexpr inline bool ok() const { return word1_ & MASK_OK; } + constexpr inline bool soi() const { return word1_ & MASK_SOI; } + constexpr inline int capid() const { return (word2_ >> OFFSET_CAPID) & MASK_CAPID; } + constexpr inline edm::DataFrame::data_type raw(edm::DataFrame::size_type i) const { + return (i > WORDS_PER_SAMPLE) ? 0 : ((i == 1) ? word2_ : word1_); + } + QIE10DataFrame::Sample::wide_type wideRaw() const { + static_assert(sizeof(QIE10DataFrame::Sample::wide_type) == 2 * sizeof(word1_), + "The wide result type must be able to contain two words"); + wide_type result = 0; + edm::DataFrame::data_type* ptr = reinterpret_cast(&result); + ptr[0] = word1_; + ptr[1] = word2_; + return result; + } - private: - edm::DataFrame::data_type word1_; - edm::DataFrame::data_type word2_; - }; + private: + edm::DataFrame::data_type word1_; + edm::DataFrame::data_type word2_; + }; - constexpr void copyContent(const QIE10DataFrame& digi) { - for (edm::DataFrame::size_type i = 0; i < size() && i < digi.size(); i++) { - Sample sam = digi[i]; - setSample(i, sam.adc(), sam.le_tdc(), sam.te_tdc(), sam.capid(), sam.soi(), sam.ok()); + constexpr void copyContent(const QIE10DataFrame& digi) { + for (edm::DataFrame::size_type i = 0; i < size() && i < digi.size(); i++) { + Sample sam = digi[i]; + setSample(i, sam.adc(), sam.le_tdc(), sam.te_tdc(), sam.capid(), sam.soi(), sam.ok()); + } } - } - /// Get the detector id - constexpr DetId detid() const { return DetId(m_data.id()); } - constexpr edm::DataFrame::id_type id() const { return m_data.id(); } - /// more accessors - constexpr edm::DataFrame::size_type size() const { return m_data.size(); } - /// iterators - constexpr edm::DataFrame::iterator begin() { return m_data.begin(); } - constexpr edm::DataFrame::iterator end() { return m_data.end(); } - constexpr edm::DataFrame::const_iterator begin() const { return m_data.begin(); } - constexpr edm::DataFrame::const_iterator end() const { return m_data.end(); } - /// total number of samples in the digi - constexpr int samples() const { return (size() - HEADER_WORDS - FLAG_WORDS) / WORDS_PER_SAMPLE; } - /// for backward compatibility - constexpr int presamples() const { - for (int i = 0; i < samples(); i++) { - if ((*this)[i].soi()) - return i; + /// Get the detector id + constexpr DetId detid() const { return DetId(m_data.id()); } + constexpr edm::DataFrame::id_type id() const { return m_data.id(); } + /// more accessors + constexpr edm::DataFrame::size_type size() const { return m_data.size(); } + /// iterators + constexpr edm::DataFrame::iterator begin() { return m_data.begin(); } + constexpr edm::DataFrame::iterator end() { return m_data.end(); } + constexpr edm::DataFrame::const_iterator begin() const { return m_data.begin(); } + constexpr edm::DataFrame::const_iterator end() const { return m_data.end(); } + /// total number of samples in the digi + constexpr int samples() const { return (size() - HEADER_WORDS - FLAG_WORDS) / WORDS_PER_SAMPLE; } + /// for backward compatibility + constexpr int presamples() const { + for (int i = 0; i < samples(); i++) { + if ((*this)[i].soi()) + return i; + } + return -1; } - return -1; - } - /// get the flavor of the frame - static const int OFFSET_FLAVOR = 12; - static const int MASK_FLAVOR = 0x7; - constexpr int flavor() const { return ((m_data[0] >> OFFSET_FLAVOR) & MASK_FLAVOR); } - /// was there a link error? - static const int MASK_LINKERROR = 0x800; - constexpr bool linkError() const { return m_data[0] & MASK_LINKERROR; } - /// was this a mark-and-pass ZS event? - static const int MASK_MARKPASS = 0x100; - constexpr bool zsMarkAndPass() const { return m_data[0] & MASK_MARKPASS; } - /// set ZS params - constexpr void setZSInfo(bool markAndPass) { - if (markAndPass) - m_data[0] |= MASK_MARKPASS; - } - /// get the sample - constexpr inline Sample operator[](edm::DataFrame::size_type i) const { - return Sample(m_data, i * WORDS_PER_SAMPLE + HEADER_WORDS); - } - /// set the sample contents - constexpr void setSample( - edm::DataFrame::size_type isample, int adc, int le_tdc, int te_tdc, int capid, bool soi = false, bool ok = true) { - if (isample >= size()) - return; - m_data[isample * WORDS_PER_SAMPLE + HEADER_WORDS] = - (adc & Sample::MASK_ADC) | (soi ? (Sample::MASK_SOI) : (0)) | (ok ? (Sample::MASK_OK) : (0)); - m_data[isample * WORDS_PER_SAMPLE + HEADER_WORDS + 1] = - (le_tdc & Sample::MASK_LE_TDC) | ((te_tdc & Sample::MASK_TE_TDC) << Sample::OFFSET_TE_TDC) | - ((capid & Sample::MASK_CAPID) << Sample::OFFSET_CAPID) | 0x4000; // 0x4000 marks this as second word of a pair - } - /// get the flag word - constexpr uint16_t flags() const { return m_data[size() - 1]; } - /// set the flag word - constexpr void setFlags(uint16_t v) { m_data[size() - 1] = v; } - -private: - edm::DataFrame m_data; -}; + /// get the flavor of the frame + static const int OFFSET_FLAVOR = 12; + static const int MASK_FLAVOR = 0x7; + constexpr int flavor() const { return ((m_data[0] >> OFFSET_FLAVOR) & MASK_FLAVOR); } + /// was there a link error? + static const int MASK_LINKERROR = 0x800; + constexpr bool linkError() const { return m_data[0] & MASK_LINKERROR; } + /// was this a mark-and-pass ZS event? + static const int MASK_MARKPASS = 0x100; + constexpr bool zsMarkAndPass() const { return m_data[0] & MASK_MARKPASS; } + /// set ZS params + constexpr void setZSInfo(bool markAndPass) { + if (markAndPass) + m_data[0] |= MASK_MARKPASS; + } + /// get the sample + constexpr inline Sample operator[](edm::DataFrame::size_type i) const { + return Sample(m_data, i * WORDS_PER_SAMPLE + HEADER_WORDS); + } + /// set the sample contents + constexpr void setSample(edm::DataFrame::size_type isample, + int adc, + int le_tdc, + int te_tdc, + int capid, + bool soi = false, + bool ok = true) { + if (isample >= size()) + return; + m_data[isample * WORDS_PER_SAMPLE + HEADER_WORDS] = + (adc & Sample::MASK_ADC) | (soi ? (Sample::MASK_SOI) : (0)) | (ok ? (Sample::MASK_OK) : (0)); + m_data[isample * WORDS_PER_SAMPLE + HEADER_WORDS + 1] = + (le_tdc & Sample::MASK_LE_TDC) | ((te_tdc & Sample::MASK_TE_TDC) << Sample::OFFSET_TE_TDC) | + ((capid & Sample::MASK_CAPID) << Sample::OFFSET_CAPID) | + 0x4000; // 0x4000 marks this as second word of a pair + } + /// get the flag word + constexpr uint16_t flags() const { return m_data[size() - 1]; } + /// set the flag word + constexpr void setFlags(uint16_t v) { m_data[size() - 1] = v; } -std::ostream& operator<<(std::ostream&, const QIE10DataFrame&); + private: + edm::DataFrame m_data; + }; + std::ostream& operator<<(std::ostream&, const QIE10DataFrame&); +} // namespace io_v1 +using QIE10DataFrame = io_v1::QIE10DataFrame; #endif // DATAFORMATS_HCALDIGI_QIE10DATAFRAME_H diff --git a/DataFormats/HcalDigi/interface/QIE10DataFrameFwd.h b/DataFormats/HcalDigi/interface/QIE10DataFrameFwd.h index 640bdc0683568..a914e5f1b0f30 100644 --- a/DataFormats/HcalDigi/interface/QIE10DataFrameFwd.h +++ b/DataFormats/HcalDigi/interface/QIE10DataFrameFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_HcalDigi_QIE10DataFrameFwd_h #define DataFormats_HcalDigi_QIE10DataFrameFwd_h -class QIE10DataFrame; +namespace io_v1 { + class QIE10DataFrame; +} +using QIE10DataFrame = io_v1::QIE10DataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/QIE11DataFrame.h b/DataFormats/HcalDigi/interface/QIE11DataFrame.h index d2433a54f8e32..eabe6771e83cf 100644 --- a/DataFormats/HcalDigi/interface/QIE11DataFrame.h +++ b/DataFormats/HcalDigi/interface/QIE11DataFrame.h @@ -8,136 +8,139 @@ /** Precision readout digi from QIE11 including TDC information */ -class QIE11DataFrame { -public: - static const int WORDS_PER_SAMPLE = 1; - static const int HEADER_WORDS = 1; - static const int FLAG_WORDS = 1; +namespace io_v1 { + class QIE11DataFrame { + public: + static const int WORDS_PER_SAMPLE = 1; + static const int HEADER_WORDS = 1; + static const int FLAG_WORDS = 1; - static const int OFFSET_FLAVOR = 12; - static const int MASK_FLAVOR = 0x7; - static const int FLAVOR_HB = 3; - static const int MASK_LINKERROR = 0x800; + static const int OFFSET_FLAVOR = 12; + static const int MASK_FLAVOR = 0x7; + static const int FLAVOR_HB = 3; + static const int MASK_LINKERROR = 0x800; - constexpr QIE11DataFrame() {} - constexpr QIE11DataFrame(edm::DataFrame const& df) : m_data(df) {} + constexpr QIE11DataFrame() {} + constexpr QIE11DataFrame(edm::DataFrame const& df) : m_data(df) {} - class Sample { - public: - constexpr Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : frame_(frame), i_(i) {} - static const int MASK_ADC = 0xFF; - static const int MASK_TDC_HE = 0x3F; - static const int MASK_TDC_HB = 0x3; - static const int OFFSET_TDC = 8; // 8 bits - static const int MASK_SOI = 0x4000; - static const int MASK_LE_HB = 0x2000; - static const int MASK_CAPID = 0x3; - static const int MASK_CAPID_INV_HB = 0xF3FF; - static const int MASK_CAPID_KEEP_HB = 0x0C00; - static const int OFFSET_CAPID_HE = 8; - static const int OFFSET_CAPID_HB = 10; - constexpr int flavor() const { return ((frame_[0] >> OFFSET_FLAVOR) & MASK_FLAVOR); } - constexpr int adc() const { return frame_[i_] & MASK_ADC; } - constexpr int tdc() const { - return (frame_[i_] >> OFFSET_TDC) & ((flavor() == FLAVOR_HB) ? (MASK_TDC_HB) : (MASK_TDC_HE)); - } - constexpr bool soi() const { return frame_[i_] & MASK_SOI; } - constexpr int capid() const { - return (flavor() == FLAVOR_HB) - ? ((frame_[i_] >> OFFSET_CAPID_HB) & MASK_CAPID) - : ((((frame_[0] >> OFFSET_CAPID_HE) & MASK_CAPID) + i_ - HEADER_WORDS) & MASK_CAPID); - } - constexpr bool linkError() const { - return (flavor() == FLAVOR_HB) ? (frame_[i_] & MASK_LE_HB) : (frame_[0] & MASK_LINKERROR); - } + class Sample { + public: + constexpr Sample(const edm::DataFrame& frame, edm::DataFrame::size_type i) : frame_(frame), i_(i) {} + static const int MASK_ADC = 0xFF; + static const int MASK_TDC_HE = 0x3F; + static const int MASK_TDC_HB = 0x3; + static const int OFFSET_TDC = 8; // 8 bits + static const int MASK_SOI = 0x4000; + static const int MASK_LE_HB = 0x2000; + static const int MASK_CAPID = 0x3; + static const int MASK_CAPID_INV_HB = 0xF3FF; + static const int MASK_CAPID_KEEP_HB = 0x0C00; + static const int OFFSET_CAPID_HE = 8; + static const int OFFSET_CAPID_HB = 10; + constexpr int flavor() const { return ((frame_[0] >> OFFSET_FLAVOR) & MASK_FLAVOR); } + constexpr int adc() const { return frame_[i_] & MASK_ADC; } + constexpr int tdc() const { + return (frame_[i_] >> OFFSET_TDC) & ((flavor() == FLAVOR_HB) ? (MASK_TDC_HB) : (MASK_TDC_HE)); + } + constexpr bool soi() const { return frame_[i_] & MASK_SOI; } + constexpr int capid() const { + return (flavor() == FLAVOR_HB) + ? ((frame_[i_] >> OFFSET_CAPID_HB) & MASK_CAPID) + : ((((frame_[0] >> OFFSET_CAPID_HE) & MASK_CAPID) + i_ - HEADER_WORDS) & MASK_CAPID); + } + constexpr bool linkError() const { + return (flavor() == FLAVOR_HB) ? (frame_[i_] & MASK_LE_HB) : (frame_[0] & MASK_LINKERROR); + } - private: - const edm::DataFrame& frame_; - edm::DataFrame::size_type i_; - }; + private: + const edm::DataFrame& frame_; + edm::DataFrame::size_type i_; + }; - constexpr void copyContent(const QIE11DataFrame& digi) { - for (edm::DataFrame::size_type i = 0; i < size() && i < digi.size(); i++) { - Sample sam = digi[i]; - setSample(i, sam.adc(), sam.tdc(), sam.soi()); + constexpr void copyContent(const QIE11DataFrame& digi) { + for (edm::DataFrame::size_type i = 0; i < size() && i < digi.size(); i++) { + Sample sam = digi[i]; + setSample(i, sam.adc(), sam.tdc(), sam.soi()); + } } - } - /// Get the detector id - constexpr DetId detid() const { return DetId(m_data.id()); } - constexpr edm::DataFrame::id_type id() const { return m_data.id(); } - /// more accessors - constexpr edm::DataFrame::size_type size() const { return m_data.size(); } - /// iterators - constexpr edm::DataFrame::iterator begin() { return m_data.begin(); } - constexpr edm::DataFrame::iterator end() { return m_data.end(); } - constexpr edm::DataFrame::const_iterator begin() const { return m_data.begin(); } - constexpr edm::DataFrame::const_iterator end() const { return m_data.end(); } - /// total number of samples in the digi - constexpr int samples() const { return (size() - HEADER_WORDS - FLAG_WORDS) / WORDS_PER_SAMPLE; } - /// for backward compatibility - constexpr int presamples() const { - for (int i = 0; i < samples(); i++) { - if ((*this)[i].soi()) - return i; + /// Get the detector id + constexpr DetId detid() const { return DetId(m_data.id()); } + constexpr edm::DataFrame::id_type id() const { return m_data.id(); } + /// more accessors + constexpr edm::DataFrame::size_type size() const { return m_data.size(); } + /// iterators + constexpr edm::DataFrame::iterator begin() { return m_data.begin(); } + constexpr edm::DataFrame::iterator end() { return m_data.end(); } + constexpr edm::DataFrame::const_iterator begin() const { return m_data.begin(); } + constexpr edm::DataFrame::const_iterator end() const { return m_data.end(); } + /// total number of samples in the digi + constexpr int samples() const { return (size() - HEADER_WORDS - FLAG_WORDS) / WORDS_PER_SAMPLE; } + /// for backward compatibility + constexpr int presamples() const { + for (int i = 0; i < samples(); i++) { + if ((*this)[i].soi()) + return i; + } + return -1; } - return -1; - } - /// get the flavor of the frame - constexpr int flavor() const { return ((m_data[0] >> OFFSET_FLAVOR) & MASK_FLAVOR); } - /// was there a link error? - constexpr bool linkError() const { return m_data[0] & MASK_LINKERROR; } - /// was there a capid rotation error? - static const int MASK_CAPIDERROR = 0x400; - constexpr bool capidError() const { return m_data[0] & MASK_CAPIDERROR; } - /// was this a mark-and-pass ZS event? - constexpr bool zsMarkAndPass() const { return (flavor() == 1); } - /// set ZS params - constexpr void setZSInfo(bool markAndPass) { - if (markAndPass) - m_data[0] |= (markAndPass & MASK_FLAVOR) << OFFSET_FLAVOR; - } - /// get the sample - constexpr inline Sample operator[](edm::DataFrame::size_type i) const { return Sample(m_data, i + HEADER_WORDS); } + /// get the flavor of the frame + constexpr int flavor() const { return ((m_data[0] >> OFFSET_FLAVOR) & MASK_FLAVOR); } + /// was there a link error? + constexpr bool linkError() const { return m_data[0] & MASK_LINKERROR; } + /// was there a capid rotation error? + static const int MASK_CAPIDERROR = 0x400; + constexpr bool capidError() const { return m_data[0] & MASK_CAPIDERROR; } + /// was this a mark-and-pass ZS event? + constexpr bool zsMarkAndPass() const { return (flavor() == 1); } + /// set ZS params + constexpr void setZSInfo(bool markAndPass) { + if (markAndPass) + m_data[0] |= (markAndPass & MASK_FLAVOR) << OFFSET_FLAVOR; + } + /// get the sample + constexpr inline Sample operator[](edm::DataFrame::size_type i) const { return Sample(m_data, i + HEADER_WORDS); } - // set flavor - constexpr void setFlavor(int flavor) { - m_data[0] &= 0x9FFF; // inversion of flavor mask - m_data[0] |= ((flavor & MASK_FLAVOR) << OFFSET_FLAVOR); - } + // set flavor + constexpr void setFlavor(int flavor) { + m_data[0] &= 0x9FFF; // inversion of flavor mask + m_data[0] |= ((flavor & MASK_FLAVOR) << OFFSET_FLAVOR); + } - constexpr void setCapid0(int cap0) { - if (flavor() == FLAVOR_HB) { - for (int i = 0; i < samples(); i++) { - m_data[i + 1] &= Sample::MASK_CAPID_INV_HB; - m_data[i + 1] |= ((cap0 + i) & Sample::MASK_CAPID) << Sample::OFFSET_CAPID_HB; + constexpr void setCapid0(int cap0) { + if (flavor() == FLAVOR_HB) { + for (int i = 0; i < samples(); i++) { + m_data[i + 1] &= Sample::MASK_CAPID_INV_HB; + m_data[i + 1] |= ((cap0 + i) & Sample::MASK_CAPID) << Sample::OFFSET_CAPID_HB; + } + } else { + m_data[0] &= 0xFCFF; // inversion of the capid0 mask + m_data[0] |= ((cap0 & Sample::MASK_CAPID) << Sample::OFFSET_CAPID_HE); } - } else { - m_data[0] &= 0xFCFF; // inversion of the capid0 mask - m_data[0] |= ((cap0 & Sample::MASK_CAPID) << Sample::OFFSET_CAPID_HE); } - } - /// set the sample contents - constexpr void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi = false) { - if (isample >= size()) - return; - if (flavor() == FLAVOR_HB) - m_data[isample + 1] = (adc & Sample::MASK_ADC) | (soi ? (Sample::MASK_SOI) : (0)) | - ((tdc & Sample::MASK_TDC_HB) << Sample::OFFSET_TDC) | - (m_data[isample + 1] & Sample::MASK_CAPID_KEEP_HB); - else - m_data[isample + 1] = (adc & Sample::MASK_ADC) | (soi ? (Sample::MASK_SOI) : (0)) | - ((tdc & Sample::MASK_TDC_HE) << Sample::OFFSET_TDC); - } - /// get the flag word - constexpr uint16_t flags() const { return m_data[size() - 1]; } - /// set the flag word - constexpr void setFlags(uint16_t v) { m_data[size() - 1] = v; } + /// set the sample contents + constexpr void setSample(edm::DataFrame::size_type isample, int adc, int tdc, bool soi = false) { + if (isample >= size()) + return; + if (flavor() == FLAVOR_HB) + m_data[isample + 1] = (adc & Sample::MASK_ADC) | (soi ? (Sample::MASK_SOI) : (0)) | + ((tdc & Sample::MASK_TDC_HB) << Sample::OFFSET_TDC) | + (m_data[isample + 1] & Sample::MASK_CAPID_KEEP_HB); + else + m_data[isample + 1] = (adc & Sample::MASK_ADC) | (soi ? (Sample::MASK_SOI) : (0)) | + ((tdc & Sample::MASK_TDC_HE) << Sample::OFFSET_TDC); + } + /// get the flag word + constexpr uint16_t flags() const { return m_data[size() - 1]; } + /// set the flag word + constexpr void setFlags(uint16_t v) { m_data[size() - 1] = v; } -private: - edm::DataFrame m_data; -}; + private: + edm::DataFrame m_data; + }; -std::ostream& operator<<(std::ostream&, const QIE11DataFrame&); + std::ostream& operator<<(std::ostream&, const QIE11DataFrame&); +} // namespace io_v1 +using QIE11DataFrame = io_v1::QIE11DataFrame; #endif // DATAFORMATS_HCALDIGI_QIE11DATAFRAME_H diff --git a/DataFormats/HcalDigi/interface/QIE11DataFrameFwd.h b/DataFormats/HcalDigi/interface/QIE11DataFrameFwd.h index a67df2c7bc4dc..1b33b0f3b42ea 100644 --- a/DataFormats/HcalDigi/interface/QIE11DataFrameFwd.h +++ b/DataFormats/HcalDigi/interface/QIE11DataFrameFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_HcalDigi_QIE11DataFrameFwd_h #define DataFormats_HcalDigi_QIE11DataFrameFwd_h -class QIE11DataFrame; - +namespace io_v1 { + class QIE11DataFrame; +} +using QIE11DataFrame = io_v1::QIE11DataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/ZDCDataFrame.h b/DataFormats/HcalDigi/interface/ZDCDataFrame.h index 238bc3027b344..4d156d117ff3a 100644 --- a/DataFormats/HcalDigi/interface/ZDCDataFrame.h +++ b/DataFormats/HcalDigi/interface/ZDCDataFrame.h @@ -12,55 +12,57 @@ Precision readout digi for ZDC */ -class ZDCDataFrame { -public: - typedef HcalZDCDetId key_type; ///< For the sorted collection +namespace io_v1 { + class ZDCDataFrame { + public: + typedef HcalZDCDetId key_type; ///< For the sorted collection - ZDCDataFrame(); // for persistence - explicit ZDCDataFrame(const HcalZDCDetId& id); + ZDCDataFrame(); // for persistence + explicit ZDCDataFrame(const HcalZDCDetId& id); - const HcalZDCDetId& id() const { return id_; } - const HcalElectronicsId& elecId() const { return electronicsId_; } + const HcalZDCDetId& id() const { return id_; } + const HcalElectronicsId& elecId() const { return electronicsId_; } - /// total number of samples in the digi - int size() const { return size_ & 0xF; } - /// number of samples before the sample from the triggered beam crossing (according to the hardware) - int presamples() const { return hcalPresamples_ & 0xF; } - /// was ZS MarkAndPass? - bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } - /// was ZS unsuppressed? - bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } - /// zs crossing mask (which sums considered) - uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } + /// total number of samples in the digi + int size() const { return size_ & 0xF; } + /// number of samples before the sample from the triggered beam crossing (according to the hardware) + int presamples() const { return hcalPresamples_ & 0xF; } + /// was ZS MarkAndPass? + bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); } + /// was ZS unsuppressed? + bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); } + /// zs crossing mask (which sums considered) + uint32_t zsCrossingMask() const { return (hcalPresamples_ & 0x3FF000) >> 12; } - /// access a sample - const HcalQIESample& operator[](int i) const { return data_[i]; } - /// access a sample - const HcalQIESample& sample(int i) const { return data_[i]; } + /// access a sample + const HcalQIESample& operator[](int i) const { return data_[i]; } + /// access a sample + const HcalQIESample& sample(int i) const { return data_[i]; } - /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) - int fiberIdleOffset() const; + /// offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) + int fiberIdleOffset() const; - /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) - bool validate(int firstSample = 0, int nSamples = 100) const; + /// validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) + bool validate(int firstSample = 0, int nSamples = 100) const; - void setSize(int size); - void setPresamples(int ps); - void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0); - void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } - void setReadoutIds(const HcalElectronicsId& eid); - void setFiberIdleOffset(int offset); + void setSize(int size); + void setPresamples(int ps); + void setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask = 0); + void setSample(int i, const HcalQIESample& sam) { data_[i] = sam; } + void setReadoutIds(const HcalElectronicsId& eid); + void setFiberIdleOffset(int offset); - static const int MAXSAMPLES = 10; + static const int MAXSAMPLES = 10; -private: - HcalZDCDetId id_; - HcalElectronicsId electronicsId_; - int size_; - int hcalPresamples_; // also contains information about ZS MarkAndPass - HcalQIESample data_[MAXSAMPLES]; -}; - -std::ostream& operator<<(std::ostream&, const ZDCDataFrame&); + private: + HcalZDCDetId id_; + HcalElectronicsId electronicsId_; + int size_; + int hcalPresamples_; // also contains information about ZS MarkAndPass + HcalQIESample data_[MAXSAMPLES]; + }; + std::ostream& operator<<(std::ostream&, const ZDCDataFrame&); +} // namespace io_v1 +using ZDCDataFrame = io_v1::ZDCDataFrame; #endif diff --git a/DataFormats/HcalDigi/interface/ZDCDataFrameFwd.h b/DataFormats/HcalDigi/interface/ZDCDataFrameFwd.h index becff03902464..54be0687601c7 100644 --- a/DataFormats/HcalDigi/interface/ZDCDataFrameFwd.h +++ b/DataFormats/HcalDigi/interface/ZDCDataFrameFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_HcalDigi_ZDCDataFrameFwd_h #define DataFormats_HcalDigi_ZDCDataFrameFwd_h -class ZDCDataFrame; +namespace io_v1 { + class ZDCDataFrame; +} +using ZDCDataFrame = io_v1::ZDCDataFrame; #endif diff --git a/DataFormats/HcalDigi/src/HBHEDataFrame.cc b/DataFormats/HcalDigi/src/HBHEDataFrame.cc index 65212819382e4..ce0bbc4b34989 100644 --- a/DataFormats/HcalDigi/src/HBHEDataFrame.cc +++ b/DataFormats/HcalDigi/src/HBHEDataFrame.cc @@ -1,19 +1,20 @@ #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" - -std::ostream& operator<<(std::ostream& s, const HBHEDataFrame& digi) { - s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; - if (digi.zsUnsuppressed()) - s << " zsUS"; - if (digi.zsMarkAndPass()) - s << " zsM&P"; - if (digi.fiberIdleOffset() != 0) { - if (digi.fiberIdleOffset() == -1000) - s << " nofiberOffset"; - else - s << " fiberOffset=" << digi.fiberIdleOffset(); +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const HBHEDataFrame& digi) { + s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; + if (digi.zsUnsuppressed()) + s << " zsUS"; + if (digi.zsMarkAndPass()) + s << " zsM&P"; + if (digi.fiberIdleOffset() != 0) { + if (digi.fiberIdleOffset() == -1000) + s << " nofiberOffset"; + else + s << " fiberOffset=" << digi.fiberIdleOffset(); + } + s << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; } - s << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/HFDataFrame.cc b/DataFormats/HcalDigi/src/HFDataFrame.cc index 696fd706075f9..13645a7007fa1 100644 --- a/DataFormats/HcalDigi/src/HFDataFrame.cc +++ b/DataFormats/HcalDigi/src/HFDataFrame.cc @@ -1,19 +1,20 @@ #include "DataFormats/HcalDigi/interface/HFDataFrame.h" - -std::ostream& operator<<(std::ostream& s, const HFDataFrame& digi) { - s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; - if (digi.zsUnsuppressed()) - s << " zsUS "; - if (digi.zsMarkAndPass()) - s << " zsM&P "; - if (digi.fiberIdleOffset() != 0) { - if (digi.fiberIdleOffset() == -1000) - s << " nofiberOffset"; - else - s << " fiberOffset=" << digi.fiberIdleOffset(); +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const HFDataFrame& digi) { + s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; + if (digi.zsUnsuppressed()) + s << " zsUS "; + if (digi.zsMarkAndPass()) + s << " zsM&P "; + if (digi.fiberIdleOffset() != 0) { + if (digi.fiberIdleOffset() == -1000) + s << " nofiberOffset"; + else + s << " fiberOffset=" << digi.fiberIdleOffset(); + } + s << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; } - s << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/HODataFrame.cc b/DataFormats/HcalDigi/src/HODataFrame.cc index 0a634ca6b1424..37b841b85d8af 100644 --- a/DataFormats/HcalDigi/src/HODataFrame.cc +++ b/DataFormats/HcalDigi/src/HODataFrame.cc @@ -1,19 +1,21 @@ #include "DataFormats/HcalDigi/interface/HODataFrame.h" -std::ostream& operator<<(std::ostream& s, const HODataFrame& digi) { - s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; - if (digi.zsUnsuppressed()) - s << " zsUS "; - if (digi.zsMarkAndPass()) - s << " zsM&P "; - if (digi.fiberIdleOffset() != 0) { - if (digi.fiberIdleOffset() == -1000) - s << " nofiberOffset"; - else - s << " fiberOffset=" << digi.fiberIdleOffset(); +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const HODataFrame& digi) { + s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; + if (digi.zsUnsuppressed()) + s << " zsUS "; + if (digi.zsMarkAndPass()) + s << " zsM&P "; + if (digi.fiberIdleOffset() != 0) { + if (digi.fiberIdleOffset() == -1000) + s << " nofiberOffset"; + else + s << " fiberOffset=" << digi.fiberIdleOffset(); + } + s << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; } - s << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/HcalTriggerPrimitiveDigi.cc b/DataFormats/HcalDigi/src/HcalTriggerPrimitiveDigi.cc index e359075942f02..c8e08e86cc749 100644 --- a/DataFormats/HcalDigi/src/HcalTriggerPrimitiveDigi.cc +++ b/DataFormats/HcalDigi/src/HcalTriggerPrimitiveDigi.cc @@ -1,40 +1,42 @@ #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveDigi.h" -HcalTriggerPrimitiveDigi::HcalTriggerPrimitiveDigi() : size_(0), hcalPresamples_(0) {} -HcalTriggerPrimitiveDigi::HcalTriggerPrimitiveDigi(const HcalTrigTowerDetId& id) - : id_(id), size_(0), hcalPresamples_(0) {} +namespace io_v1 { + HcalTriggerPrimitiveDigi::HcalTriggerPrimitiveDigi() : size_(0), hcalPresamples_(0) {} + HcalTriggerPrimitiveDigi::HcalTriggerPrimitiveDigi(const HcalTrigTowerDetId& id) + : id_(id), size_(0), hcalPresamples_(0) {} -void HcalTriggerPrimitiveDigi::setSize(int size) { - if (size < 0) - size_ = 0; - else if (size > MAXSAMPLES) - size_ = MAXSAMPLES; - else - size_ = size; -} -void HcalTriggerPrimitiveDigi::setPresamples(int ps) { - if (ps < 0) - hcalPresamples_ &= 0xFFFFFF0; - // else if (ps>=size_) hcalPresamples_=size_-1; - else - hcalPresamples_ |= ps & 0xF; -} + void HcalTriggerPrimitiveDigi::setSize(int size) { + if (size < 0) + size_ = 0; + else if (size > MAXSAMPLES) + size_ = MAXSAMPLES; + else + size_ = size; + } + void HcalTriggerPrimitiveDigi::setPresamples(int ps) { + if (ps < 0) + hcalPresamples_ &= 0xFFFFFF0; + // else if (ps>=size_) hcalPresamples_=size_-1; + else + hcalPresamples_ |= ps & 0xF; + } -void HcalTriggerPrimitiveDigi::setZSInfo(bool unsuppressed, bool markAndPass) { - if (markAndPass) - hcalPresamples_ |= 0x10; - if (unsuppressed) - hcalPresamples_ |= 0x20; -} + void HcalTriggerPrimitiveDigi::setZSInfo(bool unsuppressed, bool markAndPass) { + if (markAndPass) + hcalPresamples_ |= 0x10; + if (unsuppressed) + hcalPresamples_ |= 0x20; + } -std::ostream& operator<<(std::ostream& s, const HcalTriggerPrimitiveDigi& digi) { - s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples"; - if (digi.zsUnsuppressed()) - s << " zsUS"; - if (digi.zsMarkAndPass()) - s << " zsM&P"; - s << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} + std::ostream& operator<<(std::ostream& s, const HcalTriggerPrimitiveDigi& digi) { + s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples"; + if (digi.zsUnsuppressed()) + s << " zsUS"; + if (digi.zsMarkAndPass()) + s << " zsM&P"; + s << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; + } +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/QIE10DataFrame.cc b/DataFormats/HcalDigi/src/QIE10DataFrame.cc index 5f61ea2f4fc8c..b8626f93a1072 100644 --- a/DataFormats/HcalDigi/src/QIE10DataFrame.cc +++ b/DataFormats/HcalDigi/src/QIE10DataFrame.cc @@ -1,27 +1,29 @@ #include "DataFormats/HcalDigi/interface/QIE10DataFrame.h" #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" -std::ostream& operator<<(std::ostream& s, const QIE10DataFrame& digi) { - if (digi.detid().det() == DetId::Hcal) { - s << HcalGenericDetId(digi.detid()); - } else { - s << "DetId(" << digi.detid().rawId() << ")"; - } - s << " " << digi.samples() << " samples"; - if (digi.linkError()) - s << " LinkError "; - if (digi.zsMarkAndPass()) - s << " MaP "; - s << std::endl; - for (int i = 0; i < digi.samples(); i++) { - QIE10DataFrame::Sample sam = digi[i]; - s << " ADC=" << sam.adc() << " TDC(LE)=" << sam.le_tdc() << " TDC(TE)=" << sam.te_tdc() - << " CAPID=" << sam.capid(); - if (sam.soi()) - s << " SOI "; - if (!sam.ok()) - s << " !OK "; +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const QIE10DataFrame& digi) { + if (digi.detid().det() == DetId::Hcal) { + s << HcalGenericDetId(digi.detid()); + } else { + s << "DetId(" << digi.detid().rawId() << ")"; + } + s << " " << digi.samples() << " samples"; + if (digi.linkError()) + s << " LinkError "; + if (digi.zsMarkAndPass()) + s << " MaP "; s << std::endl; + for (int i = 0; i < digi.samples(); i++) { + QIE10DataFrame::Sample sam = digi[i]; + s << " ADC=" << sam.adc() << " TDC(LE)=" << sam.le_tdc() << " TDC(TE)=" << sam.te_tdc() + << " CAPID=" << sam.capid(); + if (sam.soi()) + s << " SOI "; + if (!sam.ok()) + s << " !OK "; + s << std::endl; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/QIE11DataFrame.cc b/DataFormats/HcalDigi/src/QIE11DataFrame.cc index 9e8811ca9a475..8d71033a63dcb 100644 --- a/DataFormats/HcalDigi/src/QIE11DataFrame.cc +++ b/DataFormats/HcalDigi/src/QIE11DataFrame.cc @@ -1,26 +1,28 @@ #include "DataFormats/HcalDigi/interface/QIE11DataFrame.h" #include "DataFormats/HcalDetId/interface/HcalGenericDetId.h" -std::ostream& operator<<(std::ostream& s, const QIE11DataFrame& digi) { - if (digi.detid().det() == DetId::Hcal) { - s << "DetID=" << HcalGenericDetId(digi.detid()) << " flavor=" << digi.flavor(); - } else { - s << "DetId(" << digi.detid().rawId() << ")"; - } - s << " " << digi.samples() << " samples"; - if (digi.linkError()) - s << " LinkError "; - if (digi.capidError()) - s << " CapIdError "; - if (digi.zsMarkAndPass()) - s << " M&P "; - s << std::endl; - for (int i = 0; i < digi.samples(); i++) { - QIE11DataFrame::Sample sam = digi[i]; - s << " ADC=" << sam.adc() << " TDC=" << sam.tdc() << " CAPID=" << sam.capid(); - if (sam.soi()) - s << " SOI "; +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const QIE11DataFrame& digi) { + if (digi.detid().det() == DetId::Hcal) { + s << "DetID=" << HcalGenericDetId(digi.detid()) << " flavor=" << digi.flavor(); + } else { + s << "DetId(" << digi.detid().rawId() << ")"; + } + s << " " << digi.samples() << " samples"; + if (digi.linkError()) + s << " LinkError "; + if (digi.capidError()) + s << " CapIdError "; + if (digi.zsMarkAndPass()) + s << " M&P "; s << std::endl; + for (int i = 0; i < digi.samples(); i++) { + QIE11DataFrame::Sample sam = digi[i]; + s << " ADC=" << sam.adc() << " TDC=" << sam.tdc() << " CAPID=" << sam.capid(); + if (sam.soi()) + s << " SOI "; + s << std::endl; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/ZDCDataFrame.cc b/DataFormats/HcalDigi/src/ZDCDataFrame.cc index 9858416d430fd..d460f03c85452 100644 --- a/DataFormats/HcalDigi/src/ZDCDataFrame.cc +++ b/DataFormats/HcalDigi/src/ZDCDataFrame.cc @@ -1,77 +1,79 @@ #include "DataFormats/HcalDigi/interface/ZDCDataFrame.h" -ZDCDataFrame::ZDCDataFrame() : id_(0), size_(0), hcalPresamples_(0) {} +namespace io_v1 { + ZDCDataFrame::ZDCDataFrame() : id_(0), size_(0), hcalPresamples_(0) {} -ZDCDataFrame::ZDCDataFrame(const HcalZDCDetId& id) : id_(id), size_(0), hcalPresamples_(0) { - // TODO : test id for ZDC -} - -void ZDCDataFrame::setSize(int size) { - if (size > MAXSAMPLES) - size_ = MAXSAMPLES; - else if (size <= 0) - size_ = 0; - else - size_ = size; -} -void ZDCDataFrame::setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } -void ZDCDataFrame::setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } + ZDCDataFrame::ZDCDataFrame(const HcalZDCDetId& id) : id_(id), size_(0), hcalPresamples_(0) { + // TODO : test id for ZDC + } -bool ZDCDataFrame::validate(int firstSample, int nSamples) const { - int capid = -1; - bool ok = true; - for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { - if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) - ok = false; - if (i == 0) - capid = data_[i + firstSample].capid(); - if (capid != data_[i + firstSample].capid()) - ok = false; - capid = (capid + 1) % 4; + void ZDCDataFrame::setSize(int size) { + if (size > MAXSAMPLES) + size_ = MAXSAMPLES; + else if (size <= 0) + size_ = 0; + else + size_ = size; } - return ok; -} + void ZDCDataFrame::setPresamples(int ps) { hcalPresamples_ |= ps & 0xF; } + void ZDCDataFrame::setReadoutIds(const HcalElectronicsId& eid) { electronicsId_ = eid; } -void ZDCDataFrame::setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask) { - hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset - if (markAndPass) - hcalPresamples_ |= 0x10; - if (unsuppressed) - hcalPresamples_ |= 0x20; - hcalPresamples_ |= (crossingMask & 0x3FF) << 12; -} + bool ZDCDataFrame::validate(int firstSample, int nSamples) const { + int capid = -1; + bool ok = true; + for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) { + if (data_[i + firstSample].er() || !data_[i + firstSample].dv()) + ok = false; + if (i == 0) + capid = data_[i + firstSample].capid(); + if (capid != data_[i + firstSample].capid()) + ok = false; + capid = (capid + 1) % 4; + } + return ok; + } -int ZDCDataFrame::fiberIdleOffset() const { - int val = (hcalPresamples_ & 0xF00) >> 8; - return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); -} + void ZDCDataFrame::setZSInfo(bool unsuppressed, bool markAndPass, uint32_t crossingMask) { + hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset + if (markAndPass) + hcalPresamples_ |= 0x10; + if (unsuppressed) + hcalPresamples_ |= 0x20; + hcalPresamples_ |= (crossingMask & 0x3FF) << 12; + } -void ZDCDataFrame::setFiberIdleOffset(int offset) { - hcalPresamples_ &= 0x7FFFF0FF; - if (offset >= 7) - hcalPresamples_ |= 0xF00; - else if (offset >= 0) - hcalPresamples_ |= (0x800) | (offset << 8); - else if (offset >= -7) - hcalPresamples_ |= ((-offset) << 8); - else - hcalPresamples_ |= 0x700; -} + int ZDCDataFrame::fiberIdleOffset() const { + int val = (hcalPresamples_ & 0xF00) >> 8; + return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7)); + } -std::ostream& operator<<(std::ostream& s, const ZDCDataFrame& digi) { - s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; - if (digi.zsUnsuppressed()) - s << " zsUS "; - if (digi.zsMarkAndPass()) - s << " zsM&P "; - if (digi.fiberIdleOffset() != 0) { - if (digi.fiberIdleOffset() == -1000) - s << " nofiberOffset"; + void ZDCDataFrame::setFiberIdleOffset(int offset) { + hcalPresamples_ &= 0x7FFFF0FF; + if (offset >= 7) + hcalPresamples_ |= 0xF00; + else if (offset >= 0) + hcalPresamples_ |= (0x800) | (offset << 8); + else if (offset >= -7) + hcalPresamples_ |= ((-offset) << 8); else - s << " fiberOffset=" << digi.fiberIdleOffset(); + hcalPresamples_ |= 0x700; + } + + std::ostream& operator<<(std::ostream& s, const ZDCDataFrame& digi) { + s << digi.id() << " " << digi.size() << " samples " << digi.presamples() << " presamples "; + if (digi.zsUnsuppressed()) + s << " zsUS "; + if (digi.zsMarkAndPass()) + s << " zsM&P "; + if (digi.fiberIdleOffset() != 0) { + if (digi.fiberIdleOffset() == -1000) + s << " nofiberOffset"; + else + s << " fiberOffset=" << digi.fiberIdleOffset(); + } + s << std::endl; + for (int i = 0; i < digi.size(); i++) + s << " " << digi.sample(i) << std::endl; + return s; } - s << std::endl; - for (int i = 0; i < digi.size(); i++) - s << " " << digi.sample(i) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalDigi/src/classes_def.xml b/DataFormats/HcalDigi/src/classes_def.xml index aa664b497c3ce..a4a78aaed4895 100644 --- a/DataFormats/HcalDigi/src/classes_def.xml +++ b/DataFormats/HcalDigi/src/classes_def.xml @@ -1,112 +1,108 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + - - + + - - - - - + + - - - + + + - + - + - - - + + + - + - + - - + + - - - + + + - + - + - - - + + + - + - + - - - + + + diff --git a/DataFormats/HcalIsolatedTrack/src/classes_def.xml b/DataFormats/HcalIsolatedTrack/src/classes_def.xml index 174fb032a6c87..223b57b525480 100644 --- a/DataFormats/HcalIsolatedTrack/src/classes_def.xml +++ b/DataFormats/HcalIsolatedTrack/src/classes_def.xml @@ -2,45 +2,37 @@ - - - - - - + + - + - - - - - + + - + - - - + + - + diff --git a/DataFormats/HcalRecHit/interface/HBHERecHit.h b/DataFormats/HcalRecHit/interface/HBHERecHit.h index 81fe484b4d3d5..d0bb3e688de9e 100644 --- a/DataFormats/HcalRecHit/interface/HBHERecHit.h +++ b/DataFormats/HcalRecHit/interface/HBHERecHit.h @@ -10,75 +10,77 @@ * * \author J. Mans - Minnesota */ -class HBHERecHit : public CaloRecHit { -public: - typedef HcalDetId key_type; - - constexpr HBHERecHit() - : CaloRecHit(), - timeFalling_(0), - chiSquared_(-1), - rawEnergy_(-1.0e21), - auxEnergy_(-1.0e21), - auxHBHE_(0), - auxPhase1_(0), - auxTDC_(0) {} - - constexpr HBHERecHit(const HcalDetId& id, float energy, float timeRising, float timeFalling = 0) - : CaloRecHit(id, energy, timeRising), - timeFalling_(timeFalling), - chiSquared_(-1), - rawEnergy_(-1.0e21), - auxEnergy_(-1.0e21), - auxHBHE_(0), - auxPhase1_(0), - auxTDC_(0) {} - - /// get the hit falling time - constexpr inline float timeFalling() const { return timeFalling_; } - constexpr inline void setTimeFalling(float timeFalling) { timeFalling_ = timeFalling; } - /// get the id - constexpr inline HcalDetId id() const { return HcalDetId(detid()); } - - constexpr inline void setChiSquared(const float chi2) { chiSquared_ = chi2; } - constexpr inline float chi2() const { return chiSquared_; } - - constexpr inline void setRawEnergy(const float en) { rawEnergy_ = en; } - constexpr inline float eraw() const { return rawEnergy_; } - - constexpr inline void setAuxEnergy(const float en) { auxEnergy_ = en; } - constexpr inline float eaux() const { return auxEnergy_; } - - constexpr inline void setAuxHBHE(const uint32_t aux) { auxHBHE_ = aux; } - constexpr inline uint32_t auxHBHE() const { return auxHBHE_; } - - constexpr inline void setAuxPhase1(const uint32_t aux) { auxPhase1_ = aux; } - constexpr inline uint32_t auxPhase1() const { return auxPhase1_; } - - constexpr inline void setAuxTDC(const uint32_t aux) { auxTDC_ = aux; } - constexpr inline uint32_t auxTDC() const { return auxTDC_; } - - // The following method returns "true" for "Plan 1" merged rechits - bool isMerged() const; - - // The following method fills the vector with the ids of the - // rechits that have been merged to construct the "Plan 1" rechit. - // For normal (i.e., not merged) rechits the vector will be cleared. - void getMergedIds(std::vector* ids) const; - - // Returns the DetId of the front Id if it is a merged RecHit in "Plan 1" - HcalDetId idFront() const; - -private: - float timeFalling_; - float chiSquared_; - float rawEnergy_; - float auxEnergy_; - uint32_t auxHBHE_; - uint32_t auxPhase1_; - uint32_t auxTDC_; -}; - -std::ostream& operator<<(std::ostream& s, const HBHERecHit& hit); - +namespace io_v1 { + class HBHERecHit : public CaloRecHit { + public: + typedef HcalDetId key_type; + + constexpr HBHERecHit() + : CaloRecHit(), + timeFalling_(0), + chiSquared_(-1), + rawEnergy_(-1.0e21), + auxEnergy_(-1.0e21), + auxHBHE_(0), + auxPhase1_(0), + auxTDC_(0) {} + + constexpr HBHERecHit(const HcalDetId& id, float energy, float timeRising, float timeFalling = 0) + : CaloRecHit(id, energy, timeRising), + timeFalling_(timeFalling), + chiSquared_(-1), + rawEnergy_(-1.0e21), + auxEnergy_(-1.0e21), + auxHBHE_(0), + auxPhase1_(0), + auxTDC_(0) {} + + /// get the hit falling time + constexpr inline float timeFalling() const { return timeFalling_; } + constexpr inline void setTimeFalling(float timeFalling) { timeFalling_ = timeFalling; } + /// get the id + constexpr inline HcalDetId id() const { return HcalDetId(detid()); } + + constexpr inline void setChiSquared(const float chi2) { chiSquared_ = chi2; } + constexpr inline float chi2() const { return chiSquared_; } + + constexpr inline void setRawEnergy(const float en) { rawEnergy_ = en; } + constexpr inline float eraw() const { return rawEnergy_; } + + constexpr inline void setAuxEnergy(const float en) { auxEnergy_ = en; } + constexpr inline float eaux() const { return auxEnergy_; } + + constexpr inline void setAuxHBHE(const uint32_t aux) { auxHBHE_ = aux; } + constexpr inline uint32_t auxHBHE() const { return auxHBHE_; } + + constexpr inline void setAuxPhase1(const uint32_t aux) { auxPhase1_ = aux; } + constexpr inline uint32_t auxPhase1() const { return auxPhase1_; } + + constexpr inline void setAuxTDC(const uint32_t aux) { auxTDC_ = aux; } + constexpr inline uint32_t auxTDC() const { return auxTDC_; } + + // The following method returns "true" for "Plan 1" merged rechits + bool isMerged() const; + + // The following method fills the vector with the ids of the + // rechits that have been merged to construct the "Plan 1" rechit. + // For normal (i.e., not merged) rechits the vector will be cleared. + void getMergedIds(std::vector* ids) const; + + // Returns the DetId of the front Id if it is a merged RecHit in "Plan 1" + HcalDetId idFront() const; + + private: + float timeFalling_; + float chiSquared_; + float rawEnergy_; + float auxEnergy_; + uint32_t auxHBHE_; + uint32_t auxPhase1_; + uint32_t auxTDC_; + }; + + std::ostream& operator<<(std::ostream& s, const HBHERecHit& hit); +} // namespace io_v1 +using HBHERecHit = io_v1::HBHERecHit; #endif diff --git a/DataFormats/HcalRecHit/interface/HBHERecHitFwd.h b/DataFormats/HcalRecHit/interface/HBHERecHitFwd.h index 6bcddc778bb61..003a0b5543c01 100644 --- a/DataFormats/HcalRecHit/interface/HBHERecHitFwd.h +++ b/DataFormats/HcalRecHit/interface/HBHERecHitFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_HcalRecHit_HBHERecHitFwd_h #define DataFormats_HcalRecHit_HBHERecHitFwd_h -class HBHERecHit; +namespace io_v1 { + class HBHERecHit; +} +using HBHERecHit = io_v1::HBHERecHit; #endif diff --git a/DataFormats/HcalRecHit/interface/HFPreRecHit.h b/DataFormats/HcalRecHit/interface/HFPreRecHit.h index 0d042174ae978..ac60cdac35fad 100644 --- a/DataFormats/HcalRecHit/interface/HFPreRecHit.h +++ b/DataFormats/HcalRecHit/interface/HFPreRecHit.h @@ -11,78 +11,80 @@ * using QIE10 chips and dual-anode readout. Groups the information * provided by a single PMT. */ -class HFPreRecHit { -public: - typedef HcalDetId key_type; +namespace io_v1 { + class HFPreRecHit { + public: + typedef HcalDetId key_type; - constexpr HFPreRecHit() : hasInfo_{false, false} {} + constexpr HFPreRecHit() : hasInfo_{false, false} {} - // In the constructor below, either "first" or "second" - // pointer can be nullptr - constexpr HFPreRecHit(const HcalDetId& id, const HFQIE10Info* first, const HFQIE10Info* second) - : id_(id), hasInfo_{false, false} { - if (first) { - hfQIE10Info_[0] = *first; - hasInfo_[0] = true; + // In the constructor below, either "first" or "second" + // pointer can be nullptr + constexpr HFPreRecHit(const HcalDetId& id, const HFQIE10Info* first, const HFQIE10Info* second) + : id_(id), hasInfo_{false, false} { + if (first) { + hfQIE10Info_[0] = *first; + hasInfo_[0] = true; + } + if (second) { + hfQIE10Info_[1] = *second; + hasInfo_[1] = true; + } } - if (second) { - hfQIE10Info_[1] = *second; - hasInfo_[1] = true; - } - } - - constexpr HcalDetId id() const { return id_; } - // Get a pointer to the QIE10 info. nullptr will be returned - // if the info with the given index does not exist or if the - // index is out of range. - constexpr HFQIE10Info const* getHFQIE10Info(unsigned index) const { - if (index < 2 && hasInfo_[index]) - return &hfQIE10Info_[index]; - else - return nullptr; - } + constexpr HcalDetId id() const { return id_; } - // Quantities simply added from both anodes - constexpr float charge() const { - float q = 0.f; - for (unsigned i = 0; i < 2; ++i) - if (hasInfo_[i]) - q += hfQIE10Info_[i].charge(); - return q; - } - constexpr float energy() const { - float e = 0.f; - for (unsigned i = 0; i < 2; ++i) - if (hasInfo_[i]) - e += hfQIE10Info_[i].energy(); - return e; - } + // Get a pointer to the QIE10 info. nullptr will be returned + // if the info with the given index does not exist or if the + // index is out of range. + constexpr HFQIE10Info const* getHFQIE10Info(unsigned index) const { + if (index < 2 && hasInfo_[index]) + return &hfQIE10Info_[index]; + else + return nullptr; + } - // The following function returns a pair. - // The first element of the pair is the charge asymmetry, - // if calculated. The second element of the pair indicates - // whether the asymmetry is actually calculated. "true" - // means yes, it is. The asymmetry is calculated if all - // of the following conditions are satisfied: - // - // 1) The data is available for both PMT anodes. - // 2) The sum of the charges is positive. - // 3) The sum of the charges is at least "chargeThreshold". - // - // If the asymmetry is not calculated, the first element of - // the pair is set to 0 and the second to "false". - // - std::pair chargeAsymmetry(float chargeThreshold) const; + // Quantities simply added from both anodes + constexpr float charge() const { + float q = 0.f; + for (unsigned i = 0; i < 2; ++i) + if (hasInfo_[i]) + q += hfQIE10Info_[i].charge(); + return q; + } + constexpr float energy() const { + float e = 0.f; + for (unsigned i = 0; i < 2; ++i) + if (hasInfo_[i]) + e += hfQIE10Info_[i].energy(); + return e; + } - // Similar function for the energy asymmetry - std::pair energyAsymmetry(float energyThreshold) const; + // The following function returns a pair. + // The first element of the pair is the charge asymmetry, + // if calculated. The second element of the pair indicates + // whether the asymmetry is actually calculated. "true" + // means yes, it is. The asymmetry is calculated if all + // of the following conditions are satisfied: + // + // 1) The data is available for both PMT anodes. + // 2) The sum of the charges is positive. + // 3) The sum of the charges is at least "chargeThreshold". + // + // If the asymmetry is not calculated, the first element of + // the pair is set to 0 and the second to "false". + // + std::pair chargeAsymmetry(float chargeThreshold) const; -private: - HcalDetId id_; + // Similar function for the energy asymmetry + std::pair energyAsymmetry(float energyThreshold) const; - HFQIE10Info hfQIE10Info_[2]; - bool hasInfo_[2]; -}; + private: + HcalDetId id_; + HFQIE10Info hfQIE10Info_[2]; + bool hasInfo_[2]; + }; +} // namespace io_v1 +using HFPreRecHit = io_v1::HFPreRecHit; #endif // DATAFORMATS_HCALRECHIT_HFPRERECHIT_H diff --git a/DataFormats/HcalRecHit/interface/HFRecHit.h b/DataFormats/HcalRecHit/interface/HFRecHit.h index d2521609c7530..a5216a29f38c2 100644 --- a/DataFormats/HcalRecHit/interface/HFRecHit.h +++ b/DataFormats/HcalRecHit/interface/HFRecHit.h @@ -8,31 +8,33 @@ * *\author J. Mans - Minnesota */ -class HFRecHit : public CaloRecHit { -public: - typedef HcalDetId key_type; - - constexpr HFRecHit() : CaloRecHit(), timeFalling_(0.f), auxHF_(0) {} - - //HFRecHit(const HcalDetId& id, float energy, float time); - /// get the id - constexpr HFRecHit(const HcalDetId& id, float en, float timeRising, float timeFalling = 0) - : CaloRecHit(id, en, timeRising), timeFalling_(timeFalling), auxHF_(0) {} - - /// get the amplitude (generally fC, but can vary) - /// get the hit time - constexpr float timeFalling() const { return timeFalling_; } - constexpr void setTimeFalling(float timeFalling) { timeFalling_ = timeFalling; } - constexpr HcalDetId id() const { return HcalDetId(detid()); } - - constexpr void setAuxHF(const uint32_t u) { auxHF_ = u; } - constexpr uint32_t getAuxHF() const { return auxHF_; } - -private: - float timeFalling_; - uint32_t auxHF_; -}; - -std::ostream& operator<<(std::ostream& s, const HFRecHit& hit); - +namespace io_v1 { + class HFRecHit : public CaloRecHit { + public: + typedef HcalDetId key_type; + + constexpr HFRecHit() : CaloRecHit(), timeFalling_(0.f), auxHF_(0) {} + + //HFRecHit(const HcalDetId& id, float energy, float time); + /// get the id + constexpr HFRecHit(const HcalDetId& id, float en, float timeRising, float timeFalling = 0) + : CaloRecHit(id, en, timeRising), timeFalling_(timeFalling), auxHF_(0) {} + + /// get the amplitude (generally fC, but can vary) + /// get the hit time + constexpr float timeFalling() const { return timeFalling_; } + constexpr void setTimeFalling(float timeFalling) { timeFalling_ = timeFalling; } + constexpr HcalDetId id() const { return HcalDetId(detid()); } + + constexpr void setAuxHF(const uint32_t u) { auxHF_ = u; } + constexpr uint32_t getAuxHF() const { return auxHF_; } + + private: + float timeFalling_; + uint32_t auxHF_; + }; + + std::ostream& operator<<(std::ostream& s, const HFRecHit& hit); +} // namespace io_v1 +using HFRecHit = io_v1::HFRecHit; #endif diff --git a/DataFormats/HcalRecHit/interface/HORecHit.h b/DataFormats/HcalRecHit/interface/HORecHit.h index e7693e6d3c967..3e640761facd9 100644 --- a/DataFormats/HcalRecHit/interface/HORecHit.h +++ b/DataFormats/HcalRecHit/interface/HORecHit.h @@ -8,17 +8,19 @@ * * \author J. Mans - Minnesota */ -class HORecHit : public CaloRecHit { -public: - typedef HcalDetId key_type; +namespace io_v1 { + class HORecHit : public CaloRecHit { + public: + typedef HcalDetId key_type; - constexpr HORecHit() : CaloRecHit() {} + constexpr HORecHit() : CaloRecHit() {} - constexpr HORecHit(const HcalDetId& id, float energy, float time) : CaloRecHit(id, energy, time) {} - /// get the id - constexpr HcalDetId id() const { return HcalDetId(detid()); } -}; - -std::ostream& operator<<(std::ostream& s, const HORecHit& hit); + constexpr HORecHit(const HcalDetId& id, float energy, float time) : CaloRecHit(id, energy, time) {} + /// get the id + constexpr HcalDetId id() const { return HcalDetId(detid()); } + }; + std::ostream& operator<<(std::ostream& s, const HORecHit& hit); +} // namespace io_v1 +using HORecHit = io_v1::HORecHit; #endif diff --git a/DataFormats/HcalRecHit/interface/ZDCRecHit.h b/DataFormats/HcalRecHit/interface/ZDCRecHit.h index 7b6793c19b2aa..d7fd548b9eefe 100644 --- a/DataFormats/HcalRecHit/interface/ZDCRecHit.h +++ b/DataFormats/HcalRecHit/interface/ZDCRecHit.h @@ -8,38 +8,40 @@ * *\author J. Mans - Minnesota */ -class ZDCRecHit : public CaloRecHit { -public: - typedef HcalZDCDetId key_type; +namespace io_v1 { + class ZDCRecHit : public CaloRecHit { + public: + typedef HcalZDCDetId key_type; - ZDCRecHit(); - ZDCRecHit(const HcalZDCDetId& id, float energy, float time, float lowGainEnergy); - /// get the id - HcalZDCDetId id() const { return HcalZDCDetId(detid()); } - // follow EcalRecHit method of adding variable flagBits_ to CaloRecHit - float lowGainEnergy() const { return lowGainEnergy_; }; + ZDCRecHit(); + ZDCRecHit(const HcalZDCDetId& id, float energy, float time, float lowGainEnergy); + /// get the id + HcalZDCDetId id() const { return HcalZDCDetId(detid()); } + // follow EcalRecHit method of adding variable flagBits_ to CaloRecHit + float lowGainEnergy() const { return lowGainEnergy_; }; - constexpr inline void setEnergySOIp1(const float en) { energySOIp1_ = en; }; - constexpr inline float energySOIp1() const { return energySOIp1_; }; // energy of Slice of Interest plus 1 - constexpr inline void setRatioSOIp1(const float ratio) { ratioSOIp1_ = ratio; }; - constexpr inline float ratioSOIp1() const { - return ratioSOIp1_; - }; // ratio of Energy of (Slice of Interest)/ (Slice of Interest plus 1) - constexpr inline void setTDCtime(const float time) { TDCtime_ = time; }; - constexpr inline float TDCtime() const { return TDCtime_; }; - constexpr inline void setChargeWeightedTime(const float time) { - chargeWeightedTime_ = time; - }; // time of activity determined by charged weighted average - constexpr inline float chargeWeightedTime() const { return chargeWeightedTime_; }; + constexpr inline void setEnergySOIp1(const float en) { energySOIp1_ = en; }; + constexpr inline float energySOIp1() const { return energySOIp1_; }; // energy of Slice of Interest plus 1 + constexpr inline void setRatioSOIp1(const float ratio) { ratioSOIp1_ = ratio; }; + constexpr inline float ratioSOIp1() const { + return ratioSOIp1_; + }; // ratio of Energy of (Slice of Interest)/ (Slice of Interest plus 1) + constexpr inline void setTDCtime(const float time) { TDCtime_ = time; }; + constexpr inline float TDCtime() const { return TDCtime_; }; + constexpr inline void setChargeWeightedTime(const float time) { + chargeWeightedTime_ = time; + }; // time of activity determined by charged weighted average + constexpr inline float chargeWeightedTime() const { return chargeWeightedTime_; }; -private: - float lowGainEnergy_; - float energySOIp1_; - float ratioSOIp1_; - float TDCtime_; - float chargeWeightedTime_; -}; - -std::ostream& operator<<(std::ostream& s, const ZDCRecHit& hit); + private: + float lowGainEnergy_; + float energySOIp1_; + float ratioSOIp1_; + float TDCtime_; + float chargeWeightedTime_; + }; + std::ostream& operator<<(std::ostream& s, const ZDCRecHit& hit); +} // namespace io_v1 +using ZDCRecHit = io_v1::ZDCRecHit; #endif diff --git a/DataFormats/HcalRecHit/src/HBHERecHit.cc b/DataFormats/HcalRecHit/src/HBHERecHit.cc index 4441c9fb345d2..5a7b35267a2e0 100644 --- a/DataFormats/HcalRecHit/src/HBHERecHit.cc +++ b/DataFormats/HcalRecHit/src/HBHERecHit.cc @@ -2,43 +2,45 @@ #include "DataFormats/HcalRecHit/interface/HBHERecHitAuxSetter.h" #include "DataFormats/HcalRecHit/interface/CaloRecHitAuxSetter.h" -HcalDetId HBHERecHit::idFront() const { - if (auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED)) { - const HcalDetId myId(id()); - return HcalDetId(myId.subdet(), myId.ieta(), myId.iphi(), auxHBHE_ & 0xf); - } else { - return id(); +namespace io_v1 { + HcalDetId HBHERecHit::idFront() const { + if (auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED)) { + const HcalDetId myId(id()); + return HcalDetId(myId.subdet(), myId.ieta(), myId.iphi(), auxHBHE_ & 0xf); + } else { + return id(); + } } -} -bool HBHERecHit::isMerged() const { return auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED); } + bool HBHERecHit::isMerged() const { return auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED); } -std::ostream& operator<<(std::ostream& s, const HBHERecHit& hit) { - s << hit.id() << ": " << hit.energy() << " GeV"; - if (hit.eraw() > -0.9e21) { - s << ", eraw=" << hit.eraw() << " GeV"; - } - if (hit.eaux() > -0.9e21) { - s << ", eaux=" << hit.eaux() << " GeV"; - } - if (hit.time() > -998) { - s << ", t= " << hit.time() << " to " << hit.timeFalling() << " ns"; + std::ostream& operator<<(std::ostream& s, const HBHERecHit& hit) { + s << hit.id() << ": " << hit.energy() << " GeV"; + if (hit.eraw() > -0.9e21) { + s << ", eraw=" << hit.eraw() << " GeV"; + } + if (hit.eaux() > -0.9e21) { + s << ", eaux=" << hit.eaux() << " GeV"; + } + if (hit.time() > -998) { + s << ", t= " << hit.time() << " to " << hit.timeFalling() << " ns"; + } + return s; } - return s; -} -void HBHERecHit::getMergedIds(std::vector* ids) const { - if (ids) { - ids->clear(); - if (auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED)) { - const unsigned nMerged = CaloRecHitAuxSetter::getField( - auxPhase1_, HBHERecHitAuxSetter::MASK_NSAMPLES, HBHERecHitAuxSetter::OFF_NSAMPLES); - ids->reserve(nMerged); - const HcalDetId myId(id()); - for (unsigned i = 0; i < nMerged; ++i) { - const unsigned depth = CaloRecHitAuxSetter::getField(auxHBHE_, 0xf, i * 4); - ids->emplace_back(myId.subdet(), myId.ieta(), myId.iphi(), depth); + void HBHERecHit::getMergedIds(std::vector* ids) const { + if (ids) { + ids->clear(); + if (auxPhase1_ & (1U << HBHERecHitAuxSetter::OFF_COMBINED)) { + const unsigned nMerged = CaloRecHitAuxSetter::getField( + auxPhase1_, HBHERecHitAuxSetter::MASK_NSAMPLES, HBHERecHitAuxSetter::OFF_NSAMPLES); + ids->reserve(nMerged); + const HcalDetId myId(id()); + for (unsigned i = 0; i < nMerged; ++i) { + const unsigned depth = CaloRecHitAuxSetter::getField(auxHBHE_, 0xf, i * 4); + ids->emplace_back(myId.subdet(), myId.ieta(), myId.iphi(), depth); + } } } } -} +} // namespace io_v1 diff --git a/DataFormats/HcalRecHit/src/HFRecHit.cc b/DataFormats/HcalRecHit/src/HFRecHit.cc index 1faf6ca2a3676..03b5d1b00d65b 100644 --- a/DataFormats/HcalRecHit/src/HFRecHit.cc +++ b/DataFormats/HcalRecHit/src/HFRecHit.cc @@ -1,9 +1,11 @@ #include "DataFormats/HcalRecHit/interface/HFRecHit.h" -std::ostream& operator<<(std::ostream& s, const HFRecHit& hit) { - s << hit.id() << ": " << hit.energy() << " GeV"; - if (hit.time() > -998) { - s << ", t= " << hit.time() << " to " << hit.timeFalling() << " ns"; +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const HFRecHit& hit) { + s << hit.id() << ": " << hit.energy() << " GeV"; + if (hit.time() > -998) { + s << ", t= " << hit.time() << " to " << hit.timeFalling() << " ns"; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/HcalRecHit/src/HORecHit.cc b/DataFormats/HcalRecHit/src/HORecHit.cc index 8ab46e76472cb..0b0da48874be4 100644 --- a/DataFormats/HcalRecHit/src/HORecHit.cc +++ b/DataFormats/HcalRecHit/src/HORecHit.cc @@ -1,5 +1,7 @@ #include "DataFormats/HcalRecHit/interface/HORecHit.h" -std::ostream& operator<<(std::ostream& s, const HORecHit& hit) { - return s << hit.id() << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& s, const HORecHit& hit) { + return s << hit.id() << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + } +} // namespace io_v1 diff --git a/DataFormats/HcalRecHit/src/ZDCRecHit.cc b/DataFormats/HcalRecHit/src/ZDCRecHit.cc index 1c20349a073f4..c3e7dbb999153 100644 --- a/DataFormats/HcalRecHit/src/ZDCRecHit.cc +++ b/DataFormats/HcalRecHit/src/ZDCRecHit.cc @@ -1,16 +1,18 @@ #include "DataFormats/HcalRecHit/interface/ZDCRecHit.h" -ZDCRecHit::ZDCRecHit() - : CaloRecHit(), lowGainEnergy_(), energySOIp1_(-99), ratioSOIp1_(-99), TDCtime_(-99), chargeWeightedTime_(-99) {} +namespace io_v1 { + ZDCRecHit::ZDCRecHit() + : CaloRecHit(), lowGainEnergy_(), energySOIp1_(-99), ratioSOIp1_(-99), TDCtime_(-99), chargeWeightedTime_(-99) {} -ZDCRecHit::ZDCRecHit(const HcalZDCDetId& id, float energy, float time, float lowGainEnergy) - : CaloRecHit(id, energy, time), - lowGainEnergy_(lowGainEnergy), - energySOIp1_(-99), - ratioSOIp1_(-99), - TDCtime_(-99), - chargeWeightedTime_(-99) {} + ZDCRecHit::ZDCRecHit(const HcalZDCDetId& id, float energy, float time, float lowGainEnergy) + : CaloRecHit(id, energy, time), + lowGainEnergy_(lowGainEnergy), + energySOIp1_(-99), + ratioSOIp1_(-99), + TDCtime_(-99), + chargeWeightedTime_(-99) {} -std::ostream& operator<<(std::ostream& s, const ZDCRecHit& hit) { - return s << hit.id() << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; -} + std::ostream& operator<<(std::ostream& s, const ZDCRecHit& hit) { + return s << hit.id() << ": " << hit.energy() << " GeV, " << hit.time() << " ns"; + } +} // namespace io_v1 diff --git a/DataFormats/HcalRecHit/src/classes_def.xml b/DataFormats/HcalRecHit/src/classes_def.xml index 128e558f1ee8a..4c67aac31c8f5 100644 --- a/DataFormats/HcalRecHit/src/classes_def.xml +++ b/DataFormats/HcalRecHit/src/classes_def.xml @@ -1,126 +1,105 @@ - - - - - - - - - - + + - - - + + - - - + + - - + + - - - - - - - + + - - - - - + + - - - - + + - - - + + - - + + - - + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - + + + + diff --git a/DataFormats/HeavyIonEvent/src/classes_def.xml b/DataFormats/HeavyIonEvent/src/classes_def.xml index e7e6481185269..1282f311e9ef3 100644 --- a/DataFormats/HeavyIonEvent/src/classes_def.xml +++ b/DataFormats/HeavyIonEvent/src/classes_def.xml @@ -1,20 +1,18 @@ - - + + - - - - + + - - + + diff --git a/DataFormats/HepMCCandidate/interface/GenParticle.h b/DataFormats/HepMCCandidate/interface/GenParticle.h index 935613bc7e0c3..b1c31052c5ea2 100644 --- a/DataFormats/HepMCCandidate/interface/GenParticle.h +++ b/DataFormats/HepMCCandidate/interface/GenParticle.h @@ -17,100 +17,104 @@ namespace HepMC { } namespace reco { - - class GenParticle : public CompositeRefCandidateT { - public: - /// default constructor - GenParticle() {} - /// default constructor - GenParticle(const LeafCandidate &c) : CompositeRefCandidateT(c) {} - /// constrocturo from values - GenParticle(Charge q, const LorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); - /// constrocturo from values - GenParticle(Charge q, const PolarLorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); - /// destructor - ~GenParticle() override; - /// return a clone - GenParticle *clone() const override; - void setCollisionId(int s) { collisionId_ = s; } - int collisionId() const { return collisionId_; } - - const GenStatusFlags &statusFlags() const { return statusFlags_; } - GenStatusFlags &statusFlags() { return statusFlags_; } - - ///////////////////////////////////////////////////////////////////////////// - //basic set of gen status flags accessible directly here - //the rest accessible through statusFlags() - //(see GenStatusFlags.h for their meaning) - - ///////////////////////////////////////////////////////////////////////////// - //these are robust, generator-independent functions for categorizing - //mainly final state particles, but also intermediate hadrons/taus - - //is particle prompt (not from hadron, muon, or tau decay) and final state - bool isPromptFinalState() const { return status() == 1 && statusFlags_.isPrompt(); } - - //is particle prompt (not from hadron, muon, or tau decay) and decayed - //such as a prompt tau - bool isPromptDecayed() const { return statusFlags_.isDecayedLeptonHadron() && statusFlags_.isPrompt(); } - - //this particle is a direct decay product of a prompt tau and is final state - //(eg an electron or muon from a leptonic decay of a prompt tau) - bool isDirectPromptTauDecayProductFinalState() const { - return status() == 1 && statusFlags_.isDirectPromptTauDecayProduct(); - } - - ///////////////////////////////////////////////////////////////////////////// - //these are generator history-dependent functions for tagging particles - //associated with the hard process - //Currently implemented for Pythia 6 and Pythia 8 status codes and history - //and may not have 100% consistent meaning across all types of processes - //Users are strongly encouraged to stick to the more robust flags above, - //as well as the expanded set available in GenStatusFlags.h - - //this particle is part of the hard process - bool isHardProcess() const { return statusFlags_.isHardProcess(); } - - //this particle is the final state direct descendant of a hard process particle - bool fromHardProcessFinalState() const { return status() == 1 && statusFlags_.fromHardProcess(); } - - //this particle is the decayed direct descendant of a hard process particle - //such as a tau from the hard process - bool fromHardProcessDecayed() const { - return statusFlags_.isDecayedLeptonHadron() && statusFlags_.fromHardProcess(); - } - - //this particle is a direct decay product of a hardprocess tau and is final state - //(eg an electron or muon from a leptonic decay of a tau from the hard process) - bool isDirectHardProcessTauDecayProductFinalState() const { - return status() == 1 && statusFlags_.isDirectHardProcessTauDecayProduct(); - } - - //this particle is the direct descendant of a hard process particle of the same pdg id. - //For outgoing particles the kinematics are those before QCD or QED FSR - //This corresponds roughly to status code 3 in pythia 6 - //This is the most complex and error prone of all the flags and you are strongly encouraged - //to consider using the others to fill your needs. - bool fromHardProcessBeforeFSR() const { return statusFlags_.fromHardProcessBeforeFSR(); } - - //provided for convenience. Use this one if you were using status 3 before and didn't know or care what it exactly meant - bool isMostlyLikePythia6Status3() { return fromHardProcessBeforeFSR(); } - - //this particle is the last copy of the particle in the chain with the same pdg id - //(and therefore is more likely, but not guaranteed, to carry the final physical momentum) - bool isLastCopy() const { return statusFlags_.isLastCopy(); } - - //this particle is the last copy of the particle in the chain with the same pdg id - //before QED or QCD FSR - //(and therefore is more likely, but not guaranteed, to carry the momentum after ISR) - bool isLastCopyBeforeFSR() const { return statusFlags_.isLastCopyBeforeFSR(); } - - private: - /// checp overlap with another candidate - bool overlap(const Candidate &) const override; - int collisionId_; - GenStatusFlags statusFlags_; - }; + namespace io_v1 { + + class GenParticle : public CompositeRefCandidateT { + public: + /// default constructor + GenParticle() {} + /// default constructor + GenParticle(const LeafCandidate &c) : CompositeRefCandidateT(c) {} + /// constrocturo from values + GenParticle(Charge q, const LorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); + /// constrocturo from values + GenParticle(Charge q, const PolarLorentzVector &p4, const Point &vtx, int pdgId, int status, bool integerCharge); + /// destructor + ~GenParticle() override; + /// return a clone + GenParticle *clone() const override; + void setCollisionId(int s) { collisionId_ = s; } + int collisionId() const { return collisionId_; } + + const GenStatusFlags &statusFlags() const { return statusFlags_; } + GenStatusFlags &statusFlags() { return statusFlags_; } + + ///////////////////////////////////////////////////////////////////////////// + //basic set of gen status flags accessible directly here + //the rest accessible through statusFlags() + //(see GenStatusFlags.h for their meaning) + + ///////////////////////////////////////////////////////////////////////////// + //these are robust, generator-independent functions for categorizing + //mainly final state particles, but also intermediate hadrons/taus + + //is particle prompt (not from hadron, muon, or tau decay) and final state + bool isPromptFinalState() const { return status() == 1 && statusFlags_.isPrompt(); } + + //is particle prompt (not from hadron, muon, or tau decay) and decayed + //such as a prompt tau + bool isPromptDecayed() const { return statusFlags_.isDecayedLeptonHadron() && statusFlags_.isPrompt(); } + + //this particle is a direct decay product of a prompt tau and is final state + //(eg an electron or muon from a leptonic decay of a prompt tau) + bool isDirectPromptTauDecayProductFinalState() const { + return status() == 1 && statusFlags_.isDirectPromptTauDecayProduct(); + } + + ///////////////////////////////////////////////////////////////////////////// + //these are generator history-dependent functions for tagging particles + //associated with the hard process + //Currently implemented for Pythia 6 and Pythia 8 status codes and history + //and may not have 100% consistent meaning across all types of processes + //Users are strongly encouraged to stick to the more robust flags above, + //as well as the expanded set available in GenStatusFlags.h + + //this particle is part of the hard process + bool isHardProcess() const { return statusFlags_.isHardProcess(); } + + //this particle is the final state direct descendant of a hard process particle + bool fromHardProcessFinalState() const { return status() == 1 && statusFlags_.fromHardProcess(); } + + //this particle is the decayed direct descendant of a hard process particle + //such as a tau from the hard process + bool fromHardProcessDecayed() const { + return statusFlags_.isDecayedLeptonHadron() && statusFlags_.fromHardProcess(); + } + + //this particle is a direct decay product of a hardprocess tau and is final state + //(eg an electron or muon from a leptonic decay of a tau from the hard process) + bool isDirectHardProcessTauDecayProductFinalState() const { + return status() == 1 && statusFlags_.isDirectHardProcessTauDecayProduct(); + } + + //this particle is the direct descendant of a hard process particle of the same pdg id. + //For outgoing particles the kinematics are those before QCD or QED FSR + //This corresponds roughly to status code 3 in pythia 6 + //This is the most complex and error prone of all the flags and you are strongly encouraged + //to consider using the others to fill your needs. + bool fromHardProcessBeforeFSR() const { return statusFlags_.fromHardProcessBeforeFSR(); } + + //provided for convenience. Use this one if you were using status 3 before and didn't know or care what it exactly meant + bool isMostlyLikePythia6Status3() { return fromHardProcessBeforeFSR(); } + + //this particle is the last copy of the particle in the chain with the same pdg id + //(and therefore is more likely, but not guaranteed, to carry the final physical momentum) + bool isLastCopy() const { return statusFlags_.isLastCopy(); } + + //this particle is the last copy of the particle in the chain with the same pdg id + //before QED or QCD FSR + //(and therefore is more likely, but not guaranteed, to carry the momentum after ISR) + bool isLastCopyBeforeFSR() const { return statusFlags_.isLastCopyBeforeFSR(); } + + private: + /// checp overlap with another candidate + bool overlap(const Candidate &) const override; + int collisionId_; + GenStatusFlags statusFlags_; + }; + + } // namespace io_v1 + using GenParticle = io_v1::GenParticle; } // namespace reco diff --git a/DataFormats/HepMCCandidate/interface/GenParticleFwd.h b/DataFormats/HepMCCandidate/interface/GenParticleFwd.h index a44654967c4d2..c518b4ac55a20 100644 --- a/DataFormats/HepMCCandidate/interface/GenParticleFwd.h +++ b/DataFormats/HepMCCandidate/interface/GenParticleFwd.h @@ -10,7 +10,10 @@ #include "DataFormats/Common/interface/Association.h" namespace reco { - class GenParticle; + namespace io_v1 { + class GenParticle; + } + using GenParticle = io_v1::GenParticle; /// collection of GenParticles typedef std::vector GenParticleCollection; /// persistent reference to a GenParticle diff --git a/DataFormats/HepMCCandidate/src/classes_def.xml b/DataFormats/HepMCCandidate/src/classes_def.xml index 2dac7e22b292b..c3c35763d8c03 100644 --- a/DataFormats/HepMCCandidate/src/classes_def.xml +++ b/DataFormats/HepMCCandidate/src/classes_def.xml @@ -1,15 +1,12 @@ - - - - - + + - - - - + + + + @@ -19,42 +16,39 @@ - - - - - + + + + + - + - - + + - - + + - - - - + + - - - + + - - - + + + diff --git a/DataFormats/JetMatching/interface/JetFlavourInfo.h b/DataFormats/JetMatching/interface/JetFlavourInfo.h index 876f2c75c986a..bbfdbe6f733b6 100644 --- a/DataFormats/JetMatching/interface/JetFlavourInfo.h +++ b/DataFormats/JetMatching/interface/JetFlavourInfo.h @@ -6,7 +6,8 @@ #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" namespace reco { - /**\class JetFlavourInfo JetFlavourInfo.h DataFormats/JetMatching/interface/JetFlavourInfo.h + namespace io_v1 { + /**\class JetFlavourInfo JetFlavourInfo.h DataFormats/JetMatching/interface/JetFlavourInfo.h * \brief Class storing the jet flavour information * * JetFlavourInfo class stores the jet flavour information based on hadrons @@ -15,50 +16,52 @@ namespace reco { * flavours are defined in the JetFlavourClustering producer. */ - class JetFlavourInfo { - public: - JetFlavourInfo(void) : m_hadronFlavour(0), m_partonFlavour(0) {} - JetFlavourInfo(const int hadronFlavour, const int partonFlavour) - : m_hadronFlavour(hadronFlavour), m_partonFlavour(partonFlavour) {} - JetFlavourInfo(const GenParticleRefVector& bHadrons, - const GenParticleRefVector& cHadrons, - const GenParticleRefVector& partons, - const GenParticleRefVector& leptons, - const int hadronFlavour, - const int partonFlavour) - : m_bHadrons(bHadrons), - m_cHadrons(cHadrons), - m_partons(partons), - m_leptons(leptons), - m_hadronFlavour(hadronFlavour), - m_partonFlavour(partonFlavour) {} + class JetFlavourInfo { + public: + JetFlavourInfo(void) : m_hadronFlavour(0), m_partonFlavour(0) {} + JetFlavourInfo(const int hadronFlavour, const int partonFlavour) + : m_hadronFlavour(hadronFlavour), m_partonFlavour(partonFlavour) {} + JetFlavourInfo(const GenParticleRefVector& bHadrons, + const GenParticleRefVector& cHadrons, + const GenParticleRefVector& partons, + const GenParticleRefVector& leptons, + const int hadronFlavour, + const int partonFlavour) + : m_bHadrons(bHadrons), + m_cHadrons(cHadrons), + m_partons(partons), + m_leptons(leptons), + m_hadronFlavour(hadronFlavour), + m_partonFlavour(partonFlavour) {} - /// Return a vector of GenParticleRef's to b hadrons clustered inside the jet - const GenParticleRefVector& getbHadrons() const { return m_bHadrons; } - /// Return a vector of GenParticleRef's to c hadrons clustered inside the jet - const GenParticleRefVector& getcHadrons() const { return m_cHadrons; } - /// Return a vector of GenParticleRef's to partons clustered inside the jet - const GenParticleRefVector& getPartons() const { return m_partons; } - /// Return a vector of GenParticleRef's to leptons clustered inside the jet - const GenParticleRefVector& getLeptons() const { return m_leptons; } - /// Return the hadron-based flavour - const int getHadronFlavour() const { return m_hadronFlavour; } - /// Return the parton-based flavour - const int getPartonFlavour() const { return m_partonFlavour; } + /// Return a vector of GenParticleRef's to b hadrons clustered inside the jet + const GenParticleRefVector& getbHadrons() const { return m_bHadrons; } + /// Return a vector of GenParticleRef's to c hadrons clustered inside the jet + const GenParticleRefVector& getcHadrons() const { return m_cHadrons; } + /// Return a vector of GenParticleRef's to partons clustered inside the jet + const GenParticleRefVector& getPartons() const { return m_partons; } + /// Return a vector of GenParticleRef's to leptons clustered inside the jet + const GenParticleRefVector& getLeptons() const { return m_leptons; } + /// Return the hadron-based flavour + const int getHadronFlavour() const { return m_hadronFlavour; } + /// Return the parton-based flavour + const int getPartonFlavour() const { return m_partonFlavour; } - /// Set the hadron-based flavour - void setHadronFlavour(const int hadronFlavour) { m_hadronFlavour = hadronFlavour; } - /// Set the parton-based flavour - void setPartonFlavour(const int partonFlavour) { m_partonFlavour = partonFlavour; } + /// Set the hadron-based flavour + void setHadronFlavour(const int hadronFlavour) { m_hadronFlavour = hadronFlavour; } + /// Set the parton-based flavour + void setPartonFlavour(const int partonFlavour) { m_partonFlavour = partonFlavour; } - private: - GenParticleRefVector m_bHadrons; - GenParticleRefVector m_cHadrons; - GenParticleRefVector m_partons; - GenParticleRefVector m_leptons; - int m_hadronFlavour; - int m_partonFlavour; - }; + private: + GenParticleRefVector m_bHadrons; + GenParticleRefVector m_cHadrons; + GenParticleRefVector m_partons; + GenParticleRefVector m_leptons; + int m_hadronFlavour; + int m_partonFlavour; + }; + } // namespace io_v1 + using JetFlavourInfo = io_v1::JetFlavourInfo; } // namespace reco #endif diff --git a/DataFormats/JetMatching/interface/JetFlavourInfoMatching.h b/DataFormats/JetMatching/interface/JetFlavourInfoMatching.h index cbe88b557f229..ba93587ea049d 100644 --- a/DataFormats/JetMatching/interface/JetFlavourInfoMatching.h +++ b/DataFormats/JetMatching/interface/JetFlavourInfoMatching.h @@ -12,16 +12,21 @@ namespace reco { typedef edm::AssociationVector, std::vector > JetFlavourInfoMatchingCollectionBase; - class JetFlavourInfoMatchingCollection : public JetFlavourInfoMatchingCollectionBase { - public: - JetFlavourInfoMatchingCollection() : JetFlavourInfoMatchingCollectionBase() {} + namespace io_v1 { - JetFlavourInfoMatchingCollection(const reco::CaloJetRefProd &ref) - : JetFlavourInfoMatchingCollectionBase(edm::RefToBaseProd(ref)) {} + class JetFlavourInfoMatchingCollection : public reco::JetFlavourInfoMatchingCollectionBase { + public: + JetFlavourInfoMatchingCollection() : reco::JetFlavourInfoMatchingCollectionBase() {} - JetFlavourInfoMatchingCollection(const JetFlavourInfoMatchingCollectionBase &v) - : JetFlavourInfoMatchingCollectionBase(v) {} - }; + JetFlavourInfoMatchingCollection(const reco::CaloJetRefProd &ref) + : reco::JetFlavourInfoMatchingCollectionBase(edm::RefToBaseProd(ref)) {} + + JetFlavourInfoMatchingCollection(const reco::JetFlavourInfoMatchingCollectionBase &v) + : reco::JetFlavourInfoMatchingCollectionBase(v) {} + }; + + } // namespace io_v1 + using JetFlavourInfoMatchingCollection = io_v1::JetFlavourInfoMatchingCollection; typedef JetFlavourInfoMatchingCollection::value_type JetFlavourInfoMatching; diff --git a/DataFormats/JetMatching/src/classes_def.xml b/DataFormats/JetMatching/src/classes_def.xml index 569e9d760bc65..042d9d8f88d52 100755 --- a/DataFormats/JetMatching/src/classes_def.xml +++ b/DataFormats/JetMatching/src/classes_def.xml @@ -1,39 +1,37 @@ - - + + - - + + - - - + + - + - - + + - - + + - - + + - - - + + @@ -42,18 +40,17 @@ - - + + - - + + - - - + + diff --git a/DataFormats/JetReco/interface/BasicJet.h b/DataFormats/JetReco/interface/BasicJet.h index 2ab1de643879a..a490a6adda360 100644 --- a/DataFormats/JetReco/interface/BasicJet.h +++ b/DataFormats/JetReco/interface/BasicJet.h @@ -16,27 +16,30 @@ #include "DataFormats/JetReco/interface/Jet.h" namespace reco { - class BasicJet : public Jet { - public: - /** Default constructor*/ - BasicJet() {} - - /** Constructor from values*/ - BasicJet(const LorentzVector& fP4, const Point& fVertex); - BasicJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); - - ~BasicJet() override {} - - /// Polymorphic clone - BasicJet* clone() const override; - - /// Print object - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - }; + namespace io_v1 { + class BasicJet : public Jet { + public: + /** Default constructor*/ + BasicJet() {} + + /** Constructor from values*/ + BasicJet(const LorentzVector& fP4, const Point& fVertex); + BasicJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); + + ~BasicJet() override {} + + /// Polymorphic clone + BasicJet* clone() const override; + + /// Print object + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + }; + } // namespace io_v1 + using BasicJet = io_v1::BasicJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/BasicJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/CaloJet.h b/DataFormats/JetReco/interface/CaloJet.h index 9445f205ce8b7..b211573133db5 100644 --- a/DataFormats/JetReco/interface/CaloJet.h +++ b/DataFormats/JetReco/interface/CaloJet.h @@ -24,140 +24,143 @@ #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" namespace reco { - class CaloJet : public Jet { - public: - typedef CaloTowerPtr ConstituentTypePtr; - typedef CaloTowerFwdPtr ConstituentTypeFwdPtr; - - struct Specific { - Specific() - : mMaxEInEmTowers(0), - mMaxEInHadTowers(0), - mHadEnergyInHO(0), - mHadEnergyInHB(0), - mHadEnergyInHF(0), - mHadEnergyInHE(0), - mEmEnergyInEB(0), - mEmEnergyInEE(0), - mEmEnergyInHF(0), - mEnergyFractionHadronic(0), - mEnergyFractionEm(0), - mTowersArea(0) {} - - /// Maximum energy in EM towers - float mMaxEInEmTowers; - /// Maximum energy in HCAL towers - float mMaxEInHadTowers; - /// Hadronic nergy fraction in HO - float mHadEnergyInHO; - /// Hadronic energy in HB - float mHadEnergyInHB; - /// Hadronic energy in HF - float mHadEnergyInHF; - /// Hadronic energy in HE - float mHadEnergyInHE; - /// Em energy in EB - float mEmEnergyInEB; - /// Em energy in EE - float mEmEnergyInEE; - /// Em energy in HF - float mEmEnergyInHF; - /// Hadronic energy fraction - float mEnergyFractionHadronic; - /// Em energy fraction - float mEnergyFractionEm; - /// Area of contributing CaloTowers - float mTowersArea; + namespace io_v1 { + class CaloJet : public Jet { + public: + typedef CaloTowerPtr ConstituentTypePtr; + typedef CaloTowerFwdPtr ConstituentTypeFwdPtr; + + struct Specific { + Specific() + : mMaxEInEmTowers(0), + mMaxEInHadTowers(0), + mHadEnergyInHO(0), + mHadEnergyInHB(0), + mHadEnergyInHF(0), + mHadEnergyInHE(0), + mEmEnergyInEB(0), + mEmEnergyInEE(0), + mEmEnergyInHF(0), + mEnergyFractionHadronic(0), + mEnergyFractionEm(0), + mTowersArea(0) {} + + /// Maximum energy in EM towers + float mMaxEInEmTowers; + /// Maximum energy in HCAL towers + float mMaxEInHadTowers; + /// Hadronic nergy fraction in HO + float mHadEnergyInHO; + /// Hadronic energy in HB + float mHadEnergyInHB; + /// Hadronic energy in HF + float mHadEnergyInHF; + /// Hadronic energy in HE + float mHadEnergyInHE; + /// Em energy in EB + float mEmEnergyInEB; + /// Em energy in EE + float mEmEnergyInEE; + /// Em energy in HF + float mEmEnergyInHF; + /// Hadronic energy fraction + float mEnergyFractionHadronic; + /// Em energy fraction + float mEnergyFractionEm; + /// Area of contributing CaloTowers + float mTowersArea; + }; + + /** Default constructor*/ + CaloJet() {} + + /** Constructor from values*/ + CaloJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + + /** Constructor from values*/ + CaloJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); + + /** backward compatible, vertex=(0,0,0) */ + CaloJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~CaloJet() override {} + + /** Returns the maximum energy deposited in ECAL towers*/ + float maxEInEmTowers() const { return m_specific.mMaxEInEmTowers; } + /** Returns the maximum energy deposited in HCAL towers*/ + float maxEInHadTowers() const { return m_specific.mMaxEInHadTowers; } + /** Returns the jet hadronic energy fraction*/ + float energyFractionHadronic() const { return m_specific.mEnergyFractionHadronic; } + /** Returns the jet electromagnetic energy fraction*/ + float emEnergyFraction() const { return m_specific.mEnergyFractionEm; } + /** Returns the jet hadronic energy in HB*/ + float hadEnergyInHB() const { return m_specific.mHadEnergyInHB; } + /** Returns the jet hadronic energy in HO*/ + float hadEnergyInHO() const { return m_specific.mHadEnergyInHO; } + /** Returns the jet hadronic energy in HE*/ + float hadEnergyInHE() const { return m_specific.mHadEnergyInHE; } + /** Returns the jet hadronic energy in HF*/ + float hadEnergyInHF() const { return m_specific.mHadEnergyInHF; } + /** Returns the jet electromagnetic energy in EB*/ + float emEnergyInEB() const { return m_specific.mEmEnergyInEB; } + /** Returns the jet electromagnetic energy in EE*/ + float emEnergyInEE() const { return m_specific.mEmEnergyInEE; } + /** Returns the jet electromagnetic energy extracted from HF*/ + float emEnergyInHF() const { return m_specific.mEmEnergyInHF; } + /** Returns area of contributing towers */ + float towersArea() const { return m_specific.mTowersArea; } + /** Returns the number of constituents carrying a 90% of the total Jet energy*/ + int n90() const { return nCarrying(0.9); } + /** Returns the number of constituents carrying a 60% of the total Jet energy*/ + int n60() const { return nCarrying(0.6); } + + /// Physics Eta (use jet Z and kinematics only) + // float physicsEtaQuick (float fZVertex) const; + /// Physics Eta (use jet Z and kinematics only) + //float physicsEta (float fZVertex) const {return physicsEtaQuick (fZVertex);} + /// Physics p4 (use jet Z and kinematics only) + //LorentzVector physicsP4 (float fZVertex) const; + /// Physics p4 for full 3d vertex corretion + LorentzVector physicsP4(const Particle::Point& vertex) const; + /// detector p4 for full 3d vertex correction. + LorentzVector detectorP4() const; + + /// Physics Eta (loop over constituents) + //float physicsEtaDetailed (float fZVertex) const; + + /// Detector Eta (default for CaloJets) + //float detectorEta () const {return eta();} + + /// get specific constituent + virtual CaloTowerPtr getCaloConstituent(unsigned fIndex) const; + /// get all constituents + virtual std::vector getCaloConstituents() const; + + // block accessors + + const Specific& getSpecific() const { return m_specific; } + + /// Polymorphic clone + CaloJet* clone() const override; + + /// Print object + std::string print() const override; + + /// CaloTowers indexes + std::vector getTowerIndices() const; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + //Variables specific to to the CaloJet class + Specific m_specific; }; - - /** Default constructor*/ - CaloJet() {} - - /** Constructor from values*/ - CaloJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - - /** Constructor from values*/ - CaloJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); - - /** backward compatible, vertex=(0,0,0) */ - CaloJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~CaloJet() override {} - - /** Returns the maximum energy deposited in ECAL towers*/ - float maxEInEmTowers() const { return m_specific.mMaxEInEmTowers; } - /** Returns the maximum energy deposited in HCAL towers*/ - float maxEInHadTowers() const { return m_specific.mMaxEInHadTowers; } - /** Returns the jet hadronic energy fraction*/ - float energyFractionHadronic() const { return m_specific.mEnergyFractionHadronic; } - /** Returns the jet electromagnetic energy fraction*/ - float emEnergyFraction() const { return m_specific.mEnergyFractionEm; } - /** Returns the jet hadronic energy in HB*/ - float hadEnergyInHB() const { return m_specific.mHadEnergyInHB; } - /** Returns the jet hadronic energy in HO*/ - float hadEnergyInHO() const { return m_specific.mHadEnergyInHO; } - /** Returns the jet hadronic energy in HE*/ - float hadEnergyInHE() const { return m_specific.mHadEnergyInHE; } - /** Returns the jet hadronic energy in HF*/ - float hadEnergyInHF() const { return m_specific.mHadEnergyInHF; } - /** Returns the jet electromagnetic energy in EB*/ - float emEnergyInEB() const { return m_specific.mEmEnergyInEB; } - /** Returns the jet electromagnetic energy in EE*/ - float emEnergyInEE() const { return m_specific.mEmEnergyInEE; } - /** Returns the jet electromagnetic energy extracted from HF*/ - float emEnergyInHF() const { return m_specific.mEmEnergyInHF; } - /** Returns area of contributing towers */ - float towersArea() const { return m_specific.mTowersArea; } - /** Returns the number of constituents carrying a 90% of the total Jet energy*/ - int n90() const { return nCarrying(0.9); } - /** Returns the number of constituents carrying a 60% of the total Jet energy*/ - int n60() const { return nCarrying(0.6); } - - /// Physics Eta (use jet Z and kinematics only) - // float physicsEtaQuick (float fZVertex) const; - /// Physics Eta (use jet Z and kinematics only) - //float physicsEta (float fZVertex) const {return physicsEtaQuick (fZVertex);} - /// Physics p4 (use jet Z and kinematics only) - //LorentzVector physicsP4 (float fZVertex) const; - /// Physics p4 for full 3d vertex corretion - LorentzVector physicsP4(const Particle::Point& vertex) const; - /// detector p4 for full 3d vertex correction. - LorentzVector detectorP4() const; - - /// Physics Eta (loop over constituents) - //float physicsEtaDetailed (float fZVertex) const; - - /// Detector Eta (default for CaloJets) - //float detectorEta () const {return eta();} - - /// get specific constituent - virtual CaloTowerPtr getCaloConstituent(unsigned fIndex) const; - /// get all constituents - virtual std::vector getCaloConstituents() const; - - // block accessors - - const Specific& getSpecific() const { return m_specific; } - - /// Polymorphic clone - CaloJet* clone() const override; - - /// Print object - std::string print() const override; - - /// CaloTowers indexes - std::vector getTowerIndices() const; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - //Variables specific to to the CaloJet class - Specific m_specific; - }; + } // namespace io_v1 + using CaloJet = io_v1::CaloJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/CaloJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/CaloJetFwd.h b/DataFormats/JetReco/interface/CaloJetFwd.h index e242d3de59a04..264229e15a4e2 100644 --- a/DataFormats/JetReco/interface/CaloJetFwd.h +++ b/DataFormats/JetReco/interface/CaloJetFwd.h @@ -1,7 +1,10 @@ #ifndef DataFormats_JetReco_CaloJetFwd_h #define DataFormats_JetReco_CaloJetFwd_h namespace reco { - class CaloJet; -} + namespace io_v1 { + class CaloJet; + } + using CaloJet = io_v1::CaloJet; +} // namespace reco #endif diff --git a/DataFormats/JetReco/interface/GenJet.h b/DataFormats/JetReco/interface/GenJet.h index 24fd9609a30f6..d362f89f96925 100644 --- a/DataFormats/JetReco/interface/GenJet.h +++ b/DataFormats/JetReco/interface/GenJet.h @@ -16,124 +16,126 @@ ************************************************************/ #include "DataFormats/JetReco/interface/Jet.h" +#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" namespace reco { - class GenParticle; - - class GenJet : public Jet { - public: - struct Specific { - Specific() - : m_EmEnergy(0), - m_HadEnergy(0), - m_InvisibleEnergy(0), - m_AuxiliaryEnergy(0), - m_ChargedHadronEnergy(0), - m_NeutralHadronEnergy(0), - m_ChargedEmEnergy(0), - m_NeutralEmEnergy(0), - m_MuonEnergy(0), - m_ChargedHadronMultiplicity(0), - m_NeutralHadronMultiplicity(0), - m_ChargedEmMultiplicity(0), - m_NeutralEmMultiplicity(0), - m_MuonMultiplicity(0) {} - - /// Calo-like definitions: - /// Energy of EM particles - float m_EmEnergy; - /// Energy of Hadrons - float m_HadEnergy; - /// Invisible energy (mu, nu, ...) - float m_InvisibleEnergy; - /// Anything else (undecayed Sigmas etc.) - float m_AuxiliaryEnergy; - - /// PF-like definitions: - /// pi+, K+, etc - float m_ChargedHadronEnergy; - /// K0, etc - float m_NeutralHadronEnergy; - /// Electrons - float m_ChargedEmEnergy; - /// Photons - float m_NeutralEmEnergy; - /// Muons - float m_MuonEnergy; - /// Corresponding multiplicities: - int m_ChargedHadronMultiplicity; - int m_NeutralHadronMultiplicity; - int m_ChargedEmMultiplicity; - int m_NeutralEmMultiplicity; - int m_MuonMultiplicity; + namespace io_v1 { + class GenJet : public Jet { + public: + struct Specific { + Specific() + : m_EmEnergy(0), + m_HadEnergy(0), + m_InvisibleEnergy(0), + m_AuxiliaryEnergy(0), + m_ChargedHadronEnergy(0), + m_NeutralHadronEnergy(0), + m_ChargedEmEnergy(0), + m_NeutralEmEnergy(0), + m_MuonEnergy(0), + m_ChargedHadronMultiplicity(0), + m_NeutralHadronMultiplicity(0), + m_ChargedEmMultiplicity(0), + m_NeutralEmMultiplicity(0), + m_MuonMultiplicity(0) {} + + /// Calo-like definitions: + /// Energy of EM particles + float m_EmEnergy; + /// Energy of Hadrons + float m_HadEnergy; + /// Invisible energy (mu, nu, ...) + float m_InvisibleEnergy; + /// Anything else (undecayed Sigmas etc.) + float m_AuxiliaryEnergy; + + /// PF-like definitions: + /// pi+, K+, etc + float m_ChargedHadronEnergy; + /// K0, etc + float m_NeutralHadronEnergy; + /// Electrons + float m_ChargedEmEnergy; + /// Photons + float m_NeutralEmEnergy; + /// Muons + float m_MuonEnergy; + /// Corresponding multiplicities: + int m_ChargedHadronMultiplicity; + int m_NeutralHadronMultiplicity; + int m_ChargedEmMultiplicity; + int m_NeutralEmMultiplicity; + int m_MuonMultiplicity; + }; + + /** Default constructor*/ + GenJet() {} + + /** Constructor from values*/ + GenJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + GenJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); + + /** backward compatible, vertex=(0,0,0) */ + GenJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~GenJet() override {} + /** Returns energy of electromagnetic particles*/ + float emEnergy() const { return m_specific.m_EmEnergy; }; + /** Returns energy of hadronic particles*/ + float hadEnergy() const { return m_specific.m_HadEnergy; }; + /** Returns invisible energy*/ + float invisibleEnergy() const { return m_specific.m_InvisibleEnergy; }; + /** Returns other energy (undecayed Sigmas etc.)*/ + float auxiliaryEnergy() const { return m_specific.m_AuxiliaryEnergy; }; + + // PF-like definitions + float chargedHadronEnergy() const { return m_specific.m_ChargedHadronEnergy; } + float neutralHadronEnergy() const { return m_specific.m_NeutralHadronEnergy; } + float chargedEmEnergy() const { return m_specific.m_ChargedEmEnergy; } + float neutralEmEnergy() const { return m_specific.m_NeutralEmEnergy; } + float muonEnergy() const { return m_specific.m_MuonEnergy; } + int chargedHadronMultiplicity() const { return m_specific.m_ChargedHadronMultiplicity; } + int neutralHadronMultiplicity() const { return m_specific.m_NeutralHadronMultiplicity; } + int chargedEmMultiplicity() const { return m_specific.m_ChargedEmMultiplicity; } + int neutralEmMultiplicity() const { return m_specific.m_NeutralEmMultiplicity; } + int muonMultiplicity() const { return m_specific.m_MuonMultiplicity; } + + /// Detector Eta (use reference Z and jet kinematics only) + float detectorEta(float fZVertex) const; + + /// convert generic constituent to specific type + static const GenParticle* genParticle(const reco::Candidate* fConstituent); + /// get specific constituent + virtual const GenParticle* getGenConstituent(unsigned fIndex) const; + /// get all constituents + virtual std::vector getGenConstituents() const; + + // block accessors + + const Specific& getSpecific() const { return m_specific; } + + /// set the specific (note: responsibility of keeping it consistent with the jet daughers belongs to the caller) + void setSpecific(const Specific& spec) { m_specific = spec; } + + /// Polymorphic clone + GenJet* clone() const override; + + /// Print object + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + // Data members + //Variables specific to to the GenJet class + Specific m_specific; }; - - /** Default constructor*/ - GenJet() {} - - /** Constructor from values*/ - GenJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - GenJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); - - /** backward compatible, vertex=(0,0,0) */ - GenJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~GenJet() override {} - /** Returns energy of electromagnetic particles*/ - float emEnergy() const { return m_specific.m_EmEnergy; }; - /** Returns energy of hadronic particles*/ - float hadEnergy() const { return m_specific.m_HadEnergy; }; - /** Returns invisible energy*/ - float invisibleEnergy() const { return m_specific.m_InvisibleEnergy; }; - /** Returns other energy (undecayed Sigmas etc.)*/ - float auxiliaryEnergy() const { return m_specific.m_AuxiliaryEnergy; }; - - // PF-like definitions - float chargedHadronEnergy() const { return m_specific.m_ChargedHadronEnergy; } - float neutralHadronEnergy() const { return m_specific.m_NeutralHadronEnergy; } - float chargedEmEnergy() const { return m_specific.m_ChargedEmEnergy; } - float neutralEmEnergy() const { return m_specific.m_NeutralEmEnergy; } - float muonEnergy() const { return m_specific.m_MuonEnergy; } - int chargedHadronMultiplicity() const { return m_specific.m_ChargedHadronMultiplicity; } - int neutralHadronMultiplicity() const { return m_specific.m_NeutralHadronMultiplicity; } - int chargedEmMultiplicity() const { return m_specific.m_ChargedEmMultiplicity; } - int neutralEmMultiplicity() const { return m_specific.m_NeutralEmMultiplicity; } - int muonMultiplicity() const { return m_specific.m_MuonMultiplicity; } - - /// Detector Eta (use reference Z and jet kinematics only) - float detectorEta(float fZVertex) const; - - /// convert generic constituent to specific type - static const GenParticle* genParticle(const reco::Candidate* fConstituent); - /// get specific constituent - virtual const GenParticle* getGenConstituent(unsigned fIndex) const; - /// get all constituents - virtual std::vector getGenConstituents() const; - - // block accessors - - const Specific& getSpecific() const { return m_specific; } - - /// set the specific (note: responsibility of keeping it consistent with the jet daughers belongs to the caller) - void setSpecific(const Specific& spec) { m_specific = spec; } - - /// Polymorphic clone - GenJet* clone() const override; - - /// Print object - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - // Data members - //Variables specific to to the GenJet class - Specific m_specific; - }; + } // namespace io_v1 + using GenJet = io_v1::GenJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/GenJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/GenJetFwd.h b/DataFormats/JetReco/interface/GenJetFwd.h index b7c18220156bc..b60dc627b8914 100644 --- a/DataFormats/JetReco/interface/GenJetFwd.h +++ b/DataFormats/JetReco/interface/GenJetFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_JetReco_GenJetFwd_h #define DataFormats_JetReco_GenJetFwd_h namespace reco { - class GenJet; -} + namespace io_v1 { + class GenJet; + } + using GenJet = io_v1::GenJet; +} // namespace reco #endif diff --git a/DataFormats/JetReco/interface/JPTJet.h b/DataFormats/JetReco/interface/JPTJet.h index 127c96e6af14a..9a1360954fe59 100644 --- a/DataFormats/JetReco/interface/JPTJet.h +++ b/DataFormats/JetReco/interface/JPTJet.h @@ -25,120 +25,123 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class JPTJet : public Jet { - public: - struct Specific { - Specific() - : mChargedHadronEnergy(0), - mChargedEmEnergy(0), - mResponseOfChargedWithEff(0), - mResponseOfChargedWithoutEff(0), - mSumPtOfChargedWithEff(0), - mSumPtOfChargedWithoutEff(0), - mSumEnergyOfChargedWithEff(0), - mSumEnergyOfChargedWithoutEff(0), - R2momtr(0), - Eta2momtr(0), - Phi2momtr(0), - Pout(0), - Zch(0), - JPTSeed(0) {} - edm::RefToBase theCaloJetRef; - reco::TrackRefVector pionsInVertexInCalo; - reco::TrackRefVector pionsInVertexOutCalo; - reco::TrackRefVector pionsOutVertexInCalo; - reco::TrackRefVector muonsInVertexInCalo; - reco::TrackRefVector muonsInVertexOutCalo; - reco::TrackRefVector muonsOutVertexInCalo; - reco::TrackRefVector elecsInVertexInCalo; - reco::TrackRefVector elecsInVertexOutCalo; - reco::TrackRefVector elecsOutVertexInCalo; - float mChargedHadronEnergy; - float mChargedEmEnergy; - float mResponseOfChargedWithEff; - float mResponseOfChargedWithoutEff; - float mSumPtOfChargedWithEff; - float mSumPtOfChargedWithoutEff; - float mSumEnergyOfChargedWithEff; - float mSumEnergyOfChargedWithoutEff; - float R2momtr; - float Eta2momtr; - float Phi2momtr; - float Pout; - float Zch; - int JPTSeed; + namespace io_v1 { + class JPTJet : public Jet { + public: + struct Specific { + Specific() + : mChargedHadronEnergy(0), + mChargedEmEnergy(0), + mResponseOfChargedWithEff(0), + mResponseOfChargedWithoutEff(0), + mSumPtOfChargedWithEff(0), + mSumPtOfChargedWithoutEff(0), + mSumEnergyOfChargedWithEff(0), + mSumEnergyOfChargedWithoutEff(0), + R2momtr(0), + Eta2momtr(0), + Phi2momtr(0), + Pout(0), + Zch(0), + JPTSeed(0) {} + edm::RefToBase theCaloJetRef; + reco::TrackRefVector pionsInVertexInCalo; + reco::TrackRefVector pionsInVertexOutCalo; + reco::TrackRefVector pionsOutVertexInCalo; + reco::TrackRefVector muonsInVertexInCalo; + reco::TrackRefVector muonsInVertexOutCalo; + reco::TrackRefVector muonsOutVertexInCalo; + reco::TrackRefVector elecsInVertexInCalo; + reco::TrackRefVector elecsInVertexOutCalo; + reco::TrackRefVector elecsOutVertexInCalo; + float mChargedHadronEnergy; + float mChargedEmEnergy; + float mResponseOfChargedWithEff; + float mResponseOfChargedWithoutEff; + float mSumPtOfChargedWithEff; + float mSumPtOfChargedWithoutEff; + float mSumEnergyOfChargedWithEff; + float mSumEnergyOfChargedWithoutEff; + float R2momtr; + float Eta2momtr; + float Phi2momtr; + float Pout; + float Zch; + int JPTSeed; + }; + + /** Default constructor*/ + JPTJet() {} + + /** Constructor from values*/ + JPTJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + + /** backward compatible, vertex=(0,0,0) */ + JPTJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~JPTJet() override {} + /// chargedHadronEnergy + float chargedHadronEnergy() const { return mspecific.mChargedHadronEnergy; } + /// chargedHadronEnergyFraction + float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } + /// chargedEmEnergy + float chargedEmEnergy() const { return mspecific.mChargedEmEnergy; } + /// chargedEmEnergyFraction + float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } + /// chargedMultiplicity + int chargedMultiplicity() const { + return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size() + + mspecific.pionsInVertexInCalo.size() + mspecific.pionsInVertexOutCalo.size() + + mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); + } + /// muonMultiplicity + int muonMultiplicity() const { + return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size(); + } + /// elecMultiplicity + int elecMultiplicity() const { + return mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); + } + /// Tracks + const reco::TrackRefVector& getPionsInVertexInCalo() const { return mspecific.pionsInVertexInCalo; } + const reco::TrackRefVector& getPionsInVertexOutCalo() const { return mspecific.pionsInVertexOutCalo; } + const reco::TrackRefVector& getPionsOutVertexInCalo() const { return mspecific.pionsOutVertexInCalo; } + const reco::TrackRefVector& getMuonsInVertexInCalo() const { return mspecific.muonsInVertexInCalo; } + const reco::TrackRefVector& getMuonsInVertexOutCalo() const { return mspecific.muonsInVertexOutCalo; } + const reco::TrackRefVector& getMuonsOutVertexInCalo() const { return mspecific.muonsOutVertexInCalo; } + const reco::TrackRefVector& getElecsInVertexInCalo() const { return mspecific.elecsInVertexInCalo; } + const reco::TrackRefVector& getElecsInVertexOutCalo() const { return mspecific.elecsInVertexOutCalo; } + const reco::TrackRefVector& getElecsOutVertexInCalo() const { return mspecific.elecsOutVertexInCalo; } + + const edm::RefToBase& getCaloJetRef() const { return mspecific.theCaloJetRef; } + /// block accessors + + const Specific& getSpecific() const { return mspecific; } + + /// Polymorphic clone + JPTJet* clone() const override; + + /// Print object in details + virtual void printJet() const; + + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + //Variables specific to to the JPTJet class + + Specific mspecific; }; - /** Default constructor*/ - JPTJet() {} - - /** Constructor from values*/ - JPTJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - - /** backward compatible, vertex=(0,0,0) */ - JPTJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~JPTJet() override {} - /// chargedHadronEnergy - float chargedHadronEnergy() const { return mspecific.mChargedHadronEnergy; } - /// chargedHadronEnergyFraction - float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } - /// chargedEmEnergy - float chargedEmEnergy() const { return mspecific.mChargedEmEnergy; } - /// chargedEmEnergyFraction - float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } - /// chargedMultiplicity - int chargedMultiplicity() const { - return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size() + - mspecific.pionsInVertexInCalo.size() + mspecific.pionsInVertexOutCalo.size() + - mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); - } - /// muonMultiplicity - int muonMultiplicity() const { - return mspecific.muonsInVertexInCalo.size() + mspecific.muonsInVertexOutCalo.size(); - } - /// elecMultiplicity - int elecMultiplicity() const { - return mspecific.elecsInVertexInCalo.size() + mspecific.elecsInVertexOutCalo.size(); - } - /// Tracks - const reco::TrackRefVector& getPionsInVertexInCalo() const { return mspecific.pionsInVertexInCalo; } - const reco::TrackRefVector& getPionsInVertexOutCalo() const { return mspecific.pionsInVertexOutCalo; } - const reco::TrackRefVector& getPionsOutVertexInCalo() const { return mspecific.pionsOutVertexInCalo; } - const reco::TrackRefVector& getMuonsInVertexInCalo() const { return mspecific.muonsInVertexInCalo; } - const reco::TrackRefVector& getMuonsInVertexOutCalo() const { return mspecific.muonsInVertexOutCalo; } - const reco::TrackRefVector& getMuonsOutVertexInCalo() const { return mspecific.muonsOutVertexInCalo; } - const reco::TrackRefVector& getElecsInVertexInCalo() const { return mspecific.elecsInVertexInCalo; } - const reco::TrackRefVector& getElecsInVertexOutCalo() const { return mspecific.elecsInVertexOutCalo; } - const reco::TrackRefVector& getElecsOutVertexInCalo() const { return mspecific.elecsOutVertexInCalo; } - - const edm::RefToBase& getCaloJetRef() const { return mspecific.theCaloJetRef; } - /// block accessors - - const Specific& getSpecific() const { return mspecific; } - - /// Polymorphic clone - JPTJet* clone() const override; - - /// Print object in details - virtual void printJet() const; - - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - //Variables specific to to the JPTJet class - - Specific mspecific; - }; - - // streamer - //std::ostream& operator<<(std::ostream& out, const reco::JPTJet& jet); + // streamer + //std::ostream& operator<<(std::ostream& out, const reco::JPTJet& jet); + } // namespace io_v1 + using JPTJet = io_v1::JPTJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/JPTJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/Jet.h b/DataFormats/JetReco/interface/Jet.h index 56081b3dcc756..8a1ab3ac8092b 100644 --- a/DataFormats/JetReco/interface/Jet.h +++ b/DataFormats/JetReco/interface/Jet.h @@ -17,113 +17,116 @@ #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" namespace reco { - class Jet : public CompositePtrCandidate { - public: - typedef edm::Ptr Constituent; - typedef std::vector Constituents; - - /// record to store eta-phi first and second moments - class EtaPhiMoments { + namespace io_v1 { + class Jet : public CompositePtrCandidate { public: - float etaMean; - float phiMean; - float etaEtaMoment; - float phiPhiMoment; - float etaPhiMoment; - }; + typedef edm::Ptr Constituent; + typedef std::vector Constituents; - /// Default constructor - Jet() : mJetArea(0), mPileupEnergy(0), mPassNumber(0), mIsWeighted(false) {} - /// Initiator - Jet(const LorentzVector& fP4, const Point& fVertex); - Jet(const LorentzVector& fP4, const Point& fVertex, const Constituents& fConstituents); - /// Destructor - ~Jet() override {} + /// record to store eta-phi first and second moments + class EtaPhiMoments { + public: + float etaMean; + float phiMean; + float etaEtaMoment; + float phiPhiMoment; + float etaPhiMoment; + }; - /// eta-phi statistics, ET weighted - EtaPhiMoments etaPhiStatistics() const; + /// Default constructor + Jet() : mJetArea(0), mPileupEnergy(0), mPassNumber(0), mIsWeighted(false) {} + /// Initiator + Jet(const LorentzVector& fP4, const Point& fVertex); + Jet(const LorentzVector& fP4, const Point& fVertex, const Constituents& fConstituents); + /// Destructor + ~Jet() override {} - /// eta-eta second moment, ET weighted - float etaetaMoment() const; + /// eta-phi statistics, ET weighted + EtaPhiMoments etaPhiStatistics() const; - /// phi-phi second moment, ET weighted - float phiphiMoment() const; + /// eta-eta second moment, ET weighted + float etaetaMoment() const; - /// eta-phi second moment, ET weighted - float etaphiMoment() const; + /// phi-phi second moment, ET weighted + float phiphiMoment() const; - /// ET in annulus between rmin and rmax around jet direction - float etInAnnulus(float fRmin, float fRmax) const; + /// eta-phi second moment, ET weighted + float etaphiMoment() const; - /// return # of constituent carrying fraction of energy - int nCarrying(float fFraction) const; + /// ET in annulus between rmin and rmax around jet direction + float etInAnnulus(float fRmin, float fRmax) const; - /// maximum distance from jet to constituent - float maxDistance() const; + /// return # of constituent carrying fraction of energy + int nCarrying(float fFraction) const; - /// # of constituents - virtual int nConstituents() const { return numberOfDaughters(); } + /// maximum distance from jet to constituent + float maxDistance() const; - /// static function to convert detector eta to physics eta - static float physicsEta(float fZVertex, float fDetectorEta); + /// # of constituents + virtual int nConstituents() const { return numberOfDaughters(); } - /// static function to convert physics eta to detector eta - static float detectorEta(float fZVertex, float fPhysicsEta); + /// static function to convert detector eta to physics eta + static float physicsEta(float fZVertex, float fDetectorEta); - static Candidate::LorentzVector physicsP4(const Candidate::Point& newVertex, - const Candidate& inParticle, - const Candidate::Point& oldVertex = Candidate::Point(0, 0, 0)); + /// static function to convert physics eta to detector eta + static float detectorEta(float fZVertex, float fPhysicsEta); - static Candidate::LorentzVector detectorP4(const Candidate::Point& vertex, const Candidate& inParticle); + static Candidate::LorentzVector physicsP4(const Candidate::Point& newVertex, + const Candidate& inParticle, + const Candidate::Point& oldVertex = Candidate::Point(0, 0, 0)); - /// list of constituents - virtual Constituents getJetConstituents() const; + static Candidate::LorentzVector detectorP4(const Candidate::Point& vertex, const Candidate& inParticle); - /// quick list of constituents - virtual std::vector getJetConstituentsQuick() const; + /// list of constituents + virtual Constituents getJetConstituents() const; - // jet structure variables: - // constituentPtDistribution is the pT distribution among the jet constituents - // (ptDistribution = 1 if jet made by one constituent carrying all its momentum, - // ptDistribution = 0 if jet made by infinite constituents carrying an infinitesimal fraction of pt): - float constituentPtDistribution() const; + /// quick list of constituents + virtual std::vector getJetConstituentsQuick() const; - // rmsCand is the rms of the eta-phi spread of the jet's constituents wrt the jet axis: - float constituentEtaPhiSpread() const; + // jet structure variables: + // constituentPtDistribution is the pT distribution among the jet constituents + // (ptDistribution = 1 if jet made by one constituent carrying all its momentum, + // ptDistribution = 0 if jet made by infinite constituents carrying an infinitesimal fraction of pt): + float constituentPtDistribution() const; - /// Print object - virtual std::string print() const; + // rmsCand is the rms of the eta-phi spread of the jet's constituents wrt the jet axis: + float constituentEtaPhiSpread() const; - /// scale energy of the jet - virtual void scaleEnergy(double fScale); + /// Print object + virtual std::string print() const; - /// set jet area - virtual void setJetArea(float fArea) { mJetArea = fArea; } - /// get jet area - virtual float jetArea() const { return mJetArea; } + /// scale energy of the jet + virtual void scaleEnergy(double fScale); - /// Set pileup energy contribution as calculated by algorithm - virtual void setPileup(float fEnergy) { mPileupEnergy = fEnergy; } - /// pileup energy contribution as calculated by algorithm - virtual float pileup() const { return mPileupEnergy; } + /// set jet area + virtual void setJetArea(float fArea) { mJetArea = fArea; } + /// get jet area + virtual float jetArea() const { return mJetArea; } - /// Set number of passes taken by algorithm - virtual void setNPasses(int fPasses) { mPassNumber = fPasses; } - /// number of passes taken by algorithm - virtual int nPasses() const { return mPassNumber; } + /// Set pileup energy contribution as calculated by algorithm + virtual void setPileup(float fEnergy) { mPileupEnergy = fEnergy; } + /// pileup energy contribution as calculated by algorithm + virtual float pileup() const { return mPileupEnergy; } - /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) - virtual void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } - /// boolean if weights were applied by algorithm (e.g. PUPPI weights) - virtual int isWeighted() const { return mIsWeighted; } + /// Set number of passes taken by algorithm + virtual void setNPasses(int fPasses) { mPassNumber = fPasses; } + /// number of passes taken by algorithm + virtual int nPasses() const { return mPassNumber; } - bool isJet() const override; + /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) + virtual void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } + /// boolean if weights were applied by algorithm (e.g. PUPPI weights) + virtual int isWeighted() const { return mIsWeighted; } - private: - float mJetArea; - float mPileupEnergy; - int mPassNumber; - bool mIsWeighted; - }; + bool isJet() const override; + + private: + float mJetArea; + float mPileupEnergy; + int mPassNumber; + bool mIsWeighted; + }; + } // namespace io_v1 + using Jet = io_v1::Jet; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/JetExtendedAssociation.h b/DataFormats/JetReco/interface/JetExtendedAssociation.h index 38c7c1ca27740..cde4775c92e03 100644 --- a/DataFormats/JetReco/interface/JetExtendedAssociation.h +++ b/DataFormats/JetReco/interface/JetExtendedAssociation.h @@ -22,9 +22,12 @@ namespace fwlite { namespace reco { namespace JetExtendedAssociation { - class JetExtendedData; + namespace io_v1 { + class JetExtendedData; + } + using io_v1::JetExtendedData; typedef math::PtEtaPhiELorentzVectorF LorentzVector; - typedef reco::JetExtendedAssociation::JetExtendedData Value; + typedef reco::JetExtendedAssociation::io_v1::JetExtendedData Value; typedef std::vector Values; typedef edm::AssociationVector Container; typedef Container::value_type value_type; @@ -64,15 +67,17 @@ namespace reco { /// check if jet is associated bool hasJet(const Container&, const reco::Jet&); - class JetExtendedData { - public: - JetExtendedData(); - ~JetExtendedData() {} - int mTracksAtVertexNumber; - LorentzVector mTracksAtVertexP4; - int mTracksAtCaloNumber; - LorentzVector mTracksAtCaloP4; - }; + namespace io_v1 { + class JetExtendedData { + public: + JetExtendedData(); + ~JetExtendedData() {} + int mTracksAtVertexNumber; + LorentzVector mTracksAtVertexP4; + int mTracksAtCaloNumber; + LorentzVector mTracksAtCaloP4; + }; + } // namespace io_v1 } // namespace JetExtendedAssociation } // namespace reco diff --git a/DataFormats/JetReco/interface/JetFwd.h b/DataFormats/JetReco/interface/JetFwd.h index f815e76e5f481..53bb2592d9a10 100644 --- a/DataFormats/JetReco/interface/JetFwd.h +++ b/DataFormats/JetReco/interface/JetFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_JetReco_JetFwd_h #define DataFormats_JetReco_JetFwd_h namespace reco { - class Jet; + namespace io_v1 { + class Jet; + } + using Jet = io_v1::Jet; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/JetID.h b/DataFormats/JetReco/interface/JetID.h index 316a47e1784e4..963dd193afb0b 100644 --- a/DataFormats/JetReco/interface/JetID.h +++ b/DataFormats/JetReco/interface/JetID.h @@ -13,54 +13,58 @@ #include "DataFormats/Common/interface/ValueMap.h" namespace reco { - struct JetID { - // initialize - JetID() { - fHPD = 0.0; - fRBX = 0.0; - n90Hits = 0; - fSubDetector1 = 0.0; - fSubDetector2 = 0.0; - fSubDetector3 = 0.0; - fSubDetector4 = 0.0; - restrictedEMF = 0.0; - nHCALTowers = 0; - nECALTowers = 0; - approximatefHPD = 0.0; - approximatefRBX = 0.0; - hitsInN90 = 0; - numberOfHits2RPC = 0; - numberOfHits3RPC = 0; - numberOfHitsRPC = 0; + namespace io_v1 { + struct JetID { + // initialize + JetID() { + fHPD = 0.0; + fRBX = 0.0; + n90Hits = 0; + fSubDetector1 = 0.0; + fSubDetector2 = 0.0; + fSubDetector3 = 0.0; + fSubDetector4 = 0.0; + restrictedEMF = 0.0; + nHCALTowers = 0; + nECALTowers = 0; + approximatefHPD = 0.0; + approximatefRBX = 0.0; + hitsInN90 = 0; + numberOfHits2RPC = 0; + numberOfHits3RPC = 0; + numberOfHitsRPC = 0; - fEB = fEE = fHB = fHE = fHO = fLong = fShort = 0.0; - fLS = fHFOOT = 0.0; - } + fEB = fEE = fHB = fHE = fHO = fLong = fShort = 0.0; + fLS = fHFOOT = 0.0; + } - // hcal+ecal id - float fHPD; - float fRBX; - short n90Hits; - float fSubDetector1; - float fSubDetector2; - float fSubDetector3; - float fSubDetector4; - float restrictedEMF; - short nHCALTowers; - short nECALTowers; - float approximatefHPD; - float approximatefRBX; - short hitsInN90; - // muon hits id - short numberOfHits2RPC; - short numberOfHits3RPC; - short numberOfHitsRPC; + // hcal+ecal id + float fHPD; + float fRBX; + short n90Hits; + float fSubDetector1; + float fSubDetector2; + float fSubDetector3; + float fSubDetector4; + float restrictedEMF; + short nHCALTowers; + short nECALTowers; + float approximatefHPD; + float approximatefRBX; + short hitsInN90; + // muon hits id + short numberOfHits2RPC; + short numberOfHits3RPC; + short numberOfHitsRPC; - float fEB, fEE, fHB, fHE, fHO, fLong, fShort; - float fLS, fHFOOT; - }; + float fEB, fEE, fHB, fHE, fHO, fLong, fShort; + float fLS, fHFOOT; + }; - typedef edm::ValueMap JetIDValueMap; + typedef edm::ValueMap JetIDValueMap; + } // namespace io_v1 + using JetID = io_v1::JetID; + using JetIDValueMap = io_v1::JetIDValueMap; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/PFJet.h b/DataFormats/JetReco/interface/PFJet.h index 3d300767ef373..03cd529803581 100644 --- a/DataFormats/JetReco/interface/PFJet.h +++ b/DataFormats/JetReco/interface/PFJet.h @@ -17,178 +17,181 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" namespace reco { - class PFJet : public Jet { - public: - typedef reco::PFCandidatePtr ConstituentTypePtr; - typedef reco::PFCandidateFwdPtr ConstituentTypeFwdPtr; - - struct Specific { - Specific() - : mChargedHadronEnergy(0), - mNeutralHadronEnergy(0), - mPhotonEnergy(0), - mElectronEnergy(0), - mMuonEnergy(0), - mHFHadronEnergy(0), - mHFEMEnergy(0), - - mChargedHadronMultiplicity(0), - mNeutralHadronMultiplicity(0), - mPhotonMultiplicity(0), - mElectronMultiplicity(0), - mMuonMultiplicity(0), - mHFHadronMultiplicity(0), - mHFEMMultiplicity(0), - - mChargedEmEnergy(0), - mChargedMuEnergy(0), - mNeutralEmEnergy(0), - - mChargedMultiplicity(0), - mNeutralMultiplicity(0), - - mHOEnergy(0) {} - float mChargedHadronEnergy; - float mNeutralHadronEnergy; - float mPhotonEnergy; - float mElectronEnergy; - float mMuonEnergy; - float mHFHadronEnergy; - float mHFEMEnergy; - - int mChargedHadronMultiplicity; - int mNeutralHadronMultiplicity; - int mPhotonMultiplicity; - int mElectronMultiplicity; - int mMuonMultiplicity; - int mHFHadronMultiplicity; - int mHFEMMultiplicity; - - //old (deprecated) data members - //kept only for backwards compatibility: - float mChargedEmEnergy; - float mChargedMuEnergy; - float mNeutralEmEnergy; - int mChargedMultiplicity; - int mNeutralMultiplicity; - - float mHOEnergy; + namespace io_v1 { + class PFJet : public Jet { + public: + typedef reco::PFCandidatePtr ConstituentTypePtr; + typedef reco::PFCandidateFwdPtr ConstituentTypeFwdPtr; + + struct Specific { + Specific() + : mChargedHadronEnergy(0), + mNeutralHadronEnergy(0), + mPhotonEnergy(0), + mElectronEnergy(0), + mMuonEnergy(0), + mHFHadronEnergy(0), + mHFEMEnergy(0), + + mChargedHadronMultiplicity(0), + mNeutralHadronMultiplicity(0), + mPhotonMultiplicity(0), + mElectronMultiplicity(0), + mMuonMultiplicity(0), + mHFHadronMultiplicity(0), + mHFEMMultiplicity(0), + + mChargedEmEnergy(0), + mChargedMuEnergy(0), + mNeutralEmEnergy(0), + + mChargedMultiplicity(0), + mNeutralMultiplicity(0), + + mHOEnergy(0) {} + float mChargedHadronEnergy; + float mNeutralHadronEnergy; + float mPhotonEnergy; + float mElectronEnergy; + float mMuonEnergy; + float mHFHadronEnergy; + float mHFEMEnergy; + + int mChargedHadronMultiplicity; + int mNeutralHadronMultiplicity; + int mPhotonMultiplicity; + int mElectronMultiplicity; + int mMuonMultiplicity; + int mHFHadronMultiplicity; + int mHFEMMultiplicity; + + //old (deprecated) data members + //kept only for backwards compatibility: + float mChargedEmEnergy; + float mChargedMuEnergy; + float mNeutralEmEnergy; + int mChargedMultiplicity; + int mNeutralMultiplicity; + + float mHOEnergy; + }; + + /** Default constructor*/ + PFJet() {} + + /** Constructor from values*/ + PFJet(const LorentzVector& fP4, + const Point& fVertex, + const Specific& fSpecific, + const Jet::Constituents& fConstituents); + + PFJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); + + /** backward compatible, vertex=(0,0,0) */ + PFJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); + + ~PFJet() override {} + + /// chargedHadronEnergy + float chargedHadronEnergy() const { return m_specific.mChargedHadronEnergy; } + /// chargedHadronEnergyFraction + float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } + /// neutralHadronEnergy + float neutralHadronEnergy() const { return m_specific.mNeutralHadronEnergy; } + /// neutralHadronEnergyFraction + float neutralHadronEnergyFraction() const { return neutralHadronEnergy() / energy(); } + /// photonEnergy + float photonEnergy() const { return m_specific.mPhotonEnergy; } + /// photonEnergyFraction + float photonEnergyFraction() const { return photonEnergy() / energy(); } + /// electronEnergy + float electronEnergy() const { return m_specific.mElectronEnergy; } + /// electronEnergyFraction + float electronEnergyFraction() const { return electronEnergy() / energy(); } + /// muonEnergy + float muonEnergy() const { return m_specific.mMuonEnergy; } + /// muonEnergyFraction + float muonEnergyFraction() const { return muonEnergy() / energy(); } + /// HFHadronEnergy + float HFHadronEnergy() const { return m_specific.mHFHadronEnergy; } + /// HFHadronEnergyFraction + float HFHadronEnergyFraction() const { return HFHadronEnergy() / energy(); } + /// HFEMEnergy + float HFEMEnergy() const { return m_specific.mHFEMEnergy; } + /// HFEMEnergyFraction + float HFEMEnergyFraction() const { return HFEMEnergy() / energy(); } + + /// chargedHadronMultiplicity + int chargedHadronMultiplicity() const { return m_specific.mChargedHadronMultiplicity; } + /// neutralHadronMultiplicity + int neutralHadronMultiplicity() const { return m_specific.mNeutralHadronMultiplicity; } + /// photonMultiplicity + int photonMultiplicity() const { return m_specific.mPhotonMultiplicity; } + /// electronMultiplicity + int electronMultiplicity() const { return m_specific.mElectronMultiplicity; } + /// muonMultiplicity + int muonMultiplicity() const { return m_specific.mMuonMultiplicity; } + /// HFHadronMultiplicity + int HFHadronMultiplicity() const { return m_specific.mHFHadronMultiplicity; } + /// HFEMMultiplicity + int HFEMMultiplicity() const { return m_specific.mHFEMMultiplicity; } + + /// chargedEmEnergy + float chargedEmEnergy() const { return m_specific.mChargedEmEnergy; } + /// chargedEmEnergyFraction + float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } + /// chargedMuEnergy + float chargedMuEnergy() const { return m_specific.mChargedMuEnergy; } + /// chargedMuEnergyFraction + float chargedMuEnergyFraction() const { return chargedMuEnergy() / energy(); } + /// neutralEmEnergy + float neutralEmEnergy() const { return m_specific.mNeutralEmEnergy; } + /// neutralEmEnergyFraction + float neutralEmEnergyFraction() const { return neutralEmEnergy() / energy(); } + + /// chargedMultiplicity + int chargedMultiplicity() const { return m_specific.mChargedMultiplicity; } + /// neutralMultiplicity + int neutralMultiplicity() const { return m_specific.mNeutralMultiplicity; } + + /// hoEnergy + float hoEnergy() const { return m_specific.mHOEnergy; } + /// hoEnergyFraction + float hoEnergyFraction() const { return hoEnergy() / energy(); } + + /// get specific constituent + virtual reco::PFCandidatePtr getPFConstituent(unsigned fIndex) const; + + /// get all constituents + virtual std::vector getPFConstituents() const; + + /// \ brief get all tracks in the jets + /// All PFCandidates hold a reference to a track. All the non-null + /// references are added to the returned TrackRefVector + reco::TrackRefVector getTrackRefs() const; + + // block accessors + + const Specific& getSpecific() const { return m_specific; } + + /// Polymorphic clone + PFJet* clone() const override; + + /// Print object in details + std::string print() const override; + + private: + /// Polymorphic overlap + bool overlap(const Candidate&) const override; + + //Variables specific to to the PFJet class + Specific m_specific; }; - /** Default constructor*/ - PFJet() {} - - /** Constructor from values*/ - PFJet(const LorentzVector& fP4, - const Point& fVertex, - const Specific& fSpecific, - const Jet::Constituents& fConstituents); - - PFJet(const LorentzVector& fP4, const Point& fVertex, const Specific& fSpecific); - - /** backward compatible, vertex=(0,0,0) */ - PFJet(const LorentzVector& fP4, const Specific& fSpecific, const Jet::Constituents& fConstituents); - - ~PFJet() override {} - - /// chargedHadronEnergy - float chargedHadronEnergy() const { return m_specific.mChargedHadronEnergy; } - /// chargedHadronEnergyFraction - float chargedHadronEnergyFraction() const { return chargedHadronEnergy() / energy(); } - /// neutralHadronEnergy - float neutralHadronEnergy() const { return m_specific.mNeutralHadronEnergy; } - /// neutralHadronEnergyFraction - float neutralHadronEnergyFraction() const { return neutralHadronEnergy() / energy(); } - /// photonEnergy - float photonEnergy() const { return m_specific.mPhotonEnergy; } - /// photonEnergyFraction - float photonEnergyFraction() const { return photonEnergy() / energy(); } - /// electronEnergy - float electronEnergy() const { return m_specific.mElectronEnergy; } - /// electronEnergyFraction - float electronEnergyFraction() const { return electronEnergy() / energy(); } - /// muonEnergy - float muonEnergy() const { return m_specific.mMuonEnergy; } - /// muonEnergyFraction - float muonEnergyFraction() const { return muonEnergy() / energy(); } - /// HFHadronEnergy - float HFHadronEnergy() const { return m_specific.mHFHadronEnergy; } - /// HFHadronEnergyFraction - float HFHadronEnergyFraction() const { return HFHadronEnergy() / energy(); } - /// HFEMEnergy - float HFEMEnergy() const { return m_specific.mHFEMEnergy; } - /// HFEMEnergyFraction - float HFEMEnergyFraction() const { return HFEMEnergy() / energy(); } - - /// chargedHadronMultiplicity - int chargedHadronMultiplicity() const { return m_specific.mChargedHadronMultiplicity; } - /// neutralHadronMultiplicity - int neutralHadronMultiplicity() const { return m_specific.mNeutralHadronMultiplicity; } - /// photonMultiplicity - int photonMultiplicity() const { return m_specific.mPhotonMultiplicity; } - /// electronMultiplicity - int electronMultiplicity() const { return m_specific.mElectronMultiplicity; } - /// muonMultiplicity - int muonMultiplicity() const { return m_specific.mMuonMultiplicity; } - /// HFHadronMultiplicity - int HFHadronMultiplicity() const { return m_specific.mHFHadronMultiplicity; } - /// HFEMMultiplicity - int HFEMMultiplicity() const { return m_specific.mHFEMMultiplicity; } - - /// chargedEmEnergy - float chargedEmEnergy() const { return m_specific.mChargedEmEnergy; } - /// chargedEmEnergyFraction - float chargedEmEnergyFraction() const { return chargedEmEnergy() / energy(); } - /// chargedMuEnergy - float chargedMuEnergy() const { return m_specific.mChargedMuEnergy; } - /// chargedMuEnergyFraction - float chargedMuEnergyFraction() const { return chargedMuEnergy() / energy(); } - /// neutralEmEnergy - float neutralEmEnergy() const { return m_specific.mNeutralEmEnergy; } - /// neutralEmEnergyFraction - float neutralEmEnergyFraction() const { return neutralEmEnergy() / energy(); } - - /// chargedMultiplicity - int chargedMultiplicity() const { return m_specific.mChargedMultiplicity; } - /// neutralMultiplicity - int neutralMultiplicity() const { return m_specific.mNeutralMultiplicity; } - - /// hoEnergy - float hoEnergy() const { return m_specific.mHOEnergy; } - /// hoEnergyFraction - float hoEnergyFraction() const { return hoEnergy() / energy(); } - - /// get specific constituent - virtual reco::PFCandidatePtr getPFConstituent(unsigned fIndex) const; - - /// get all constituents - virtual std::vector getPFConstituents() const; - - /// \ brief get all tracks in the jets - /// All PFCandidates hold a reference to a track. All the non-null - /// references are added to the returned TrackRefVector - reco::TrackRefVector getTrackRefs() const; - - // block accessors - - const Specific& getSpecific() const { return m_specific; } - - /// Polymorphic clone - PFJet* clone() const override; - - /// Print object in details - std::string print() const override; - - private: - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - //Variables specific to to the PFJet class - Specific m_specific; - }; - - // streamer - std::ostream& operator<<(std::ostream& out, const reco::PFJet& jet); + // streamer + std::ostream& operator<<(std::ostream& out, const reco::io_v1::PFJet& jet); + } // namespace io_v1 + using PFJet = io_v1::PFJet; } // namespace reco // temporary fix before include_checcker runs globally #include "DataFormats/JetReco/interface/PFJetCollection.h" //INCLUDECHECKER:SKIP diff --git a/DataFormats/JetReco/interface/PFJetCollection.h b/DataFormats/JetReco/interface/PFJetCollection.h index 74e154e327dd7..041e6e9bd7ea2 100644 --- a/DataFormats/JetReco/interface/PFJetCollection.h +++ b/DataFormats/JetReco/interface/PFJetCollection.h @@ -11,7 +11,10 @@ #include "DataFormats/JetReco/interface/PFJet.h" //INCLUDECHECKER:SKIP namespace reco { - class PFJet; + namespace io_v1 { + class PFJet; + } + using PFJet = io_v1::PFJet; /// collection of PFJet objects typedef std::vector PFJetCollection; /// edm references diff --git a/DataFormats/JetReco/interface/TrackExtrapolation.h b/DataFormats/JetReco/interface/TrackExtrapolation.h index 461372c6687fb..ac14af443806d 100644 --- a/DataFormats/JetReco/interface/TrackExtrapolation.h +++ b/DataFormats/JetReco/interface/TrackExtrapolation.h @@ -19,34 +19,37 @@ #include namespace reco { - class TrackExtrapolation { - // Next two typedefs use double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, - // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase - // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. - typedef ROOT::Math::PositionVector3D > Point; - typedef ROOT::Math::DisplacementVector3D > Vector; - - public: - TrackExtrapolation() {} - TrackExtrapolation(reco::TrackRef const& track, std::vector const& pos, std::vector const& mom) - : track_(track) { - pos_.resize(pos.size()); - copy(pos.begin(), pos.end(), pos_.begin()); - mom_.resize(mom.size()); - copy(mom.begin(), mom.end(), mom_.begin()); - } - - ~TrackExtrapolation() {} - - reco::TrackRef const& track() const { return track_; } - std::vector const& positions() const { return pos_; } - std::vector const& momenta() const { return mom_; } - - protected: - reco::TrackRef track_; - std::vector pos_; - std::vector mom_; - }; + namespace io_v1 { + class TrackExtrapolation { + // Next two typedefs use double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D > Point; + typedef ROOT::Math::DisplacementVector3D > Vector; + + public: + TrackExtrapolation() {} + TrackExtrapolation(reco::TrackRef const& track, std::vector const& pos, std::vector const& mom) + : track_(track) { + pos_.resize(pos.size()); + copy(pos.begin(), pos.end(), pos_.begin()); + mom_.resize(mom.size()); + copy(mom.begin(), mom.end(), mom_.begin()); + } + + ~TrackExtrapolation() {} + + reco::TrackRef const& track() const { return track_; } + std::vector const& positions() const { return pos_; } + std::vector const& momenta() const { return mom_; } + + protected: + reco::TrackRef track_; + std::vector pos_; + std::vector mom_; + }; + } // namespace io_v1 + using TrackExtrapolation = io_v1::TrackExtrapolation; } // namespace reco #endif diff --git a/DataFormats/JetReco/interface/TrackJet.h b/DataFormats/JetReco/interface/TrackJet.h index 160d8ad213387..20625cb0f2473 100644 --- a/DataFormats/JetReco/interface/TrackJet.h +++ b/DataFormats/JetReco/interface/TrackJet.h @@ -20,48 +20,51 @@ #include "DataFormats/VertexReco/interface/VertexFwd.h" namespace reco { + namespace io_v1 { - class TrackJet : public Jet { - public: - /// Default constructor - TrackJet(); - /// Constructor without constituents - TrackJet(const LorentzVector& fP4, const Point& fVertex); - /// Constructor from RecoChargedRefCandidate constituents - TrackJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); - /// Destructor - ~TrackJet() override {} - /// Polymorphic clone - TrackJet* clone() const override; + class TrackJet : public Jet { + public: + /// Default constructor + TrackJet(); + /// Constructor without constituents + TrackJet(const LorentzVector& fP4, const Point& fVertex); + /// Constructor from RecoChargedRefCandidate constituents + TrackJet(const LorentzVector& fP4, const Point& fVertex, const Jet::Constituents& fConstituents); + /// Destructor + ~TrackJet() override {} + /// Polymorphic clone + TrackJet* clone() const override; - /// Number of track daughters - size_t numberOfTracks() const { return numberOfDaughters(); } - /// Return Ptr to the track costituent - virtual edm::Ptr track(size_t i) const; - /// Return pointers to all track costituents - std::vector > tracks() const; + /// Number of track daughters + size_t numberOfTracks() const { return numberOfDaughters(); } + /// Return Ptr to the track costituent + virtual edm::Ptr track(size_t i) const; + /// Return pointers to all track costituents + std::vector > tracks() const; - /// calculate and set the charge by adding up the constituting track charges - void resetCharge(); - /// get associated primary vertex - const reco::VertexRef primaryVertex() const; - /// set associated primary vertex - void setPrimaryVertex(const reco::VertexRef& vtx); - /// check jet to be associated to the hard primary vertex - bool fromHardVertex() const { return (this->primaryVertex().index() == 0); } + /// calculate and set the charge by adding up the constituting track charges + void resetCharge(); + /// get associated primary vertex + const reco::VertexRef primaryVertex() const; + /// set associated primary vertex + void setPrimaryVertex(const reco::VertexRef& vtx); + /// check jet to be associated to the hard primary vertex + bool fromHardVertex() const { return (this->primaryVertex().index() == 0); } - /// Print object - std::string print() const override; + /// Print object + std::string print() const override; - private: - /// Polymorphic overlap - bool overlap(const Candidate& dummy) const override; + private: + /// Polymorphic overlap + bool overlap(const Candidate& dummy) const override; - private: - /// Associated primary vertex - reco::VertexRef vtx_; - }; + private: + /// Associated primary vertex + reco::VertexRef vtx_; + }; + } // namespace io_v1 + using TrackJet = io_v1::TrackJet; } // namespace reco #endif diff --git a/DataFormats/JetReco/src/PFJet.cc b/DataFormats/JetReco/src/PFJet.cc index e5f0c62839870..a45c4493227d4 100644 --- a/DataFormats/JetReco/src/PFJet.cc +++ b/DataFormats/JetReco/src/PFJet.cc @@ -11,6 +11,7 @@ #include "DataFormats/JetReco/interface/PFJet.h" using namespace reco; +using namespace reco::io_v1; PFJet::PFJet(const LorentzVector& fP4, const Point& fVertex, @@ -95,7 +96,7 @@ std::string PFJet::print() const { return out.str(); } -std::ostream& reco::operator<<(std::ostream& out, const reco::PFJet& jet) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const reco::io_v1::PFJet& jet) { if (out) { out << "PFJet " << "(pt, eta, phi) = " << jet.pt() << "," << jet.eta() << "," << jet.phi() diff --git a/DataFormats/JetReco/src/classes_def_1.xml b/DataFormats/JetReco/src/classes_def_1.xml index 3ce0cde16cbdf..d581b00004345 100644 --- a/DataFormats/JetReco/src/classes_def_1.xml +++ b/DataFormats/JetReco/src/classes_def_1.xml @@ -1,145 +1,124 @@ - - - - - + + - - + + - - - - - + + - - + + - - - - - - - + + + + + + + - - + + - + - + - - - - - + + - - - + + - - - - - + + + + + - - + + - - - - - + + - - - + + - - - - - + + + + + - - - + + + - + - + - - - - - + + - - - + + - - - - - - + + + + + + - - - + + + - + - - - - - + + - - - - - + + + + + - - - + + + - + - + diff --git a/DataFormats/JetReco/src/classes_def_2.xml b/DataFormats/JetReco/src/classes_def_2.xml index 8d553c7c88ba2..b3136d3c64812 100755 --- a/DataFormats/JetReco/src/classes_def_2.xml +++ b/DataFormats/JetReco/src/classes_def_2.xml @@ -12,9 +12,9 @@ - + - + @@ -34,9 +34,9 @@ - + - + @@ -56,9 +56,9 @@ - + - + @@ -78,31 +78,31 @@ - + - + - - + + - - + + - + - - - - + + + + diff --git a/DataFormats/JetReco/src/classes_def_3.xml b/DataFormats/JetReco/src/classes_def_3.xml index 0d8a9a8db0761..06efd6c592eb8 100644 --- a/DataFormats/JetReco/src/classes_def_3.xml +++ b/DataFormats/JetReco/src/classes_def_3.xml @@ -1,30 +1,24 @@ - - - - - + + - - - - - + + + + + - - - + + + - + - - - - - + + @@ -32,7 +26,7 @@ - + @@ -46,13 +40,13 @@ - + - + - + @@ -85,8 +79,8 @@ - - + + @@ -103,33 +97,33 @@ - + - - - - - - - - - + + + + + + + + + - + - + - + - + - + - + - - + + diff --git a/DataFormats/JetReco/src/classes_def_4.xml b/DataFormats/JetReco/src/classes_def_4.xml index 82ce2b47f45b2..ac4c6a3d77ec6 100644 --- a/DataFormats/JetReco/src/classes_def_4.xml +++ b/DataFormats/JetReco/src/classes_def_4.xml @@ -1,17 +1,17 @@ - - + + - - - - - - - + + + + + + + - - + + @@ -21,34 +21,32 @@ - - - + + + - - - + + + - - + + - - + + - - - - + + @@ -58,22 +56,22 @@ - - - + + + - - + + - - - - - - - - - + + + + + + + + + @@ -90,8 +88,8 @@ - - + + @@ -108,9 +106,9 @@ - + - + @@ -130,9 +128,9 @@ - + - + diff --git a/DataFormats/L1CSCTrackFinder/interface/L1CSCSPStatusDigi.h b/DataFormats/L1CSCTrackFinder/interface/L1CSCSPStatusDigi.h index 9fbecb4e7e2d3..05d1fd5d878ea 100644 --- a/DataFormats/L1CSCTrackFinder/interface/L1CSCSPStatusDigi.h +++ b/DataFormats/L1CSCTrackFinder/interface/L1CSCSPStatusDigi.h @@ -3,48 +3,50 @@ class CSCTFUnpacker; -class L1CSCSPStatusDigi { -private: - unsigned short sp_slot{}; // - unsigned short l1a_bxn{}; // Take from the SP header - unsigned short fmm_status{}; // Take from the SP header - - unsigned short se{}; // Make logical OR of all tbins for each of 15(endcap) SE bits - unsigned short sm{}; // Make logical OR of all tbins for each of 15(endcap) SM bits - unsigned long bx{}; // Make logical OR of all tbins for each of 15(endcap)+2(barrel) BX bits - unsigned long af{}; // Make logical OR of all tbins for each of 15(endcap)+2(barrel) AF bits - unsigned long vp{}; // Make logical OR of all tbins for each of 15(endcap)+2(barrel) VP/VQ bits - enum { - IDLE = 1, - CARRIER = 2, - NORMAL = 4, - ERROR = 8, - FIFO = 16 - }; // States of optical receivers + Alignment FIFO full OR empty status - unsigned short link_status[15]{}; // Optical receiver status ORed for all tbins - unsigned short mpc_link_id{}; // MPC_id and link# from MEx Data Record ORed for all tbins - - unsigned long track_cnt{}; - unsigned long orbit_cnt{}; - - friend class CSCTFUnpacker; - -public: - unsigned short slot(void) const throw() { return sp_slot; } - unsigned short BXN(void) const throw() { return l1a_bxn; } - unsigned short FMM(void) const throw() { return fmm_status; } - unsigned short SEs(void) const throw() { return se; } - unsigned short SMs(void) const throw() { return sm; } - unsigned long BXs(void) const throw() { return bx; } - unsigned long AFs(void) const throw() { return af; } - unsigned long VPs(void) const throw() { return vp; } - unsigned short link(int link) const throw() { return link_status[link]; } - - unsigned long track_counter(void) const throw() { return track_cnt; } - unsigned long orbit_counter(void) const throw() { return orbit_cnt; } - - L1CSCSPStatusDigi(void) = default; - ~L1CSCSPStatusDigi(void) = default; -}; - +namespace io_v1 { + class L1CSCSPStatusDigi { + private: + unsigned short sp_slot{}; // + unsigned short l1a_bxn{}; // Take from the SP header + unsigned short fmm_status{}; // Take from the SP header + + unsigned short se{}; // Make logical OR of all tbins for each of 15(endcap) SE bits + unsigned short sm{}; // Make logical OR of all tbins for each of 15(endcap) SM bits + unsigned long bx{}; // Make logical OR of all tbins for each of 15(endcap)+2(barrel) BX bits + unsigned long af{}; // Make logical OR of all tbins for each of 15(endcap)+2(barrel) AF bits + unsigned long vp{}; // Make logical OR of all tbins for each of 15(endcap)+2(barrel) VP/VQ bits + enum { + IDLE = 1, + CARRIER = 2, + NORMAL = 4, + ERROR = 8, + FIFO = 16 + }; // States of optical receivers + Alignment FIFO full OR empty status + unsigned short link_status[15]{}; // Optical receiver status ORed for all tbins + unsigned short mpc_link_id{}; // MPC_id and link# from MEx Data Record ORed for all tbins + + unsigned long track_cnt{}; + unsigned long orbit_cnt{}; + + friend class ::CSCTFUnpacker; + + public: + unsigned short slot(void) const throw() { return sp_slot; } + unsigned short BXN(void) const throw() { return l1a_bxn; } + unsigned short FMM(void) const throw() { return fmm_status; } + unsigned short SEs(void) const throw() { return se; } + unsigned short SMs(void) const throw() { return sm; } + unsigned long BXs(void) const throw() { return bx; } + unsigned long AFs(void) const throw() { return af; } + unsigned long VPs(void) const throw() { return vp; } + unsigned short link(int link) const throw() { return link_status[link]; } + + unsigned long track_counter(void) const throw() { return track_cnt; } + unsigned long orbit_counter(void) const throw() { return orbit_cnt; } + + L1CSCSPStatusDigi(void) = default; + ~L1CSCSPStatusDigi(void) = default; + }; +} // namespace io_v1 +using L1CSCSPStatusDigi = io_v1::L1CSCSPStatusDigi; #endif diff --git a/DataFormats/L1CSCTrackFinder/interface/L1Track.h b/DataFormats/L1CSCTrackFinder/interface/L1Track.h index 495b0ae5cbd2d..b0d602bb913f9 100644 --- a/DataFormats/L1CSCTrackFinder/interface/L1Track.h +++ b/DataFormats/L1CSCTrackFinder/interface/L1Track.h @@ -17,121 +17,124 @@ class CSCTFUnpacker; class CSCTFSPCoreLogic; namespace csc { - - class L1Track : public L1MuRegionalCand { - public: - L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { - setType(2); - setPtPacked(0); - } - L1Track(const csc::L1TrackId&); - L1Track(const csc::L1Track&); - - const csc::L1Track& operator=(const csc::L1Track&); - - ~L1Track() override; - - unsigned rank() const; - void setRank(const unsigned& rank) { m_rank = rank; } - - unsigned localPhi() const { return m_lphi; } - void setLocalPhi(const unsigned& lphi) { m_lphi = lphi; } - - unsigned me1ID() const { return me1_id; } - unsigned me2ID() const { return me2_id; } - unsigned me3ID() const { return me3_id; } - unsigned me4ID() const { return me4_id; } - unsigned mb1ID() const { return mb1_id; } - - unsigned endcap() const { return m_endcap; } - unsigned sector() const { return m_sector; } - unsigned station() const { return 0; } - // these next two are needed by the trigger container class - unsigned subsector() const { return 0; } - unsigned cscid() const { return 0; } - - int BX() const { return bx(); } - - static unsigned encodeRank(const unsigned& pt, const unsigned& quality); - static void decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality); - - unsigned ptLUTAddress() const { return m_ptAddress; } - unsigned front_rear() const { return m_fr; } - void setPtLUTAddress(const unsigned& adr) { m_ptAddress = adr; } - void set_front_rear(unsigned fr) { m_fr = fr; } - - unsigned outputLink() const { return m_output_link; } - void setOutputLink(unsigned oPL) { m_output_link = oPL; } - bool winner() const { return m_winner; } - - bool operator>(const csc::L1Track&) const; - bool operator<(const csc::L1Track&) const; - bool operator>=(const csc::L1Track&) const; - bool operator<=(const csc::L1Track&) const; - bool operator==(const csc::L1Track&) const; - bool operator!=(const csc::L1Track&) const; - - //friend std::ostream& operator<<(std::ostream&, const csc::L1Track&); - //friend std::ostream& operator<<(std::ostream&, csc::L1Track&); - - /// Only the Unpacker and SectorProcessor should have access to addTrackStub() - /// This prevents people from adding too many track stubs. - - friend class CSCTFSectorProcessor; // for track stubs - friend class ::CSCTFUnpacker; // for track id bits and track stubs - friend class ::CSCTFSPCoreLogic; // for track id bits - - void Print() const; - - // Accessors for some technical information: - unsigned deltaPhi12(void) const { return m_ptAddress & 0xFF; } - unsigned deltaPhi23(void) const { return (m_ptAddress >> 8) & 0xF; } - unsigned addressEta(void) const { return (m_ptAddress >> 12) & 0xF; } - unsigned mode(void) const { return (m_ptAddress >> 16) & 0xF; } - bool sign(void) const { return (m_ptAddress >> 20) & 0x1; } - bool synch_err(void) const { return m_se; } - bool bx0(void) const { return m_bx0; } - bool bc0(void) const { return m_bc0; } - unsigned me1Tbin(void) const { return m_me1Tbin; } - unsigned me2Tbin(void) const { return m_me2Tbin; } - unsigned me3Tbin(void) const { return m_me3Tbin; } - unsigned me4Tbin(void) const { return m_me4Tbin; } - unsigned mb1Tbin(void) const { return m_mbTbin; } - void setBits(bool se, bool bx0, bool bc0) { - m_se = se; - m_bx0 = bx0; - m_bc0 = bc0; - } - void setTbins(unsigned me1, unsigned me2, unsigned me3, unsigned me4, unsigned mb) { - m_me1Tbin = me1; - m_me2Tbin = me2; - m_me3Tbin = me3; - m_me4Tbin = me4; - m_mbTbin = mb; - } - void setStationIds( - const unsigned& me1, const unsigned& me2, const unsigned& me3, const unsigned& me4, const unsigned& mb1); - - unsigned modeExtended(void) const; - - private: - std::string m_name; - //L1TrackId m_id; remove this nested class for now... POOL doesn't like it. - unsigned m_endcap = 0, m_sector = 0; - //CSCCorrelatedLCTDigiCollection track_stubs; same as above - unsigned m_lphi = 0; - unsigned m_ptAddress = 0; - unsigned m_fr = 0; - unsigned me1_id = 0, me2_id = 0, me3_id = 0, me4_id = 0, mb1_id = 0; - unsigned m_rank = 0; - unsigned m_output_link = 0; - bool m_empty = true; - bool m_winner = false; - - // Technical information: - bool m_se = true, m_bx0 = true, m_bc0 = true; - unsigned m_me1Tbin = 0, m_me2Tbin = 0, m_me3Tbin = 0, m_me4Tbin = 0, m_mbTbin = 0; - }; + namespace io_v1 { + + class L1Track : public L1MuRegionalCand { + public: + L1Track() : L1MuRegionalCand(), m_name("csc::L1Track") { + setType(2); + setPtPacked(0); + } + L1Track(const csc::L1TrackId&); + L1Track(const csc::io_v1::L1Track&); + + const csc::io_v1::L1Track& operator=(const csc::io_v1::L1Track&); + + ~L1Track() override; + + unsigned rank() const; + void setRank(const unsigned& rank) { m_rank = rank; } + + unsigned localPhi() const { return m_lphi; } + void setLocalPhi(const unsigned& lphi) { m_lphi = lphi; } + + unsigned me1ID() const { return me1_id; } + unsigned me2ID() const { return me2_id; } + unsigned me3ID() const { return me3_id; } + unsigned me4ID() const { return me4_id; } + unsigned mb1ID() const { return mb1_id; } + + unsigned endcap() const { return m_endcap; } + unsigned sector() const { return m_sector; } + unsigned station() const { return 0; } + // these next two are needed by the trigger container class + unsigned subsector() const { return 0; } + unsigned cscid() const { return 0; } + + int BX() const { return bx(); } + + static unsigned encodeRank(const unsigned& pt, const unsigned& quality); + static void decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality); + + unsigned ptLUTAddress() const { return m_ptAddress; } + unsigned front_rear() const { return m_fr; } + void setPtLUTAddress(const unsigned& adr) { m_ptAddress = adr; } + void set_front_rear(unsigned fr) { m_fr = fr; } + + unsigned outputLink() const { return m_output_link; } + void setOutputLink(unsigned oPL) { m_output_link = oPL; } + bool winner() const { return m_winner; } + + bool operator>(const csc::io_v1::L1Track&) const; + bool operator<(const csc::io_v1::L1Track&) const; + bool operator>=(const csc::io_v1::L1Track&) const; + bool operator<=(const csc::io_v1::L1Track&) const; + bool operator==(const csc::io_v1::L1Track&) const; + bool operator!=(const csc::io_v1::L1Track&) const; + + //friend std::ostream& operator<<(std::ostream&, const csc::io_v1::L1Track&); + //friend std::ostream& operator<<(std::ostream&, csc::io_v1::L1Track&); + + /// Only the Unpacker and SectorProcessor should have access to addTrackStub() + /// This prevents people from adding too many track stubs. + + friend class ::CSCTFSectorProcessor; // for track stubs + friend class ::CSCTFUnpacker; // for track id bits and track stubs + friend class ::CSCTFSPCoreLogic; // for track id bits + + void Print() const; + + // Accessors for some technical information: + unsigned deltaPhi12(void) const { return m_ptAddress & 0xFF; } + unsigned deltaPhi23(void) const { return (m_ptAddress >> 8) & 0xF; } + unsigned addressEta(void) const { return (m_ptAddress >> 12) & 0xF; } + unsigned mode(void) const { return (m_ptAddress >> 16) & 0xF; } + bool sign(void) const { return (m_ptAddress >> 20) & 0x1; } + bool synch_err(void) const { return m_se; } + bool bx0(void) const { return m_bx0; } + bool bc0(void) const { return m_bc0; } + unsigned me1Tbin(void) const { return m_me1Tbin; } + unsigned me2Tbin(void) const { return m_me2Tbin; } + unsigned me3Tbin(void) const { return m_me3Tbin; } + unsigned me4Tbin(void) const { return m_me4Tbin; } + unsigned mb1Tbin(void) const { return m_mbTbin; } + void setBits(bool se, bool bx0, bool bc0) { + m_se = se; + m_bx0 = bx0; + m_bc0 = bc0; + } + void setTbins(unsigned me1, unsigned me2, unsigned me3, unsigned me4, unsigned mb) { + m_me1Tbin = me1; + m_me2Tbin = me2; + m_me3Tbin = me3; + m_me4Tbin = me4; + m_mbTbin = mb; + } + void setStationIds( + const unsigned& me1, const unsigned& me2, const unsigned& me3, const unsigned& me4, const unsigned& mb1); + + unsigned modeExtended(void) const; + + private: + std::string m_name; + //L1TrackId m_id; remove this nested class for now... POOL doesn't like it. + unsigned m_endcap = 0, m_sector = 0; + //CSCCorrelatedLCTDigiCollection track_stubs; same as above + unsigned m_lphi = 0; + unsigned m_ptAddress = 0; + unsigned m_fr = 0; + unsigned me1_id = 0, me2_id = 0, me3_id = 0, me4_id = 0, mb1_id = 0; + unsigned m_rank = 0; + unsigned m_output_link = 0; + bool m_empty = true; + bool m_winner = false; + + // Technical information: + bool m_se = true, m_bx0 = true, m_bc0 = true; + unsigned m_me1Tbin = 0, m_me2Tbin = 0, m_me3Tbin = 0, m_me4Tbin = 0, m_mbTbin = 0; + }; + } // namespace io_v1 + using L1Track = io_v1::L1Track; } // namespace csc #endif diff --git a/DataFormats/L1CSCTrackFinder/interface/TrackStub.h b/DataFormats/L1CSCTrackFinder/interface/TrackStub.h index 697798aea6d28..33e3232cf6d8f 100644 --- a/DataFormats/L1CSCTrackFinder/interface/TrackStub.h +++ b/DataFormats/L1CSCTrackFinder/interface/TrackStub.h @@ -18,57 +18,59 @@ #include namespace csctf { + namespace io_v1 { + class TrackStub : public CSCCorrelatedLCTDigi { + public: + TrackStub() {} + TrackStub(const CSCCorrelatedLCTDigi &, const DetId &); + TrackStub(const CSCCorrelatedLCTDigi &, const DetId &, const unsigned &phi, const unsigned &eta); - class TrackStub : public CSCCorrelatedLCTDigi { - public: - TrackStub() {} - TrackStub(const CSCCorrelatedLCTDigi &, const DetId &); - TrackStub(const CSCCorrelatedLCTDigi &, const DetId &, const unsigned &phi, const unsigned &eta); + /// set Eta and Phi from integer values. + void setEtaPacked(const unsigned &eta_) { theEta_ = eta_; } + void setPhiPacked(const unsigned &phi_) { thePhi_ = phi_; } - /// set Eta and Phi from integer values. - void setEtaPacked(const unsigned &eta_) { theEta_ = eta_; } - void setPhiPacked(const unsigned &phi_) { thePhi_ = phi_; } + /// return the Eta Value of this stub's position. + double etaValue() const { return (theEta_ * theEtaBinning + CSCTFConstants::minEta); } + /// return the Phi Value of this stub's position in local coordinates. + double phiValue() const { return (thePhi_ * thePhiBinning); } - /// return the Eta Value of this stub's position. - double etaValue() const { return (theEta_ * theEtaBinning + CSCTFConstants::minEta); } - /// return the Phi Value of this stub's position in local coordinates. - double phiValue() const { return (thePhi_ * thePhiBinning); } + /// Return the binned eta for this stub. + unsigned etaPacked() const { return theEta_; } + /// Return the binned phi for this stub. - /// Return the binned eta for this stub. - unsigned etaPacked() const { return theEta_; } - /// Return the binned phi for this stub. + unsigned phiPacked() const { return thePhi_; } - unsigned phiPacked() const { return thePhi_; } + /// Get the digi this stub was made from. + const CSCCorrelatedLCTDigi *getDigi() const { return dynamic_cast(this); } + DetId getDetId() const { return DetId(theDetId_); } - /// Get the digi this stub was made from. - const CSCCorrelatedLCTDigi *getDigi() const { return dynamic_cast(this); } - DetId getDetId() const { return DetId(theDetId_); } + /// Time / Space identifiers + /// See CSCTransientDataType.h for more details. + unsigned endcap() const; + unsigned station() const; + unsigned sector() const; + unsigned subsector() const; + unsigned cscid() const; + unsigned cscidSeparateME1a() const; + int BX() const { return getBX(); } - /// Time / Space identifiers - /// See CSCTransientDataType.h for more details. - unsigned endcap() const; - unsigned station() const; - unsigned sector() const; - unsigned subsector() const; - unsigned cscid() const; - unsigned cscidSeparateME1a() const; - int BX() const { return getBX(); } + /// Comparision Operators, used for MPC sorting + bool operator>(const TrackStub &) const; + bool operator<(const TrackStub &) const; + bool operator>=(const TrackStub &rhs) const { return !(this->operator<(rhs)); } + bool operator<=(const TrackStub &rhs) const { return !(this->operator>(rhs)); } + bool operator==(const TrackStub &rhs) const { + return ((theDetId_ == rhs.theDetId_) && (*(getDigi()) == *(rhs.getDigi()))); + } + bool operator!=(const TrackStub &rhs) const { return !(this->operator==(rhs)); } - /// Comparision Operators, used for MPC sorting - bool operator>(const TrackStub &) const; - bool operator<(const TrackStub &) const; - bool operator>=(const TrackStub &rhs) const { return !(this->operator<(rhs)); } - bool operator<=(const TrackStub &rhs) const { return !(this->operator>(rhs)); } - bool operator==(const TrackStub &rhs) const { - return ((theDetId_ == rhs.theDetId_) && (*(getDigi()) == *(rhs.getDigi()))); - } - bool operator!=(const TrackStub &rhs) const { return !(this->operator==(rhs)); } - - private: - uint32_t theDetId_; - unsigned thePhi_, theEta_, link_; - static const double theEtaBinning, thePhiBinning; - }; + private: + uint32_t theDetId_; + unsigned thePhi_, theEta_, link_; + static const double theEtaBinning, thePhiBinning; + }; + } // namespace io_v1 + using TrackStub = io_v1::TrackStub; } // namespace csctf #endif diff --git a/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h b/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h index d627e5dd592dd..5412916665577 100644 --- a/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h +++ b/DataFormats/L1CSCTrackFinder/interface/TrackStubFwd.h @@ -2,7 +2,10 @@ #define L1CSCTrackFinder_TrackStubFwd_h namespace csctf { - class TrackStub; -} + namespace io_v1 { + class TrackStub; + } + using TrackStub = io_v1::TrackStub; +} // namespace csctf #endif diff --git a/DataFormats/L1CSCTrackFinder/src/L1Track.cc b/DataFormats/L1CSCTrackFinder/src/L1Track.cc index f5472fae8bd33..40c272958fc64 100644 --- a/DataFormats/L1CSCTrackFinder/src/L1Track.cc +++ b/DataFormats/L1CSCTrackFinder/src/L1Track.cc @@ -2,73 +2,29 @@ #include namespace csc { + namespace io_v1 { - L1Track::L1Track(const csc::L1TrackId& id) : m_name("csc::L1Track") { - m_endcap = id.endcap(); - m_sector = id.sector(); - setType(2); - setPtPacked(0); - } - - L1Track::L1Track(const csc::L1Track& rhs) - : L1MuRegionalCand(rhs.type_idx(), - rhs.phi_packed(), - rhs.eta_packed(), - rhs.pt_packed(), - rhs.charge_packed(), - rhs.charge_valid_packed(), - rhs.finehalo_packed(), - rhs.quality_packed(), - rhs.bx()), - m_name(rhs.m_name) { - this->setBx(rhs.bx()); - this->setDataWord(rhs.getDataWord()); - m_name = rhs.m_name; - this->setType(rhs.type_idx()); - this->setPhiPacked(rhs.phi_packed()); - this->setEtaPacked(rhs.eta_packed()); - this->setPtPacked(rhs.pt_packed()); - this->setChargePacked(rhs.charge_packed()); - this->setChargeValidPacked(rhs.charge_valid_packed()); - this->setFineHaloPacked(rhs.finehalo_packed()); - this->setQualityPacked(rhs.quality_packed()); - m_empty = rhs.m_empty; - m_lphi = rhs.m_lphi; - m_endcap = rhs.m_endcap; - m_sector = rhs.m_sector; - m_ptAddress = rhs.m_ptAddress; - m_rank = rhs.m_rank; - me1_id = rhs.me1_id; - me2_id = rhs.me2_id; - me3_id = rhs.me3_id; - me4_id = rhs.me4_id; - mb1_id = rhs.mb1_id; - m_me1Tbin = rhs.m_me1Tbin; - m_me2Tbin = rhs.m_me2Tbin; - m_me3Tbin = rhs.m_me3Tbin; - m_me4Tbin = rhs.m_me4Tbin; - m_mbTbin = rhs.m_mbTbin; - m_output_link = rhs.m_output_link; - m_winner = rhs.m_winner; - m_fr = rhs.m_fr; - m_se = rhs.m_se; - m_bx0 = rhs.m_bx0; - m_bc0 = rhs.m_bc0; - } - - L1Track::~L1Track() {} - - const csc::L1Track& L1Track::operator=(const csc::L1Track& rhs) { - if (this != &rhs) { - m_fr = rhs.m_fr; - m_se = rhs.m_se; - m_bx0 = rhs.m_bx0; - m_bc0 = rhs.m_bc0; - m_empty = rhs.m_empty; + L1Track::L1Track(const csc::L1TrackId& id) : m_name("csc::L1Track") { + m_endcap = id.endcap(); + m_sector = id.sector(); + setType(2); + setPtPacked(0); + } + + L1Track::L1Track(const csc::io_v1::L1Track& rhs) + : L1MuRegionalCand(rhs.type_idx(), + rhs.phi_packed(), + rhs.eta_packed(), + rhs.pt_packed(), + rhs.charge_packed(), + rhs.charge_valid_packed(), + rhs.finehalo_packed(), + rhs.quality_packed(), + rhs.bx()), + m_name(rhs.m_name) { this->setBx(rhs.bx()); this->setDataWord(rhs.getDataWord()); m_name = rhs.m_name; - m_lphi = rhs.m_lphi; this->setType(rhs.type_idx()); this->setPhiPacked(rhs.phi_packed()); this->setEtaPacked(rhs.eta_packed()); @@ -77,6 +33,8 @@ namespace csc { this->setChargeValidPacked(rhs.charge_valid_packed()); this->setFineHaloPacked(rhs.finehalo_packed()); this->setQualityPacked(rhs.quality_packed()); + m_empty = rhs.m_empty; + m_lphi = rhs.m_lphi; m_endcap = rhs.m_endcap; m_sector = rhs.m_sector; m_ptAddress = rhs.m_ptAddress; @@ -93,88 +51,132 @@ namespace csc { m_mbTbin = rhs.m_mbTbin; m_output_link = rhs.m_output_link; m_winner = rhs.m_winner; + m_fr = rhs.m_fr; + m_se = rhs.m_se; + m_bx0 = rhs.m_bx0; + m_bc0 = rhs.m_bc0; + } + + L1Track::~L1Track() {} + + const csc::io_v1::L1Track& L1Track::operator=(const csc::io_v1::L1Track& rhs) { + if (this != &rhs) { + m_fr = rhs.m_fr; + m_se = rhs.m_se; + m_bx0 = rhs.m_bx0; + m_bc0 = rhs.m_bc0; + m_empty = rhs.m_empty; + this->setBx(rhs.bx()); + this->setDataWord(rhs.getDataWord()); + m_name = rhs.m_name; + m_lphi = rhs.m_lphi; + this->setType(rhs.type_idx()); + this->setPhiPacked(rhs.phi_packed()); + this->setEtaPacked(rhs.eta_packed()); + this->setPtPacked(rhs.pt_packed()); + this->setChargePacked(rhs.charge_packed()); + this->setChargeValidPacked(rhs.charge_valid_packed()); + this->setFineHaloPacked(rhs.finehalo_packed()); + this->setQualityPacked(rhs.quality_packed()); + m_endcap = rhs.m_endcap; + m_sector = rhs.m_sector; + m_ptAddress = rhs.m_ptAddress; + m_rank = rhs.m_rank; + me1_id = rhs.me1_id; + me2_id = rhs.me2_id; + me3_id = rhs.me3_id; + me4_id = rhs.me4_id; + mb1_id = rhs.mb1_id; + m_me1Tbin = rhs.m_me1Tbin; + m_me2Tbin = rhs.m_me2Tbin; + m_me3Tbin = rhs.m_me3Tbin; + m_me4Tbin = rhs.m_me4Tbin; + m_mbTbin = rhs.m_mbTbin; + m_output_link = rhs.m_output_link; + m_winner = rhs.m_winner; + } + return *this; + } + + unsigned L1Track::rank() const { return m_rank; } + + void L1Track::setStationIds( + const unsigned& me1, const unsigned& me2, const unsigned& me3, const unsigned& me4, const unsigned& mb1) { + me1_id = me1; + me2_id = me2; + me3_id = me3; + me4_id = me4; + mb1_id = mb1; } - return *this; - } - - unsigned L1Track::rank() const { return m_rank; } - - void L1Track::setStationIds( - const unsigned& me1, const unsigned& me2, const unsigned& me3, const unsigned& me4, const unsigned& mb1) { - me1_id = me1; - me2_id = me2; - me3_id = me3; - me4_id = me4; - mb1_id = mb1; - } - - unsigned L1Track::encodeRank(const unsigned& pt, const unsigned& quality) { - if (pt == 0) - return 0; - return pt | (quality << L1MuRegionalCand::PT_LENGTH); - } - - void L1Track::decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality) { - if (rank == 0) { - quality = 0; - pt = 0; - } else { - quality = rank >> L1MuRegionalCand::PT_LENGTH; - pt = rank & ((1 << L1MuRegionalCand::PT_LENGTH) - 1); + + unsigned L1Track::encodeRank(const unsigned& pt, const unsigned& quality) { + if (pt == 0) + return 0; + return pt | (quality << L1MuRegionalCand::PT_LENGTH); + } + + void L1Track::decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality) { + if (rank == 0) { + quality = 0; + pt = 0; + } else { + quality = rank >> L1MuRegionalCand::PT_LENGTH; + pt = rank & ((1 << L1MuRegionalCand::PT_LENGTH) - 1); + } } - } - - bool L1Track::operator>(const csc::L1Track& rhs) const { return (rank() > rhs.rank()); } - - bool L1Track::operator<(const csc::L1Track& rhs) const { return (rank() < rhs.rank()); } - - bool L1Track::operator>=(const csc::L1Track& rhs) const { return (rank() >= rhs.rank()); } - - bool L1Track::operator<=(const csc::L1Track& rhs) const { return (rank() <= rhs.rank()); } - - bool L1Track::operator==(const csc::L1Track& rhs) const { return (rank() == rhs.rank()); } - - bool L1Track::operator!=(const csc::L1Track& rhs) const { return (rank() != rhs.rank()); } - - void L1Track::Print() const { - if (!empty()) { - std::cout << "\t Pt(int): " - << " " << pt_packed() << " Phi(int): " - << " " << phi_packed() << " Eta(int): " - << " " << eta_packed() << " Quality: " - << " " << quality_packed() << " charge: " - << " " << charge_packed() << " side: " - << " " << endcap() << " bx: " - << " " << BX() << " Winner: " - << " " << winner() << std::endl; - } else { - std::cout << "\t Empty track!\n"; - std::cout << "\t Pt(int): " - << " " - << "unassigned or zero" - << " Phi(int): " - << " " << phi_packed() << " Eta(int): " - << " " << eta_packed() << " Quality: " - << " " - << "unassigned or zero" - << " charge: " - << " " << charge_packed() << " side: " - << " " << endcap() << " bx: " - << " " << BX() << " Winner: " - << " " << winner() << std::endl; + + bool L1Track::operator>(const csc::io_v1::L1Track& rhs) const { return (rank() > rhs.rank()); } + + bool L1Track::operator<(const csc::io_v1::L1Track& rhs) const { return (rank() < rhs.rank()); } + + bool L1Track::operator>=(const csc::io_v1::L1Track& rhs) const { return (rank() >= rhs.rank()); } + + bool L1Track::operator<=(const csc::io_v1::L1Track& rhs) const { return (rank() <= rhs.rank()); } + + bool L1Track::operator==(const csc::io_v1::L1Track& rhs) const { return (rank() == rhs.rank()); } + + bool L1Track::operator!=(const csc::io_v1::L1Track& rhs) const { return (rank() != rhs.rank()); } + + void L1Track::Print() const { + if (!empty()) { + std::cout << "\t Pt(int): " + << " " << pt_packed() << " Phi(int): " + << " " << phi_packed() << " Eta(int): " + << " " << eta_packed() << " Quality: " + << " " << quality_packed() << " charge: " + << " " << charge_packed() << " side: " + << " " << endcap() << " bx: " + << " " << BX() << " Winner: " + << " " << winner() << std::endl; + } else { + std::cout << "\t Empty track!\n"; + std::cout << "\t Pt(int): " + << " " + << "unassigned or zero" + << " Phi(int): " + << " " << phi_packed() << " Eta(int): " + << " " << eta_packed() << " Quality: " + << " " + << "unassigned or zero" + << " charge: " + << " " << charge_packed() << " side: " + << " " << endcap() << " bx: " + << " " << BX() << " Winner: " + << " " << winner() << std::endl; + } + } + + unsigned L1Track::modeExtended(void) const { + unsigned modeExt = mode(); + unsigned fr = (m_ptAddress >> 21) & 0x1; + + if (modeExt == 11 && fr == 1) + modeExt = 17; + else if (modeExt == 12 && fr == 1) + modeExt = 18; + else if (modeExt == 14 && fr == 1) + modeExt = 16; + return modeExt; } - } - - unsigned L1Track::modeExtended(void) const { - unsigned modeExt = mode(); - unsigned fr = (m_ptAddress >> 21) & 0x1; - - if (modeExt == 11 && fr == 1) - modeExt = 17; - else if (modeExt == 12 && fr == 1) - modeExt = 18; - else if (modeExt == 14 && fr == 1) - modeExt = 16; - return modeExt; - } + } // namespace io_v1 } // namespace csc diff --git a/DataFormats/L1CSCTrackFinder/src/classes_def.xml b/DataFormats/L1CSCTrackFinder/src/classes_def.xml index 09cbc47615a35..5ce5a58096ca7 100644 --- a/DataFormats/L1CSCTrackFinder/src/classes_def.xml +++ b/DataFormats/L1CSCTrackFinder/src/classes_def.xml @@ -1,45 +1,39 @@ - - - + + - - + + - - + + - - - - - - - + + - + - - - + + + - - + + - + - + - + - + - + diff --git a/DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h b/DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h index 54acbf62d2a21..8e136f8c37593 100644 --- a/DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h +++ b/DataFormats/L1CaloTrigger/interface/L1CaloEmCand.h @@ -14,82 +14,84 @@ * \date June 2006 */ -class L1CaloEmCand { -public: - /// default constructor (for vector initialisation etc.) - L1CaloEmCand(); +namespace io_v1 { + class L1CaloEmCand { + public: + /// default constructor (for vector initialisation etc.) + L1CaloEmCand(); - /// construct from raw data, no source - used by TextToDigi - L1CaloEmCand(uint16_t data, unsigned crate, bool iso); + /// construct from raw data, no source - used by TextToDigi + L1CaloEmCand(uint16_t data, unsigned crate, bool iso); - /// construct from raw data with source - used by GCT unpacker - /// last bool argument is a hack to distinguish this constructor from the next one! - L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy); + /// construct from raw data with source - used by GCT unpacker + /// last bool argument is a hack to distinguish this constructor from the next one! + L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy); - /// construct from components for emulation - L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso); + /// construct from components for emulation + L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso); - /// construct from components for emulation (including index) - L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx); + /// construct from components for emulation (including index) + L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx); - /// destructor - ~L1CaloEmCand(); + /// destructor + ~L1CaloEmCand(); - /// get the raw data - uint16_t raw() const { return m_data; } + /// get the raw data + uint16_t raw() const { return m_data; } - /// get rank bits - unsigned rank() const { return m_data & 0x3f; } + /// get rank bits + unsigned rank() const { return m_data & 0x3f; } - /// get RCT receiver card - unsigned rctCard() const { return (m_data >> 7) & 0x7; } + /// get RCT receiver card + unsigned rctCard() const { return (m_data >> 7) & 0x7; } - /// get RCT region ID - unsigned rctRegion() const { return (m_data >> 6) & 0x1; } + /// get RCT region ID + unsigned rctRegion() const { return (m_data >> 6) & 0x1; } - /// get RCT crate - unsigned rctCrate() const { return m_rctCrate; } + /// get RCT crate + unsigned rctCrate() const { return m_rctCrate; } - /// which stream did this come from - bool isolated() const { return m_iso; } + /// which stream did this come from + bool isolated() const { return m_iso; } - /// get index on cable - unsigned index() const { return m_index; } + /// get index on cable + unsigned index() const { return m_index; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// get DetID object - L1CaloRegionDetId regionId() const { return L1CaloRegionDetId(rctCrate(), rctCard(), rctRegion()); } + /// get DetID object + L1CaloRegionDetId regionId() const { return L1CaloRegionDetId(rctCrate(), rctCard(), rctRegion()); } - /// set BX - void setBx(int16_t bx); + /// set BX + void setBx(int16_t bx); - /// equality operator, including rank, isolation, position - int operator==(const L1CaloEmCand& c) const { - return ((m_data == c.raw() && m_iso == c.isolated() && m_rctCrate == c.rctCrate() && - this->regionId() == c.regionId()) || - (this->empty() && c.empty())); - } + /// equality operator, including rank, isolation, position + int operator==(const L1CaloEmCand& c) const { + return ((m_data == c.raw() && m_iso == c.isolated() && m_rctCrate == c.rctCrate() && + this->regionId() == c.regionId()) || + (this->empty() && c.empty())); + } - /// inequality operator - int operator!=(const L1CaloEmCand& c) const { return !(*this == c); } + /// inequality operator + int operator!=(const L1CaloEmCand& c) const { return !(*this == c); } - /// is there any information in the candidate - bool empty() const { return (rank() == 0); } + /// is there any information in the candidate + bool empty() const { return (rank() == 0); } -private: - // rank, card and region ID are contained in the data on the cable - uint16_t m_data; + private: + // rank, card and region ID are contained in the data on the cable + uint16_t m_data; - // members to store geographical information (crate/cable) - // these should probably be packed into a single uint16_t (or m_data) ??? - uint16_t m_rctCrate; - bool m_iso; - uint16_t m_index; - int16_t m_bx; -}; - -std::ostream& operator<<(std::ostream& s, const L1CaloEmCand& cand); + // members to store geographical information (crate/cable) + // these should probably be packed into a single uint16_t (or m_data) ??? + uint16_t m_rctCrate; + bool m_iso; + uint16_t m_index; + int16_t m_bx; + }; + std::ostream& operator<<(std::ostream& s, const L1CaloEmCand& cand); +} // namespace io_v1 +using L1CaloEmCand = io_v1::L1CaloEmCand; #endif diff --git a/DataFormats/L1CaloTrigger/interface/L1CaloEmCandFwd.h b/DataFormats/L1CaloTrigger/interface/L1CaloEmCandFwd.h index 71564e8495be3..42ce3a25e5dbe 100644 --- a/DataFormats/L1CaloTrigger/interface/L1CaloEmCandFwd.h +++ b/DataFormats/L1CaloTrigger/interface/L1CaloEmCandFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_L1CaloTrigger_L1CaloEmCandFwd_h #define DataFormats_L1CaloTrigger_L1CaloEmCandFwd_h -class L1CaloEmCand; +namespace io_v1 { + class L1CaloEmCand; +} +using L1CaloEmCand = io_v1::L1CaloEmCand; #endif diff --git a/DataFormats/L1CaloTrigger/interface/L1CaloRegion.h b/DataFormats/L1CaloTrigger/interface/L1CaloRegion.h index 75099b6512c66..f72b4e0e63242 100644 --- a/DataFormats/L1CaloTrigger/interface/L1CaloRegion.h +++ b/DataFormats/L1CaloTrigger/interface/L1CaloRegion.h @@ -18,184 +18,186 @@ * */ -class L1CaloRegion { -public: - /// default constructor - L1CaloRegion(); - - /// constructor for RCT emulator (HB/HE regions) - to be removed! - L1CaloRegion( - unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn); - - /// constructor for RCT emulator (HF regions) - to be removed! - L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn); - - /// construct with GCT eta,phi indices, for testing GCT emulator - note argument ordering! - to be removed! - L1CaloRegion(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi); - - /// constructor from raw data and GCT indices for unpacking - to be removed! - L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx); - - /// destructor - ~L1CaloRegion(); - - // named ctors - - /// constructor HB/HE region from components - static L1CaloRegion makeHBHERegion(const unsigned et, - const bool overFlow, - const bool tauVeto, - const bool mip, - const bool quiet, - const unsigned crate, - const unsigned card, - const unsigned rgn); - - /// construct HF region from components - static L1CaloRegion makeHFRegion(const unsigned et, const bool fineGrain, const unsigned crate, const unsigned rgn); - - /// construct region from GCT indices - static L1CaloRegion makeRegionFromGctIndices(const unsigned et, - const bool overFlow, - const bool fineGrain, - const bool mip, - const bool quiet, - const unsigned ieta, - const unsigned iphi); - /// constructor from raw data and GCT indices for unpacking - static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, - const unsigned ieta, - const unsigned iphi, - const uint16_t block, - const uint16_t index, - const int16_t bx); - - /// construct region for use in GCT internal jet-finding - static L1CaloRegion makeGctJetRegion(const unsigned et, +namespace io_v1 { + class L1CaloRegion { + public: + /// default constructor + L1CaloRegion(); + + /// constructor for RCT emulator (HB/HE regions) - to be removed! + L1CaloRegion( + unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn); + + /// constructor for RCT emulator (HF regions) - to be removed! + L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn); + + /// construct with GCT eta,phi indices, for testing GCT emulator - note argument ordering! - to be removed! + L1CaloRegion(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi); + + /// constructor from raw data and GCT indices for unpacking - to be removed! + L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx); + + /// destructor + ~L1CaloRegion(); + + // named ctors + + /// constructor HB/HE region from components + static L1CaloRegion makeHBHERegion(const unsigned et, const bool overFlow, - const bool fineGrain, - const unsigned ieta, - const unsigned iphi, - const int16_t bx); + const bool tauVeto, + const bool mip, + const bool quiet, + const unsigned crate, + const unsigned card, + const unsigned rgn); + + /// construct HF region from components + static L1CaloRegion makeHFRegion(const unsigned et, const bool fineGrain, const unsigned crate, const unsigned rgn); + + /// construct region from GCT indices + static L1CaloRegion makeRegionFromGctIndices(const unsigned et, + const bool overFlow, + const bool fineGrain, + const bool mip, + const bool quiet, + const unsigned ieta, + const unsigned iphi); + /// constructor from raw data and GCT indices for unpacking + static L1CaloRegion makeRegionFromUnpacker(const uint16_t data, + const unsigned ieta, + const unsigned iphi, + const uint16_t block, + const uint16_t index, + const int16_t bx); - // get/set methods for the data + /// construct region for use in GCT internal jet-finding + static L1CaloRegion makeGctJetRegion(const unsigned et, + const bool overFlow, + const bool fineGrain, + const unsigned ieta, + const unsigned iphi, + const int16_t bx); - /// reset the data content (not position id!) - void reset() { m_data = 0; } + // get/set methods for the data - /// get raw data - uint16_t raw() const { return m_data; } + /// reset the data content (not position id!) + void reset() { m_data = 0; } - /// get Et - unsigned et() const { return (isHf() ? m_data & 0xff : m_data & 0x3ff); } + /// get raw data + uint16_t raw() const { return m_data; } - /// get Et for internal GCT use - unsigned etFullScale() const { return m_data & 0xfff; } + /// get Et + unsigned et() const { return (isHf() ? m_data & 0xff : m_data & 0x3ff); } - /// get overflow - bool overFlow() const { return ((m_data >> 10) & 0x1) != 0; } + /// get Et for internal GCT use + unsigned etFullScale() const { return m_data & 0xfff; } - /// get tau veto bit - bool tauVeto() const { return (isHf() ? false : fineGrain()); } + /// get overflow + bool overFlow() const { return ((m_data >> 10) & 0x1) != 0; } - /// get fine grain bit - bool fineGrain() const { return ((m_data >> 11) & 0x1) != 0; } + /// get tau veto bit + bool tauVeto() const { return (isHf() ? false : fineGrain()); } - /// get MIP bit - bool mip() const { return ((m_data >> 12) & 0x1) != 0; } + /// get fine grain bit + bool fineGrain() const { return ((m_data >> 11) & 0x1) != 0; } - /// get quiet bit - bool quiet() const { return ((m_data >> 13) & 0x1) != 0; } + /// get MIP bit + bool mip() const { return ((m_data >> 12) & 0x1) != 0; } - /// set cap block - void setCaptureBlock(uint16_t capBlock) { m_captureBlock = capBlock; } + /// get quiet bit + bool quiet() const { return ((m_data >> 13) & 0x1) != 0; } - /// set cap index - void setCaptureIndex(uint16_t capIndex) { m_captureIndex = capIndex; } + /// set cap block + void setCaptureBlock(uint16_t capBlock) { m_captureBlock = capBlock; } - /// set bx - void setBx(int16_t bx); + /// set cap index + void setCaptureIndex(uint16_t capIndex) { m_captureIndex = capIndex; } - /// set data - void setRawData(uint32_t data) { m_data = data; } + /// set bx + void setBx(int16_t bx); - /// set MIP bit (required for GCT emulator standalone operation) - void setMip(bool mip); + /// set data + void setRawData(uint32_t data) { m_data = data; } - /// set quiet bit (required for GCT emulator standalone operation) - void setQuiet(bool quiet); + /// set MIP bit (required for GCT emulator standalone operation) + void setMip(bool mip); - // get methods for the geographical information + /// set quiet bit (required for GCT emulator standalone operation) + void setQuiet(bool quiet); - /// get global region ID - L1CaloRegionDetId id() const { return m_id; } + // get methods for the geographical information - /// forward or central region - bool isHf() const { return m_id.isHf(); } - bool isHbHe() const { return !m_id.isHf(); } + /// get global region ID + L1CaloRegionDetId id() const { return m_id; } - /// get RCT crate ID - unsigned rctCrate() const { return m_id.rctCrate(); } + /// forward or central region + bool isHf() const { return m_id.isHf(); } + bool isHbHe() const { return !m_id.isHf(); } - /// get RCT reciever card ID (valid output for HB/HE) - unsigned rctCard() const { return m_id.rctCard(); } + /// get RCT crate ID + unsigned rctCrate() const { return m_id.rctCrate(); } - /// get RCT region index - unsigned rctRegionIndex() const { return m_id.rctRegion(); } + /// get RCT reciever card ID (valid output for HB/HE) + unsigned rctCard() const { return m_id.rctCard(); } - /// get local eta index (within RCT crate) - unsigned rctEta() const { return m_id.rctEta(); } + /// get RCT region index + unsigned rctRegionIndex() const { return m_id.rctRegion(); } - /// get local phi index (within RCT crate) - unsigned rctPhi() const { return m_id.rctPhi(); } + /// get local eta index (within RCT crate) + unsigned rctEta() const { return m_id.rctEta(); } - /// get GCT eta index - unsigned gctEta() const { return m_id.ieta(); } + /// get local phi index (within RCT crate) + unsigned rctPhi() const { return m_id.rctPhi(); } - /// get GCT phi index - unsigned gctPhi() const { return m_id.iphi(); } + /// get GCT eta index + unsigned gctEta() const { return m_id.ieta(); } - /// which capture block did this come from - unsigned capBlock() const { return m_captureBlock; } + /// get GCT phi index + unsigned gctPhi() const { return m_id.iphi(); } - /// what index within capture block - unsigned capIndex() const { return m_captureIndex; } + /// which capture block did this come from + unsigned capBlock() const { return m_captureBlock; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// what index within capture block + unsigned capIndex() const { return m_captureIndex; } - /// equality operator, including rank, feature bits, and position - int operator==(const L1CaloRegion& c) const { - return ((m_data == c.raw() && m_id == c.id()) || (this->empty() && c.empty())); - } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// inequality operator - int operator!=(const L1CaloRegion& c) const { return !(*this == c); } + /// equality operator, including rank, feature bits, and position + int operator==(const L1CaloRegion& c) const { + return ((m_data == c.raw() && m_id == c.id()) || (this->empty() && c.empty())); + } - /// is there any information in the candidate - bool empty() const { return (m_data == 0); } + /// inequality operator + int operator!=(const L1CaloRegion& c) const { return !(*this == c); } - /// print to stream - friend std::ostream& operator<<(std::ostream& os, const L1CaloRegion& reg); + /// is there any information in the candidate + bool empty() const { return (m_data == 0); } -private: - /// set region ID - void setRegionId(L1CaloRegionDetId id) { m_id = id; } + /// print to stream + friend std::ostream& operator<<(std::ostream& os, const L1CaloRegion& reg); - /// pack the raw data from arguments (used in constructors) - void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet); + private: + /// set region ID + void setRegionId(L1CaloRegionDetId id) { m_id = id; } - /// pack the raw data from arguments (used in constructors) - void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet); + /// pack the raw data from arguments (used in constructors) + void pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet); - /// region id - L1CaloRegionDetId m_id; + /// pack the raw data from arguments (used in constructors) + void pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet); - /// region data : et, overflow, fine grain/tau veto, mip and quiet bits - uint16_t m_data; - uint16_t m_captureBlock; - uint8_t m_captureIndex; - int16_t m_bx; -}; + /// region id + L1CaloRegionDetId m_id; + /// region data : et, overflow, fine grain/tau veto, mip and quiet bits + uint16_t m_data; + uint16_t m_captureBlock; + uint8_t m_captureIndex; + int16_t m_bx; + }; +} // namespace io_v1 +using L1CaloRegion = io_v1::L1CaloRegion; #endif /*L1CALOREGION_H*/ diff --git a/DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h b/DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h index 78e4858d70755..513ac89cf9c89 100644 --- a/DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h +++ b/DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h @@ -15,47 +15,49 @@ * */ -class L1CaloRegionDetId : public DetId { -public: - static const unsigned N_PHI = 18; - static const unsigned N_ETA = 22; +namespace io_v1 { + class L1CaloRegionDetId : public DetId { + public: + static const unsigned N_PHI = 18; + static const unsigned N_ETA = 22; - /// create null id - L1CaloRegionDetId(); + /// create null id + L1CaloRegionDetId(); - /// create id from raw data (0=invalid code?) - L1CaloRegionDetId(uint32_t rawid); + /// create id from raw data (0=invalid code?) + L1CaloRegionDetId(uint32_t rawid); - /// create id from global eta, phi indices (eta=0-21, phi=0-17) - L1CaloRegionDetId(unsigned ieta, unsigned iphi); + /// create id from global eta, phi indices (eta=0-21, phi=0-17) + L1CaloRegionDetId(unsigned ieta, unsigned iphi); - /// create id from RCT crate, RCT card, RCT region (within card) - /// icard=999 is used to indicate HF regions - L1CaloRegionDetId(unsigned icrate, unsigned icard, unsigned irgn); + /// create id from RCT crate, RCT card, RCT region (within card) + /// icard=999 is used to indicate HF regions + L1CaloRegionDetId(unsigned icrate, unsigned icard, unsigned irgn); - /// global eta index (0-21) - unsigned ieta() const { return id_ & 0x1f; } + /// global eta index (0-21) + unsigned ieta() const { return id_ & 0x1f; } - /// global phi index (0-17) - unsigned iphi() const { return (id_ >> 5) & 0x1f; } + /// global phi index (0-17) + unsigned iphi() const { return (id_ >> 5) & 0x1f; } - /// return central or forward type - bool isHf() const { return (ieta() < 4 || ieta() > 17); } + /// return central or forward type + bool isHf() const { return (ieta() < 4 || ieta() > 17); } - /// return RCT crate number (0-17) - unsigned rctCrate() const; + /// return RCT crate number (0-17) + unsigned rctCrate() const; - /// return RCT card number (0-6) - unsigned rctCard() const; + /// return RCT card number (0-6) + unsigned rctCard() const; - /// return RCT region index (0-1 for barrel, 0-7 for HF) - unsigned rctRegion() const; + /// return RCT region index (0-1 for barrel, 0-7 for HF) + unsigned rctRegion() const; - /// return local RCT eta index (0-10) - unsigned rctEta() const { return (ieta() < 11 ? 10 - ieta() : ieta() - 11); } - - /// return local RCT phi index (0-1) - unsigned rctPhi() const { return (iphi() % 2); } -}; + /// return local RCT eta index (0-10) + unsigned rctEta() const { return (ieta() < 11 ? 10 - ieta() : ieta() - 11); } + /// return local RCT phi index (0-1) + unsigned rctPhi() const { return (iphi() % 2); } + }; +} // namespace io_v1 +using L1CaloRegionDetId = io_v1::L1CaloRegionDetId; #endif diff --git a/DataFormats/L1CaloTrigger/interface/L1CaloRegionFwd.h b/DataFormats/L1CaloTrigger/interface/L1CaloRegionFwd.h index 406c2b45c6327..7aeb87251ec29 100644 --- a/DataFormats/L1CaloTrigger/interface/L1CaloRegionFwd.h +++ b/DataFormats/L1CaloTrigger/interface/L1CaloRegionFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1CaloTrigger_L1CaloRegionFwd_h #define DataFormats_L1CaloTrigger_L1CaloRegionFwd_h -class L1CaloRegion; - +namespace io_v1 { + class L1CaloRegion; +} +using L1CaloRegion = io_v1::L1CaloRegion; #endif diff --git a/DataFormats/L1CaloTrigger/src/L1CaloEmCand.cc b/DataFormats/L1CaloTrigger/src/L1CaloEmCand.cc index d427eedd442bf..ab95b8937e840 100644 --- a/DataFormats/L1CaloTrigger/src/L1CaloEmCand.cc +++ b/DataFormats/L1CaloTrigger/src/L1CaloEmCand.cc @@ -7,53 +7,55 @@ using std::endl; using std::hex; using std::ostream; -// default constructor -L1CaloEmCand::L1CaloEmCand() : m_data(0), m_rctCrate(0), m_iso(false), m_index(0), m_bx(0) {} - -// construct from raw data (for use in unpacking) -// last bool argument is a hack to distinguish this constructor from the next one! -L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso) - : m_data(data), m_rctCrate(crate), m_iso(iso), m_index(0), m_bx(0) {} - -// construct from raw data (for use in unpacking) -// last bool argument is a hack to distinguish this constructor from the next one! -L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy) - : m_data(data), m_rctCrate(crate), m_iso(iso), m_index(index), m_bx(bx) {} - -// construct from content (for use in emulator) -L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso) - : m_data(0), // over-ridden below - m_rctCrate(crate), - m_iso(iso), - m_index(0), - m_bx(0) - -{ - m_data = (rank & 0x3f) + ((region & 0x1) << 6) + ((card & 0x7) << 7); -} - -// construct from content (for use in emulator) -L1CaloEmCand::L1CaloEmCand( - unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx) - : m_data(0), // over-ridden below - m_rctCrate(crate), - m_iso(iso), - m_index(index), - m_bx(bx) { - m_data = (rank & 0x3f) + ((region & 0x1) << 6) + ((card & 0x7) << 7); -} - -// destructor -L1CaloEmCand::~L1CaloEmCand() {} - -void L1CaloEmCand::setBx(int16_t bx) { m_bx = bx; } - -// pretty print -ostream& operator<<(ostream& s, const L1CaloEmCand& cand) { - s << "L1CaloEmCand : "; - s << "rank=" << cand.rank(); - s << ", region=" << cand.rctRegion() << ", card=" << cand.rctCard() << ", crate=" << cand.rctCrate(); - s << ", iso=" << cand.isolated(); - s << ", index=" << cand.index() << ", BX=" << cand.bx(); - return s; -} +namespace io_v1 { + // default constructor + L1CaloEmCand::L1CaloEmCand() : m_data(0), m_rctCrate(0), m_iso(false), m_index(0), m_bx(0) {} + + // construct from raw data (for use in unpacking) + // last bool argument is a hack to distinguish this constructor from the next one! + L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso) + : m_data(data), m_rctCrate(crate), m_iso(iso), m_index(0), m_bx(0) {} + + // construct from raw data (for use in unpacking) + // last bool argument is a hack to distinguish this constructor from the next one! + L1CaloEmCand::L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy) + : m_data(data), m_rctCrate(crate), m_iso(iso), m_index(index), m_bx(bx) {} + + // construct from content (for use in emulator) + L1CaloEmCand::L1CaloEmCand(unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso) + : m_data(0), // over-ridden below + m_rctCrate(crate), + m_iso(iso), + m_index(0), + m_bx(0) + + { + m_data = (rank & 0x3f) + ((region & 0x1) << 6) + ((card & 0x7) << 7); + } + + // construct from content (for use in emulator) + L1CaloEmCand::L1CaloEmCand( + unsigned rank, unsigned region, unsigned card, unsigned crate, bool iso, uint16_t index, int16_t bx) + : m_data(0), // over-ridden below + m_rctCrate(crate), + m_iso(iso), + m_index(index), + m_bx(bx) { + m_data = (rank & 0x3f) + ((region & 0x1) << 6) + ((card & 0x7) << 7); + } + + // destructor + L1CaloEmCand::~L1CaloEmCand() {} + + void L1CaloEmCand::setBx(int16_t bx) { m_bx = bx; } + + // pretty print + ostream& operator<<(ostream& s, const L1CaloEmCand& cand) { + s << "L1CaloEmCand : "; + s << "rank=" << cand.rank(); + s << ", region=" << cand.rctRegion() << ", card=" << cand.rctCard() << ", crate=" << cand.rctCrate(); + s << ", iso=" << cand.isolated(); + s << ", index=" << cand.index() << ", BX=" << cand.bx(); + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1CaloTrigger/src/L1CaloRegion.cc b/DataFormats/L1CaloTrigger/src/L1CaloRegion.cc index 543ed5ee36306..cc9b1749209aa 100644 --- a/DataFormats/L1CaloTrigger/src/L1CaloRegion.cc +++ b/DataFormats/L1CaloTrigger/src/L1CaloRegion.cc @@ -7,151 +7,153 @@ using std::endl; using std::hex; using std::ostream; -// default constructor -L1CaloRegion::L1CaloRegion() : m_id(), m_data(0), m_bx(0) {} - -// constructor for RCT emulator (HB/HE regions) -L1CaloRegion::L1CaloRegion( - unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn) - : m_id(crate, card, rgn), - m_data(0), // over-ridden below - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) { - pack(et, overFlow, tauVeto, mip, quiet); -} - -// constructor for RCT emulator (HF regions) -L1CaloRegion::L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn) - : m_id(crate, 999, rgn), - m_data(0), // over-ridden below - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) { - pack((et & 0xff), (et >= 0xff), fineGrain, false, false); -} - -// construct from global eta, phi indices -L1CaloRegion::L1CaloRegion( - unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi) - : m_id(ieta, iphi), - m_data(0), // over-ridden below - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) { - pack(et, overFlow, fineGrain, mip, quiet); -} - -//constructor for unpacking -L1CaloRegion::L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx) - : m_id(ieta, iphi), m_data(data), m_captureBlock(0), m_captureIndex(0), m_bx(bx) {} - -// destructor -L1CaloRegion::~L1CaloRegion() {} - -// named ctors - -// for HB/HE from RCT indices -L1CaloRegion L1CaloRegion::makeHBHERegion( - unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn) { - L1CaloRegion r; - r.setRegionId(L1CaloRegionDetId(crate, card, rgn)); - r.setBx(0); - r.pack(et, overFlow, tauVeto, mip, quiet); - return r; -} - -// for HF from RCT indices -L1CaloRegion L1CaloRegion::makeHFRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn) { - L1CaloRegion r; - r.setRegionId(L1CaloRegionDetId(crate, 999, rgn)); - r.setBx(0); - r.pack((et & 0xff), (et >= 0xff), fineGrain, false, false); - return r; -} - -// HB/HE/HF from GCT indices -L1CaloRegion L1CaloRegion::makeRegionFromGctIndices( - unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi) { - L1CaloRegion r; - r.setRegionId(L1CaloRegionDetId(ieta, iphi)); - r.setBx(0); - r.pack(et, overFlow, fineGrain, mip, quiet); - return r; -} - -//constructor for unpacking -L1CaloRegion L1CaloRegion::makeRegionFromUnpacker( - uint16_t data, unsigned ieta, unsigned iphi, uint16_t block, uint16_t index, int16_t bx) { - L1CaloRegion r; - r.setRegionId(L1CaloRegionDetId(ieta, iphi)); - r.setRawData(data); - r.setCaptureBlock(block); - r.setCaptureIndex(index); - r.setBx(bx); - return r; -} - -L1CaloRegion L1CaloRegion::makeGctJetRegion(const unsigned et, - const bool overFlow, - const bool fineGrain, - const unsigned ieta, - const unsigned iphi, - const int16_t bx) { - L1CaloRegion r; - r.setRegionId(L1CaloRegionDetId(ieta, iphi)); - r.setBx(bx); - r.pack12BitsEt(et, overFlow, fineGrain, false, false); - return r; -} - -// set BX -void L1CaloRegion::setBx(int16_t bx) { m_bx = bx; } - -// set mip bit -void L1CaloRegion::setMip(bool mip) { - if (mip) { - m_data |= 0x1000; - } else { - m_data &= 0xefff; +namespace io_v1 { + // default constructor + L1CaloRegion::L1CaloRegion() : m_id(), m_data(0), m_bx(0) {} + + // constructor for RCT emulator (HB/HE regions) + L1CaloRegion::L1CaloRegion( + unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn) + : m_id(crate, card, rgn), + m_data(0), // over-ridden below + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) { + pack(et, overFlow, tauVeto, mip, quiet); } -} - -// set quiet bit -void L1CaloRegion::setQuiet(bool quiet) { - if (quiet) { - m_data |= 0x2000; - } else { - m_data &= 0xdfff; + + // constructor for RCT emulator (HF regions) + L1CaloRegion::L1CaloRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn) + : m_id(crate, 999, rgn), + m_data(0), // over-ridden below + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) { + pack((et & 0xff), (et >= 0xff), fineGrain, false, false); + } + + // construct from global eta, phi indices + L1CaloRegion::L1CaloRegion( + unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi) + : m_id(ieta, iphi), + m_data(0), // over-ridden below + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) { + pack(et, overFlow, fineGrain, mip, quiet); + } + + //constructor for unpacking + L1CaloRegion::L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx) + : m_id(ieta, iphi), m_data(data), m_captureBlock(0), m_captureIndex(0), m_bx(bx) {} + + // destructor + L1CaloRegion::~L1CaloRegion() {} + + // named ctors + + // for HB/HE from RCT indices + L1CaloRegion L1CaloRegion::makeHBHERegion( + unsigned et, bool overFlow, bool tauVeto, bool mip, bool quiet, unsigned crate, unsigned card, unsigned rgn) { + L1CaloRegion r; + r.setRegionId(L1CaloRegionDetId(crate, card, rgn)); + r.setBx(0); + r.pack(et, overFlow, tauVeto, mip, quiet); + return r; + } + + // for HF from RCT indices + L1CaloRegion L1CaloRegion::makeHFRegion(unsigned et, bool fineGrain, unsigned crate, unsigned rgn) { + L1CaloRegion r; + r.setRegionId(L1CaloRegionDetId(crate, 999, rgn)); + r.setBx(0); + r.pack((et & 0xff), (et >= 0xff), fineGrain, false, false); + return r; + } + + // HB/HE/HF from GCT indices + L1CaloRegion L1CaloRegion::makeRegionFromGctIndices( + unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet, unsigned ieta, unsigned iphi) { + L1CaloRegion r; + r.setRegionId(L1CaloRegionDetId(ieta, iphi)); + r.setBx(0); + r.pack(et, overFlow, fineGrain, mip, quiet); + return r; + } + + //constructor for unpacking + L1CaloRegion L1CaloRegion::makeRegionFromUnpacker( + uint16_t data, unsigned ieta, unsigned iphi, uint16_t block, uint16_t index, int16_t bx) { + L1CaloRegion r; + r.setRegionId(L1CaloRegionDetId(ieta, iphi)); + r.setRawData(data); + r.setCaptureBlock(block); + r.setCaptureIndex(index); + r.setBx(bx); + return r; + } + + L1CaloRegion L1CaloRegion::makeGctJetRegion(const unsigned et, + const bool overFlow, + const bool fineGrain, + const unsigned ieta, + const unsigned iphi, + const int16_t bx) { + L1CaloRegion r; + r.setRegionId(L1CaloRegionDetId(ieta, iphi)); + r.setBx(bx); + r.pack12BitsEt(et, overFlow, fineGrain, false, false); + return r; + } + + // set BX + void L1CaloRegion::setBx(int16_t bx) { m_bx = bx; } + + // set mip bit + void L1CaloRegion::setMip(bool mip) { + if (mip) { + m_data |= 0x1000; + } else { + m_data &= 0xefff; + } + } + + // set quiet bit + void L1CaloRegion::setQuiet(bool quiet) { + if (quiet) { + m_data |= 0x2000; + } else { + m_data &= 0xdfff; + } + } + + void L1CaloRegion::pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet) { + bool checkOvF = overFlow || (et >= 0x400); + m_data = (et & 0x3ff) | ((checkOvF) ? 0x400 : 0x0) | ((fineGrain) ? 0x800 : 0x0) | ((mip) ? 0x1000 : 0x0) | + ((quiet) ? 0x2000 : 0x0); + } + + void L1CaloRegion::pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet) { + bool checkOvF = overFlow || (et >= 0x400); + m_data = (et & 0xfff) | ((checkOvF) ? 0x400 : 0x0) | ((fineGrain) ? 0x800 : 0x0) | ((mip) ? 0x1000 : 0x0) | + ((quiet) ? 0x2000 : 0x0); + } + + // print to stream + ostream& operator<<(ostream& os, const L1CaloRegion& reg) { + os << "L1CaloRegion:"; + os << " Et=" << reg.et(); + os << " o/f=" << reg.overFlow(); + os << " f/g=" << reg.fineGrain(); + os << " tau=" << reg.tauVeto() << endl; + os << " RCT crate=" << reg.rctCrate(); + os << " RCT card=" << reg.rctCard(); + os << " RCT rgn=" << reg.rctRegionIndex(); + os << " RCT eta=" << reg.rctEta(); + os << " RCT phi=" << reg.rctPhi() << endl; + os << " GCT eta=" << reg.gctEta(); + os << " GCT phi=" << reg.gctPhi() << endl; + os << hex << " cap block=" << reg.capBlock() << dec << ", index=" << reg.capIndex() << ", BX=" << reg.bx(); + return os; } -} - -void L1CaloRegion::pack(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet) { - bool checkOvF = overFlow || (et >= 0x400); - m_data = (et & 0x3ff) | ((checkOvF) ? 0x400 : 0x0) | ((fineGrain) ? 0x800 : 0x0) | ((mip) ? 0x1000 : 0x0) | - ((quiet) ? 0x2000 : 0x0); -} - -void L1CaloRegion::pack12BitsEt(unsigned et, bool overFlow, bool fineGrain, bool mip, bool quiet) { - bool checkOvF = overFlow || (et >= 0x400); - m_data = (et & 0xfff) | ((checkOvF) ? 0x400 : 0x0) | ((fineGrain) ? 0x800 : 0x0) | ((mip) ? 0x1000 : 0x0) | - ((quiet) ? 0x2000 : 0x0); -} - -// print to stream -ostream& operator<<(ostream& os, const L1CaloRegion& reg) { - os << "L1CaloRegion:"; - os << " Et=" << reg.et(); - os << " o/f=" << reg.overFlow(); - os << " f/g=" << reg.fineGrain(); - os << " tau=" << reg.tauVeto() << endl; - os << " RCT crate=" << reg.rctCrate(); - os << " RCT card=" << reg.rctCard(); - os << " RCT rgn=" << reg.rctRegionIndex(); - os << " RCT eta=" << reg.rctEta(); - os << " RCT phi=" << reg.rctPhi() << endl; - os << " GCT eta=" << reg.gctEta(); - os << " GCT phi=" << reg.gctPhi() << endl; - os << hex << " cap block=" << reg.capBlock() << dec << ", index=" << reg.capIndex() << ", BX=" << reg.bx(); - return os; -} +} // namespace io_v1 diff --git a/DataFormats/L1CaloTrigger/src/classes_def.xml b/DataFormats/L1CaloTrigger/src/classes_def.xml index 6dd02978e55d7..afdbe2d5abba5 100644 --- a/DataFormats/L1CaloTrigger/src/classes_def.xml +++ b/DataFormats/L1CaloTrigger/src/classes_def.xml @@ -1,18 +1,17 @@ - - + + - - - + + - - + + - - - - + + + + diff --git a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h index cfaaac8e353e9..8dc199e5637f6 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h @@ -30,32 +30,34 @@ // -- Class Interface -- // --------------------- -class L1MuDTChambPhContainer { -public: - typedef std::vector Phi_Container; - typedef Phi_Container::const_iterator Phi_iterator; +namespace io_v1 { + class L1MuDTChambPhContainer { + public: + typedef std::vector Phi_Container; + typedef Phi_Container::const_iterator Phi_iterator; - // Constructors - L1MuDTChambPhContainer() = default; - explicit L1MuDTChambPhContainer(Phi_Container); + // Constructors + L1MuDTChambPhContainer() = default; + explicit L1MuDTChambPhContainer(Phi_Container); - // Destructor - ~L1MuDTChambPhContainer() = default; + // Destructor + ~L1MuDTChambPhContainer() = default; - void setContainer(Phi_Container inputSegments); + void setContainer(Phi_Container inputSegments); - Phi_Container const* getContainer() const; + Phi_Container const* getContainer() const; - bool bxEmpty(int step) const; + bool bxEmpty(int step) const; - int bxSize(int step1, int step2) const; + int bxSize(int step1, int step2) const; - L1MuDTChambPhDigi const* chPhiSegm1(int wheel, int stat, int sect, int bx) const; + L1MuDTChambPhDigi const* chPhiSegm1(int wheel, int stat, int sect, int bx) const; - L1MuDTChambPhDigi const* chPhiSegm2(int wheel, int stat, int sect, int bx) const; - -private: - Phi_Container phiSegments; -}; + L1MuDTChambPhDigi const* chPhiSegm2(int wheel, int stat, int sect, int bx) const; + private: + Phi_Container phiSegments; + }; +} // namespace io_v1 +using L1MuDTChambPhContainer = io_v1::L1MuDTChambPhContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainerFwd.h b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainerFwd.h index b06081310ec08..5072caf839a29 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainerFwd.h +++ b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainerFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1DTTrackFinder_L1MuDTChambPhContainerFwd_h #define DataFormats_L1DTTrackFinder_L1MuDTChambPhContainerFwd_h -class L1MuDTChambPhContainer; - +namespace io_v1 { + class L1MuDTChambPhContainer; +} +using L1MuDTChambPhContainer = io_v1::L1MuDTChambPhContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h index ea4c8906d81f9..8da2d94762ec5 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h @@ -30,30 +30,32 @@ // -- Class Interface -- // --------------------- -class L1MuDTChambThContainer { -public: - typedef std::vector The_Container; - typedef The_Container::const_iterator The_iterator; +namespace io_v1 { + class L1MuDTChambThContainer { + public: + typedef std::vector The_Container; + typedef The_Container::const_iterator The_iterator; - // Constructors - L1MuDTChambThContainer() = default; - L1MuDTChambThContainer(The_Container); + // Constructors + L1MuDTChambThContainer() = default; + L1MuDTChambThContainer(The_Container); - // Destructor - ~L1MuDTChambThContainer() = default; + // Destructor + ~L1MuDTChambThContainer() = default; - void setContainer(The_Container inputSegments); + void setContainer(The_Container inputSegments); - The_Container const* getContainer() const; + The_Container const* getContainer() const; - bool bxEmpty(int step) const; + bool bxEmpty(int step) const; - int bxSize(int step1, int step2) const; + int bxSize(int step1, int step2) const; - L1MuDTChambThDigi const* chThetaSegm(int wheel, int stat, int sect, int bx) const; - -private: - The_Container theSegments; -}; + L1MuDTChambThDigi const* chThetaSegm(int wheel, int stat, int sect, int bx) const; + private: + The_Container theSegments; + }; +} // namespace io_v1 +using L1MuDTChambThContainer = io_v1::L1MuDTChambThContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainerFwd.h b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainerFwd.h index daa5e34fe1f4f..3c9d1d1ee752e 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainerFwd.h +++ b/DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainerFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1DTTrackFinder_L1MuDTChambThContainerFwd_h #define DataFormats_L1DTTrackFinder_L1MuDTChambThContainerFwd_h -class L1MuDTChambThContainer; - +namespace io_v1 { + class L1MuDTChambThContainer; +} +using L1MuDTChambThContainer = io_v1::L1MuDTChambThContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h b/DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h index 0e4d880f909b1..cb022c5f6b17a 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1MuDTTrackContainer.h @@ -30,32 +30,34 @@ // -- Class Interface -- // --------------------- -class L1MuDTTrackContainer { -public: - typedef std::vector TrackContainer; - typedef TrackContainer::const_iterator Trackiterator; - typedef TrackContainer::iterator TrackIterator; +namespace io_v1 { + class L1MuDTTrackContainer { + public: + typedef std::vector TrackContainer; + typedef TrackContainer::const_iterator Trackiterator; + typedef TrackContainer::iterator TrackIterator; - // Constructors - L1MuDTTrackContainer(); + // Constructors + L1MuDTTrackContainer(); - // Destructor - ~L1MuDTTrackContainer(); + // Destructor + ~L1MuDTTrackContainer(); - void setContainer(const TrackContainer& inputTracks); + void setContainer(const TrackContainer& inputTracks); - TrackContainer const* getContainer() const; + TrackContainer const* getContainer() const; - bool bxEmpty(int step) const; + bool bxEmpty(int step) const; - int bxSize(int step1, int step2) const; + int bxSize(int step1, int step2) const; - L1MuDTTrackCand const* dtTrackCand1(int wheel, int sect, int bx) const; + L1MuDTTrackCand const* dtTrackCand1(int wheel, int sect, int bx) const; - L1MuDTTrackCand const* dtTrackCand2(int wheel, int sect, int bx) const; - -private: - TrackContainer dtTracks; -}; + L1MuDTTrackCand const* dtTrackCand2(int wheel, int sect, int bx) const; + private: + TrackContainer dtTracks; + }; +} // namespace io_v1 +using L1MuDTTrackContainer = io_v1::L1MuDTTrackContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhContainer.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhContainer.h index 66b23f62fefed..c171549a581b2 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhContainer.h @@ -31,20 +31,23 @@ //-- Class Interface -- //--------------------- -class L1Phase2MuDTExtPhContainer { -public: - typedef std::vector Segment_Container; - typedef Segment_Container::const_iterator Segment_iterator; +namespace io_v1 { + class L1Phase2MuDTExtPhContainer { + public: + typedef std::vector Segment_Container; + typedef Segment_Container::const_iterator Segment_iterator; - // Constructor - L1Phase2MuDTExtPhContainer(); + // Constructor + L1Phase2MuDTExtPhContainer(); - void setContainer(const Segment_Container& inputSegments); + void setContainer(const Segment_Container& inputSegments); - Segment_Container const* getContainer() const; + Segment_Container const* getContainer() const; -private: - Segment_Container m_segments; -}; + private: + Segment_Container m_segments; + }; +} // namespace io_v1 +using L1Phase2MuDTExtPhContainer = io_v1::L1Phase2MuDTExtPhContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhDigi.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhDigi.h index 0f9f2a720b148..0efaa73d0cff2 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhDigi.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhDigi.h @@ -31,58 +31,61 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTExtPhDigi : public L1Phase2MuDTPhDigi { -public: - // Constructors - L1Phase2MuDTExtPhDigi(); - - L1Phase2MuDTExtPhDigi(int bx, - int wh, - int sc, - int st, - int sl, - int phi, - int phib, - int qual, - int idx, - int t0, - int chi2, - int x, - int tan, - int phi_cmssw, - int phib_cmssw, - int rpc = -10, - int wireId[8] = nullptr, - int tdc[8] = nullptr, - int lat[8] = nullptr); - - L1Phase2MuDTExtPhDigi(const L1Phase2MuDTExtPhDigi& digi); - L1Phase2MuDTExtPhDigi& operator=(const L1Phase2MuDTExtPhDigi&) = default; - L1Phase2MuDTExtPhDigi& operator=(L1Phase2MuDTExtPhDigi&&) = default; - - ~L1Phase2MuDTExtPhDigi() override {} - - // Operations - int xLocal() const; - int tanPsi() const; - - int phiCMSSW() const; - int phiBendCMSSW() const; - - int pathWireId(int) const; - int pathTDC(int) const; - int pathLat(int) const; - -private: - int m_xLocal; - int m_tanPsi; - - int m_phiCMSSW; - int m_phiBendCMSSW; - - int m_pathWireId[8]; - int m_pathTDC[8]; - int m_pathLat[8]; -}; +namespace io_v1 { + class L1Phase2MuDTExtPhDigi : public L1Phase2MuDTPhDigi { + public: + // Constructors + L1Phase2MuDTExtPhDigi(); + + L1Phase2MuDTExtPhDigi(int bx, + int wh, + int sc, + int st, + int sl, + int phi, + int phib, + int qual, + int idx, + int t0, + int chi2, + int x, + int tan, + int phi_cmssw, + int phib_cmssw, + int rpc = -10, + int wireId[8] = nullptr, + int tdc[8] = nullptr, + int lat[8] = nullptr); + + L1Phase2MuDTExtPhDigi(const L1Phase2MuDTExtPhDigi& digi); + L1Phase2MuDTExtPhDigi& operator=(const L1Phase2MuDTExtPhDigi&) = default; + L1Phase2MuDTExtPhDigi& operator=(L1Phase2MuDTExtPhDigi&&) = default; + + ~L1Phase2MuDTExtPhDigi() override {} + + // Operations + int xLocal() const; + int tanPsi() const; + + int phiCMSSW() const; + int phiBendCMSSW() const; + + int pathWireId(int) const; + int pathTDC(int) const; + int pathLat(int) const; + + private: + int m_xLocal; + int m_tanPsi; + + int m_phiCMSSW; + int m_phiBendCMSSW; + + int m_pathWireId[8]; + int m_pathTDC[8]; + int m_pathLat[8]; + }; +} // namespace io_v1 +using L1Phase2MuDTExtPhDigi = io_v1::L1Phase2MuDTExtPhDigi; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPair.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPair.h index c02ac2254ced3..c9b53ba5dc95f 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPair.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPair.h @@ -13,29 +13,32 @@ #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhDigi.h" #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThDigi.h" -class L1Phase2MuDTExtPhiThetaPair { -public: - /// Default constructor - L1Phase2MuDTExtPhiThetaPair() = default; - - /// Constructor with digis and quality - L1Phase2MuDTExtPhiThetaPair(const L1Phase2MuDTExtPhDigi& phi, const L1Phase2MuDTExtThDigi& theta, int quality); - - // Explicitly allow copy/move - L1Phase2MuDTExtPhiThetaPair(const L1Phase2MuDTExtPhiThetaPair&) = default; - L1Phase2MuDTExtPhiThetaPair& operator=(const L1Phase2MuDTExtPhiThetaPair&) = default; - L1Phase2MuDTExtPhiThetaPair(L1Phase2MuDTExtPhiThetaPair&&) = default; - L1Phase2MuDTExtPhiThetaPair& operator=(L1Phase2MuDTExtPhiThetaPair&&) = default; - - /// Accessors - const L1Phase2MuDTExtPhDigi& phiDigi() const { return phi_; } - const L1Phase2MuDTExtThDigi& thetaDigi() const { return theta_; } - int quality() const { return quality_; } - -private: - L1Phase2MuDTExtPhDigi phi_; - L1Phase2MuDTExtThDigi theta_; - int quality_; -}; +namespace io_v1 { + class L1Phase2MuDTExtPhiThetaPair { + public: + /// Default constructor + L1Phase2MuDTExtPhiThetaPair() = default; + + /// Constructor with digis and quality + L1Phase2MuDTExtPhiThetaPair(const L1Phase2MuDTExtPhDigi& phi, const L1Phase2MuDTExtThDigi& theta, int quality); + + // Explicitly allow copy/move + L1Phase2MuDTExtPhiThetaPair(const L1Phase2MuDTExtPhiThetaPair&) = default; + L1Phase2MuDTExtPhiThetaPair& operator=(const L1Phase2MuDTExtPhiThetaPair&) = default; + L1Phase2MuDTExtPhiThetaPair(L1Phase2MuDTExtPhiThetaPair&&) = default; + L1Phase2MuDTExtPhiThetaPair& operator=(L1Phase2MuDTExtPhiThetaPair&&) = default; + + /// Accessors + const L1Phase2MuDTExtPhDigi& phiDigi() const { return phi_; } + const L1Phase2MuDTExtThDigi& thetaDigi() const { return theta_; } + int quality() const { return quality_; } + + private: + L1Phase2MuDTExtPhDigi phi_; + L1Phase2MuDTExtThDigi theta_; + int quality_; + }; +} // namespace io_v1 +using L1Phase2MuDTExtPhiThetaPair = io_v1::L1Phase2MuDTExtPhiThetaPair; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPairContainer.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPairContainer.h index 74d9cf5bf076f..8777f8164acc2 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPairContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPairContainer.h @@ -31,20 +31,23 @@ //-- Class Interface -- //--------------------- -class L1Phase2MuDTExtPhiThetaPairContainer { -public: - typedef std::vector Segment_Container; - typedef Segment_Container::const_iterator Segment_iterator; +namespace io_v1 { + class L1Phase2MuDTExtPhiThetaPairContainer { + public: + typedef std::vector Segment_Container; + typedef Segment_Container::const_iterator Segment_iterator; - // Constructor - L1Phase2MuDTExtPhiThetaPairContainer(); + // Constructor + L1Phase2MuDTExtPhiThetaPairContainer(); - void setContainer(const Segment_Container& inputSegments); + void setContainer(const Segment_Container& inputSegments); - Segment_Container const& getContainer() const; + Segment_Container const& getContainer() const; -private: - Segment_Container m_segments; -}; + private: + Segment_Container m_segments; + }; +} // namespace io_v1 +using L1Phase2MuDTExtPhiThetaPairContainer = io_v1::L1Phase2MuDTExtPhiThetaPairContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThContainer.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThContainer.h index bc3a4b1281e06..9ba4ebe9058d7 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThContainer.h @@ -32,20 +32,23 @@ //-- Class Interface -- //--------------------- -class L1Phase2MuDTExtThContainer { -public: - typedef std::vector Segment_Container; - typedef Segment_Container::const_iterator Segment_iterator; +namespace io_v1 { + class L1Phase2MuDTExtThContainer { + public: + typedef std::vector Segment_Container; + typedef Segment_Container::const_iterator Segment_iterator; - // Constructor - L1Phase2MuDTExtThContainer(); + // Constructor + L1Phase2MuDTExtThContainer(); - void setContainer(const Segment_Container& inputSegments); + void setContainer(const Segment_Container& inputSegments); - Segment_Container const* getContainer() const; + Segment_Container const* getContainer() const; -private: - Segment_Container m_segments; -}; + private: + Segment_Container m_segments; + }; +} // namespace io_v1 +using L1Phase2MuDTExtThContainer = io_v1::L1Phase2MuDTExtThContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThDigi.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThDigi.h index f6e392cdd33e9..61fb3aed6dbf5 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThDigi.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtThDigi.h @@ -31,54 +31,57 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTExtThDigi : public L1Phase2MuDTThDigi { -public: - // Constructors - L1Phase2MuDTExtThDigi(); - - L1Phase2MuDTExtThDigi(int bx, - int wh, - int sc, - int st, - int z, - int k, - int qual, - int idx, - int t0, - int chi2, - int y, - int z_cmssw, - int k_cmssw, - int rpc = -10, - int wireId[4] = nullptr, - int tdc[4] = nullptr, - int lat[4] = nullptr); - - L1Phase2MuDTExtThDigi(const L1Phase2MuDTExtThDigi& digi); - L1Phase2MuDTExtThDigi& operator=(const L1Phase2MuDTExtThDigi&) = default; - L1Phase2MuDTExtThDigi& operator=(L1Phase2MuDTExtThDigi&&) = default; - - ~L1Phase2MuDTExtThDigi() override {} - - // Operations - int yLocal() const; - - int zCMSSW() const; - int kCMSSW() const; - - int pathWireId(int) const; - int pathTDC(int) const; - int pathLat(int) const; - -private: - int m_yLocal; - - int m_zCMSSW; - int m_kCMSSW; - - int m_pathWireId[4]; - int m_pathTDC[4]; - int m_pathLat[4]; -}; +namespace io_v1 { + class L1Phase2MuDTExtThDigi : public L1Phase2MuDTThDigi { + public: + // Constructors + L1Phase2MuDTExtThDigi(); + + L1Phase2MuDTExtThDigi(int bx, + int wh, + int sc, + int st, + int z, + int k, + int qual, + int idx, + int t0, + int chi2, + int y, + int z_cmssw, + int k_cmssw, + int rpc = -10, + int wireId[4] = nullptr, + int tdc[4] = nullptr, + int lat[4] = nullptr); + + L1Phase2MuDTExtThDigi(const L1Phase2MuDTExtThDigi& digi); + L1Phase2MuDTExtThDigi& operator=(const L1Phase2MuDTExtThDigi&) = default; + L1Phase2MuDTExtThDigi& operator=(L1Phase2MuDTExtThDigi&&) = default; + + ~L1Phase2MuDTExtThDigi() override {} + + // Operations + int yLocal() const; + + int zCMSSW() const; + int kCMSSW() const; + + int pathWireId(int) const; + int pathTDC(int) const; + int pathLat(int) const; + + private: + int m_yLocal; + + int m_zCMSSW; + int m_kCMSSW; + + int m_pathWireId[4]; + int m_pathTDC[4]; + int m_pathLat[4]; + }; +} // namespace io_v1 +using L1Phase2MuDTExtThDigi = io_v1::L1Phase2MuDTExtThDigi; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhContainer.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhContainer.h index 6f72f2821af4d..5fba4ec3f9d4c 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhContainer.h @@ -31,20 +31,23 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTPhContainer { -public: - typedef std::vector Segment_Container; - typedef Segment_Container::const_iterator Segment_iterator; +namespace io_v1 { + class L1Phase2MuDTPhContainer { + public: + typedef std::vector Segment_Container; + typedef Segment_Container::const_iterator Segment_iterator; - // Constructor - L1Phase2MuDTPhContainer(); + // Constructor + L1Phase2MuDTPhContainer(); - void setContainer(const Segment_Container& inputSegments); + void setContainer(const Segment_Container& inputSegments); - Segment_Container const* getContainer() const; + Segment_Container const* getContainer() const; -private: - Segment_Container m_segments; -}; + private: + Segment_Container m_segments; + }; +} // namespace io_v1 +using L1Phase2MuDTPhContainer = io_v1::L1Phase2MuDTPhContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigi.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigi.h index 24f1bf459d617..95adb83a7c682 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigi.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigi.h @@ -29,52 +29,55 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTPhDigi { -public: - // Constructors - L1Phase2MuDTPhDigi(); +namespace io_v1 { + class L1Phase2MuDTPhDigi { + public: + // Constructors + L1Phase2MuDTPhDigi(); - L1Phase2MuDTPhDigi( - int bx, int wh, int sc, int st, int sl, int phi, int phib, int qual, int idx, int t0, int chi2, int rpc = -10); + L1Phase2MuDTPhDigi( + int bx, int wh, int sc, int st, int sl, int phi, int phib, int qual, int idx, int t0, int chi2, int rpc = -10); - virtual ~L1Phase2MuDTPhDigi() {} + virtual ~L1Phase2MuDTPhDigi() {} - // Operations - int bxNum() const; + // Operations + int bxNum() const; - int whNum() const; - int scNum() const; - int stNum() const; - int slNum() const; + int whNum() const; + int scNum() const; + int stNum() const; + int slNum() const; - int phi() const; - int phiBend() const; + int phi() const; + int phiBend() const; - int quality() const; - int index() const; + int quality() const; + int index() const; - int t0() const; - int chi2() const; + int t0() const; + int chi2() const; - int rpcFlag() const; + int rpcFlag() const; -private: - int m_bx; - int m_wheel; - int m_sector; - int m_station; - int m_superlayer; + private: + int m_bx; + int m_wheel; + int m_sector; + int m_station; + int m_superlayer; - int m_phiAngle; - int m_phiBending; + int m_phiAngle; + int m_phiBending; - int m_qualityCode; - int m_index; + int m_qualityCode; + int m_index; - int m_t0; - int m_chi2; + int m_t0; + int m_chi2; - int m_rpcFlag; -}; + int m_rpcFlag; + }; +} // namespace io_v1 +using L1Phase2MuDTPhDigi = io_v1::L1Phase2MuDTPhDigi; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigiFwd.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigiFwd.h new file mode 100644 index 0000000000000..e24823dd66183 --- /dev/null +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigiFwd.h @@ -0,0 +1,9 @@ +#ifndef DataFormats_L1DTTrackFinder_L1Phase2MuDTPhDigiFwd_h +#define DataFormats_L1DTTrackFinder_L1Phase2MuDTPhDigiFwd_h + +namespace io_v1 { + class L1Phase2MuDTPhDigi; +} +using L1Phase2MuDTPhDigi = io_v1::L1Phase2MuDTPhDigi; + +#endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShower.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShower.h index f60b49e3eda73..2fe74f337c347 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShower.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShower.h @@ -25,51 +25,54 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTShower { -public: - // Constructors +namespace io_v1 { + class L1Phase2MuDTShower { + public: + // Constructors - L1Phase2MuDTShower(); + L1Phase2MuDTShower(); - L1Phase2MuDTShower(int wh, // Wheel - int sc, // Sector - int st, // Station - int sl, // Superlayer - int ndigis, // Number of digis within shower - int bx, // BX estimation - int min_wire, // Minimum wire - int max_wire, // Maximum wire - float avg_pos, // Averaged position of the shower - float avg_time, // Averaged time of the shower - const std::vector wires_profile // Wires profile - ); + L1Phase2MuDTShower(int wh, // Wheel + int sc, // Sector + int st, // Station + int sl, // Superlayer + int ndigis, // Number of digis within shower + int bx, // BX estimation + int min_wire, // Minimum wire + int max_wire, // Maximum wire + float avg_pos, // Averaged position of the shower + float avg_time, // Averaged time of the shower + const std::vector wires_profile // Wires profile + ); - // Operations + // Operations - int whNum() const; - int scNum() const; - int stNum() const; - int slNum() const; - int ndigis() const; - int bxNum() const; - int minWire() const; - int maxWire() const; - float avg_time() const; - float avg_pos() const; - std::vector wiresProfile() const; + int whNum() const; + int scNum() const; + int stNum() const; + int slNum() const; + int ndigis() const; + int bxNum() const; + int minWire() const; + int maxWire() const; + float avg_time() const; + float avg_pos() const; + std::vector wiresProfile() const; -private: - int m_wheel; - int m_sector; - int m_station; - int m_superlayer; - int m_ndigis; - int m_bx; - int m_min_wire; - int m_max_wire; - float m_avg_pos; - float m_avg_time; - std::vector m_wires_profile; -}; + private: + int m_wheel; + int m_sector; + int m_station; + int m_superlayer; + int m_ndigis; + int m_bx; + int m_min_wire; + int m_max_wire; + float m_avg_pos; + float m_avg_time; + std::vector m_wires_profile; + }; +} // namespace io_v1 +using L1Phase2MuDTShower = io_v1::L1Phase2MuDTShower; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShowerContainer.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShowerContainer.h index 60fb1a27263e0..39f13271041a0 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShowerContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTShowerContainer.h @@ -27,20 +27,23 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTShowerContainer { -public: - typedef std::vector Shower_Container; - typedef Shower_Container::const_iterator Shower_iterator; +namespace io_v1 { + class L1Phase2MuDTShowerContainer { + public: + typedef std::vector Shower_Container; + typedef Shower_Container::const_iterator Shower_iterator; - // Constructor - L1Phase2MuDTShowerContainer(); + // Constructor + L1Phase2MuDTShowerContainer(); - void setContainer(const Shower_Container& inputShowers); + void setContainer(const Shower_Container& inputShowers); - Shower_Container const* getContainer() const; + Shower_Container const* getContainer() const; -private: - Shower_Container m_showers; -}; + private: + Shower_Container m_showers; + }; +} // namespace io_v1 +using L1Phase2MuDTShowerContainer = io_v1::L1Phase2MuDTShowerContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h index ca044f03a70e7..632e7c8238d9d 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h @@ -31,20 +31,23 @@ // -- Class Interface -- // --------------------- -class L1Phase2MuDTThContainer { -public: - typedef std::vector Segment_Container; - typedef Segment_Container::const_iterator Segment_iterator; +namespace io_v1 { + class L1Phase2MuDTThContainer { + public: + typedef std::vector Segment_Container; + typedef Segment_Container::const_iterator Segment_iterator; - // Constructor - L1Phase2MuDTThContainer(); + // Constructor + L1Phase2MuDTThContainer(); - void setContainer(const Segment_Container& inputSegments); + void setContainer(const Segment_Container& inputSegments); - Segment_Container const* getContainer() const; + Segment_Container const* getContainer() const; -private: - Segment_Container m_segments; -}; + private: + Segment_Container m_segments; + }; +} // namespace io_v1 +using L1Phase2MuDTThContainer = io_v1::L1Phase2MuDTThContainer; #endif diff --git a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h index 13c84d8813c90..8d57a67f43ff3 100644 --- a/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h +++ b/DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h @@ -1,49 +1,52 @@ #ifndef L1Phase2MuDTThDigi_H #define L1Phase2MuDTThDigi_H -class L1Phase2MuDTThDigi { -public: - // Constructors - L1Phase2MuDTThDigi(); +namespace io_v1 { + class L1Phase2MuDTThDigi { + public: + // Constructors + L1Phase2MuDTThDigi(); - L1Phase2MuDTThDigi(int bx, int wh, int sc, int st, int z, int k, int qual, int idx, int t0, int chi2, int rpc = -10); + L1Phase2MuDTThDigi(int bx, int wh, int sc, int st, int z, int k, int qual, int idx, int t0, int chi2, int rpc = -10); - virtual ~L1Phase2MuDTThDigi() {} + virtual ~L1Phase2MuDTThDigi() {} - // Operations - int bxNum() const; + // Operations + int bxNum() const; - int whNum() const; - int scNum() const; - int stNum() const; + int whNum() const; + int scNum() const; + int stNum() const; - int z() const; - int k() const; + int z() const; + int k() const; - int quality() const; - int index() const; + int quality() const; + int index() const; - int t0() const; - int chi2() const; + int t0() const; + int chi2() const; - int rpcFlag() const; + int rpcFlag() const; -private: - int m_bx; - int m_wheel; - int m_sector; - int m_station; + private: + int m_bx; + int m_wheel; + int m_sector; + int m_station; - int m_zGlobal; - int m_kSlope; + int m_zGlobal; + int m_kSlope; - int m_qualityCode; - int m_index; + int m_qualityCode; + int m_index; - int m_t0; - int m_chi2; + int m_t0; + int m_chi2; - int m_rpcFlag; -}; + int m_rpcFlag; + }; +} // namespace io_v1 +using L1Phase2MuDTThDigi = io_v1::L1Phase2MuDTThDigi; #endif diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhContainer.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhContainer.cc index 10c7dae0e00ed..14df4567e2454 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhContainer.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhContainer.cc @@ -31,13 +31,17 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTExtPhContainer::L1Phase2MuDTExtPhContainer() {} +namespace io_v1 { -//-------------- -// Operations -- -//-------------- -void L1Phase2MuDTExtPhContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + L1Phase2MuDTExtPhContainer::L1Phase2MuDTExtPhContainer() {} -L1Phase2MuDTExtPhContainer::Segment_Container const* L1Phase2MuDTExtPhContainer::getContainer() const { - return &m_segments; -} + //-------------- + // Operations -- + //-------------- + void L1Phase2MuDTExtPhContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + + L1Phase2MuDTExtPhContainer::Segment_Container const* L1Phase2MuDTExtPhContainer::getContainer() const { + return &m_segments; + } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhDigi.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhDigi.cc index 95836301340cd..b74cbee1e3f46 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhDigi.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhDigi.cc @@ -31,97 +31,101 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTExtPhDigi::L1Phase2MuDTExtPhDigi() - : - - L1Phase2MuDTPhDigi(), - - m_xLocal(0), - m_tanPsi(0), - m_phiCMSSW(0), - m_phiBendCMSSW(0) { - for (int i = 0; i < 8; i++) { - m_pathWireId[i] = -1; - m_pathTDC[i] = -1; - m_pathLat[i] = 2; +namespace io_v1 { + + L1Phase2MuDTExtPhDigi::L1Phase2MuDTExtPhDigi() + : + + L1Phase2MuDTPhDigi(), + + m_xLocal(0), + m_tanPsi(0), + m_phiCMSSW(0), + m_phiBendCMSSW(0) { + for (int i = 0; i < 8; i++) { + m_pathWireId[i] = -1; + m_pathTDC[i] = -1; + m_pathLat[i] = 2; + } } -} - -L1Phase2MuDTExtPhDigi::L1Phase2MuDTExtPhDigi(int bx, - int wh, - int sc, - int st, - int sl, - int phi, - int phib, - int qual, - int idx, - int t0, - int chi2, - int x, - int tan, - int phi_cmssw, - int phib_cmssw, - int rpc, - int wireId[8], - int tdc[8], - int lat[8]) - : - - L1Phase2MuDTPhDigi(bx, wh, sc, st, sl, phi, phib, qual, idx, t0, chi2, rpc), - - m_xLocal(x), - m_tanPsi(tan), - m_phiCMSSW(phi_cmssw), - m_phiBendCMSSW(phib_cmssw) { - for (int i = 0; i < 8; i++) { - m_pathWireId[i] = wireId[i]; - m_pathTDC[i] = tdc[i]; - m_pathLat[i] = lat[i]; + + L1Phase2MuDTExtPhDigi::L1Phase2MuDTExtPhDigi(int bx, + int wh, + int sc, + int st, + int sl, + int phi, + int phib, + int qual, + int idx, + int t0, + int chi2, + int x, + int tan, + int phi_cmssw, + int phib_cmssw, + int rpc, + int wireId[8], + int tdc[8], + int lat[8]) + : + + L1Phase2MuDTPhDigi(bx, wh, sc, st, sl, phi, phib, qual, idx, t0, chi2, rpc), + + m_xLocal(x), + m_tanPsi(tan), + m_phiCMSSW(phi_cmssw), + m_phiBendCMSSW(phib_cmssw) { + for (int i = 0; i < 8; i++) { + m_pathWireId[i] = wireId[i]; + m_pathTDC[i] = tdc[i]; + m_pathLat[i] = lat[i]; + } } -} - -L1Phase2MuDTExtPhDigi::L1Phase2MuDTExtPhDigi(const L1Phase2MuDTExtPhDigi &digi) - : - - L1Phase2MuDTPhDigi(digi.bxNum(), - digi.whNum(), - digi.scNum(), - digi.stNum(), - digi.slNum(), - digi.phi(), - digi.phiBend(), - digi.quality(), - digi.index(), - digi.t0(), - digi.chi2(), - digi.rpcFlag()), - - m_xLocal(digi.xLocal()), - m_tanPsi(digi.tanPsi()), - m_phiCMSSW(digi.phiCMSSW()), - m_phiBendCMSSW(digi.phiBendCMSSW()) { - for (int i = 0; i < 8; i++) { - m_pathWireId[i] = digi.pathWireId(i); - m_pathTDC[i] = digi.pathTDC(i); - m_pathLat[i] = digi.pathLat(i); + + L1Phase2MuDTExtPhDigi::L1Phase2MuDTExtPhDigi(const L1Phase2MuDTExtPhDigi &digi) + : + + L1Phase2MuDTPhDigi(digi.bxNum(), + digi.whNum(), + digi.scNum(), + digi.stNum(), + digi.slNum(), + digi.phi(), + digi.phiBend(), + digi.quality(), + digi.index(), + digi.t0(), + digi.chi2(), + digi.rpcFlag()), + + m_xLocal(digi.xLocal()), + m_tanPsi(digi.tanPsi()), + m_phiCMSSW(digi.phiCMSSW()), + m_phiBendCMSSW(digi.phiBendCMSSW()) { + for (int i = 0; i < 8; i++) { + m_pathWireId[i] = digi.pathWireId(i); + m_pathTDC[i] = digi.pathTDC(i); + m_pathLat[i] = digi.pathLat(i); + } } -} -//-------------- -// Operations -- -//-------------- + //-------------- + // Operations -- + //-------------- + + int L1Phase2MuDTExtPhDigi::xLocal() const { return m_xLocal; } -int L1Phase2MuDTExtPhDigi::xLocal() const { return m_xLocal; } + int L1Phase2MuDTExtPhDigi::tanPsi() const { return m_tanPsi; } -int L1Phase2MuDTExtPhDigi::tanPsi() const { return m_tanPsi; } + int L1Phase2MuDTExtPhDigi::phiCMSSW() const { return m_phiCMSSW; } -int L1Phase2MuDTExtPhDigi::phiCMSSW() const { return m_phiCMSSW; } + int L1Phase2MuDTExtPhDigi::phiBendCMSSW() const { return m_phiBendCMSSW; } -int L1Phase2MuDTExtPhDigi::phiBendCMSSW() const { return m_phiBendCMSSW; } + int L1Phase2MuDTExtPhDigi::pathWireId(int i) const { return m_pathWireId[i]; } -int L1Phase2MuDTExtPhDigi::pathWireId(int i) const { return m_pathWireId[i]; } + int L1Phase2MuDTExtPhDigi::pathTDC(int i) const { return m_pathTDC[i]; } -int L1Phase2MuDTExtPhDigi::pathTDC(int i) const { return m_pathTDC[i]; } + int L1Phase2MuDTExtPhDigi::pathLat(int i) const { return m_pathLat[i]; } -int L1Phase2MuDTExtPhDigi::pathLat(int i) const { return m_pathLat[i]; } +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPair.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPair.cc index aafaee24912f7..e077d855e69ad 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPair.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPair.cc @@ -1,6 +1,10 @@ #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTExtPhiThetaPair.h" -L1Phase2MuDTExtPhiThetaPair::L1Phase2MuDTExtPhiThetaPair(const L1Phase2MuDTExtPhDigi& phi, - const L1Phase2MuDTExtThDigi& theta, - int quality) - : phi_(phi), theta_(theta), quality_(quality) {} +namespace io_v1 { + + L1Phase2MuDTExtPhiThetaPair::L1Phase2MuDTExtPhiThetaPair(const L1Phase2MuDTExtPhDigi& phi, + const L1Phase2MuDTExtThDigi& theta, + int quality) + : phi_(phi), theta_(theta), quality_(quality) {} + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPairContainer.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPairContainer.cc index e6dd96c594f61..2c81922581f11 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPairContainer.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtPhiThetaPairContainer.cc @@ -31,16 +31,20 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTExtPhiThetaPairContainer::L1Phase2MuDTExtPhiThetaPairContainer() {} - -//-------------- -// Operations -- -//-------------- -void L1Phase2MuDTExtPhiThetaPairContainer::setContainer(const Segment_Container& inputSegments) { - m_segments = inputSegments; -} - -L1Phase2MuDTExtPhiThetaPairContainer::Segment_Container const& L1Phase2MuDTExtPhiThetaPairContainer::getContainer() - const { - return m_segments; -} +namespace io_v1 { + + L1Phase2MuDTExtPhiThetaPairContainer::L1Phase2MuDTExtPhiThetaPairContainer() {} + + //-------------- + // Operations -- + //-------------- + void L1Phase2MuDTExtPhiThetaPairContainer::setContainer(const Segment_Container& inputSegments) { + m_segments = inputSegments; + } + + L1Phase2MuDTExtPhiThetaPairContainer::Segment_Container const& L1Phase2MuDTExtPhiThetaPairContainer::getContainer() + const { + return m_segments; + } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThContainer.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThContainer.cc index ca24221bc1318..8fae8f07f2faf 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThContainer.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThContainer.cc @@ -31,13 +31,17 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTExtThContainer::L1Phase2MuDTExtThContainer() {} +namespace io_v1 { -//-------------- -// Operations -- -//-------------- -void L1Phase2MuDTExtThContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + L1Phase2MuDTExtThContainer::L1Phase2MuDTExtThContainer() {} -L1Phase2MuDTExtThContainer::Segment_Container const* L1Phase2MuDTExtThContainer::getContainer() const { - return &m_segments; -} + //-------------- + // Operations -- + //-------------- + void L1Phase2MuDTExtThContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + + L1Phase2MuDTExtThContainer::Segment_Container const* L1Phase2MuDTExtThContainer::getContainer() const { + return &m_segments; + } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThDigi.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThDigi.cc index 1458077aaddfc..a5015ab67f676 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThDigi.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTExtThDigi.cc @@ -31,89 +31,93 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTExtThDigi::L1Phase2MuDTExtThDigi() - : - - L1Phase2MuDTThDigi(), - - m_yLocal(0), - m_zCMSSW(0), - m_kCMSSW(0) { - for (int i = 0; i < 4; i++) { - m_pathWireId[i] = -1; - m_pathTDC[i] = -1; - m_pathLat[i] = 2; +namespace io_v1 { + + L1Phase2MuDTExtThDigi::L1Phase2MuDTExtThDigi() + : + + L1Phase2MuDTThDigi(), + + m_yLocal(0), + m_zCMSSW(0), + m_kCMSSW(0) { + for (int i = 0; i < 4; i++) { + m_pathWireId[i] = -1; + m_pathTDC[i] = -1; + m_pathLat[i] = 2; + } } -} - -L1Phase2MuDTExtThDigi::L1Phase2MuDTExtThDigi(int bx, - int wh, - int sc, - int st, - int z, - int k, - int qual, - int idx, - int t0, - int chi2, - int y, - int z_cmssw, - int k_cmssw, - int rpc, - int wireId[4], - int tdc[4], - int lat[4]) - : - - L1Phase2MuDTThDigi(bx, wh, sc, st, z, k, qual, idx, t0, chi2, rpc), - - m_yLocal(y), - m_zCMSSW(z_cmssw), - m_kCMSSW(k_cmssw) { - for (int i = 0; i < 4; i++) { - m_pathWireId[i] = wireId[i]; - m_pathTDC[i] = tdc[i]; - m_pathLat[i] = lat[i]; + + L1Phase2MuDTExtThDigi::L1Phase2MuDTExtThDigi(int bx, + int wh, + int sc, + int st, + int z, + int k, + int qual, + int idx, + int t0, + int chi2, + int y, + int z_cmssw, + int k_cmssw, + int rpc, + int wireId[4], + int tdc[4], + int lat[4]) + : + + L1Phase2MuDTThDigi(bx, wh, sc, st, z, k, qual, idx, t0, chi2, rpc), + + m_yLocal(y), + m_zCMSSW(z_cmssw), + m_kCMSSW(k_cmssw) { + for (int i = 0; i < 4; i++) { + m_pathWireId[i] = wireId[i]; + m_pathTDC[i] = tdc[i]; + m_pathLat[i] = lat[i]; + } } -} - -L1Phase2MuDTExtThDigi::L1Phase2MuDTExtThDigi(const L1Phase2MuDTExtThDigi &digi) - : - - L1Phase2MuDTThDigi(digi.bxNum(), - digi.whNum(), - digi.scNum(), - digi.stNum(), - digi.z(), - digi.k(), - digi.quality(), - digi.index(), - digi.t0(), - digi.chi2(), - digi.rpcFlag()), - - m_yLocal(digi.yLocal()), - m_zCMSSW(digi.zCMSSW()), - m_kCMSSW(digi.kCMSSW()) { - for (int i = 0; i < 4; i++) { - m_pathWireId[i] = digi.pathWireId(i); - m_pathTDC[i] = digi.pathTDC(i); - m_pathLat[i] = digi.pathLat(i); + + L1Phase2MuDTExtThDigi::L1Phase2MuDTExtThDigi(const L1Phase2MuDTExtThDigi &digi) + : + + L1Phase2MuDTThDigi(digi.bxNum(), + digi.whNum(), + digi.scNum(), + digi.stNum(), + digi.z(), + digi.k(), + digi.quality(), + digi.index(), + digi.t0(), + digi.chi2(), + digi.rpcFlag()), + + m_yLocal(digi.yLocal()), + m_zCMSSW(digi.zCMSSW()), + m_kCMSSW(digi.kCMSSW()) { + for (int i = 0; i < 4; i++) { + m_pathWireId[i] = digi.pathWireId(i); + m_pathTDC[i] = digi.pathTDC(i); + m_pathLat[i] = digi.pathLat(i); + } } -} -//-------------- -// Operations -- -//-------------- + //-------------- + // Operations -- + //-------------- + + int L1Phase2MuDTExtThDigi::yLocal() const { return m_yLocal; } -int L1Phase2MuDTExtThDigi::yLocal() const { return m_yLocal; } + int L1Phase2MuDTExtThDigi::zCMSSW() const { return m_zCMSSW; } -int L1Phase2MuDTExtThDigi::zCMSSW() const { return m_zCMSSW; } + int L1Phase2MuDTExtThDigi::kCMSSW() const { return m_kCMSSW; } -int L1Phase2MuDTExtThDigi::kCMSSW() const { return m_kCMSSW; } + int L1Phase2MuDTExtThDigi::pathWireId(int i) const { return m_pathWireId[i]; } -int L1Phase2MuDTExtThDigi::pathWireId(int i) const { return m_pathWireId[i]; } + int L1Phase2MuDTExtThDigi::pathTDC(int i) const { return m_pathTDC[i]; } -int L1Phase2MuDTExtThDigi::pathTDC(int i) const { return m_pathTDC[i]; } + int L1Phase2MuDTExtThDigi::pathLat(int i) const { return m_pathLat[i]; } -int L1Phase2MuDTExtThDigi::pathLat(int i) const { return m_pathLat[i]; } +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhContainer.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhContainer.cc index 7c568382595e4..40d36d2fa5fa0 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhContainer.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhContainer.cc @@ -31,11 +31,17 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTPhContainer::L1Phase2MuDTPhContainer() {} +namespace io_v1 { -//-------------- -// Operations -- -//-------------- -void L1Phase2MuDTPhContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + L1Phase2MuDTPhContainer::L1Phase2MuDTPhContainer() {} -L1Phase2MuDTPhContainer::Segment_Container const* L1Phase2MuDTPhContainer::getContainer() const { return &m_segments; } + //-------------- + // Operations -- + //-------------- + void L1Phase2MuDTPhContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + + L1Phase2MuDTPhContainer::Segment_Container const* L1Phase2MuDTPhContainer::getContainer() const { + return &m_segments; + } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhDigi.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhDigi.cc index 0b421c800f567..31fa6aa232c29 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhDigi.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTPhDigi.cc @@ -31,58 +31,62 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTPhDigi::L1Phase2MuDTPhDigi() - : m_bx(-100), - m_wheel(0), - m_sector(0), - m_station(0), - m_superlayer(0), - m_phiAngle(0), - m_phiBending(0), - m_qualityCode(-1), - m_index(0), - m_t0(0), - m_chi2(0), - m_rpcFlag(-10) {} +namespace io_v1 { -L1Phase2MuDTPhDigi::L1Phase2MuDTPhDigi( - int bx, int wh, int sc, int st, int sl, int phi, int phib, int qual, int idx, int t0, int chi2, int rpc) - : m_bx(bx), - m_wheel(wh), - m_sector(sc), - m_station(st), - m_superlayer(sl), - m_phiAngle(phi), - m_phiBending(phib), - m_qualityCode(qual), - m_index(idx), - m_t0(t0), - m_chi2(chi2), - m_rpcFlag(rpc) {} + L1Phase2MuDTPhDigi::L1Phase2MuDTPhDigi() + : m_bx(-100), + m_wheel(0), + m_sector(0), + m_station(0), + m_superlayer(0), + m_phiAngle(0), + m_phiBending(0), + m_qualityCode(-1), + m_index(0), + m_t0(0), + m_chi2(0), + m_rpcFlag(-10) {} -//-------------- -// Operations -- -//-------------- -int L1Phase2MuDTPhDigi::bxNum() const { return m_bx; } + L1Phase2MuDTPhDigi::L1Phase2MuDTPhDigi( + int bx, int wh, int sc, int st, int sl, int phi, int phib, int qual, int idx, int t0, int chi2, int rpc) + : m_bx(bx), + m_wheel(wh), + m_sector(sc), + m_station(st), + m_superlayer(sl), + m_phiAngle(phi), + m_phiBending(phib), + m_qualityCode(qual), + m_index(idx), + m_t0(t0), + m_chi2(chi2), + m_rpcFlag(rpc) {} -int L1Phase2MuDTPhDigi::whNum() const { return m_wheel; } + //-------------- + // Operations -- + //-------------- + int L1Phase2MuDTPhDigi::bxNum() const { return m_bx; } -int L1Phase2MuDTPhDigi::scNum() const { return m_sector; } + int L1Phase2MuDTPhDigi::whNum() const { return m_wheel; } -int L1Phase2MuDTPhDigi::stNum() const { return m_station; } + int L1Phase2MuDTPhDigi::scNum() const { return m_sector; } -int L1Phase2MuDTPhDigi::slNum() const { return m_superlayer; } + int L1Phase2MuDTPhDigi::stNum() const { return m_station; } -int L1Phase2MuDTPhDigi::phi() const { return m_phiAngle; } + int L1Phase2MuDTPhDigi::slNum() const { return m_superlayer; } -int L1Phase2MuDTPhDigi::phiBend() const { return m_phiBending; } + int L1Phase2MuDTPhDigi::phi() const { return m_phiAngle; } -int L1Phase2MuDTPhDigi::quality() const { return m_qualityCode; } + int L1Phase2MuDTPhDigi::phiBend() const { return m_phiBending; } -int L1Phase2MuDTPhDigi::index() const { return m_index; } + int L1Phase2MuDTPhDigi::quality() const { return m_qualityCode; } -int L1Phase2MuDTPhDigi::t0() const { return m_t0; } + int L1Phase2MuDTPhDigi::index() const { return m_index; } -int L1Phase2MuDTPhDigi::chi2() const { return m_chi2; } + int L1Phase2MuDTPhDigi::t0() const { return m_t0; } -int L1Phase2MuDTPhDigi::rpcFlag() const { return m_rpcFlag; } + int L1Phase2MuDTPhDigi::chi2() const { return m_chi2; } + + int L1Phase2MuDTPhDigi::rpcFlag() const { return m_rpcFlag; } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShower.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShower.cc index 19e855c19a690..eb5355414631c 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShower.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShower.cc @@ -21,65 +21,69 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTShower::L1Phase2MuDTShower() - : m_wheel(0), - m_sector(0), - m_station(0), - m_superlayer(0), - m_ndigis(0), - m_bx(-100), - m_min_wire(0), - m_max_wire(0), - m_avg_pos(0), - m_avg_time(0) { - m_wires_profile.resize(96, 0); -} - -L1Phase2MuDTShower::L1Phase2MuDTShower(int wh, - int sc, - int st, - int sl, - int ndigis, - int bx, - int min_wire, - int max_wire, - float avg_pos, - float avg_time, - const std::vector wires_profile) - : m_wheel(wh), - m_sector(sc), - m_station(st), - m_superlayer(sl), - m_ndigis(ndigis), - m_bx(bx), - m_min_wire(min_wire), - m_max_wire(max_wire), - m_avg_pos(avg_pos), - m_avg_time(avg_time), - m_wires_profile(wires_profile) {} - -//-------------- -// Operations -- -//-------------- - -int L1Phase2MuDTShower::whNum() const { return m_wheel; } - -int L1Phase2MuDTShower::scNum() const { return m_sector; } - -int L1Phase2MuDTShower::stNum() const { return m_station; } - -int L1Phase2MuDTShower::slNum() const { return m_superlayer; } - -int L1Phase2MuDTShower::ndigis() const { return m_ndigis; } - -int L1Phase2MuDTShower::bxNum() const { return m_bx; } - -int L1Phase2MuDTShower::minWire() const { return m_min_wire; } - -int L1Phase2MuDTShower::maxWire() const { return m_max_wire; } - -float L1Phase2MuDTShower::avg_time() const { return m_avg_time; } - -float L1Phase2MuDTShower::avg_pos() const { return m_avg_pos; } - -std::vector L1Phase2MuDTShower::wiresProfile() const { return m_wires_profile; } +namespace io_v1 { + + L1Phase2MuDTShower::L1Phase2MuDTShower() + : m_wheel(0), + m_sector(0), + m_station(0), + m_superlayer(0), + m_ndigis(0), + m_bx(-100), + m_min_wire(0), + m_max_wire(0), + m_avg_pos(0), + m_avg_time(0) { + m_wires_profile.resize(96, 0); + } + + L1Phase2MuDTShower::L1Phase2MuDTShower(int wh, + int sc, + int st, + int sl, + int ndigis, + int bx, + int min_wire, + int max_wire, + float avg_pos, + float avg_time, + const std::vector wires_profile) + : m_wheel(wh), + m_sector(sc), + m_station(st), + m_superlayer(sl), + m_ndigis(ndigis), + m_bx(bx), + m_min_wire(min_wire), + m_max_wire(max_wire), + m_avg_pos(avg_pos), + m_avg_time(avg_time), + m_wires_profile(wires_profile) {} + + //-------------- + // Operations -- + //-------------- + + int L1Phase2MuDTShower::whNum() const { return m_wheel; } + + int L1Phase2MuDTShower::scNum() const { return m_sector; } + + int L1Phase2MuDTShower::stNum() const { return m_station; } + + int L1Phase2MuDTShower::slNum() const { return m_superlayer; } + + int L1Phase2MuDTShower::ndigis() const { return m_ndigis; } + + int L1Phase2MuDTShower::bxNum() const { return m_bx; } + + int L1Phase2MuDTShower::minWire() const { return m_min_wire; } + + int L1Phase2MuDTShower::maxWire() const { return m_max_wire; } + + float L1Phase2MuDTShower::avg_time() const { return m_avg_time; } + + float L1Phase2MuDTShower::avg_pos() const { return m_avg_pos; } + + std::vector L1Phase2MuDTShower::wiresProfile() const { return m_wires_profile; } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShowerContainer.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShowerContainer.cc index 19671cd6aba34..d8229a5c018d4 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShowerContainer.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTShowerContainer.cc @@ -19,13 +19,17 @@ //---------------- // Constructors -- //---------------- -L1Phase2MuDTShowerContainer::L1Phase2MuDTShowerContainer() {} +namespace io_v1 { -//-------------- -// Operations -- -//-------------- -void L1Phase2MuDTShowerContainer::setContainer(const Shower_Container& inputShowers) { m_showers = inputShowers; } + L1Phase2MuDTShowerContainer::L1Phase2MuDTShowerContainer() {} -L1Phase2MuDTShowerContainer::Shower_Container const* L1Phase2MuDTShowerContainer::getContainer() const { - return &m_showers; -} + //-------------- + // Operations -- + //-------------- + void L1Phase2MuDTShowerContainer::setContainer(const Shower_Container& inputShowers) { m_showers = inputShowers; } + + L1Phase2MuDTShowerContainer::Shower_Container const* L1Phase2MuDTShowerContainer::getContainer() const { + return &m_showers; + } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThContainer.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThContainer.cc index d7c37dc0f440e..859f9dddb9c7c 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThContainer.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThContainer.cc @@ -1,7 +1,13 @@ #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h" -L1Phase2MuDTThContainer::L1Phase2MuDTThContainer() {} +namespace io_v1 { -void L1Phase2MuDTThContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + L1Phase2MuDTThContainer::L1Phase2MuDTThContainer() {} -L1Phase2MuDTThContainer::Segment_Container const* L1Phase2MuDTThContainer::getContainer() const { return &m_segments; } + void L1Phase2MuDTThContainer::setContainer(const Segment_Container& inputSegments) { m_segments = inputSegments; } + + L1Phase2MuDTThContainer::Segment_Container const* L1Phase2MuDTThContainer::getContainer() const { + return &m_segments; + } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThDigi.cc b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThDigi.cc index e035e5274a231..edf421dd85daa 100644 --- a/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThDigi.cc +++ b/DataFormats/L1DTTrackFinder/src/L1Phase2MuDTThDigi.cc @@ -1,50 +1,54 @@ #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h" -L1Phase2MuDTThDigi::L1Phase2MuDTThDigi() - : m_bx(-100), - m_wheel(0), - m_sector(0), - m_station(0), - m_zGlobal(0), - m_kSlope(0), - m_qualityCode(-1), - m_index(0), - m_t0(0), - m_chi2(0), - m_rpcFlag(-10) {} +namespace io_v1 { -L1Phase2MuDTThDigi::L1Phase2MuDTThDigi( - int bx, int wh, int sc, int st, int z, int k, int qual, int idx, int t0, int chi2, int rpc) - : m_bx(bx), - m_wheel(wh), - m_sector(sc), - m_station(st), - m_zGlobal(z), - m_kSlope(k), - m_qualityCode(qual), - m_index(idx), - m_t0(t0), - m_chi2(chi2), - m_rpcFlag(rpc) {} + L1Phase2MuDTThDigi::L1Phase2MuDTThDigi() + : m_bx(-100), + m_wheel(0), + m_sector(0), + m_station(0), + m_zGlobal(0), + m_kSlope(0), + m_qualityCode(-1), + m_index(0), + m_t0(0), + m_chi2(0), + m_rpcFlag(-10) {} -int L1Phase2MuDTThDigi::bxNum() const { return m_bx; } + L1Phase2MuDTThDigi::L1Phase2MuDTThDigi( + int bx, int wh, int sc, int st, int z, int k, int qual, int idx, int t0, int chi2, int rpc) + : m_bx(bx), + m_wheel(wh), + m_sector(sc), + m_station(st), + m_zGlobal(z), + m_kSlope(k), + m_qualityCode(qual), + m_index(idx), + m_t0(t0), + m_chi2(chi2), + m_rpcFlag(rpc) {} -int L1Phase2MuDTThDigi::whNum() const { return m_wheel; } + int L1Phase2MuDTThDigi::bxNum() const { return m_bx; } -int L1Phase2MuDTThDigi::scNum() const { return m_sector; } + int L1Phase2MuDTThDigi::whNum() const { return m_wheel; } -int L1Phase2MuDTThDigi::stNum() const { return m_station; } + int L1Phase2MuDTThDigi::scNum() const { return m_sector; } -int L1Phase2MuDTThDigi::z() const { return m_zGlobal; } + int L1Phase2MuDTThDigi::stNum() const { return m_station; } -int L1Phase2MuDTThDigi::k() const { return m_kSlope; } + int L1Phase2MuDTThDigi::z() const { return m_zGlobal; } -int L1Phase2MuDTThDigi::quality() const { return m_qualityCode; } + int L1Phase2MuDTThDigi::k() const { return m_kSlope; } -int L1Phase2MuDTThDigi::index() const { return m_index; } + int L1Phase2MuDTThDigi::quality() const { return m_qualityCode; } -int L1Phase2MuDTThDigi::t0() const { return m_t0; } + int L1Phase2MuDTThDigi::index() const { return m_index; } -int L1Phase2MuDTThDigi::chi2() const { return m_chi2; } + int L1Phase2MuDTThDigi::t0() const { return m_t0; } -int L1Phase2MuDTThDigi::rpcFlag() const { return m_rpcFlag; } + int L1Phase2MuDTThDigi::chi2() const { return m_chi2; } + + int L1Phase2MuDTThDigi::rpcFlag() const { return m_rpcFlag; } + +} // namespace io_v1 diff --git a/DataFormats/L1DTTrackFinder/src/classes_def.xml b/DataFormats/L1DTTrackFinder/src/classes_def.xml index b2fedfc4e5985..0dab3c8a40521 100644 --- a/DataFormats/L1DTTrackFinder/src/classes_def.xml +++ b/DataFormats/L1DTTrackFinder/src/classes_def.xml @@ -1,80 +1,94 @@ - - - + + - - + + - - - + + - - + + - - + + - - - - + + + + + + + + + + + + - - - - - - + + + + + + - - + + - - + + - - + + - - + + - - + + - - - - + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + - - - - - + + + + + diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctCand.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctCand.h index f07c386413388..90baea35aa64d 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctCand.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctCand.h @@ -9,36 +9,39 @@ /// \date July 2006 /// -class L1GctCand { -public: - L1GctCand(); +namespace io_v1 { + class L1GctCand { + public: + L1GctCand(); - virtual ~L1GctCand(); + virtual ~L1GctCand(); - /// access origin of candidate - virtual L1CaloRegionDetId regionId() const = 0; + /// access origin of candidate + virtual L1CaloRegionDetId regionId() const = 0; - /// empty candidate - true if object not initialized - virtual bool empty() const = 0; + /// empty candidate - true if object not initialized + virtual bool empty() const = 0; - /// \brief get the rank code (6 bits) - /// - /// Note that the precise meaning of the bits returned by this method - /// (ie. the Et scale) may differ depending on the concrete type - virtual unsigned rank() const = 0; + /// \brief get the rank code (6 bits) + /// + /// Note that the precise meaning of the bits returned by this method + /// (ie. the Et scale) may differ depending on the concrete type + virtual unsigned rank() const = 0; - /// get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z) - virtual unsigned etaIndex() const = 0; + /// get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z) + virtual unsigned etaIndex() const = 0; - /// get eta sign bit (1 for -ve Z, 0 for +ve Z) - virtual unsigned etaSign() const = 0; + /// get eta sign bit (1 for -ve Z, 0 for +ve Z) + virtual unsigned etaSign() const = 0; - /// get phi index (0-17) - virtual unsigned phiIndex() const = 0; + /// get phi index (0-17) + virtual unsigned phiIndex() const = 0; -private: - /// dummy data member to make derived classes perstistable - bool dummy_; -}; + private: + /// dummy data member to make derived classes perstistable + bool dummy_; + }; +} // namespace io_v1 +using L1GctCand = io_v1::L1GctCand; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctCandFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctCandFwd.h new file mode 100644 index 0000000000000..c4e895a612f6f --- /dev/null +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctCandFwd.h @@ -0,0 +1,9 @@ +#ifndef DataFormats_L1GlobalCaloTrigger_L1GctCandFwd_h +#define DataFormats_L1GlobalCaloTrigger_L1GctCandFwd_h + +namespace io_v1 { + class L1GctCand; +} +using L1GctCand = io_v1::L1GctCand; + +#endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCand.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCand.h index 6d968d43f8ac2..3a096378ca636 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCand.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCand.h @@ -18,87 +18,89 @@ * \date June 2006 */ -class L1GctEmCand : public L1GctCand { -public: - /// default constructor (for vector initialisation etc.) - L1GctEmCand(); +namespace io_v1 { + class L1GctEmCand : public L1GctCand { + public: + /// default constructor (for vector initialisation etc.) + L1GctEmCand(); - /// construct from raw data, no source - used in GT - L1GctEmCand(uint16_t rawData, bool iso); + /// construct from raw data, no source - used in GT + L1GctEmCand(uint16_t rawData, bool iso); - /// construct from raw data with source - used in GCT unpacker - L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx); + /// construct from raw data with source - used in GCT unpacker + L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx); - /// construct from rank, eta, phi, isolation - used in GCT emulator - /// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z - L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso); + /// construct from rank, eta, phi, isolation - used in GCT emulator + /// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso); - /// construct from rank, eta, phi, isolation - could be used in GCT emulator? - /// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z - L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx); + /// construct from rank, eta, phi, isolation - could be used in GCT emulator? + /// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx); - /// construct from RCT output candidate - L1GctEmCand(L1CaloEmCand& c); + /// construct from RCT output candidate + L1GctEmCand(L1CaloEmCand& c); - /// destructor (virtual to prevent compiler warnings) - ~L1GctEmCand() override; + /// destructor (virtual to prevent compiler warnings) + ~L1GctEmCand() override; - /// region associated with the candidate - L1CaloRegionDetId regionId() const override; + /// region associated with the candidate + L1CaloRegionDetId regionId() const override; - /// name of object - std::string name() const; + /// name of object + std::string name() const; - /// was an object really found? - bool empty() const override { return (rank() == 0); } + /// was an object really found? + bool empty() const override { return (rank() == 0); } - /// get the raw data - uint16_t raw() const { return m_data; } + /// get the raw data + uint16_t raw() const { return m_data; } - /// get rank bits - unsigned rank() const override { return m_data & 0x3f; } + /// get rank bits + unsigned rank() const override { return m_data & 0x3f; } - /// get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z) - unsigned etaIndex() const override { return (m_data >> 6) & 0xf; } + /// get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z) + unsigned etaIndex() const override { return (m_data >> 6) & 0xf; } - /// get eta sign (1 for -ve Z, 0 for +ve Z) - unsigned etaSign() const override { return (m_data >> 9) & 0x1; } + /// get eta sign (1 for -ve Z, 0 for +ve Z) + unsigned etaSign() const override { return (m_data >> 9) & 0x1; } - /// get phi index (0-17) - unsigned phiIndex() const override { return (m_data >> 10) & 0x1f; } + /// get phi index (0-17) + unsigned phiIndex() const override { return (m_data >> 10) & 0x1f; } - /// which stream did this come from - bool isolated() const { return m_iso; } + /// which stream did this come from + bool isolated() const { return m_iso; } - /// which capture block did this come from - unsigned capBlock() const { return m_captureBlock; } + /// which capture block did this come from + unsigned capBlock() const { return m_captureBlock; } - /// what index within capture block - unsigned capIndex() const { return m_captureIndex; } + /// what index within capture block + unsigned capIndex() const { return m_captureIndex; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// equality operator - int operator==(const L1GctEmCand& c) const { - return ((m_data == c.raw() && m_iso == c.isolated()) || (this->empty() && c.empty())); - } + /// equality operator + int operator==(const L1GctEmCand& c) const { + return ((m_data == c.raw() && m_iso == c.isolated()) || (this->empty() && c.empty())); + } - /// inequality operator - int operator!=(const L1GctEmCand& c) const { return !(*this == c); } + /// inequality operator + int operator!=(const L1GctEmCand& c) const { return !(*this == c); } -private: - // set internal data from rank and region ieta, iphi - void construct(unsigned rank, unsigned eta, unsigned phi); + private: + // set internal data from rank and region ieta, iphi + void construct(unsigned rank, unsigned eta, unsigned phi); -private: - uint16_t m_data; - bool m_iso; - uint16_t m_captureBlock; - uint8_t m_captureIndex; - int16_t m_bx; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctEmCand& cand); + private: + uint16_t m_data; + bool m_iso; + uint16_t m_captureBlock; + uint8_t m_captureIndex; + int16_t m_bx; + }; + std::ostream& operator<<(std::ostream& s, const L1GctEmCand& cand); +} // namespace io_v1 +using L1GctEmCand = io_v1::L1GctEmCand; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCandFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCandFwd.h index 2e319031f3b92..c09e8d95dc77b 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCandFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCandFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctEmCandFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctEmCandFwd_h -class L1GctEmCand; - +namespace io_v1 { + class L1GctEmCand; +} +using L1GctEmCand = io_v1::L1GctEmCand; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h index 4ba0a0923f647..80f8d8f8134e4 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h @@ -14,52 +14,54 @@ /// \class L1GctEtHad /// \brief Persistable copy of total Ht measured at Level-1 -class L1GctEtHad { -public: - enum numberOfBits { - kEtHadNBits = 12, - kEtHadOFlowBit = 1 << kEtHadNBits, - kEtHadMaxValue = kEtHadOFlowBit - 1, - kRawCtorMask = kEtHadOFlowBit | kEtHadMaxValue +namespace io_v1 { + class L1GctEtHad { + public: + enum numberOfBits { + kEtHadNBits = 12, + kEtHadOFlowBit = 1 << kEtHadNBits, + kEtHadMaxValue = kEtHadOFlowBit - 1, + kRawCtorMask = kEtHadOFlowBit | kEtHadMaxValue + }; + + L1GctEtHad(); + L1GctEtHad(uint16_t rawData); + L1GctEtHad(uint16_t rawData, int16_t bx); + L1GctEtHad(unsigned et, bool oflow); + L1GctEtHad(unsigned et, bool oflow, int16_t bx); + virtual ~L1GctEtHad(); + + /// name method + std::string name() const { return "EtHad"; } + + /// empty method (= false; hadronic Et is always calculated) + bool empty() const { return false; } + + /// get the data + uint16_t raw() const { return m_data; } + + /// get the Et + unsigned et() const { return m_data & kEtHadMaxValue; } + + /// get the overflow + bool overFlow() const { return (m_data & kEtHadOFlowBit) != 0; } + + /// get bunch-crossing index + int16_t bx() const { return m_bx; } + + /// equality operator + int operator==(const L1GctEtHad& e) const { return m_data == e.raw(); } + + /// inequality operator + int operator!=(const L1GctEtHad& e) const { return m_data != e.raw(); } + + private: + uint16_t m_data; + int16_t m_bx; }; - L1GctEtHad(); - L1GctEtHad(uint16_t rawData); - L1GctEtHad(uint16_t rawData, int16_t bx); - L1GctEtHad(unsigned et, bool oflow); - L1GctEtHad(unsigned et, bool oflow, int16_t bx); - virtual ~L1GctEtHad(); - - /// name method - std::string name() const { return "EtHad"; } - - /// empty method (= false; hadronic Et is always calculated) - bool empty() const { return false; } - - /// get the data - uint16_t raw() const { return m_data; } - - /// get the Et - unsigned et() const { return m_data & kEtHadMaxValue; } - - /// get the overflow - bool overFlow() const { return (m_data & kEtHadOFlowBit) != 0; } - - /// get bunch-crossing index - int16_t bx() const { return m_bx; } - - /// equality operator - int operator==(const L1GctEtHad& e) const { return m_data == e.raw(); } - - /// inequality operator - int operator!=(const L1GctEtHad& e) const { return m_data != e.raw(); } - -private: - uint16_t m_data; - int16_t m_bx; -}; - -/// Pretty-print operator for L1GctEtHad -std::ostream& operator<<(std::ostream& s, const L1GctEtHad& c); - + /// Pretty-print operator for L1GctEtHad + std::ostream& operator<<(std::ostream& s, const L1GctEtHad& c); +} // namespace io_v1 +using L1GctEtHad = io_v1::L1GctEtHad; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHadFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHadFwd.h index 83e0e374d6010..4c31e76f63a7c 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHadFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHadFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctEtHadFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctEtHadFwd_h -class L1GctEtHad; +namespace io_v1 { + class L1GctEtHad; +} +using L1GctEtHad = io_v1::L1GctEtHad; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h index 453ae9227635b..73b3a0aeb687f 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h @@ -14,68 +14,70 @@ /// \class L1GctEtMiss /// \brief Persistable copy of missing Et measured at Level-1 -class L1GctEtMiss { -public: - /*! To match the RAW format, EtMiss is on bits 11:0, Overflow flag on bit 12, +namespace io_v1 { + class L1GctEtMiss { + public: + /*! To match the RAW format, EtMiss is on bits 11:0, Overflow flag on bit 12, * and Phi is on bits 22:16. All other bits will be be zero. */ - enum numberOfBits { - kEtMissNBits = 12, - kEtMissOFlowBit = 1 << kEtMissNBits, - kEtMissMaxValue = kEtMissOFlowBit - 1, - kEtMissPhiShift = 16, - kEtMissPhiNBits = 7, - kETMissPhiMask = (1 << kEtMissPhiNBits) - 1, - kEtMissPhiNBins = 72, - kRawCtorMask = (kETMissPhiMask << kEtMissPhiShift) | kEtMissOFlowBit | kEtMissMaxValue - }; - - L1GctEtMiss(); + enum numberOfBits { + kEtMissNBits = 12, + kEtMissOFlowBit = 1 << kEtMissNBits, + kEtMissMaxValue = kEtMissOFlowBit - 1, + kEtMissPhiShift = 16, + kEtMissPhiNBits = 7, + kETMissPhiMask = (1 << kEtMissPhiNBits) - 1, + kEtMissPhiNBins = 72, + kRawCtorMask = (kETMissPhiMask << kEtMissPhiShift) | kEtMissOFlowBit | kEtMissMaxValue + }; - /// For use with raw data from the unpacker. - L1GctEtMiss(uint32_t rawData); + L1GctEtMiss(); - /// For use with raw data from the unpacker. - L1GctEtMiss(uint32_t rawData, int16_t bx); + /// For use with raw data from the unpacker. + L1GctEtMiss(uint32_t rawData); - L1GctEtMiss(unsigned et, unsigned phi, bool oflow); + /// For use with raw data from the unpacker. + L1GctEtMiss(uint32_t rawData, int16_t bx); - L1GctEtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx); + L1GctEtMiss(unsigned et, unsigned phi, bool oflow); - virtual ~L1GctEtMiss(); + L1GctEtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx); - /// name method - std::string name() const { return "EtMiss"; } + virtual ~L1GctEtMiss(); - /// empty method (= false; missing Et is always calculated) - bool empty() const { return false; } + /// name method + std::string name() const { return "EtMiss"; } - /// get the data - uint32_t raw() const { return m_data; } + /// empty method (= false; missing Et is always calculated) + bool empty() const { return false; } - /// get the magnitude - unsigned et() const { return m_data & kEtMissMaxValue; } + /// get the data + uint32_t raw() const { return m_data; } - /// get the overflow - bool overFlow() const { return (m_data & kEtMissOFlowBit) != 0; } + /// get the magnitude + unsigned et() const { return m_data & kEtMissMaxValue; } - /// get the Et - unsigned phi() const { return (m_data >> kEtMissPhiShift) & kETMissPhiMask; } + /// get the overflow + bool overFlow() const { return (m_data & kEtMissOFlowBit) != 0; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get the Et + unsigned phi() const { return (m_data >> kEtMissPhiShift) & kETMissPhiMask; } - /// equality operator - int operator==(const L1GctEtMiss& e) const { return m_data == e.raw(); } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// inequality operator - int operator!=(const L1GctEtMiss& e) const { return m_data != e.raw(); } + /// equality operator + int operator==(const L1GctEtMiss& e) const { return m_data == e.raw(); } -private: - uint32_t m_data; - int16_t m_bx; -}; + /// inequality operator + int operator!=(const L1GctEtMiss& e) const { return m_data != e.raw(); } -/// Pretty-print operator for L1GctEtMiss -std::ostream& operator<<(std::ostream& s, const L1GctEtMiss& c); + private: + uint32_t m_data; + int16_t m_bx; + }; + /// Pretty-print operator for L1GctEtMiss + std::ostream& operator<<(std::ostream& s, const L1GctEtMiss& c); +} // namespace io_v1 +using L1GctEtMiss = io_v1::L1GctEtMiss; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMissFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMissFwd.h index 7a46512e05d89..1a0b9208b3754 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMissFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMissFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctEtMissFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctEtMissFwd_h -class L1GctEtMiss; - +namespace io_v1 { + class L1GctEtMiss; +} +using L1GctEtMiss = io_v1::L1GctEtMiss; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h index 359b43fe77e6f..732fc28e4437d 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h @@ -14,52 +14,54 @@ /// \class L1GctEtTotal /// \brief Persistable copy of total Et measured at Level-1 -class L1GctEtTotal { -public: - enum numberOfBits { - kEtTotalNBits = 12, - kEtTotalOFlowBit = 1 << kEtTotalNBits, - kEtTotalMaxValue = kEtTotalOFlowBit - 1, - kRawCtorMask = kEtTotalOFlowBit | kEtTotalMaxValue +namespace io_v1 { + class L1GctEtTotal { + public: + enum numberOfBits { + kEtTotalNBits = 12, + kEtTotalOFlowBit = 1 << kEtTotalNBits, + kEtTotalMaxValue = kEtTotalOFlowBit - 1, + kRawCtorMask = kEtTotalOFlowBit | kEtTotalMaxValue + }; + + L1GctEtTotal(); + L1GctEtTotal(uint16_t rawData); + L1GctEtTotal(uint16_t rawData, int16_t bx); + L1GctEtTotal(unsigned et, bool oflow); + L1GctEtTotal(unsigned et, bool oflow, int16_t bx); + virtual ~L1GctEtTotal(); + + /// name method + std::string name() const { return "EtTotal"; } + + /// empty method (= false; total Et is always calculated) + bool empty() const { return false; } + + /// get the data + uint16_t raw() const { return m_data; } + + /// get the Et + unsigned et() const { return m_data & kEtTotalMaxValue; } + + /// get the overflow + bool overFlow() const { return (m_data & kEtTotalOFlowBit) != 0; } + + /// get bunch-crossing index + int16_t bx() const { return m_bx; } + + /// equality operator + int operator==(const L1GctEtTotal& e) const { return m_data == e.raw(); } + + /// inequality operator + int operator!=(const L1GctEtTotal& e) const { return m_data != e.raw(); } + + private: + uint16_t m_data; + int16_t m_bx; }; - L1GctEtTotal(); - L1GctEtTotal(uint16_t rawData); - L1GctEtTotal(uint16_t rawData, int16_t bx); - L1GctEtTotal(unsigned et, bool oflow); - L1GctEtTotal(unsigned et, bool oflow, int16_t bx); - virtual ~L1GctEtTotal(); - - /// name method - std::string name() const { return "EtTotal"; } - - /// empty method (= false; total Et is always calculated) - bool empty() const { return false; } - - /// get the data - uint16_t raw() const { return m_data; } - - /// get the Et - unsigned et() const { return m_data & kEtTotalMaxValue; } - - /// get the overflow - bool overFlow() const { return (m_data & kEtTotalOFlowBit) != 0; } - - /// get bunch-crossing index - int16_t bx() const { return m_bx; } - - /// equality operator - int operator==(const L1GctEtTotal& e) const { return m_data == e.raw(); } - - /// inequality operator - int operator!=(const L1GctEtTotal& e) const { return m_data != e.raw(); } - -private: - uint16_t m_data; - int16_t m_bx; -}; - -/// Pretty-print operator for L1GctEtTotal -std::ostream& operator<<(std::ostream& s, const L1GctEtTotal& c); - + /// Pretty-print operator for L1GctEtTotal + std::ostream& operator<<(std::ostream& s, const L1GctEtTotal& c); +} // namespace io_v1 +using L1GctEtTotal = io_v1::L1GctEtTotal; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotalFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotalFwd.h index 973231adf6e76..72c518e18fc78 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotalFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotalFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctEtTotalFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctEtTotalFwd_h -class L1GctEtTotal; - +namespace io_v1 { + class L1GctEtTotal; +} +using L1GctEtTotal = io_v1::L1GctEtTotal; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctFibreWord.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctFibreWord.h index 5d3ddfa2963b3..cb9fb134337af 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctFibreWord.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctFibreWord.h @@ -14,23 +14,25 @@ * \date July 2007 */ -class L1GctFibreWord { -public: - L1GctFibreWord(); - L1GctFibreWord(uint32_t data, uint16_t block, uint16_t index, int16_t bx); - - uint32_t data() const { return data_; } - uint16_t block() const { return block_; } - uint16_t index() const { return index_; } - int16_t bx() const { return bx_; } - -private: - uint32_t data_; - uint16_t block_; - uint16_t index_; - int16_t bx_; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctFibreWord& fw); - +namespace io_v1 { + class L1GctFibreWord { + public: + L1GctFibreWord(); + L1GctFibreWord(uint32_t data, uint16_t block, uint16_t index, int16_t bx); + + uint32_t data() const { return data_; } + uint16_t block() const { return block_; } + uint16_t index() const { return index_; } + int16_t bx() const { return bx_; } + + private: + uint32_t data_; + uint16_t block_; + uint16_t index_; + int16_t bx_; + }; + + std::ostream& operator<<(std::ostream& s, const L1GctFibreWord& fw); +} // namespace io_v1 +using L1GctFibreWord = io_v1::L1GctFibreWord; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCounts.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCounts.h index 781e819147aa4..1989f0de54efe 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCounts.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCounts.h @@ -13,99 +13,101 @@ /// Will store four Et sums of 3 bits each /// -class L1GctHFBitCounts { -public: - static const unsigned N_SUMS = 4; +namespace io_v1 { + class L1GctHFBitCounts { + public: + static const unsigned N_SUMS = 4; -public: - /// default constructor (for vector initialisation etc.) - L1GctHFBitCounts(); + public: + /// default constructor (for vector initialisation etc.) + L1GctHFBitCounts(); - /// destructor - ~L1GctHFBitCounts(); + /// destructor + ~L1GctHFBitCounts(); - /// named ctor for unpacker - /// note this expects a 32 bit word that also contains the - /// HF ring Et sums, which are ignored - static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); + /// named ctor for unpacker + /// note this expects a 32 bit word that also contains the + /// HF ring Et sums, which are ignored + static L1GctHFBitCounts fromConcHFBitCounts(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); - /// named ctor for GCT emulator - static L1GctHFBitCounts fromGctEmulator(const int16_t bx, - const uint16_t bitCountPosEtaRing1, - const uint16_t bitCountNegEtaRing1, - const uint16_t bitCountPosEtaRing2, - const uint16_t bitCountNegEtaRing2); + /// named ctor for GCT emulator + static L1GctHFBitCounts fromGctEmulator(const int16_t bx, + const uint16_t bitCountPosEtaRing1, + const uint16_t bitCountNegEtaRing1, + const uint16_t bitCountPosEtaRing2, + const uint16_t bitCountNegEtaRing2); - // optional named ctor for GT if required - // arguments to be defined - // static L1GctHFBitCounts fromGtPsb() + // optional named ctor for GT if required + // arguments to be defined + // static L1GctHFBitCounts fromGtPsb() - // getters + // getters - // get number of ring sums - static unsigned nCounts() { return N_SUMS; } + // get number of ring sums + static unsigned nCounts() { return N_SUMS; } - /// get GCT unpacker capture block - uint16_t capBlock() const { return capBlock_; } + /// get GCT unpacker capture block + uint16_t capBlock() const { return capBlock_; } - /// get index within GCT unpacker capture block - uint16_t capIndex() const { return capIndex_; } + /// get index within GCT unpacker capture block + uint16_t capIndex() const { return capIndex_; } - /// get BX number - int16_t bx() const { return bx_; } + /// get BX number + int16_t bx() const { return bx_; } - /// is the sum non-zero - bool empty() const { return (data_ == 0); } + /// is the sum non-zero + bool empty() const { return (data_ == 0); } - /// the raw data - uint16_t raw() const { return data_; } + /// the raw data + uint16_t raw() const { return data_; } - /// get a bit count - /// index : sum - /// 0 : Ring 1 Positive Rapidity HF bit count - /// 1 : Ring 1 Negative Rapidity HF bit count - /// 2 : Ring 2 Positive Rapidity HF bit count - /// 3 : Ring 2 Negative Rapidity HF bit count - uint16_t bitCount(unsigned const i) const; + /// get a bit count + /// index : sum + /// 0 : Ring 1 Positive Rapidity HF bit count + /// 1 : Ring 1 Negative Rapidity HF bit count + /// 2 : Ring 2 Positive Rapidity HF bit count + /// 3 : Ring 2 Negative Rapidity HF bit count + uint16_t bitCount(unsigned const i) const; - // setters + // setters - /// set cap block - void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } + /// set cap block + void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } - /// set cap index - void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } + /// set cap index + void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } - /// set bx - void setBx(int16_t bx) { bx_ = bx; } + /// set bx + void setBx(int16_t bx) { bx_ = bx; } - /// set a sum - void setBitCount(unsigned i, uint16_t c); + /// set a sum + void setBitCount(unsigned i, uint16_t c); - /// set the raw data - void setData(uint32_t data) { data_ = data; } + /// set the raw data + void setData(uint32_t data) { data_ = data; } - /// operators + /// operators - /// equality operator - bool operator==(const L1GctHFBitCounts& c) const; + /// equality operator + bool operator==(const L1GctHFBitCounts& c) const; - /// inequality operator - bool operator!=(const L1GctHFBitCounts& c) const { return !(*this == c); } + /// inequality operator + bool operator!=(const L1GctHFBitCounts& c) const { return !(*this == c); } -private: - // source of the data - uint16_t capBlock_; - uint16_t capIndex_; - int16_t bx_; + private: + // source of the data + uint16_t capBlock_; + uint16_t capIndex_; + int16_t bx_; - // the captured data - uint16_t data_; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand); + // the captured data + uint16_t data_; + }; + std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand); +} // namespace io_v1 +using L1GctHFBitCounts = io_v1::L1GctHFBitCounts; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCountsFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCountsFwd.h index 4929260606674..95742bc724a5e 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCountsFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCountsFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctHFBitCountsFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctHFBitCountsFwd_h -class L1GctHFBitCounts; - +namespace io_v1 { + class L1GctHFBitCounts; +} +using L1GctHFBitCounts = io_v1::L1GctHFBitCounts; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h index c6860f88397c3..d4b4aca72d1ca 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSums.h @@ -13,99 +13,101 @@ /// Will store four Et sums of 3 bits each /// -class L1GctHFRingEtSums { -public: - static const unsigned N_SUMS = 4; +namespace io_v1 { + class L1GctHFRingEtSums { + public: + static const unsigned N_SUMS = 4; -public: - /// default constructor (for vector initialisation etc.) - L1GctHFRingEtSums(); + public: + /// default constructor (for vector initialisation etc.) + L1GctHFRingEtSums(); - /// destructor - ~L1GctHFRingEtSums(); + /// destructor + ~L1GctHFRingEtSums(); - /// named ctor for unpacker - /// note that this expects a 32 bit word that also contains - /// the HF bit counts, which are ignored - static L1GctHFRingEtSums fromConcRingSums(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); + /// named ctor for unpacker + /// note that this expects a 32 bit word that also contains + /// the HF bit counts, which are ignored + static L1GctHFRingEtSums fromConcRingSums(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); - /// named ctor for GCT emulator - static L1GctHFRingEtSums fromGctEmulator(const int16_t bx, - const uint16_t etSumPosEtaRing1, - const uint16_t etSumNegEtaRing1, - const uint16_t etSumPosEtaRing2, - const uint16_t etSumNegEtaRing2); + /// named ctor for GCT emulator + static L1GctHFRingEtSums fromGctEmulator(const int16_t bx, + const uint16_t etSumPosEtaRing1, + const uint16_t etSumNegEtaRing1, + const uint16_t etSumPosEtaRing2, + const uint16_t etSumNegEtaRing2); - // optional named ctor for GT if required - // arguments to be defined - // static L1GctHfRingEtSums fromGtPsb() + // optional named ctor for GT if required + // arguments to be defined + // static L1GctHfRingEtSums fromGtPsb() - // get number of ring sums - static unsigned nSums() { return N_SUMS; } + // get number of ring sums + static unsigned nSums() { return N_SUMS; } - // getters + // getters - /// get GCT unpacker capture block - uint16_t capBlock() const { return capBlock_; } + /// get GCT unpacker capture block + uint16_t capBlock() const { return capBlock_; } - /// get index within GCT unpacker capture block - uint16_t capIndex() const { return capIndex_; } + /// get index within GCT unpacker capture block + uint16_t capIndex() const { return capIndex_; } - /// get BX number - int16_t bx() const { return bx_; } + /// get BX number + int16_t bx() const { return bx_; } - /// is the sum non-zero - bool empty() const { return (data_ == 0); } + /// is the sum non-zero + bool empty() const { return (data_ == 0); } - /// get the raw data - uint16_t raw() const { return data_; } + /// get the raw data + uint16_t raw() const { return data_; } - /// get an Et sum - /// index : sum - /// 0 : Ring 1 Positive Rapidity HF Et sum - /// 1 : Ring 1 Negative Rapidity HF Et sum - /// 2 : Ring 2 Positive Rapidity HF Et sum - /// 3 : Ring 2 Negative Rapidity HF Et sum - uint16_t etSum(unsigned const i) const; + /// get an Et sum + /// index : sum + /// 0 : Ring 1 Positive Rapidity HF Et sum + /// 1 : Ring 1 Negative Rapidity HF Et sum + /// 2 : Ring 2 Positive Rapidity HF Et sum + /// 3 : Ring 2 Negative Rapidity HF Et sum + uint16_t etSum(unsigned const i) const; - // setters + // setters - /// set cap block - void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } + /// set cap block + void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } - /// set cap index - void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } + /// set cap index + void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } - /// set bx - void setBx(uint16_t bx) { bx_ = bx; } + /// set bx + void setBx(uint16_t bx) { bx_ = bx; } - /// set a sum - void setEtSum(unsigned i, uint16_t et); + /// set a sum + void setEtSum(unsigned i, uint16_t et); - /// set the raw data - void setData(uint32_t data) { data_ = data; } + /// set the raw data + void setData(uint32_t data) { data_ = data; } - /// operators + /// operators - /// equality operator - bool operator==(const L1GctHFRingEtSums& c) const; + /// equality operator + bool operator==(const L1GctHFRingEtSums& c) const; - /// inequality operator - bool operator!=(const L1GctHFRingEtSums& c) const { return !(*this == c); } + /// inequality operator + bool operator!=(const L1GctHFRingEtSums& c) const { return !(*this == c); } -private: - // source of the data - uint16_t capBlock_; - uint16_t capIndex_; - int16_t bx_; + private: + // source of the data + uint16_t capBlock_; + uint16_t capIndex_; + int16_t bx_; - // the captured data - uint16_t data_; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand); + // the captured data + uint16_t data_; + }; + std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand); +} // namespace io_v1 +using L1GctHFRingEtSums = io_v1::L1GctHFRingEtSums; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSumsFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSumsFwd.h index e00f55cffe780..1b8c4bbd365da 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSumsFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSumsFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctHFRingEtSumsFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctHFRingEtSumsFwd_h -class L1GctHFRingEtSums; - +namespace io_v1 { + class L1GctHFRingEtSums; +} +using L1GctHFRingEtSums = io_v1::L1GctHFRingEtSums; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMiss.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMiss.h index 3aabfb1ee02d7..e10ad275b8a66 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMiss.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMiss.h @@ -13,72 +13,74 @@ /// \class L1GctHtMiss /// \brief Persistable copy of missing Et measured at Level-1 -class L1GctHtMiss { -public: - /*! To match the RAW format: +namespace io_v1 { + class L1GctHtMiss { + public: + /*! To match the RAW format: * HtMissPhi is on bits 4:0, * HtMissMagnitude is on bits 11:5, * Overflow flag on bit 12, * All other bits will be be zero. */ - enum numberOfBits { - kHtMissPhiNBits = 5, - kHtMissMagNBits = 7, - kHtMissPhiMask = (1 << kHtMissPhiNBits) - 1, - kHtMissMagMask = (1 << kHtMissMagNBits) - 1, - kHtMissPhiShift = 0, - kHtMissMagShift = kHtMissPhiNBits, - kHtMissOFlowBit = (1 << (kHtMissPhiNBits + kHtMissMagNBits)), - kHtMissPhiNBins = 18, - kRawCtorMask = kHtMissOFlowBit | (kHtMissMagMask << kHtMissMagShift) | (kHtMissPhiMask << kHtMissPhiShift) - }; - - L1GctHtMiss(); + enum numberOfBits { + kHtMissPhiNBits = 5, + kHtMissMagNBits = 7, + kHtMissPhiMask = (1 << kHtMissPhiNBits) - 1, + kHtMissMagMask = (1 << kHtMissMagNBits) - 1, + kHtMissPhiShift = 0, + kHtMissMagShift = kHtMissPhiNBits, + kHtMissOFlowBit = (1 << (kHtMissPhiNBits + kHtMissMagNBits)), + kHtMissPhiNBins = 18, + kRawCtorMask = kHtMissOFlowBit | (kHtMissMagMask << kHtMissMagShift) | (kHtMissPhiMask << kHtMissPhiShift) + }; - /// For use with raw data from the unpacker. - L1GctHtMiss(uint32_t rawData); + L1GctHtMiss(); - /// For use with raw data from the unpacker. - L1GctHtMiss(uint32_t rawData, int16_t bx); + /// For use with raw data from the unpacker. + L1GctHtMiss(uint32_t rawData); - L1GctHtMiss(unsigned et, unsigned phi, bool oflow); + /// For use with raw data from the unpacker. + L1GctHtMiss(uint32_t rawData, int16_t bx); - L1GctHtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx); + L1GctHtMiss(unsigned et, unsigned phi, bool oflow); - virtual ~L1GctHtMiss(); + L1GctHtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx); - /// name method - std::string name() const { return "HtMiss"; } + virtual ~L1GctHtMiss(); - /// empty method (= false; missing Et is always calculated) - bool empty() const { return false; } + /// name method + std::string name() const { return "HtMiss"; } - /// get the data - uint32_t raw() const { return m_data; } + /// empty method (= false; missing Et is always calculated) + bool empty() const { return false; } - /// get the magnitude - unsigned et() const { return (m_data >> kHtMissMagShift) & kHtMissMagMask; } + /// get the data + uint32_t raw() const { return m_data; } - /// get the overflow - bool overFlow() const { return (m_data & kHtMissOFlowBit) != 0; } + /// get the magnitude + unsigned et() const { return (m_data >> kHtMissMagShift) & kHtMissMagMask; } - /// get the Et - unsigned phi() const { return (m_data >> kHtMissPhiShift) & kHtMissPhiMask; } + /// get the overflow + bool overFlow() const { return (m_data & kHtMissOFlowBit) != 0; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get the Et + unsigned phi() const { return (m_data >> kHtMissPhiShift) & kHtMissPhiMask; } - /// equality operator - int operator==(const L1GctHtMiss& e) const { return m_data == e.raw(); } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// inequality operator - int operator!=(const L1GctHtMiss& e) const { return !(*this == e); } + /// equality operator + int operator==(const L1GctHtMiss& e) const { return m_data == e.raw(); } -private: - uint32_t m_data; - int16_t m_bx; -}; + /// inequality operator + int operator!=(const L1GctHtMiss& e) const { return !(*this == e); } -/// Pretty-print operator for L1GctHtMiss -std::ostream& operator<<(std::ostream& s, const L1GctHtMiss& c); + private: + uint32_t m_data; + int16_t m_bx; + }; + /// Pretty-print operator for L1GctHtMiss + std::ostream& operator<<(std::ostream& s, const L1GctHtMiss& c); +} // namespace io_v1 +using L1GctHtMiss = io_v1::L1GctHtMiss; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMissFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMissFwd.h index d5671397d4ac8..2b1f79f11d56a 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMissFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMissFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctHtMissFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctHtMissFwd_h -class L1GctHtMiss; - +namespace io_v1 { + class L1GctHtMiss; +} +using L1GctHtMiss = io_v1::L1GctHtMiss; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEmCand.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEmCand.h index 96e3de2c0ab10..381e0bf365faa 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEmCand.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEmCand.h @@ -15,79 +15,87 @@ * \date June 2006 */ -class L1GctInternEmCand { //: public L1GctCand { -public: - /// default constructor (for vector initialisation etc.) - L1GctInternEmCand(); +namespace io_v1 { + class L1GctInternEmCand { //: public L1GctCand { + public: + /// default constructor (for vector initialisation etc.) + L1GctInternEmCand(); - /// construct from raw data - L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx); + /// construct from raw data + L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx); - // construct from eta, phi etc - L1GctInternEmCand( - unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi, bool iso, unsigned block, unsigned index, int16_t bx); + // construct from eta, phi etc + L1GctInternEmCand(unsigned rank, + unsigned eta, + unsigned etaSgn, + unsigned phi, + bool iso, + unsigned block, + unsigned index, + int16_t bx); - /// destructor (virtual to prevent compiler warnings) - virtual ~L1GctInternEmCand(); + /// destructor (virtual to prevent compiler warnings) + virtual ~L1GctInternEmCand(); - /// region associated with the candidate - L1CaloRegionDetId regionId() const; + /// region associated with the candidate + L1CaloRegionDetId regionId() const; - /// name of object - std::string name() const; + /// name of object + std::string name() const; - /// was an object really found? - bool empty() const; + /// was an object really found? + bool empty() const; - /// get the raw data - uint16_t raw() const { return m_data; } + /// get the raw data + uint16_t raw() const { return m_data; } - /// get rank bits - unsigned rank() const { return m_data & 0x3f; } + /// get rank bits + unsigned rank() const { return m_data & 0x3f; } - /// get eta index - Barrel 1:4, Endcap 5:7, HF 8:11 - unsigned etaIndex() const { return (m_data >> 6) & 0x1f; } + /// get eta index - Barrel 1:4, Endcap 5:7, HF 8:11 + unsigned etaIndex() const { return (m_data >> 6) & 0x1f; } - /// get eta sign (1 for -ve Z, 0 for +ve Z) - unsigned etaSign() const { return (m_data >> 10) & 0x1; } + /// get eta sign (1 for -ve Z, 0 for +ve Z) + unsigned etaSign() const { return (m_data >> 10) & 0x1; } - /// get phi index (0-17) - unsigned phiIndex() const { return (m_data >> 11) & 0x1f; } + /// get phi index (0-17) + unsigned phiIndex() const { return (m_data >> 11) & 0x1f; } - /// which stream did this come from - bool isolated() const { return m_iso; } + /// which stream did this come from + bool isolated() const { return m_iso; } - /// which capture block did this come from - unsigned capBlock() const { return m_captureBlock; } + /// which capture block did this come from + unsigned capBlock() const { return m_captureBlock; } - /// what index within capture block - unsigned capIndex() const { return m_captureIndex; } + /// what index within capture block + unsigned capIndex() const { return m_captureIndex; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// equality operator - int operator==(const L1GctInternEmCand& c) const { - return ((m_data == c.raw() && m_iso == c.isolated()) || (this->empty() && c.empty())); - } + /// equality operator + int operator==(const L1GctInternEmCand& c) const { + return ((m_data == c.raw() && m_iso == c.isolated()) || (this->empty() && c.empty())); + } - /// inequality operator - int operator!=(const L1GctInternEmCand& c) const { - return ((m_data != c.raw() || m_iso != c.isolated()) && (!this->empty() || !c.empty())); - } + /// inequality operator + int operator!=(const L1GctInternEmCand& c) const { + return ((m_data != c.raw() || m_iso != c.isolated()) && (!this->empty() || !c.empty())); + } -private: - // set internal data from rank and region ieta, iphi - void construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi); + private: + // set internal data from rank and region ieta, iphi + void construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi); -private: - uint16_t m_data; - uint16_t m_captureBlock; - uint8_t m_captureIndex; - bool m_iso; - int16_t m_bx; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctInternEmCand& cand); + private: + uint16_t m_data; + uint16_t m_captureBlock; + uint8_t m_captureIndex; + bool m_iso; + int16_t m_bx; + }; + std::ostream& operator<<(std::ostream& s, const L1GctInternEmCand& cand); +} // namespace io_v1 +using L1GctInternEmCand = io_v1::L1GctInternEmCand; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h index af184b35b0061..05685ace41a12 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h @@ -11,144 +11,146 @@ /// \date June 2008 /// -class L1GctInternEtSum { -public: - /// et sum type - not clear this is required - enum L1GctInternEtSumType { - null, - jet_tot_et, // from jet_tot_et_and_ht in leaf output - jet_tot_ht, // from jet_tot_et_and_ht in leaf output - jet_miss_et, // leaf output - total_et_or_ht, // conc input, wheel input and output - miss_etx_or_ety // conc input, wheel input and output - }; - - enum numberOfBits { - kTotEtOrHtNBits = 12, - kJetMissEtNBits = 17, - kMissExOrEyNBits = 20, - kTotEtOrHtOFlowBit = 1 << kTotEtOrHtNBits, - kJetMissEtOFlowBit = 1 << kJetMissEtNBits, - kMissExOrEyOFlowBit = 1 << kMissExOrEyNBits, - kTotEtOrHtMaxValue = kTotEtOrHtOFlowBit - 1, - kJetMissEtMaxValue = kJetMissEtOFlowBit - 1, - kMissExOrEyMaxValue = kMissExOrEyOFlowBit - 1, - kTotEtOrHtRawCtorMask = kTotEtOrHtOFlowBit | kTotEtOrHtMaxValue, - kJetMissEtRawCtorMask = kJetMissEtOFlowBit | kJetMissEtMaxValue, - kMissExOrEyRawCtorMask = kMissExOrEyOFlowBit | kMissExOrEyMaxValue - }; +namespace io_v1 { + class L1GctInternEtSum { + public: + /// et sum type - not clear this is required + enum L1GctInternEtSumType { + null, + jet_tot_et, // from jet_tot_et_and_ht in leaf output + jet_tot_ht, // from jet_tot_et_and_ht in leaf output + jet_miss_et, // leaf output + total_et_or_ht, // conc input, wheel input and output + miss_etx_or_ety // conc input, wheel input and output + }; - /// default constructor (for vector initialisation etc.) - L1GctInternEtSum(); + enum numberOfBits { + kTotEtOrHtNBits = 12, + kJetMissEtNBits = 17, + kMissExOrEyNBits = 20, + kTotEtOrHtOFlowBit = 1 << kTotEtOrHtNBits, + kJetMissEtOFlowBit = 1 << kJetMissEtNBits, + kMissExOrEyOFlowBit = 1 << kMissExOrEyNBits, + kTotEtOrHtMaxValue = kTotEtOrHtOFlowBit - 1, + kJetMissEtMaxValue = kJetMissEtOFlowBit - 1, + kMissExOrEyMaxValue = kMissExOrEyOFlowBit - 1, + kTotEtOrHtRawCtorMask = kTotEtOrHtOFlowBit | kTotEtOrHtMaxValue, + kJetMissEtRawCtorMask = kJetMissEtOFlowBit | kJetMissEtMaxValue, + kMissExOrEyRawCtorMask = kMissExOrEyOFlowBit | kMissExOrEyMaxValue + }; - /// construct from individual quantities - L1GctInternEtSum(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t et, uint8_t oflow); + /// default constructor (for vector initialisation etc.) + L1GctInternEtSum(); - /// destructor - ~L1GctInternEtSum(); + /// construct from individual quantities + L1GctInternEtSum(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t et, uint8_t oflow); - // named ctors - static L1GctInternEtSum fromJetTotEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + /// destructor + ~L1GctInternEtSum(); - static L1GctInternEtSum fromJetTotHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + // named ctors + static L1GctInternEtSum fromJetTotEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - static L1GctInternEtSum fromJetMissEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + static L1GctInternEtSum fromJetTotHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + static L1GctInternEtSum fromJetMissEt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + static L1GctInternEtSum fromTotalEtOrHt(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx); + static L1GctInternEtSum fromMissEtxOrEty(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx); + static L1GctInternEtSum fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx); - static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx); + static L1GctInternEtSum fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx); - static L1GctInternEtSum fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx); + static L1GctInternEtSum fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx); - static L1GctInternEtSum fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx); + static L1GctInternEtSum fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx); - /// metadata + static L1GctInternEtSum fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx); - /// 'type' of object - not required? - L1GctInternEtSum::L1GctInternEtSumType type() const { return type_; } + /// metadata - /// get capture block - uint16_t capBlock() const { return capBlock_; } + /// 'type' of object - not required? + L1GctInternEtSum::L1GctInternEtSumType type() const { return type_; } - /// get index within capture block - uint16_t capIndex() const { return capIndex_; } + /// get capture block + uint16_t capBlock() const { return capBlock_; } - /// get BX number - int16_t bx() const { return bx_; } + /// get index within capture block + uint16_t capIndex() const { return capIndex_; } - /// is the sum non-zero - bool empty() const { return (data_ == 0); } + /// get BX number + int16_t bx() const { return bx_; } - /// get the actual bits + /// is the sum non-zero + bool empty() const { return (data_ == 0); } - /// get the raw data - uint32_t raw() const { return data_; } + /// get the actual bits - /// get value - uint32_t value() const { return data_ & 0x7fffffff; } + /// get the raw data + uint32_t raw() const { return data_; } - /// get et - uint32_t et() const { return value(); } + /// get value + uint32_t value() const { return data_ & 0x7fffffff; } - /// get count - uint32_t count() const { return value(); } + /// get et + uint32_t et() const { return value(); } - /// get oflow - uint8_t oflow() const { return (data_ >> 31) & 0x1; } + /// get count + uint32_t count() const { return value(); } - // setters + /// get oflow + uint8_t oflow() const { return (data_ >> 31) & 0x1; } - /// set cap block - void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } + // setters - /// set cap index - void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } + /// set cap block + void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } - /// set bx - void setBx(uint16_t bx) { bx_ = bx; } + /// set cap index + void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } - /// set type - void setType(L1GctInternEtSumType type) { type_ = type; } + /// set bx + void setBx(uint16_t bx) { bx_ = bx; } - /// set value - void setValue(uint32_t val); + /// set type + void setType(L1GctInternEtSumType type) { type_ = type; } - /// set Et sum - void setEt(uint32_t et); + /// set value + void setValue(uint32_t val); - /// set count - void setCount(uint32_t count); + /// set Et sum + void setEt(uint32_t et); - /// set overflow bit - void setOflow(uint8_t oflow); + /// set count + void setCount(uint32_t count); - /// operators + /// set overflow bit + void setOflow(uint8_t oflow); - /// equality operator - bool operator==(const L1GctInternEtSum& c) const; + /// operators - /// inequality operator - bool operator!=(const L1GctInternEtSum& c) const { return !(*this == c); } + /// equality operator + bool operator==(const L1GctInternEtSum& c) const; -private: - // type of data - L1GctInternEtSumType type_; + /// inequality operator + bool operator!=(const L1GctInternEtSum& c) const { return !(*this == c); } - // source of the data - uint16_t capBlock_; - uint16_t capIndex_; - int16_t bx_; + private: + // type of data + L1GctInternEtSumType type_; - // the captured data - uint32_t data_; -}; + // source of the data + uint16_t capBlock_; + uint16_t capIndex_; + int16_t bx_; -std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c); + // the captured data + uint32_t data_; + }; + std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c); +} // namespace io_v1 +using L1GctInternEtSum = io_v1::L1GctInternEtSum; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHFData.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHFData.h index b8c17f64e3858..5e9bff0030580 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHFData.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHFData.h @@ -13,123 +13,125 @@ /// Will store 4 sums/counts of up to 8 bits each /// -class L1GctInternHFData { -public: - /// et sum type - not clear this is required - enum L1GctInternHFDataType { - null, - conc_hf_ring_et_sums, - conc_hf_bit_counts, - wheel_hf_ring_et_sums, - wheel_hf_bit_counts - }; - - /// default constructor (for vector initialisation etc.) - L1GctInternHFData(); - - /// destructor - ~L1GctInternHFData(); - - static L1GctInternHFData fromConcRingSums(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - static L1GctInternHFData fromConcBitCounts(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock, +namespace io_v1 { + class L1GctInternHFData { + public: + /// et sum type - not clear this is required + enum L1GctInternHFDataType { + null, + conc_hf_ring_et_sums, + conc_hf_bit_counts, + wheel_hf_ring_et_sums, + wheel_hf_bit_counts + }; + + /// default constructor (for vector initialisation etc.) + L1GctInternHFData(); + + /// destructor + ~L1GctInternHFData(); + + static L1GctInternHFData fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data); - /// metadata + static L1GctInternHFData fromConcBitCounts(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); + + static L1GctInternHFData fromWheelRingSums(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); - /// 'type' of object - L1GctInternHFData::L1GctInternHFDataType type() const { return type_; } + static L1GctInternHFData fromWheelBitCounts(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); - /// get capture block - uint16_t capBlock() const { return capBlock_; } + /// metadata - /// get index within capture block - uint16_t capIndex() const { return capIndex_; } + /// 'type' of object + L1GctInternHFData::L1GctInternHFDataType type() const { return type_; } - /// get BX number - int16_t bx() const { return bx_; } + /// get capture block + uint16_t capBlock() const { return capBlock_; } - /// is the sum non-zero - bool empty() const { return (data_ == 0); } + /// get index within capture block + uint16_t capIndex() const { return capIndex_; } - /// get the actual data + /// get BX number + int16_t bx() const { return bx_; } - /// is this ring sums or bit counts? - bool isRingSums() const { return (type_ == conc_hf_ring_et_sums || type_ == wheel_hf_ring_et_sums); } + /// is the sum non-zero + bool empty() const { return (data_ == 0); } - /// get the raw data - uint32_t raw() const { return data_; } + /// get the actual data - /// get value - uint16_t value(unsigned i) const; + /// is this ring sums or bit counts? + bool isRingSums() const { return (type_ == conc_hf_ring_et_sums || type_ == wheel_hf_ring_et_sums); } - /// get the et sums - uint16_t et(unsigned i) const; + /// get the raw data + uint32_t raw() const { return data_; } - /// get the counts - uint16_t count(unsigned i) const; + /// get value + uint16_t value(unsigned i) const; - // setters + /// get the et sums + uint16_t et(unsigned i) const; - /// set cap block - void setCapBlock(uint16_t const capBlock) { capBlock_ = capBlock; } + /// get the counts + uint16_t count(unsigned i) const; - /// set cap index - void setCapIndex(uint16_t const capIndex) { capIndex_ = capIndex; } + // setters - /// set bx - void setBx(int16_t const bx) { bx_ = bx; } + /// set cap block + void setCapBlock(uint16_t const capBlock) { capBlock_ = capBlock; } - /// set type - void setType(L1GctInternHFDataType type) { type_ = type; } + /// set cap index + void setCapIndex(uint16_t const capIndex) { capIndex_ = capIndex; } - /// set value - void setValue(unsigned const i, uint16_t const val); + /// set bx + void setBx(int16_t const bx) { bx_ = bx; } - /// set the sum - void setEt(unsigned const i, uint16_t const et); + /// set type + void setType(L1GctInternHFDataType type) { type_ = type; } - /// set the count - void setCount(unsigned const i, uint16_t const count); + /// set value + void setValue(unsigned const i, uint16_t const val); - void setData(uint32_t const data) { data_ = data; } + /// set the sum + void setEt(unsigned const i, uint16_t const et); - /// operators + /// set the count + void setCount(unsigned const i, uint16_t const count); - /// equality operator - bool operator==(const L1GctInternHFData& c) const; + void setData(uint32_t const data) { data_ = data; } - /// inequality operator - bool operator!=(const L1GctInternHFData& c) const { return !(*this == c); } + /// operators -private: - // type of data - L1GctInternHFDataType type_; + /// equality operator + bool operator==(const L1GctInternHFData& c) const; - // source of the data - uint16_t capBlock_; - uint16_t capIndex_; - int16_t bx_; + /// inequality operator + bool operator!=(const L1GctInternHFData& c) const { return !(*this == c); } - // the captured data - uint32_t data_; -}; + private: + // type of data + L1GctInternHFDataType type_; -std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand); + // source of the data + uint16_t capBlock_; + uint16_t capIndex_; + int16_t bx_; + + // the captured data + uint32_t data_; + }; + std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand); +} // namespace io_v1 +using L1GctInternHFData = io_v1::L1GctInternHFData; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHtMiss.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHtMiss.h index 8311ff73c89a4..ca534f2ed510c 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHtMiss.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHtMiss.h @@ -13,147 +13,151 @@ #include #include -class L1GctInternHtMiss { -public: - /// Enum for the variants of Internal HtMiss. - enum L1GctInternHtMissType { nulltype, miss_htx, miss_hty, miss_htx_and_hty, jf_miss_htx_and_hty }; - - enum numberOfBits { - // TODO - tidy up all these enums. - // These numbers of bits are needed to specify data sizes in the emulator - // Other masks are below in the private section. - kJetMissHtNBits = 12, - kMissHxAndHyNBits = 14, - kMissHxOrHyNBits = 16 - }; - - /// default constructor (for vector initialisation etc.) - L1GctInternHtMiss(); - - /// destructor - ~L1GctInternHtMiss(); - - /* Named Constructors */ - - /// Named ctor for making missing Ht x-component object from unpacker raw data. - static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - /// Named ctor for making missing Ht y-component object from unpacker raw data. - static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - /// Named ctor for making missing Ht x & y components object from unpacker raw data (wheel input). - static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - /// Named ctor for making missing Ht x & y components object from emulator (jetFinder output). - static L1GctInternHtMiss emulatorJetMissHt(const int htx, const int hty, const bool overFlow, const int16_t bx); - - /// Named ctor for making missing Ht x & y components object from emulator (wheel input). - static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx); - - /// Named ctor for making missing Ht x component object from emulator - static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx); - - /// Named ctor for making missing Ht y component object from emulator - static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx); - - /* Metadata */ +namespace io_v1 { + class L1GctInternHtMiss { + public: + /// Enum for the variants of Internal HtMiss. + enum L1GctInternHtMissType { nulltype, miss_htx, miss_hty, miss_htx_and_hty, jf_miss_htx_and_hty }; - /// 'type' of object? - L1GctInternHtMiss::L1GctInternHtMissType type() const { return type_; } + enum numberOfBits { + // TODO - tidy up all these enums. + // These numbers of bits are needed to specify data sizes in the emulator + // Other masks are below in the private section. + kJetMissHtNBits = 12, + kMissHxAndHyNBits = 14, + kMissHxOrHyNBits = 16 + }; - /// Get capture block - uint16_t capBlock() const { return capBlock_; } + /// default constructor (for vector initialisation etc.) + L1GctInternHtMiss(); - /// Get index within capture block - uint16_t capIndex() const { return capIndex_; } + /// destructor + ~L1GctInternHtMiss(); + + /* Named Constructors */ + + /// Named ctor for making missing Ht x-component object from unpacker raw data. + static L1GctInternHtMiss unpackerMissHtx(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); + + /// Named ctor for making missing Ht y-component object from unpacker raw data. + static L1GctInternHtMiss unpackerMissHty(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); - /// Get BX number - int16_t bx() const { return bx_; } + /// Named ctor for making missing Ht x & y components object from unpacker raw data (wheel input). + static L1GctInternHtMiss unpackerMissHtxHty(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); + + /// Named ctor for making missing Ht x & y components object from emulator (jetFinder output). + static L1GctInternHtMiss emulatorJetMissHt(const int htx, const int hty, const bool overFlow, const int16_t bx); + + /// Named ctor for making missing Ht x & y components object from emulator (wheel input). + static L1GctInternHtMiss emulatorMissHtxHty(const int htx, const int hty, const bool overFlow, const int16_t bx); + + /// Named ctor for making missing Ht x component object from emulator + static L1GctInternHtMiss emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx); + + /// Named ctor for making missing Ht y component object from emulator + static L1GctInternHtMiss emulatorMissHty(const int hty, const bool overFlow, const int16_t bx); + + /* Metadata */ + + /// 'type' of object? + L1GctInternHtMiss::L1GctInternHtMissType type() const { return type_; } + + /// Get capture block + uint16_t capBlock() const { return capBlock_; } + + /// Get index within capture block + uint16_t capIndex() const { return capIndex_; } + + /// Get BX number + int16_t bx() const { return bx_; } + + /// Is there a valid Ht x-component stored? + bool isThereHtx() const { + return (type() == miss_htx || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty); + } + + /// Is there a valid Ht y-component stored? + bool isThereHty() const { + return (type() == miss_hty || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty); + } + + /* Access to the actual data */ + + /// Get the raw data + uint32_t raw() const { return data_; } + + /// Get Ht x-component value + int16_t htx() const; + + /// Get Ht y-component + int16_t hty() const; + + /// Get overflow + bool overflow() const; + + /* Operators */ + + /// Equality operator + bool operator==(const L1GctInternHtMiss& rhs) const { return (type() == rhs.type() && raw() == rhs.raw()); } + + /// Inequality operator + bool operator!=(const L1GctInternHtMiss& rhs) const { return !(*this == rhs); } + + private: + /// Useful bit masks and bit shifts + enum ShiftsAndMasks { + kDoubleComponentHtyShift = 16, // Bit shift for Hty in miss_htx_and_hty + kSingleComponentOflowMask = (1 << 30), // Overflow bit mask in miss_htx or miss_hty + kDoubleComponentOflowMask = (1 << 15), // Overflow bit mask in miss_htx_and_hty + kSingleComponentHtMask = 0xffff, // Ht component mask in miss_htx or miss_hty + kDoubleComponentHtMask = 0x3fff, // Ht component mask in miss_htx_and_hty + kJetFinderComponentHtMask = 0x0fff, // Ht component mask in jf_miss_htx_and_hty + kSingleComponentRawMask = + kSingleComponentOflowMask | + kSingleComponentHtMask, // To mask off all the non-data bits in raw data (e.g. BC0, etc) + kDoubleComponentRawMask = + (kDoubleComponentHtMask << kDoubleComponentHtyShift) | kDoubleComponentOflowMask | kDoubleComponentHtMask + }; - /// Is there a valid Ht x-component stored? - bool isThereHtx() const { - return (type() == miss_htx || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty); - } + /* Private ctors and methods */ - /// Is there a valid Ht y-component stored? - bool isThereHty() const { - return (type() == miss_hty || type() == miss_htx_and_hty || type() == jf_miss_htx_and_hty); - } + /// Private constructor that the named ctors use. + L1GctInternHtMiss(const L1GctInternHtMissType type, + const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data); - /* Access to the actual data */ + /// Converts 14-bit two's complement numbers to 16-bit two's complement (i.e. an int16_t) + /*! The input is the raw bits of the 14-bit two's complement in a 16-bit unsigned number. */ + int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const; - /// Get the raw data - uint32_t raw() const { return data_; } + /* Private data */ - /// Get Ht x-component value - int16_t htx() const; + /// 'Type' of the data + L1GctInternHtMissType type_; - /// Get Ht y-component - int16_t hty() const; + // source of the data + uint16_t capBlock_; + uint16_t capIndex_; + int16_t bx_; - /// Get overflow - bool overflow() const; - - /* Operators */ - - /// Equality operator - bool operator==(const L1GctInternHtMiss& rhs) const { return (type() == rhs.type() && raw() == rhs.raw()); } - - /// Inequality operator - bool operator!=(const L1GctInternHtMiss& rhs) const { return !(*this == rhs); } - -private: - /// Useful bit masks and bit shifts - enum ShiftsAndMasks { - kDoubleComponentHtyShift = 16, // Bit shift for Hty in miss_htx_and_hty - kSingleComponentOflowMask = (1 << 30), // Overflow bit mask in miss_htx or miss_hty - kDoubleComponentOflowMask = (1 << 15), // Overflow bit mask in miss_htx_and_hty - kSingleComponentHtMask = 0xffff, // Ht component mask in miss_htx or miss_hty - kDoubleComponentHtMask = 0x3fff, // Ht component mask in miss_htx_and_hty - kJetFinderComponentHtMask = 0x0fff, // Ht component mask in jf_miss_htx_and_hty - kSingleComponentRawMask = kSingleComponentOflowMask | - kSingleComponentHtMask, // To mask off all the non-data bits in raw data (e.g. BC0, etc) - kDoubleComponentRawMask = - (kDoubleComponentHtMask << kDoubleComponentHtyShift) | kDoubleComponentOflowMask | kDoubleComponentHtMask + /// The captured raw data + uint32_t data_; }; - /* Private ctors and methods */ - - /// Private constructor that the named ctors use. - L1GctInternHtMiss(const L1GctInternHtMissType type, - const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data); - - /// Converts 14-bit two's complement numbers to 16-bit two's complement (i.e. an int16_t) - /*! The input is the raw bits of the 14-bit two's complement in a 16-bit unsigned number. */ - int16_t convert14BitTwosCompTo16Bit(const uint16_t data) const; - - /* Private data */ - - /// 'Type' of the data - L1GctInternHtMissType type_; - - // source of the data - uint16_t capBlock_; - uint16_t capIndex_; - int16_t bx_; - - /// The captured raw data - uint32_t data_; -}; - -// Pretty-print operator for L1GctInternHtMiss -std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs); + // Pretty-print operator for L1GctInternHtMiss + std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs); +} // namespace io_v1 +using L1GctInternHtMiss = io_v1::L1GctInternHtMiss; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h index 62c32ee218f4d..6609423f4455e 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h @@ -11,149 +11,151 @@ /// \date June 2006 /// -class L1GctInternJetData { -public: - enum L1GctInternJetType { null, emulator, jet_cluster, jet_cluster_minimal, jet_precluster, gct_trig_object }; +namespace io_v1 { + class L1GctInternJetData { + public: + enum L1GctInternJetType { null, emulator, jet_cluster, jet_cluster_minimal, jet_precluster, gct_trig_object }; -public: - /// default constructor (for vector initialisation etc.) - L1GctInternJetData(); + public: + /// default constructor (for vector initialisation etc.) + L1GctInternJetData(); - /// construct from individual quantities - L1GctInternJetData(L1CaloRegionDetId rgn, - uint16_t capBlock, - uint16_t capIndex, - int16_t bx, - uint8_t sgnEta, - uint8_t oflow, - uint16_t et, - uint8_t eta, - uint8_t phi, - uint8_t tauVeto, - uint8_t rank); + /// construct from individual quantities + L1GctInternJetData(L1CaloRegionDetId rgn, + uint16_t capBlock, + uint16_t capIndex, + int16_t bx, + uint8_t sgnEta, + uint8_t oflow, + uint16_t et, + uint8_t eta, + uint8_t phi, + uint8_t tauVeto, + uint8_t rank); - // 'named' constructors to avoid confusion + // 'named' constructors to avoid confusion - // emulator calibrated jet ctor - static L1GctInternJetData fromEmulator(L1CaloRegionDetId rgn, - int16_t bx, - uint16_t et, - bool overFlow, - bool tauVeto, - uint8_t eta, - uint8_t phi, - uint16_t rank); + // emulator calibrated jet ctor + static L1GctInternJetData fromEmulator(L1CaloRegionDetId rgn, + int16_t bx, + uint16_t et, + bool overFlow, + bool tauVeto, + uint8_t eta, + uint8_t phi, + uint16_t rank); - /// construct from "jet_cluster" - static L1GctInternJetData fromJetCluster( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + /// construct from "jet_cluster" + static L1GctInternJetData fromJetCluster( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - /// construct from "jet_precluster" - static L1GctInternJetData fromJetPreCluster( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + /// construct from "jet_precluster" + static L1GctInternJetData fromJetPreCluster( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - /// construct from "jet_cluster_minimal" - static L1GctInternJetData fromJetClusterMinimal( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + /// construct from "jet_cluster_minimal" + static L1GctInternJetData fromJetClusterMinimal( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - /// construct from "gct_trig_object" - static L1GctInternJetData fromGctTrigObject( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); + /// construct from "gct_trig_object" + static L1GctInternJetData fromGctTrigObject( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data); - /// destructor (virtual to prevent compiler warnings) - virtual ~L1GctInternJetData(); + /// destructor (virtual to prevent compiler warnings) + virtual ~L1GctInternJetData(); - // getters + // getters - /// 'type' of object - L1GctInternJetData::L1GctInternJetType type() const { return type_; } + /// 'type' of object + L1GctInternJetData::L1GctInternJetType type() const { return type_; } - /// region associated with the candidate - L1CaloRegionDetId regionId() const { return regionId_; } + /// region associated with the candidate + L1CaloRegionDetId regionId() const { return regionId_; } - /// was an object really found? - bool empty() const { return (data_ == 0); } + /// was an object really found? + bool empty() const { return (data_ == 0); } - /// get capture block - uint16_t capBlock() const { return capBlock_; } + /// get capture block + uint16_t capBlock() const { return capBlock_; } - /// get index within capture block - uint16_t capIndex() const { return capIndex_; } + /// get index within capture block + uint16_t capIndex() const { return capIndex_; } - /// get BX number - int16_t bx() const { return bx_; } + /// get BX number + int16_t bx() const { return bx_; } - /// get the raw data - uint32_t raw() const { return data_; } + /// get the raw data + uint32_t raw() const { return data_; } - /// get rank bits - uint16_t rank() const { return data_ & 0x3f; } + /// get rank bits + uint16_t rank() const { return data_ & 0x3f; } - /// get tau veto - uint16_t tauVeto() const { return (data_ >> 6) & 0x1; } + /// get tau veto + uint16_t tauVeto() const { return (data_ >> 6) & 0x1; } - /// get phi - uint16_t phi() const { return (data_ >> 7) & 0x1f; } + /// get phi + uint16_t phi() const { return (data_ >> 7) & 0x1f; } - /// get eta - uint16_t eta() const { return (data_ >> 12) & 0xf; } + /// get eta + uint16_t eta() const { return (data_ >> 12) & 0xf; } - /// get et - uint16_t et() const { return (data_ >> 16) & 0xfff; } + /// get et + uint16_t et() const { return (data_ >> 16) & 0xfff; } - /// get oflow - uint16_t oflow() const { return (data_ >> 28) & 0x1; } + /// get oflow + uint16_t oflow() const { return (data_ >> 28) & 0x1; } - /// get sign of eta - uint16_t sgnEta() const { return (data_ >> 29) & 0x1; } + /// get sign of eta + uint16_t sgnEta() const { return (data_ >> 29) & 0x1; } - // setters + // setters - /// set region - void setRegionId(L1CaloRegionDetId rgn) { regionId_ = rgn; } + /// set region + void setRegionId(L1CaloRegionDetId rgn) { regionId_ = rgn; } - /// set cap block - void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } + /// set cap block + void setCapBlock(uint16_t capBlock) { capBlock_ = capBlock; } - /// set cap index - void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } + /// set cap index + void setCapIndex(uint16_t capIndex) { capIndex_ = capIndex; } - /// set bx - void setBx(uint16_t bx) { bx_ = bx; } + /// set bx + void setBx(uint16_t bx) { bx_ = bx; } - /// set type - void setType(L1GctInternJetType type) { type_ = type; } + /// set type + void setType(L1GctInternJetType type) { type_ = type; } - /// set data - void setRawData(uint32_t data) { data_ = data; } + /// set data + void setRawData(uint32_t data) { data_ = data; } - /// construct data word from components - void setData(uint8_t sgnEta, uint8_t oflow, uint16_t et, uint8_t eta, uint8_t phi, uint8_t tauVeto, uint8_t rank); + /// construct data word from components + void setData(uint8_t sgnEta, uint8_t oflow, uint16_t et, uint8_t eta, uint8_t phi, uint8_t tauVeto, uint8_t rank); - // operators + // operators - /// equality operator - bool operator==(const L1GctInternJetData& c) const; + /// equality operator + bool operator==(const L1GctInternJetData& c) const; - /// inequality operator - bool operator!=(const L1GctInternJetData& c) const { return !(*this == c); } + /// inequality operator + bool operator!=(const L1GctInternJetData& c) const { return !(*this == c); } -private: - // location in calorimeter (optionally set by unpacker) - L1CaloRegionDetId regionId_; + private: + // location in calorimeter (optionally set by unpacker) + L1CaloRegionDetId regionId_; - // source of the data - uint16_t capBlock_; - uint16_t capIndex_; - int16_t bx_; + // source of the data + uint16_t capBlock_; + uint16_t capIndex_; + int16_t bx_; - // type of data - L1GctInternJetType type_; + // type of data + L1GctInternJetType type_; - // the captured data - uint32_t data_; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& cand); + // the captured data + uint32_t data_; + }; + std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& cand); +} // namespace io_v1 +using L1GctInternJetData = io_v1::L1GctInternJetData; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetDataFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetDataFwd.h index ba5fe35172e35..2668529b89cf7 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetDataFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetDataFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctInternJetDataFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctInternJetDataFwd_h -class L1GctInternJetData; - +namespace io_v1 { + class L1GctInternJetData; +} +using L1GctInternJetData = io_v1::L1GctInternJetData; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h index eeb3dac186a24..ccaeb6d66f095 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h @@ -14,88 +14,90 @@ /// \date June 2006 /// -class L1GctJetCand : public L1GctCand { -public: - /// default constructor (for vector initialisation etc.) - L1GctJetCand(); +namespace io_v1 { + class L1GctJetCand : public L1GctCand { + public: + /// default constructor (for vector initialisation etc.) + L1GctJetCand(); - /// construct from raw data - used in GT - L1GctJetCand(uint16_t rawData, bool isTau, bool isFor); + /// construct from raw data - used in GT + L1GctJetCand(uint16_t rawData, bool isTau, bool isFor); - /// construct from raw data with source - uesd in GCT unpacker - L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx); + /// construct from raw data with source - uesd in GCT unpacker + L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx); - /// construct from rank, eta, phi, isolation - used in GCT emulator - /// NB - eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z - L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor); + /// construct from rank, eta, phi, isolation - used in GCT emulator + /// NB - eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor); - /// construct from rank, eta, phi, isolation - will be used in GCT emulator? - /// NB - eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z - L1GctJetCand( - unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx); + /// construct from rank, eta, phi, isolation - will be used in GCT emulator? + /// NB - eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctJetCand( + unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx); - /// destructor (virtual to prevent compiler warnings) - ~L1GctJetCand() override; + /// destructor (virtual to prevent compiler warnings) + ~L1GctJetCand() override; - /// region associated with the candidate - L1CaloRegionDetId regionId() const override; + /// region associated with the candidate + L1CaloRegionDetId regionId() const override; - /// name of object - std::string name() const; + /// name of object + std::string name() const; - /// was an object really found? - bool empty() const override { return (rank() == 0); } + /// was an object really found? + bool empty() const override { return (rank() == 0); } - /// get the raw data - uint16_t raw() const { return m_data; } + /// get the raw data + uint16_t raw() const { return m_data; } - /// get rank bits - unsigned rank() const override { return m_data & 0x3f; } + /// get rank bits + unsigned rank() const override { return m_data & 0x3f; } - /// get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z) - unsigned etaIndex() const override { return (m_data >> 6) & 0xf; } + /// get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z) + unsigned etaIndex() const override { return (m_data >> 6) & 0xf; } - /// get eta sign bit (1 for -ve Z, 0 for +ve Z) - unsigned etaSign() const override { return (m_data >> 9) & 0x1; } + /// get eta sign bit (1 for -ve Z, 0 for +ve Z) + unsigned etaSign() const override { return (m_data >> 9) & 0x1; } - /// get phi index (0-17) - unsigned phiIndex() const override { return (m_data >> 10) & 0x1f; } + /// get phi index (0-17) + unsigned phiIndex() const override { return (m_data >> 10) & 0x1f; } - /// check if this is a central jet - bool isCentral() const { return (!m_isTau) && (!m_isFor); } + /// check if this is a central jet + bool isCentral() const { return (!m_isTau) && (!m_isFor); } - /// check if this is a tau - bool isTau() const { return m_isTau; } + /// check if this is a tau + bool isTau() const { return m_isTau; } - /// check if this is a forward jet - bool isForward() const { return m_isFor; } + /// check if this is a forward jet + bool isForward() const { return m_isFor; } - /// which capture block did this come from - unsigned capBlock() const { return m_captureBlock; } + /// which capture block did this come from + unsigned capBlock() const { return m_captureBlock; } - /// what index within capture block - unsigned capIndex() const { return m_captureIndex; } + /// what index within capture block + unsigned capIndex() const { return m_captureIndex; } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// equality operator - int operator==(const L1GctJetCand& c) const { - return ((m_data == c.raw() && m_isTau == c.isTau() && m_isFor == c.isForward()) || (this->empty() && c.empty())); - } + /// equality operator + int operator==(const L1GctJetCand& c) const { + return ((m_data == c.raw() && m_isTau == c.isTau() && m_isFor == c.isForward()) || (this->empty() && c.empty())); + } - /// inequality operator - int operator!=(const L1GctJetCand& c) const { return !(*this == c); } + /// inequality operator + int operator!=(const L1GctJetCand& c) const { return !(*this == c); } -private: - uint16_t m_data; - bool m_isTau; - bool m_isFor; - uint16_t m_captureBlock; - uint8_t m_captureIndex; - int16_t m_bx; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctJetCand& cand); + private: + uint16_t m_data; + bool m_isTau; + bool m_isFor; + uint16_t m_captureBlock; + uint8_t m_captureIndex; + int16_t m_bx; + }; + std::ostream& operator<<(std::ostream& s, const L1GctJetCand& cand); +} // namespace io_v1 +using L1GctJetCand = io_v1::L1GctJetCand; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCandFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCandFwd.h index 0eb93262c9536..125cf1952d44b 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCandFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCandFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctJetCandFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctJetCandFwd_h -class L1GctJetCand; - +namespace io_v1 { + class L1GctJetCand; +} +using L1GctJetCand = io_v1::L1GctJetCand; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCounts.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCounts.h index 639177793b138..18d3034771af0 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCounts.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCounts.h @@ -13,79 +13,81 @@ /// Class to store the GCT jet count output /// -class L1GctJetCounts { -public: - /// static maximum number of jet counts - /// This can be up to 12 but we use some of the - /// available bandwidth for other information. - static const unsigned MAX_TOTAL_COUNTS; - static const unsigned MAX_TRUE_COUNTS; - - /// default constructor - L1GctJetCounts(); - - /// Constructor for unpacking. - /*! Expects three 5-bit jet counts in bits 14:0, and then +namespace io_v1 { + class L1GctJetCounts { + public: + /// static maximum number of jet counts + /// This can be up to 12 but we use some of the + /// available bandwidth for other information. + static const unsigned MAX_TOTAL_COUNTS; + static const unsigned MAX_TRUE_COUNTS; + + /// default constructor + L1GctJetCounts(); + + /// Constructor for unpacking. + /*! Expects three 5-bit jet counts in bits 14:0, and then * three more 5-bit jet counts in bits 30:16 for both of * the arguments; this is because in the raw format bit * 31 is a BC0 flag, and bit 15 is always 1. Thus, jet * count 0 should be in bits 4:0 of the data0 argument. */ - L1GctJetCounts(uint32_t data0, uint32_t data1); + L1GctJetCounts(uint32_t data0, uint32_t data1); - L1GctJetCounts(uint32_t data0, uint32_t data1, int16_t bx); + L1GctJetCounts(uint32_t data0, uint32_t data1, int16_t bx); - /// constructor for emulator - L1GctJetCounts(const std::vector& counts); + /// constructor for emulator + L1GctJetCounts(const std::vector& counts); - L1GctJetCounts(const std::vector& counts, int16_t bx); + L1GctJetCounts(const std::vector& counts, int16_t bx); - /// destructor - virtual ~L1GctJetCounts(); + /// destructor + virtual ~L1GctJetCounts(); - /// name method - std::string name() const { return "JetCounts"; } + /// name method + std::string name() const { return "JetCounts"; } - /// empty method - bool empty() const { return false; } + /// empty method + bool empty() const { return false; } - /// get raw word 0 - uint32_t raw0() const { return m_data0; } + /// get raw word 0 + uint32_t raw0() const { return m_data0; } - /// get raw word 1 - uint32_t raw1() const { return m_data1; } + /// get raw word 1 + uint32_t raw1() const { return m_data1; } - /// get count by index - unsigned count(unsigned i) const; + /// get count by index + unsigned count(unsigned i) const; - /// get individual counts (for use with FWLite) - unsigned count00() const { return (MAX_TRUE_COUNTS < 1 ? 0 : count(0)); } - unsigned count01() const { return (MAX_TRUE_COUNTS < 2 ? 0 : count(1)); } - unsigned count02() const { return (MAX_TRUE_COUNTS < 3 ? 0 : count(2)); } - unsigned count03() const { return (MAX_TRUE_COUNTS < 4 ? 0 : count(3)); } - unsigned count04() const { return (MAX_TRUE_COUNTS < 5 ? 0 : count(4)); } - unsigned count05() const { return (MAX_TRUE_COUNTS < 6 ? 0 : count(5)); } - unsigned count06() const { return (MAX_TRUE_COUNTS < 7 ? 0 : count(6)); } - unsigned count07() const { return (MAX_TRUE_COUNTS < 8 ? 0 : count(7)); } - unsigned count08() const { return (MAX_TRUE_COUNTS < 9 ? 0 : count(8)); } - unsigned count09() const { return (MAX_TRUE_COUNTS < 10 ? 0 : count(9)); } - unsigned count10() const { return (MAX_TRUE_COUNTS < 11 ? 0 : count(10)); } - unsigned count11() const { return (MAX_TRUE_COUNTS < 12 ? 0 : count(11)); } + /// get individual counts (for use with FWLite) + unsigned count00() const { return (MAX_TRUE_COUNTS < 1 ? 0 : count(0)); } + unsigned count01() const { return (MAX_TRUE_COUNTS < 2 ? 0 : count(1)); } + unsigned count02() const { return (MAX_TRUE_COUNTS < 3 ? 0 : count(2)); } + unsigned count03() const { return (MAX_TRUE_COUNTS < 4 ? 0 : count(3)); } + unsigned count04() const { return (MAX_TRUE_COUNTS < 5 ? 0 : count(4)); } + unsigned count05() const { return (MAX_TRUE_COUNTS < 6 ? 0 : count(5)); } + unsigned count06() const { return (MAX_TRUE_COUNTS < 7 ? 0 : count(6)); } + unsigned count07() const { return (MAX_TRUE_COUNTS < 8 ? 0 : count(7)); } + unsigned count08() const { return (MAX_TRUE_COUNTS < 9 ? 0 : count(8)); } + unsigned count09() const { return (MAX_TRUE_COUNTS < 10 ? 0 : count(9)); } + unsigned count10() const { return (MAX_TRUE_COUNTS < 11 ? 0 : count(10)); } + unsigned count11() const { return (MAX_TRUE_COUNTS < 12 ? 0 : count(11)); } - /// get bunch-crossing index - int16_t bx() const { return m_bx; } + /// get bunch-crossing index + int16_t bx() const { return m_bx; } - /// equality operator - int operator==(const L1GctJetCounts& c) const { return (m_data0 == c.raw0() && m_data1 == c.raw1()); } + /// equality operator + int operator==(const L1GctJetCounts& c) const { return (m_data0 == c.raw0() && m_data1 == c.raw1()); } - /// inequality operator - int operator!=(const L1GctJetCounts& c) const { return !(*this == c); } + /// inequality operator + int operator!=(const L1GctJetCounts& c) const { return !(*this == c); } -private: - uint32_t m_data0; - uint32_t m_data1; - int16_t m_bx; -}; - -std::ostream& operator<<(std::ostream& s, const L1GctJetCounts& c); + private: + uint32_t m_data0; + uint32_t m_data1; + int16_t m_bx; + }; + std::ostream& operator<<(std::ostream& s, const L1GctJetCounts& c); +} // namespace io_v1 +using L1GctJetCounts = io_v1::L1GctJetCounts; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCountsFwd.h b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCountsFwd.h index d61fd862cf355..e41c6800fad24 100644 --- a/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCountsFwd.h +++ b/DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCountsFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalCaloTrigger_L1GctJetCountsFwd_h #define DataFormats_L1GlobalCaloTrigger_L1GctJetCountsFwd_h -class L1GctJetCounts; - +namespace io_v1 { + class L1GctJetCounts; +} +using L1GctJetCounts = io_v1::L1GctJetCounts; #endif diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctEmCand.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctEmCand.cc index a13a1c0ef53a8..130e556ca25df 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctEmCand.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctEmCand.cc @@ -7,94 +7,97 @@ using std::hex; using std::ostream; using std::string; -// default constructor -L1GctEmCand::L1GctEmCand() : m_data(0), m_iso(false), m_captureBlock(0), m_captureIndex(0), m_bx(0) {} +namespace io_v1 { + // default constructor + L1GctEmCand::L1GctEmCand() : m_data(0), m_iso(false), m_captureBlock(0), m_captureIndex(0), m_bx(0) {} -// construct from raw data, no source (i.e. no capBlock/capIndex); used in GT -L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso) - : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored - m_iso(iso), - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) {} + // construct from raw data, no source (i.e. no capBlock/capIndex); used in GT + L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso) + : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored + m_iso(iso), + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) {} -// construct from raw data with source - used in GCT unpacker -L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx) - : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored - m_iso(iso), - m_captureBlock(block & 0xfff), - m_captureIndex(index & 0xff), - m_bx(bx) {} + // construct from raw data with source - used in GCT unpacker + L1GctEmCand::L1GctEmCand(uint16_t rawData, bool iso, uint16_t block, uint16_t index, int16_t bx) + : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored + m_iso(iso), + m_captureBlock(block & 0xfff), + m_captureIndex(index & 0xff), + m_bx(bx) {} -// construct from content - used in GCT emulator -// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z -L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso) - : m_data(0), // override below - m_iso(iso), - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) + // construct from content - used in GCT emulator + // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso) + : m_data(0), // override below + m_iso(iso), + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) -{ - construct(rank, eta, phi); -} + { + construct(rank, eta, phi); + } -// construct from content, with source (i.e. capBlock/capIndex); will be used in GCT emulator one day? -// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z -L1GctEmCand::L1GctEmCand(unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx) - : m_data(0), // override below - m_iso(iso), - m_captureBlock(block & 0xfff), - m_captureIndex(index & 0xff), - m_bx(bx) { - construct(rank, eta, phi); -} + // construct from content, with source (i.e. capBlock/capIndex); will be used in GCT emulator one day? + // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctEmCand::L1GctEmCand( + unsigned rank, unsigned phi, unsigned eta, bool iso, uint16_t block, uint16_t index, int16_t bx) + : m_data(0), // override below + m_iso(iso), + m_captureBlock(block & 0xfff), + m_captureIndex(index & 0xff), + m_bx(bx) { + construct(rank, eta, phi); + } -// construct from RCT output candidate -L1GctEmCand::L1GctEmCand(L1CaloEmCand& c) - : m_data(0), // override below - m_iso(c.isolated()), - m_captureBlock(0), - m_captureIndex(0), - m_bx(c.bx()) { - unsigned eta = ((c.regionId().rctEta() & 0x7) | (c.regionId().ieta() < 11 ? 0x8 : 0x0)); - construct(c.rank(), eta, c.regionId().iphi()); -} + // construct from RCT output candidate + L1GctEmCand::L1GctEmCand(L1CaloEmCand& c) + : m_data(0), // override below + m_iso(c.isolated()), + m_captureBlock(0), + m_captureIndex(0), + m_bx(c.bx()) { + unsigned eta = ((c.regionId().rctEta() & 0x7) | (c.regionId().ieta() < 11 ? 0x8 : 0x0)); + construct(c.rank(), eta, c.regionId().iphi()); + } -// destructor -L1GctEmCand::~L1GctEmCand() {} + // destructor + L1GctEmCand::~L1GctEmCand() {} -// name of candidate type -string L1GctEmCand::name() const { return (isolated() ? "iso EM" : "non iso EM"); } + // name of candidate type + string L1GctEmCand::name() const { return (isolated() ? "iso EM" : "non iso EM"); } -// return region object -L1CaloRegionDetId L1GctEmCand::regionId() const { - // get global eta - unsigned eta = (etaSign() == 1 ? 10 - (etaIndex() & 0x7) : 11 + (etaIndex() & 0x7)); - return L1CaloRegionDetId(eta, phiIndex()); -} + // return region object + L1CaloRegionDetId L1GctEmCand::regionId() const { + // get global eta + unsigned eta = (etaSign() == 1 ? 10 - (etaIndex() & 0x7) : 11 + (etaIndex() & 0x7)); + return L1CaloRegionDetId(eta, phiIndex()); + } -// construct from rank, eta, phi -void L1GctEmCand::construct(unsigned rank, unsigned eta, unsigned phi) { - if (rank > 0) { - m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10); - } else { - // Default values for zero rank electrons, - // different in hardware for positive and negative eta - if ((eta & 0x8) == 0) { - m_data = 0x7000; + // construct from rank, eta, phi + void L1GctEmCand::construct(unsigned rank, unsigned eta, unsigned phi) { + if (rank > 0) { + m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10); } else { - m_data = 0x7400; + // Default values for zero rank electrons, + // different in hardware for positive and negative eta + if ((eta & 0x8) == 0) { + m_data = 0x7000; + } else { + m_data = 0x7400; + } } } -} -// pretty print -ostream& operator<<(ostream& s, const L1GctEmCand& cand) { - s << "L1GctEmCand : "; - s << "rank=" << cand.rank(); - s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0x7) << ", phi=" << cand.phiIndex(); - s << ", iso=" << cand.isolated(); - s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx(); - return s; -} + // pretty print + ostream& operator<<(ostream& s, const L1GctEmCand& cand) { + s << "L1GctEmCand : "; + s << "rank=" << cand.rank(); + s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0x7) << ", phi=" << cand.phiIndex(); + s << ", iso=" << cand.isolated(); + s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx(); + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctEtHad.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctEtHad.cc index ab96d946f3595..70037384722b9 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctEtHad.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctEtHad.cc @@ -1,28 +1,30 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtHad.h" -L1GctEtHad::L1GctEtHad() : m_data(0), m_bx(0) {} +namespace io_v1 { + L1GctEtHad::L1GctEtHad() : m_data(0), m_bx(0) {} -L1GctEtHad::L1GctEtHad(uint16_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} + L1GctEtHad::L1GctEtHad(uint16_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} -L1GctEtHad::L1GctEtHad(uint16_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} + L1GctEtHad::L1GctEtHad(uint16_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} -L1GctEtHad::L1GctEtHad(unsigned et, bool oflow) : m_data(0), m_bx(0) { - m_data = (et & kEtHadMaxValue) | ((oflow || et > kEtHadMaxValue) ? kEtHadOFlowBit : 0); -} + L1GctEtHad::L1GctEtHad(unsigned et, bool oflow) : m_data(0), m_bx(0) { + m_data = (et & kEtHadMaxValue) | ((oflow || et > kEtHadMaxValue) ? kEtHadOFlowBit : 0); + } -L1GctEtHad::L1GctEtHad(unsigned et, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { - m_data = (et & kEtHadMaxValue) | ((oflow || et > kEtHadMaxValue) ? kEtHadOFlowBit : 0); -} + L1GctEtHad::L1GctEtHad(unsigned et, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { + m_data = (et & kEtHadMaxValue) | ((oflow || et > kEtHadMaxValue) ? kEtHadOFlowBit : 0); + } -L1GctEtHad::~L1GctEtHad() {} + L1GctEtHad::~L1GctEtHad() {} -/// Pretty-print operator for L1GctEtHad -std::ostream& operator<<(std::ostream& s, const L1GctEtHad& c) { - s << " L1GctEtHad: "; - s << " ht=" << c.et(); - if (c.overFlow()) { - s << "; overflow set"; + /// Pretty-print operator for L1GctEtHad + std::ostream& operator<<(std::ostream& s, const L1GctEtHad& c) { + s << " L1GctEtHad: "; + s << " ht=" << c.et(); + if (c.overFlow()) { + s << "; overflow set"; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctEtMiss.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctEtMiss.cc index 9e431a78d5875..25abc5562ebe7 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctEtMiss.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctEtMiss.cc @@ -1,40 +1,42 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtMiss.h" -L1GctEtMiss::L1GctEtMiss() : m_data(0), m_bx(0) {} - -// The raw data is masked off so as only the MET magnitude, overflow + phi bits are stored. -// This is because the raw data stream also contains a BC0 flag on bit 31, and bit 15 is always -// set to 1. This data is masked off so as to match an L1GctEtMiss object constructed using -// the L1GctEtMiss(unsigned et, unsigned phi, bool oflow) constructor. -L1GctEtMiss::L1GctEtMiss(uint32_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} - -L1GctEtMiss::L1GctEtMiss(uint32_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} - -L1GctEtMiss::L1GctEtMiss(unsigned et, unsigned phi, bool oflow) : m_data(0), m_bx(0) { - if ((et <= kEtMissMaxValue) && (phi < kEtMissPhiNBins)) { - m_data = et | (oflow ? kEtMissOFlowBit : 0) | ((phi & kETMissPhiMask) << kEtMissPhiShift); - } else { - m_data = (et & kEtMissMaxValue) | kEtMissOFlowBit; +namespace io_v1 { + L1GctEtMiss::L1GctEtMiss() : m_data(0), m_bx(0) {} + + // The raw data is masked off so as only the MET magnitude, overflow + phi bits are stored. + // This is because the raw data stream also contains a BC0 flag on bit 31, and bit 15 is always + // set to 1. This data is masked off so as to match an L1GctEtMiss object constructed using + // the L1GctEtMiss(unsigned et, unsigned phi, bool oflow) constructor. + L1GctEtMiss::L1GctEtMiss(uint32_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} + + L1GctEtMiss::L1GctEtMiss(uint32_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} + + L1GctEtMiss::L1GctEtMiss(unsigned et, unsigned phi, bool oflow) : m_data(0), m_bx(0) { + if ((et <= kEtMissMaxValue) && (phi < kEtMissPhiNBins)) { + m_data = et | (oflow ? kEtMissOFlowBit : 0) | ((phi & kETMissPhiMask) << kEtMissPhiShift); + } else { + m_data = (et & kEtMissMaxValue) | kEtMissOFlowBit; + } } -} -L1GctEtMiss::L1GctEtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { - if ((et <= kEtMissMaxValue) && (phi < kEtMissPhiNBins)) { - m_data = et | (oflow ? kEtMissOFlowBit : 0) | ((phi & kETMissPhiMask) << kEtMissPhiShift); - } else { - m_data = (et & kEtMissMaxValue) | kEtMissOFlowBit; + L1GctEtMiss::L1GctEtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { + if ((et <= kEtMissMaxValue) && (phi < kEtMissPhiNBins)) { + m_data = et | (oflow ? kEtMissOFlowBit : 0) | ((phi & kETMissPhiMask) << kEtMissPhiShift); + } else { + m_data = (et & kEtMissMaxValue) | kEtMissOFlowBit; + } } -} -L1GctEtMiss::~L1GctEtMiss() {} + L1GctEtMiss::~L1GctEtMiss() {} -/// Pretty-print operator for L1GctEtMiss -std::ostream& operator<<(std::ostream& s, const L1GctEtMiss& c) { - s << " L1GctEtMiss: "; - s << " mag=" << c.et() << ", phi=" << c.phi(); - if (c.overFlow()) { - s << "; overflow set"; + /// Pretty-print operator for L1GctEtMiss + std::ostream& operator<<(std::ostream& s, const L1GctEtMiss& c) { + s << " L1GctEtMiss: "; + s << " mag=" << c.et() << ", phi=" << c.phi(); + if (c.overFlow()) { + s << "; overflow set"; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctEtTotal.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctEtTotal.cc index 2e478219e6058..1d4f5a3724f3a 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctEtTotal.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctEtTotal.cc @@ -1,28 +1,30 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEtTotal.h" -L1GctEtTotal::L1GctEtTotal() : m_data(0), m_bx(0) {} +namespace io_v1 { + L1GctEtTotal::L1GctEtTotal() : m_data(0), m_bx(0) {} -L1GctEtTotal::L1GctEtTotal(uint16_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} + L1GctEtTotal::L1GctEtTotal(uint16_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} -L1GctEtTotal::L1GctEtTotal(uint16_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} + L1GctEtTotal::L1GctEtTotal(uint16_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} -L1GctEtTotal::L1GctEtTotal(unsigned et, bool oflow) : m_data(0), m_bx(0) { - m_data = (et & kEtTotalMaxValue) | ((oflow || et > kEtTotalMaxValue) ? kEtTotalOFlowBit : 0); -} + L1GctEtTotal::L1GctEtTotal(unsigned et, bool oflow) : m_data(0), m_bx(0) { + m_data = (et & kEtTotalMaxValue) | ((oflow || et > kEtTotalMaxValue) ? kEtTotalOFlowBit : 0); + } -L1GctEtTotal::L1GctEtTotal(unsigned et, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { - m_data = (et & kEtTotalMaxValue) | ((oflow || et > kEtTotalMaxValue) ? kEtTotalOFlowBit : 0); -} + L1GctEtTotal::L1GctEtTotal(unsigned et, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { + m_data = (et & kEtTotalMaxValue) | ((oflow || et > kEtTotalMaxValue) ? kEtTotalOFlowBit : 0); + } -L1GctEtTotal::~L1GctEtTotal() {} + L1GctEtTotal::~L1GctEtTotal() {} -/// Pretty-print operator for L1GctEtTotal -std::ostream& operator<<(std::ostream& s, const L1GctEtTotal& c) { - s << " L1GctEtTotal: "; - s << " et=" << c.et(); - if (c.overFlow()) { - s << "; overflow set"; + /// Pretty-print operator for L1GctEtTotal + std::ostream& operator<<(std::ostream& s, const L1GctEtTotal& c) { + s << " L1GctEtTotal: "; + s << " et=" << c.et(); + if (c.overFlow()) { + s << "; overflow set"; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctFibreWord.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctFibreWord.cc index 8e4a5173c5fa8..584576bbd106e 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctFibreWord.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctFibreWord.cc @@ -1,14 +1,16 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctFibreWord.h" -L1GctFibreWord::L1GctFibreWord() : data_(0), block_(0), index_(0), bx_(0) {} +namespace io_v1 { + L1GctFibreWord::L1GctFibreWord() : data_(0), block_(0), index_(0), bx_(0) {} -L1GctFibreWord::L1GctFibreWord(uint32_t data, uint16_t block, uint16_t index, int16_t bx) - : data_(data), block_(block), index_(index), bx_(bx) {} + L1GctFibreWord::L1GctFibreWord(uint32_t data, uint16_t block, uint16_t index, int16_t bx) + : data_(data), block_(block), index_(index), bx_(bx) {} -std::ostream& operator<<(std::ostream& s, const L1GctFibreWord& fw) { - s << "L1GctFibreWord : "; - s << std::hex << fw.data() << ", block " << fw.block(); - s << std::dec << ", index : " << fw.index() << ", bx : " << fw.bx(); - return s; -} + std::ostream& operator<<(std::ostream& s, const L1GctFibreWord& fw) { + s << "L1GctFibreWord : "; + s << std::hex << fw.data() << ", block " << fw.block(); + s << std::dec << ", index : " << fw.index() << ", bx : " << fw.bx(); + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctHFBitCounts.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctHFBitCounts.cc index 71a8b6fc1dfcf..20cadca56d721 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctHFBitCounts.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctHFBitCounts.cc @@ -4,71 +4,74 @@ /// set static consts //static const unsigned L1GctHFBitCounts::N_COUNTS = 4; -/// default constructor (for vector initialisation etc.) -L1GctHFBitCounts::L1GctHFBitCounts() : capBlock_(0), capIndex_(0), bx_(0), data_(0) {} +namespace io_v1 { + /// default constructor (for vector initialisation etc.) + L1GctHFBitCounts::L1GctHFBitCounts() : capBlock_(0), capIndex_(0), bx_(0), data_(0) {} -/// destructor -L1GctHFBitCounts::~L1GctHFBitCounts() {} + /// destructor + L1GctHFBitCounts::~L1GctHFBitCounts() {} -// named ctor for unpacker -L1GctHFBitCounts L1GctHFBitCounts::fromConcHFBitCounts(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctHFBitCounts c; - c.setCapBlock(capBlock); - c.setCapIndex(capIndex); - c.setBx(bx); - c.setData(data & 0xfff); - return c; -} + // named ctor for unpacker + L1GctHFBitCounts L1GctHFBitCounts::fromConcHFBitCounts(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctHFBitCounts c; + c.setCapBlock(capBlock); + c.setCapIndex(capIndex); + c.setBx(bx); + c.setData(data & 0xfff); + return c; + } -// named ctor for GCT emulator -L1GctHFBitCounts L1GctHFBitCounts::fromGctEmulator(const int16_t bx, - const uint16_t bitCountPosEtaRing1, - const uint16_t bitCountNegEtaRing1, - const uint16_t bitCountPosEtaRing2, - const uint16_t bitCountNegEtaRing2) { - L1GctHFBitCounts c; - c.setBx(bx); - c.setBitCount(0, bitCountPosEtaRing1); - c.setBitCount(1, bitCountNegEtaRing1); - c.setBitCount(2, bitCountPosEtaRing2); - c.setBitCount(3, bitCountNegEtaRing2); - return c; -} + // named ctor for GCT emulator + L1GctHFBitCounts L1GctHFBitCounts::fromGctEmulator(const int16_t bx, + const uint16_t bitCountPosEtaRing1, + const uint16_t bitCountNegEtaRing1, + const uint16_t bitCountPosEtaRing2, + const uint16_t bitCountNegEtaRing2) { + L1GctHFBitCounts c; + c.setBx(bx); + c.setBitCount(0, bitCountPosEtaRing1); + c.setBitCount(1, bitCountNegEtaRing1); + c.setBitCount(2, bitCountPosEtaRing2); + c.setBitCount(3, bitCountNegEtaRing2); + return c; + } -/// get a bit count -/// index : sum -/// 0 : Ring 1 Positive Rapidity HF bit count -/// 1 : Ring 1 Negative Rapidity HF bit count -/// 2 : Ring 2 Positive Rapidity HF bit count -/// 3 : Ring 2 Negative Rapidity HF bit count -uint16_t L1GctHFBitCounts::bitCount(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; } + /// get a bit count + /// index : sum + /// 0 : Ring 1 Positive Rapidity HF bit count + /// 1 : Ring 1 Negative Rapidity HF bit count + /// 2 : Ring 2 Positive Rapidity HF bit count + /// 3 : Ring 2 Negative Rapidity HF bit count + uint16_t L1GctHFBitCounts::bitCount(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; } -/// equality operator -bool L1GctHFBitCounts::operator==(const L1GctHFBitCounts& c) const { return (this->raw() == c.raw()); } + /// equality operator + bool L1GctHFBitCounts::operator==(const L1GctHFBitCounts& c) const { return (this->raw() == c.raw()); } -/// set a sum -void L1GctHFBitCounts::setBitCount(unsigned i, uint16_t c) { - data_ &= ~(0x7 << (i * 3)); - data_ |= (c & 0x7) << (i * 3); -} + /// set a sum + void L1GctHFBitCounts::setBitCount(unsigned i, uint16_t c) { + data_ &= ~(0x7 << (i * 3)); + data_ |= (c & 0x7) << (i * 3); + } -std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand) { - s << "L1GctHFBitCounts :"; + std::ostream& operator<<(std::ostream& s, const L1GctHFBitCounts& cand) { + s << "L1GctHFBitCounts :"; - if (cand.empty()) { - s << " empty"; - } else { - s << " ring1 eta+=" << cand.bitCount(0); - s << " ring1 eta-=" << cand.bitCount(1); - s << " ring2 eta+=" << cand.bitCount(2); - s << " ring2 eta-=" << cand.bitCount(3); - s << std::endl; - } + if (cand.empty()) { + s << " empty"; + } else { + s << " ring1 eta+=" << cand.bitCount(0); + s << " ring1 eta-=" << cand.bitCount(1); + s << " ring2 eta+=" << cand.bitCount(2); + s << " ring2 eta-=" << cand.bitCount(3); + s << std::endl; + } - s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx(); + s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() + << " BX=" << cand.bx(); - return s; -} + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctHFRingEtSums.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctHFRingEtSums.cc index 19afc5794490c..5fc7c542c78d5 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctHFRingEtSums.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctHFRingEtSums.cc @@ -4,74 +4,77 @@ /// set static consts //static const unsigned L1GctHFRingEtSums::N_SUMS = 4; -/// default constructor (for vector initialisation etc.) -L1GctHFRingEtSums::L1GctHFRingEtSums() : capBlock_(0), capIndex_(0), bx_(0), data_(0) {} +namespace io_v1 { + /// default constructor (for vector initialisation etc.) + L1GctHFRingEtSums::L1GctHFRingEtSums() : capBlock_(0), capIndex_(0), bx_(0), data_(0) {} -/// destructor -L1GctHFRingEtSums::~L1GctHFRingEtSums() {} + /// destructor + L1GctHFRingEtSums::~L1GctHFRingEtSums() {} -// named ctor for unpacker -L1GctHFRingEtSums L1GctHFRingEtSums::fromConcRingSums(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctHFRingEtSums s; - s.setCapBlock(capBlock); - s.setCapIndex(capIndex); - s.setBx(bx); - s.setEtSum(0, (data >> 12) & 0x7); - s.setEtSum(1, (data >> 16) & 0x7); - s.setEtSum(2, (data >> 19) & 0x7); - s.setEtSum(3, (data >> 22) & 0x7); - return s; -} + // named ctor for unpacker + L1GctHFRingEtSums L1GctHFRingEtSums::fromConcRingSums(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctHFRingEtSums s; + s.setCapBlock(capBlock); + s.setCapIndex(capIndex); + s.setBx(bx); + s.setEtSum(0, (data >> 12) & 0x7); + s.setEtSum(1, (data >> 16) & 0x7); + s.setEtSum(2, (data >> 19) & 0x7); + s.setEtSum(3, (data >> 22) & 0x7); + return s; + } -// named ctor for GCT emulator -L1GctHFRingEtSums L1GctHFRingEtSums::fromGctEmulator(const int16_t bx, - const uint16_t etSumPosEtaRing1, - const uint16_t etSumNegEtaRing1, - const uint16_t etSumPosEtaRing2, - const uint16_t etSumNegEtaRing2) { - L1GctHFRingEtSums s; - s.setBx(bx); - s.setEtSum(0, etSumPosEtaRing1); - s.setEtSum(1, etSumNegEtaRing1); - s.setEtSum(2, etSumPosEtaRing2); - s.setEtSum(3, etSumNegEtaRing2); - return s; -} + // named ctor for GCT emulator + L1GctHFRingEtSums L1GctHFRingEtSums::fromGctEmulator(const int16_t bx, + const uint16_t etSumPosEtaRing1, + const uint16_t etSumNegEtaRing1, + const uint16_t etSumPosEtaRing2, + const uint16_t etSumNegEtaRing2) { + L1GctHFRingEtSums s; + s.setBx(bx); + s.setEtSum(0, etSumPosEtaRing1); + s.setEtSum(1, etSumNegEtaRing1); + s.setEtSum(2, etSumPosEtaRing2); + s.setEtSum(3, etSumNegEtaRing2); + return s; + } -/// get an Et sum -/// index : sum -/// 0 : Ring 1 Positive Rapidity HF Et sum -/// 1 : Ring 1 Negative Rapidity HF Et sum -/// 2 : Ring 2 Positive Rapidity HF Et sum -/// 3 : Ring 2 Negative Rapidity HF Et sum -uint16_t L1GctHFRingEtSums::etSum(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; } + /// get an Et sum + /// index : sum + /// 0 : Ring 1 Positive Rapidity HF Et sum + /// 1 : Ring 1 Negative Rapidity HF Et sum + /// 2 : Ring 2 Positive Rapidity HF Et sum + /// 3 : Ring 2 Negative Rapidity HF Et sum + uint16_t L1GctHFRingEtSums::etSum(unsigned const i) const { return (data_ >> (i * 3)) & 0x7; } -/// equality operator -bool L1GctHFRingEtSums::operator==(const L1GctHFRingEtSums& c) const { return (this->raw() == c.raw()); } + /// equality operator + bool L1GctHFRingEtSums::operator==(const L1GctHFRingEtSums& c) const { return (this->raw() == c.raw()); } -/// set a sum -void L1GctHFRingEtSums::setEtSum(unsigned i, uint16_t et) { - data_ &= ~(0x7 << (i * 3)); - data_ |= (et & 0x7) << (i * 3); -} + /// set a sum + void L1GctHFRingEtSums::setEtSum(unsigned i, uint16_t et) { + data_ &= ~(0x7 << (i * 3)); + data_ |= (et & 0x7) << (i * 3); + } -std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand) { - s << "L1GctHFRingEtSums :"; + std::ostream& operator<<(std::ostream& s, const L1GctHFRingEtSums& cand) { + s << "L1GctHFRingEtSums :"; - if (cand.empty()) { - s << " empty"; - } else { - s << " ring1 eta+=" << cand.etSum(0); - s << " ring1 eta-=" << cand.etSum(1); - s << " ring2 eta+=" << cand.etSum(2); - s << " ring2 eta-=" << cand.etSum(3); - s << std::endl; - } + if (cand.empty()) { + s << " empty"; + } else { + s << " ring1 eta+=" << cand.etSum(0); + s << " ring1 eta-=" << cand.etSum(1); + s << " ring2 eta+=" << cand.etSum(2); + s << " ring2 eta-=" << cand.etSum(3); + s << std::endl; + } - s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx(); + s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() + << " BX=" << cand.bx(); - return s; -} + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctHtMiss.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctHtMiss.cc index e96898b587ff5..78a322c8ba5c2 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctHtMiss.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctHtMiss.cc @@ -1,43 +1,45 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHtMiss.h" -L1GctHtMiss::L1GctHtMiss() : m_data(0), m_bx(0) {} - -// The raw data is masked off so as only the MHT magnitude, overflow + phi bits are stored. -// This is because the raw data stream also contains a BC0 flag on bit 31, bit 15 is always -// set to 1, bits 14:13 are always '10', and bits 30:16 are always '101010...'. -// This data is masked off so as to match an L1GctHtMiss object constructed using -// the L1GctHtMiss(unsigned et, unsigned phi, bool oflow) constructor. -L1GctHtMiss::L1GctHtMiss(uint32_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} - -L1GctHtMiss::L1GctHtMiss(uint32_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} - -L1GctHtMiss::L1GctHtMiss(unsigned et, unsigned phi, bool oflow) : m_data(0), m_bx(0) { - if ((et <= kHtMissMagMask) && (phi < kHtMissPhiNBins)) { - m_data = (oflow ? kHtMissOFlowBit : 0) | ((et & kHtMissMagMask) << kHtMissMagShift) | - ((phi & kHtMissPhiMask) << kHtMissPhiShift); - } else { - m_data = ((et & kHtMissMagMask) << kHtMissMagShift) | kHtMissOFlowBit; +namespace io_v1 { + L1GctHtMiss::L1GctHtMiss() : m_data(0), m_bx(0) {} + + // The raw data is masked off so as only the MHT magnitude, overflow + phi bits are stored. + // This is because the raw data stream also contains a BC0 flag on bit 31, bit 15 is always + // set to 1, bits 14:13 are always '10', and bits 30:16 are always '101010...'. + // This data is masked off so as to match an L1GctHtMiss object constructed using + // the L1GctHtMiss(unsigned et, unsigned phi, bool oflow) constructor. + L1GctHtMiss::L1GctHtMiss(uint32_t rawData) : m_data(rawData & kRawCtorMask), m_bx(0) {} + + L1GctHtMiss::L1GctHtMiss(uint32_t rawData, int16_t bx) : m_data(rawData & kRawCtorMask), m_bx(bx) {} + + L1GctHtMiss::L1GctHtMiss(unsigned et, unsigned phi, bool oflow) : m_data(0), m_bx(0) { + if ((et <= kHtMissMagMask) && (phi < kHtMissPhiNBins)) { + m_data = (oflow ? kHtMissOFlowBit : 0) | ((et & kHtMissMagMask) << kHtMissMagShift) | + ((phi & kHtMissPhiMask) << kHtMissPhiShift); + } else { + m_data = ((et & kHtMissMagMask) << kHtMissMagShift) | kHtMissOFlowBit; + } } -} - -L1GctHtMiss::L1GctHtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { - if ((et <= kHtMissMagMask) && (phi < kHtMissPhiNBins)) { - m_data = (oflow ? kHtMissOFlowBit : 0) | ((et & kHtMissMagMask) << kHtMissMagShift) | - ((phi & kHtMissPhiMask) << kHtMissPhiShift); - } else { - m_data = ((et & kHtMissMagMask) << kHtMissMagShift) | kHtMissOFlowBit; + + L1GctHtMiss::L1GctHtMiss(unsigned et, unsigned phi, bool oflow, int16_t bx) : m_data(0), m_bx(bx) { + if ((et <= kHtMissMagMask) && (phi < kHtMissPhiNBins)) { + m_data = (oflow ? kHtMissOFlowBit : 0) | ((et & kHtMissMagMask) << kHtMissMagShift) | + ((phi & kHtMissPhiMask) << kHtMissPhiShift); + } else { + m_data = ((et & kHtMissMagMask) << kHtMissMagShift) | kHtMissOFlowBit; + } } -} -L1GctHtMiss::~L1GctHtMiss() {} + L1GctHtMiss::~L1GctHtMiss() {} -/// Pretty-print operator for L1GctHtMiss -std::ostream& operator<<(std::ostream& s, const L1GctHtMiss& c) { - s << " L1GctHtMiss: "; - s << " mag=" << c.et() << ", phi=" << c.phi(); - if (c.overFlow()) { - s << "; overflow set"; + /// Pretty-print operator for L1GctHtMiss + std::ostream& operator<<(std::ostream& s, const L1GctHtMiss& c) { + s << " L1GctHtMiss: "; + s << " mag=" << c.et() << ", phi=" << c.phi(); + if (c.overFlow()) { + s << "; overflow set"; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEmCand.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEmCand.cc index b2474fd7a3cf6..86271760ed96d 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEmCand.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEmCand.cc @@ -9,52 +9,54 @@ using std::hex; using std::ostream; using std::string; -// default constructor -L1GctInternEmCand::L1GctInternEmCand() : m_data(0), m_captureBlock(0), m_captureIndex(0), m_iso(false), m_bx(0) {} - -// construct from raw data (for use in unpacking) -L1GctInternEmCand::L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx) - : m_data(data), m_captureBlock(block & 0xfff), m_captureIndex(index & 0xff), m_iso(iso), m_bx(bx) {} - -// construct from eta/phi etc -L1GctInternEmCand::L1GctInternEmCand( - unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi, bool iso, unsigned block, unsigned index, int16_t bx) - : m_data(0), // Over-ridden in construct() - m_captureBlock(block & 0xfff), - m_captureIndex(index & 0xff), - m_iso(iso), - m_bx(bx) { - construct(rank, eta, etaSgn, phi); -} - -// destructor -L1GctInternEmCand::~L1GctInternEmCand() {} - -// name of candidate type -string L1GctInternEmCand::name() const { return (isolated() ? "iso EM" : "non iso EM"); } - -// was a candidate found -bool L1GctInternEmCand::empty() const { return (rank() == 0); } - -// pretty print -ostream& operator<<(ostream& s, const L1GctInternEmCand& cand) { - s << "L1GctInternEmCand : "; - s << "rank=" << cand.rank(); - s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0xf) << ", phi=" << cand.phiIndex(); - s << ", iso=" << cand.isolated(); - s << " cap block=" << hex << cand.capBlock(); - s << ", index=" << dec << cand.capIndex() << ", BX=" << cand.bx(); - return s; -} - -// return region object -L1CaloRegionDetId L1GctInternEmCand::regionId() const { - // get global eta - unsigned eta = (etaSign() == 1 ? 10 - (etaIndex() & 0xf) : 11 + (etaIndex() & 0xf)); - return L1CaloRegionDetId(eta, phiIndex()); -} - -// construct from rank, eta, phi -void L1GctInternEmCand::construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi) { - m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((etaSgn & 0x1) << 10) + ((phi & 0x1f) << 11); -} +namespace io_v1 { + // default constructor + L1GctInternEmCand::L1GctInternEmCand() : m_data(0), m_captureBlock(0), m_captureIndex(0), m_iso(false), m_bx(0) {} + + // construct from raw data (for use in unpacking) + L1GctInternEmCand::L1GctInternEmCand(uint16_t data, bool iso, unsigned block, unsigned index, int16_t bx) + : m_data(data), m_captureBlock(block & 0xfff), m_captureIndex(index & 0xff), m_iso(iso), m_bx(bx) {} + + // construct from eta/phi etc + L1GctInternEmCand::L1GctInternEmCand( + unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi, bool iso, unsigned block, unsigned index, int16_t bx) + : m_data(0), // Over-ridden in construct() + m_captureBlock(block & 0xfff), + m_captureIndex(index & 0xff), + m_iso(iso), + m_bx(bx) { + construct(rank, eta, etaSgn, phi); + } + + // destructor + L1GctInternEmCand::~L1GctInternEmCand() {} + + // name of candidate type + string L1GctInternEmCand::name() const { return (isolated() ? "iso EM" : "non iso EM"); } + + // was a candidate found + bool L1GctInternEmCand::empty() const { return (rank() == 0); } + + // pretty print + ostream& operator<<(ostream& s, const L1GctInternEmCand& cand) { + s << "L1GctInternEmCand : "; + s << "rank=" << cand.rank(); + s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0xf) << ", phi=" << cand.phiIndex(); + s << ", iso=" << cand.isolated(); + s << " cap block=" << hex << cand.capBlock(); + s << ", index=" << dec << cand.capIndex() << ", BX=" << cand.bx(); + return s; + } + + // return region object + L1CaloRegionDetId L1GctInternEmCand::regionId() const { + // get global eta + unsigned eta = (etaSign() == 1 ? 10 - (etaIndex() & 0xf) : 11 + (etaIndex() & 0xf)); + return L1CaloRegionDetId(eta, phiIndex()); + } + + // construct from rank, eta, phi + void L1GctInternEmCand::construct(unsigned rank, unsigned eta, unsigned etaSgn, unsigned phi) { + m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((etaSgn & 0x1) << 10) + ((phi & 0x1f) << 11); + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEtSum.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEtSum.cc index 605ea360e9228..119f40811a3c2 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEtSum.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternEtSum.cc @@ -1,190 +1,192 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternEtSum.h" #include -L1GctInternEtSum::L1GctInternEtSum() : data_(0) {} - -/// construct from individual quantities -L1GctInternEtSum::L1GctInternEtSum(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t et, uint8_t oflow) - : type_(null), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), data_(0) { - this->setEt(et); - this->setOflow(oflow); -} - -/// destructor -L1GctInternEtSum::~L1GctInternEtSum() {} - -L1GctInternEtSum L1GctInternEtSum::fromJetTotEt(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternEtSum s; - s.setEt(data & kTotEtOrHtMaxValue); - s.setOflow((data >> kTotEtOrHtNBits) & 0x1); - s.setCapBlock(capBlock); - s.setCapIndex(capIndex); - s.setBx(bx); - s.setType(jet_tot_et); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromJetTotHt(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternEtSum s; - uint32_t word = data >> 16; - s.setEt(word & kTotEtOrHtMaxValue); - s.setOflow((word >> kTotEtOrHtNBits) & 0x1); - s.setCapBlock(capBlock); - s.setCapIndex(capIndex); - s.setBx(bx); - s.setType(jet_tot_ht); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromJetMissEt(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternEtSum s; - s.setEt(data & kJetMissEtMaxValue); - s.setOflow((data >> kJetMissEtNBits) & 0x1); - s.setCapBlock(capBlock); - s.setCapIndex(capIndex); - s.setBx(bx); - s.setType(jet_miss_et); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromTotalEtOrHt(const uint16_t capBlock, +namespace io_v1 { + L1GctInternEtSum::L1GctInternEtSum() : data_(0) {} + + /// construct from individual quantities + L1GctInternEtSum::L1GctInternEtSum(uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t et, uint8_t oflow) + : type_(null), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), data_(0) { + this->setEt(et); + this->setOflow(oflow); + } + + /// destructor + L1GctInternEtSum::~L1GctInternEtSum() {} + + L1GctInternEtSum L1GctInternEtSum::fromJetTotEt(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternEtSum s; + s.setEt(data & kTotEtOrHtMaxValue); + s.setOflow((data >> kTotEtOrHtNBits) & 0x1); + s.setCapBlock(capBlock); + s.setCapIndex(capIndex); + s.setBx(bx); + s.setType(jet_tot_et); + return s; + } + + L1GctInternEtSum L1GctInternEtSum::fromJetTotHt(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternEtSum s; + uint32_t word = data >> 16; + s.setEt(word & kTotEtOrHtMaxValue); + s.setOflow((word >> kTotEtOrHtNBits) & 0x1); + s.setCapBlock(capBlock); + s.setCapIndex(capIndex); + s.setBx(bx); + s.setType(jet_tot_ht); + return s; + } + + L1GctInternEtSum L1GctInternEtSum::fromJetMissEt(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data) { - L1GctInternEtSum s; - s.setEt(data & kTotEtOrHtMaxValue); - s.setOflow((data >> kTotEtOrHtNBits) & 0x1); - s.setCapBlock(capBlock); - s.setCapIndex(capIndex); - s.setBx(bx); - s.setType(total_et_or_ht); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromMissEtxOrEty(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternEtSum s; - s.setEt(data & kMissExOrEyNBits); - s.setOflow(0); // No over flow bit at the moment - s.setCapBlock(capBlock); - s.setCapIndex(capIndex); - s.setBx(bx); - s.setType(miss_etx_or_ety); - return s; -} - -/// Emulator constructors - -L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx) { - L1GctInternEtSum s; - s.setEt(totEt & kTotEtOrHtMaxValue); - if (overFlow || (totEt > kTotEtOrHtMaxValue)) - s.setOflow(0x1); - s.setBx(bx); - s.setType(jet_tot_et); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx) { - L1GctInternEtSum s; - s.setEt(totHt & kTotEtOrHtMaxValue); - if (overFlow || (totHt > kTotEtOrHtMaxValue)) - s.setOflow(0x1); - s.setBx(bx); - s.setType(jet_tot_ht); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx) { - L1GctInternEtSum s; - s.setEt(missEtxOrEty & kJetMissEtMaxValue); - if (overFlow || (missEtxOrEty >= kJetMissEtOFlowBit / 2) || (missEtxOrEty < -kJetMissEtOFlowBit / 2)) - s.setOflow(0x1); - s.setBx(bx); - s.setType(jet_miss_et); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx) { - L1GctInternEtSum s; - s.setEt(totEtOrHt & kTotEtOrHtMaxValue); - if (overFlow || (totEtOrHt > kTotEtOrHtMaxValue)) - s.setOflow(0x1); - s.setBx(bx); - s.setType(total_et_or_ht); - return s; -} - -L1GctInternEtSum L1GctInternEtSum::fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx) { - L1GctInternEtSum s; - s.setEt(missEtxOrEty & kMissExOrEyMaxValue); - if (overFlow || (missEtxOrEty >= kMissExOrEyOFlowBit / 2) || (missEtxOrEty < -kMissExOrEyOFlowBit / 2)) - s.setOflow(0x1); - s.setBx(bx); - s.setType(miss_etx_or_ety); - return s; -} - -/// equality operator -bool L1GctInternEtSum::operator==(const L1GctInternEtSum& c) const { return (data_ == c.raw() && bx_ == c.bx()); } - -/// set value -void L1GctInternEtSum::setValue(uint32_t val) { - data_ &= 0x80000000; - data_ |= val & 0x7ffffff; -} - -/// set et -void L1GctInternEtSum::setEt(uint32_t et) { setValue(et); } - -/// set count -void L1GctInternEtSum::setCount(uint32_t count) { setValue(count); } - -/// set overflow bit -void L1GctInternEtSum::setOflow(uint8_t oflow) { - data_ &= 0x7ffffff; - data_ |= (oflow & 0x1) << 31; -} - -/// Pretty-print operator for L1GctInternEtSum -std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c) { - s << "L1GctInternEtSum : "; - - if (c.type() == L1GctInternEtSum::jet_miss_et) { - s << " type=jet_miss_et"; - } else if (c.type() == L1GctInternEtSum::jet_tot_et) { - s << " type=jet_tot_et"; - } else if (c.type() == L1GctInternEtSum::jet_tot_ht) { - s << " type=jet_tot_ht"; - } else if (c.type() == L1GctInternEtSum::total_et_or_ht) { - s << " type=total_et_or_ht"; - } else if (c.type() == L1GctInternEtSum::miss_etx_or_ety) { - s << " type=miss_etx_or_ety"; + L1GctInternEtSum s; + s.setEt(data & kJetMissEtMaxValue); + s.setOflow((data >> kJetMissEtNBits) & 0x1); + s.setCapBlock(capBlock); + s.setCapIndex(capIndex); + s.setBx(bx); + s.setType(jet_miss_et); + return s; } - if (c.empty()) { - s << " empty!"; - } else { - s << " mag=" << c.et(); - if (c.oflow()) { - s << " overflow set"; - } + L1GctInternEtSum L1GctInternEtSum::fromTotalEtOrHt(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternEtSum s; + s.setEt(data & kTotEtOrHtMaxValue); + s.setOflow((data >> kTotEtOrHtNBits) & 0x1); + s.setCapBlock(capBlock); + s.setCapIndex(capIndex); + s.setBx(bx); + s.setType(total_et_or_ht); + return s; + } + + L1GctInternEtSum L1GctInternEtSum::fromMissEtxOrEty(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternEtSum s; + s.setEt(data & kMissExOrEyNBits); + s.setOflow(0); // No over flow bit at the moment + s.setCapBlock(capBlock); + s.setCapIndex(capIndex); + s.setBx(bx); + s.setType(miss_etx_or_ety); + return s; + } + + /// Emulator constructors + + L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotEt(unsigned totEt, bool overFlow, int16_t bx) { + L1GctInternEtSum s; + s.setEt(totEt & kTotEtOrHtMaxValue); + if (overFlow || (totEt > kTotEtOrHtMaxValue)) + s.setOflow(0x1); + s.setBx(bx); + s.setType(jet_tot_et); + return s; + } + + L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetTotHt(unsigned totHt, bool overFlow, int16_t bx) { + L1GctInternEtSum s; + s.setEt(totHt & kTotEtOrHtMaxValue); + if (overFlow || (totHt > kTotEtOrHtMaxValue)) + s.setOflow(0x1); + s.setBx(bx); + s.setType(jet_tot_ht); + return s; + } + + L1GctInternEtSum L1GctInternEtSum::fromEmulatorJetMissEt(int missEtxOrEty, bool overFlow, int16_t bx) { + L1GctInternEtSum s; + s.setEt(missEtxOrEty & kJetMissEtMaxValue); + if (overFlow || (missEtxOrEty >= kJetMissEtOFlowBit / 2) || (missEtxOrEty < -kJetMissEtOFlowBit / 2)) + s.setOflow(0x1); + s.setBx(bx); + s.setType(jet_miss_et); + return s; } - s << " cap block=" << std::hex << c.capBlock(); - s << " index=" << std::dec << c.capIndex(); - s << " BX=" << c.bx(); + L1GctInternEtSum L1GctInternEtSum::fromEmulatorTotalEtOrHt(unsigned totEtOrHt, bool overFlow, int16_t bx) { + L1GctInternEtSum s; + s.setEt(totEtOrHt & kTotEtOrHtMaxValue); + if (overFlow || (totEtOrHt > kTotEtOrHtMaxValue)) + s.setOflow(0x1); + s.setBx(bx); + s.setType(total_et_or_ht); + return s; + } + + L1GctInternEtSum L1GctInternEtSum::fromEmulatorMissEtxOrEty(int missEtxOrEty, bool overFlow, int16_t bx) { + L1GctInternEtSum s; + s.setEt(missEtxOrEty & kMissExOrEyMaxValue); + if (overFlow || (missEtxOrEty >= kMissExOrEyOFlowBit / 2) || (missEtxOrEty < -kMissExOrEyOFlowBit / 2)) + s.setOflow(0x1); + s.setBx(bx); + s.setType(miss_etx_or_ety); + return s; + } + + /// equality operator + bool L1GctInternEtSum::operator==(const L1GctInternEtSum& c) const { return (data_ == c.raw() && bx_ == c.bx()); } + + /// set value + void L1GctInternEtSum::setValue(uint32_t val) { + data_ &= 0x80000000; + data_ |= val & 0x7ffffff; + } + + /// set et + void L1GctInternEtSum::setEt(uint32_t et) { setValue(et); } + + /// set count + void L1GctInternEtSum::setCount(uint32_t count) { setValue(count); } - return s; -} + /// set overflow bit + void L1GctInternEtSum::setOflow(uint8_t oflow) { + data_ &= 0x7ffffff; + data_ |= (oflow & 0x1) << 31; + } + + /// Pretty-print operator for L1GctInternEtSum + std::ostream& operator<<(std::ostream& s, const L1GctInternEtSum& c) { + s << "L1GctInternEtSum : "; + + if (c.type() == L1GctInternEtSum::jet_miss_et) { + s << " type=jet_miss_et"; + } else if (c.type() == L1GctInternEtSum::jet_tot_et) { + s << " type=jet_tot_et"; + } else if (c.type() == L1GctInternEtSum::jet_tot_ht) { + s << " type=jet_tot_ht"; + } else if (c.type() == L1GctInternEtSum::total_et_or_ht) { + s << " type=total_et_or_ht"; + } else if (c.type() == L1GctInternEtSum::miss_etx_or_ety) { + s << " type=miss_etx_or_ety"; + } + + if (c.empty()) { + s << " empty!"; + } else { + s << " mag=" << c.et(); + if (c.oflow()) { + s << " overflow set"; + } + } + + s << " cap block=" << std::hex << c.capBlock(); + s << " index=" << std::dec << c.capIndex(); + s << " BX=" << c.bx(); + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHFData.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHFData.cc index e056bff3dd3a6..bd98be9a26414 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHFData.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHFData.cc @@ -1,118 +1,121 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternHFData.h" -L1GctInternHFData::L1GctInternHFData() : type_(null), capBlock_(0), capIndex_(0), bx_(0), data_(0) {} - -/// destructor -L1GctInternHFData::~L1GctInternHFData() {} - -L1GctInternHFData L1GctInternHFData::fromConcRingSums(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternHFData d; - d.setType(conc_hf_ring_et_sums); - d.setCapIndex(capIndex); - d.setCapBlock(capBlock); - d.setBx(bx); - d.setData(data); - return d; -} - -L1GctInternHFData L1GctInternHFData::fromConcBitCounts(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternHFData d; - d.setType(conc_hf_bit_counts); - d.setCapIndex(capIndex); - d.setCapBlock(capBlock); - d.setBx(bx); - for (unsigned i = 0; i < 4; ++i) { - d.setCount(i, (data >> (6 * i)) & 0x3f); - } - return d; -} - -L1GctInternHFData L1GctInternHFData::fromWheelRingSums(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - L1GctInternHFData d; - d.setType(wheel_hf_ring_et_sums); - d.setCapIndex(capIndex); - d.setCapBlock(capBlock); - d.setBx(bx); - d.setData(data & 0xff); - return d; -} - -L1GctInternHFData L1GctInternHFData::fromWheelBitCounts(const uint16_t capBlock, +namespace io_v1 { + L1GctInternHFData::L1GctInternHFData() : type_(null), capBlock_(0), capIndex_(0), bx_(0), data_(0) {} + + /// destructor + L1GctInternHFData::~L1GctInternHFData() {} + + L1GctInternHFData L1GctInternHFData::fromConcRingSums(const uint16_t capBlock, const uint16_t capIndex, const int16_t bx, const uint32_t data) { - L1GctInternHFData d; - d.setType(wheel_hf_bit_counts); - d.setCapIndex(capIndex); - d.setCapBlock(capBlock); - d.setBx(bx); - d.setCount(0, data & 0x3f); - return d; -} - -// get value -uint16_t L1GctInternHFData::value(unsigned i) const { return (data_ >> (i * 8)) & 0xff; } - -/// get the et sums -uint16_t L1GctInternHFData::et(unsigned i) const { return value(i); } - -/// get the counts -uint16_t L1GctInternHFData::count(unsigned i) const { return value(i); } - -/// equality operator -bool L1GctInternHFData::operator==(const L1GctInternHFData& c) const { return (this->raw() == c.raw()); } - -// set value -void L1GctInternHFData::setValue(unsigned i, uint16_t val) { - data_ &= ~(0xff << (i * 8)); - data_ |= (val & 0xff) << (i * 8); -} - -/// set the sum -void L1GctInternHFData::setEt(unsigned i, uint16_t et) { setValue(i, et); } - -/// set the count -void L1GctInternHFData::setCount(unsigned i, uint16_t count) { setValue(i, count); } - -std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand) { - s << "L1GctInternHFData :"; - - if (cand.empty()) { - s << " empty"; - } else { - if (cand.type() == L1GctInternHFData::conc_hf_ring_et_sums) { - s << " type=conc_hf_ring_et_sums"; - s << " ring1 eta+=" << cand.et(0); - s << " ring1 eta-=" << cand.et(1); - s << " ring2 eta+=" << cand.et(2); - s << " ring2 eta-=" << cand.et(3); - } else if (cand.type() == L1GctInternHFData::conc_hf_bit_counts) { - s << " type=conc_hf_bit_counts"; - s << " ring1 eta+=" << cand.count(0); - s << " ring1 eta-=" << cand.count(1); - s << " ring2 eta+=" << cand.count(2); - s << " ring2 eta-=" << cand.count(3); - } else if (cand.type() == L1GctInternHFData::wheel_hf_ring_et_sums) { - s << " type=conc_hf_ring_et_sums"; - s << " Et sum=" << cand.et(0); - } else if (cand.type() == L1GctInternHFData::wheel_hf_bit_counts) { - s << " type=wheel_hf_bit_counts"; - s << " Bit count=" << cand.et(0); + L1GctInternHFData d; + d.setType(conc_hf_ring_et_sums); + d.setCapIndex(capIndex); + d.setCapBlock(capBlock); + d.setBx(bx); + d.setData(data); + return d; + } + + L1GctInternHFData L1GctInternHFData::fromConcBitCounts(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternHFData d; + d.setType(conc_hf_bit_counts); + d.setCapIndex(capIndex); + d.setCapBlock(capBlock); + d.setBx(bx); + for (unsigned i = 0; i < 4; ++i) { + d.setCount(i, (data >> (6 * i)) & 0x3f); } + return d; + } + + L1GctInternHFData L1GctInternHFData::fromWheelRingSums(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternHFData d; + d.setType(wheel_hf_ring_et_sums); + d.setCapIndex(capIndex); + d.setCapBlock(capBlock); + d.setBx(bx); + d.setData(data & 0xff); + return d; + } + + L1GctInternHFData L1GctInternHFData::fromWheelBitCounts(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + L1GctInternHFData d; + d.setType(wheel_hf_bit_counts); + d.setCapIndex(capIndex); + d.setCapBlock(capBlock); + d.setBx(bx); + d.setCount(0, data & 0x3f); + return d; } - s << std::endl; - s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() << " BX=" << cand.bx(); + // get value + uint16_t L1GctInternHFData::value(unsigned i) const { return (data_ >> (i * 8)) & 0xff; } - return s; -} + /// get the et sums + uint16_t L1GctInternHFData::et(unsigned i) const { return value(i); } + + /// get the counts + uint16_t L1GctInternHFData::count(unsigned i) const { return value(i); } + + /// equality operator + bool L1GctInternHFData::operator==(const L1GctInternHFData& c) const { return (this->raw() == c.raw()); } + + // set value + void L1GctInternHFData::setValue(unsigned i, uint16_t val) { + data_ &= ~(0xff << (i * 8)); + data_ |= (val & 0xff) << (i * 8); + } + + /// set the sum + void L1GctInternHFData::setEt(unsigned i, uint16_t et) { setValue(i, et); } + + /// set the count + void L1GctInternHFData::setCount(unsigned i, uint16_t count) { setValue(i, count); } + + std::ostream& operator<<(std::ostream& s, const L1GctInternHFData& cand) { + s << "L1GctInternHFData :"; + + if (cand.empty()) { + s << " empty"; + } else { + if (cand.type() == L1GctInternHFData::conc_hf_ring_et_sums) { + s << " type=conc_hf_ring_et_sums"; + s << " ring1 eta+=" << cand.et(0); + s << " ring1 eta-=" << cand.et(1); + s << " ring2 eta+=" << cand.et(2); + s << " ring2 eta-=" << cand.et(3); + } else if (cand.type() == L1GctInternHFData::conc_hf_bit_counts) { + s << " type=conc_hf_bit_counts"; + s << " ring1 eta+=" << cand.count(0); + s << " ring1 eta-=" << cand.count(1); + s << " ring2 eta+=" << cand.count(2); + s << " ring2 eta-=" << cand.count(3); + } else if (cand.type() == L1GctInternHFData::wheel_hf_ring_et_sums) { + s << " type=conc_hf_ring_et_sums"; + s << " Et sum=" << cand.et(0); + } else if (cand.type() == L1GctInternHFData::wheel_hf_bit_counts) { + s << " type=wheel_hf_bit_counts"; + s << " Bit count=" << cand.et(0); + } + } + s << std::endl; + + s << std::hex << " cap block=" << cand.capBlock() << std::dec << " index=" << cand.capIndex() + << " BX=" << cand.bx(); + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHtMiss.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHtMiss.cc index e0ea832444183..1babd56cf207b 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHtMiss.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternHtMiss.cc @@ -2,153 +2,155 @@ // PUBLIC METHODS -// Default ctor -L1GctInternHtMiss::L1GctInternHtMiss() : type_(nulltype), capBlock_(0), capIndex_(0), bx_(0), data_(0) {} - -// Destructor -L1GctInternHtMiss::~L1GctInternHtMiss() {} - -// Named ctor for making missing Ht x-component object from unpacker raw data. -L1GctInternHtMiss L1GctInternHtMiss::unpackerMissHtx(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - return L1GctInternHtMiss(miss_htx, capBlock, capIndex, bx, data & kSingleComponentRawMask); -} - -// Named ctor for making missing Ht y-component object from unpacker raw data. -L1GctInternHtMiss L1GctInternHtMiss::unpackerMissHty(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - return L1GctInternHtMiss(miss_hty, capBlock, capIndex, bx, data & kSingleComponentRawMask); -} - -// Named ctor for making missing Ht x & y components object from unpacker raw data. -L1GctInternHtMiss L1GctInternHtMiss::unpackerMissHtxHty(const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) { - return L1GctInternHtMiss(miss_htx_and_hty, capBlock, capIndex, bx, data & kDoubleComponentRawMask); -} - -// Named ctor for making missing Ht x & y components object from unpacker raw data. -L1GctInternHtMiss L1GctInternHtMiss::emulatorJetMissHt(const int htx, - const int hty, - const bool overFlow, - const int16_t bx) { - int32_t xdata = (htx & kJetFinderComponentHtMask); - int32_t ydata = (hty & kJetFinderComponentHtMask) << kDoubleComponentHtyShift; - int32_t odata = 0; - if (overFlow || (htx >= kJetFinderComponentHtMask / 2) || (htx < -kJetFinderComponentHtMask / 2) || - (hty >= kJetFinderComponentHtMask / 2) || (hty < -kJetFinderComponentHtMask / 2)) - odata = kDoubleComponentOflowMask; - return L1GctInternHtMiss(jf_miss_htx_and_hty, 0, 0, bx, xdata | ydata | odata); -} - -/// Named ctor for making missing Ht x & y components object from emulator (wheel input). -L1GctInternHtMiss L1GctInternHtMiss::emulatorMissHtxHty(const int htx, - const int hty, - const bool overFlow, - const int16_t bx) { - int32_t xdata = (htx & kDoubleComponentHtMask); - int32_t ydata = (hty & kDoubleComponentHtMask) << kDoubleComponentHtyShift; - int32_t odata = 0; - if (overFlow || (htx >= kDoubleComponentHtMask / 2) || (htx < -kDoubleComponentHtMask / 2) || - (hty >= kDoubleComponentHtMask / 2) || (hty < -kDoubleComponentHtMask / 2)) - odata = kDoubleComponentOflowMask; - return L1GctInternHtMiss(miss_htx_and_hty, 0, 0, bx, xdata | ydata | odata); -} - -/// Named ctor for making missing Ht x component object from emulator -L1GctInternHtMiss L1GctInternHtMiss::emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx) { - int32_t xdata = (htx & kSingleComponentHtMask); - int32_t odata = 0; - if (overFlow || (htx >= kSingleComponentHtMask / 2) || (htx < -kSingleComponentHtMask / 2)) - odata = kSingleComponentOflowMask; - return L1GctInternHtMiss(miss_htx, 0, 0, bx, xdata | odata); -} - -/// Named ctor for making missing Ht y component object from emulator -L1GctInternHtMiss L1GctInternHtMiss::emulatorMissHty(const int hty, const bool overFlow, const int16_t bx) { - int32_t ydata = (hty & kSingleComponentHtMask); - int32_t odata = 0; - if (overFlow || (hty >= kSingleComponentHtMask / 2) || (hty < -kSingleComponentHtMask / 2)) - odata = kSingleComponentOflowMask; - return L1GctInternHtMiss(miss_hty, 0, 0, bx, ydata | odata); -} - -// Get Ht x-component -int16_t L1GctInternHtMiss::htx() const { - if (type() == miss_htx) { - return static_cast(raw() & kSingleComponentHtMask); +namespace io_v1 { + // Default ctor + L1GctInternHtMiss::L1GctInternHtMiss() : type_(nulltype), capBlock_(0), capIndex_(0), bx_(0), data_(0) {} + + // Destructor + L1GctInternHtMiss::~L1GctInternHtMiss() {} + + // Named ctor for making missing Ht x-component object from unpacker raw data. + L1GctInternHtMiss L1GctInternHtMiss::unpackerMissHtx(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + return L1GctInternHtMiss(miss_htx, capBlock, capIndex, bx, data & kSingleComponentRawMask); } - if (type() == miss_htx_and_hty) { - return convert14BitTwosCompTo16Bit(raw() & kDoubleComponentHtMask); + + // Named ctor for making missing Ht y-component object from unpacker raw data. + L1GctInternHtMiss L1GctInternHtMiss::unpackerMissHty(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + return L1GctInternHtMiss(miss_hty, capBlock, capIndex, bx, data & kSingleComponentRawMask); } - return 0; -} -// Get Ht y-component -int16_t L1GctInternHtMiss::hty() const { - if (type() == miss_hty) { - return static_cast(raw() & kSingleComponentHtMask); + // Named ctor for making missing Ht x & y components object from unpacker raw data. + L1GctInternHtMiss L1GctInternHtMiss::unpackerMissHtxHty(const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) { + return L1GctInternHtMiss(miss_htx_and_hty, capBlock, capIndex, bx, data & kDoubleComponentRawMask); } - if (type() == miss_htx_and_hty) { - return convert14BitTwosCompTo16Bit((raw() >> kDoubleComponentHtyShift) & kDoubleComponentHtMask); + + // Named ctor for making missing Ht x & y components object from unpacker raw data. + L1GctInternHtMiss L1GctInternHtMiss::emulatorJetMissHt(const int htx, + const int hty, + const bool overFlow, + const int16_t bx) { + int32_t xdata = (htx & kJetFinderComponentHtMask); + int32_t ydata = (hty & kJetFinderComponentHtMask) << kDoubleComponentHtyShift; + int32_t odata = 0; + if (overFlow || (htx >= kJetFinderComponentHtMask / 2) || (htx < -kJetFinderComponentHtMask / 2) || + (hty >= kJetFinderComponentHtMask / 2) || (hty < -kJetFinderComponentHtMask / 2)) + odata = kDoubleComponentOflowMask; + return L1GctInternHtMiss(jf_miss_htx_and_hty, 0, 0, bx, xdata | ydata | odata); } - return 0; -} -// Get overflow -bool L1GctInternHtMiss::overflow() const { - if (type() == miss_htx || type() == miss_hty) { - return (raw() & kSingleComponentOflowMask) != 0; + /// Named ctor for making missing Ht x & y components object from emulator (wheel input). + L1GctInternHtMiss L1GctInternHtMiss::emulatorMissHtxHty(const int htx, + const int hty, + const bool overFlow, + const int16_t bx) { + int32_t xdata = (htx & kDoubleComponentHtMask); + int32_t ydata = (hty & kDoubleComponentHtMask) << kDoubleComponentHtyShift; + int32_t odata = 0; + if (overFlow || (htx >= kDoubleComponentHtMask / 2) || (htx < -kDoubleComponentHtMask / 2) || + (hty >= kDoubleComponentHtMask / 2) || (hty < -kDoubleComponentHtMask / 2)) + odata = kDoubleComponentOflowMask; + return L1GctInternHtMiss(miss_htx_and_hty, 0, 0, bx, xdata | ydata | odata); } - if (type() == miss_htx_and_hty) { - return (raw() & kDoubleComponentOflowMask) != 0; + + /// Named ctor for making missing Ht x component object from emulator + L1GctInternHtMiss L1GctInternHtMiss::emulatorMissHtx(const int htx, const bool overFlow, const int16_t bx) { + int32_t xdata = (htx & kSingleComponentHtMask); + int32_t odata = 0; + if (overFlow || (htx >= kSingleComponentHtMask / 2) || (htx < -kSingleComponentHtMask / 2)) + odata = kSingleComponentOflowMask; + return L1GctInternHtMiss(miss_htx, 0, 0, bx, xdata | odata); } - return false; -} - -// PRIVATE METHODS - -L1GctInternHtMiss::L1GctInternHtMiss(const L1GctInternHtMissType type, - const uint16_t capBlock, - const uint16_t capIndex, - const int16_t bx, - const uint32_t data) - : type_(type), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), data_(data) {} - -int16_t L1GctInternHtMiss::convert14BitTwosCompTo16Bit(const uint16_t data) const { - // If bit 13 is high, set bits 13, 14, 15 high. - if ((data & 0x2000) != 0) { - return static_cast(data | 0xe000); + + /// Named ctor for making missing Ht y component object from emulator + L1GctInternHtMiss L1GctInternHtMiss::emulatorMissHty(const int hty, const bool overFlow, const int16_t bx) { + int32_t ydata = (hty & kSingleComponentHtMask); + int32_t odata = 0; + if (overFlow || (hty >= kSingleComponentHtMask / 2) || (hty < -kSingleComponentHtMask / 2)) + odata = kSingleComponentOflowMask; + return L1GctInternHtMiss(miss_hty, 0, 0, bx, ydata | odata); } - // Else, bit 13 must be low, so set bits 13, 14, 15 low. - return static_cast(data & 0x1fff); -} + // Get Ht x-component + int16_t L1GctInternHtMiss::htx() const { + if (type() == miss_htx) { + return static_cast(raw() & kSingleComponentHtMask); + } + if (type() == miss_htx_and_hty) { + return convert14BitTwosCompTo16Bit(raw() & kDoubleComponentHtMask); + } + return 0; + } -// PRETTY PRINTOUT OPERATOR + // Get Ht y-component + int16_t L1GctInternHtMiss::hty() const { + if (type() == miss_hty) { + return static_cast(raw() & kSingleComponentHtMask); + } + if (type() == miss_htx_and_hty) { + return convert14BitTwosCompTo16Bit((raw() >> kDoubleComponentHtyShift) & kDoubleComponentHtMask); + } + return 0; + } -std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs) { - os << " L1GctInternHtMiss: htx="; - if (rhs.isThereHtx()) { - os << rhs.htx(); - } else { - os << "n/a"; + // Get overflow + bool L1GctInternHtMiss::overflow() const { + if (type() == miss_htx || type() == miss_hty) { + return (raw() & kSingleComponentOflowMask) != 0; + } + if (type() == miss_htx_and_hty) { + return (raw() & kDoubleComponentOflowMask) != 0; + } + return false; } - os << ", hty="; - if (rhs.isThereHty()) { - os << rhs.hty(); - } else { - os << "n/a"; + + // PRIVATE METHODS + + L1GctInternHtMiss::L1GctInternHtMiss(const L1GctInternHtMissType type, + const uint16_t capBlock, + const uint16_t capIndex, + const int16_t bx, + const uint32_t data) + : type_(type), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), data_(data) {} + + int16_t L1GctInternHtMiss::convert14BitTwosCompTo16Bit(const uint16_t data) const { + // If bit 13 is high, set bits 13, 14, 15 high. + if ((data & 0x2000) != 0) { + return static_cast(data | 0xe000); + } + + // Else, bit 13 must be low, so set bits 13, 14, 15 low. + return static_cast(data & 0x1fff); } - if (rhs.overflow()) { - os << "; overflow set"; + + // PRETTY PRINTOUT OPERATOR + + std::ostream& operator<<(std::ostream& os, const L1GctInternHtMiss& rhs) { + os << " L1GctInternHtMiss: htx="; + if (rhs.isThereHtx()) { + os << rhs.htx(); + } else { + os << "n/a"; + } + os << ", hty="; + if (rhs.isThereHty()) { + os << rhs.hty(); + } else { + os << "n/a"; + } + if (rhs.overflow()) { + os << "; overflow set"; + } + os << "; cap block=0x" << std::hex << rhs.capBlock() << std::dec << ", index=" << rhs.capIndex() + << ", BX=" << rhs.bx(); + return os; } - os << "; cap block=0x" << std::hex << rhs.capBlock() << std::dec << ", index=" << rhs.capIndex() - << ", BX=" << rhs.bx(); - return os; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternJetData.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternJetData.cc index 645621a2c0cd9..64f560a845ff9 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctInternJetData.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctInternJetData.cc @@ -1,157 +1,165 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctInternJetData.h" -L1GctInternJetData::L1GctInternJetData() : capBlock_(0), capIndex_(0), bx_(0), type_(null), data_(0) {} - -/// construct from individual quantities -L1GctInternJetData::L1GctInternJetData(L1CaloRegionDetId rgn, - uint16_t capBlock, - uint16_t capIndex, - int16_t bx, - uint8_t sgnEta, - uint8_t oflow, - uint16_t et, - uint8_t eta, - uint8_t phi, - uint8_t tauVeto, - uint8_t rank) - : regionId_(rgn), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), type_(null), data_(0) { - setData(sgnEta, oflow, et, eta, phi, tauVeto, rank); -} - -// 'named' constructors to avoid confusion - -// emulator calibrated jet ctor -L1GctInternJetData L1GctInternJetData::fromEmulator( - L1CaloRegionDetId rgn, int16_t bx, uint16_t et, bool oflow, bool tauVeto, uint8_t eta, uint8_t phi, uint16_t rank) { - L1GctInternJetData d; - - d.setType(emulator); - d.setRegionId(rgn); - d.setData(0, (oflow ? 1 : 0), et, eta, phi, (tauVeto ? 1 : 0), rank); - d.setBx(bx); - - return d; -} - -/// construct from "jet_cluster" -L1GctInternJetData L1GctInternJetData::fromJetCluster( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { - L1GctInternJetData d; - - d.setRegionId(rgn); - d.setCapBlock(capBlock); - d.setCapIndex(capIndex); - d.setBx(bx); - d.setType(jet_cluster); - d.setRawData(data & 0x1fffffff); - - return d; -} - -/// construct from "jet_precluster" -L1GctInternJetData L1GctInternJetData::fromJetPreCluster( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { - L1GctInternJetData d; - - d.setRegionId(rgn); - d.setCapBlock(capBlock); - d.setCapIndex(capIndex); - d.setBx(bx); - d.setType(jet_precluster); - d.setData(0, (data >> 10) & 0x1, data & 0x3ff, (data >> 12) & 0xf, 0, (data >> 11) & 0x1, 0); - - return d; -} - -/// construct from "jet_cluster_minimal" -L1GctInternJetData L1GctInternJetData::fromJetClusterMinimal( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { - L1GctInternJetData d; - - d.setRegionId(rgn); - d.setCapBlock(capBlock); - d.setCapIndex(capIndex); - d.setBx(bx); - d.setType(jet_cluster_minimal); - d.setData(0, (data >> 10) & 0x1, 0, (data >> 6) & 0xf, (data >> 12) & 0x1, (data >> 11) & 0x1, data & 0x3f); - - return d; -} - -/// construct from "gct_trig_object" -L1GctInternJetData L1GctInternJetData::fromGctTrigObject( - L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { - L1GctInternJetData d; - - d.setRegionId(rgn); - d.setCapBlock(capBlock); - d.setCapIndex(capIndex); - d.setBx(bx); - d.setType(gct_trig_object); - d.setData((data >> 10) & 0x1, 0, 0, (data >> 6) & 0xf, (data >> 11) & 0x1f, 0, data & 0x3f); - - return d; -} - -/// destructor (virtual to prevent compiler warnings) -L1GctInternJetData::~L1GctInternJetData() {} - -/// construct -void L1GctInternJetData::setData( - uint8_t sgnEta, uint8_t oflow, uint16_t et, uint8_t eta, uint8_t phi, uint8_t tauVeto, uint8_t rank) { - data_ = 0; - data_ = rank & 0x3f; - data_ |= (tauVeto & 0x1) << 6; - data_ |= (phi & 0x1f) << 7; - data_ |= (eta & 0xf) << 12; - data_ |= (et & 0xfff) << 16; - data_ |= (oflow & 0x1) << 28; - data_ |= (sgnEta & 0x1) << 29; -} - -/// operators - -/// equality operator -bool L1GctInternJetData::operator==(const L1GctInternJetData& c) const { - return (type_ == c.type() && data_ == c.raw() && regionId_ == c.regionId() && bx_ == c.bx()); -} - -/// pretty print -std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& c) { - s << "L1GctInternJetData :"; - if (c.empty()) { - s << " empty!"; +namespace io_v1 { + L1GctInternJetData::L1GctInternJetData() : capBlock_(0), capIndex_(0), bx_(0), type_(null), data_(0) {} + + /// construct from individual quantities + L1GctInternJetData::L1GctInternJetData(L1CaloRegionDetId rgn, + uint16_t capBlock, + uint16_t capIndex, + int16_t bx, + uint8_t sgnEta, + uint8_t oflow, + uint16_t et, + uint8_t eta, + uint8_t phi, + uint8_t tauVeto, + uint8_t rank) + : regionId_(rgn), capBlock_(capBlock), capIndex_(capIndex), bx_(bx), type_(null), data_(0) { + setData(sgnEta, oflow, et, eta, phi, tauVeto, rank); } - if (c.type() == L1GctInternJetData::jet_cluster) { - s << " type=jet_cluster"; - s << " oflow=" << c.oflow(); - s << " et=" << c.et(); - s << " eta=" << c.eta(); - s << " phi=" << c.phi(); - s << " tauVeto=" << c.tauVeto(); - s << " rank=" << c.rank(); - } else if (c.type() == L1GctInternJetData::jet_precluster) { - s << " type=jet_precluster"; - s << " oflow=" << c.oflow(); - s << " et=" << c.et(); - s << " eta=" << c.eta(); - s << " tauVeto=" << c.tauVeto(); - } else if (c.type() == L1GctInternJetData::jet_cluster_minimal) { - s << " type=jet_cluster_minimal"; - s << " oflow=" << c.oflow(); - s << " eta=" << c.eta(); - s << " phi=" << c.phi(); - s << " tauVeto=" << c.tauVeto(); - s << " rank=" << c.rank(); - } else if (c.type() == L1GctInternJetData::gct_trig_object) { - s << " type=gct_trig_object"; - s << " eta=" << c.eta(); - s << " phi=" << c.phi(); - s << " rank=" << c.rank(); + + // 'named' constructors to avoid confusion + + // emulator calibrated jet ctor + L1GctInternJetData L1GctInternJetData::fromEmulator(L1CaloRegionDetId rgn, + int16_t bx, + uint16_t et, + bool oflow, + bool tauVeto, + uint8_t eta, + uint8_t phi, + uint16_t rank) { + L1GctInternJetData d; + + d.setType(emulator); + d.setRegionId(rgn); + d.setData(0, (oflow ? 1 : 0), et, eta, phi, (tauVeto ? 1 : 0), rank); + d.setBx(bx); + + return d; + } + + /// construct from "jet_cluster" + L1GctInternJetData L1GctInternJetData::fromJetCluster( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { + L1GctInternJetData d; + + d.setRegionId(rgn); + d.setCapBlock(capBlock); + d.setCapIndex(capIndex); + d.setBx(bx); + d.setType(jet_cluster); + d.setRawData(data & 0x1fffffff); + + return d; + } + + /// construct from "jet_precluster" + L1GctInternJetData L1GctInternJetData::fromJetPreCluster( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { + L1GctInternJetData d; + + d.setRegionId(rgn); + d.setCapBlock(capBlock); + d.setCapIndex(capIndex); + d.setBx(bx); + d.setType(jet_precluster); + d.setData(0, (data >> 10) & 0x1, data & 0x3ff, (data >> 12) & 0xf, 0, (data >> 11) & 0x1, 0); + + return d; } - s << " cap block=" << std::hex << c.capBlock(); - s << " index=" << std::dec << c.capIndex(); - s << " BX=" << c.bx(); - return s; -} + /// construct from "jet_cluster_minimal" + L1GctInternJetData L1GctInternJetData::fromJetClusterMinimal( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { + L1GctInternJetData d; + + d.setRegionId(rgn); + d.setCapBlock(capBlock); + d.setCapIndex(capIndex); + d.setBx(bx); + d.setType(jet_cluster_minimal); + d.setData(0, (data >> 10) & 0x1, 0, (data >> 6) & 0xf, (data >> 12) & 0x1, (data >> 11) & 0x1, data & 0x3f); + + return d; + } + + /// construct from "gct_trig_object" + L1GctInternJetData L1GctInternJetData::fromGctTrigObject( + L1CaloRegionDetId rgn, uint16_t capBlock, uint16_t capIndex, int16_t bx, uint32_t data) { + L1GctInternJetData d; + + d.setRegionId(rgn); + d.setCapBlock(capBlock); + d.setCapIndex(capIndex); + d.setBx(bx); + d.setType(gct_trig_object); + d.setData((data >> 10) & 0x1, 0, 0, (data >> 6) & 0xf, (data >> 11) & 0x1f, 0, data & 0x3f); + + return d; + } + + /// destructor (virtual to prevent compiler warnings) + L1GctInternJetData::~L1GctInternJetData() {} + + /// construct + void L1GctInternJetData::setData( + uint8_t sgnEta, uint8_t oflow, uint16_t et, uint8_t eta, uint8_t phi, uint8_t tauVeto, uint8_t rank) { + data_ = 0; + data_ = rank & 0x3f; + data_ |= (tauVeto & 0x1) << 6; + data_ |= (phi & 0x1f) << 7; + data_ |= (eta & 0xf) << 12; + data_ |= (et & 0xfff) << 16; + data_ |= (oflow & 0x1) << 28; + data_ |= (sgnEta & 0x1) << 29; + } + + /// operators + + /// equality operator + bool L1GctInternJetData::operator==(const L1GctInternJetData& c) const { + return (type_ == c.type() && data_ == c.raw() && regionId_ == c.regionId() && bx_ == c.bx()); + } + + /// pretty print + std::ostream& operator<<(std::ostream& s, const L1GctInternJetData& c) { + s << "L1GctInternJetData :"; + if (c.empty()) { + s << " empty!"; + } + if (c.type() == L1GctInternJetData::jet_cluster) { + s << " type=jet_cluster"; + s << " oflow=" << c.oflow(); + s << " et=" << c.et(); + s << " eta=" << c.eta(); + s << " phi=" << c.phi(); + s << " tauVeto=" << c.tauVeto(); + s << " rank=" << c.rank(); + } else if (c.type() == L1GctInternJetData::jet_precluster) { + s << " type=jet_precluster"; + s << " oflow=" << c.oflow(); + s << " et=" << c.et(); + s << " eta=" << c.eta(); + s << " tauVeto=" << c.tauVeto(); + } else if (c.type() == L1GctInternJetData::jet_cluster_minimal) { + s << " type=jet_cluster_minimal"; + s << " oflow=" << c.oflow(); + s << " eta=" << c.eta(); + s << " phi=" << c.phi(); + s << " tauVeto=" << c.tauVeto(); + s << " rank=" << c.rank(); + } else if (c.type() == L1GctInternJetData::gct_trig_object) { + s << " type=gct_trig_object"; + s << " eta=" << c.eta(); + s << " phi=" << c.phi(); + s << " rank=" << c.rank(); + } + s << " cap block=" << std::hex << c.capBlock(); + s << " index=" << std::dec << c.capIndex(); + s << " BX=" << c.bx(); + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCand.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCand.cc index 1c4154b28e571..716d8b1633bdd 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCand.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCand.cc @@ -7,94 +7,96 @@ using std::hex; using std::ostream; using std::string; -L1GctJetCand::L1GctJetCand() - : m_data(0), m_isTau(false), m_isFor(false), m_captureBlock(0), m_captureIndex(0), m_bx(0) {} +namespace io_v1 { + L1GctJetCand::L1GctJetCand() + : m_data(0), m_isTau(false), m_isFor(false), m_captureBlock(0), m_captureIndex(0), m_bx(0) {} -//constructor for GT -L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor) - : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored - m_isTau(isTau), - m_isFor(isFor), - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) {} + //constructor for GT + L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor) + : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored + m_isTau(isTau), + m_isFor(isFor), + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) {} -//constructor for GCT unpacker -L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx) - : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored - m_isTau(isTau), - m_isFor(isFor), - m_captureBlock(block & 0xfff), - m_captureIndex(index & 0xff), - m_bx(bx) {} + //constructor for GCT unpacker + L1GctJetCand::L1GctJetCand(uint16_t rawData, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx) + : m_data(rawData & 0x7fff), // 0x7fff is to mask off bit 15, which is not data that needs to be stored + m_isTau(isTau), + m_isFor(isFor), + m_captureBlock(block & 0xfff), + m_captureIndex(index & 0xff), + m_bx(bx) {} -// constructor for use in emulator -// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z -L1GctJetCand::L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor) - : m_data(0), // overridden below - m_isTau(isTau), - m_isFor(isFor), - m_captureBlock(0), - m_captureIndex(0), - m_bx(0) { - m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10); -} + // constructor for use in emulator + // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctJetCand::L1GctJetCand(unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor) + : m_data(0), // overridden below + m_isTau(isTau), + m_isFor(isFor), + m_captureBlock(0), + m_captureIndex(0), + m_bx(0) { + m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10); + } -// constructor for use in emulator -// eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z -L1GctJetCand::L1GctJetCand( - unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx) - : m_data(0), // overridden below - m_isTau(isTau), - m_isFor(isFor), - m_captureBlock(block & 0xfff), - m_captureIndex(index & 0xff), - m_bx(bx) { - m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10); -} + // constructor for use in emulator + // eta = -6 to -0, +0 to +6. Sign is bit 3, 1 means -ve Z, 0 means +ve Z + L1GctJetCand::L1GctJetCand( + unsigned rank, unsigned phi, unsigned eta, bool isTau, bool isFor, uint16_t block, uint16_t index, int16_t bx) + : m_data(0), // overridden below + m_isTau(isTau), + m_isFor(isFor), + m_captureBlock(block & 0xfff), + m_captureIndex(index & 0xff), + m_bx(bx) { + m_data = (rank & 0x3f) + ((eta & 0xf) << 6) + ((phi & 0x1f) << 10); + } -L1GctJetCand::~L1GctJetCand() {} + L1GctJetCand::~L1GctJetCand() {} -// return name -string L1GctJetCand::name() const { - if (m_isTau) { - return "tau jet"; - } else if (m_isFor) { - return "forward jet"; - } else { - return "central jet"; + // return name + string L1GctJetCand::name() const { + if (m_isTau) { + return "tau jet"; + } else if (m_isFor) { + return "forward jet"; + } else { + return "central jet"; + } } -} -// pretty print -ostream& operator<<(ostream& s, const L1GctJetCand& cand) { - if (cand.empty()) { - s << "L1GctJetCand empty jet"; - } else { - s << "L1GctJetCand : "; - s << "rank=" << cand.rank(); - s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0x7) << ", phi=" << cand.phiIndex(); - s << " type="; - if (cand.isTau()) { - s << "tau"; - } else if (cand.isForward()) { - s << "forward"; + // pretty print + ostream& operator<<(ostream& s, const L1GctJetCand& cand) { + if (cand.empty()) { + s << "L1GctJetCand empty jet"; } else { - s << "central"; + s << "L1GctJetCand : "; + s << "rank=" << cand.rank(); + s << ", etaSign=" << cand.etaSign() << ", eta=" << (cand.etaIndex() & 0x7) << ", phi=" << cand.phiIndex(); + s << " type="; + if (cand.isTau()) { + s << "tau"; + } else if (cand.isForward()) { + s << "forward"; + } else { + s << "central"; + } } + s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx(); + return s; } - s << hex << " cap block=" << cand.capBlock() << dec << ", index=" << cand.capIndex() << ", BX=" << cand.bx(); - return s; -} -L1CaloRegionDetId L1GctJetCand::regionId() const { - // get global eta - unsigned eta; - if (!isForward()) { - eta = (etaSign() == 1 ? 10 - (etaIndex() & 0x7) : (etaIndex() & 0x7) + 11); - } else { - eta = (etaSign() == 1 ? 3 - (etaIndex() & 0x7) : (etaIndex() & 0x7) + 18); - } + L1CaloRegionDetId L1GctJetCand::regionId() const { + // get global eta + unsigned eta; + if (!isForward()) { + eta = (etaSign() == 1 ? 10 - (etaIndex() & 0x7) : (etaIndex() & 0x7) + 11); + } else { + eta = (etaSign() == 1 ? 3 - (etaIndex() & 0x7) : (etaIndex() & 0x7) + 18); + } - return L1CaloRegionDetId(eta, phiIndex()); -} + return L1CaloRegionDetId(eta, phiIndex()); + } +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCounts.cc b/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCounts.cc index bb1e89e4c3b43..08de30d83c8cd 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCounts.cc +++ b/DataFormats/L1GlobalCaloTrigger/src/L1GctJetCounts.cc @@ -5,76 +5,78 @@ using std::endl; using std::ostream; using std::vector; -/// static maximum number of jet counts -/// This can be up to 12 but we use some of the -/// available bandwidth for other information. -const unsigned L1GctJetCounts::MAX_TOTAL_COUNTS = 12; -/// MAX_TRUE_COUNTS specifies the bandwidth remaining -/// for real jet count information. -const unsigned L1GctJetCounts::MAX_TRUE_COUNTS = 6; +namespace io_v1 { + /// static maximum number of jet counts + /// This can be up to 12 but we use some of the + /// available bandwidth for other information. + const unsigned L1GctJetCounts::MAX_TOTAL_COUNTS = 12; + /// MAX_TRUE_COUNTS specifies the bandwidth remaining + /// for real jet count information. + const unsigned L1GctJetCounts::MAX_TRUE_COUNTS = 6; -// default constructor -L1GctJetCounts::L1GctJetCounts() : m_data0(0), m_data1(0), m_bx(0) {} + // default constructor + L1GctJetCounts::L1GctJetCounts() : m_data0(0), m_data1(0), m_bx(0) {} -// constructor for unpacking -L1GctJetCounts::L1GctJetCounts(uint32_t data0, uint32_t data1) - : m_data0(data0 & 0x7fff7fff), // Mask off bits 15 and 31 for better compression and consistency - m_data1(data1 & 0x7fff7fff), // with emulator constructor - these bits are not jet count data! - m_bx(0) {} + // constructor for unpacking + L1GctJetCounts::L1GctJetCounts(uint32_t data0, uint32_t data1) + : m_data0(data0 & 0x7fff7fff), // Mask off bits 15 and 31 for better compression and consistency + m_data1(data1 & 0x7fff7fff), // with emulator constructor - these bits are not jet count data! + m_bx(0) {} -// constructor for unpacking -L1GctJetCounts::L1GctJetCounts(uint32_t data0, uint32_t data1, int16_t bx) - : m_data0(data0 & 0x7fff7fff), // Mask off bits 15 and 31 for better compression and consistency - m_data1(data1 & 0x7fff7fff), // with emulator constructor - these bits are not jet count data! - m_bx(bx) {} + // constructor for unpacking + L1GctJetCounts::L1GctJetCounts(uint32_t data0, uint32_t data1, int16_t bx) + : m_data0(data0 & 0x7fff7fff), // Mask off bits 15 and 31 for better compression and consistency + m_data1(data1 & 0x7fff7fff), // with emulator constructor - these bits are not jet count data! + m_bx(bx) {} -// constructor for emulator -L1GctJetCounts::L1GctJetCounts(const std::vector& counts) : m_data0(0), m_data1(0), m_bx(0) { - // Assumes all required output data has been packed - // into 12 5-bit fields - if (counts.size() != MAX_TOTAL_COUNTS) { - } else { - for (unsigned int i = 0; i < 3; ++i) { - m_data0 += (counts[i] << (5 * i)); - m_data0 += (counts[i + 3] << (5 * i + 16)); - m_data1 += (counts[i + 6] << (5 * i)); - m_data1 += (counts[i + 9] << (5 * i + 16)); + // constructor for emulator + L1GctJetCounts::L1GctJetCounts(const std::vector& counts) : m_data0(0), m_data1(0), m_bx(0) { + // Assumes all required output data has been packed + // into 12 5-bit fields + if (counts.size() != MAX_TOTAL_COUNTS) { + } else { + for (unsigned int i = 0; i < 3; ++i) { + m_data0 += (counts[i] << (5 * i)); + m_data0 += (counts[i + 3] << (5 * i + 16)); + m_data1 += (counts[i + 6] << (5 * i)); + m_data1 += (counts[i + 9] << (5 * i + 16)); + } } } -} -// constructor for emulator -L1GctJetCounts::L1GctJetCounts(const std::vector& counts, int16_t bx) : m_data0(0), m_data1(0), m_bx(bx) { - if (counts.size() != MAX_TOTAL_COUNTS) { - } else { - for (unsigned int i = 0; i < 3; ++i) { - m_data0 += (counts[i] << (5 * i)); - m_data0 += (counts[i + 3] << (5 * i + 16)); - m_data1 += (counts[i + 6] << (5 * i)); - m_data1 += (counts[i + 9] << (5 * i + 16)); + // constructor for emulator + L1GctJetCounts::L1GctJetCounts(const std::vector& counts, int16_t bx) : m_data0(0), m_data1(0), m_bx(bx) { + if (counts.size() != MAX_TOTAL_COUNTS) { + } else { + for (unsigned int i = 0; i < 3; ++i) { + m_data0 += (counts[i] << (5 * i)); + m_data0 += (counts[i + 3] << (5 * i + 16)); + m_data1 += (counts[i + 6] << (5 * i)); + m_data1 += (counts[i + 9] << (5 * i + 16)); + } } } -} -// destructor -L1GctJetCounts::~L1GctJetCounts() {} + // destructor + L1GctJetCounts::~L1GctJetCounts() {} -// return counts by index -unsigned L1GctJetCounts::count(unsigned i) const { - if (i < 6) { - return ((m_data0 >> (i < 3 ? (5 * i) : ((5 * i) + 1))) & 0x1f); - } else if (i < MAX_TOTAL_COUNTS) { - return ((m_data1 >> (i < 9 ? ((5 * i) - 30) : ((5 * i) - 29))) & 0x1f); - } else { - return 0; + // return counts by index + unsigned L1GctJetCounts::count(unsigned i) const { + if (i < 6) { + return ((m_data0 >> (i < 3 ? (5 * i) : ((5 * i) + 1))) & 0x1f); + } else if (i < MAX_TOTAL_COUNTS) { + return ((m_data1 >> (i < 9 ? ((5 * i) - 30) : ((5 * i) - 29))) & 0x1f); + } else { + return 0; + } } -} -// pretty print -ostream& operator<<(ostream& s, const L1GctJetCounts& c) { - s << "L1GctJetCounts : "; - for (unsigned int i = 0; i < 12; ++i) { - s << "\n count " << i << "=" << c.count(i); + // pretty print + ostream& operator<<(ostream& s, const L1GctJetCounts& c) { + s << "L1GctJetCounts : "; + for (unsigned int i = 0; i < 12; ++i) { + s << "\n count " << i << "=" << c.count(i); + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml b/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml index 6784870eef0bc..eb217eb1628cf 100644 --- a/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml +++ b/DataFormats/L1GlobalCaloTrigger/src/classes_def.xml @@ -1,99 +1,93 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h index 16bafbb39e04d..79157eed59606 100644 --- a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h +++ b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCand.h @@ -36,214 +36,216 @@ // -- Class Interface -- // --------------------- -class L1MuGMTCand { -public: - /// constructor - L1MuGMTCand(); +namespace io_v1 { + class L1MuGMTCand { + public: + /// constructor + L1MuGMTCand(); - /// constructor from dataword - L1MuGMTCand(unsigned data, int bx = 0); + /// constructor from dataword + L1MuGMTCand(unsigned data, int bx = 0); - /// copy constructor - L1MuGMTCand(const L1MuGMTCand&); + /// copy constructor + L1MuGMTCand(const L1MuGMTCand&); - /// assignment operator - L1MuGMTCand& operator=(const L1MuGMTCand&) = default; + /// assignment operator + L1MuGMTCand& operator=(const L1MuGMTCand&) = default; - /// destructor - virtual ~L1MuGMTCand(); + /// destructor + virtual ~L1MuGMTCand(); - /// reset muon candidate - void reset(); + /// reset muon candidate + void reset(); - // - // Getters - // + // + // Getters + // - /// is it an empty muon candidate? - bool empty() const { return readDataField(PT_START, PT_LENGTH) == 0; } + /// is it an empty muon candidate? + bool empty() const { return readDataField(PT_START, PT_LENGTH) == 0; } - /// get muon data word - unsigned getDataWord() const { return m_dataWord; } + /// get muon data word + unsigned getDataWord() const { return m_dataWord; } - /// get name of object - std::string name() const { return m_name; } + /// get name of object + std::string name() const { return m_name; } - /// get phi-code - unsigned int phiIndex() const { return readDataField(PHI_START, PHI_LENGTH); } + /// get phi-code + unsigned int phiIndex() const { return readDataField(PHI_START, PHI_LENGTH); } - /// get pt-code - unsigned int ptIndex() const { return readDataField(PT_START, PT_LENGTH); } + /// get pt-code + unsigned int ptIndex() const { return readDataField(PT_START, PT_LENGTH); } - /// get quality + /// get quality - /// Quality codes: - /// - /// 0 .. no muon - /// 1 .. beam halo muon (CSC) - /// 2 .. very low quality level 1 (e.g. ignore in single and di-muon trigger) - /// 3 .. very low quality level 2 (e.g. ignore in single muon trigger use in di-muon trigger) - /// 4 .. very low quality level 3 (e.g. ignore in di-muon trigger, use in single-muon trigger) - /// 5 .. unmatched RPC - /// 6 .. unmatched DT or CSC - /// 7 .. matched DT-RPC or CSC-RPC - /// - /// attention: try not to rely on quality codes in analysis: they may change again - /// - unsigned int quality() const { return readDataField(QUAL_START, QUAL_LENGTH); } + /// Quality codes: + /// + /// 0 .. no muon + /// 1 .. beam halo muon (CSC) + /// 2 .. very low quality level 1 (e.g. ignore in single and di-muon trigger) + /// 3 .. very low quality level 2 (e.g. ignore in single muon trigger use in di-muon trigger) + /// 4 .. very low quality level 3 (e.g. ignore in di-muon trigger, use in single-muon trigger) + /// 5 .. unmatched RPC + /// 6 .. unmatched DT or CSC + /// 7 .. matched DT-RPC or CSC-RPC + /// + /// attention: try not to rely on quality codes in analysis: they may change again + /// + unsigned int quality() const { return readDataField(QUAL_START, QUAL_LENGTH); } - /// interpretation of quality code: is the candidate to be used in a single muon trigger ? - bool useInSingleMuonTrigger() const { return quality() >= 4; }; + /// interpretation of quality code: is the candidate to be used in a single muon trigger ? + bool useInSingleMuonTrigger() const { return quality() >= 4; }; - /// interpretation of quality code: is the candidate to be used in a di-muon trigger ? - bool useInDiMuonTrigger() const { return (quality() >= 3) && (quality() != 4); }; + /// interpretation of quality code: is the candidate to be used in a di-muon trigger ? + bool useInDiMuonTrigger() const { return (quality() >= 3) && (quality() != 4); }; - /// interpretation of quality code: is the candidate a matched candidate ? - bool isMatchedCand() const { return quality() == 7; } + /// interpretation of quality code: is the candidate a matched candidate ? + bool isMatchedCand() const { return quality() == 7; } - /// interpretation of quality code: is the candidate a beam halo muon ? - bool isHaloCand() const { return quality() == 1; } + /// interpretation of quality code: is the candidate a beam halo muon ? + bool isHaloCand() const { return quality() == 1; } - /// get eta-code - unsigned int etaIndex() const { return readDataField(ETA_START, ETA_LENGTH); } + /// get eta-code + unsigned int etaIndex() const { return readDataField(ETA_START, ETA_LENGTH); } - /// get charge/synchronization word (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) - unsigned sysign() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH); } + /// get charge/synchronization word (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) + unsigned sysign() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH); } - /// get isolation - bool isol() const { return readDataField(ISO_START, ISO_LENGTH) == 1; } + /// get isolation + bool isol() const { return readDataField(ISO_START, ISO_LENGTH) == 1; } - /// get mip - bool mip() const { return readDataField(MIP_START, MIP_LENGTH) == 1; } + /// get mip + bool mip() const { return readDataField(MIP_START, MIP_LENGTH) == 1; } - /// get bunch crossing identifier - int bx() const { return m_bx; } + /// get bunch crossing identifier + int bx() const { return m_bx; } - /// get phi-value of muon candidate in radians (low edge of bin) - /// this functionality will be moved to an extra Producer - float phiValue() const; + /// get phi-value of muon candidate in radians (low edge of bin) + /// this functionality will be moved to an extra Producer + float phiValue() const; - /// get eta-value of muon candidate - /// this functionality will be moved to an extra Producer - float etaValue() const; + /// get eta-value of muon candidate + /// this functionality will be moved to an extra Producer + float etaValue() const; - /// get pt-value of muon candidate in GeV - /// this functionality will be moved to an extra Producer - float ptValue() const; + /// get pt-value of muon candidate in GeV + /// this functionality will be moved to an extra Producer + float ptValue() const; - /// get charge (+1 -1) - int charge() const { return (readDataField(SYSIGN_START, SYSIGN_LENGTH) & 1) == 0 ? 1 : -1; } + /// get charge (+1 -1) + int charge() const { return (readDataField(SYSIGN_START, SYSIGN_LENGTH) & 1) == 0 ? 1 : -1; } - /// is the charge valid ? - bool charge_valid() const { - unsigned sysign = readDataField(SYSIGN_START, SYSIGN_LENGTH); - return (sysign == 0 || sysign == 1); - } - - /// is the candidate a sync word - bool isSyncWord() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH) == 3; } + /// is the charge valid ? + bool charge_valid() const { + unsigned sysign = readDataField(SYSIGN_START, SYSIGN_LENGTH); + return (sysign == 0 || sysign == 1); + } - /// - /// Setters - /// + /// is the candidate a sync word + bool isSyncWord() const { return readDataField(SYSIGN_START, SYSIGN_LENGTH) == 3; } - /// set packed phi-code of muon candidate - void setPhiPacked(unsigned phi) { writeDataField(PHI_START, PHI_LENGTH, phi); } + /// + /// Setters + /// - /// set packed pt-code of muon candidate - void setPtPacked(unsigned pt) { writeDataField(PT_START, PT_LENGTH, pt); } + /// set packed phi-code of muon candidate + void setPhiPacked(unsigned phi) { writeDataField(PHI_START, PHI_LENGTH, phi); } - /// set quality of muon candidate - void setQuality(unsigned quality) { writeDataField(QUAL_START, QUAL_LENGTH, quality); } + /// set packed pt-code of muon candidate + void setPtPacked(unsigned pt) { writeDataField(PT_START, PT_LENGTH, pt); } - /// set packed eta-code of muon candidate - void setEtaPacked(unsigned eta) { writeDataField(ETA_START, ETA_LENGTH, eta); } + /// set quality of muon candidate + void setQuality(unsigned quality) { writeDataField(QUAL_START, QUAL_LENGTH, quality); } - /// set isolation of muon candidate - void setIsolation(bool isol) { writeDataField(ISO_START, ISO_LENGTH, isol ? 1 : 0); } + /// set packed eta-code of muon candidate + void setEtaPacked(unsigned eta) { writeDataField(ETA_START, ETA_LENGTH, eta); } - /// set min ionizing bit for muon candidate - void setMIP(bool mip) { writeDataField(MIP_START, MIP_LENGTH, mip ? 1 : 0); } + /// set isolation of muon candidate + void setIsolation(bool isol) { writeDataField(ISO_START, ISO_LENGTH, isol ? 1 : 0); } - /// set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) - void setChargePacked(unsigned ch) { writeDataField(SYSIGN_START, SYSIGN_LENGTH, ch); } + /// set min ionizing bit for muon candidate + void setMIP(bool mip) { writeDataField(MIP_START, MIP_LENGTH, mip ? 1 : 0); } - /// set bunch crossing identifier - void setBx(int bx) { m_bx = bx; } + /// set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) + void setChargePacked(unsigned ch) { writeDataField(SYSIGN_START, SYSIGN_LENGTH, ch); } - /// Setters for physical values + /// set bunch crossing identifier + void setBx(int bx) { m_bx = bx; } - /// Set Phi Value - void setPhiValue(float phiVal) { m_phiValue = phiVal; } + /// Setters for physical values - /// Set Pt Value - void setPtValue(float ptVal) { m_ptValue = ptVal; } + /// Set Phi Value + void setPhiValue(float phiVal) { m_phiValue = phiVal; } - /// Set Eta Value (need to set type, first) - void setEtaValue(float etaVal) { m_etaValue = etaVal; } + /// Set Pt Value + void setPtValue(float ptVal) { m_ptValue = ptVal; } - // - // Other - // + /// Set Eta Value (need to set type, first) + void setEtaValue(float etaVal) { m_etaValue = etaVal; } - unsigned int linearizedPt(float lsbValue, unsigned maxScale) const { return 0; } + // + // Other + // - unsigned int etaRegionIndex() const { return etaIndex(); } + unsigned int linearizedPt(float lsbValue, unsigned maxScale) const { return 0; } - unsigned int phiRegionIndex() const { return phiIndex(); } + unsigned int etaRegionIndex() const { return etaIndex(); } - /// equal operator - bool operator==(const L1MuGMTCand&) const; + unsigned int phiRegionIndex() const { return phiIndex(); } - /// unequal operator - bool operator!=(const L1MuGMTCand&) const; + /// equal operator + bool operator==(const L1MuGMTCand&) const; - /// print parameters of muon candidate - void print() const; + /// unequal operator + bool operator!=(const L1MuGMTCand&) const; - /// output stream operator - friend std::ostream& operator<<(std::ostream&, const L1MuGMTCand&); + /// print parameters of muon candidate + void print() const; -protected: -protected: - inline unsigned readDataField(unsigned start, unsigned count) const; - inline void writeDataField(unsigned start, unsigned count, unsigned value); + /// output stream operator + friend std::ostream& operator<<(std::ostream&, const L1MuGMTCand&); - std::string m_name; - int m_bx; // in here only for technical reasons in simulation - unsigned m_dataWord; // muon data word (26 bits) : + protected: + protected: + inline unsigned readDataField(unsigned start, unsigned count) const; + inline void writeDataField(unsigned start, unsigned count, unsigned value); - float m_phiValue; - float m_etaValue; - float m_ptValue; - static const float m_invalidValue; + std::string m_name; + int m_bx; // in here only for technical reasons in simulation + unsigned m_dataWord; // muon data word (26 bits) : - // definition of the bit fields - enum { PHI_START = 0 }; - enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits) - enum { PT_START = 8 }; - enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits) - enum { QUAL_START = 13 }; - enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits) - enum { ETA_START = 16 }; - enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits) - enum { ISO_START = 22 }; - enum { ISO_LENGTH = 1 }; // Bit 22 Isolation - enum { MIP_START = 23 }; - enum { MIP_LENGTH = 1 }; // Bit 23 MIP - enum { SYSIGN_START = 24 }; - enum { SYSIGN_LENGTH = 2 }; // Bit 24:25 Charge/Syncword -}; + float m_phiValue; + float m_etaValue; + float m_ptValue; + static const float m_invalidValue; -unsigned L1MuGMTCand::readDataField(unsigned start, unsigned count) const { - unsigned mask = ((1 << count) - 1) << start; - return (m_dataWord & mask) >> start; -} + // definition of the bit fields + enum { PHI_START = 0 }; + enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits) + enum { PT_START = 8 }; + enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits) + enum { QUAL_START = 13 }; + enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits) + enum { ETA_START = 16 }; + enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits) + enum { ISO_START = 22 }; + enum { ISO_LENGTH = 1 }; // Bit 22 Isolation + enum { MIP_START = 23 }; + enum { MIP_LENGTH = 1 }; // Bit 23 MIP + enum { SYSIGN_START = 24 }; + enum { SYSIGN_LENGTH = 2 }; // Bit 24:25 Charge/Syncword + }; -void L1MuGMTCand::writeDataField(unsigned start, unsigned count, unsigned value) { - unsigned mask = ((1 << count) - 1) << start; - m_dataWord &= ~mask; // clear - m_dataWord |= (value << start) & mask; -} + inline unsigned L1MuGMTCand::readDataField(unsigned start, unsigned count) const { + unsigned mask = ((1 << count) - 1) << start; + return (m_dataWord & mask) >> start; + } + inline void L1MuGMTCand::writeDataField(unsigned start, unsigned count, unsigned value) { + unsigned mask = ((1 << count) - 1) << start; + m_dataWord &= ~mask; // clear + m_dataWord |= (value << start) & mask; + } +} // namespace io_v1 +using L1MuGMTCand = io_v1::L1MuGMTCand; #endif diff --git a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCandFwd.h b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCandFwd.h index f4f15b569edac..2f7ccb677cc69 100644 --- a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCandFwd.h +++ b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCandFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalMuonTrigger_L1MuGMTCandFwd_h #define DataFormats_L1GlobalMuonTrigger_L1MuGMTCandFwd_h -class L1MuGMTCand; - +namespace io_v1 { + class L1MuGMTCand; +} +using L1MuGMTCand = io_v1::L1MuGMTCand; #endif diff --git a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h index 5edccc1e1bbfa..be87a514a07ce 100644 --- a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h +++ b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h @@ -36,38 +36,41 @@ //-- Class Interface -- //--------------------- -class L1MuGMTReadoutCollection { -public: - L1MuGMTReadoutCollection() {} - L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); } +namespace io_v1 { + class L1MuGMTReadoutCollection { + public: + L1MuGMTReadoutCollection() {} + L1MuGMTReadoutCollection(int nbx) { m_Records.reserve(nbx); } - virtual ~L1MuGMTReadoutCollection() {} + virtual ~L1MuGMTReadoutCollection() {} - void reset() { - for (unsigned int i = 0; i < m_Records.size(); i++) - m_Records[i].reset(); - }; + void reset() { + for (unsigned int i = 0; i < m_Records.size(); i++) + m_Records[i].reset(); + }; - // get record vector - std::vector const& getRecords() const { return m_Records; }; + // get record vector + std::vector const& getRecords() const { return m_Records; }; - // get record for a given bx - L1MuGMTReadoutRecord const& getRecord(int bx = 0) const { - std::vector::const_iterator iter; - for (iter = m_Records.begin(); iter != m_Records.end(); iter++) { - if ((*iter).getBxCounter() == bx) - return (*iter); - } - return getDefaultFor(bx); - }; + // get record for a given bx + L1MuGMTReadoutRecord const& getRecord(int bx = 0) const { + std::vector::const_iterator iter; + for (iter = m_Records.begin(); iter != m_Records.end(); iter++) { + if ((*iter).getBxCounter() == bx) + return (*iter); + } + return getDefaultFor(bx); + }; - // add record - void addRecord(L1MuGMTReadoutRecord const& rec) { m_Records.push_back(rec); }; + // add record + void addRecord(L1MuGMTReadoutRecord const& rec) { m_Records.push_back(rec); }; -private: - static L1MuGMTReadoutRecord const& getDefaultFor(int bx); + private: + static L1MuGMTReadoutRecord const& getDefaultFor(int bx); - std::vector m_Records; -}; + std::vector m_Records; + }; +} // namespace io_v1 +using L1MuGMTReadoutCollection = io_v1::L1MuGMTReadoutCollection; #endif // DataFormatsL1GlobalMuonTrigger_L1MuGMTReadoutCollection_h diff --git a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollectionFwd.h b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollectionFwd.h index 9c4dd26e23a1c..d806651a0c7a0 100644 --- a/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollectionFwd.h +++ b/DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollectionFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalMuonTrigger_L1MuGMTReadoutCollectionFwd_h #define DataFormats_L1GlobalMuonTrigger_L1MuGMTReadoutCollectionFwd_h -class L1MuGMTReadoutCollection; - +namespace io_v1 { + class L1MuGMTReadoutCollection; +} +using L1MuGMTReadoutCollection = io_v1::L1MuGMTReadoutCollection; #endif diff --git a/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h b/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h index 5c58c95f1e95c..10c42bc154b04 100644 --- a/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h +++ b/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h @@ -23,184 +23,187 @@ // -- Class Interface -- // --------------------- -class L1MuRegionalCand { -public: - /// constructor from data word - L1MuRegionalCand(unsigned dataword = 0, int bx = 0); +namespace io_v1 { + class L1MuRegionalCand { + public: + /// constructor from data word + L1MuRegionalCand(unsigned dataword = 0, int bx = 0); - /// constructor from packed members - L1MuRegionalCand(unsigned type_idx, - unsigned phi, - unsigned eta, - unsigned pt, - unsigned charge, - unsigned ch_valid, - unsigned finehalo, - unsigned quality, - int bx); + /// constructor from packed members + L1MuRegionalCand(unsigned type_idx, + unsigned phi, + unsigned eta, + unsigned pt, + unsigned charge, + unsigned ch_valid, + unsigned finehalo, + unsigned quality, + int bx); - /// destructor - virtual ~L1MuRegionalCand() {} + /// destructor + virtual ~L1MuRegionalCand() {} - /// - /// Getters - values - /// + /// + /// Getters - values + /// - /// return empty flag - virtual bool empty() const { - return (readDataField(PT_START, PT_LENGTH) == 0) || (readDataField(PHI_START, PHI_LENGTH) == 0xff); - } + /// return empty flag + virtual bool empty() const { + return (readDataField(PT_START, PT_LENGTH) == 0) || (readDataField(PHI_START, PHI_LENGTH) == 0xff); + } - /// get phi-value of muon candidate in radians (low edge of bin) - float phiValue() const; + /// get phi-value of muon candidate in radians (low edge of bin) + float phiValue() const; - /// get eta-value of muon candidate - float etaValue() const; + /// get eta-value of muon candidate + float etaValue() const; - /// get pt-value of muon candidate in GeV - float ptValue() const; + /// get pt-value of muon candidate in GeV + float ptValue() const; - /// get charge - int chargeValue() const { return readDataField(CHARGE_START, CHARGE_LENGTH) == 0 ? 1 : -1; } + /// get charge + int chargeValue() const { return readDataField(CHARGE_START, CHARGE_LENGTH) == 0 ? 1 : -1; } - /// is the charge valid ? - bool chargeValid() const { return charge_valid_packed() == 1; } + /// is the charge valid ? + bool chargeValid() const { return charge_valid_packed() == 1; } - /// is it fine (DT) / halo (CSC) ? - bool isFineHalo() const { return finehalo_packed() == 1; } + /// is it fine (DT) / halo (CSC) ? + bool isFineHalo() const { return finehalo_packed() == 1; } - /// return quality - unsigned int quality() const { return quality_packed(); } + /// return quality + unsigned int quality() const { return quality_packed(); } - /// return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC - unsigned type_idx() const { return (int)readDataField(TYPE_START, TYPE_LENGTH); }; + /// return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC + unsigned type_idx() const { return (int)readDataField(TYPE_START, TYPE_LENGTH); }; - /// return bunch crossing identifier - int bx() const { return m_bx; } + /// return bunch crossing identifier + int bx() const { return m_bx; } - /// - /// Getters - packed format - /// + /// + /// Getters - packed format + /// - /// return phi packed as in hardware - unsigned phi_packed() const { return readDataField(PHI_START, PHI_LENGTH); } + /// return phi packed as in hardware + unsigned phi_packed() const { return readDataField(PHI_START, PHI_LENGTH); } - /// return pt packed as in hardware - unsigned pt_packed() const { return readDataField(PT_START, PT_LENGTH); } + /// return pt packed as in hardware + unsigned pt_packed() const { return readDataField(PT_START, PT_LENGTH); } - /// return quality packed as in hardware - unsigned int quality_packed() const { return readDataField(QUAL_START, QUAL_LENGTH); } + /// return quality packed as in hardware + unsigned int quality_packed() const { return readDataField(QUAL_START, QUAL_LENGTH); } - /// return eta packed as in hardware - unsigned eta_packed() const { return readDataField(ETA_START, ETA_LENGTH); } + /// return eta packed as in hardware + unsigned eta_packed() const { return readDataField(ETA_START, ETA_LENGTH); } - /// return eta-fine (for DT) / halo (for CSC) bit - unsigned finehalo_packed() const { return readDataField(FINEHALO_START, FINEHALO_LENGTH); } + /// return eta-fine (for DT) / halo (for CSC) bit + unsigned finehalo_packed() const { return readDataField(FINEHALO_START, FINEHALO_LENGTH); } - /// return charge packed as in hardware (0=pos, 1=neg) - unsigned charge_packed() const { return readDataField(CHARGE_START, CHARGE_LENGTH); } + /// return charge packed as in hardware (0=pos, 1=neg) + unsigned charge_packed() const { return readDataField(CHARGE_START, CHARGE_LENGTH); } - /// return charge valid packed as in hardware (1=valid, 0=not valid) - unsigned charge_valid_packed() const { return readDataField(CHVALID_START, CHVALID_LENGTH); } + /// return charge valid packed as in hardware (1=valid, 0=not valid) + unsigned charge_valid_packed() const { return readDataField(CHVALID_START, CHVALID_LENGTH); } - /// return data word - unsigned getDataWord() const { return m_dataWord; }; + /// return data word + unsigned getDataWord() const { return m_dataWord; }; - /// - /// Setters - packed format - /// + /// + /// Setters - packed format + /// - /// Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC - void setType(unsigned type) { writeDataField(TYPE_START, TYPE_LENGTH, type); } + /// Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC + void setType(unsigned type) { writeDataField(TYPE_START, TYPE_LENGTH, type); } - /// Set Bunch Crossing - void setBx(int bx) { m_bx = bx; } + /// Set Bunch Crossing + void setBx(int bx) { m_bx = bx; } - /// Set Phi: 0..143 - void setPhiPacked(unsigned phi) { writeDataField(PHI_START, PHI_LENGTH, phi); } + /// Set Phi: 0..143 + void setPhiPacked(unsigned phi) { writeDataField(PHI_START, PHI_LENGTH, phi); } - /// Set Pt: 0..31 - void setPtPacked(unsigned pt) { writeDataField(PT_START, PT_LENGTH, pt); } + /// Set Pt: 0..31 + void setPtPacked(unsigned pt) { writeDataField(PT_START, PT_LENGTH, pt); } - /// Set Quality: 0..7 - void setQualityPacked(unsigned qual) { writeDataField(QUAL_START, QUAL_LENGTH, qual); } + /// Set Quality: 0..7 + void setQualityPacked(unsigned qual) { writeDataField(QUAL_START, QUAL_LENGTH, qual); } - /// Set Charge (0=pos, 1=neg) - void setChargePacked(unsigned ch) { writeDataField(CHARGE_START, CHARGE_LENGTH, ch); } + /// Set Charge (0=pos, 1=neg) + void setChargePacked(unsigned ch) { writeDataField(CHARGE_START, CHARGE_LENGTH, ch); } - /// Set Charge Valid - void setChargeValidPacked(unsigned valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid); } + /// Set Charge Valid + void setChargeValidPacked(unsigned valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid); } - /// Set Eta: 6-bit code - void setEtaPacked(unsigned eta) { writeDataField(ETA_START, ETA_LENGTH, eta); } + /// Set Eta: 6-bit code + void setEtaPacked(unsigned eta) { writeDataField(ETA_START, ETA_LENGTH, eta); } - /// Set Fine / Halo - void setFineHaloPacked(unsigned fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh); } + /// Set Fine / Halo + void setFineHaloPacked(unsigned fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh); } - /// - /// Setters - values - /// + /// + /// Setters - values + /// - /// Set Phi Value - void setPhiValue(float phiVal) { m_phiValue = phiVal; } + /// Set Phi Value + void setPhiValue(float phiVal) { m_phiValue = phiVal; } - /// Set Pt Value - void setPtValue(float ptVal) { m_ptValue = ptVal; } + /// Set Pt Value + void setPtValue(float ptVal) { m_ptValue = ptVal; } - /// Set Eta Value (need to set type, first) - void setEtaValue(float etaVal) { m_etaValue = etaVal; } + /// Set Eta Value (need to set type, first) + void setEtaValue(float etaVal) { m_etaValue = etaVal; } - /// Set Charge Value: -1, 1 - void setChargeValue(int charge) { writeDataField(CHARGE_START, CHARGE_LENGTH, charge == 1 ? 0 : 1); } + /// Set Charge Value: -1, 1 + void setChargeValue(int charge) { writeDataField(CHARGE_START, CHARGE_LENGTH, charge == 1 ? 0 : 1); } - /// Set Charge Valid - void setChargeValid(bool valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid ? 1 : 0); } + /// Set Charge Valid + void setChargeValid(bool valid) { writeDataField(CHVALID_START, CHVALID_LENGTH, valid ? 1 : 0); } - /// Set Fine / Halo - void setFineHalo(bool fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh ? 1 : 0); } + /// Set Fine / Halo + void setFineHalo(bool fh) { writeDataField(FINEHALO_START, FINEHALO_LENGTH, fh ? 1 : 0); } - /// reset - virtual void reset(); + /// reset + virtual void reset(); - /// Set data word - void setDataWord(unsigned dataword) { m_dataWord = dataword; } + /// Set data word + void setDataWord(unsigned dataword) { m_dataWord = dataword; } - /// print candidate - virtual void print() const; + /// print candidate + virtual void print() const; -private: - unsigned readDataField(unsigned start, unsigned count) const; - void writeDataField(unsigned start, unsigned count, unsigned value); + private: + unsigned readDataField(unsigned start, unsigned count) const; + void writeDataField(unsigned start, unsigned count, unsigned value); -private: - int m_bx; - unsigned m_dataWord; // muon data word (25 bits) : + private: + int m_bx; + unsigned m_dataWord; // muon data word (25 bits) : - float m_phiValue; - float m_etaValue; - float m_ptValue; - static const float m_invalidValue; + float m_phiValue; + float m_etaValue; + float m_ptValue; + static const float m_invalidValue; -public: - // definition of the bit fields - enum { PHI_START = 0 }; - enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits) - enum { PT_START = 8 }; - enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits) - enum { QUAL_START = 13 }; - enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits) - enum { ETA_START = 16 }; - enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits) - enum { FINEHALO_START = 22 }; - enum { FINEHALO_LENGTH = 1 }; // Bit 22 Eta is fine (DT) / Halo (CSC) - enum { CHARGE_START = 23 }; - enum { CHARGE_LENGTH = 1 }; // Bit 23 Charge: 0 = positive - enum { CHVALID_START = 24 }; - enum { CHVALID_LENGTH = 1 }; // Bit 24 Charge is vaild (1=valid) - // Bits 26 to 29: Synchronization + public: + // definition of the bit fields + enum { PHI_START = 0 }; + enum { PHI_LENGTH = 8 }; // Bits 0:7 phi (8 bits) + enum { PT_START = 8 }; + enum { PT_LENGTH = 5 }; // Bits 8:12 pt (5 bits) + enum { QUAL_START = 13 }; + enum { QUAL_LENGTH = 3 }; // Bits 13:15 quality (3 bits) + enum { ETA_START = 16 }; + enum { ETA_LENGTH = 6 }; // Bits 16:21 eta (6 bits) + enum { FINEHALO_START = 22 }; + enum { FINEHALO_LENGTH = 1 }; // Bit 22 Eta is fine (DT) / Halo (CSC) + enum { CHARGE_START = 23 }; + enum { CHARGE_LENGTH = 1 }; // Bit 23 Charge: 0 = positive + enum { CHVALID_START = 24 }; + enum { CHVALID_LENGTH = 1 }; // Bit 24 Charge is vaild (1=valid) + // Bits 26 to 29: Synchronization - enum { TYPE_START = 30 }; - enum { TYPE_LENGTH = 2 }; // Bit 30/31 type DT, bRPC, CSC, fRPC - // these bits are not sent to the GMT in hardware -}; + enum { TYPE_START = 30 }; + enum { TYPE_LENGTH = 2 }; // Bit 30/31 type DT, bRPC, CSC, fRPC + // these bits are not sent to the GMT in hardware + }; +} // namespace io_v1 +using L1MuRegionalCand = io_v1::L1MuRegionalCand; #endif diff --git a/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCandFwd.h b/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCandFwd.h index ba561f1473161..c61dd6d7dac53 100644 --- a/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCandFwd.h +++ b/DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCandFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalMuonTrigger_L1MuRegionalCandFwd_h #define DataFormats_L1GlobalMuonTrigger_L1MuRegionalCandFwd_h -class L1MuRegionalCand; - +namespace io_v1 { + class L1MuRegionalCand; +} +using L1MuRegionalCand = io_v1::L1MuRegionalCand; #endif diff --git a/DataFormats/L1GlobalMuonTrigger/src/L1MuGMTCand.cc b/DataFormats/L1GlobalMuonTrigger/src/L1MuGMTCand.cc index 528bb7ca9d747..b1c5439047dde 100644 --- a/DataFormats/L1GlobalMuonTrigger/src/L1MuGMTCand.cc +++ b/DataFormats/L1GlobalMuonTrigger/src/L1MuGMTCand.cc @@ -40,146 +40,150 @@ using namespace std; -const float L1MuGMTCand::m_invalidValue = -10.; - -//---------------- -// Constructors -- -//---------------- - -L1MuGMTCand::L1MuGMTCand() : m_name("L1MuGMTCand"), m_bx(0), m_dataWord(0) { - m_phiValue = m_invalidValue; - m_etaValue = m_invalidValue; - m_ptValue = m_invalidValue; -} - -L1MuGMTCand::L1MuGMTCand(const L1MuGMTCand& mu) - : m_name(mu.m_name), - m_bx(mu.m_bx), - m_dataWord(mu.m_dataWord), - m_phiValue(mu.m_phiValue), - m_etaValue(mu.m_etaValue), - m_ptValue(mu.m_ptValue) {} - -L1MuGMTCand::L1MuGMTCand(unsigned data, int bx) : m_name("L1MuGMTCand"), m_bx(bx), m_dataWord(data) { - m_phiValue = m_invalidValue; - m_etaValue = m_invalidValue; - m_ptValue = m_invalidValue; -} - -//-------------- -// Destructor -- -//-------------- -L1MuGMTCand::~L1MuGMTCand() { reset(); } - -//-------------- -// Operations -- -//-------------- +namespace io_v1 { + const float L1MuGMTCand::m_invalidValue = -10.; -// -// reset Muon Track Candidate -// -void L1MuGMTCand::reset() { - m_bx = 0; - m_dataWord = 0; - m_phiValue = m_invalidValue; - m_etaValue = m_invalidValue; - m_ptValue = m_invalidValue; -} + //---------------- + // Constructors -- + //---------------- -// -// return phi of track candidate in radians -// -float L1MuGMTCand::phiValue() const { - if (m_phiValue == m_invalidValue) { - edm::LogWarning("ValueInvalid") << "L1MuGMTCand::phiValue requested physical value is invalid"; + L1MuGMTCand::L1MuGMTCand() : m_name("L1MuGMTCand"), m_bx(0), m_dataWord(0) { + m_phiValue = m_invalidValue; + m_etaValue = m_invalidValue; + m_ptValue = m_invalidValue; } - return m_phiValue; -} -// -// return eta of track candidate -// -float L1MuGMTCand::etaValue() const { - if (m_etaValue == m_invalidValue) { - edm::LogWarning("ValueInvalid") << "L1MuGMTCand::etaValue requested physical value is invalid"; + L1MuGMTCand::L1MuGMTCand(const L1MuGMTCand& mu) + : m_name(mu.m_name), + m_bx(mu.m_bx), + m_dataWord(mu.m_dataWord), + m_phiValue(mu.m_phiValue), + m_etaValue(mu.m_etaValue), + m_ptValue(mu.m_ptValue) {} + + L1MuGMTCand::L1MuGMTCand(unsigned data, int bx) : m_name("L1MuGMTCand"), m_bx(bx), m_dataWord(data) { + m_phiValue = m_invalidValue; + m_etaValue = m_invalidValue; + m_ptValue = m_invalidValue; } - return m_etaValue; -} -// -// return pt-value of track candidate in GeV -// -float L1MuGMTCand::ptValue() const { - if (m_ptValue == m_invalidValue) { - edm::LogWarning("ValueInvalid") << "L1MuRegionalCand::ptValue requested physical value is invalid"; + //-------------- + // Destructor -- + //-------------- + L1MuGMTCand::~L1MuGMTCand() { reset(); } + + //-------------- + // Operations -- + //-------------- + + // + // reset Muon Track Candidate + // + void L1MuGMTCand::reset() { + m_bx = 0; + m_dataWord = 0; + m_phiValue = m_invalidValue; + m_etaValue = m_invalidValue; + m_ptValue = m_invalidValue; } - return m_ptValue; -} -// -// Equal operator -// -bool L1MuGMTCand::operator==(const L1MuGMTCand& cand) const { - if (m_bx != cand.m_bx) - return false; - if (m_dataWord != cand.m_dataWord) - return false; - return true; -} + // + // return phi of track candidate in radians + // + float L1MuGMTCand::phiValue() const { + if (m_phiValue == m_invalidValue) { + edm::LogWarning("ValueInvalid") << "L1MuGMTCand::phiValue requested physical value is invalid"; + } + return m_phiValue; + } -// -// Unequal operator -// -bool L1MuGMTCand::operator!=(const L1MuGMTCand& cand) const { - if (m_bx != cand.m_bx) - return true; - if (m_dataWord != cand.m_dataWord) + // + // return eta of track candidate + // + float L1MuGMTCand::etaValue() const { + if (m_etaValue == m_invalidValue) { + edm::LogWarning("ValueInvalid") << "L1MuGMTCand::etaValue requested physical value is invalid"; + } + return m_etaValue; + } + + // + // return pt-value of track candidate in GeV + // + float L1MuGMTCand::ptValue() const { + if (m_ptValue == m_invalidValue) { + edm::LogWarning("ValueInvalid") << "L1MuRegionalCand::ptValue requested physical value is invalid"; + } + return m_ptValue; + } + + // + // Equal operator + // + bool L1MuGMTCand::operator==(const L1MuGMTCand& cand) const { + if (m_bx != cand.m_bx) + return false; + if (m_dataWord != cand.m_dataWord) + return false; return true; - return false; -} + } -// -// print parameters of track candidate -// -void L1MuGMTCand::print() const { - if (!empty()) { - if (m_phiValue == m_invalidValue || m_etaValue == m_invalidValue || m_ptValue == m_invalidValue) { - edm::LogVerbatim("GMT_Candidate_info") << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed) - << "bx = " << setw(2) << bx() << " " << endl - << "pt(index) = " << setw(2) << ptIndex() << " " - << "charge = " << setw(2) << charge() << " " - << "eta(index) = " << setw(2) << etaIndex() << " " - << "phi(index) = " << setw(3) << phiIndex() << " " - << "quality = " << setw(1) << quality() << " " - << "isolated = " << setw(1) << isol() << " " - << "mip = " << setw(1) << mip() << endl; - } else { - edm::LogVerbatim("GMT_Candidate_info") << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed) - << "bx = " << setw(2) << bx() << " " << endl - << "pt = " << setw(5) << setprecision(1) << ptValue() << " GeV " - << "charge = " << setw(2) << charge() << " " - << "eta = " << setw(5) << setprecision(2) << etaValue() << " " - << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad " - << "quality = " << setw(1) << quality() << " " - << "isolated = " << setw(1) << isol() << " " - << "mip = " << setw(1) << mip() << endl; + // + // Unequal operator + // + bool L1MuGMTCand::operator!=(const L1MuGMTCand& cand) const { + if (m_bx != cand.m_bx) + return true; + if (m_dataWord != cand.m_dataWord) + return true; + return false; + } + + // + // print parameters of track candidate + // + void L1MuGMTCand::print() const { + if (!empty()) { + if (m_phiValue == m_invalidValue || m_etaValue == m_invalidValue || m_ptValue == m_invalidValue) { + edm::LogVerbatim("GMT_Candidate_info") + << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed) << "bx = " << setw(2) << bx() + << " " << endl + << "pt(index) = " << setw(2) << ptIndex() << " " + << "charge = " << setw(2) << charge() << " " + << "eta(index) = " << setw(2) << etaIndex() << " " + << "phi(index) = " << setw(3) << phiIndex() << " " + << "quality = " << setw(1) << quality() << " " + << "isolated = " << setw(1) << isol() << " " + << "mip = " << setw(1) << mip() << endl; + } else { + edm::LogVerbatim("GMT_Candidate_info") + << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed) << "bx = " << setw(2) << bx() + << " " << endl + << "pt = " << setw(5) << setprecision(1) << ptValue() << " GeV " + << "charge = " << setw(2) << charge() << " " + << "eta = " << setw(5) << setprecision(2) << etaValue() << " " + << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad " + << "quality = " << setw(1) << quality() << " " + << "isolated = " << setw(1) << isol() << " " + << "mip = " << setw(1) << mip() << endl; + } } } -} -// -// output stream operator for track candidate -// -ostream& operator<<(ostream& s, const L1MuGMTCand& id) { - if (!id.empty()) { - s << setiosflags(ios::showpoint | ios::fixed) << "bx = " << setw(2) << id.bx() << " " - << "pt = " << setw(5) << setprecision(1) << id.ptValue() << " GeV " - << "charge = " << setw(2) << id.charge() << " " - << "eta = " << setw(5) << setprecision(2) << id.etaValue() << " " - << "phi = " << setw(5) << setprecision(3) << id.phiValue() << " rad " - << "quality = " << setw(1) << id.quality() << " " - << "isolated = " << setw(1) << id.isol() << " " - << "mip = " << setw(1) << id.mip() << " "; + // + // output stream operator for track candidate + // + ostream& operator<<(ostream& s, const L1MuGMTCand& id) { + if (!id.empty()) { + s << setiosflags(ios::showpoint | ios::fixed) << "bx = " << setw(2) << id.bx() << " " + << "pt = " << setw(5) << setprecision(1) << id.ptValue() << " GeV " + << "charge = " << setw(2) << id.charge() << " " + << "eta = " << setw(5) << setprecision(2) << id.etaValue() << " " + << "phi = " << setw(5) << setprecision(3) << id.phiValue() << " rad " + << "quality = " << setw(1) << id.quality() << " " + << "isolated = " << setw(1) << id.isol() << " " + << "mip = " << setw(1) << id.mip() << " "; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1GlobalMuonTrigger/src/classes_def.xml b/DataFormats/L1GlobalMuonTrigger/src/classes_def.xml index 892ef396fe820..be8770c04687d 100644 --- a/DataFormats/L1GlobalMuonTrigger/src/classes_def.xml +++ b/DataFormats/L1GlobalMuonTrigger/src/classes_def.xml @@ -1,28 +1,27 @@ - - + + - - - - + + + + - - - - - - + + + + + - - + + - - + + - - + + diff --git a/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h b/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h index d307527e260ee..db2f0489f6480 100644 --- a/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h +++ b/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h @@ -43,122 +43,124 @@ namespace edm { // class interface -class L1GlobalTriggerReadoutRecord { -public: - /// constructors - L1GlobalTriggerReadoutRecord(); +namespace io_v1 { + class L1GlobalTriggerReadoutRecord { + public: + /// constructors + L1GlobalTriggerReadoutRecord(); - L1GlobalTriggerReadoutRecord(int NumberBxInEvent); + L1GlobalTriggerReadoutRecord(int NumberBxInEvent); - L1GlobalTriggerReadoutRecord(const int numberBxInEvent, const int numberFdlBoards, const int numberPsbBoards); + L1GlobalTriggerReadoutRecord(const int numberBxInEvent, const int numberFdlBoards, const int numberPsbBoards); - /// copy constructor - L1GlobalTriggerReadoutRecord(const L1GlobalTriggerReadoutRecord&); + /// copy constructor + L1GlobalTriggerReadoutRecord(const L1GlobalTriggerReadoutRecord&); - /// destructor - virtual ~L1GlobalTriggerReadoutRecord(); + /// destructor + virtual ~L1GlobalTriggerReadoutRecord(); - /// assignment operator - L1GlobalTriggerReadoutRecord& operator=(const L1GlobalTriggerReadoutRecord&); + /// assignment operator + L1GlobalTriggerReadoutRecord& operator=(const L1GlobalTriggerReadoutRecord&); - /// equal operator - bool operator==(const L1GlobalTriggerReadoutRecord&) const; + /// equal operator + bool operator==(const L1GlobalTriggerReadoutRecord&) const; - /// unequal operator - bool operator!=(const L1GlobalTriggerReadoutRecord&) const; + /// unequal operator + bool operator!=(const L1GlobalTriggerReadoutRecord&) const; -public: - /// get Global Trigger decision, decision word and technical trigger word - /// overloaded w.r.t. bxInEvent argument - /// bxInEvent not given: for bunch cross with L1Accept - const bool decision(int bxInEventValue) const; - const bool decision() const; + public: + /// get Global Trigger decision, decision word and technical trigger word + /// overloaded w.r.t. bxInEvent argument + /// bxInEvent not given: for bunch cross with L1Accept + const bool decision(int bxInEventValue) const; + const bool decision() const; - const cms_uint16_t finalOR(int bxInEventValue) const; - const cms_uint16_t finalOR() const; + const cms_uint16_t finalOR(int bxInEventValue) const; + const cms_uint16_t finalOR() const; - const DecisionWord& decisionWord(int bxInEventValue) const; - const DecisionWord& decisionWord() const; + const DecisionWord& decisionWord(int bxInEventValue) const; + const DecisionWord& decisionWord() const; - const TechnicalTriggerWord& technicalTriggerWord(int bxInEventValue) const; - const TechnicalTriggerWord& technicalTriggerWord() const; + const TechnicalTriggerWord& technicalTriggerWord(int bxInEventValue) const; + const TechnicalTriggerWord& technicalTriggerWord() const; - /// set global decision, decision word and technical trigger word - void setDecision(const bool& t, int bxInEventValue); - void setDecision(const bool& t); + /// set global decision, decision word and technical trigger word + void setDecision(const bool& t, int bxInEventValue); + void setDecision(const bool& t); - void setDecisionWord(const DecisionWord& decisionWordValue, int bxInEventValue); - void setDecisionWord(const DecisionWord& decisionWordValue); + void setDecisionWord(const DecisionWord& decisionWordValue, int bxInEventValue); + void setDecisionWord(const DecisionWord& decisionWordValue); - void setTechnicalTriggerWord(const TechnicalTriggerWord& ttWordValue, int bxInEventValue); - void setTechnicalTriggerWord(const TechnicalTriggerWord& ttWordValue); + void setTechnicalTriggerWord(const TechnicalTriggerWord& ttWordValue, int bxInEventValue); + void setTechnicalTriggerWord(const TechnicalTriggerWord& ttWordValue); - /// print global decision and algorithm decision word - void printGtDecision(std::ostream& myCout, int bxInEventValue) const; - void printGtDecision(std::ostream& myCout) const; + /// print global decision and algorithm decision word + void printGtDecision(std::ostream& myCout, int bxInEventValue) const; + void printGtDecision(std::ostream& myCout) const; - /// print technical triggers - void printTechnicalTrigger(std::ostream& myCout, int bxInEventValue) const; - void printTechnicalTrigger(std::ostream& myCout) const; + /// print technical triggers + void printTechnicalTrigger(std::ostream& myCout, int bxInEventValue) const; + void printTechnicalTrigger(std::ostream& myCout) const; - /// get / set reference to L1MuGMTReadoutCollection - const edm::RefProd muCollectionRefProd() const; - void setMuCollectionRefProd(edm::Handle&); - void setMuCollectionRefProd(const edm::RefProd&); + /// get / set reference to L1MuGMTReadoutCollection + const edm::RefProd muCollectionRefProd() const; + void setMuCollectionRefProd(edm::Handle&); + void setMuCollectionRefProd(const edm::RefProd&); - //************************************************************************** - // get/set hardware-related words - // - //************************************************************************** + //************************************************************************** + // get/set hardware-related words + // + //************************************************************************** - /// get / set GTFE word (record) in the GT readout record - const L1GtfeWord gtfeWord() const; - void setGtfeWord(const L1GtfeWord&); + /// get / set GTFE word (record) in the GT readout record + const L1GtfeWord gtfeWord() const; + void setGtfeWord(const L1GtfeWord&); - /// get the vector of L1GtFdlWord - const std::vector gtFdlVector() const { return m_gtFdlWord; } + /// get the vector of L1GtFdlWord + const std::vector gtFdlVector() const { return m_gtFdlWord; } - std::vector& gtFdlVector() { return m_gtFdlWord; } + std::vector& gtFdlVector() { return m_gtFdlWord; } - /// get / set FDL word (record) in the GT readout record - const L1GtFdlWord gtFdlWord(int bxInEventValue) const; - const L1GtFdlWord gtFdlWord() const; + /// get / set FDL word (record) in the GT readout record + const L1GtFdlWord gtFdlWord(int bxInEventValue) const; + const L1GtFdlWord gtFdlWord() const; - void setGtFdlWord(const L1GtFdlWord&, int bxInEventValue); - void setGtFdlWord(const L1GtFdlWord&); + void setGtFdlWord(const L1GtFdlWord&, int bxInEventValue); + void setGtFdlWord(const L1GtFdlWord&); - /// get the vector of L1GtPsbWord - const std::vector gtPsbVector() const { return m_gtPsbWord; } + /// get the vector of L1GtPsbWord + const std::vector gtPsbVector() const { return m_gtPsbWord; } - std::vector& gtPsbVector() { return m_gtPsbWord; } + std::vector& gtPsbVector() { return m_gtPsbWord; } - /// get / set PSB word (record) in the GT readout record - const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue, int bxInEventValue) const; - const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue) const; + /// get / set PSB word (record) in the GT readout record + const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue, int bxInEventValue) const; + const L1GtPsbWord gtPsbWord(cms_uint16_t boardIdValue) const; - void setGtPsbWord(const L1GtPsbWord&, cms_uint16_t boardIdValue, int bxInEventValue); - void setGtPsbWord(const L1GtPsbWord&, cms_uint16_t boardIdValue); - void setGtPsbWord(const L1GtPsbWord& gtPsbWordValue); + void setGtPsbWord(const L1GtPsbWord&, cms_uint16_t boardIdValue, int bxInEventValue); + void setGtPsbWord(const L1GtPsbWord&, cms_uint16_t boardIdValue); + void setGtPsbWord(const L1GtPsbWord& gtPsbWordValue); - // other methods + // other methods - /// clear the record - void reset(); + /// clear the record + void reset(); - /// pretty print the content of a L1GlobalTriggerReadoutRecord - void print(std::ostream& myCout) const; + /// pretty print the content of a L1GlobalTriggerReadoutRecord + void print(std::ostream& myCout) const; - /// output stream operator - friend std::ostream& operator<<(std::ostream&, const L1GlobalTriggerReadoutRecord&); + /// output stream operator + friend std::ostream& operator<<(std::ostream&, const L1GlobalTriggerReadoutRecord&); -private: - L1GtfeWord m_gtfeWord; + private: + L1GtfeWord m_gtfeWord; - std::vector m_gtFdlWord; + std::vector m_gtFdlWord; - std::vector m_gtPsbWord; - - edm::RefProd m_muCollRefProd; -}; + std::vector m_gtPsbWord; + edm::RefProd m_muCollRefProd; + }; +} // namespace io_v1 +using L1GlobalTriggerReadoutRecord = io_v1::L1GlobalTriggerReadoutRecord; #endif diff --git a/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecordFwd.h b/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecordFwd.h index 36ee22fec5388..94e28e74c9d8d 100644 --- a/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecordFwd.h +++ b/DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecordFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1GlobalTrigger_L1GlobalTriggerReadoutRecordFwd_h #define DataFormats_L1GlobalTrigger_L1GlobalTriggerReadoutRecordFwd_h -class L1GlobalTriggerReadoutRecord; - +namespace io_v1 { + class L1GlobalTriggerReadoutRecord; +} +using L1GlobalTriggerReadoutRecord = io_v1::L1GlobalTriggerReadoutRecord; #endif diff --git a/DataFormats/L1GlobalTrigger/src/classes_def.xml b/DataFormats/L1GlobalTrigger/src/classes_def.xml index bf37c0c20926d..135ab734fbe2b 100644 --- a/DataFormats/L1GlobalTrigger/src/classes_def.xml +++ b/DataFormats/L1GlobalTrigger/src/classes_def.xml @@ -1,31 +1,29 @@ - - + + - - - + + - - - + + - - + + - - + + @@ -33,84 +31,82 @@ - - + + - - + + - + - - + + - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + - - + + diff --git a/DataFormats/L1TCalorimeter/interface/CaloCluster.h b/DataFormats/L1TCalorimeter/interface/CaloCluster.h index 88a9f5c9f6944..734c5129aa6b0 100644 --- a/DataFormats/L1TCalorimeter/interface/CaloCluster.h +++ b/DataFormats/L1TCalorimeter/interface/CaloCluster.h @@ -5,76 +5,77 @@ #include "DataFormats/L1Trigger/interface/BXVector.h" namespace l1t { + namespace io_v1 { + class CaloCluster : public L1Candidate { + public: + enum ClusterFlag { + INCLUDE_SEED = 0, + INCLUDE_NW = 1, + INCLUDE_N = 2, + INCLUDE_NE = 3, + INCLUDE_E = 4, + INCLUDE_SE = 5, + INCLUDE_S = 6, + INCLUDE_SW = 7, + INCLUDE_W = 8, + INCLUDE_NN = 9, + INCLUDE_SS = 10, + TRIM_LEFT = 11, + IS_SECONDARY = 12, + MERGE_UPDOWN = 13, // 0=up, 1=down + MERGE_LEFTRIGHT = 14 // 0=left, 1=right + }; - class CaloCluster : public L1Candidate { - public: - enum ClusterFlag { - INCLUDE_SEED = 0, - INCLUDE_NW = 1, - INCLUDE_N = 2, - INCLUDE_NE = 3, - INCLUDE_E = 4, - INCLUDE_SE = 5, - INCLUDE_S = 6, - INCLUDE_SW = 7, - INCLUDE_W = 8, - INCLUDE_NN = 9, - INCLUDE_SS = 10, - TRIM_LEFT = 11, - IS_SECONDARY = 12, - MERGE_UPDOWN = 13, // 0=up, 1=down - MERGE_LEFTRIGHT = 14 // 0=left, 1=right - }; - - public: - CaloCluster() {} - CaloCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); + public: + CaloCluster() {} + CaloCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); - ~CaloCluster() override; + ~CaloCluster() override; - void setClusterFlag(ClusterFlag flag, bool val = true); - void setHwPtEm(int pt); - void setHwPtHad(int pt); - void setHwSeedPt(int pt); - void setFgEta(int fgEta); - void setFgPhi(int fgPhi); - void setHOverE(int hOverE); - void setFgECAL(int fgECAL); + void setClusterFlag(ClusterFlag flag, bool val = true); + void setHwPtEm(int pt); + void setHwPtHad(int pt); + void setHwSeedPt(int pt); + void setFgEta(int fgEta); + void setFgPhi(int fgPhi); + void setHOverE(int hOverE); + void setFgECAL(int fgECAL); - bool checkClusterFlag(ClusterFlag flag) const; - bool isValid() const; - int hwPtEm() const; - int hwPtHad() const; - int hwSeedPt() const; - int fgEta() const; - int fgPhi() const; - int hOverE() const; - int fgECAL() const; - int clusterFlags() const { return m_clusterFlags; } + bool checkClusterFlag(ClusterFlag flag) const; + bool isValid() const; + int hwPtEm() const; + int hwPtHad() const; + int hwSeedPt() const; + int fgEta() const; + int fgPhi() const; + int hOverE() const; + int fgECAL() const; + int clusterFlags() const { return m_clusterFlags; } - bool operator<(const CaloCluster& cl) const; - bool operator>(const CaloCluster& cl) const { return cl < *this; }; - bool operator<=(const CaloCluster& cl) const { return !(cl > *this); }; - bool operator>=(const CaloCluster& cl) const { return !(cl < *this); }; + bool operator<(const CaloCluster& cl) const; + bool operator>(const CaloCluster& cl) const { return cl < *this; }; + bool operator<=(const CaloCluster& cl) const { return !(cl > *this); }; + bool operator>=(const CaloCluster& cl) const { return !(cl < *this); }; - private: - // Summary of clustering outcomes - int m_clusterFlags{0}; // see ClusterFlag bits (15 bits, will evolve) + private: + // Summary of clustering outcomes + int m_clusterFlags{0}; // see ClusterFlag bits (15 bits, will evolve) - // Energies - int m_hwPtEm{0}; - int m_hwPtHad{0}; - int m_hwSeedPt{0}; + // Energies + int m_hwPtEm{0}; + int m_hwPtHad{0}; + int m_hwSeedPt{0}; - // fine grained position - int m_fgEta{0}; // 2 bits (to be defined in agreement with GT inputs) - int m_fgPhi{0}; // 2 bits (to be defined in agreement with GT inputs) - - // identification variables - int m_hOverE{0}; // 8 bits (between 0 and 1 -> resolution=1/256=0.39%). Number of bits is not definitive - int m_fgECAL{0}; // FG bit of the seed tower - }; + // fine grained position + int m_fgEta{0}; // 2 bits (to be defined in agreement with GT inputs) + int m_fgPhi{0}; // 2 bits (to be defined in agreement with GT inputs) + // identification variables + int m_hOverE{0}; // 8 bits (between 0 and 1 -> resolution=1/256=0.39%). Number of bits is not definitive + int m_fgECAL{0}; // FG bit of the seed tower + }; + } // namespace io_v1 + using CaloCluster = io_v1::CaloCluster; typedef BXVector CaloClusterBxCollection; } // namespace l1t diff --git a/DataFormats/L1TCalorimeter/interface/CaloTower.h b/DataFormats/L1TCalorimeter/interface/CaloTower.h index b932b35e22acf..258d647b12a99 100644 --- a/DataFormats/L1TCalorimeter/interface/CaloTower.h +++ b/DataFormats/L1TCalorimeter/interface/CaloTower.h @@ -6,49 +6,51 @@ namespace l1t { - class CaloTower; - typedef BXVector CaloTowerBxCollection; - - class CaloTower : public L1Candidate { - public: - CaloTower() : etEm_(0.), etHad_(0.), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} - - CaloTower(const LorentzVector& p4, - double etEm = 0., - double etHad = 0., - int pt = 0, - int eta = 0, - int phi = 0, - int qual = 0, - int hwEtEm = 0, - int hwEtHad = 0, - int hwEtRatio = 0); - - ~CaloTower() override; - - void setEtEm(double et); - void setEtHad(double et); - - void setHwEtEm(int et); - void setHwEtHad(int et); - void setHwEtRatio(int ratio); - - double etEm() const; - double etHad() const; - - int hwEtEm() const; - int hwEtHad() const; - int hwEtRatio() const; - - private: - // additional hardware quantities - double etEm_; - double etHad_; - - int hwEtEm_; - int hwEtHad_; - int hwEtRatio_; - }; + namespace io_v1 { + class CaloTower : public L1Candidate { + public: + CaloTower() : etEm_(0.), etHad_(0.), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} + + CaloTower(const LorentzVector& p4, + double etEm = 0., + double etHad = 0., + int pt = 0, + int eta = 0, + int phi = 0, + int qual = 0, + int hwEtEm = 0, + int hwEtHad = 0, + int hwEtRatio = 0); + + ~CaloTower() override; + + void setEtEm(double et); + void setEtHad(double et); + + void setHwEtEm(int et); + void setHwEtHad(int et); + void setHwEtRatio(int ratio); + + double etEm() const; + double etHad() const; + + int hwEtEm() const; + int hwEtHad() const; + int hwEtRatio() const; + + private: + // additional hardware quantities + double etEm_; + double etHad_; + + int hwEtEm_; + int hwEtHad_; + int hwEtRatio_; + }; + } // namespace io_v1 + using CaloTower = io_v1::CaloTower; + + using CaloTowerBxCollection = BXVector; } // namespace l1t diff --git a/DataFormats/L1TCalorimeter/src/classes_def.xml b/DataFormats/L1TCalorimeter/src/classes_def.xml index ca48fe424fd0d..d960b67741cc5 100644 --- a/DataFormats/L1TCalorimeter/src/classes_def.xml +++ b/DataFormats/L1TCalorimeter/src/classes_def.xml @@ -9,13 +9,17 @@ - - + + + + - - + + + + diff --git a/DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h b/DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h index aa4895fcdf008..67dfe3f40d833 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h @@ -10,143 +10,144 @@ #include "DataFormats/DetId/interface/DetId.h" namespace l1tp2 { + namespace io_v1 { + class CaloCrystalCluster : public l1t::L1Candidate { + public: + CaloCrystalCluster() + : l1t::L1Candidate(), + calibratedPt_(0.), + hovere_(0.), + iso_(0.), + puCorrPt_(0.), + bremStrength_(0.), + e2x2_(0.), + e2x5_(0.), + e3x5_(0.), + e5x5_(0.), + standaloneWP_(0.), + electronWP98_(0.), + photonWP80_(0.), + electronWP90_(0.), + looseL1TkMatchWP_(0.), + stage2effMatch_(0.) {} - class CaloCrystalCluster : public l1t::L1Candidate { - public: - CaloCrystalCluster() - : l1t::L1Candidate(), - calibratedPt_(0.), - hovere_(0.), - iso_(0.), - puCorrPt_(0.), - bremStrength_(0.), - e2x2_(0.), - e2x5_(0.), - e3x5_(0.), - e5x5_(0.), - standaloneWP_(0.), - electronWP98_(0.), - photonWP80_(0.), - electronWP90_(0.), - looseL1TkMatchWP_(0.), - stage2effMatch_(0.) {} + CaloCrystalCluster(const PolarLorentzVector &p4, + float calibratedPt, + float hovere, + float iso, + DetId seedCrystal, + float puCorrPt = 0., + float bremStrength = 0., + float e2x2 = 0., + float e2x5 = 0., + float e3x5 = 0., + float e5x5 = 0., + bool standaloneWP = false, + bool electronWP98 = false, + bool photonWP80 = false, + bool electronWP90 = false, + bool looseL1TkMatchWP = false, + bool stage2effMatch = false) + : l1t::L1Candidate(p4), + calibratedPt_(calibratedPt), + hovere_(hovere), + iso_(iso), + seedCrystal_(seedCrystal), + puCorrPt_(puCorrPt), + bremStrength_(bremStrength), + e2x2_(e2x2), + e2x5_(e2x5), + e3x5_(e3x5), + e5x5_(e5x5), + standaloneWP_(standaloneWP), + electronWP98_(electronWP98), + photonWP80_(photonWP80), + electronWP90_(electronWP90), + looseL1TkMatchWP_(looseL1TkMatchWP), + stage2effMatch_(stage2effMatch) {} - CaloCrystalCluster(const PolarLorentzVector &p4, - float calibratedPt, - float hovere, - float iso, - DetId seedCrystal, - float puCorrPt = 0., - float bremStrength = 0., - float e2x2 = 0., - float e2x5 = 0., - float e3x5 = 0., - float e5x5 = 0., - bool standaloneWP = false, - bool electronWP98 = false, - bool photonWP80 = false, - bool electronWP90 = false, - bool looseL1TkMatchWP = false, - bool stage2effMatch = false) - : l1t::L1Candidate(p4), - calibratedPt_(calibratedPt), - hovere_(hovere), - iso_(iso), - seedCrystal_(seedCrystal), - puCorrPt_(puCorrPt), - bremStrength_(bremStrength), - e2x2_(e2x2), - e2x5_(e2x5), - e3x5_(e3x5), - e5x5_(e5x5), - standaloneWP_(standaloneWP), - electronWP98_(electronWP98), - photonWP80_(photonWP80), - electronWP90_(electronWP90), - looseL1TkMatchWP_(looseL1TkMatchWP), - stage2effMatch_(stage2effMatch) {} + ~CaloCrystalCluster() override {} + inline float calibratedPt() const { return calibratedPt_; }; + inline float hovere() const { return hovere_; }; + inline float isolation() const { return iso_; }; + inline float puCorrPt() const { return puCorrPt_; }; + inline float bremStrength() const { return bremStrength_; }; + inline DetId seedCrystal() const { return seedCrystal_; }; + void setCrystalPtInfo(std::vector info) { + std::sort(info.begin(), info.end()); + std::reverse(info.begin(), info.end()); + crystalPt_ = std::move(info); + }; + void setExperimentalParams(const std::map ¶ms) { experimentalParams_ = params; }; + const std::map &getExperimentalParams() const { return experimentalParams_; }; + inline float experimentalParam(const std::string &name) const { + auto iter = experimentalParams_.find(name); + if (iter != experimentalParams_.end()) { + return iter->second; + } else { + warningNoMapping(name); + return -99.; + } + }; - ~CaloCrystalCluster() override {} - inline float calibratedPt() const { return calibratedPt_; }; - inline float hovere() const { return hovere_; }; - inline float isolation() const { return iso_; }; - inline float puCorrPt() const { return puCorrPt_; }; - inline float bremStrength() const { return bremStrength_; }; - inline DetId seedCrystal() const { return seedCrystal_; }; - void setCrystalPtInfo(std::vector info) { - std::sort(info.begin(), info.end()); - std::reverse(info.begin(), info.end()); - crystalPt_ = std::move(info); - }; - void setExperimentalParams(const std::map ¶ms) { experimentalParams_ = params; }; - const std::map &getExperimentalParams() const { return experimentalParams_; }; - inline float experimentalParam(const std::string &name) const { - auto iter = experimentalParams_.find(name); - if (iter != experimentalParams_.end()) { - return iter->second; - } else { - warningNoMapping(name); - return -99.; - } - }; - - inline float e2x2() const { return e2x2_; }; - inline float e2x5() const { return e2x5_; }; - inline float e3x5() const { return e3x5_; }; - inline float e5x5() const { return e5x5_; }; - inline float standaloneWP() const { return standaloneWP_; }; - inline float electronWP98() const { return electronWP98_; }; - inline float photonWP80() const { return photonWP80_; }; - inline float electronWP90() const { return electronWP90_; }; - inline float looseL1TkMatchWP() const { return looseL1TkMatchWP_; }; - inline float stage2effMatch() const { return stage2effMatch_; }; + inline float e2x2() const { return e2x2_; }; + inline float e2x5() const { return e2x5_; }; + inline float e3x5() const { return e3x5_; }; + inline float e5x5() const { return e5x5_; }; + inline float standaloneWP() const { return standaloneWP_; }; + inline float electronWP98() const { return electronWP98_; }; + inline float photonWP80() const { return photonWP80_; }; + inline float electronWP90() const { return electronWP90_; }; + inline float looseL1TkMatchWP() const { return looseL1TkMatchWP_; }; + inline float stage2effMatch() const { return stage2effMatch_; }; - // The index range depends on the algorithm eta,phi window, currently 3x5 - // The pt should always be ordered. - inline float crystalPt(unsigned int index) const { return (index < crystalPt_.size()) ? crystalPt_[index] : 0.; }; - - private: - static void warningNoMapping(const std::string &name); - // pT calibrated to Stage-2 (Phase-I) L1EG Objects. NOTE - // all working points are defined with respect to cluster.pt(), - // not cluster.calibratedPt() - float calibratedPt_; - // HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster - float hovere_; - // ECal isolation (for outer window size, again look in producer) - float iso_; - // DetId of seed crystal used to make cluster (could be EBDetId or EEDetId) - DetId seedCrystal_; - // Pileup-corrected energy deposit, not studied carefully yet, don't use - float puCorrPt_; - // Bremstrahlung strength, should be proportional to the likelihood of a brem. - float bremStrength_; - // Shower shape variable - max 2x2 energy containing seed crystal - float e2x2_; - // Shower shape variable - max 2x5 energy containing seed crystal, phi centered - float e2x5_; - // Shower shape variable - 3x5 energy containing seed crystal, phi centered - float e3x5_; - // Shower shape variable - 5x5 energy containing centered on seed crystal - float e5x5_; - // Standalone L1EG WP - bool standaloneWP_; - // 98% efficient electron WP, for electrons above 35 GeV - bool electronWP98_; - // 80% efficient photon WP, for photons above 35 GeV - bool photonWP80_; - // 90% efficient electron based WP, early rise to efficiency plateau - bool electronWP90_; - // loose isolation and shower shape requirements to be used in conjunction with L1Trk matching - bool looseL1TkMatchWP_; - // Stage-2 L1EG efficiency matched WP, for rate comparisons - bool stage2effMatch_; - // Crystal pt (in order of strength) for all crystals in the cluster - std::vector crystalPt_; - // For investigating novel algorithm parameters - std::map experimentalParams_; - }; + // The index range depends on the algorithm eta,phi window, currently 3x5 + // The pt should always be ordered. + inline float crystalPt(unsigned int index) const { return (index < crystalPt_.size()) ? crystalPt_[index] : 0.; }; + private: + static void warningNoMapping(const std::string &name); + // pT calibrated to Stage-2 (Phase-I) L1EG Objects. NOTE + // all working points are defined with respect to cluster.pt(), + // not cluster.calibratedPt() + float calibratedPt_; + // HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster + float hovere_; + // ECal isolation (for outer window size, again look in producer) + float iso_; + // DetId of seed crystal used to make cluster (could be EBDetId or EEDetId) + DetId seedCrystal_; + // Pileup-corrected energy deposit, not studied carefully yet, don't use + float puCorrPt_; + // Bremstrahlung strength, should be proportional to the likelihood of a brem. + float bremStrength_; + // Shower shape variable - max 2x2 energy containing seed crystal + float e2x2_; + // Shower shape variable - max 2x5 energy containing seed crystal, phi centered + float e2x5_; + // Shower shape variable - 3x5 energy containing seed crystal, phi centered + float e3x5_; + // Shower shape variable - 5x5 energy containing centered on seed crystal + float e5x5_; + // Standalone L1EG WP + bool standaloneWP_; + // 98% efficient electron WP, for electrons above 35 GeV + bool electronWP98_; + // 80% efficient photon WP, for photons above 35 GeV + bool photonWP80_; + // 90% efficient electron based WP, early rise to efficiency plateau + bool electronWP90_; + // loose isolation and shower shape requirements to be used in conjunction with L1Trk matching + bool looseL1TkMatchWP_; + // Stage-2 L1EG efficiency matched WP, for rate comparisons + bool stage2effMatch_; + // Crystal pt (in order of strength) for all crystals in the cluster + std::vector crystalPt_; + // For investigating novel algorithm parameters + std::map experimentalParams_; + }; + } // namespace io_v1 + using CaloCrystalCluster = io_v1::CaloCrystalCluster; // Concrete collection of output objects (with extra tuning information) typedef std::vector CaloCrystalClusterCollection; } // namespace l1tp2 diff --git a/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h b/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h index 7a80f95bbadbf..70ef21787d61f 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h @@ -8,51 +8,52 @@ #include "DataFormats/L1Trigger/interface/L1Candidate.h" namespace l1tp2 { - - class CaloJet : public l1t::L1Candidate { - public: - CaloJet() : l1t::L1Candidate(), calibratedPt_(0.), hovere_(0.), iso_(0.), puCorrPt_(0.) {} - - CaloJet(const PolarLorentzVector& p4, float calibratedPt, float hovere, float iso, float puCorrPt = 0.) - : l1t::L1Candidate(p4), calibratedPt_(calibratedPt), hovere_(hovere), iso_(iso), puCorrPt_(puCorrPt) {} - - inline float calibratedPt() const { return calibratedPt_; }; - inline float hovere() const { return hovere_; }; - inline float isolation() const { return iso_; }; - inline float puCorrPt() const { return puCorrPt_; }; - const std::vector>& associated_l1EGs() const { return associated_l1EGs_; }; - - void setExperimentalParams(const std::map& params) { experimentalParams_ = params; }; - void setAssociated_l1EGs(const std::vector> l1EGs) { associated_l1EGs_ = l1EGs; }; - - const std::map& experimentalParams() const { return experimentalParams_; }; - - inline float experimentalParam(std::string const& name) const { - auto iter = experimentalParams_.find(name); - if (iter != experimentalParams_.end()) { - return iter->second; - } else { - warningNoMapping(name); - return -99.; - } + namespace io_v1 { + class CaloJet : public l1t::L1Candidate { + public: + CaloJet() : l1t::L1Candidate(), calibratedPt_(0.), hovere_(0.), iso_(0.), puCorrPt_(0.) {} + + CaloJet(const PolarLorentzVector& p4, float calibratedPt, float hovere, float iso, float puCorrPt = 0.) + : l1t::L1Candidate(p4), calibratedPt_(calibratedPt), hovere_(hovere), iso_(iso), puCorrPt_(puCorrPt) {} + + inline float calibratedPt() const { return calibratedPt_; }; + inline float hovere() const { return hovere_; }; + inline float isolation() const { return iso_; }; + inline float puCorrPt() const { return puCorrPt_; }; + const std::vector>& associated_l1EGs() const { return associated_l1EGs_; }; + + void setExperimentalParams(const std::map& params) { experimentalParams_ = params; }; + void setAssociated_l1EGs(const std::vector> l1EGs) { associated_l1EGs_ = l1EGs; }; + + const std::map& experimentalParams() const { return experimentalParams_; }; + + inline float experimentalParam(std::string const& name) const { + auto iter = experimentalParams_.find(name); + if (iter != experimentalParams_.end()) { + return iter->second; + } else { + warningNoMapping(name); + return -99.; + } + }; + + private: + static void warningNoMapping(std::string const&); + // pT calibrated to get + float calibratedPt_; + // HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster + float hovere_; + // ECal isolation (for outer window size, again look in producer) + float iso_; + // Pileup-corrected energy deposit, not studied carefully yet, don't use + float puCorrPt_; + // For investigating novel algorithm parameters + std::map experimentalParams_; + // For decay mode related checks with CaloTaus + std::vector> associated_l1EGs_; }; - - private: - static void warningNoMapping(std::string const&); - // pT calibrated to get - float calibratedPt_; - // HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster - float hovere_; - // ECal isolation (for outer window size, again look in producer) - float iso_; - // Pileup-corrected energy deposit, not studied carefully yet, don't use - float puCorrPt_; - // For investigating novel algorithm parameters - std::map experimentalParams_; - // For decay mode related checks with CaloTaus - std::vector> associated_l1EGs_; - }; - + } // namespace io_v1 + using CaloJet = io_v1::CaloJet; // Concrete collection of output objects (with extra tuning information) typedef std::vector CaloJetsCollection; } // namespace l1tp2 diff --git a/DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h b/DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h index 531dcc9d2f593..48166f510ef8d 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h @@ -12,73 +12,74 @@ #include "DataFormats/L1Trigger/interface/L1Candidate.h" namespace l1tp2 { + namespace io_v1 { + class CaloTower : public l1t::L1Candidate { + public: + CaloTower() + : l1t::L1Candidate(), + ecalTowerEt_(0.0), + hcalTowerEt_(0.0), + towerIPhi_(-99), + towerIEta_(-99), + towerPhi_(-99), + towerEta_(-99), + l1egTowerEt_(0.0), + nL1eg_(0), + l1egTrkSS_(0), + l1egTrkIso_(0), + l1egStandaloneSS_(0), + l1egStandaloneIso_(0), + isBarrel_(false) {} - class CaloTower : public l1t::L1Candidate { - public: - CaloTower() - : l1t::L1Candidate(), - ecalTowerEt_(0.0), - hcalTowerEt_(0.0), - towerIPhi_(-99), - towerIEta_(-99), - towerPhi_(-99), - towerEta_(-99), - l1egTowerEt_(0.0), - nL1eg_(0), - l1egTrkSS_(0), - l1egTrkIso_(0), - l1egStandaloneSS_(0), - l1egStandaloneIso_(0), - isBarrel_(false) {} + public: + inline float ecalTowerEt() const { return ecalTowerEt_; }; + inline float hcalTowerEt() const { return hcalTowerEt_; }; + inline int towerIPhi() const { return towerIPhi_; }; + inline int towerIEta() const { return towerIEta_; }; + inline float towerPhi() const { return towerPhi_; }; + inline float towerEta() const { return towerEta_; }; + inline float l1egTowerEt() const { return l1egTowerEt_; }; + inline int nL1eg() const { return nL1eg_; }; + inline int l1egTrkSS() const { return l1egTrkSS_; }; + inline int l1egTrkIso() const { return l1egTrkIso_; }; + inline int l1egStandaloneSS() const { return l1egStandaloneSS_; }; + inline int l1egStandaloneIso() const { return l1egStandaloneIso_; }; + inline bool isBarrel() const { return isBarrel_; }; - public: - inline float ecalTowerEt() const { return ecalTowerEt_; }; - inline float hcalTowerEt() const { return hcalTowerEt_; }; - inline int towerIPhi() const { return towerIPhi_; }; - inline int towerIEta() const { return towerIEta_; }; - inline float towerPhi() const { return towerPhi_; }; - inline float towerEta() const { return towerEta_; }; - inline float l1egTowerEt() const { return l1egTowerEt_; }; - inline int nL1eg() const { return nL1eg_; }; - inline int l1egTrkSS() const { return l1egTrkSS_; }; - inline int l1egTrkIso() const { return l1egTrkIso_; }; - inline int l1egStandaloneSS() const { return l1egStandaloneSS_; }; - inline int l1egStandaloneIso() const { return l1egStandaloneIso_; }; - inline bool isBarrel() const { return isBarrel_; }; + void setEcalTowerEt(float et) { ecalTowerEt_ = et; }; + void setHcalTowerEt(float et) { hcalTowerEt_ = et; }; + void setTowerIPhi(int iPhi) { towerIPhi_ = iPhi; }; + void setTowerIEta(int iEta) { towerIEta_ = iEta; }; + void setTowerPhi(float phi) { towerPhi_ = phi; }; + void setTowerEta(float eta) { towerEta_ = eta; }; + void setL1egTowerEt(float et) { l1egTowerEt_ = et; }; + void setNL1eg(int n) { nL1eg_ = n; }; + void setL1egTrkSS(int trkSS) { l1egTrkSS_ = trkSS; }; + void setL1egTrkIso(int trkIso) { l1egTrkIso_ = trkIso; }; + void setL1egStandaloneSS(int staSS) { l1egStandaloneSS_ = staSS; }; + void setL1egStandaloneIso(int staIso) { l1egStandaloneIso_ = staIso; }; + void setIsBarrel(bool isBarrel) { isBarrel_ = isBarrel; }; - void setEcalTowerEt(float et) { ecalTowerEt_ = et; }; - void setHcalTowerEt(float et) { hcalTowerEt_ = et; }; - void setTowerIPhi(int iPhi) { towerIPhi_ = iPhi; }; - void setTowerIEta(int iEta) { towerIEta_ = iEta; }; - void setTowerPhi(float phi) { towerPhi_ = phi; }; - void setTowerEta(float eta) { towerEta_ = eta; }; - void setL1egTowerEt(float et) { l1egTowerEt_ = et; }; - void setNL1eg(int n) { nL1eg_ = n; }; - void setL1egTrkSS(int trkSS) { l1egTrkSS_ = trkSS; }; - void setL1egTrkIso(int trkIso) { l1egTrkIso_ = trkIso; }; - void setL1egStandaloneSS(int staSS) { l1egStandaloneSS_ = staSS; }; - void setL1egStandaloneIso(int staIso) { l1egStandaloneIso_ = staIso; }; - void setIsBarrel(bool isBarrel) { isBarrel_ = isBarrel; }; + private: + float ecalTowerEt_ = 0.0; + float hcalTowerEt_ = 0.0; + int towerIPhi_ = -99; + int towerIEta_ = -99; + float towerPhi_ = -99; + float towerEta_ = -99; - private: - float ecalTowerEt_ = 0.0; - float hcalTowerEt_ = 0.0; - int towerIPhi_ = -99; - int towerIEta_ = -99; - float towerPhi_ = -99; - float towerEta_ = -99; - - // L1EG info - float l1egTowerEt_ = 0.0; - int nL1eg_ = 0; - int l1egTrkSS_ = 0; - int l1egTrkIso_ = 0; - int l1egStandaloneSS_ = 0; - int l1egStandaloneIso_ = 0; - - bool isBarrel_ = false; - }; + // L1EG info + float l1egTowerEt_ = 0.0; + int nL1eg_ = 0; + int l1egTrkSS_ = 0; + int l1egTrkIso_ = 0; + int l1egStandaloneSS_ = 0; + int l1egStandaloneIso_ = 0; + bool isBarrel_ = false; + }; + } // namespace io_v1 + using CaloTower = io_v1::CaloTower; // Collection of either ECAL or HCAL TPs with the Layer1 calibration constant attached, et_calibration typedef std::vector CaloTowerCollection; diff --git a/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterCorrelator.h b/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterCorrelator.h index 5b24441295f3d..832c67ac37c6c 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterCorrelator.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterCorrelator.h @@ -5,184 +5,186 @@ #include namespace l1tp2 { + namespace io_v1 { + class DigitizedClusterCorrelator { + private: + // Data + unsigned long long int clusterData; + unsigned int idxGCTCard; // 0, 1, or 2 + + // Constants + static constexpr unsigned int n_towers_eta = 34; // in GCT card unique region + static constexpr unsigned int n_towers_phi = 24; // in GCT card unique region + static constexpr unsigned int n_crystals_in_tower = 5; + static constexpr float LSB_PT = 0.5; // 0.5 GeV + static constexpr float ETA_RANGE_ONE_SIDE = 1.4841; // barrel goes from (-1.4841, +1.4841) + static constexpr float LSB_ETA = + ((2 * ETA_RANGE_ONE_SIDE) / (n_towers_eta * n_crystals_in_tower)); // (2.8 / 170) + static constexpr float LSB_PHI = ((2 * M_PI) / (3 * n_towers_phi * n_crystals_in_tower)); // (2 pi * 360) + + static constexpr unsigned int n_bits_pt = 12; // 12 bits allocated for pt + static constexpr unsigned int n_bits_unused_start = 63; // unused bits start at bit 63 + + // "top" of the correlator card #0 in GCT coordinates is iPhi tower index 24 + static constexpr int correlatorCard0_tower_iphi_offset = 24; + // same but for correlator cards #1 and 2 (cards wrap around phi = 180 degrees): + static constexpr int correlatorCard1_tower_iphi_offset = 48; + static constexpr int correlatorCard2_tower_iphi_offset = 0; + + // Private member functions to perform digitization + ap_uint<12> digitizePt(float pt_f) { + float maxPt_f = (std::pow(2, n_bits_pt) - 1) * LSB_PT; + // If pT exceeds the maximum (extremely unlikely), saturate the value + if (pt_f >= maxPt_f) { + return (ap_uint<12>)0xFFF; + } + + return (ap_uint<12>)(pt_f / LSB_PT); + } - class DigitizedClusterCorrelator { - private: - // Data - unsigned long long int clusterData; - unsigned int idxGCTCard; // 0, 1, or 2 - - // Constants - static constexpr unsigned int n_towers_eta = 34; // in GCT card unique region - static constexpr unsigned int n_towers_phi = 24; // in GCT card unique region - static constexpr unsigned int n_crystals_in_tower = 5; - static constexpr float LSB_PT = 0.5; // 0.5 GeV - static constexpr float ETA_RANGE_ONE_SIDE = 1.4841; // barrel goes from (-1.4841, +1.4841) - static constexpr float LSB_ETA = ((2 * ETA_RANGE_ONE_SIDE) / (n_towers_eta * n_crystals_in_tower)); // (2.8 / 170) - static constexpr float LSB_PHI = ((2 * M_PI) / (3 * n_towers_phi * n_crystals_in_tower)); // (2 pi * 360) - - static constexpr unsigned int n_bits_pt = 12; // 12 bits allocated for pt - static constexpr unsigned int n_bits_unused_start = 63; // unused bits start at bit 63 - - // "top" of the correlator card #0 in GCT coordinates is iPhi tower index 24 - static constexpr int correlatorCard0_tower_iphi_offset = 24; - // same but for correlator cards #1 and 2 (cards wrap around phi = 180 degrees): - static constexpr int correlatorCard1_tower_iphi_offset = 48; - static constexpr int correlatorCard2_tower_iphi_offset = 0; - - // Private member functions to perform digitization - ap_uint<12> digitizePt(float pt_f) { - float maxPt_f = (std::pow(2, n_bits_pt) - 1) * LSB_PT; - // If pT exceeds the maximum (extremely unlikely), saturate the value - if (pt_f >= maxPt_f) { - return (ap_uint<12>)0xFFF; + ap_uint<8> digitizeIEtaCr(unsigned int iEtaCr) { return (ap_uint<8>)iEtaCr; } + + ap_uint<7> digitizeIPhiCr(unsigned int iPhiCr) { return (ap_uint<7>)iPhiCr; } + + // To-do: HoE is not defined for clusters + ap_uint<4> digitizeHoE(unsigned int hoe) { return (ap_uint<4>)hoe; } + ap_uint<2> digitizeHoeFlag(unsigned int hoeFlag) { return (ap_uint<2>)hoeFlag; } + + ap_uint<3> digitizeIso(unsigned int iso) { return (ap_uint<3>)iso; } + ap_uint<2> digitizeIsoFlag(unsigned int isoFlag) { return (ap_uint<2>)isoFlag; } + + // To-do: fb: no information yet + ap_uint<6> digitizeFb(unsigned int fb) { return (ap_uint<6>)fb; } + + // To-do: timing: no information yet + ap_uint<5> digitizeTiming(unsigned int timing) { return (ap_uint<5>)timing; } + + // Shape: shower shape working point + ap_uint<2> digitizeShapeFlag(unsigned int shapeFlag) { return (ap_uint<2>)shapeFlag; } + + // TO-DO: Brems: was brems applied (NOT STORED YET IN GCT) + ap_uint<2> digitizeBrems(unsigned int brems) { return (ap_uint<2>)brems; } + + public: + DigitizedClusterCorrelator() { clusterData = 0x0; } + + DigitizedClusterCorrelator(ap_uint<64> data) { clusterData = data; } + + // Constructor from digitized inputs + DigitizedClusterCorrelator(ap_uint<12> pt, + ap_uint<8> etaCr, + ap_uint<7> phiCr, + ap_uint<4> hoe, + ap_uint<2> hoeFlag, + ap_uint<3> iso, + ap_uint<2> isoFlag, + ap_uint<6> fb, + ap_uint<5> timing, + ap_uint<2> shapeFlag, + ap_uint<2> brems, + int iGCTCard, + bool fullydigitizedInputs) { + (void)fullydigitizedInputs; + clusterData = ((ap_uint<64>)pt) | (((ap_uint<64>)etaCr) << 12) | (((ap_uint<64>)phiCr) << 20) | + (((ap_uint<64>)hoe) << 27) | (((ap_uint<64>)hoeFlag) << 31) | (((ap_uint<64>)iso) << 36) | + (((ap_uint<64>)isoFlag) << 38) | (((ap_uint<64>)fb) << 44) | (((ap_uint<64>)timing) << 49) | + (((ap_uint<64>)shapeFlag << 51)) | (((ap_uint<64>)brems << 53)); + idxGCTCard = iGCTCard; } - return (ap_uint<12>)(pt_f / LSB_PT); - } - - ap_uint<8> digitizeIEtaCr(unsigned int iEtaCr) { return (ap_uint<8>)iEtaCr; } - - ap_uint<7> digitizeIPhiCr(unsigned int iPhiCr) { return (ap_uint<7>)iPhiCr; } - - // To-do: HoE is not defined for clusters - ap_uint<4> digitizeHoE(unsigned int hoe) { return (ap_uint<4>)hoe; } - ap_uint<2> digitizeHoeFlag(unsigned int hoeFlag) { return (ap_uint<2>)hoeFlag; } - - ap_uint<3> digitizeIso(unsigned int iso) { return (ap_uint<3>)iso; } - ap_uint<2> digitizeIsoFlag(unsigned int isoFlag) { return (ap_uint<2>)isoFlag; } - - // To-do: fb: no information yet - ap_uint<6> digitizeFb(unsigned int fb) { return (ap_uint<6>)fb; } - - // To-do: timing: no information yet - ap_uint<5> digitizeTiming(unsigned int timing) { return (ap_uint<5>)timing; } - - // Shape: shower shape working point - ap_uint<2> digitizeShapeFlag(unsigned int shapeFlag) { return (ap_uint<2>)shapeFlag; } - - // TO-DO: Brems: was brems applied (NOT STORED YET IN GCT) - ap_uint<2> digitizeBrems(unsigned int brems) { return (ap_uint<2>)brems; } - - public: - DigitizedClusterCorrelator() { clusterData = 0x0; } - - DigitizedClusterCorrelator(ap_uint<64> data) { clusterData = data; } - - // Constructor from digitized inputs - DigitizedClusterCorrelator(ap_uint<12> pt, - ap_uint<8> etaCr, - ap_uint<7> phiCr, - ap_uint<4> hoe, - ap_uint<2> hoeFlag, - ap_uint<3> iso, - ap_uint<2> isoFlag, - ap_uint<6> fb, - ap_uint<5> timing, - ap_uint<2> shapeFlag, - ap_uint<2> brems, - int iGCTCard, - bool fullydigitizedInputs) { - (void)fullydigitizedInputs; - clusterData = ((ap_uint<64>)pt) | (((ap_uint<64>)etaCr) << 12) | (((ap_uint<64>)phiCr) << 20) | - (((ap_uint<64>)hoe) << 27) | (((ap_uint<64>)hoeFlag) << 31) | (((ap_uint<64>)iso) << 36) | - (((ap_uint<64>)isoFlag) << 38) | (((ap_uint<64>)fb) << 44) | (((ap_uint<64>)timing) << 49) | - (((ap_uint<64>)shapeFlag << 51)) | (((ap_uint<64>)brems << 53)); - idxGCTCard = iGCTCard; - } - - // Constructor from float inputs - DigitizedClusterCorrelator(float pt_f, - unsigned int iEtaCr, - unsigned int iPhiCr, - unsigned int hoe, - unsigned int hoeFlag, - unsigned int iso, - unsigned int isoFlag, - unsigned int fb, - unsigned int timing, - unsigned int shapeFlag, - unsigned int brems, - int iGCTCard) { - clusterData = (((ap_uint<64>)digitizePt(pt_f)) | ((ap_uint<64>)digitizeIEtaCr(iEtaCr) << 12) | - ((ap_uint<64>)digitizeIPhiCr(iPhiCr) << 20) | ((ap_uint<64>)digitizeHoE(hoe) << 27) | - ((ap_uint<64>)digitizeHoeFlag(hoeFlag) << 31) | ((ap_uint<64>)digitizeIso(iso) << 36) | - ((ap_uint<64>)digitizeIsoFlag(isoFlag) << 38) | ((ap_uint<64>)digitizeFb(fb) << 44) | - ((ap_uint<64>)digitizeTiming(timing) << 49) | ((ap_uint<64>)digitizeShapeFlag(shapeFlag) << 51) | - ((ap_uint<64>)digitizeBrems(brems) << 53)); - idxGCTCard = iGCTCard; - } - - ap_uint<64> data() const { return clusterData; } - - // Other getters - float ptLSB() const { return LSB_PT; } - ap_uint<12> pt() const { return (clusterData & 0xFFF); } - float ptFloat() const { return (pt() * ptLSB()); } - - // crystal eta in the correlator region (LSB: 2.8/170) - ap_uint<8> eta() const { return ((clusterData >> 12) & 0xFF); } // (eight 1's) 0b11111111 = 0xFF - - // crystal phi in the correlator region (LSB: 2pi/360) - ap_uint<7> phi() const { return ((clusterData >> 20) & 0x7F); } // (seven 1's) 0b1111111 = 0x7F - - // HoE value and flag: not defined yet in the emulator - ap_uint<4> hoe() const { return ((clusterData >> 27) & 0xF); } // (four 1's) 0b1111 = 0xF - ap_uint<2> hoeFlag() const { return ((clusterData >> 31) & 0x3); } // (two 1's) 0b11 = 0x3 - - // Raw isolation sum: not saved in the emulator - ap_uint<3> iso() const { return ((clusterData >> 36) & 0x7); } - - // iso flag: two bits, least significant bit is the standalone WP (true or false), second bit is the looseTk WP (true or false) - // e.g. 0b01 : standalone iso flag passed, loose Tk iso flag did not pass - ap_uint<2> isoFlags() const { return ((clusterData >> 38) & 0x3); } // (two 1's) 0b11 = 0x3 - bool passes_iso() const { return (isoFlags() & 0x1); } // standalone iso WP - bool passes_looseTkiso() const { return (isoFlags() & 0x2); } // loose Tk iso WP - - // fb and timing: not saved in the current emulator - ap_uint<6> fb() const { return ((clusterData >> 44) & 0x3F); } - ap_uint<5> timing() const { return ((clusterData >> 49) & 0x1F); } - - // shower shape shape flag: two bits, least significant bit is the standalone WP, second bit is the looseTk WP - // e.g. 0b01 : standalone shower shape flag passed, loose Tk shower shape flag did not pass - ap_uint<2> shapeFlags() const { return ((clusterData >> 51) & 0x3); } - - bool passes_ss() const { return (shapeFlags() & 0x1); } // standalone shower shape WP - bool passes_looseTkss() const { return (shapeFlags() & 0x2); } // loose Tk shower shape WP - - // brems: not saved in the current emulator - ap_uint<2> brems() const { return ((clusterData >> 53) & 0x3); } - - // which GCT card (0, 1, or 2) - unsigned int cardNumber() const { return idxGCTCard; } - - const int unusedBitsStart() const { return n_bits_unused_start; } - - // Other checks - bool passNullBitsCheck(void) const { return ((data() >> unusedBitsStart()) == 0x0); } - - // Get real eta (does not depend on card number). crystal iEta = 0 starts at real eta -1.4841. - // LSB_ETA/2 is to add half a crystal width to get the center of the crystal in eta - float realEta() const { return (float)((-1 * ETA_RANGE_ONE_SIDE) + (eta() * LSB_ETA) + (LSB_ETA / 2)); } - - // Get real phi (uses card number). - float realPhi() const { - // each card starts at a different real phi - int offset_tower = 0; - if (cardNumber() == 0) { - offset_tower = correlatorCard0_tower_iphi_offset; - } else if (cardNumber() == 1) { - offset_tower = correlatorCard1_tower_iphi_offset; - } else if (cardNumber() == 2) { - offset_tower = correlatorCard2_tower_iphi_offset; + // Constructor from float inputs + DigitizedClusterCorrelator(float pt_f, + unsigned int iEtaCr, + unsigned int iPhiCr, + unsigned int hoe, + unsigned int hoeFlag, + unsigned int iso, + unsigned int isoFlag, + unsigned int fb, + unsigned int timing, + unsigned int shapeFlag, + unsigned int brems, + int iGCTCard) { + clusterData = (((ap_uint<64>)digitizePt(pt_f)) | ((ap_uint<64>)digitizeIEtaCr(iEtaCr) << 12) | + ((ap_uint<64>)digitizeIPhiCr(iPhiCr) << 20) | ((ap_uint<64>)digitizeHoE(hoe) << 27) | + ((ap_uint<64>)digitizeHoeFlag(hoeFlag) << 31) | ((ap_uint<64>)digitizeIso(iso) << 36) | + ((ap_uint<64>)digitizeIsoFlag(isoFlag) << 38) | ((ap_uint<64>)digitizeFb(fb) << 44) | + ((ap_uint<64>)digitizeTiming(timing) << 49) | ((ap_uint<64>)digitizeShapeFlag(shapeFlag) << 51) | + ((ap_uint<64>)digitizeBrems(brems) << 53)); + idxGCTCard = iGCTCard; } - int thisPhi = (phi() + (offset_tower * n_crystals_in_tower)); - // crystal iPhi = 0 starts at real phi = -180 degrees - // LSB_PHI/2 is to add half a crystal width to get the center of the crystal in phi - return (float)((-1 * M_PI) + (thisPhi * LSB_PHI) + (LSB_PHI / 2)); - } - }; + ap_uint<64> data() const { return clusterData; } + + // Other getters + float ptLSB() const { return LSB_PT; } + ap_uint<12> pt() const { return (clusterData & 0xFFF); } + float ptFloat() const { return (pt() * ptLSB()); } + + // crystal eta in the correlator region (LSB: 2.8/170) + ap_uint<8> eta() const { return ((clusterData >> 12) & 0xFF); } // (eight 1's) 0b11111111 = 0xFF + + // crystal phi in the correlator region (LSB: 2pi/360) + ap_uint<7> phi() const { return ((clusterData >> 20) & 0x7F); } // (seven 1's) 0b1111111 = 0x7F + + // HoE value and flag: not defined yet in the emulator + ap_uint<4> hoe() const { return ((clusterData >> 27) & 0xF); } // (four 1's) 0b1111 = 0xF + ap_uint<2> hoeFlag() const { return ((clusterData >> 31) & 0x3); } // (two 1's) 0b11 = 0x3 + + // Raw isolation sum: not saved in the emulator + ap_uint<3> iso() const { return ((clusterData >> 36) & 0x7); } + + // iso flag: two bits, least significant bit is the standalone WP (true or false), second bit is the looseTk WP (true or false) + // e.g. 0b01 : standalone iso flag passed, loose Tk iso flag did not pass + ap_uint<2> isoFlags() const { return ((clusterData >> 38) & 0x3); } // (two 1's) 0b11 = 0x3 + bool passes_iso() const { return (isoFlags() & 0x1); } // standalone iso WP + bool passes_looseTkiso() const { return (isoFlags() & 0x2); } // loose Tk iso WP + + // fb and timing: not saved in the current emulator + ap_uint<6> fb() const { return ((clusterData >> 44) & 0x3F); } + ap_uint<5> timing() const { return ((clusterData >> 49) & 0x1F); } + + // shower shape shape flag: two bits, least significant bit is the standalone WP, second bit is the looseTk WP + // e.g. 0b01 : standalone shower shape flag passed, loose Tk shower shape flag did not pass + ap_uint<2> shapeFlags() const { return ((clusterData >> 51) & 0x3); } + + bool passes_ss() const { return (shapeFlags() & 0x1); } // standalone shower shape WP + bool passes_looseTkss() const { return (shapeFlags() & 0x2); } // loose Tk shower shape WP + + // brems: not saved in the current emulator + ap_uint<2> brems() const { return ((clusterData >> 53) & 0x3); } + + // which GCT card (0, 1, or 2) + unsigned int cardNumber() const { return idxGCTCard; } + + const int unusedBitsStart() const { return n_bits_unused_start; } + + // Other checks + bool passNullBitsCheck(void) const { return ((data() >> unusedBitsStart()) == 0x0); } + + // Get real eta (does not depend on card number). crystal iEta = 0 starts at real eta -1.4841. + // LSB_ETA/2 is to add half a crystal width to get the center of the crystal in eta + float realEta() const { return (float)((-1 * ETA_RANGE_ONE_SIDE) + (eta() * LSB_ETA) + (LSB_ETA / 2)); } + + // Get real phi (uses card number). + float realPhi() const { + // each card starts at a different real phi + int offset_tower = 0; + if (cardNumber() == 0) { + offset_tower = correlatorCard0_tower_iphi_offset; + } else if (cardNumber() == 1) { + offset_tower = correlatorCard1_tower_iphi_offset; + } else if (cardNumber() == 2) { + offset_tower = correlatorCard2_tower_iphi_offset; + } + int thisPhi = (phi() + (offset_tower * n_crystals_in_tower)); + // crystal iPhi = 0 starts at real phi = -180 degrees + // LSB_PHI/2 is to add half a crystal width to get the center of the crystal in phi + return (float)((-1 * M_PI) + (thisPhi * LSB_PHI) + (LSB_PHI / 2)); + } + }; + } // namespace io_v1 + using DigitizedClusterCorrelator = io_v1::DigitizedClusterCorrelator; // Collection typedef typedef std::vector DigitizedClusterCorrelatorCollection; diff --git a/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterGT.h b/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterGT.h index 728ee26865285..178820ae9303a 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterGT.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/DigitizedClusterGT.h @@ -5,97 +5,98 @@ #include namespace l1tp2 { + namespace io_v1 { + class DigitizedClusterGT { + private: + // Data + unsigned long long int clusterData; + + // Constants + static constexpr float LSB_PT = 0.03125; // 0.03125 GeV + static constexpr unsigned int n_bits_eta_pi = 12; // 12 bits corresponds to pi in eta + static constexpr unsigned int n_bits_phi_pi = 12; // 12 bits corresponds to pi in phi + static constexpr unsigned int n_bits_pt = 16; // 12 bits allocated for pt + static constexpr unsigned int n_bits_unused_start = 44; // unused bits start at bit number 44 + + float LSB_ETA = (M_PI / std::pow(2, n_bits_eta_pi)); + float LSB_PHI = (M_PI / std::pow(2, n_bits_phi_pi)); + + // Private member functions to perform digitization + ap_uint<1> digitizeIsValid(bool isValid) { return (ap_uint<1>)isValid; } + + ap_uint<16> digitizePt(float pt_f) { + float maxPt_f = (std::pow(2, n_bits_pt) - 1) * LSB_PT; + // If pT exceeds the maximum, saturate the value + if (pt_f >= maxPt_f) { + return (ap_uint<16>)0xFFFF; + } + return (ap_uint<16>)(pt_f / LSB_PT); + } + + // Use two's complements representation + ap_int<13> digitizePhi(float phi_f) { + ap_int<13> phi_digitized = (phi_f / LSB_PHI); + return phi_digitized; + } + + // Use two's complements representation + ap_int<14> digitizeEta(float eta_f) { + ap_int<14> eta_digitized = (eta_f / LSB_ETA); + return eta_digitized; + } + + public: + DigitizedClusterGT() { clusterData = 0x0; } + + DigitizedClusterGT(ap_uint<64> data) { clusterData = data; } - class DigitizedClusterGT { - private: - // Data - unsigned long long int clusterData; - - // Constants - static constexpr float LSB_PT = 0.03125; // 0.03125 GeV - static constexpr unsigned int n_bits_eta_pi = 12; // 12 bits corresponds to pi in eta - static constexpr unsigned int n_bits_phi_pi = 12; // 12 bits corresponds to pi in phi - static constexpr unsigned int n_bits_pt = 16; // 12 bits allocated for pt - static constexpr unsigned int n_bits_unused_start = 44; // unused bits start at bit number 44 - - float LSB_ETA = (M_PI / std::pow(2, n_bits_eta_pi)); - float LSB_PHI = (M_PI / std::pow(2, n_bits_phi_pi)); - - // Private member functions to perform digitization - ap_uint<1> digitizeIsValid(bool isValid) { return (ap_uint<1>)isValid; } - - ap_uint<16> digitizePt(float pt_f) { - float maxPt_f = (std::pow(2, n_bits_pt) - 1) * LSB_PT; - // If pT exceeds the maximum, saturate the value - if (pt_f >= maxPt_f) { - return (ap_uint<16>)0xFFFF; + // Constructor from digitized inputs + DigitizedClusterGT(ap_uint<1> isValid, ap_uint<16> pt, ap_int<13> phi, ap_int<14> eta, bool fullyDigitizedInputs) { + (void)fullyDigitizedInputs; + clusterData = + ((ap_uint<64>)isValid) | (((ap_uint<64>)pt) << 1) | (((ap_uint<64>)phi) << 17) | (((ap_uint<64>)eta) << 30); + } + + // Constructor from float inputs that will perform digitization + DigitizedClusterGT(bool isValid, float pt_f, float phi_f, float eta_f) { + // N.b.: For eta/phi, after shifting the bits to the correct place and casting to ap_uint<64>, + // we have an additional bit mask + // e.g. 0x3FFE0000 for phi. This mask is all zero's except for 1 in the phi bits (bits 17 through 29): + // bit mask = 0x3FFE0000 = 0b111111111111100000000000000000 + // Applying the "and" of this bitmask, avoids bogus 1's in the case where phi is negative + + clusterData = ((ap_uint<64>)digitizeIsValid(isValid)) | ((ap_uint<64>)digitizePt(pt_f) << 1) | + (((ap_uint<64>)digitizePhi(phi_f) << 17) & + 0x3FFE0000) | // 0x3FFE0000 is all zero's except the phi bits (bits 17 through 29) + (((ap_uint<64>)digitizeEta(eta_f) << 30) & + 0xFFFC0000000); // 0xFFFC0000000 is all zero's except the eta bits (bits 30 through 32) + } + + ap_uint<64> data() const { return clusterData; } + + // Other getters + float ptLSB() const { return LSB_PT; } + float phiLSB() const { return LSB_PHI; } + float etaLSB() const { return LSB_ETA; } + ap_uint<1> isValid() const { return (clusterData & 0x1); } + ap_uint<16> pt() const { return ((clusterData >> 1) & 0xFFFF); } // 16 1's = 0xFFFF + ap_int<13> phi() const { return ((clusterData >> 17) & 0x1FFF); } // (thirteen 1's)= 0x1FFF + ap_int<14> eta() const { return ((clusterData >> 30) & 0x3FFF); } // (fourteen 1's) = 0x3FFF + + float ptFloat() const { return (pt() * ptLSB()); } + float realPhi() const { // convert from signed int to float + return (phi() * phiLSB()); + } + float realEta() const { // convert from signed int to float + return (eta() * etaLSB()); } - return (ap_uint<16>)(pt_f / LSB_PT); - } - - // Use two's complements representation - ap_int<13> digitizePhi(float phi_f) { - ap_int<13> phi_digitized = (phi_f / LSB_PHI); - return phi_digitized; - } - - // Use two's complements representation - ap_int<14> digitizeEta(float eta_f) { - ap_int<14> eta_digitized = (eta_f / LSB_ETA); - return eta_digitized; - } - - public: - DigitizedClusterGT() { clusterData = 0x0; } - - DigitizedClusterGT(ap_uint<64> data) { clusterData = data; } - - // Constructor from digitized inputs - DigitizedClusterGT(ap_uint<1> isValid, ap_uint<16> pt, ap_int<13> phi, ap_int<14> eta, bool fullyDigitizedInputs) { - (void)fullyDigitizedInputs; - clusterData = - ((ap_uint<64>)isValid) | (((ap_uint<64>)pt) << 1) | (((ap_uint<64>)phi) << 17) | (((ap_uint<64>)eta) << 30); - } - - // Constructor from float inputs that will perform digitization - DigitizedClusterGT(bool isValid, float pt_f, float phi_f, float eta_f) { - // N.b.: For eta/phi, after shifting the bits to the correct place and casting to ap_uint<64>, - // we have an additional bit mask - // e.g. 0x3FFE0000 for phi. This mask is all zero's except for 1 in the phi bits (bits 17 through 29): - // bit mask = 0x3FFE0000 = 0b111111111111100000000000000000 - // Applying the "and" of this bitmask, avoids bogus 1's in the case where phi is negative - - clusterData = ((ap_uint<64>)digitizeIsValid(isValid)) | ((ap_uint<64>)digitizePt(pt_f) << 1) | - (((ap_uint<64>)digitizePhi(phi_f) << 17) & - 0x3FFE0000) | // 0x3FFE0000 is all zero's except the phi bits (bits 17 through 29) - (((ap_uint<64>)digitizeEta(eta_f) << 30) & - 0xFFFC0000000); // 0xFFFC0000000 is all zero's except the eta bits (bits 30 through 32) - } - - ap_uint<64> data() const { return clusterData; } - - // Other getters - float ptLSB() const { return LSB_PT; } - float phiLSB() const { return LSB_PHI; } - float etaLSB() const { return LSB_ETA; } - ap_uint<1> isValid() const { return (clusterData & 0x1); } - ap_uint<16> pt() const { return ((clusterData >> 1) & 0xFFFF); } // 16 1's = 0xFFFF - ap_int<13> phi() const { return ((clusterData >> 17) & 0x1FFF); } // (thirteen 1's)= 0x1FFF - ap_int<14> eta() const { return ((clusterData >> 30) & 0x3FFF); } // (fourteen 1's) = 0x3FFF - - float ptFloat() const { return (pt() * ptLSB()); } - float realPhi() const { // convert from signed int to float - return (phi() * phiLSB()); - } - float realEta() const { // convert from signed int to float - return (eta() * etaLSB()); - } - const int unusedBitsStart() const { return n_bits_unused_start; } // unused bits start at bit 44 - - // Other checks - bool passNullBitsCheck(void) const { return ((data() >> unusedBitsStart()) == 0x0); } - }; + const int unusedBitsStart() const { return n_bits_unused_start; } // unused bits start at bit 44 + // Other checks + bool passNullBitsCheck(void) const { return ((data() >> unusedBitsStart()) == 0x0); } + }; + } // namespace io_v1 + using DigitizedClusterGT = io_v1::DigitizedClusterGT; // Collection typedef typedef std::vector DigitizedClusterGTCollection; diff --git a/DataFormats/L1TCalorimeterPhase2/interface/DigitizedTowerCorrelator.h b/DataFormats/L1TCalorimeterPhase2/interface/DigitizedTowerCorrelator.h index 9ec88d1957cf4..778ff4dbac340 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/DigitizedTowerCorrelator.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/DigitizedTowerCorrelator.h @@ -5,90 +5,91 @@ #include namespace l1tp2 { - - class DigitizedTowerCorrelator { - private: - // Data - unsigned int towerData; - unsigned int idxCard; // 0, 1, or 2 (there are three GCT cards) - unsigned int idxFiber; // 0 to 47 (there are 48 fibers in one GCT card) - unsigned int idxTower; // 0 to 16 (there are 17 towers in one fiber) - - // Constants - static constexpr float LSB_ET = 0.5; // 0.5 GeV, so max value is (2^10 - 1) * 0.5 = 511.5 GeV - static constexpr unsigned int n_bits_pt = 10; - static constexpr unsigned int n_towers_in_fiber = 17; - static constexpr unsigned int n_fibers_in_card = 48; - static constexpr unsigned int n_cards = 3; - - // Private member functions to perform digitization - ap_uint<10> digitizeEt(float et_f) { - float maxEt_f = (std::pow(2, n_bits_pt) - 1) * LSB_ET; - // If pT exceeds the maximum, saturate the value - if (et_f >= maxEt_f) { - return (ap_uint<10>)0x3FF; + namespace io_v1 { + class DigitizedTowerCorrelator { + private: + // Data + unsigned int towerData; + unsigned int idxCard; // 0, 1, or 2 (there are three GCT cards) + unsigned int idxFiber; // 0 to 47 (there are 48 fibers in one GCT card) + unsigned int idxTower; // 0 to 16 (there are 17 towers in one fiber) + + // Constants + static constexpr float LSB_ET = 0.5; // 0.5 GeV, so max value is (2^10 - 1) * 0.5 = 511.5 GeV + static constexpr unsigned int n_bits_pt = 10; + static constexpr unsigned int n_towers_in_fiber = 17; + static constexpr unsigned int n_fibers_in_card = 48; + static constexpr unsigned int n_cards = 3; + + // Private member functions to perform digitization + ap_uint<10> digitizeEt(float et_f) { + float maxEt_f = (std::pow(2, n_bits_pt) - 1) * LSB_ET; + // If pT exceeds the maximum, saturate the value + if (et_f >= maxEt_f) { + return (ap_uint<10>)0x3FF; + } + return (ap_uint<10>)(et_f / LSB_ET); } - return (ap_uint<10>)(et_f / LSB_ET); - } - - ap_uint<4> digitizeHoE(ap_uint<4> hoe) { return (ap_uint<4>)hoe; } - - // To-do: FB not implemented yet - ap_uint<2> digitizeFB(ap_uint<2> fb) { return (ap_uint<2>)fb; } - - public: - DigitizedTowerCorrelator() { towerData = 0x0; } - - DigitizedTowerCorrelator(ap_uint<16> data) { towerData = data; } - // Constructor from digitized inputs - DigitizedTowerCorrelator(ap_uint<10> et, - ap_uint<4> hoe, - ap_uint<2> fb, - unsigned int indexCard, - unsigned int indexFiber, - unsigned int indexTower, - bool fullyDigitizedInputs) { - (void)fullyDigitizedInputs; - towerData = ((ap_uint<16>)et) | (((ap_uint<16>)hoe) << 10) | (((ap_uint<16>)fb) << 14); - idxCard = indexCard; - idxFiber = indexFiber; - idxTower = indexTower; - assert(hasValidIndices()); - } - - // Constructor from float inputs - DigitizedTowerCorrelator(float et_f, - ap_uint<4> hoe, - ap_uint<2> fb, - unsigned int indexCard, - unsigned int indexFiber, - unsigned int indexTower) { - towerData = ((ap_uint<16>)digitizeEt(et_f)) | (((ap_uint<16>)hoe) << 10) | (((ap_uint<16>)fb) << 14); - idxCard = indexCard; - idxFiber = indexFiber; - idxTower = indexTower; - assert(hasValidIndices()); - } - - ap_uint<16> data() const { return towerData; } - - // Other getters - float etLSB() const { return LSB_ET; } - ap_uint<10> et() const { return (towerData & 0x3FF); } // ten 1's = 0x3FF - ap_uint<4> hoe() const { return ((towerData >> 10) & 0xF); } // four 1's= 0xF - ap_uint<2> fb() const { return ((towerData >> 14) & 0x3); } // two 1's = 0x3 - float etFloat() const { return et() * etLSB(); } - unsigned int cardNumber() const { return idxCard; } // GCT card number - unsigned int fiberNumber() const { return idxFiber; } // fiber number in card (hardware convention) - unsigned int towerNumber() const { return idxTower; } // tower number in fiber (hardware convention) + ap_uint<4> digitizeHoE(ap_uint<4> hoe) { return (ap_uint<4>)hoe; } + + // To-do: FB not implemented yet + ap_uint<2> digitizeFB(ap_uint<2> fb) { return (ap_uint<2>)fb; } + + public: + DigitizedTowerCorrelator() { towerData = 0x0; } + + DigitizedTowerCorrelator(ap_uint<16> data) { towerData = data; } + + // Constructor from digitized inputs + DigitizedTowerCorrelator(ap_uint<10> et, + ap_uint<4> hoe, + ap_uint<2> fb, + unsigned int indexCard, + unsigned int indexFiber, + unsigned int indexTower, + bool fullyDigitizedInputs) { + (void)fullyDigitizedInputs; + towerData = ((ap_uint<16>)et) | (((ap_uint<16>)hoe) << 10) | (((ap_uint<16>)fb) << 14); + idxCard = indexCard; + idxFiber = indexFiber; + idxTower = indexTower; + assert(hasValidIndices()); + } - // Other checks - bool hasValidIndices(void) const { - return (idxTower < n_towers_in_fiber) && (idxFiber < n_fibers_in_card) && (idxCard < n_cards); - } - }; + // Constructor from float inputs + DigitizedTowerCorrelator(float et_f, + ap_uint<4> hoe, + ap_uint<2> fb, + unsigned int indexCard, + unsigned int indexFiber, + unsigned int indexTower) { + towerData = ((ap_uint<16>)digitizeEt(et_f)) | (((ap_uint<16>)hoe) << 10) | (((ap_uint<16>)fb) << 14); + idxCard = indexCard; + idxFiber = indexFiber; + idxTower = indexTower; + assert(hasValidIndices()); + } + ap_uint<16> data() const { return towerData; } + + // Other getters + float etLSB() const { return LSB_ET; } + ap_uint<10> et() const { return (towerData & 0x3FF); } // ten 1's = 0x3FF + ap_uint<4> hoe() const { return ((towerData >> 10) & 0xF); } // four 1's= 0xF + ap_uint<2> fb() const { return ((towerData >> 14) & 0x3); } // two 1's = 0x3 + float etFloat() const { return et() * etLSB(); } + unsigned int cardNumber() const { return idxCard; } // GCT card number + unsigned int fiberNumber() const { return idxFiber; } // fiber number in card (hardware convention) + unsigned int towerNumber() const { return idxTower; } // tower number in fiber (hardware convention) + + // Other checks + bool hasValidIndices(void) const { + return (idxTower < n_towers_in_fiber) && (idxFiber < n_fibers_in_card) && (idxCard < n_cards); + } + }; + } // namespace io_v1 + using DigitizedTowerCorrelator = io_v1::DigitizedTowerCorrelator; // Collection typedef typedef std::vector DigitizedTowerCorrelatorCollection; diff --git a/DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h b/DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h index cdeb45467371c..667ec484a97d5 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/Phase2L1CaloJet.h @@ -9,92 +9,93 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" namespace l1tp2 { + namespace io_v1 { + class Phase2L1CaloJet : public l1t::L1Candidate { + public: + Phase2L1CaloJet() + : l1t::L1Candidate(), + jetEt_(0.), + tauEt_(0.), + jetIEta_(-99), + jetIPhi_(-99), + jetEta_(-99.), + jetPhi_(-99.), + towerEt_(0.), + towerIEta_(-99), + towerIPhi_(-99), + towerEta_(-99.), + towerPhi_(-99.) {} - class Phase2L1CaloJet : public l1t::L1Candidate { - public: - Phase2L1CaloJet() - : l1t::L1Candidate(), - jetEt_(0.), - tauEt_(0.), - jetIEta_(-99), - jetIPhi_(-99), - jetEta_(-99.), - jetPhi_(-99.), - towerEt_(0.), - towerIEta_(-99), - towerIPhi_(-99), - towerEta_(-99.), - towerPhi_(-99.) {} + Phase2L1CaloJet(const PolarLorentzVector& p4, + float jetEt, + float tauEt, + int jetIEta, + int jetIPhi, + float jetEta, + float jetPhi, + float towerEt, + int towerIEta, + int towerIPhi, + float towerEta, + float towerPhi) + : l1t::L1Candidate(p4), + jetEt_(jetEt), + tauEt_(tauEt), + jetIEta_(jetIEta), + jetIPhi_(jetIPhi), + jetEta_(jetEta), + jetPhi_(jetPhi), + towerEt_(towerEt), + towerIEta_(towerIEta), + towerIPhi_(towerIPhi), + towerEta_(towerEta), + towerPhi_(towerPhi) {} - Phase2L1CaloJet(const PolarLorentzVector& p4, - float jetEt, - float tauEt, - int jetIEta, - int jetIPhi, - float jetEta, - float jetPhi, - float towerEt, - int towerIEta, - int towerIPhi, - float towerEta, - float towerPhi) - : l1t::L1Candidate(p4), - jetEt_(jetEt), - tauEt_(tauEt), - jetIEta_(jetIEta), - jetIPhi_(jetIPhi), - jetEta_(jetEta), - jetPhi_(jetPhi), - towerEt_(towerEt), - towerIEta_(towerIEta), - towerIPhi_(towerIPhi), - towerEta_(towerEta), - towerPhi_(towerPhi) {} + inline float jetEt() const { return jetEt_; }; + inline float tauEt() const { return tauEt_; }; + inline int jetIEta() const { return jetIEta_; }; + inline int jetIPhi() const { return jetIPhi_; }; + inline float jetEta() const { return jetEta_; }; + inline float jetPhi() const { return jetPhi_; }; + inline float towerEt() const { return towerEt_; }; + inline int towerIEta() const { return towerIEta_; }; + inline int towerIPhi() const { return towerIPhi_; }; + inline float towerEta() const { return towerEta_; }; + inline float towerPhi() const { return towerPhi_; }; - inline float jetEt() const { return jetEt_; }; - inline float tauEt() const { return tauEt_; }; - inline int jetIEta() const { return jetIEta_; }; - inline int jetIPhi() const { return jetIPhi_; }; - inline float jetEta() const { return jetEta_; }; - inline float jetPhi() const { return jetPhi_; }; - inline float towerEt() const { return towerEt_; }; - inline int towerIEta() const { return towerIEta_; }; - inline int towerIPhi() const { return towerIPhi_; }; - inline float towerEta() const { return towerEta_; }; - inline float towerPhi() const { return towerPhi_; }; - - void setJetEt(float jetEtIn) { jetEt_ = jetEtIn; }; - void setTauEt(float tauEtIn) { tauEt_ = tauEtIn; }; - void setJetIEta(int jetIEtaIn) { jetIEta_ = jetIEtaIn; }; - void setJetIPhi(int jetIPhiIn) { jetIPhi_ = jetIPhiIn; }; - void setJetEta(float jetEtaIn) { jetEta_ = jetEtaIn; }; - void setJetPhi(float jetPhiIn) { jetPhi_ = jetPhiIn; }; - void setTowerEt(float towerEtIn) { towerEt_ = towerEtIn; }; - void setTowerIEta(int towerIEtaIn) { towerIEta_ = towerIEtaIn; }; - void setTowerIPhi(int towerIPhiIn) { towerIPhi_ = towerIPhiIn; }; - void setTowerEta(float towerEtaIn) { towerEta_ = towerEtaIn; }; - void setTowerPhi(float towerPhiIn) { towerPhi_ = towerPhiIn; }; - - private: - // ET - float jetEt_; - // Tau ET - float tauEt_; - // GCT ieta - int jetIEta_; - // GCT iphi - int jetIPhi_; - // Tower (real) eta - float jetEta_; - // Tower (real) phi - float jetPhi_; - float towerEt_; - int towerIEta_; - int towerIPhi_; - float towerEta_; - float towerPhi_; - }; + void setJetEt(float jetEtIn) { jetEt_ = jetEtIn; }; + void setTauEt(float tauEtIn) { tauEt_ = tauEtIn; }; + void setJetIEta(int jetIEtaIn) { jetIEta_ = jetIEtaIn; }; + void setJetIPhi(int jetIPhiIn) { jetIPhi_ = jetIPhiIn; }; + void setJetEta(float jetEtaIn) { jetEta_ = jetEtaIn; }; + void setJetPhi(float jetPhiIn) { jetPhi_ = jetPhiIn; }; + void setTowerEt(float towerEtIn) { towerEt_ = towerEtIn; }; + void setTowerIEta(int towerIEtaIn) { towerIEta_ = towerIEtaIn; }; + void setTowerIPhi(int towerIPhiIn) { towerIPhi_ = towerIPhiIn; }; + void setTowerEta(float towerEtaIn) { towerEta_ = towerEtaIn; }; + void setTowerPhi(float towerPhiIn) { towerPhi_ = towerPhiIn; }; + private: + // ET + float jetEt_; + // Tau ET + float tauEt_; + // GCT ieta + int jetIEta_; + // GCT iphi + int jetIPhi_; + // Tower (real) eta + float jetEta_; + // Tower (real) phi + float jetPhi_; + float towerEt_; + int towerIEta_; + int towerIPhi_; + float towerEta_; + float towerPhi_; + }; + } // namespace io_v1 + using Phase2L1CaloJet = io_v1::Phase2L1CaloJet; // Concrete collection of output objects (with extra tuning information) typedef std::vector Phase2L1CaloJetCollection; } // namespace l1tp2 diff --git a/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml b/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml index d812650d64efd..415edca70901c 100644 --- a/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml +++ b/DataFormats/L1TCalorimeterPhase2/src/classes_def.xml @@ -4,23 +4,23 @@ - - + + - + - - + + - + - + @@ -34,32 +34,29 @@ - - + + - + - - - + + - - - + + - - - + + @@ -71,7 +68,7 @@ - + diff --git a/DataFormats/L1TCorrelator/interface/TkElectron.h b/DataFormats/L1TCorrelator/interface/TkElectron.h index 29a1df62b023b..d0b370d763002 100644 --- a/DataFormats/L1TCorrelator/interface/TkElectron.h +++ b/DataFormats/L1TCorrelator/interface/TkElectron.h @@ -19,44 +19,46 @@ #include namespace l1t { + namespace io_v1 { + class TkElectron : public TkEm { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; - class TkElectron : public TkEm { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; + TkElectron(); - TkElectron(); + TkElectron(const LorentzVector& p4, + const edm::Ptr& egCaloPtr, + const edm::Ptr& trkPtr, + float tkisol = -999.); - TkElectron(const LorentzVector& p4, - const edm::Ptr& egCaloPtr, - const edm::Ptr& trkPtr, - float tkisol = -999.); + TkElectron(const LorentzVector& p4, float tkisol = -999.); - TkElectron(const LorentzVector& p4, float tkisol = -999.); + // ---------- const member functions --------------------- - // ---------- const member functions --------------------- + const edm::Ptr& trkPtr() const { return trkPtr_; } - const edm::Ptr& trkPtr() const { return trkPtr_; } + float trkzVtx() const { return trkzVtx_; } + float idScore() const { return idScore_; } + // ---------- member functions --------------------------- - float trkzVtx() const { return trkzVtx_; } - float idScore() const { return idScore_; } - // ---------- member functions --------------------------- + void setTrkPtr(const edm::Ptr& tkPtr) { trkPtr_ = tkPtr; } + void setTrkzVtx(float TrkzVtx) { trkzVtx_ = TrkzVtx; } + void setIdScore(float score) { idScore_ = score; } - void setTrkPtr(const edm::Ptr& tkPtr) { trkPtr_ = tkPtr; } - void setTrkzVtx(float TrkzVtx) { trkzVtx_ = TrkzVtx; } - void setIdScore(float score) { idScore_ = score; } - - l1gt::Electron hwObj() const { - if (encoding() != HWEncoding::GT) { - throw cms::Exception("RuntimeError") << "TkElectron::hwObj : encoding is not in GT format!" << std::endl; + l1gt::Electron hwObj() const { + if (encoding() != HWEncoding::GT) { + throw cms::Exception("RuntimeError") << "TkElectron::hwObj : encoding is not in GT format!" << std::endl; + } + return l1gt::Electron::unpack_ap(egBinaryWord()); } - return l1gt::Electron::unpack_ap(egBinaryWord()); - } - - private: - edm::Ptr trkPtr_; - float trkzVtx_; - float idScore_; - }; + + private: + edm::Ptr trkPtr_; + float trkzVtx_; + float idScore_; + }; + } // namespace io_v1 + using TkElectron = io_v1::TkElectron; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkElectronFwd.h b/DataFormats/L1TCorrelator/interface/TkElectronFwd.h index afef20cfa5da5..53ce87783c290 100644 --- a/DataFormats/L1TCorrelator/interface/TkElectronFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkElectronFwd.h @@ -13,7 +13,10 @@ #include "DataFormats/L1Trigger/interface/RegionalOutput.h" namespace l1t { - class TkElectron; + namespace io_v1 { + class TkElectron; + } + using TkElectron = io_v1::TkElectron; typedef std::vector TkElectronCollection; diff --git a/DataFormats/L1TCorrelator/interface/TkEm.h b/DataFormats/L1TCorrelator/interface/TkEm.h index 051a324a8e082..aff9bb1ae4a26 100644 --- a/DataFormats/L1TCorrelator/interface/TkEm.h +++ b/DataFormats/L1TCorrelator/interface/TkEm.h @@ -19,73 +19,75 @@ #include namespace l1t { + namespace io_v1 { + class TkEm : public L1Candidate { + public: + TkEm(); - class TkEm : public L1Candidate { - public: - TkEm(); + TkEm(const LorentzVector& p4, float tkisol = -999., float tkisolPV = -999); - TkEm(const LorentzVector& p4, float tkisol = -999., float tkisolPV = -999); + TkEm(const LorentzVector& p4, const edm::Ptr& egCaloPtr, float tkisol = -999., float tkisolPV = -999); - TkEm(const LorentzVector& p4, const edm::Ptr& egCaloPtr, float tkisol = -999., float tkisolPV = -999); + enum class HWEncoding { None, CT, GT }; - enum class HWEncoding { None, CT, GT }; + // ---------- const member functions --------------------- - // ---------- const member functions --------------------- + const edm::Ptr& egCaloPtr() const { return egCaloPtr_; } - const edm::Ptr& egCaloPtr() const { return egCaloPtr_; } + float trkIsol() const { return trkIsol_; } // not constrained to the PV, just track ptSum + float trkIsolPV() const { return trkIsolPV_; } // constrained to the PV by DZ + float pfIsol() const { return pfIsol_; } // not constrained to the PV, just track ptSum + float pfIsolPV() const { return pfIsolPV_; } // constrained to the PV by DZ + float puppiIsol() const { return puppiIsol_; } // not constrained to the PV, just track ptSum + float puppiIsolPV() const { return puppiIsolPV_; } // constrained to the PV by DZ - float trkIsol() const { return trkIsol_; } // not constrained to the PV, just track ptSum - float trkIsolPV() const { return trkIsolPV_; } // constrained to the PV by DZ - float pfIsol() const { return pfIsol_; } // not constrained to the PV, just track ptSum - float pfIsolPV() const { return pfIsolPV_; } // constrained to the PV by DZ - float puppiIsol() const { return puppiIsol_; } // not constrained to the PV, just track ptSum - float puppiIsolPV() const { return puppiIsolPV_; } // constrained to the PV by DZ + // ---------- member functions --------------------------- - // ---------- member functions --------------------------- + void setTrkIsol(float TrkIsol) { trkIsol_ = TrkIsol; } + void setTrkIsolPV(float TrkIsolPV) { trkIsolPV_ = TrkIsolPV; } + void setPFIsol(float pfIsol) { pfIsol_ = pfIsol; } + void setPFIsolPV(float pfIsolPV) { pfIsolPV_ = pfIsolPV; } + void setPuppiIsol(float puppiIsol) { puppiIsol_ = puppiIsol; } + void setPuppiIsolPV(float puppiIsolPV) { puppiIsolPV_ = puppiIsolPV; } + void setEgCaloPtr(const edm::Ptr& egPtr) { egCaloPtr_ = egPtr; } - void setTrkIsol(float TrkIsol) { trkIsol_ = TrkIsol; } - void setTrkIsolPV(float TrkIsolPV) { trkIsolPV_ = TrkIsolPV; } - void setPFIsol(float pfIsol) { pfIsol_ = pfIsol; } - void setPFIsolPV(float pfIsolPV) { pfIsolPV_ = pfIsolPV; } - void setPuppiIsol(float puppiIsol) { puppiIsol_ = puppiIsol; } - void setPuppiIsolPV(float puppiIsolPV) { puppiIsolPV_ = puppiIsolPV; } - void setEgCaloPtr(const edm::Ptr& egPtr) { egCaloPtr_ = egPtr; } + template + void setEgBinaryWord(ap_uint word, HWEncoding encoding) { + egBinaryWord0_ = word; + egBinaryWord1_ = (word >> 32); + egBinaryWord2_ = (word >> 64); + encoding_ = encoding; + } - template - void setEgBinaryWord(ap_uint word, HWEncoding encoding) { - egBinaryWord0_ = word; - egBinaryWord1_ = (word >> 32); - egBinaryWord2_ = (word >> 64); - encoding_ = encoding; - } + l1gt::Photon hwObj() const { + if (encoding() != HWEncoding::GT) { + throw cms::Exception("RuntimeError") << "TkEm::hwObj : encoding is not in GT format!" << std::endl; + } + return l1gt::Photon::unpack_ap(egBinaryWord()); + } - l1gt::Photon hwObj() const { - if (encoding() != HWEncoding::GT) { - throw cms::Exception("RuntimeError") << "TkEm::hwObj : encoding is not in GT format!" << std::endl; + template + ap_uint egBinaryWord() const { + return ap_uint(egBinaryWord0_) | (ap_uint(egBinaryWord1_) << 32) | (ap_uint(egBinaryWord2_) << 64); } - return l1gt::Photon::unpack_ap(egBinaryWord()); - } - - template - ap_uint egBinaryWord() const { - return ap_uint(egBinaryWord0_) | (ap_uint(egBinaryWord1_) << 32) | (ap_uint(egBinaryWord2_) << 64); - } - - HWEncoding encoding() const { return encoding_; } - - private: - edm::Ptr egCaloPtr_; - float trkIsol_; - float trkIsolPV_; - float pfIsol_; - float pfIsolPV_; - float puppiIsol_; - float puppiIsolPV_; - uint32_t egBinaryWord0_; - uint32_t egBinaryWord1_; - uint32_t egBinaryWord2_; - HWEncoding encoding_; - }; + + HWEncoding encoding() const { return encoding_; } + + private: + edm::Ptr egCaloPtr_; + float trkIsol_; + float trkIsolPV_; + float pfIsol_; + float pfIsolPV_; + float puppiIsol_; + float puppiIsolPV_; + uint32_t egBinaryWord0_; + uint32_t egBinaryWord1_; + uint32_t egBinaryWord2_; + HWEncoding encoding_; + }; + } // namespace io_v1 + using TkEm = io_v1::TkEm; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkEmFwd.h b/DataFormats/L1TCorrelator/interface/TkEmFwd.h index 8a190eec390ff..8e3e2b932068e 100644 --- a/DataFormats/L1TCorrelator/interface/TkEmFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkEmFwd.h @@ -14,7 +14,10 @@ namespace l1t { - class TkEm; + namespace io_v1 { + class TkEm; + } + using TkEm = io_v1::TkEm; typedef std::vector TkEmCollection; diff --git a/DataFormats/L1TCorrelator/interface/TkEtMiss.h b/DataFormats/L1TCorrelator/interface/TkEtMiss.h index 8fdcd13246938..b7454fcafdcfc 100644 --- a/DataFormats/L1TCorrelator/interface/TkEtMiss.h +++ b/DataFormats/L1TCorrelator/interface/TkEtMiss.h @@ -6,60 +6,63 @@ #include "DataFormats/L1Trigger/interface/VertexWord.h" namespace l1t { - class TkEtMiss : public L1Candidate { - public: - enum EtMissType { kMET, kMHT, kNumTypes }; - TkEtMiss(); - TkEtMiss(const LorentzVector& p4, - EtMissType type, - const double& etTotal, - const double& etMissPU, - const double& etTotalPU, - const edm::Ref& aVtxRef = edm::Ref(), - int bx = 0); + namespace io_v1 { + class TkEtMiss : public L1Candidate { + public: + enum EtMissType { kMET, kMHT, kNumTypes }; + TkEtMiss(); + TkEtMiss(const LorentzVector& p4, + EtMissType type, + const double& etTotal, + const double& etMissPU, + const double& etTotalPU, + const edm::Ref& aVtxRef = edm::Ref(), + int bx = 0); - TkEtMiss(const LorentzVector& p4, - EtMissType type, - const double& etTotal, - const double& etMissPU, - const double& etTotalPU, - int bx = 0); + TkEtMiss(const LorentzVector& p4, + EtMissType type, + const double& etTotal, + const double& etMissPU, + const double& etTotalPU, + int bx = 0); - TkEtMiss(const LorentzVector& p4, EtMissType type, const double& EtPhi, const int& NumTracks, int bx = 0); + TkEtMiss(const LorentzVector& p4, EtMissType type, const double& EtPhi, const int& NumTracks, int bx = 0); - // ---------- const member functions --------------------- - EtMissType type() const { return type_; } // kMET or kMHT - // For type = kMET, this is |MET|; for type = kMHT, this is |MHT| - double etMiss() const { return et(); } - // For type = kMET, this is total ET; for type = kMHT, this is total HT - double etTotal() const { return etTot_; } - // EtMiss and EtTot from PU vertices - double etMissPU() const { return etMissPU_; } - double etTotalPU() const { return etTotalPU_; } - int bx() const { return bx_; } - const edm::Ref& vtxRef() const { return vtxRef_; } + // ---------- const member functions --------------------- + EtMissType type() const { return type_; } // kMET or kMHT + // For type = kMET, this is |MET|; for type = kMHT, this is |MHT| + double etMiss() const { return et(); } + // For type = kMET, this is total ET; for type = kMHT, this is total HT + double etTotal() const { return etTot_; } + // EtMiss and EtTot from PU vertices + double etMissPU() const { return etMissPU_; } + double etTotalPU() const { return etTotalPU_; } + int bx() const { return bx_; } + const edm::Ref& vtxRef() const { return vtxRef_; } - double etPhi() const { return etPhi_; } - int etQual() const { return etQual_; } + double etPhi() const { return etPhi_; } + int etQual() const { return etQual_; } - // ---------- member functions --------------------------- - void setEtTotal(const double& etTotal) { etTot_ = etTotal; } - void setBx(int bx) { bx_ = bx; } + // ---------- member functions --------------------------- + void setEtTotal(const double& etTotal) { etTot_ = etTotal; } + void setBx(int bx) { bx_ = bx; } - private: - // ---------- member data -------------------------------- - EtMissType type_; - double etTot_; - double etMissPU_; - double etTotalPU_; - edm::Ref vtxRef_; + private: + // ---------- member data -------------------------------- + EtMissType type_; + double etTot_; + double etMissPU_; + double etTotalPU_; + edm::Ref vtxRef_; - double etMiss_; - double etPhi_; - int etQual_; + double etMiss_; + double etPhi_; + int etQual_; - int bx_; - }; + int bx_; + }; + } // namespace io_v1 + using TkEtMiss = io_v1::TkEtMiss; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h b/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h index d70874b0222b2..5c9c772ed5465 100644 --- a/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkEtMissFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace l1t { - class TkEtMiss; + namespace io_v1 { + class TkEtMiss; + } + using TkEtMiss = io_v1::TkEtMiss; typedef std::vector TkEtMissCollection; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkHTMiss.h b/DataFormats/L1TCorrelator/interface/TkHTMiss.h index 174511c34aa09..f4b60812642f7 100644 --- a/DataFormats/L1TCorrelator/interface/TkHTMiss.h +++ b/DataFormats/L1TCorrelator/interface/TkHTMiss.h @@ -12,47 +12,50 @@ #include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" namespace l1t { - class TkHTMiss : public L1Candidate { - public: - TkHTMiss(); - TkHTMiss(const LorentzVector& p4, - double EtTotal, - const edm::RefProd& jetCollRef = edm::RefProd(), - const edm::Ref& aVtxRef = edm::Ref(), - int bx = 0); - - // ---------- const member functions --------------------- - double EtMiss() const { // HTM (missing HT) - return et(); - } - double etTotal() const { return etTot_; } - // HTM and HT from PU vertices - double etMissPU() const { return etMissPU_; } - double etTotalPU() const { return etTotalPU_; } - int bx() const { return bx_; } - float vtx() const { return zvtx_; } - const edm::RefProd& jetCollectionRef() const { return jetCollectionRef_; } - const edm::Ref& vtxRef() const { return vtxRef_; } - - // ---------- member functions --------------------------- - void setEtTotal(double EtTotal) { etTot_ = EtTotal; } - void setEtTotalPU(double EtTotalPU) { etTotalPU_ = EtTotalPU; } - void setEtMissPU(double EtMissPU) { etMissPU_ = EtMissPU; } - void setVtx(const float& zvtx) { zvtx_ = zvtx; } - void setBx(int bx) { bx_ = bx; } - - private: - // ---------- member data -------------------------------- - float zvtx_; // zvtx used to constrain the jets - double etTot_; // HT - double etMissPU_; // HTM form jets that don't come from zvtx - double etTotalPU_; // HT from jets that don't come from zvtx - - edm::RefProd jetCollectionRef_; - edm::Ref vtxRef_; - - int bx_; - }; + namespace io_v1 { + class TkHTMiss : public L1Candidate { + public: + TkHTMiss(); + TkHTMiss(const LorentzVector& p4, + double EtTotal, + const edm::RefProd& jetCollRef = edm::RefProd(), + const edm::Ref& aVtxRef = edm::Ref(), + int bx = 0); + + // ---------- const member functions --------------------- + double EtMiss() const { // HTM (missing HT) + return et(); + } + double etTotal() const { return etTot_; } + // HTM and HT from PU vertices + double etMissPU() const { return etMissPU_; } + double etTotalPU() const { return etTotalPU_; } + int bx() const { return bx_; } + float vtx() const { return zvtx_; } + const edm::RefProd& jetCollectionRef() const { return jetCollectionRef_; } + const edm::Ref& vtxRef() const { return vtxRef_; } + + // ---------- member functions --------------------------- + void setEtTotal(double EtTotal) { etTot_ = EtTotal; } + void setEtTotalPU(double EtTotalPU) { etTotalPU_ = EtTotalPU; } + void setEtMissPU(double EtMissPU) { etMissPU_ = EtMissPU; } + void setVtx(const float& zvtx) { zvtx_ = zvtx; } + void setBx(int bx) { bx_ = bx; } + + private: + // ---------- member data -------------------------------- + float zvtx_; // zvtx used to constrain the jets + double etTot_; // HT + double etMissPU_; // HTM form jets that don't come from zvtx + double etTotalPU_; // HT from jets that don't come from zvtx + + edm::RefProd jetCollectionRef_; + edm::Ref vtxRef_; + + int bx_; + }; + } // namespace io_v1 + using TkHTMiss = io_v1::TkHTMiss; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h b/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h index 6be4314fe7858..6fe2b146a8e71 100644 --- a/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkHTMissFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace l1t { - class TkHTMiss; + namespace io_v1 { + class TkHTMiss; + } + using TkHTMiss = io_v1::TkHTMiss; typedef std::vector TkHTMissCollection; } // namespace l1t diff --git a/DataFormats/L1TCorrelator/interface/TkJet.h b/DataFormats/L1TCorrelator/interface/TkJet.h index 82f983d23f168..401ac20591e46 100644 --- a/DataFormats/L1TCorrelator/interface/TkJet.h +++ b/DataFormats/L1TCorrelator/interface/TkJet.h @@ -14,52 +14,54 @@ #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" namespace l1t { + namespace io_v1 { + class TkJet : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; - class TkJet : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; + TkJet(); - TkJet(); + TkJet(const LorentzVector& p4, + const edm::Ref& jetRef, + const std::vector >& trkPtrs, + float jetvtx = -999.); + TkJet(const LorentzVector& p4, + const std::vector >& trkPtrs, + float jetvtx = -999., + unsigned int ntracks = 0, + unsigned int tighttracks = 0, + unsigned int displacedtracks = 0, + unsigned int tightdisplacedtracks = 0, + bool displacedTag = false); - TkJet(const LorentzVector& p4, - const edm::Ref& jetRef, - const std::vector >& trkPtrs, - float jetvtx = -999.); - TkJet(const LorentzVector& p4, - const std::vector >& trkPtrs, - float jetvtx = -999., - unsigned int ntracks = 0, - unsigned int tighttracks = 0, - unsigned int displacedtracks = 0, - unsigned int tightdisplacedtracks = 0, - bool displacedTag = false); + // ---------- const member functions --------------------- - // ---------- const member functions --------------------- + const edm::Ref& jetRef() const { return jetRef_; } - const edm::Ref& jetRef() const { return jetRef_; } + const std::vector >& trkPtrs() const { return trkPtrs_; } - const std::vector >& trkPtrs() const { return trkPtrs_; } + float jetVtx() const { return JetVtx_; } + unsigned int ntracks() const { return ntracks_; } + unsigned int nTighttracks() const { return tighttracks_; } + unsigned int nDisptracks() const { return displacedtracks_; } + unsigned int nTightDisptracks() const { return tightdisplacedtracks_; } + bool isDisplaced() const { return displacedTag_; } - float jetVtx() const { return JetVtx_; } - unsigned int ntracks() const { return ntracks_; } - unsigned int nTighttracks() const { return tighttracks_; } - unsigned int nDisptracks() const { return displacedtracks_; } - unsigned int nTightDisptracks() const { return tightdisplacedtracks_; } - bool isDisplaced() const { return displacedTag_; } + // ---------- member functions --------------------------- + void setJetVtx(float JetVtx) { JetVtx_ = JetVtx; } - // ---------- member functions --------------------------- - void setJetVtx(float JetVtx) { JetVtx_ = JetVtx; } + int bx() const; - int bx() const; - - private: - edm::Ref jetRef_; - std::vector > trkPtrs_; - float JetVtx_; - unsigned int ntracks_, tighttracks_, displacedtracks_, tightdisplacedtracks_; - bool displacedTag_; - }; + private: + edm::Ref jetRef_; + std::vector > trkPtrs_; + float JetVtx_; + unsigned int ntracks_, tighttracks_, displacedtracks_, tightdisplacedtracks_; + bool displacedTag_; + }; + } // namespace io_v1 + using TkJet = io_v1::TkJet; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkJetFwd.h b/DataFormats/L1TCorrelator/interface/TkJetFwd.h index 5696712a4141e..da9690e20af1c 100644 --- a/DataFormats/L1TCorrelator/interface/TkJetFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkJetFwd.h @@ -12,8 +12,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace l1t { - - class TkJet; + namespace io_v1 { + class TkJet; + } + using TkJet = io_v1::TkJet; typedef edm::RefProd TkJetRefProd; diff --git a/DataFormats/L1TCorrelator/interface/TkTriplet.h b/DataFormats/L1TCorrelator/interface/TkTriplet.h index 2c2cc599432b6..f4c635b40fe30 100644 --- a/DataFormats/L1TCorrelator/interface/TkTriplet.h +++ b/DataFormats/L1TCorrelator/interface/TkTriplet.h @@ -15,41 +15,43 @@ #include namespace l1t { - - class TkTriplet : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; - - TkTriplet(); - - TkTriplet(const LorentzVector& p4, int charge); - TkTriplet(const LorentzVector& p4, - int charge, - double pair_mass_max, - double pair_mass_min, - double pair_dz_max, - double pair_dz_min, - std::vector> trkPtrList); - - ~TkTriplet() override {} - - int getTripletCharge() const { return charge_; } - double getPairMassMax() const { return pair_mass_max_; } - double getPairMassMin() const { return pair_mass_min_; } - double getPairDzMax() const { return pair_dz_max_; } - double getPairDzMin() const { return pair_dz_min_; } - const edm::Ptr& trkPtr(size_t i) const { return trkPtrList_.at(i); } - int bx() const; - - private: - int charge_; - double pair_mass_max_; - double pair_mass_min_; - double pair_dz_max_; - double pair_dz_min_; - std::vector> trkPtrList_; - }; + namespace io_v1 { + class TkTriplet : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; + + TkTriplet(); + + TkTriplet(const LorentzVector& p4, int charge); + TkTriplet(const LorentzVector& p4, + int charge, + double pair_mass_max, + double pair_mass_min, + double pair_dz_max, + double pair_dz_min, + std::vector> trkPtrList); + + ~TkTriplet() override {} + + int getTripletCharge() const { return charge_; } + double getPairMassMax() const { return pair_mass_max_; } + double getPairMassMin() const { return pair_mass_min_; } + double getPairDzMax() const { return pair_dz_max_; } + double getPairDzMin() const { return pair_dz_min_; } + const edm::Ptr& trkPtr(size_t i) const { return trkPtrList_.at(i); } + int bx() const; + + private: + int charge_; + double pair_mass_max_; + double pair_mass_min_; + double pair_dz_max_; + double pair_dz_min_; + std::vector> trkPtrList_; + }; + } // namespace io_v1 + using TkTriplet = io_v1::TkTriplet; } // namespace l1t #endif diff --git a/DataFormats/L1TCorrelator/interface/TkTripletFwd.h b/DataFormats/L1TCorrelator/interface/TkTripletFwd.h index 0132fc2b66765..2af78354ca3a3 100644 --- a/DataFormats/L1TCorrelator/interface/TkTripletFwd.h +++ b/DataFormats/L1TCorrelator/interface/TkTripletFwd.h @@ -15,7 +15,10 @@ namespace l1t { - class TkTriplet; + namespace io_v1 { + class TkTriplet; + } + using TkTriplet = io_v1::TkTriplet; typedef edm::RefProd TkTripletRefProd; diff --git a/DataFormats/L1TCorrelator/src/classes_def.xml b/DataFormats/L1TCorrelator/src/classes_def.xml index 8ac314ea58ae1..2ba68a5f58872 100644 --- a/DataFormats/L1TCorrelator/src/classes_def.xml +++ b/DataFormats/L1TCorrelator/src/classes_def.xml @@ -1,132 +1,111 @@ - - - - + + - - - - - - - - - + + + + + + - - - - + + + + - - setEgCaloPtr(edm::refToPtr(onfile.egRef_)); - ]]> - - - + - + - + - - - - - - - + + - - - - + + + + - - - + + - - - - + + + + - - + + - - - - + + + + - - - + + - - - - - - - + + + + + - - + - + - + - + diff --git a/DataFormats/L1TGlobal/interface/GlobalAlgBlk.h b/DataFormats/L1TGlobal/interface/GlobalAlgBlk.h index 18a5ebd48241a..c37529111f67e 100644 --- a/DataFormats/L1TGlobal/interface/GlobalAlgBlk.h +++ b/DataFormats/L1TGlobal/interface/GlobalAlgBlk.h @@ -28,7 +28,10 @@ // forward declarations -class GlobalAlgBlk; +namespace io_v1 { + class GlobalAlgBlk; +} +using GlobalAlgBlk = io_v1::GlobalAlgBlk; typedef BXVector GlobalAlgBlkBxCollection; typedef l1t::ObjectRef GlobalAlgBlkRef; @@ -38,87 +41,88 @@ typedef l1t::ObjectRefPairBxCollection GlobalAlgBlkRefPairBxCollec // class interface -class GlobalAlgBlk { -public: - /// constructors - GlobalAlgBlk(); // empty constructor, all members set to zero; - - GlobalAlgBlk(int orbitNr, int bxNr, int bxInEvent); - - /// destructor - virtual ~GlobalAlgBlk(); - -public: - static constexpr unsigned int maxPhysicsTriggers = 512; - - /// set simple members - void setL1MenuUUID(int uuid) { m_orbitNr = uuid; } - void setL1FirmwareUUID(int fuuid) { m_bxNr = fuuid; } - void setbxInEventNr(int bxNr) { m_bxInEvent = bxNr; } - void setFinalORVeto(bool fOR) { m_finalORVeto = fOR; } - void setFinalORPreVeto(bool fOR) { m_finalORPreVeto = fOR; } - void setFinalOR(bool fOR) { m_finalOR = fOR; } - void setPreScColumn(int psC) { m_preScColumn = psC; } - - /// get simple members - inline const int getL1MenuUUID() const { return m_orbitNr; } - inline const int getL1FirmwareUUID() const { return m_bxNr; } - inline const int getbxInEventNr() const { return m_bxInEvent; } - inline const bool getFinalOR() const { return m_finalOR; } - inline const bool getFinalORPreVeto() const { return m_finalORPreVeto; }; - inline const bool getFinalORVeto() const { return m_finalORVeto; } - inline const int getPreScColumn() const { return m_preScColumn; } - - /// Copy vectors words - void copyInitialToInterm() { m_algoDecisionPreScaled = m_algoDecisionInitial; } - void copyIntermToFinal() { m_algoDecisionFinal = m_algoDecisionPreScaled; } - - /// Set decision bits - void setAlgoDecisionInitial(unsigned int bit, bool val); - void setAlgoDecisionInterm(unsigned int bit, bool val); - void setAlgoDecisionFinal(unsigned int bit, bool val); - - /// Get decision bits - std::vector const& getAlgoDecisionInitial() const { return m_algoDecisionInitial; } - std::vector const& getAlgoDecisionInterm() const { return m_algoDecisionPreScaled; } - std::vector const& getAlgoDecisionFinal() const { return m_algoDecisionFinal; } - bool getAlgoDecisionInitial(unsigned int bit) const; - bool getAlgoDecisionInterm(unsigned int bit) const; - bool getAlgoDecisionFinal(unsigned int bit) const; - - /// reset the content of a GlobalAlgBlk - void reset(); - - // compare the content of this GlobalAlgBlk with another one - virtual bool operator==(const GlobalAlgBlk& rhs) const; - virtual inline bool operator!=(const GlobalAlgBlk& rhs) const { return !(operator==(rhs)); }; - - /// pretty print the content of a GlobalAlgBlk - void print(std::ostream& myCout) const; - -private: - // where noted member data has been re-interpreted, to keep persistant data the same, as these features were added late in release cycle. - - /// orbit number -> L1MenuUUID - int m_orbitNr; - - /// bunch cross number of the actual bx -> L1FirmwareUUID - int m_bxNr; - - /// bunch cross in the GT event record (E,F,0,1,2) - int m_bxInEvent; - - // finalOR - bool m_finalOR; - bool m_finalORPreVeto; - bool m_finalORVeto; - - //Prescale Column - int m_preScColumn; - - std::vector m_algoDecisionInitial; - std::vector m_algoDecisionPreScaled; // -> Interm - std::vector m_algoDecisionFinal; -}; - +namespace io_v1 { + class GlobalAlgBlk { + public: + /// constructors + GlobalAlgBlk(); // empty constructor, all members set to zero; + + GlobalAlgBlk(int orbitNr, int bxNr, int bxInEvent); + + /// destructor + virtual ~GlobalAlgBlk(); + + public: + static constexpr unsigned int maxPhysicsTriggers = 512; + + /// set simple members + void setL1MenuUUID(int uuid) { m_orbitNr = uuid; } + void setL1FirmwareUUID(int fuuid) { m_bxNr = fuuid; } + void setbxInEventNr(int bxNr) { m_bxInEvent = bxNr; } + void setFinalORVeto(bool fOR) { m_finalORVeto = fOR; } + void setFinalORPreVeto(bool fOR) { m_finalORPreVeto = fOR; } + void setFinalOR(bool fOR) { m_finalOR = fOR; } + void setPreScColumn(int psC) { m_preScColumn = psC; } + + /// get simple members + inline const int getL1MenuUUID() const { return m_orbitNr; } + inline const int getL1FirmwareUUID() const { return m_bxNr; } + inline const int getbxInEventNr() const { return m_bxInEvent; } + inline const bool getFinalOR() const { return m_finalOR; } + inline const bool getFinalORPreVeto() const { return m_finalORPreVeto; }; + inline const bool getFinalORVeto() const { return m_finalORVeto; } + inline const int getPreScColumn() const { return m_preScColumn; } + + /// Copy vectors words + void copyInitialToInterm() { m_algoDecisionPreScaled = m_algoDecisionInitial; } + void copyIntermToFinal() { m_algoDecisionFinal = m_algoDecisionPreScaled; } + + /// Set decision bits + void setAlgoDecisionInitial(unsigned int bit, bool val); + void setAlgoDecisionInterm(unsigned int bit, bool val); + void setAlgoDecisionFinal(unsigned int bit, bool val); + + /// Get decision bits + std::vector const& getAlgoDecisionInitial() const { return m_algoDecisionInitial; } + std::vector const& getAlgoDecisionInterm() const { return m_algoDecisionPreScaled; } + std::vector const& getAlgoDecisionFinal() const { return m_algoDecisionFinal; } + bool getAlgoDecisionInitial(unsigned int bit) const; + bool getAlgoDecisionInterm(unsigned int bit) const; + bool getAlgoDecisionFinal(unsigned int bit) const; + + /// reset the content of a GlobalAlgBlk + void reset(); + + // compare the content of this GlobalAlgBlk with another one + virtual bool operator==(const GlobalAlgBlk& rhs) const; + virtual inline bool operator!=(const GlobalAlgBlk& rhs) const { return !(operator==(rhs)); }; + + /// pretty print the content of a GlobalAlgBlk + void print(std::ostream& myCout) const; + + private: + // where noted member data has been re-interpreted, to keep persistant data the same, as these features were added late in release cycle. + + /// orbit number -> L1MenuUUID + int m_orbitNr; + + /// bunch cross number of the actual bx -> L1FirmwareUUID + int m_bxNr; + + /// bunch cross in the GT event record (E,F,0,1,2) + int m_bxInEvent; + + // finalOR + bool m_finalOR; + bool m_finalORPreVeto; + bool m_finalORVeto; + + //Prescale Column + int m_preScColumn; + + std::vector m_algoDecisionInitial; + std::vector m_algoDecisionPreScaled; // -> Interm + std::vector m_algoDecisionFinal; + }; +} // namespace io_v1 #endif /*DataFormats_L1TGlobal_GlobalAlgBlk_h*/ diff --git a/DataFormats/L1TGlobal/interface/GlobalExtBlk.h b/DataFormats/L1TGlobal/interface/GlobalExtBlk.h index 79ddebb3fb42c..967d1c5fed270 100644 --- a/DataFormats/L1TGlobal/interface/GlobalExtBlk.h +++ b/DataFormats/L1TGlobal/interface/GlobalExtBlk.h @@ -26,36 +26,39 @@ // forward declarations -class GlobalExtBlk; +namespace io_v1 { + class GlobalExtBlk; +} +using GlobalExtBlk = io_v1::GlobalExtBlk; typedef BXVector GlobalExtBlkBxCollection; // class interface +namespace io_v1 { + class GlobalExtBlk { + public: + /// constructors + GlobalExtBlk(); // empty constructor, all members set to zero; -class GlobalExtBlk { -public: - /// constructors - GlobalExtBlk(); // empty constructor, all members set to zero; + /// destructor + virtual ~GlobalExtBlk(); - /// destructor - virtual ~GlobalExtBlk(); + public: + const static unsigned int maxExternalConditions = 256; -public: - const static unsigned int maxExternalConditions = 256; + /// Set decision bits + void setExternalDecision(unsigned int bit, bool val); - /// Set decision bits - void setExternalDecision(unsigned int bit, bool val); + /// Get decision bits + bool getExternalDecision(unsigned int bit) const; - /// Get decision bits - bool getExternalDecision(unsigned int bit) const; + /// reset the content of a GlobalExtBlk + void reset(); - /// reset the content of a GlobalExtBlk - void reset(); - - /// pretty print the content of a GlobalExtBlk - void print(std::ostream& myCout) const; - -private: - std::vector m_extDecision; -}; + /// pretty print the content of a GlobalExtBlk + void print(std::ostream& myCout) const; + private: + std::vector m_extDecision; + }; +} // namespace io_v1 #endif /*L1Trigger_GlobalExtBlk_h*/ diff --git a/DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h b/DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h index 88ad2c8eabdf4..999c6eba1b1f4 100644 --- a/DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h +++ b/DataFormats/L1TGlobal/interface/GlobalObjectMapRecord.h @@ -74,5 +74,4 @@ class GlobalObjectMapRecord { }; inline void swap(GlobalObjectMapRecord& lh, GlobalObjectMapRecord& rh) { lh.swap(rh); } - #endif diff --git a/DataFormats/L1TGlobal/src/classes_def.xml b/DataFormats/L1TGlobal/src/classes_def.xml index 77e087a731a83..ea4f53101a582 100644 --- a/DataFormats/L1TGlobal/src/classes_def.xml +++ b/DataFormats/L1TGlobal/src/classes_def.xml @@ -1,23 +1,17 @@ - - - - - + + - + - - - - - + + - + @@ -69,9 +63,8 @@ - - - + + diff --git a/DataFormats/L1THGCal/interface/HGCalCluster.h b/DataFormats/L1THGCal/interface/HGCalCluster.h index 2c132916bf024..b4b813b38c1c9 100644 --- a/DataFormats/L1THGCal/interface/HGCalCluster.h +++ b/DataFormats/L1THGCal/interface/HGCalCluster.h @@ -8,22 +8,24 @@ namespace l1t { - class HGCalCluster : public HGCalClusterT { - public: - HGCalCluster() {} - HGCalCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); + namespace io_v1 { + class HGCalCluster : public HGCalClusterT { + public: + HGCalCluster() {} + HGCalCluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); - HGCalCluster(const edm::Ptr &tc); + HGCalCluster(const edm::Ptr& tc); - ~HGCalCluster() override; + ~HGCalCluster() override; - void setModule(uint32_t module) { module_ = module; } - uint32_t module() const { return module_; } - - private: - uint32_t module_; - }; + void setModule(uint32_t module) { module_ = module; } + uint32_t module() const { return module_; } + private: + uint32_t module_; + }; + } // namespace io_v1 + using HGCalCluster = io_v1::HGCalCluster; typedef BXVector HGCalClusterBxCollection; } // namespace l1t diff --git a/DataFormats/L1THGCal/interface/HGCalMulticluster.h b/DataFormats/L1THGCal/interface/HGCalMulticluster.h index d0d58a6d1021d..dc0275f5b5da3 100644 --- a/DataFormats/L1THGCal/interface/HGCalMulticluster.h +++ b/DataFormats/L1THGCal/interface/HGCalMulticluster.h @@ -9,89 +9,92 @@ #include namespace l1t { + namespace io_v1 { + class HGCalMulticluster : public HGCalClusterT { + public: + HGCalMulticluster() : hOverEValid_(false) {} + HGCalMulticluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); + + HGCalMulticluster(const edm::Ptr& tc, float fraction = 1); + + ~HGCalMulticluster() override; + + float hOverE() const { + // --- this below would be faster when reading old objects, as HoE will only be computed once, + // --- but it may not be allowed by CMS rules because of the const_cast + // --- and could potentially cause a data race + // if (!hOverEValid_) (const_cast(this))->saveHOverE(); + // --- this below is safe in any case + return hOverEValid_ ? hOverE_ : l1t::HGCalClusterT::hOverE(); + } - class HGCalMulticluster : public HGCalClusterT { - public: - HGCalMulticluster() : hOverEValid_(false) {} - HGCalMulticluster(const LorentzVector p4, int pt = 0, int eta = 0, int phi = 0); - - HGCalMulticluster(const edm::Ptr& tc, float fraction = 1); - - ~HGCalMulticluster() override; - - float hOverE() const { - // --- this below would be faster when reading old objects, as HoE will only be computed once, - // --- but it may not be allowed by CMS rules because of the const_cast - // --- and could potentially cause a data race - // if (!hOverEValid_) (const_cast(this))->saveHOverE(); - // --- this below is safe in any case - return hOverEValid_ ? hOverE_ : l1t::HGCalClusterT::hOverE(); - } - - void saveHOverE() { - hOverE_ = l1t::HGCalClusterT::hOverE(); - hOverEValid_ = true; - } - - enum EnergyInterpretation { EM = 0 }; - - void saveEnergyInterpretation(const HGCalMulticluster::EnergyInterpretation eInt, double energy); + void saveHOverE() { + hOverE_ = l1t::HGCalClusterT::hOverE(); + hOverEValid_ = true; + } - double iEnergy(const HGCalMulticluster::EnergyInterpretation eInt) const { - return energy() * interpretationFraction(eInt); - } + enum EnergyInterpretation { EM = 0 }; - double iPt(const HGCalMulticluster::EnergyInterpretation eInt) const { return pt() * interpretationFraction(eInt); } + void saveEnergyInterpretation(const HGCalMulticluster::EnergyInterpretation eInt, double energy); - math::XYZTLorentzVector iP4(const HGCalMulticluster::EnergyInterpretation eInt) const { - return p4() * interpretationFraction(eInt); - } + double iEnergy(const HGCalMulticluster::EnergyInterpretation eInt) const { + return energy() * interpretationFraction(eInt); + } - math::PtEtaPhiMLorentzVector iPolarP4(const HGCalMulticluster::EnergyInterpretation eInt) const { - return math::PtEtaPhiMLorentzVector(pt() * interpretationFraction(eInt), eta(), phi(), 0.); - } + double iPt(const HGCalMulticluster::EnergyInterpretation eInt) const { + return pt() * interpretationFraction(eInt); + } - private: - template - struct KeyGetter { - const typename Iter::value_type::first_type& operator()(const typename Iter::value_type& p) const { - return p.first; + math::XYZTLorentzVector iP4(const HGCalMulticluster::EnergyInterpretation eInt) const { + return p4() * interpretationFraction(eInt); } - }; - template - boost::transform_iterator, Iter> key_iterator(Iter itr) const { - return boost::make_transform_iterator, Iter>(itr, KeyGetter()); - } + math::PtEtaPhiMLorentzVector iPolarP4(const HGCalMulticluster::EnergyInterpretation eInt) const { + return math::PtEtaPhiMLorentzVector(pt() * interpretationFraction(eInt), eta(), phi(), 0.); + } - public: - typedef boost::transform_iterator::const_iterator>, - std::map::const_iterator> - EnergyInterpretation_const_iterator; + private: + template + struct KeyGetter { + const typename Iter::value_type::first_type& operator()(const typename Iter::value_type& p) const { + return p.first; + } + }; + + template + boost::transform_iterator, Iter> key_iterator(Iter itr) const { + return boost::make_transform_iterator, Iter>(itr, KeyGetter()); + } - std::pair energyInterpretations() const { - return std::make_pair(key_iterator(energyInterpretationFractions_.cbegin()), - key_iterator(energyInterpretationFractions_.cend())); - } + public: + typedef boost::transform_iterator::const_iterator>, + std::map::const_iterator> + EnergyInterpretation_const_iterator; - EnergyInterpretation_const_iterator interpretations_begin() const { - return key_iterator(energyInterpretationFractions_.cbegin()); - } + std::pair energyInterpretations() const { + return std::make_pair(key_iterator(energyInterpretationFractions_.cbegin()), + key_iterator(energyInterpretationFractions_.cend())); + } - EnergyInterpretation_const_iterator interpretations_end() const { - return key_iterator(energyInterpretationFractions_.cend()); - } + EnergyInterpretation_const_iterator interpretations_begin() const { + return key_iterator(energyInterpretationFractions_.cbegin()); + } - size_type interpretations_size() const { return energyInterpretationFractions_.size(); } + EnergyInterpretation_const_iterator interpretations_end() const { + return key_iterator(energyInterpretationFractions_.cend()); + } - private: - double interpretationFraction(const HGCalMulticluster::EnergyInterpretation eInt) const; + size_type interpretations_size() const { return energyInterpretationFractions_.size(); } - float hOverE_; - bool hOverEValid_; - std::map energyInterpretationFractions_; - }; + private: + double interpretationFraction(const HGCalMulticluster::EnergyInterpretation eInt) const; + float hOverE_; + bool hOverEValid_; + std::map energyInterpretationFractions_; + }; + } // namespace io_v1 + using HGCalMulticluster = io_v1::HGCalMulticluster; typedef BXVector HGCalMulticlusterBxCollection; } // namespace l1t diff --git a/DataFormats/L1THGCal/interface/HGCalTower.h b/DataFormats/L1THGCal/interface/HGCalTower.h index 74c392ee0ee07..5e4c3634cc36a 100644 --- a/DataFormats/L1THGCal/interface/HGCalTower.h +++ b/DataFormats/L1THGCal/interface/HGCalTower.h @@ -6,61 +6,60 @@ #include "DataFormats/L1THGCal/interface/HGCalTowerID.h" namespace l1t { - - class HGCalTower; + namespace io_v1 { + class HGCalTower : public L1Candidate { + public: + HGCalTower() : etEm_(0.), etHad_(0.), id_(0), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} + + HGCalTower(double etEm, + double etHad, + double eta, + double phi, + uint32_t id, + int hwpt = 0, + int hweta = 0, + int hwphi = 0, + int qual = 0, + int hwEtEm = 0, + int hwEtHad = 0, + int hwEtRatio = 0); + + ~HGCalTower() override; + + void addEtEm(double et); + void addEtHad(double et); + + double etEm() const { return etEm_; }; + double etHad() const { return etHad_; }; + + const HGCalTower& operator+=(const HGCalTower& tower); + + HGCalTowerID id() const { return id_; } + short zside() const { return id_.zside(); } + + void setHwEtEm(int et) { hwEtEm_ = et; } + void setHwEtHad(int et) { hwEtHad_ = et; } + void setHwEtRatio(int ratio) { hwEtRatio_ = ratio; } + + int hwEtEm() const { return hwEtEm_; } + int hwEtHad() const { return hwEtHad_; } + int hwEtRatio() const { return hwEtRatio_; } + + private: + void addEt(double et); + + // additional hardware quantities + double etEm_; + double etHad_; + HGCalTowerID id_; + + int hwEtEm_; + int hwEtHad_; + int hwEtRatio_; + }; + } // namespace io_v1 + using HGCalTower = io_v1::HGCalTower; typedef BXVector HGCalTowerBxCollection; - - class HGCalTower : public L1Candidate { - public: - HGCalTower() : etEm_(0.), etHad_(0.), id_(0), hwEtEm_(0), hwEtHad_(0), hwEtRatio_(0) {} - - HGCalTower(double etEm, - double etHad, - double eta, - double phi, - uint32_t id, - int hwpt = 0, - int hweta = 0, - int hwphi = 0, - int qual = 0, - int hwEtEm = 0, - int hwEtHad = 0, - int hwEtRatio = 0); - - ~HGCalTower() override; - - void addEtEm(double et); - void addEtHad(double et); - - double etEm() const { return etEm_; }; - double etHad() const { return etHad_; }; - - const HGCalTower& operator+=(const HGCalTower& tower); - - HGCalTowerID id() const { return id_; } - short zside() const { return id_.zside(); } - - void setHwEtEm(int et) { hwEtEm_ = et; } - void setHwEtHad(int et) { hwEtHad_ = et; } - void setHwEtRatio(int ratio) { hwEtRatio_ = ratio; } - - int hwEtEm() const { return hwEtEm_; } - int hwEtHad() const { return hwEtHad_; } - int hwEtRatio() const { return hwEtRatio_; } - - private: - void addEt(double et); - - // additional hardware quantities - double etEm_; - double etHad_; - HGCalTowerID id_; - - int hwEtEm_; - int hwEtHad_; - int hwEtRatio_; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1THGCal/interface/HGCalTowerMap.h b/DataFormats/L1THGCal/interface/HGCalTowerMap.h index d670ea2f29be0..2289cf501c097 100644 --- a/DataFormats/L1THGCal/interface/HGCalTowerMap.h +++ b/DataFormats/L1THGCal/interface/HGCalTowerMap.h @@ -8,30 +8,31 @@ namespace l1t { - class HGCalTowerMap; struct HGCalTowerCoord; - typedef BXVector HGCalTowerMapBxCollection; - - class HGCalTowerMap { - public: - HGCalTowerMap() : layer_(0) {} + namespace io_v1 { + class HGCalTowerMap { + public: + HGCalTowerMap() : layer_(0) {} - HGCalTowerMap(const std::vector& tower_ids, const int layer); + HGCalTowerMap(const std::vector& tower_ids, const int layer); - int layer() const { return layer_; } + int layer() const { return layer_; } - const HGCalTowerMap& operator+=(const HGCalTowerMap& map); + const HGCalTowerMap& operator+=(const HGCalTowerMap& map); - bool addEt(const std::unordered_map& towerIDandShares, float etEm, float etHad); + bool addEt(const std::unordered_map& towerIDandShares, float etEm, float etHad); - unsigned nTowers() const { return towerMap_.size(); } - const std::unordered_map& towers() const { return towerMap_; } + unsigned nTowers() const { return towerMap_.size(); } + const std::unordered_map& towers() const { return towerMap_; } - private: - std::unordered_map towerMap_; - unsigned layer_; - }; + private: + std::unordered_map towerMap_; + unsigned layer_; + }; + } // namespace io_v1 + using HGCalTowerMap = io_v1::HGCalTowerMap; + typedef BXVector HGCalTowerMapBxCollection; } // namespace l1t #endif diff --git a/DataFormats/L1THGCal/interface/HGCalTriggerCell.h b/DataFormats/L1THGCal/interface/HGCalTriggerCell.h index b65fb11316047..a7ee9e32d281c 100644 --- a/DataFormats/L1THGCal/interface/HGCalTriggerCell.h +++ b/DataFormats/L1THGCal/interface/HGCalTriggerCell.h @@ -7,46 +7,46 @@ #include "DataFormats/DetId/interface/DetId.h" namespace l1t { + namespace io_v1 { + class HGCalTriggerCell : public L1Candidate { + public: + HGCalTriggerCell() {} - class HGCalTriggerCell; - typedef BXVector HGCalTriggerCellBxCollection; - - class HGCalTriggerCell : public L1Candidate { - public: - HGCalTriggerCell() {} + HGCalTriggerCell(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, uint32_t detid = 0); - HGCalTriggerCell(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, uint32_t detid = 0); + ~HGCalTriggerCell() override; - ~HGCalTriggerCell() override; + void setDetId(uint32_t detid) { detid_ = DetId(detid); } + void setPosition(const GlobalPoint& position) { position_ = position; } - void setDetId(uint32_t detid) { detid_ = DetId(detid); } - void setPosition(const GlobalPoint& position) { position_ = position; } + uint32_t detId() const { return detid_.rawId(); } + const GlobalPoint& position() const { return position_; } - uint32_t detId() const { return detid_.rawId(); } - const GlobalPoint& position() const { return position_; } + int subdetId() const { return detid_.subdetId(); } - int subdetId() const { return detid_.subdetId(); } + void setMipPt(double value) { mipPt_ = value; } + double mipPt() const { return mipPt_; } - void setMipPt(double value) { mipPt_ = value; } - double mipPt() const { return mipPt_; } + void setUncompressedCharge(uint32_t value) { uncompressedCharge_ = value; } + uint32_t uncompressedCharge() const { return uncompressedCharge_; } - void setUncompressedCharge(uint32_t value) { uncompressedCharge_ = value; } - uint32_t uncompressedCharge() const { return uncompressedCharge_; } + void setCompressedCharge(uint32_t value) { compressedCharge_ = value; } + uint32_t compressedCharge() const { return compressedCharge_; } - void setCompressedCharge(uint32_t value) { compressedCharge_ = value; } - uint32_t compressedCharge() const { return compressedCharge_; } + void setPt(double pT); - void setPt(double pT); + private: + DetId detid_; + GlobalPoint position_; - private: - DetId detid_; - GlobalPoint position_; + double mipPt_{0.}; - double mipPt_{0.}; - - uint32_t uncompressedCharge_{0}; - uint32_t compressedCharge_{0}; - }; + uint32_t uncompressedCharge_{0}; + uint32_t compressedCharge_{0}; + }; + } // namespace io_v1 + using HGCalTriggerCell = io_v1::HGCalTriggerCell; + typedef BXVector HGCalTriggerCellBxCollection; } // namespace l1t diff --git a/DataFormats/L1THGCal/src/classes_def.xml b/DataFormats/L1THGCal/src/classes_def.xml index 2a0ace5b5b502..58def52b944cc 100644 --- a/DataFormats/L1THGCal/src/classes_def.xml +++ b/DataFormats/L1THGCal/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + @@ -14,71 +14,51 @@ - - - + + + + + - + - + + + - + - + - - - - - - - - - - - + + - + - - - - - - - - - - - - - - + + + + - - - + - - - - + + - + - - - + + @@ -90,33 +70,33 @@ - - + + - - + + - + - - + + - - - - + + + + - - - - + + + + - + diff --git a/DataFormats/L1TMuon/interface/EMTFHit.h b/DataFormats/L1TMuon/interface/EMTFHit.h index 00a12df3f8643..74d8559c6a71d 100644 --- a/DataFormats/L1TMuon/interface/EMTFHit.h +++ b/DataFormats/L1TMuon/interface/EMTFHit.h @@ -23,231 +23,232 @@ namespace l1t { namespace l1tmu = L1TMuon; - class EMTFHit { - public: - EMTFHit() - : rawDetId(0), - subsystem(-99), - endcap(-99), - station(-99), - ring(-99), - sector(-99), - sector_RPC(-99), - sector_idx(-99), - subsector(-99), - subsector_RPC(-99), - chamber(-99), - csc_ID(-99), - csc_nID(-99), - roll(-99), - neighbor(-99), - mpc_link(-99), - pc_sector(-99), - pc_station(-99), - pc_chamber(-99), - pc_segment(-99), - wire(-99), - strip(-99), - strip_hi(-99), - strip_low(-99), - strip_quart(-99), // Run 3 - strip_eighth(-99), // Run 3 - strip_quart_bit(-99), // Run 3 - strip_eighth_bit(-99), // Run 3 - muon_shower_valid(-99), // Run 3 muon shower - muon_shower_inTime(-99), // Run 3 muon shower - muon_shower_outOfTime(-99), // Run 3 muon shower - track_num(-99), - quality(-99), - pattern(-99), - pattern_run3(-99), // Run 3 - bend(-99), - slope(-99), // Run 3 - valid(-99), - sync_err(-99), - layer(-99), // TODO: verify inclusion for GEM, or better to generalize this class... - JS 06.07.20 - bc0(-99), - bx(-99), - stub_num(-99), - phi_fp(-99), - theta_fp(-99), - zone_hit(-99), - zone_code(-99), - fs_segment(-99), - fs_zone_code(-99), - bt_station(-99), - bt_segment(-99), - phi_loc(-99), - phi_glob(-999), - theta(-99), - eta(-99), - time(-99), - phi_sim(-999), - theta_sim(-99), - eta_sim(-99), - rho_sim(-99), - z_sim(-99), - alct_quality(-99), - clct_quality(-99) {} + namespace io_v1 { + class EMTFHit { + public: + EMTFHit() + : rawDetId(0), + subsystem(-99), + endcap(-99), + station(-99), + ring(-99), + sector(-99), + sector_RPC(-99), + sector_idx(-99), + subsector(-99), + subsector_RPC(-99), + chamber(-99), + csc_ID(-99), + csc_nID(-99), + roll(-99), + neighbor(-99), + mpc_link(-99), + pc_sector(-99), + pc_station(-99), + pc_chamber(-99), + pc_segment(-99), + wire(-99), + strip(-99), + strip_hi(-99), + strip_low(-99), + strip_quart(-99), // Run 3 + strip_eighth(-99), // Run 3 + strip_quart_bit(-99), // Run 3 + strip_eighth_bit(-99), // Run 3 + muon_shower_valid(-99), // Run 3 muon shower + muon_shower_inTime(-99), // Run 3 muon shower + muon_shower_outOfTime(-99), // Run 3 muon shower + track_num(-99), + quality(-99), + pattern(-99), + pattern_run3(-99), // Run 3 + bend(-99), + slope(-99), // Run 3 + valid(-99), + sync_err(-99), + layer(-99), // TODO: verify inclusion for GEM, or better to generalize this class... - JS 06.07.20 + bc0(-99), + bx(-99), + stub_num(-99), + phi_fp(-99), + theta_fp(-99), + zone_hit(-99), + zone_code(-99), + fs_segment(-99), + fs_zone_code(-99), + bt_station(-99), + bt_segment(-99), + phi_loc(-99), + phi_glob(-999), + theta(-99), + eta(-99), + time(-99), + phi_sim(-999), + theta_sim(-99), + eta_sim(-99), + rho_sim(-99), + z_sim(-99), + alct_quality(-99), + clct_quality(-99) {} - virtual ~EMTFHit() {} + virtual ~EMTFHit() {} - CSCDetId CreateCSCDetId() const; - RPCDetId CreateRPCDetId() const; - GEMDetId CreateGEMDetId() const; - ME0DetId CreateME0DetId() const; + CSCDetId CreateCSCDetId() const; + RPCDetId CreateRPCDetId() const; + GEMDetId CreateGEMDetId() const; + ME0DetId CreateME0DetId() const; - // void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi); - CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi(const bool isRun3) const; - // Run 3 muon shower - CSCShowerDigi CreateCSCShowerDigi() const; - // void ImportRPCDigi (const RPCDigi& _digi); - // RPCDigi CreateRPCDigi() const; - // void ImportCPPFDigi (const CPPFDigi& _digi); - CPPFDigi CreateCPPFDigi() const; - // void ImportGEMPadDigiCluster (const GEMPadDigiCluster& _digi); // TODO: implement placeholder when others are implemented - GEMPadDigiCluster CreateGEMPadDigiCluster() const; + // void ImportCSCCorrelatedLCTDigi (const CSCCorrelatedLCTDigi& _digi); + CSCCorrelatedLCTDigi CreateCSCCorrelatedLCTDigi(const bool isRun3) const; + // Run 3 muon shower + CSCShowerDigi CreateCSCShowerDigi() const; + // void ImportRPCDigi (const RPCDigi& _digi); + // RPCDigi CreateRPCDigi() const; + // void ImportCPPFDigi (const CPPFDigi& _digi); + CPPFDigi CreateCPPFDigi() const; + // void ImportGEMPadDigiCluster (const GEMPadDigiCluster& _digi); // TODO: implement placeholder when others are implemented + GEMPadDigiCluster CreateGEMPadDigiCluster() const; - // void PrintSimulatorHeader() const; - // void PrintForSimulator() const; + // void PrintSimulatorHeader() const; + // void PrintForSimulator() const; - //void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } - //void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } - //void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } - //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } - //void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } - //void SetCPPFDigi (const CPPFDigi& digi) { cppf_Digi = digi; } - //void SetGEMPadDigiCluster (const GEMPadDigiCluster& digi) { gem_PadClusterDigi = digi; } - void SetCSCDetId(const CSCDetId& id) { rawDetId = id.rawId(); } - void SetRPCDetId(const RPCDetId& id) { rawDetId = id.rawId(); } - void SetGEMDetId(const GEMDetId& id) { rawDetId = id.rawId(); } - void SetME0DetId(const ME0DetId& id) { rawDetId = id.rawId(); } - void SetDTDetId(const DTChamberId& id) { rawDetId = id.rawId(); } + //void SetCSCDetId (const CSCDetId& id) { csc_DetId = id; } + //void SetRPCDetId (const RPCDetId& id) { rpc_DetId = id; } + //void SetGEMDetId (const GEMDetId& id) { gem_DetId = id; } + //void SetCSCLCTDigi (const CSCCorrelatedLCTDigi& digi) { csc_LCTDigi = digi; } + //void SetRPCDigi (const RPCDigi& digi) { rpc_Digi = digi; } + //void SetCPPFDigi (const CPPFDigi& digi) { cppf_Digi = digi; } + //void SetGEMPadDigiCluster (const GEMPadDigiCluster& digi) { gem_PadClusterDigi = digi; } + void SetCSCDetId(const CSCDetId& id) { rawDetId = id.rawId(); } + void SetRPCDetId(const RPCDetId& id) { rawDetId = id.rawId(); } + void SetGEMDetId(const GEMDetId& id) { rawDetId = id.rawId(); } + void SetME0DetId(const ME0DetId& id) { rawDetId = id.rawId(); } + void SetDTDetId(const DTChamberId& id) { rawDetId = id.rawId(); } - //CSCDetId CSC_DetId () const { return csc_DetId; } - //RPCDetId RPC_DetId () const { return rpc_DetId; } - //GEMDetId GEM_DetId () const { return gem_DetId; } - //CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } - //RPCDigi RPC_Digi () const { return rpc_Digi; } - //CPPFDigi CPPF_Digi () const { return cppf_Digi; } - //GEMPadDigiCluster GEM_PadClusterDigi () const { return gem_PadClusterDigi; } - CSCDetId CSC_DetId() const { return CSCDetId(rawDetId); } - RPCDetId RPC_DetId() const { return RPCDetId(rawDetId); } - GEMDetId GEM_DetId() const { return GEMDetId(rawDetId); } - ME0DetId ME0_DetId() const { return ME0DetId(rawDetId); } - DTChamberId DT_DetId() const { return DTChamberId(rawDetId); } + //CSCDetId CSC_DetId () const { return csc_DetId; } + //RPCDetId RPC_DetId () const { return rpc_DetId; } + //GEMDetId GEM_DetId () const { return gem_DetId; } + //CSCCorrelatedLCTDigi CSC_LCTDigi () const { return csc_LCTDigi; } + //RPCDigi RPC_Digi () const { return rpc_Digi; } + //CPPFDigi CPPF_Digi () const { return cppf_Digi; } + //GEMPadDigiCluster GEM_PadClusterDigi () const { return gem_PadClusterDigi; } + CSCDetId CSC_DetId() const { return CSCDetId(rawDetId); } + RPCDetId RPC_DetId() const { return RPCDetId(rawDetId); } + GEMDetId GEM_DetId() const { return GEMDetId(rawDetId); } + ME0DetId ME0_DetId() const { return ME0DetId(rawDetId); } + DTChamberId DT_DetId() const { return DTChamberId(rawDetId); } - void set_subsystem(int bits) { subsystem = bits; } - void set_endcap(int bits) { endcap = bits; } - void set_station(int bits) { station = bits; } - void set_ring(int bits) { ring = bits; } - void set_sector(int bits) { sector = bits; } - void set_sector_RPC(int bits) { sector_RPC = bits; } - void set_sector_idx(int bits) { sector_idx = bits; } - void set_subsector(int bits) { subsector = bits; } - void set_subsector_RPC(int bits) { subsector_RPC = bits; } - void set_chamber(int bits) { chamber = bits; } - void set_csc_ID(int bits) { csc_ID = bits; } - void set_csc_nID(int bits) { csc_nID = bits; } - void set_roll(int bits) { roll = bits; } - void set_neighbor(int bits) { neighbor = bits; } - void set_mpc_link(int bits) { mpc_link = bits; } - void set_pc_sector(int bits) { pc_sector = bits; } - void set_pc_station(int bits) { pc_station = bits; } - void set_pc_chamber(int bits) { pc_chamber = bits; } - void set_pc_segment(int bits) { pc_segment = bits; } - void set_wire(int bits) { wire = bits; } - void set_strip(int bits) { strip = bits; } - void set_strip_hi(int bits) { strip_hi = bits; } - void set_strip_low(int bits) { strip_low = bits; } - void set_strip_quart(int bits) { strip_quart = bits; } // Run 3 - void set_strip_eighth(int bits) { strip_eighth = bits; } // Run 3 - void set_strip_quart_bit(int bits) { strip_quart_bit = bits; } // Run 3 - void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; } // Run 3 - void set_muon_shower_valid(int bits) { muon_shower_valid = bits; } // Run 3 muon shower - void set_muon_shower_inTime(int bits) { muon_shower_inTime = bits; } // Run 3 muon shower - void set_muon_shower_outOfTime(int bits) { muon_shower_outOfTime = bits; } // Run 3 muon shower - void set_track_num(int bits) { track_num = bits; } - void set_quality(int bits) { quality = bits; } - void set_pattern(int bits) { pattern = bits; } - void set_pattern_run3(int bits) { pattern_run3 = bits; } // Run 3 - void set_bend(int bits) { bend = bits; } - void set_slope(int bits) { slope = bits; } // Run 3 - void set_valid(int bits) { valid = bits; } - void set_sync_err(int bits) { sync_err = bits; } - // GEM specific aliases - void set_pad(int bits) { set_strip(bits); } - void set_pad_hi(int bits) { set_strip_hi(bits); } - void set_pad_low(int bits) { set_strip_low(bits); } - void set_partition(int bits) { set_roll(bits); } - void set_layer(int bits) { layer = bits; } - void set_cluster_size(int bits) { set_quality(bits); } - void set_cluster_id(int bits) { set_track_num(bits); } - // END GEM specific - void set_bc0(int bits) { bc0 = bits; } - void set_bx(int bits) { bx = bits; } - void set_stub_num(int bits) { stub_num = bits; } - void set_phi_fp(int bits) { phi_fp = bits; } - void set_theta_fp(int bits) { theta_fp = bits; } - void set_zone_hit(int bits) { zone_hit = bits; } - void set_zone_code(int bits) { zone_code = bits; } - void set_fs_segment(int bits) { fs_segment = bits; } - void set_fs_zone_code(int bits) { fs_zone_code = bits; } - void set_bt_station(int bits) { bt_station = bits; } - void set_bt_segment(int bits) { bt_segment = bits; } - void set_phi_loc(float val) { phi_loc = val; } - void set_phi_glob(float val) { phi_glob = val; } - void set_theta(float val) { theta = val; } - void set_eta(float val) { eta = val; } - void set_time(float val) { time = val; } - void set_phi_sim(float val) { phi_sim = val; } - void set_theta_sim(float val) { theta_sim = val; } - void set_eta_sim(float val) { eta_sim = val; } - void set_rho_sim(float val) { rho_sim = val; } - void set_z_sim(float val) { z_sim = val; } - void set_alct_quality(int bits) { alct_quality = bits; } - void set_clct_quality(int bits) { clct_quality = bits; } + void set_subsystem(int bits) { subsystem = bits; } + void set_endcap(int bits) { endcap = bits; } + void set_station(int bits) { station = bits; } + void set_ring(int bits) { ring = bits; } + void set_sector(int bits) { sector = bits; } + void set_sector_RPC(int bits) { sector_RPC = bits; } + void set_sector_idx(int bits) { sector_idx = bits; } + void set_subsector(int bits) { subsector = bits; } + void set_subsector_RPC(int bits) { subsector_RPC = bits; } + void set_chamber(int bits) { chamber = bits; } + void set_csc_ID(int bits) { csc_ID = bits; } + void set_csc_nID(int bits) { csc_nID = bits; } + void set_roll(int bits) { roll = bits; } + void set_neighbor(int bits) { neighbor = bits; } + void set_mpc_link(int bits) { mpc_link = bits; } + void set_pc_sector(int bits) { pc_sector = bits; } + void set_pc_station(int bits) { pc_station = bits; } + void set_pc_chamber(int bits) { pc_chamber = bits; } + void set_pc_segment(int bits) { pc_segment = bits; } + void set_wire(int bits) { wire = bits; } + void set_strip(int bits) { strip = bits; } + void set_strip_hi(int bits) { strip_hi = bits; } + void set_strip_low(int bits) { strip_low = bits; } + void set_strip_quart(int bits) { strip_quart = bits; } // Run 3 + void set_strip_eighth(int bits) { strip_eighth = bits; } // Run 3 + void set_strip_quart_bit(int bits) { strip_quart_bit = bits; } // Run 3 + void set_strip_eighth_bit(int bits) { strip_eighth_bit = bits; } // Run 3 + void set_muon_shower_valid(int bits) { muon_shower_valid = bits; } // Run 3 muon shower + void set_muon_shower_inTime(int bits) { muon_shower_inTime = bits; } // Run 3 muon shower + void set_muon_shower_outOfTime(int bits) { muon_shower_outOfTime = bits; } // Run 3 muon shower + void set_track_num(int bits) { track_num = bits; } + void set_quality(int bits) { quality = bits; } + void set_pattern(int bits) { pattern = bits; } + void set_pattern_run3(int bits) { pattern_run3 = bits; } // Run 3 + void set_bend(int bits) { bend = bits; } + void set_slope(int bits) { slope = bits; } // Run 3 + void set_valid(int bits) { valid = bits; } + void set_sync_err(int bits) { sync_err = bits; } + // GEM specific aliases + void set_pad(int bits) { set_strip(bits); } + void set_pad_hi(int bits) { set_strip_hi(bits); } + void set_pad_low(int bits) { set_strip_low(bits); } + void set_partition(int bits) { set_roll(bits); } + void set_layer(int bits) { layer = bits; } + void set_cluster_size(int bits) { set_quality(bits); } + void set_cluster_id(int bits) { set_track_num(bits); } + // END GEM specific + void set_bc0(int bits) { bc0 = bits; } + void set_bx(int bits) { bx = bits; } + void set_stub_num(int bits) { stub_num = bits; } + void set_phi_fp(int bits) { phi_fp = bits; } + void set_theta_fp(int bits) { theta_fp = bits; } + void set_zone_hit(int bits) { zone_hit = bits; } + void set_zone_code(int bits) { zone_code = bits; } + void set_fs_segment(int bits) { fs_segment = bits; } + void set_fs_zone_code(int bits) { fs_zone_code = bits; } + void set_bt_station(int bits) { bt_station = bits; } + void set_bt_segment(int bits) { bt_segment = bits; } + void set_phi_loc(float val) { phi_loc = val; } + void set_phi_glob(float val) { phi_glob = val; } + void set_theta(float val) { theta = val; } + void set_eta(float val) { eta = val; } + void set_time(float val) { time = val; } + void set_phi_sim(float val) { phi_sim = val; } + void set_theta_sim(float val) { theta_sim = val; } + void set_eta_sim(float val) { eta_sim = val; } + void set_rho_sim(float val) { rho_sim = val; } + void set_z_sim(float val) { z_sim = val; } + void set_alct_quality(int bits) { alct_quality = bits; } + void set_clct_quality(int bits) { clct_quality = bits; } - int Subsystem() const { return subsystem; } - int Endcap() const { return endcap; } - int Station() const { return station; } - int Ring() const { return ring; } - int Sector() const { return sector; } - int Sector_RPC() const { return sector_RPC; } - int Sector_idx() const { return sector_idx; } - int Subsector() const { return subsector; } - int Subsector_RPC() const { return subsector_RPC; } - int Chamber() const { return chamber; } - int CSC_ID() const { return csc_ID; } - int CSC_nID() const { return csc_nID; } - int Roll() const { return roll; } - int Neighbor() const { return neighbor; } - int MPC_link() const { return mpc_link; } - int PC_sector() const { return pc_sector; } - int PC_station() const { return pc_station; } - int PC_chamber() const { return pc_chamber; } - int PC_segment() const { return pc_segment; } - int Wire() const { return wire; } - int Strip() const { return strip; } - int Strip_hi() const { return strip_hi; } - int Strip_low() const { return strip_low; } - int Strip_quart() const { return strip_quart; } // Run 3 - int Strip_eighth() const { return strip_eighth; } // Run 3 - int Strip_quart_bit() const { return strip_quart_bit; } // Run 3 - int Strip_eighth_bit() const { return strip_eighth_bit; } // Run 3 - int Muon_shower_valid() const { return muon_shower_valid; } // Run 3 muon shower - int Muon_shower_inTime() const { return muon_shower_inTime; } // Run 3 muon shower - int Muon_shower_outOfTime() const { return muon_shower_outOfTime; } // Run 3 muon shower - int Track_num() const { return track_num; } - int Quality() const { return quality; } - int Pattern() const { return pattern; } - int Pattern_run3() const { return pattern_run3; } // Run 3 - int Bend() const { return bend; } - int Slope() const { return slope; } // Run 3 - int Valid() const { return valid; } - int Sync_err() const { return sync_err; } - // GEM specific aliases for member variables that don't match GEM nomenclature - /* + int Subsystem() const { return subsystem; } + int Endcap() const { return endcap; } + int Station() const { return station; } + int Ring() const { return ring; } + int Sector() const { return sector; } + int Sector_RPC() const { return sector_RPC; } + int Sector_idx() const { return sector_idx; } + int Subsector() const { return subsector; } + int Subsector_RPC() const { return subsector_RPC; } + int Chamber() const { return chamber; } + int CSC_ID() const { return csc_ID; } + int CSC_nID() const { return csc_nID; } + int Roll() const { return roll; } + int Neighbor() const { return neighbor; } + int MPC_link() const { return mpc_link; } + int PC_sector() const { return pc_sector; } + int PC_station() const { return pc_station; } + int PC_chamber() const { return pc_chamber; } + int PC_segment() const { return pc_segment; } + int Wire() const { return wire; } + int Strip() const { return strip; } + int Strip_hi() const { return strip_hi; } + int Strip_low() const { return strip_low; } + int Strip_quart() const { return strip_quart; } // Run 3 + int Strip_eighth() const { return strip_eighth; } // Run 3 + int Strip_quart_bit() const { return strip_quart_bit; } // Run 3 + int Strip_eighth_bit() const { return strip_eighth_bit; } // Run 3 + int Muon_shower_valid() const { return muon_shower_valid; } // Run 3 muon shower + int Muon_shower_inTime() const { return muon_shower_inTime; } // Run 3 muon shower + int Muon_shower_outOfTime() const { return muon_shower_outOfTime; } // Run 3 muon shower + int Track_num() const { return track_num; } + int Quality() const { return quality; } + int Pattern() const { return pattern; } + int Pattern_run3() const { return pattern_run3; } // Run 3 + int Bend() const { return bend; } + int Slope() const { return slope; } // Run 3 + int Valid() const { return valid; } + int Sync_err() const { return sync_err; } + // GEM specific aliases for member variables that don't match GEM nomenclature + /* * Each GEM pad is the OR of two neighbouring strips in phi. * For GE1/1 (10 degree chambers) this results in a total of 192 pads per eta partition * 128 strips per phi sector @@ -256,127 +257,128 @@ namespace l1t { * 128 strips per phi sector * 6 phi sectors per eta partition */ - /// Repurpose "strip" as GEM pad for GEM sourced hits - int Pad() const { return Strip(); } - /// Repurpose "strip" as GEM pad for GEM sourced hits - int Pad_hi() const { return Strip_hi(); } - /// Repurpose "strip" as GEM pad for GEM sourced hits - int Pad_low() const { return Strip_low(); } - /// "roll" corresponds to the GEM eta partition - int Partition() const { return Roll(); } - int Layer() const { return layer; } - /// Repurpose "quality" as the GEM cluster_size (number of pads in the cluster) - int ClusterSize() const { return Quality(); } - /// Repurpose "track_num" as the GEM cluster_id - int ClusterID() const { return Track_num(); } - // END GEM specific - int BC0() const { return bc0; } - int BX() const { return bx; } - int Stub_num() const { return stub_num; } - int Phi_fp() const { return phi_fp; } - int Theta_fp() const { return theta_fp; } - int Zone_hit() const { return zone_hit; } - int Zone_code() const { return zone_code; } - int FS_segment() const { return fs_segment; } - int FS_zone_code() const { return fs_zone_code; } - int BT_station() const { return bt_station; } - int BT_segment() const { return bt_segment; } - float Phi_loc() const { return phi_loc; } - float Phi_glob() const { return phi_glob; } - float Theta() const { return theta; } - float Eta() const { return eta; } - float Time() const { return time; } - float Phi_sim() const { return phi_sim; } - float Theta_sim() const { return theta_sim; } - float Eta_sim() const { return eta_sim; } - float Rho_sim() const { return rho_sim; } - float Z_sim() const { return z_sim; } - int ALCT_quality() const { return alct_quality; } - int CLCT_quality() const { return clct_quality; } + /// Repurpose "strip" as GEM pad for GEM sourced hits + int Pad() const { return Strip(); } + /// Repurpose "strip" as GEM pad for GEM sourced hits + int Pad_hi() const { return Strip_hi(); } + /// Repurpose "strip" as GEM pad for GEM sourced hits + int Pad_low() const { return Strip_low(); } + /// "roll" corresponds to the GEM eta partition + int Partition() const { return Roll(); } + int Layer() const { return layer; } + /// Repurpose "quality" as the GEM cluster_size (number of pads in the cluster) + int ClusterSize() const { return Quality(); } + /// Repurpose "track_num" as the GEM cluster_id + int ClusterID() const { return Track_num(); } + // END GEM specific + int BC0() const { return bc0; } + int BX() const { return bx; } + int Stub_num() const { return stub_num; } + int Phi_fp() const { return phi_fp; } + int Theta_fp() const { return theta_fp; } + int Zone_hit() const { return zone_hit; } + int Zone_code() const { return zone_code; } + int FS_segment() const { return fs_segment; } + int FS_zone_code() const { return fs_zone_code; } + int BT_station() const { return bt_station; } + int BT_segment() const { return bt_segment; } + float Phi_loc() const { return phi_loc; } + float Phi_glob() const { return phi_glob; } + float Theta() const { return theta; } + float Eta() const { return eta; } + float Time() const { return time; } + float Phi_sim() const { return phi_sim; } + float Theta_sim() const { return theta_sim; } + float Eta_sim() const { return eta_sim; } + float Rho_sim() const { return rho_sim; } + float Z_sim() const { return z_sim; } + int ALCT_quality() const { return alct_quality; } + int CLCT_quality() const { return clct_quality; } - bool Is_DT() const { return subsystem == l1tmu::kDT; } - bool Is_CSC() const { return subsystem == l1tmu::kCSC; } - bool Is_RPC() const { return subsystem == l1tmu::kRPC; } - bool Is_GEM() const { return subsystem == l1tmu::kGEM; } - bool Is_ME0() const { return subsystem == l1tmu::kME0; } + bool Is_DT() const { return subsystem == l1tmu::kDT; } + bool Is_CSC() const { return subsystem == l1tmu::kCSC; } + bool Is_RPC() const { return subsystem == l1tmu::kRPC; } + bool Is_GEM() const { return subsystem == l1tmu::kGEM; } + bool Is_ME0() const { return subsystem == l1tmu::kME0; } - private: - //CSCDetId csc_DetId; - //RPCDetId rpc_DetId; - //GEMDetId gem_DetId; - //CSCCorrelatedLCTDigi csc_LCTDigi; - //RPCDigi rpc_Digi; - //CPPFDigi cppf_Digi; - //GEMPadDigiCluster gem_PadClusterDigi; + private: + //CSCDetId csc_DetId; + //RPCDetId rpc_DetId; + //GEMDetId gem_DetId; + //CSCCorrelatedLCTDigi csc_LCTDigi; + //RPCDigi rpc_Digi; + //CPPFDigi cppf_Digi; + //GEMPadDigiCluster gem_PadClusterDigi; - uint32_t rawDetId; ///< raw CMSSW DetId - int subsystem; ///< 0 - 4. 0 for DT, 1 for CSC, 2 for RPC, 3 for GEM, 4 for ME0 - int endcap; ///< +/-1. For ME+ and ME-. - int station; ///< 1 - 4. - int ring; ///< 1 - 4. ME1/1a is denoted as "Ring 4". Should check dependence on input CSCDetId convention. - AWB 02.03.17 - int sector; ///< 1 - 6. CSC / GEM / EMTF sector convention: sector 1 starts at 15 degrees - int sector_RPC; ///< 1 - 6. RPC sector convention (in CMSSW): sector 1 starts at -5 degrees - int sector_idx; ///< 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. For neighbor hits, set by EMTF sector that received it. - int subsector; ///< 0 - 6. In CSCs, 1 or 2 for ME1, 0 for ME2/3/4. - int subsector_RPC; ///< 0 - 6. RPC sector convention (in CMSSW): subsector 3 is the first chamber in the EMTF sector. - int chamber; ///< 1 - 36. Chamber 1 starts at -5 degrees. - int csc_ID; ///< 1 - 9. For CSCs only. - int csc_nID; ///< 1 - 15. For CSCs only. Neighbors 10 - 15, 12 not filled. - int roll; ///< 1 - 3. For RPCs only, sub-division of ring. (Range? - AWB 02.03.17) - int neighbor; ///< 0 or 1. Filled in EMTFBlock(ME|GEM|RPC).cc - int mpc_link; ///< 1 - 3. Filled in EMTFHit.cc from CSCCorrelatedLCTDigi - int pc_sector; ///< 1 - 6. EMTF sector that received the LCT, even those sent from neighbor sectors. - int pc_station; ///< 0 - 5. 0 for ME1 subsector 1, 5 for neighbor hits. - int pc_chamber; ///< 0 - 8. - int pc_segment; ///< 0 - 3. - int wire; ///< 0 - 111 For CSCs only. - int strip; ///< 0 - 158 For CSCs only. - int strip_hi; ///< ? - ?. For RPCs only, highest strip in a cluster. (Range? - AWB 02.03.17) - int strip_low; ///< ? - ?. For RPCs only, lowest strip in a cluster. (Range? - AWB 02.03.17) - int strip_quart; ///< Run 3 CSC parameters - int strip_eighth; ///< Run 3 CSC parameters - int strip_quart_bit; ///< Run 3 CSC parameters - int strip_eighth_bit; ///< Run 3 CSC parameters - int muon_shower_valid; ///< Run 3 muon shower - int muon_shower_inTime; ///< Run 3 muon shower - int muon_shower_outOfTime; ///< Run 3 muon shower - int track_num; ///< ? - ?. For CSCs only. (Range? - AWB 02.03.17) - int quality; ///< 0 - 15. For CSCs only. - int pattern; ///< 0 - 10. For CSCs only. - int pattern_run3; ///< Run 3 For CSC only. - int bend; ///< 0 or 1. For CSCs only. - int slope; ///< Run 3 For CSC only. - int valid; ///< 0 or 1. For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17) - int sync_err; ///< 0 or 1. For CSCs only. - // GEM specific - int layer; ///< 0 - 1. For GEMs only, superchamber detector layer (1 or 2). - // END GEM specific - int bc0; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 - int bx; ///< -3 - +3. - int stub_num; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 - int phi_fp; ///< 0 - 4920 - int theta_fp; ///< 0 - 127 - int zone_hit; ///< 4 - 156 (Range? - AWB 02.03.17) - int zone_code; ///< 0 - 12. (Range? - AWB 02.03.17) - int fs_segment; ///< 0 - 13. (Range? - AWB 02.03.17) - int fs_zone_code; ///< 1 - 14. (Range? - AWB 02.03.17) - int bt_station; ///< 0 - 4. - int bt_segment; ///< 0 - 25. (Range? - AWB 02.03.17) - float phi_loc; ///< -20 - 60 (Range? - AWB 02.03.17) - float phi_glob; ///< +/-180. - float theta; ///< 0 - 90. - float eta; ///< +/-2.5. - float time; ///< ? - ?. RPC time information (ns) - float phi_sim; ///< +/-180. - float theta_sim; ///< 0 - 90. - float eta_sim; ///< +/-2.5. - float rho_sim; ///< ? - ?. - float z_sim; ///< ? - ?. - int alct_quality; ///< 1 - 3. For emulated CSC LCTs only, maps to number of ALCT layers (4 - 6). - int clct_quality; ///< 4 - 6. For emulated CSC LCTs only, maps to number of CLCT layers (4 - 6). - - }; // End of class EMTFHit + uint32_t rawDetId; ///< raw CMSSW DetId + int subsystem; ///< 0 - 4. 0 for DT, 1 for CSC, 2 for RPC, 3 for GEM, 4 for ME0 + int endcap; ///< +/-1. For ME+ and ME-. + int station; ///< 1 - 4. + int ring; ///< 1 - 4. ME1/1a is denoted as "Ring 4". Should check dependence on input CSCDetId convention. - AWB 02.03.17 + int sector; ///< 1 - 6. CSC / GEM / EMTF sector convention: sector 1 starts at 15 degrees + int sector_RPC; ///< 1 - 6. RPC sector convention (in CMSSW): sector 1 starts at -5 degrees + int sector_idx; ///< 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. For neighbor hits, set by EMTF sector that received it. + int subsector; ///< 0 - 6. In CSCs, 1 or 2 for ME1, 0 for ME2/3/4. + int subsector_RPC; ///< 0 - 6. RPC sector convention (in CMSSW): subsector 3 is the first chamber in the EMTF sector. + int chamber; ///< 1 - 36. Chamber 1 starts at -5 degrees. + int csc_ID; ///< 1 - 9. For CSCs only. + int csc_nID; ///< 1 - 15. For CSCs only. Neighbors 10 - 15, 12 not filled. + int roll; ///< 1 - 3. For RPCs only, sub-division of ring. (Range? - AWB 02.03.17) + int neighbor; ///< 0 or 1. Filled in EMTFBlock(ME|GEM|RPC).cc + int mpc_link; ///< 1 - 3. Filled in EMTFHit.cc from CSCCorrelatedLCTDigi + int pc_sector; ///< 1 - 6. EMTF sector that received the LCT, even those sent from neighbor sectors. + int pc_station; ///< 0 - 5. 0 for ME1 subsector 1, 5 for neighbor hits. + int pc_chamber; ///< 0 - 8. + int pc_segment; ///< 0 - 3. + int wire; ///< 0 - 111 For CSCs only. + int strip; ///< 0 - 158 For CSCs only. + int strip_hi; ///< ? - ?. For RPCs only, highest strip in a cluster. (Range? - AWB 02.03.17) + int strip_low; ///< ? - ?. For RPCs only, lowest strip in a cluster. (Range? - AWB 02.03.17) + int strip_quart; ///< Run 3 CSC parameters + int strip_eighth; ///< Run 3 CSC parameters + int strip_quart_bit; ///< Run 3 CSC parameters + int strip_eighth_bit; ///< Run 3 CSC parameters + int muon_shower_valid; ///< Run 3 muon shower + int muon_shower_inTime; ///< Run 3 muon shower + int muon_shower_outOfTime; ///< Run 3 muon shower + int track_num; ///< ? - ?. For CSCs only. (Range? - AWB 02.03.17) + int quality; ///< 0 - 15. For CSCs only. + int pattern; ///< 0 - 10. For CSCs only. + int pattern_run3; ///< Run 3 For CSC only. + int bend; ///< 0 or 1. For CSCs only. + int slope; ///< Run 3 For CSC only. + int valid; ///< 0 or 1. For CSCs only (for now; could use to flag failing clusters? - AWB 02.03.17) + int sync_err; ///< 0 or 1. For CSCs only. + // GEM specific + int layer; ///< 0 - 1. For GEMs only, superchamber detector layer (1 or 2). + // END GEM specific + int bc0; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 + int bx; ///< -3 - +3. + int stub_num; ///< 0 or 1. Only from unpacked data? - AWB 02.03.17 + int phi_fp; ///< 0 - 4920 + int theta_fp; ///< 0 - 127 + int zone_hit; ///< 4 - 156 (Range? - AWB 02.03.17) + int zone_code; ///< 0 - 12. (Range? - AWB 02.03.17) + int fs_segment; ///< 0 - 13. (Range? - AWB 02.03.17) + int fs_zone_code; ///< 1 - 14. (Range? - AWB 02.03.17) + int bt_station; ///< 0 - 4. + int bt_segment; ///< 0 - 25. (Range? - AWB 02.03.17) + float phi_loc; ///< -20 - 60 (Range? - AWB 02.03.17) + float phi_glob; ///< +/-180. + float theta; ///< 0 - 90. + float eta; ///< +/-2.5. + float time; ///< ? - ?. RPC time information (ns) + float phi_sim; ///< +/-180. + float theta_sim; ///< 0 - 90. + float eta_sim; ///< +/-2.5. + float rho_sim; ///< ? - ?. + float z_sim; ///< ? - ?. + int alct_quality; ///< 1 - 3. For emulated CSC LCTs only, maps to number of ALCT layers (4 - 6). + int clct_quality; ///< 4 - 6. For emulated CSC LCTs only, maps to number of CLCT layers (4 - 6). + }; // End of class EMTFHit + } // namespace io_v1 + using EMTFHit = io_v1::EMTFHit; // Define a vector of EMTFHit typedef std::vector EMTFHitCollection; diff --git a/DataFormats/L1TMuon/interface/EMTFTrack.h b/DataFormats/L1TMuon/interface/EMTFTrack.h index d96c4fcc41275..9756b1f117818 100644 --- a/DataFormats/L1TMuon/interface/EMTFTrack.h +++ b/DataFormats/L1TMuon/interface/EMTFTrack.h @@ -41,212 +41,214 @@ namespace l1t { uint16_t bt_si[5]; // ^ }; - class EMTFTrack { - public: - EMTFTrack() - : _PtLUT(), - endcap(-99), - sector(-99), - sector_idx(-99), - mode(-99), - mode_CSC(0), - mode_RPC(0), - mode_GEM(0), - mode_neighbor(0), - mode_inv(-99), - rank(-99), - winner(-99), - charge(-99), - bx(-99), - first_bx(-99), - second_bx(-99), - pt(-99), - pt_XML(-99), - pt_dxy(-99), - dxy(-99), - zone(-99), - ph_num(-99), - ph_q(-99), - theta_fp(-99), - theta(-99), - eta(-99), - phi_fp(-99), - phi_loc(-99), - phi_glob(-999), - gmt_pt(-99), - gmt_pt_dxy(-99), - gmt_dxy(-99), - gmt_phi(-999), - gmt_eta(-999), - gmt_quality(-99), - gmt_charge(-99), - gmt_charge_valid(-99), - track_num(-99), - numHits(-99) {} - - virtual ~EMTFTrack() {} - - void ImportSP(const emtf::SP _SP, int _sector); - // void ImportPtLUT( int _mode, unsigned long _address ); - - void clear_Hits() { - _Hits.clear(); - numHits = 0; - mode_CSC = 0; - mode_RPC = 0; - mode_GEM = 0; - mode_neighbor = 0; - } - - void push_Hit(const EMTFHit& hit) { - _Hits.push_back(hit); - numHits = _Hits.size(); - if (hit.Is_CSC()) - mode_CSC |= (1 << (4 - hit.Station())); - if (hit.Is_RPC()) - mode_RPC |= (1 << (4 - hit.Station())); - if (hit.Is_GEM()) - mode_GEM |= (1 << (4 - hit.Station())); - if (hit.Neighbor()) - mode_neighbor |= (1 << (4 - hit.Station())); - } - - void set_Hits(const EMTFHitCollection& hits) { - clear_Hits(); - for (const auto& hit : hits) - push_Hit(hit); - } - - void clear_HitIdx() { _HitIdx.clear(); } - void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); } - void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } - - int NumHits() const { return numHits; } - EMTFHitCollection Hits() const { return _Hits; } - std::vector HitIdx() const { return _HitIdx; } - - void set_PtLUT(EMTFPtLUT bits) { _PtLUT = bits; } - EMTFPtLUT PtLUT() const { return _PtLUT; } - - void set_endcap(int bits) { endcap = bits; } - void set_sector(int bits) { sector = bits; } - void set_sector_idx(int bits) { sector_idx = bits; } - void set_mode(int bits) { mode = bits; } - void set_mode_inv(int bits) { mode_inv = bits; } - void set_rank(int bits) { rank = bits; } - void set_winner(int bits) { winner = bits; } - void set_charge(int bits) { charge = bits; } - void set_bx(int bits) { bx = bits; } - void set_first_bx(int bits) { first_bx = bits; } - void set_second_bx(int bits) { second_bx = bits; } - void set_pt(float val) { pt = val; } - void set_pt_XML(float val) { pt_XML = val; } - void set_pt_dxy(float val) { pt_dxy = val; } - void set_dxy(float val) { dxy = val; } - void set_zone(int bits) { zone = bits; } - void set_ph_num(int bits) { ph_num = bits; } - void set_ph_q(int bits) { ph_q = bits; } - void set_theta_fp(int bits) { theta_fp = bits; } - void set_theta(float val) { theta = val; } - void set_eta(float val) { eta = val; } - void set_phi_fp(int bits) { phi_fp = bits; } - void set_phi_loc(float val) { phi_loc = val; } - void set_phi_glob(float val) { phi_glob = val; } - void set_gmt_pt(int bits) { gmt_pt = bits; } - void set_gmt_pt_dxy(int bits) { gmt_pt_dxy = bits; } - void set_gmt_dxy(int bits) { gmt_dxy = bits; } - void set_gmt_phi(int bits) { gmt_phi = bits; } - void set_gmt_eta(int bits) { gmt_eta = bits; } - void set_gmt_quality(int bits) { gmt_quality = bits; } - void set_gmt_charge(int bits) { gmt_charge = bits; } - void set_gmt_charge_valid(int bits) { gmt_charge_valid = bits; } - void set_track_num(int bits) { track_num = bits; } - - int Endcap() const { return endcap; } - int Sector() const { return sector; } - int Sector_idx() const { return sector_idx; } - int Mode() const { return mode; } - int Mode_CSC() const { return mode_CSC; } - int Mode_RPC() const { return mode_RPC; } - int Mode_GEM() const { return mode_GEM; } - int Mode_neighbor() const { return mode_neighbor; } - int Mode_inv() const { return mode_inv; } - int Rank() const { return rank; } - int Winner() const { return winner; } - int Charge() const { return charge; } - int BX() const { return bx; } - int First_BX() const { return first_bx; } - int Second_BX() const { return second_bx; } - float Pt() const { return pt; } - float Pt_XML() const { return pt_XML; } - float Pt_dxy() const { return pt_dxy; } - float Dxy() const { return dxy; } - int Zone() const { return zone; } - int Ph_num() const { return ph_num; } - int Ph_q() const { return ph_q; } - int Theta_fp() const { return theta_fp; } - float Theta() const { return theta; } - float Eta() const { return eta; } - int Phi_fp() const { return phi_fp; } - float Phi_loc() const { return phi_loc; } - float Phi_glob() const { return phi_glob; } - int GMT_pt() const { return gmt_pt; } - int GMT_pt_dxy() const { return gmt_pt_dxy; } - int GMT_dxy() const { return gmt_dxy; } - int GMT_phi() const { return gmt_phi; } - int GMT_eta() const { return gmt_eta; } - int GMT_quality() const { return gmt_quality; } - int GMT_charge() const { return gmt_charge; } - int GMT_charge_valid() const { return gmt_charge_valid; } - int Track_num() const { return track_num; } - - private: - EMTFHitCollection _Hits; - std::vector _HitIdx; - - EMTFPtLUT _PtLUT; - - int endcap; // +/-1. For ME+ and ME-. - int sector; // 1 - 6. - int sector_idx; // 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. - int mode; // 0 - 15. - int mode_CSC; // 0 - 15, CSC-only - int mode_RPC; // 0 - 15, RPC-only - int mode_GEM; // 0 - 15, GEM-only // TODO: verify if needed when including GEM, also start the good habit of documenting these - int mode_neighbor; // 0 - 15, only neighbor hits - int mode_inv; // 15 - 0. - int rank; // 0 - 127 (Range? - AWB 03.03.17) - int winner; // 0 - 2. (Range? - AWB 03.03.17) - int charge; // +/-1. For physical charge (reversed from GMT convention) - int bx; // -3 - +3. - int first_bx; // -3 - +3. - int second_bx; // -3 - +3. - float pt; // 0 - 255 - float pt_XML; // 0 - 999 - float pt_dxy; // 0 - 127 - float dxy; // 0 - 3 - int zone; // 0 - 3. - int ph_num; - int ph_q; - int theta_fp; // 0 - 127 - float theta; // 0 - 90. - float eta; // +/-2.5. - int phi_fp; // 0 - 4920 - float phi_loc; // -22 - 60 (Range? - AWB 03.03.17) - float phi_glob; // +/-180. - int gmt_pt; - int gmt_pt_dxy; - int gmt_dxy; - int gmt_phi; - int gmt_eta; - int gmt_quality; - int gmt_charge; - int gmt_charge_valid; - int track_num; // 0 - ??. (Range? - AWB 03.03.17) - int numHits; // 1 - 4. - - }; // End of class EMTFTrack + namespace io_v1 { + class EMTFTrack { + public: + EMTFTrack() + : _PtLUT(), + endcap(-99), + sector(-99), + sector_idx(-99), + mode(-99), + mode_CSC(0), + mode_RPC(0), + mode_GEM(0), + mode_neighbor(0), + mode_inv(-99), + rank(-99), + winner(-99), + charge(-99), + bx(-99), + first_bx(-99), + second_bx(-99), + pt(-99), + pt_XML(-99), + pt_dxy(-99), + dxy(-99), + zone(-99), + ph_num(-99), + ph_q(-99), + theta_fp(-99), + theta(-99), + eta(-99), + phi_fp(-99), + phi_loc(-99), + phi_glob(-999), + gmt_pt(-99), + gmt_pt_dxy(-99), + gmt_dxy(-99), + gmt_phi(-999), + gmt_eta(-999), + gmt_quality(-99), + gmt_charge(-99), + gmt_charge_valid(-99), + track_num(-99), + numHits(-99) {} + virtual ~EMTFTrack() {} + + void ImportSP(const emtf::SP _SP, int _sector); + // void ImportPtLUT( int _mode, unsigned long _address ); + + void clear_Hits() { + _Hits.clear(); + numHits = 0; + mode_CSC = 0; + mode_RPC = 0; + mode_GEM = 0; + mode_neighbor = 0; + } + + void push_Hit(const EMTFHit& hit) { + _Hits.push_back(hit); + numHits = _Hits.size(); + if (hit.Is_CSC()) + mode_CSC |= (1 << (4 - hit.Station())); + if (hit.Is_RPC()) + mode_RPC |= (1 << (4 - hit.Station())); + if (hit.Is_GEM()) + mode_GEM |= (1 << (4 - hit.Station())); + if (hit.Neighbor()) + mode_neighbor |= (1 << (4 - hit.Station())); + } + + void set_Hits(const EMTFHitCollection& hits) { + clear_Hits(); + for (const auto& hit : hits) + push_Hit(hit); + } + + void clear_HitIdx() { _HitIdx.clear(); } + void push_HitIdx(unsigned int bits) { _HitIdx.push_back(bits); } + void set_HitIdx(const std::vector& bits) { _HitIdx = bits; } + + int NumHits() const { return numHits; } + EMTFHitCollection Hits() const { return _Hits; } + std::vector HitIdx() const { return _HitIdx; } + + void set_PtLUT(EMTFPtLUT bits) { _PtLUT = bits; } + EMTFPtLUT PtLUT() const { return _PtLUT; } + + void set_endcap(int bits) { endcap = bits; } + void set_sector(int bits) { sector = bits; } + void set_sector_idx(int bits) { sector_idx = bits; } + void set_mode(int bits) { mode = bits; } + void set_mode_inv(int bits) { mode_inv = bits; } + void set_rank(int bits) { rank = bits; } + void set_winner(int bits) { winner = bits; } + void set_charge(int bits) { charge = bits; } + void set_bx(int bits) { bx = bits; } + void set_first_bx(int bits) { first_bx = bits; } + void set_second_bx(int bits) { second_bx = bits; } + void set_pt(float val) { pt = val; } + void set_pt_XML(float val) { pt_XML = val; } + void set_pt_dxy(float val) { pt_dxy = val; } + void set_dxy(float val) { dxy = val; } + void set_zone(int bits) { zone = bits; } + void set_ph_num(int bits) { ph_num = bits; } + void set_ph_q(int bits) { ph_q = bits; } + void set_theta_fp(int bits) { theta_fp = bits; } + void set_theta(float val) { theta = val; } + void set_eta(float val) { eta = val; } + void set_phi_fp(int bits) { phi_fp = bits; } + void set_phi_loc(float val) { phi_loc = val; } + void set_phi_glob(float val) { phi_glob = val; } + void set_gmt_pt(int bits) { gmt_pt = bits; } + void set_gmt_pt_dxy(int bits) { gmt_pt_dxy = bits; } + void set_gmt_dxy(int bits) { gmt_dxy = bits; } + void set_gmt_phi(int bits) { gmt_phi = bits; } + void set_gmt_eta(int bits) { gmt_eta = bits; } + void set_gmt_quality(int bits) { gmt_quality = bits; } + void set_gmt_charge(int bits) { gmt_charge = bits; } + void set_gmt_charge_valid(int bits) { gmt_charge_valid = bits; } + void set_track_num(int bits) { track_num = bits; } + + int Endcap() const { return endcap; } + int Sector() const { return sector; } + int Sector_idx() const { return sector_idx; } + int Mode() const { return mode; } + int Mode_CSC() const { return mode_CSC; } + int Mode_RPC() const { return mode_RPC; } + int Mode_GEM() const { return mode_GEM; } + int Mode_neighbor() const { return mode_neighbor; } + int Mode_inv() const { return mode_inv; } + int Rank() const { return rank; } + int Winner() const { return winner; } + int Charge() const { return charge; } + int BX() const { return bx; } + int First_BX() const { return first_bx; } + int Second_BX() const { return second_bx; } + float Pt() const { return pt; } + float Pt_XML() const { return pt_XML; } + float Pt_dxy() const { return pt_dxy; } + float Dxy() const { return dxy; } + int Zone() const { return zone; } + int Ph_num() const { return ph_num; } + int Ph_q() const { return ph_q; } + int Theta_fp() const { return theta_fp; } + float Theta() const { return theta; } + float Eta() const { return eta; } + int Phi_fp() const { return phi_fp; } + float Phi_loc() const { return phi_loc; } + float Phi_glob() const { return phi_glob; } + int GMT_pt() const { return gmt_pt; } + int GMT_pt_dxy() const { return gmt_pt_dxy; } + int GMT_dxy() const { return gmt_dxy; } + int GMT_phi() const { return gmt_phi; } + int GMT_eta() const { return gmt_eta; } + int GMT_quality() const { return gmt_quality; } + int GMT_charge() const { return gmt_charge; } + int GMT_charge_valid() const { return gmt_charge_valid; } + int Track_num() const { return track_num; } + + private: + EMTFHitCollection _Hits; + std::vector _HitIdx; + + EMTFPtLUT _PtLUT; + + int endcap; // +/-1. For ME+ and ME-. + int sector; // 1 - 6. + int sector_idx; // 0 - 11. 0 - 5 for ME+, 6 - 11 for ME-. + int mode; // 0 - 15. + int mode_CSC; // 0 - 15, CSC-only + int mode_RPC; // 0 - 15, RPC-only + int mode_GEM; // 0 - 15, GEM-only // TODO: verify if needed when including GEM, also start the good habit of documenting these + int mode_neighbor; // 0 - 15, only neighbor hits + int mode_inv; // 15 - 0. + int rank; // 0 - 127 (Range? - AWB 03.03.17) + int winner; // 0 - 2. (Range? - AWB 03.03.17) + int charge; // +/-1. For physical charge (reversed from GMT convention) + int bx; // -3 - +3. + int first_bx; // -3 - +3. + int second_bx; // -3 - +3. + float pt; // 0 - 255 + float pt_XML; // 0 - 999 + float pt_dxy; // 0 - 127 + float dxy; // 0 - 3 + int zone; // 0 - 3. + int ph_num; + int ph_q; + int theta_fp; // 0 - 127 + float theta; // 0 - 90. + float eta; // +/-2.5. + int phi_fp; // 0 - 4920 + float phi_loc; // -22 - 60 (Range? - AWB 03.03.17) + float phi_glob; // +/-180. + int gmt_pt; + int gmt_pt_dxy; + int gmt_dxy; + int gmt_phi; + int gmt_eta; + int gmt_quality; + int gmt_charge; + int gmt_charge_valid; + int track_num; // 0 - ??. (Range? - AWB 03.03.17) + int numHits; // 1 - 4. + + }; // End of class EMTFTrack + } // namespace io_v1 + using EMTFTrack = io_v1::EMTFTrack; // Define a vector of EMTFTrack typedef std::vector EMTFTrackCollection; diff --git a/DataFormats/L1TMuon/interface/L1MuBMTrack.h b/DataFormats/L1TMuon/interface/L1MuBMTrack.h index 595e424cbca6a..5b2804dd13f55 100644 --- a/DataFormats/L1TMuon/interface/L1MuBMTrack.h +++ b/DataFormats/L1TMuon/interface/L1MuBMTrack.h @@ -42,171 +42,175 @@ // -- Class Interface -- // --------------------- -class L1MuBMTrack; +namespace io_v1 { + class L1MuBMTrack; +} +using L1MuBMTrack = io_v1::L1MuBMTrack; typedef std::vector L1MuBMTrackCollection; -class L1MuBMTrack : public l1t::RegionalMuonCand { -public: - /// default constructor - L1MuBMTrack(); +namespace io_v1 { + class L1MuBMTrack : public l1t::RegionalMuonCand { + public: + /// default constructor + L1MuBMTrack(); - /// constructor - L1MuBMTrack(const L1MuBMSecProcId&); + /// constructor + L1MuBMTrack(const L1MuBMSecProcId&); - /// copy constructor - L1MuBMTrack(const L1MuBMTrack&); + /// copy constructor + L1MuBMTrack(const L1MuBMTrack&); - /// destructor - ~L1MuBMTrack() override; + /// destructor + ~L1MuBMTrack() override; - /// reset muon candidate - void reset(); + /// reset muon candidate + void reset(); - /// get name of object - inline std::string name() const { return m_name; } + /// get name of object + inline std::string name() const { return m_name; } - /// get pt-code (5 bits) - inline unsigned int pt() const { return hwPt(); } + /// get pt-code (5 bits) + inline unsigned int pt() const { return hwPt(); } - /// get phi-code (8 bits) - inline unsigned int phi() const { return hwPhi(); } + /// get phi-code (8 bits) + inline unsigned int phi() const { return hwPhi(); } - /// get eta-code (6 bits) - inline int eta() const { return hwEta(); } + /// get eta-code (6 bits) + inline int eta() const { return hwEta(); } - /// get fine eta bit - inline bool fineEtaBit() const { return hwHF(); } + /// get fine eta bit + inline bool fineEtaBit() const { return hwHF(); } - /// get charge (1 bit) - inline int charge() const { return hwSign(); } + /// get charge (1 bit) + inline int charge() const { return hwSign(); } - /// get quality - inline unsigned int quality() const { return hwQual(); } + /// get quality + inline unsigned int quality() const { return hwQual(); } - /// get track-class - inline TrackClass tc() const { return m_tc; } + /// get track-class + inline TrackClass tc() const { return m_tc; } - /// is it an empty muon candidate? - inline bool empty() const { return m_empty; } + /// is it an empty muon candidate? + inline bool empty() const { return m_empty; } - /// return Sector Processor in which the muon candidate was found - inline const L1MuBMSecProcId& spid() const { return m_spid; } + /// return Sector Processor in which the muon candidate was found + inline const L1MuBMSecProcId& spid() const { return m_spid; } - /// get address-array for this muon candidate - inline L1MuBMAddressArray address() const { return m_addArray; } + /// get address-array for this muon candidate + inline L1MuBMAddressArray address() const { return m_addArray; } - /// get relative address of a given station - inline int address(int stat) const { return m_addArray.station(stat); } + /// get relative address of a given station + inline int address(int stat) const { return m_addArray.station(stat); } - /// get the bunch crossing for this muon candidate - inline int bx() const { return m_bx; } + /// get the bunch crossing for this muon candidate + inline int bx() const { return m_bx; } - /// return number of phi track segments used to form the muon candidate - inline int numberOfTSphi() const { return m_tsphiList.size(); } + /// return number of phi track segments used to form the muon candidate + inline int numberOfTSphi() const { return m_tsphiList.size(); } - /// return number of eta track segments used to form the muon candidate - inline int numberOfTSeta() const { return m_tsetaList.size(); } + /// return number of eta track segments used to form the muon candidate + inline int numberOfTSeta() const { return m_tsetaList.size(); } - /// return all phi track segments of the muon candidate - const std::vector& getTSphi() const { return m_tsphiList; } + /// return all phi track segments of the muon candidate + const std::vector& getTSphi() const { return m_tsphiList; } - /// return start phi track segment of muon candidate - const L1MuBMTrackSegPhi& getStartTSphi() const; + /// return start phi track segment of muon candidate + const L1MuBMTrackSegPhi& getStartTSphi() const; - /// return end phi track segment of muon candidate - const L1MuBMTrackSegPhi& getEndTSphi() const; + /// return end phi track segment of muon candidate + const L1MuBMTrackSegPhi& getEndTSphi() const; - /// return all eta track segments of the muon candidate - const std::vector& getTSeta() const { return m_tsetaList; } + /// return all eta track segments of the muon candidate + const std::vector& getTSeta() const { return m_tsetaList; } - /// return start eta track segment of muon candidate - const L1MuBMTrackSegEta& getStartTSeta() const; + /// return start eta track segment of muon candidate + const L1MuBMTrackSegEta& getStartTSeta() const; - /// return end eta track segment of muon candidate - const L1MuBMTrackSegEta& getEndTSeta() const; + /// return end eta track segment of muon candidate + const L1MuBMTrackSegEta& getEndTSeta() const; - /// enable muon candidate - inline void enable() { - m_empty = false; - setTFIdentifiers(this->spid().sector(), l1t::tftype::bmtf); - }; - - /// disable muon candidate - inline void disable() { m_empty = true; } + /// enable muon candidate + inline void enable() { + m_empty = false; + setTFIdentifiers(this->spid().sector(), l1t::tftype::bmtf); + }; - /// set name of object - inline void setName(std::string name) { m_name = name; } + /// disable muon candidate + inline void disable() { m_empty = true; } - /// set track-class of muon candidate - inline void setTC(TrackClass tc) { m_tc = tc; } + /// set name of object + inline void setName(std::string name) { m_name = name; } - /// set phi-code of muon candidate - inline void setPhi(int phi) { setHwPhi(phi); } + /// set track-class of muon candidate + inline void setTC(TrackClass tc) { m_tc = tc; } - /// set eta-code of muon candidate - void setEta(int eta); + /// set phi-code of muon candidate + inline void setPhi(int phi) { setHwPhi(phi); } - /// set fine eta bit - inline void setFineEtaBit() { setHwHF(true); } + /// set eta-code of muon candidate + void setEta(int eta); - /// set pt-code of muon candidate - inline void setPt(int pt) { setHwPt(pt); } + /// set fine eta bit + inline void setFineEtaBit() { setHwHF(true); } - /// set charge of muon candidate - inline void setCharge(int charge) { setHwSign(charge); } + /// set pt-code of muon candidate + inline void setPt(int pt) { setHwPt(pt); } - /// set bunch crossing of this muon candidate - inline void setBx(int bx) { m_bx = bx; } + /// set charge of muon candidate + inline void setCharge(int charge) { setHwSign(charge); } - /// set quality of muon candidate - inline void setQuality(unsigned int quality) { setHwQual(quality); } + /// set bunch crossing of this muon candidate + inline void setBx(int bx) { m_bx = bx; } - /// set relative addresses of muon candidate - inline void setAddresses(const L1MuBMAddressArray& addr) { m_addArray = addr; } + /// set quality of muon candidate + inline void setQuality(unsigned int quality) { setHwQual(quality); } - /// set phi track segments used to form the muon candidate - void setTSphi(const std::vector& tsList); + /// set relative addresses of muon candidate + inline void setAddresses(const L1MuBMAddressArray& addr) { m_addArray = addr; } - /// set eta track segments used to form the muon candidate - void setTSeta(const std::vector& tsList); + /// set phi track segments used to form the muon candidate + void setTSphi(const std::vector& tsList); - /// assignment operator - L1MuBMTrack& operator=(const L1MuBMTrack&); + /// set eta track segments used to form the muon candidate + void setTSeta(const std::vector& tsList); - /// equal operator - bool operator==(const L1MuBMTrack&) const; + /// assignment operator + L1MuBMTrack& operator=(const L1MuBMTrack&); - /// unequal operator - bool operator!=(const L1MuBMTrack&) const; + /// equal operator + bool operator==(const L1MuBMTrack&) const; - /// print parameters of muon candidate - void print() const; + /// unequal operator + bool operator!=(const L1MuBMTrack&) const; - /// output stream operator - friend std::ostream& operator<<(std::ostream&, const L1MuBMTrack&); + /// print parameters of muon candidate + void print() const; - /// define a rank for muon candidates - static bool rank(const L1MuBMTrack* first, const L1MuBMTrack* second) { - unsigned short int rank_f = 0; // rank of first - unsigned short int rank_s = 0; // rank of second - if (first) - rank_f = first->pt() + 512 * first->quality(); - if (second) - rank_s = second->pt() + 512 * second->quality(); - return rank_f > rank_s; - } + /// output stream operator + friend std::ostream& operator<<(std::ostream&, const L1MuBMTrack&); -private: - L1MuBMSecProcId m_spid; // which SP found the track - std::string m_name; - bool m_empty; - TrackClass m_tc; - int m_bx; + /// define a rank for muon candidates + static bool rank(const L1MuBMTrack* first, const L1MuBMTrack* second) { + unsigned short int rank_f = 0; // rank of first + unsigned short int rank_s = 0; // rank of second + if (first) + rank_f = first->pt() + 512 * first->quality(); + if (second) + rank_s = second->pt() + 512 * second->quality(); + return rank_f > rank_s; + } - L1MuBMAddressArray m_addArray; - std::vector m_tsphiList; - std::vector m_tsetaList; -}; + private: + L1MuBMSecProcId m_spid; // which SP found the track + std::string m_name; + bool m_empty; + TrackClass m_tc; + int m_bx; + L1MuBMAddressArray m_addArray; + std::vector m_tsphiList; + std::vector m_tsetaList; + }; +} // namespace io_v1 #endif diff --git a/DataFormats/L1TMuon/interface/L1MuBMTrackFwd.h b/DataFormats/L1TMuon/interface/L1MuBMTrackFwd.h index 8c77deef0f6ef..2586b2fe11bc2 100644 --- a/DataFormats/L1TMuon/interface/L1MuBMTrackFwd.h +++ b/DataFormats/L1TMuon/interface/L1MuBMTrackFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1TMuon_L1MuBMTrackFwd_h #define DataFormats_L1TMuon_L1MuBMTrackFwd_h -class L1MuBMTrack; - +namespace io_v1 { + class L1MuBMTrack; +} +using L1MuBMTrack = io_v1::L1MuBMTrack; #endif diff --git a/DataFormats/L1TMuon/interface/L1MuBMTrackSegEta.h b/DataFormats/L1TMuon/interface/L1MuBMTrackSegEta.h index 3930b19151198..5967d6e89ebbf 100644 --- a/DataFormats/L1TMuon/interface/L1MuBMTrackSegEta.h +++ b/DataFormats/L1TMuon/interface/L1MuBMTrackSegEta.h @@ -34,71 +34,75 @@ // -- Class Interface -- // --------------------- -class L1MuBMTrackSegEta; +namespace io_v1 { + class L1MuBMTrackSegEta; +} +using L1MuBMTrackSegEta = io_v1::L1MuBMTrackSegEta; typedef std::vector L1MuBMTrackSegEtaCollection; -class L1MuBMTrackSegEta { -public: - /// default constructor - L1MuBMTrackSegEta(); +namespace io_v1 { + class L1MuBMTrackSegEta { + public: + /// default constructor + L1MuBMTrackSegEta(); - /// constructor - L1MuBMTrackSegEta(int wheel_id, int sector_id, int station_id, int position = 0, int quality = 0, int bx = 17); + /// constructor + L1MuBMTrackSegEta(int wheel_id, int sector_id, int station_id, int position = 0, int quality = 0, int bx = 17); - /// constructor - L1MuBMTrackSegEta(const L1MuBMTrackSegLoc&, int position = 0, int quality = 0, int bx = 17); + /// constructor + L1MuBMTrackSegEta(const L1MuBMTrackSegLoc&, int position = 0, int quality = 0, int bx = 17); - /// copy constructor - L1MuBMTrackSegEta(const L1MuBMTrackSegEta&); + /// copy constructor + L1MuBMTrackSegEta(const L1MuBMTrackSegEta&); - /// destructor - virtual ~L1MuBMTrackSegEta(); + /// destructor + virtual ~L1MuBMTrackSegEta(); - /// reset eta track segment - void reset(); + /// reset eta track segment + void reset(); - /// return wheel - inline int wheel() const { return m_location.wheel(); } + /// return wheel + inline int wheel() const { return m_location.wheel(); } - /// return sector - inline int sector() const { return m_location.sector(); } + /// return sector + inline int sector() const { return m_location.sector(); } - /// return station - inline int station() const { return m_location.station(); } + /// return station + inline int station() const { return m_location.station(); } - /// return location of eta track segment - inline const L1MuBMTrackSegLoc& where() const { return m_location; } + /// return location of eta track segment + inline const L1MuBMTrackSegLoc& where() const { return m_location; } - /// return position - inline unsigned int position() const { return m_position; } + /// return position + inline unsigned int position() const { return m_position; } - /// return quality code - inline unsigned int quality() const { return m_quality; } + /// return quality code + inline unsigned int quality() const { return m_quality; } - /// return bunch crossing - inline int bx() const { return m_bx; } + /// return bunch crossing + inline int bx() const { return m_bx; } - /// is it an empty eta track segment? - inline bool empty() const { return m_position == 0; } + /// is it an empty eta track segment? + inline bool empty() const { return m_position == 0; } - /// assignment operator - L1MuBMTrackSegEta& operator=(const L1MuBMTrackSegEta&); + /// assignment operator + L1MuBMTrackSegEta& operator=(const L1MuBMTrackSegEta&); - /// equal operator - bool operator==(const L1MuBMTrackSegEta&) const; + /// equal operator + bool operator==(const L1MuBMTrackSegEta&) const; - /// unequal operator - bool operator!=(const L1MuBMTrackSegEta&) const; + /// unequal operator + bool operator!=(const L1MuBMTrackSegEta&) const; - /// output stream operator - friend std::ostream& operator<<(std::ostream&, const L1MuBMTrackSegEta&); - -private: - L1MuBMTrackSegLoc m_location; // logical location of a TS - unsigned int m_position; // 7 bits - unsigned int m_quality; // 7 bits - int m_bx; // bunch crossing identifier -}; + /// output stream operator + friend std::ostream& operator<<(std::ostream&, const L1MuBMTrackSegEta&); + private: + L1MuBMTrackSegLoc m_location; // logical location of a TS + unsigned int m_position; // 7 bits + unsigned int m_quality; // 7 bits + int m_bx; // bunch crossing identifier + }; +} // namespace io_v1 #endif diff --git a/DataFormats/L1TMuon/interface/L1MuBMTrackSegEtaFwd.h b/DataFormats/L1TMuon/interface/L1MuBMTrackSegEtaFwd.h index 191fa7ed32045..4fa19a0d71f2f 100644 --- a/DataFormats/L1TMuon/interface/L1MuBMTrackSegEtaFwd.h +++ b/DataFormats/L1TMuon/interface/L1MuBMTrackSegEtaFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1TMuon_L1MuBMTrackSegEtaFwd_h #define DataFormats_L1TMuon_L1MuBMTrackSegEtaFwd_h -class L1MuBMTrackSegEta; - +namespace io_v1 { + class L1MuBMTrackSegEta; +} +using L1MuBMTrackSegEta = io_v1::L1MuBMTrackSegEta; #endif diff --git a/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h b/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h index e6e6f80d865c6..680dfd833582a 100644 --- a/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h +++ b/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhi.h @@ -34,118 +34,122 @@ // -- Class Interface -- // --------------------- -class L1MuBMTrackSegPhi; +namespace io_v1 { + class L1MuBMTrackSegPhi; +} +using L1MuBMTrackSegPhi = io_v1::L1MuBMTrackSegPhi; typedef std::vector L1MuBMTrackSegPhiCollection; -class L1MuBMTrackSegPhi { -public: - /// quality code of BBMX phi track segments - enum TSQuality { Li, Lo, Hi, Ho, LL, HL, HH, Null }; +namespace io_v1 { + class L1MuBMTrackSegPhi { + public: + /// quality code of BBMX phi track segments + enum TSQuality { Li, Lo, Hi, Ho, LL, HL, HH, Null }; - /// default constructor - L1MuBMTrackSegPhi(); + /// default constructor + L1MuBMTrackSegPhi(); - /// constructor - L1MuBMTrackSegPhi(int wheel_id, - int sector_id, - int station_id, - int phi = 0, - int phib = 0, - TSQuality quality = Null, - bool tag = false, - int bx = 17, - bool etaFlag = false); + /// constructor + L1MuBMTrackSegPhi(int wheel_id, + int sector_id, + int station_id, + int phi = 0, + int phib = 0, + TSQuality quality = Null, + bool tag = false, + int bx = 17, + bool etaFlag = false); - /// constructor - L1MuBMTrackSegPhi(const L1MuBMTrackSegLoc&, - int phi = 0, - int phib = 0, - TSQuality quality = Null, - bool tag = false, - int bx = 17, - bool etaFlag = false); + /// constructor + L1MuBMTrackSegPhi(const L1MuBMTrackSegLoc&, + int phi = 0, + int phib = 0, + TSQuality quality = Null, + bool tag = false, + int bx = 17, + bool etaFlag = false); - /// copy constructor - L1MuBMTrackSegPhi(const L1MuBMTrackSegPhi&) = default; + /// copy constructor + L1MuBMTrackSegPhi(const L1MuBMTrackSegPhi&) = default; - /// move constructor - L1MuBMTrackSegPhi(L1MuBMTrackSegPhi&&) = default; + /// move constructor + L1MuBMTrackSegPhi(L1MuBMTrackSegPhi&&) = default; - /// destructor - virtual ~L1MuBMTrackSegPhi(); + /// destructor + virtual ~L1MuBMTrackSegPhi(); - /// reset phi track segment - void reset(); + /// reset phi track segment + void reset(); - /// return phi-value in global coordinates [0,2pi] - double phiValue() const; + /// return phi-value in global coordinates [0,2pi] + double phiValue() const; - /// return phib-value in global coordinates [0,2pi] - double phibValue() const; + /// return phib-value in global coordinates [0,2pi] + double phibValue() const; - /// return wheel - inline int wheel() const { return m_location.wheel(); } + /// return wheel + inline int wheel() const { return m_location.wheel(); } - /// return sector - inline int sector() const { return m_location.sector(); } + /// return sector + inline int sector() const { return m_location.sector(); } - /// return station - inline int station() const { return m_location.station(); } + /// return station + inline int station() const { return m_location.station(); } - /// return location of phi track segment - inline const L1MuBMTrackSegLoc& where() const { return m_location; } + /// return location of phi track segment + inline const L1MuBMTrackSegLoc& where() const { return m_location; } - /// return phi - inline int phi() const { return m_phi; } + /// return phi + inline int phi() const { return m_phi; } - /// return phib - inline int phib() const { return m_phib; } + /// return phib + inline int phib() const { return m_phib; } - /// return quality code - inline int quality() const { return m_quality; } + /// return quality code + inline int quality() const { return m_quality; } - /// return tag (second TS tag) - inline int tag() const { return m_tag; } + /// return tag (second TS tag) + inline int tag() const { return m_tag; } - /// return bunch crossing - inline int bx() const { return m_bx; } + /// return bunch crossing + inline int bx() const { return m_bx; } - /// return eta flag - inline bool etaFlag() const { return m_etaFlag; } + /// return eta flag + inline bool etaFlag() const { return m_etaFlag; } - /// is it an empty phi track segment? - inline bool empty() const { return m_quality == Null; } + /// is it an empty phi track segment? + inline bool empty() const { return m_quality == Null; } - /// set eta flag - inline void setEtaFlag(bool flag) { m_etaFlag = flag; } + /// set eta flag + inline void setEtaFlag(bool flag) { m_etaFlag = flag; } - /// assignment operator - L1MuBMTrackSegPhi& operator=(const L1MuBMTrackSegPhi&) = default; + /// assignment operator + L1MuBMTrackSegPhi& operator=(const L1MuBMTrackSegPhi&) = default; - /// move assignment operator - L1MuBMTrackSegPhi& operator=(L1MuBMTrackSegPhi&&) = default; + /// move assignment operator + L1MuBMTrackSegPhi& operator=(L1MuBMTrackSegPhi&&) = default; - /// equal operator - bool operator==(const L1MuBMTrackSegPhi&) const; + /// equal operator + bool operator==(const L1MuBMTrackSegPhi&) const; - /// unequal operator - bool operator!=(const L1MuBMTrackSegPhi&) const; + /// unequal operator + bool operator!=(const L1MuBMTrackSegPhi&) const; - /// overload output stream operator for phi track segment quality - friend std::ostream& operator<<(std::ostream&, const TSQuality&); + /// overload output stream operator for phi track segment quality + friend std::ostream& operator<<(std::ostream&, const TSQuality&); - /// overload output stream operator for phi track segments - friend std::ostream& operator<<(std::ostream&, const L1MuBMTrackSegPhi&); - -private: - L1MuBMTrackSegLoc m_location; // logical location of TS - int m_phi; // 12 bits - int m_phib; // 10 bits - TSQuality m_quality; // 3 bits - bool m_tag; // tag for second TS (of chamber) - int m_bx; // bunch crossing identifier - bool m_etaFlag; // eta flag (for overlap region) -}; + /// overload output stream operator for phi track segments + friend std::ostream& operator<<(std::ostream&, const L1MuBMTrackSegPhi&); + private: + L1MuBMTrackSegLoc m_location; // logical location of TS + int m_phi; // 12 bits + int m_phib; // 10 bits + TSQuality m_quality; // 3 bits + bool m_tag; // tag for second TS (of chamber) + int m_bx; // bunch crossing identifier + bool m_etaFlag; // eta flag (for overlap region) + }; +} // namespace io_v1 #endif diff --git a/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhiFwd.h b/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhiFwd.h index d05114b571ef8..0ffe215488f6b 100644 --- a/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhiFwd.h +++ b/DataFormats/L1TMuon/interface/L1MuBMTrackSegPhiFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_L1TMuon_L1MuBMTrackSegPhiFwd_h #define DataFormats_L1TMuon_L1MuBMTrackSegPhiFwd_h -class L1MuBMTrackSegPhi; - +namespace io_v1 { + class L1MuBMTrackSegPhi; +} +using L1MuBMTrackSegPhi = io_v1::L1MuBMTrackSegPhi; #endif diff --git a/DataFormats/L1TMuon/interface/L1MuKBMTrack.h b/DataFormats/L1TMuon/interface/L1MuKBMTrack.h index a0b157a9cc461..fdbeaddc7e8ab 100644 --- a/DataFormats/L1TMuon/interface/L1MuKBMTrack.h +++ b/DataFormats/L1TMuon/interface/L1MuKBMTrack.h @@ -12,197 +12,201 @@ Sep. 2017 #include "DataFormats/L1TMuon/interface/L1MuKBMTCombinedStub.h" #include "DataFormats/L1Trigger/interface/BXVector.h" -class L1MuKBMTrack; +namespace io_v1 { + class L1MuKBMTrack; +} +using L1MuKBMTrack = io_v1::L1MuKBMTrack; typedef std::vector L1MuKBMTrackCollection; typedef BXVector L1MuKBMTrackBxCollection; -class L1MuKBMTrack : public reco::LeafCandidate { -public: - L1MuKBMTrack(); - ~L1MuKBMTrack() override; - L1MuKBMTrack(const L1MuKBMTCombinedStubRef&, int, int); - - //UnConstrained curvature at station 1 - int curvatureAtMuon() const; - //unconstrained phi at station 1 - int phiAtMuon() const; - //unconstrained phiB at station 1 - int phiBAtMuon() const; - //Constrained curvature at vertex - int curvatureAtVertex() const; - //constrained phi at the vertex - int phiAtVertex() const; - //Impact parameter as calculated from the muon track - int dxy() const; - //Unconstrained curvature at the Muon systen - int curvature() const; - //Unconstrained phi at the Muon systen - int positionAngle() const; - //Unconstrained bending angle at the Muon systen - int bendingAngle() const; - //Coarse eta caluclated only using phi segments - int coarseEta() const; - //Approximate Chi2 metric - int approxChi2() const; - int trackCompatibility() const; - - //Approximate Chi2 metric - int hitPattern() const; - //step; - int step() const; - //sector; - int sector() const; - //wheel - int wheel() const; - //quality - int quality() const; - - //unconstrained pt - float ptUnconstrained() const; - - //fine eta - int fineEta() const; - bool hasFineEta() const; - - //BX - int bx() const; - - //rank - int rank() const; - - //Associated stubs - const L1MuKBMTCombinedStubRefVector& stubs() const; - - //get Kalman gain - const std::vector& kalmanGain(unsigned int) const; - - //get covariance - const std::vector& covariance() const; - - //get residual - int residual(uint) const; - - //check ogverlap - bool overlapTrack(const L1MuKBMTrack&) const; - - bool operator==(const L1MuKBMTrack& t2) const { - if (this->stubs().size() != t2.stubs().size()) - return false; - for (unsigned int i = 0; i < this->stubs().size(); ++i) { - const L1MuKBMTCombinedStubRef& s1 = this->stubs()[i]; - const L1MuKBMTCombinedStubRef& s2 = t2.stubs()[i]; - if (s1->scNum() != s2->scNum() || s1->whNum() != s2->whNum() || s1->stNum() != s2->stNum() || - s1->tag() != s2->tag()) +namespace io_v1 { + class L1MuKBMTrack : public reco::LeafCandidate { + public: + L1MuKBMTrack(); + ~L1MuKBMTrack() override; + L1MuKBMTrack(const L1MuKBMTCombinedStubRef&, int, int); + + //UnConstrained curvature at station 1 + int curvatureAtMuon() const; + //unconstrained phi at station 1 + int phiAtMuon() const; + //unconstrained phiB at station 1 + int phiBAtMuon() const; + //Constrained curvature at vertex + int curvatureAtVertex() const; + //constrained phi at the vertex + int phiAtVertex() const; + //Impact parameter as calculated from the muon track + int dxy() const; + //Unconstrained curvature at the Muon systen + int curvature() const; + //Unconstrained phi at the Muon systen + int positionAngle() const; + //Unconstrained bending angle at the Muon systen + int bendingAngle() const; + //Coarse eta caluclated only using phi segments + int coarseEta() const; + //Approximate Chi2 metric + int approxChi2() const; + int trackCompatibility() const; + + //Approximate Chi2 metric + int hitPattern() const; + //step; + int step() const; + //sector; + int sector() const; + //wheel + int wheel() const; + //quality + int quality() const; + + //unconstrained pt + float ptUnconstrained() const; + + //fine eta + int fineEta() const; + bool hasFineEta() const; + + //BX + int bx() const; + + //rank + int rank() const; + + //Associated stubs + const L1MuKBMTCombinedStubRefVector& stubs() const; + + //get Kalman gain + const std::vector& kalmanGain(unsigned int) const; + + //get covariance + const std::vector& covariance() const; + + //get residual + int residual(uint) const; + + //check ogverlap + bool overlapTrack(const L1MuKBMTrack&) const; + + bool operator==(const L1MuKBMTrack& t2) const { + if (this->stubs().size() != t2.stubs().size()) return false; + for (unsigned int i = 0; i < this->stubs().size(); ++i) { + const L1MuKBMTCombinedStubRef& s1 = this->stubs()[i]; + const L1MuKBMTCombinedStubRef& s2 = t2.stubs()[i]; + if (s1->scNum() != s2->scNum() || s1->whNum() != s2->whNum() || s1->stNum() != s2->stNum() || + s1->tag() != s2->tag()) + return false; + } + return true; } - return true; - } - //Set coordinates general - void setCoordinates(int, int, int, int); + //Set coordinates general + void setCoordinates(int, int, int, int); - //Set coordinates at vertex - void setCoordinatesAtVertex(int, int, int); + //Set coordinates at vertex + void setCoordinatesAtVertex(int, int, int); - //Set coordinates at muon - void setCoordinatesAtMuon(int, int, int); + //Set coordinates at muon + void setCoordinatesAtMuon(int, int, int); - //Set eta coarse and pattern - void setCoarseEta(int); + //Set eta coarse and pattern + void setCoarseEta(int); - //Set phi hit pattern - void setHitPattern(int); + //Set phi hit pattern + void setHitPattern(int); - //Set chi2 like metric - void setApproxChi2(int); - void setTrackCompatibility(int); + //Set chi2 like metric + void setApproxChi2(int); + void setTrackCompatibility(int); - //Set floating point coordinates for studies - void setPtEtaPhi(double, double, double); - void setPtUnconstrained(float); + //Set floating point coordinates for studies + void setPtEtaPhi(double, double, double); + void setPtUnconstrained(float); - //Add a stub - void addStub(const L1MuKBMTCombinedStubRef&); + //Add a stub + void addStub(const L1MuKBMTCombinedStubRef&); - //kalman gain management - void setKalmanGain( - unsigned int step, unsigned int K, float a1, float a2, float a3, float a4 = 0, float a5 = 0, float a6 = 0); + //kalman gain management + void setKalmanGain( + unsigned int step, unsigned int K, float a1, float a2, float a3, float a4 = 0, float a5 = 0, float a6 = 0); - //set covariance - void setCovariance(const CovarianceMatrix&); + //set covariance + void setCovariance(const CovarianceMatrix&); - //set fine eta - void setFineEta(int); + //set fine eta + void setFineEta(int); - //set rank - void setRank(int); + //set rank + void setRank(int); - //set residual - void setResidual(uint, int); + //set residual + void setResidual(uint, int); -private: - //Covariance matrix for studies - std::vector covariance_; + private: + //Covariance matrix for studies + std::vector covariance_; - L1MuKBMTCombinedStubRefVector stubs_; + L1MuKBMTCombinedStubRefVector stubs_; - //vertex coordinates - int curvVertex_ = 0; - int phiVertex_ = 0; - int dxy_ = 0; + //vertex coordinates + int curvVertex_ = 0; + int phiVertex_ = 0; + int dxy_ = 0; - //muon coordinates - int curvMuon_ = 0; - int phiMuon_ = 0; - int phiBMuon_ = 0; + //muon coordinates + int curvMuon_ = 0; + int phiMuon_ = 0; + int phiBMuon_ = 0; - //generic coordinates - int curv_ = 0; - int phi_ = 0; - int phiB_ = 0; - //common coordinates - int coarseEta_ = 0; + //generic coordinates + int curv_ = 0; + int phi_ = 0; + int phiB_ = 0; + //common coordinates + int coarseEta_ = 0; - //Approximate Chi2 metric - int approxChi2_ = 0; - int trackCompatibility_ = 0; + //Approximate Chi2 metric + int approxChi2_ = 0; + int trackCompatibility_ = 0; - //phi bitmask - int hitPattern_ = 0; + //phi bitmask + int hitPattern_ = 0; - //propagation step - int step_ = 0; + //propagation step + int step_ = 0; - //sector - int sector_ = 0; - //wheel - int wheel_ = 0; + //sector + int sector_ = 0; + //wheel + int wheel_ = 0; - //quality - int quality_ = 0; + //quality + int quality_ = 0; - //Fine eta - int fineEta_ = 0; + //Fine eta + int fineEta_ = 0; - //has fine eta? - bool hasFineEta_ = false; + //has fine eta? + bool hasFineEta_ = false; - //BX - int bx_ = 0; + //BX + int bx_ = 0; - //rank - int rank_ = 0; + //rank + int rank_ = 0; - //Unconstrained floating point pt - float ptUnconstrained_ = 0; + //Unconstrained floating point pt + float ptUnconstrained_ = 0; - //Kalman Gain for making LUTs - std::vector kalmanGain0_; - std::vector kalmanGain1_; - std::vector kalmanGain2_; - std::vector kalmanGain3_; - - std::vector residuals_; -}; + //Kalman Gain for making LUTs + std::vector kalmanGain0_; + std::vector kalmanGain1_; + std::vector kalmanGain2_; + std::vector kalmanGain3_; + std::vector residuals_; + }; +} // namespace io_v1 #endif diff --git a/DataFormats/L1TMuon/interface/RegionalMuonCand.h b/DataFormats/L1TMuon/interface/RegionalMuonCand.h index 8aa26b1eee5b7..0446ea7feb9d8 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonCand.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonCand.h @@ -5,224 +5,225 @@ #include namespace l1t { - class RegionalMuonCand { - public: - /// Enum to identify the individual parts of the BMTF track address - /// Update kNumBmtfSubAddr if you add additional enums - enum bmtfAddress { - kWheelSide = 0, - kWheelNum = 1, - kStat1 = 2, - kStat2 = 3, - kStat3 = 4, - kStat4 = 5, - kSegSelStat1 = 6, - kSegSelStat2 = 7, - kSegSelStat3 = 8, - kSegSelStat4 = 9, - kNumBmtfSubAddr = 10 - }; - /// Enum to identify the individual parts of the OMTF track address - /// Update kNumOmtfSubAddr if you add additional enums - enum omtfAddress { kLayers = 0, kZero = 1, kWeight = 2, kNumOmtfSubAddr = 3 }; - /// Enum to identify the individual parts of the EMTF track address - /// Update kNumEmtfSubAddr if you add additional enums - enum emtfAddress { - kME1Seg = 0, - kME1Ch = 1, - kME2Seg = 2, - kME2Ch = 3, - kME3Seg = 4, - kME3Ch = 5, - kME4Seg = 6, - kME4Ch = 7, - kTrkNum = 8, - kBX = 9, - kNumEmtfSubAddr = 10 - }; + namespace io_v1 { + class RegionalMuonCand { + public: + /// Enum to identify the individual parts of the BMTF track address + /// Update kNumBmtfSubAddr if you add additional enums + enum bmtfAddress { + kWheelSide = 0, + kWheelNum = 1, + kStat1 = 2, + kStat2 = 3, + kStat3 = 4, + kStat4 = 5, + kSegSelStat1 = 6, + kSegSelStat2 = 7, + kSegSelStat3 = 8, + kSegSelStat4 = 9, + kNumBmtfSubAddr = 10 + }; + /// Enum to identify the individual parts of the OMTF track address + /// Update kNumOmtfSubAddr if you add additional enums + enum omtfAddress { kLayers = 0, kZero = 1, kWeight = 2, kNumOmtfSubAddr = 3 }; + /// Enum to identify the individual parts of the EMTF track address + /// Update kNumEmtfSubAddr if you add additional enums + enum emtfAddress { + kME1Seg = 0, + kME1Ch = 1, + kME2Seg = 2, + kME2Ch = 3, + kME3Seg = 4, + kME3Ch = 5, + kME4Seg = 6, + kME4Ch = 7, + kTrkNum = 8, + kBX = 9, + kNumEmtfSubAddr = 10 + }; - explicit RegionalMuonCand(uint64_t dataword); + explicit RegionalMuonCand(uint64_t dataword); - RegionalMuonCand() - : m_hwPt(0), - m_hwPtUnconstrained(0), - m_hwDXY(0), - m_hwPhi(0), - m_hwEta(0), - m_hwHF(false), - m_hwSign(0), - m_hwSignValid(0), - m_hwQuality(0), - m_dataword(0) { - setTFIdentifiers(0, bmtf); - }; + RegionalMuonCand() + : m_hwPt(0), + m_hwPtUnconstrained(0), + m_hwDXY(0), + m_hwPhi(0), + m_hwEta(0), + m_hwHF(false), + m_hwSign(0), + m_hwSignValid(0), + m_hwQuality(0), + m_dataword(0) { + setTFIdentifiers(0, bmtf); + }; - RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder) - : m_hwPt(pt), - m_hwPtUnconstrained(0), - m_hwDXY(0), - m_hwPhi(phi), - m_hwEta(eta), - m_hwHF(false), - m_hwSign(sign), - m_hwSignValid(signvalid), - m_hwQuality(quality), - m_dataword(0) { - setTFIdentifiers(processor, trackFinder); - // set default track addresses - if (trackFinder == tftype::bmtf) { - m_trackAddress = {{kWheelSide, 0}, - {kWheelNum, 0}, - {kStat1, 0}, - {kStat2, 0}, - {kStat3, 0}, - {kStat4, 0}, - {kSegSelStat1, 0}, - {kSegSelStat2, 0}, - {kSegSelStat3, 0}, - {kSegSelStat4, 0}}; - } else if (trackFinder == tftype::omtf_pos || trackFinder == tftype::omtf_neg) { - m_trackAddress = {{kLayers, 0}, {kZero, 0}, {kWeight, 0}}; - } else if (trackFinder == tftype::emtf_pos || trackFinder == tftype::emtf_neg) { - m_trackAddress = {{kME1Seg, 0}, - {kME1Ch, 0}, - {kME2Seg, 0}, - {kME2Ch, 0}, - {kME3Seg, 0}, - {kME3Ch, 0}, - {kME4Seg, 0}, - {kME4Ch, 0}, - {kTrkNum, 0}, - {kBX, 0}}; - } - }; + RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder) + : m_hwPt(pt), + m_hwPtUnconstrained(0), + m_hwDXY(0), + m_hwPhi(phi), + m_hwEta(eta), + m_hwHF(false), + m_hwSign(sign), + m_hwSignValid(signvalid), + m_hwQuality(quality), + m_dataword(0) { + setTFIdentifiers(processor, trackFinder); + // set default track addresses + if (trackFinder == tftype::bmtf) { + m_trackAddress = {{kWheelSide, 0}, + {kWheelNum, 0}, + {kStat1, 0}, + {kStat2, 0}, + {kStat3, 0}, + {kStat4, 0}, + {kSegSelStat1, 0}, + {kSegSelStat2, 0}, + {kSegSelStat3, 0}, + {kSegSelStat4, 0}}; + } else if (trackFinder == tftype::omtf_pos || trackFinder == tftype::omtf_neg) { + m_trackAddress = {{kLayers, 0}, {kZero, 0}, {kWeight, 0}}; + } else if (trackFinder == tftype::emtf_pos || trackFinder == tftype::emtf_neg) { + m_trackAddress = {{kME1Seg, 0}, + {kME1Ch, 0}, + {kME2Seg, 0}, + {kME2Ch, 0}, + {kME3Seg, 0}, + {kME3Ch, 0}, + {kME4Seg, 0}, + {kME4Ch, 0}, + {kTrkNum, 0}, + {kBX, 0}}; + } + }; - RegionalMuonCand(int pt, - int phi, - int eta, - int sign, - int signvalid, - int quality, - int processor, - tftype trackFinder, - std::map trackAddress) - : m_hwPt(pt), - m_hwPtUnconstrained(0), - m_hwDXY(0), - m_hwPhi(phi), - m_hwEta(eta), - m_hwHF(false), - m_hwSign(sign), - m_hwSignValid(signvalid), - m_hwQuality(quality), - m_trackAddress(trackAddress), - m_dataword(0) { - setTFIdentifiers(processor, trackFinder); - }; - - virtual ~RegionalMuonCand() {} + RegionalMuonCand(int pt, + int phi, + int eta, + int sign, + int signvalid, + int quality, + int processor, + tftype trackFinder, + std::map trackAddress) + : m_hwPt(pt), + m_hwPtUnconstrained(0), + m_hwDXY(0), + m_hwPhi(phi), + m_hwEta(eta), + m_hwHF(false), + m_hwSign(sign), + m_hwSignValid(signvalid), + m_hwQuality(quality), + m_trackAddress(trackAddress), + m_dataword(0) { + setTFIdentifiers(processor, trackFinder); + }; - /// Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits) - void setHwPt(int bits) { m_hwPt = bits; }; - /// Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits) - void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = bits; }; - /// Set compressed impact parameter with respect to beamspot (4 bits) - void setHwDXY(int bits) { m_hwDXY = bits; }; - /// Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits) - void setHwPhi(int bits) { m_hwPhi = bits; }; - /// Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits) - void setHwEta(int bits) { m_hwEta = bits; }; - /// Set charge sign bit (charge = (-1)^(sign)) - void setHwSign(int bits) { m_hwSign = bits; }; - /// Set whether charge measurement is valid (0 for high pT muons) - void setHwSignValid(int bits) { m_hwSignValid = bits; }; - /// Set compressed quality code as transmitted by hardware (4 bits) - void setHwQual(int bits) { m_hwQuality = bits; }; - /// Set HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) - void setHwHF(bool bit) { m_hwHF = bit; }; - /// Set the processor ID, track-finder type. From these two, the link is set - void setTFIdentifiers(int processor, tftype trackFinder); - // this is left to still be compatible with OMTF - void setLink(int link) { m_link = link; }; - // Set the muon index on the link (i.e., 0, 1, or 2) - void setMuIdx(int muIdx) { m_muIdx = muIdx; }; - // Set the 64 bit word from two 32 words. bits 0-31->lsbs, bits 32-63->msbs - void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; }; - // Set the 64 bit word coming from HW directly - void setDataword(uint64_t bits) { m_dataword = bits; }; - /// Set a part of the muon candidates track address; specialised for BMTF - void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } - /// Set a part of the muon candidates track address; specialised for OMTF - void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } - /// Set a part of the muon candidates track address; specialised for EMTF - void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } - /// Set the whole track address - void setTrackAddress(const std::map& address) { m_trackAddress = address; } + virtual ~RegionalMuonCand() {} - /// Get compressed pT (returned int * 0.5 = pT (GeV)) - const int hwPt() const { return m_hwPt; }; - /// Get second compressed pT (returned int * 1.0 = pT (GeV)) - const int hwPtUnconstrained() const { return m_hwPtUnconstrained; }; - /// Get compressed impact parameter (4 bits) - const int hwDXY() const { return m_hwDXY; }; - /// Get compressed local phi (returned int * 2*pi/576 = local phi in rad) - const int hwPhi() const { return m_hwPhi; }; - /// Get compressed eta (returned int * 0.010875 = eta) - const int hwEta() const { return m_hwEta; }; - /// Get charge sign bit (charge = (-1)^(sign)) - const int hwSign() const { return m_hwSign; }; - /// Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid) - const int hwSignValid() const { return m_hwSignValid; }; - /// Get quality code - const int hwQual() const { return m_hwQuality; }; - /// Get link on which the MicroGMT receives the candidate - const int link() const { return m_link; }; - /// Get muon index (i.e., 0, 1, or 2) - const int muIdx() const { return m_muIdx; }; - /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) - const int processor() const { return m_processor; }; - /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) - const tftype trackFinderType() const { return m_trackFinder; }; - /// Get HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) - const int hwHF() const { return m_hwHF; }; - /// Get 64 bit data word - const uint64_t dataword() const { return m_dataword; }; - /// Get 32 MSBs of data word - const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); }; - /// Get 32 LSBs of data word - const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); }; - /// Get the track address (identifies track primitives used for reconstruction) - const std::map& trackAddress() const { return m_trackAddress; } - /// Get part of track address (identifies track primitives used for reconstruction) - int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); } - /// Get part of track address (identifies track primitives used for reconstruction) - int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); } - /// Get part of track address (identifies track primitives used for reconstruction) - int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); } + /// Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits) + void setHwPt(int bits) { m_hwPt = bits; }; + /// Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits) + void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = bits; }; + /// Set compressed impact parameter with respect to beamspot (4 bits) + void setHwDXY(int bits) { m_hwDXY = bits; }; + /// Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits) + void setHwPhi(int bits) { m_hwPhi = bits; }; + /// Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits) + void setHwEta(int bits) { m_hwEta = bits; }; + /// Set charge sign bit (charge = (-1)^(sign)) + void setHwSign(int bits) { m_hwSign = bits; }; + /// Set whether charge measurement is valid (0 for high pT muons) + void setHwSignValid(int bits) { m_hwSignValid = bits; }; + /// Set compressed quality code as transmitted by hardware (4 bits) + void setHwQual(int bits) { m_hwQuality = bits; }; + /// Set HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) + void setHwHF(bool bit) { m_hwHF = bit; }; + /// Set the processor ID, track-finder type. From these two, the link is set + void setTFIdentifiers(int processor, tftype trackFinder); + // this is left to still be compatible with OMTF + void setLink(int link) { m_link = link; }; + // Set the muon index on the link (i.e., 0, 1, or 2) + void setMuIdx(int muIdx) { m_muIdx = muIdx; }; + // Set the 64 bit word from two 32 words. bits 0-31->lsbs, bits 32-63->msbs + void setDataword(uint32_t msbs, uint32_t lsbs) { m_dataword = (((uint64_t)msbs) << 32) + lsbs; }; + // Set the 64 bit word coming from HW directly + void setDataword(uint64_t bits) { m_dataword = bits; }; + /// Set a part of the muon candidates track address; specialised for BMTF + void setTrackSubAddress(bmtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } + /// Set a part of the muon candidates track address; specialised for OMTF + void setTrackSubAddress(omtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } + /// Set a part of the muon candidates track address; specialised for EMTF + void setTrackSubAddress(emtfAddress subAddress, int value) { m_trackAddress[subAddress] = value; } + /// Set the whole track address + void setTrackAddress(const std::map& address) { m_trackAddress = address; } - bool operator==(const RegionalMuonCand& rhs) const; - inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); }; + /// Get compressed pT (returned int * 0.5 = pT (GeV)) + const int hwPt() const { return m_hwPt; }; + /// Get second compressed pT (returned int * 1.0 = pT (GeV)) + const int hwPtUnconstrained() const { return m_hwPtUnconstrained; }; + /// Get compressed impact parameter (4 bits) + const int hwDXY() const { return m_hwDXY; }; + /// Get compressed local phi (returned int * 2*pi/576 = local phi in rad) + const int hwPhi() const { return m_hwPhi; }; + /// Get compressed eta (returned int * 0.010875 = eta) + const int hwEta() const { return m_hwEta; }; + /// Get charge sign bit (charge = (-1)^(sign)) + const int hwSign() const { return m_hwSign; }; + /// Get charge sign valid bit (0 - not valid (high pT muon); 1 - valid) + const int hwSignValid() const { return m_hwSignValid; }; + /// Get quality code + const int hwQual() const { return m_hwQuality; }; + /// Get link on which the MicroGMT receives the candidate + const int link() const { return m_link; }; + /// Get muon index (i.e., 0, 1, or 2) + const int muIdx() const { return m_muIdx; }; + /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) + const int processor() const { return m_processor; }; + /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) + const tftype trackFinderType() const { return m_trackFinder; }; + /// Get HF (halo / fine eta) bit (EMTF: halo -> 1; BMTF: fine eta -> 1) + const int hwHF() const { return m_hwHF; }; + /// Get 64 bit data word + const uint64_t dataword() const { return m_dataword; }; + /// Get 32 MSBs of data word + const uint32_t dataword32Msb() const { return (uint32_t)((m_dataword >> 32) & 0xFFFFFFFF); }; + /// Get 32 LSBs of data word + const uint32_t dataword32Lsb() const { return (uint32_t)(m_dataword & 0xFFFFFFFF); }; + /// Get the track address (identifies track primitives used for reconstruction) + const std::map& trackAddress() const { return m_trackAddress; } + /// Get part of track address (identifies track primitives used for reconstruction) + int trackSubAddress(bmtfAddress subAddress) const { return m_trackAddress.at(subAddress); } + /// Get part of track address (identifies track primitives used for reconstruction) + int trackSubAddress(omtfAddress subAddress) const { return m_trackAddress.at(subAddress); } + /// Get part of track address (identifies track primitives used for reconstruction) + int trackSubAddress(emtfAddress subAddress) const { return m_trackAddress.at(subAddress); } - private: - int m_hwPt; - int m_hwPtUnconstrained; - int m_hwDXY; - int m_hwPhi; - int m_hwEta; - bool m_hwHF; - int m_hwSign; - int m_hwSignValid; - int m_hwQuality; - int m_link; - int m_processor; - tftype m_trackFinder; - std::map m_trackAddress; + bool operator==(const RegionalMuonCand& rhs) const; + inline bool operator!=(const RegionalMuonCand& rhs) const { return !(operator==(rhs)); }; - /// This is the 64 bit word as transmitted in HW - uint64_t m_dataword; - int m_muIdx{-1}; - }; + private: + int m_hwPt; + int m_hwPtUnconstrained; + int m_hwDXY; + int m_hwPhi; + int m_hwEta; + bool m_hwHF; + int m_hwSign; + int m_hwSignValid; + int m_hwQuality; + int m_link; + int m_processor; + tftype m_trackFinder; + std::map m_trackAddress; + /// This is the 64 bit word as transmitted in HW + uint64_t m_dataword; + int m_muIdx{-1}; + }; + } // namespace io_v1 } // namespace l1t #endif /* define __l1t_regional_muon_candidate_h__ */ diff --git a/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h b/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h index a6198ee065625..6dcf6b3dab018 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h @@ -6,7 +6,10 @@ namespace l1t { enum tftype { bmtf, omtf_neg, omtf_pos, emtf_neg, emtf_pos }; - class RegionalMuonCand; + namespace io_v1 { + class RegionalMuonCand; + } + using RegionalMuonCand = io_v1::RegionalMuonCand; typedef BXVector RegionalMuonCandBxCollection; typedef ObjectRef RegionalMuonCandRef; diff --git a/DataFormats/L1TMuon/interface/RegionalMuonShower.h b/DataFormats/L1TMuon/interface/RegionalMuonShower.h index 9759c82c8eceb..d2bfe151941ab 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonShower.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonShower.h @@ -8,70 +8,69 @@ #include "RegionalMuonCandFwd.h" // For tftype. namespace l1t { + namespace io_v1 { + class RegionalMuonShower { + public: + RegionalMuonShower(bool oneNominalInTime = false, + bool oneNominalOutOfTime = false, + bool twoLooseInTime = false, + bool twoLooseOutOfTime = false, + bool oneLooseInTime = false, + bool oneTightInTime = false, + bool oneTightOutOfTime = false); - class RegionalMuonShower; - typedef BXVector RegionalMuonShowerBxCollection; - typedef ObjectRefBxCollection RegionalMuonShowerRefBxCollection; - typedef ObjectRefPair RegionalMuonShowerRefPair; - typedef ObjectRefPairBxCollection RegionalMuonShowerRefPairBxCollection; - - class RegionalMuonShower { - public: - RegionalMuonShower(bool oneNominalInTime = false, - bool oneNominalOutOfTime = false, - bool twoLooseInTime = false, - bool twoLooseOutOfTime = false, - bool oneLooseInTime = false, - bool oneTightInTime = false, - bool oneTightOutOfTime = false); - - ~RegionalMuonShower(); + ~RegionalMuonShower(); - void setOneNominalInTime(const bool bit) { isOneNominalInTime_ = bit; } - void setOneNominalOutOfTime(const bool bit) { isOneNominalOutOfTime_ = bit; } - void setOneTightInTime(const bool bit) { isOneTightInTime_ = bit; } - void setOneTightOutOfTime(const bool bit) { isOneTightOutOfTime_ = bit; } - void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; } - void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; } - void setOneLooseInTime(const bool bit) { isOneLooseInTime_ = bit; } + void setOneNominalInTime(const bool bit) { isOneNominalInTime_ = bit; } + void setOneNominalOutOfTime(const bool bit) { isOneNominalOutOfTime_ = bit; } + void setOneTightInTime(const bool bit) { isOneTightInTime_ = bit; } + void setOneTightOutOfTime(const bool bit) { isOneTightOutOfTime_ = bit; } + void setTwoLooseOutOfTime(const bool bit) { isTwoLooseOutOfTime_ = bit; } + void setTwoLooseInTime(const bool bit) { isTwoLooseInTime_ = bit; } + void setOneLooseInTime(const bool bit) { isOneLooseInTime_ = bit; } - /// Set the processor ID, track-finder type. From these two, the link is set - void setTFIdentifiers(int processor, tftype trackFinder); + /// Set the processor ID, track-finder type. From these two, the link is set + void setTFIdentifiers(int processor, tftype trackFinder); - bool isValid() const; - bool isOneNominalInTime() const { return isOneNominalInTime_; } - bool isOneNominalOutOfTime() const { return isOneNominalOutOfTime_; } - bool isOneTightInTime() const { return isOneTightInTime_; } - bool isOneTightOutOfTime() const { return isOneTightOutOfTime_; } - bool isTwoLooseInTime() const { return isTwoLooseInTime_; } - bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; } - bool isOneLooseInTime() const { return isOneLooseInTime_; } + bool isValid() const; + bool isOneNominalInTime() const { return isOneNominalInTime_; } + bool isOneNominalOutOfTime() const { return isOneNominalOutOfTime_; } + bool isOneTightInTime() const { return isOneTightInTime_; } + bool isOneTightOutOfTime() const { return isOneTightOutOfTime_; } + bool isTwoLooseInTime() const { return isTwoLooseInTime_; } + bool isTwoLooseOutOfTime() const { return isTwoLooseOutOfTime_; } + bool isOneLooseInTime() const { return isOneLooseInTime_; } - /// Get link on which the MicroGMT receives the candidate - const int link() const { return link_; }; - /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) - const int processor() const { return processor_; }; - /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) - const tftype trackFinderType() const { return trackFinder_; }; + /// Get link on which the MicroGMT receives the candidate + const int link() const { return link_; }; + /// Get processor ID on which the candidate was found (0..5 for OMTF/EMTF; 0..11 for BMTF) + const int processor() const { return processor_; }; + /// Get track-finder which found the muon (bmtf, emtf_pos/emtf_neg or omtf_pos/omtf_neg) + const tftype trackFinderType() const { return trackFinder_; }; - bool operator==(const l1t::RegionalMuonShower& rhs) const; - inline bool operator!=(const l1t::RegionalMuonShower& rhs) const { return !(operator==(rhs)); }; - - private: - // Run-3 definitions as provided in DN-20-033 - // in time and out-of-time qualities. only 2 bits each. - bool isOneNominalInTime_; - bool isOneNominalOutOfTime_; - bool isOneTightInTime_; - bool isOneTightOutOfTime_; - bool isTwoLooseInTime_; - bool isTwoLooseOutOfTime_; - bool isOneLooseInTime_; - int link_; - int processor_; - tftype trackFinder_; - }; + bool operator==(const l1t::io_v1::RegionalMuonShower& rhs) const; + inline bool operator!=(const l1t::io_v1::RegionalMuonShower& rhs) const { return !(operator==(rhs)); }; + private: + // Run-3 definitions as provided in DN-20-033 + // in time and out-of-time qualities. only 2 bits each. + bool isOneNominalInTime_; + bool isOneNominalOutOfTime_; + bool isOneTightInTime_; + bool isOneTightOutOfTime_; + bool isTwoLooseInTime_; + bool isTwoLooseOutOfTime_; + bool isOneLooseInTime_; + int link_; + int processor_; + tftype trackFinder_; + }; + } // namespace io_v1 + using RegionalMuonShower = io_v1::RegionalMuonShower; + typedef BXVector RegionalMuonShowerBxCollection; + typedef ObjectRefBxCollection RegionalMuonShowerRefBxCollection; + typedef ObjectRefPair RegionalMuonShowerRefPair; + typedef ObjectRefPairBxCollection RegionalMuonShowerRefPairBxCollection; } // namespace l1t #endif diff --git a/DataFormats/L1TMuon/src/L1MuBMTrack.cc b/DataFormats/L1TMuon/src/L1MuBMTrack.cc index af63c9a1b2f12..757050db313df 100644 --- a/DataFormats/L1TMuon/src/L1MuBMTrack.cc +++ b/DataFormats/L1TMuon/src/L1MuBMTrack.cc @@ -42,247 +42,249 @@ using namespace std; // class L1MuBMTrack //--------------------------------- -//---------------- -// Constructors -- -//---------------- -L1MuBMTrack::L1MuBMTrack() - : //L1MuRegionalCand(0,0),--> - l1t::RegionalMuonCand(), - m_spid(L1MuBMSecProcId()), - m_name("L1MuBMTrack"), - m_empty(true), - m_tc(UNDEF), - m_bx(0), - m_addArray(), - m_tsphiList(), - m_tsetaList() { - m_tsphiList.reserve(4); - m_tsetaList.reserve(3); +namespace io_v1 { + //---------------- + // Constructors -- + //---------------- + L1MuBMTrack::L1MuBMTrack() + : //L1MuRegionalCand(0,0),--> + l1t::RegionalMuonCand(), + m_spid(L1MuBMSecProcId()), + m_name("L1MuBMTrack"), + m_empty(true), + m_tc(UNDEF), + m_bx(0), + m_addArray(), + m_tsphiList(), + m_tsetaList() { + m_tsphiList.reserve(4); + m_tsetaList.reserve(3); - //setType(0); - //setChargeValid(true); - setHwSignValid(1); -} + //setType(0); + //setChargeValid(true); + setHwSignValid(1); + } -L1MuBMTrack::L1MuBMTrack(const L1MuBMSecProcId& spid) - : //L1MuRegionalCand(0,0),--> - l1t::RegionalMuonCand(), - m_spid(spid), - m_name("L1MuBMTrack"), - m_empty(true), - m_tc(UNDEF), - m_bx(0), - m_addArray(), - m_tsphiList(), - m_tsetaList() { - m_tsphiList.reserve(4); - m_tsetaList.reserve(3); - //setType(0); - //setChargeValid(true); - setHwSignValid(1); -} + L1MuBMTrack::L1MuBMTrack(const L1MuBMSecProcId& spid) + : //L1MuRegionalCand(0,0),--> + l1t::RegionalMuonCand(), + m_spid(spid), + m_name("L1MuBMTrack"), + m_empty(true), + m_tc(UNDEF), + m_bx(0), + m_addArray(), + m_tsphiList(), + m_tsetaList() { + m_tsphiList.reserve(4); + m_tsetaList.reserve(3); + //setType(0); + //setChargeValid(true); + setHwSignValid(1); + } -L1MuBMTrack::L1MuBMTrack(const L1MuBMTrack& id) - : //L1MuRegionalCand(id),--> - l1t::RegionalMuonCand(id), - m_spid(id.m_spid), - m_name(id.m_name), - m_empty(id.m_empty), - m_tc(id.m_tc), - m_bx(id.m_bx), - m_addArray(id.m_addArray), - m_tsphiList(id.m_tsphiList), - m_tsetaList(id.m_tsetaList) {} + L1MuBMTrack::L1MuBMTrack(const L1MuBMTrack& id) + : //L1MuRegionalCand(id),--> + l1t::RegionalMuonCand(id), + m_spid(id.m_spid), + m_name(id.m_name), + m_empty(id.m_empty), + m_tc(id.m_tc), + m_bx(id.m_bx), + m_addArray(id.m_addArray), + m_tsphiList(id.m_tsphiList), + m_tsetaList(id.m_tsetaList) {} -//-------------- -// Destructor -- -//-------------- -L1MuBMTrack::~L1MuBMTrack() {} + //-------------- + // Destructor -- + //-------------- + L1MuBMTrack::~L1MuBMTrack() {} -//-------------- -// Operations -- -//-------------- + //-------------- + // Operations -- + //-------------- -// -// reset Muon Track Candidate -// -void L1MuBMTrack::reset() { - //L1MuRegionalCand::reset(); - m_empty = true; - m_tc = UNDEF; - m_addArray.reset(); - m_tsphiList.clear(); - m_tsetaList.clear(); -} + // + // reset Muon Track Candidate + // + void L1MuBMTrack::reset() { + //L1MuRegionalCand::reset(); + m_empty = true; + m_tc = UNDEF; + m_addArray.reset(); + m_tsphiList.clear(); + m_tsetaList.clear(); + } -// -// set (packed) eta-code of muon candidate -// -void L1MuBMTrack::setEta(int eta) { - // eta is a signed integer [-115,118], - setHwHF(false); - setHwEta(eta); -} + // + // set (packed) eta-code of muon candidate + // + void L1MuBMTrack::setEta(int eta) { + // eta is a signed integer [-115,118], + setHwHF(false); + setHwEta(eta); + } -// -// return start phi track segment -// -const L1MuBMTrackSegPhi& L1MuBMTrack::getStartTSphi() const { return m_tsphiList.front(); } + // + // return start phi track segment + // + const L1MuBMTrackSegPhi& L1MuBMTrack::getStartTSphi() const { return m_tsphiList.front(); } -// -// return end phi track segment -// -const L1MuBMTrackSegPhi& L1MuBMTrack::getEndTSphi() const { return m_tsphiList.back(); } + // + // return end phi track segment + // + const L1MuBMTrackSegPhi& L1MuBMTrack::getEndTSphi() const { return m_tsphiList.back(); } -// -// return start eta track segment -// -const L1MuBMTrackSegEta& L1MuBMTrack::getStartTSeta() const { return m_tsetaList.front(); } + // + // return start eta track segment + // + const L1MuBMTrackSegEta& L1MuBMTrack::getStartTSeta() const { return m_tsetaList.front(); } -// -// return end eta track segment -// -const L1MuBMTrackSegEta& L1MuBMTrack::getEndTSeta() const { return m_tsetaList.back(); } + // + // return end eta track segment + // + const L1MuBMTrackSegEta& L1MuBMTrack::getEndTSeta() const { return m_tsetaList.back(); } -// -// set phi track segments used to form the muon candidate -// -void L1MuBMTrack::setTSphi(const vector& tsList) { - if (!tsList.empty()) { - vector::const_iterator iter; - for (iter = tsList.begin(); iter != tsList.end(); iter++) { - if (*iter) - m_tsphiList.push_back(**iter); + // + // set phi track segments used to form the muon candidate + // + void L1MuBMTrack::setTSphi(const vector& tsList) { + if (!tsList.empty()) { + vector::const_iterator iter; + for (iter = tsList.begin(); iter != tsList.end(); iter++) { + if (*iter) + m_tsphiList.push_back(**iter); + } } } -} -// -// set eta track segments used to form the muon candidate -// -void L1MuBMTrack::setTSeta(const vector& tsList) { - if (!tsList.empty()) { - vector::const_iterator iter; - for (iter = tsList.begin(); iter != tsList.end(); iter++) { - if (*iter) - m_tsetaList.push_back(**iter); + // + // set eta track segments used to form the muon candidate + // + void L1MuBMTrack::setTSeta(const vector& tsList) { + if (!tsList.empty()) { + vector::const_iterator iter; + for (iter = tsList.begin(); iter != tsList.end(); iter++) { + if (*iter) + m_tsetaList.push_back(**iter); + } } } -} -// -// Assignment operator -// -L1MuBMTrack& L1MuBMTrack::operator=(const L1MuBMTrack& track) { - if (this != &track) { - this->setBx(track.bx()); - //this->setDataWord(track.getDataWord()); - m_spid = track.m_spid; - m_empty = track.m_empty; - m_name = track.m_name; - m_tc = track.m_tc; - m_addArray = track.m_addArray; - m_tsphiList = track.m_tsphiList; - m_tsetaList = track.m_tsetaList; + // + // Assignment operator + // + L1MuBMTrack& L1MuBMTrack::operator=(const L1MuBMTrack& track) { + if (this != &track) { + this->setBx(track.bx()); + //this->setDataWord(track.getDataWord()); + m_spid = track.m_spid; + m_empty = track.m_empty; + m_name = track.m_name; + m_tc = track.m_tc; + m_addArray = track.m_addArray; + m_tsphiList = track.m_tsphiList; + m_tsetaList = track.m_tsetaList; + } + return *this; } - return *this; -} - -// -// Equal operator -// -bool L1MuBMTrack::operator==(const L1MuBMTrack& track) const { - if (m_spid != track.m_spid) - return false; - if (m_empty != track.m_empty) - return false; - if (m_tc != track.m_tc) - return false; - if (bx() != track.bx()) - return false; - if (phi() != track.phi()) - return false; - if (eta() != track.eta()) - return false; - if (fineEtaBit() != track.fineEtaBit()) - return false; - if (pt() != track.pt()) - return false; - if (charge() != track.charge()) - return false; - if (quality() != track.quality()) - return false; - if (m_addArray != track.m_addArray) - return false; - return true; -} -// -// Unequal operator -// -bool L1MuBMTrack::operator!=(const L1MuBMTrack& track) const { - if (m_spid != track.m_spid) - return true; - if (m_empty != track.m_empty) - return true; - if (m_tc != track.m_tc) - return true; - if (bx() != track.bx()) - return true; - if (phi() != track.phi()) - return true; - if (eta() != track.eta()) + // + // Equal operator + // + bool L1MuBMTrack::operator==(const L1MuBMTrack& track) const { + if (m_spid != track.m_spid) + return false; + if (m_empty != track.m_empty) + return false; + if (m_tc != track.m_tc) + return false; + if (bx() != track.bx()) + return false; + if (phi() != track.phi()) + return false; + if (eta() != track.eta()) + return false; + if (fineEtaBit() != track.fineEtaBit()) + return false; + if (pt() != track.pt()) + return false; + if (charge() != track.charge()) + return false; + if (quality() != track.quality()) + return false; + if (m_addArray != track.m_addArray) + return false; return true; - if (fineEtaBit() != track.fineEtaBit()) - return true; - if (pt() != track.pt()) - return true; - if (charge() != track.charge()) - return true; - if (quality() != track.quality()) - return true; - if (m_addArray != track.m_addArray) - return true; - return false; -} + } -// -// print parameters of track candidate -// -void L1MuBMTrack::print() const { - if (!empty()) { - cout.setf(ios::showpoint); - cout.setf(ios::right, ios::adjustfield); - cout << setiosflags(ios::showpoint | ios::fixed); - cout << "MUON : " - << "pt = " << setw(3) << hwPt() << " " - << "charge = " << setw(2) << hwSign() << " " - << "eta = " << setw(2) - << hwEta() - //<< " (" << setw(1) << finehalo_packed() << ") " - << "phi = " << setw(3) << hwPhi() << " " - << "quality = " << setw(1) << hwQual() << '\t' << "class = " << tc() << " " - << "bx = " << setw(2) << bx() << endl; - cout << " found in " << m_spid << " with phi track segments :" << endl; - vector::const_iterator iter; - for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) { - cout << " " << (*iter) << endl; + // + // Unequal operator + // + bool L1MuBMTrack::operator!=(const L1MuBMTrack& track) const { + if (m_spid != track.m_spid) + return true; + if (m_empty != track.m_empty) + return true; + if (m_tc != track.m_tc) + return true; + if (bx() != track.bx()) + return true; + if (phi() != track.phi()) + return true; + if (eta() != track.eta()) + return true; + if (fineEtaBit() != track.fineEtaBit()) + return true; + if (pt() != track.pt()) + return true; + if (charge() != track.charge()) + return true; + if (quality() != track.quality()) + return true; + if (m_addArray != track.m_addArray) + return true; + return false; + } + + // + // print parameters of track candidate + // + void L1MuBMTrack::print() const { + if (!empty()) { + cout.setf(ios::showpoint); + cout.setf(ios::right, ios::adjustfield); + cout << setiosflags(ios::showpoint | ios::fixed); + cout << "MUON : " + << "pt = " << setw(3) << hwPt() << " " + << "charge = " << setw(2) << hwSign() << " " + << "eta = " << setw(2) + << hwEta() + //<< " (" << setw(1) << finehalo_packed() << ") " + << "phi = " << setw(3) << hwPhi() << " " + << "quality = " << setw(1) << hwQual() << '\t' << "class = " << tc() << " " + << "bx = " << setw(2) << bx() << endl; + cout << " found in " << m_spid << " with phi track segments :" << endl; + vector::const_iterator iter; + for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) { + cout << " " << (*iter) << endl; + } } } -} -// -// output stream operator for track candidate -// -ostream& operator<<(ostream& s, const L1MuBMTrack& id) { - if (!id.empty()) { - s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(3) << id.hwPt() << " " - << "charge = " << setw(2) << id.hwSign() << " " - << "eta = " << setw(2) - << id.hwEta() - //<< " (" << setw(1) << id.finehalo_packed() << ") " - << "phi = " << setw(3) << id.hwPhi() << " " - << "quality = " << setw(1) << id.hwQual() << '\t' << "bx = " << setw(2) << id.bx(); + // + // output stream operator for track candidate + // + ostream& operator<<(ostream& s, const L1MuBMTrack& id) { + if (!id.empty()) { + s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(3) << id.hwPt() << " " + << "charge = " << setw(2) << id.hwSign() << " " + << "eta = " << setw(2) + << id.hwEta() + //<< " (" << setw(1) << id.finehalo_packed() << ") " + << "phi = " << setw(3) << id.hwPhi() << " " + << "quality = " << setw(1) << id.hwQual() << '\t' << "bx = " << setw(2) << id.bx(); + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/L1TMuon/src/L1MuBMTrackSegEta.cc b/DataFormats/L1TMuon/src/L1MuBMTrackSegEta.cc index 1b35fb9a568ea..299cb03c10493 100644 --- a/DataFormats/L1TMuon/src/L1MuBMTrackSegEta.cc +++ b/DataFormats/L1TMuon/src/L1MuBMTrackSegEta.cc @@ -37,91 +37,92 @@ using namespace std; // -------------------------------- // class L1MuBMTrackSegEta //--------------------------------- +namespace io_v1 { + //---------------- + // Constructors -- + //---------------- + + L1MuBMTrackSegEta::L1MuBMTrackSegEta() : m_location(), m_position(0), m_quality(0), m_bx(0) {} + + L1MuBMTrackSegEta::L1MuBMTrackSegEta(int wheel_id, int sector_id, int station_id, int pos, int quality, int bx) + : m_location(wheel_id, sector_id, station_id), m_position(pos), m_quality(quality), m_bx(bx) {} + + L1MuBMTrackSegEta::L1MuBMTrackSegEta(const L1MuBMTrackSegLoc& id, int pos, int quality, int bx) + : m_location(id), m_position(pos), m_quality(quality), m_bx(bx) {} + + L1MuBMTrackSegEta::L1MuBMTrackSegEta(const L1MuBMTrackSegEta& id) + : m_location(id.m_location), m_position(id.m_position), m_quality(id.m_quality), m_bx(id.m_bx) {} + + //-------------- + // Destructor -- + //-------------- + L1MuBMTrackSegEta::~L1MuBMTrackSegEta() {} + + //-------------- + // Operations -- + //-------------- + + // + // reset ETA Track Segment + // + void L1MuBMTrackSegEta::reset() { + m_position = 0; + m_quality = 0; + m_bx = 0; + } -//---------------- -// Constructors -- -//---------------- - -L1MuBMTrackSegEta::L1MuBMTrackSegEta() : m_location(), m_position(0), m_quality(0), m_bx(0) {} - -L1MuBMTrackSegEta::L1MuBMTrackSegEta(int wheel_id, int sector_id, int station_id, int pos, int quality, int bx) - : m_location(wheel_id, sector_id, station_id), m_position(pos), m_quality(quality), m_bx(bx) {} - -L1MuBMTrackSegEta::L1MuBMTrackSegEta(const L1MuBMTrackSegLoc& id, int pos, int quality, int bx) - : m_location(id), m_position(pos), m_quality(quality), m_bx(bx) {} - -L1MuBMTrackSegEta::L1MuBMTrackSegEta(const L1MuBMTrackSegEta& id) - : m_location(id.m_location), m_position(id.m_position), m_quality(id.m_quality), m_bx(id.m_bx) {} - -//-------------- -// Destructor -- -//-------------- -L1MuBMTrackSegEta::~L1MuBMTrackSegEta() {} - -//-------------- -// Operations -- -//-------------- - -// -// reset ETA Track Segment -// -void L1MuBMTrackSegEta::reset() { - m_position = 0; - m_quality = 0; - m_bx = 0; -} + // + // Assignment operator + // + L1MuBMTrackSegEta& L1MuBMTrackSegEta::operator=(const L1MuBMTrackSegEta& id) { + if (this != &id) { + m_location = id.m_location; + m_position = id.m_position; + m_quality = id.m_quality; + m_bx = id.m_bx; + } + return *this; + } -// -// Assignment operator -// -L1MuBMTrackSegEta& L1MuBMTrackSegEta::operator=(const L1MuBMTrackSegEta& id) { - if (this != &id) { - m_location = id.m_location; - m_position = id.m_position; - m_quality = id.m_quality; - m_bx = id.m_bx; + // + // Equal operator + // + bool L1MuBMTrackSegEta::operator==(const L1MuBMTrackSegEta& id) const { + if (m_location != id.m_location) + return false; + if (m_position != id.m_position) + return false; + if (m_quality != id.m_quality) + return false; + if (m_bx != id.m_bx) + return false; + return true; } - return *this; -} -// -// Equal operator -// -bool L1MuBMTrackSegEta::operator==(const L1MuBMTrackSegEta& id) const { - if (m_location != id.m_location) - return false; - if (m_position != id.m_position) - return false; - if (m_quality != id.m_quality) - return false; - if (m_bx != id.m_bx) + // + // Unequal operator + // + bool L1MuBMTrackSegEta::operator!=(const L1MuBMTrackSegEta& id) const { + if (m_location != id.m_location) + return true; + if (m_position != id.m_position) + return true; + if (m_quality != id.m_quality) + return true; + if (m_bx != id.m_bx) + return true; return false; - return true; -} + } -// -// Unequal operator -// -bool L1MuBMTrackSegEta::operator!=(const L1MuBMTrackSegEta& id) const { - if (m_location != id.m_location) - return true; - if (m_position != id.m_position) - return true; - if (m_quality != id.m_quality) - return true; - if (m_bx != id.m_bx) - return true; - return false; -} + // + // output stream operator + // + ostream& operator<<(ostream& s, const L1MuBMTrackSegEta& id) { + s.setf(ios::right, ios::adjustfield); + s << (id.m_location) << "\t" + << "position : " << bitset<7>(id.position()) << " " + << "quality : " << bitset<7>(id.quality()); -// -// output stream operator -// -ostream& operator<<(ostream& s, const L1MuBMTrackSegEta& id) { - s.setf(ios::right, ios::adjustfield); - s << (id.m_location) << "\t" - << "position : " << bitset<7>(id.position()) << " " - << "quality : " << bitset<7>(id.quality()); - - return s; -} + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1TMuon/src/L1MuBMTrackSegPhi.cc b/DataFormats/L1TMuon/src/L1MuBMTrackSegPhi.cc index 1dcd85ba9ef93..a1966887b5827 100644 --- a/DataFormats/L1TMuon/src/L1MuBMTrackSegPhi.cc +++ b/DataFormats/L1TMuon/src/L1MuBMTrackSegPhi.cc @@ -41,19 +41,20 @@ using namespace std; // Constructors -- //---------------- -L1MuBMTrackSegPhi::L1MuBMTrackSegPhi() - : m_location(), m_phi(0), m_phib(0), m_quality(Null), m_tag(false), m_bx(0), m_etaFlag(false) {} - -L1MuBMTrackSegPhi::L1MuBMTrackSegPhi( - int wheel_id, int sector_id, int station_id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag) - : m_location(wheel_id, sector_id, station_id), - m_phi(phi), - m_phib(phib), - m_quality(quality), - m_tag(tag), - m_bx(bx), - m_etaFlag(etaFlag) { - /* +namespace io_v1 { + L1MuBMTrackSegPhi::L1MuBMTrackSegPhi() + : m_location(), m_phi(0), m_phib(0), m_quality(Null), m_tag(false), m_bx(0), m_etaFlag(false) {} + + L1MuBMTrackSegPhi::L1MuBMTrackSegPhi( + int wheel_id, int sector_id, int station_id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag) + : m_location(wheel_id, sector_id, station_id), + m_phi(phi), + m_phib(phib), + m_quality(quality), + m_tag(tag), + m_bx(bx), + m_etaFlag(etaFlag) { + /* if ( phi < -2048 || phi > 2047 ) { cerr << "TrackSegPhi : phi out of range: " << phi << endl; } @@ -63,12 +64,12 @@ L1MuBMTrackSegPhi::L1MuBMTrackSegPhi( if ( quality > 7 ) { cerr << "TrackSegPhi : quality out of range: " << quality << endl; }*/ -} + } -L1MuBMTrackSegPhi::L1MuBMTrackSegPhi( - const L1MuBMTrackSegLoc& id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag) - : m_location(id), m_phi(phi), m_phib(phib), m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) { - /* + L1MuBMTrackSegPhi::L1MuBMTrackSegPhi( + const L1MuBMTrackSegLoc& id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag) + : m_location(id), m_phi(phi), m_phib(phib), m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) { + /* if ( phi < -2048 || phi > 2047 ) { cerr << "TrackSegPhi : phi out of range: " << phi << endl; } @@ -79,112 +80,113 @@ L1MuBMTrackSegPhi::L1MuBMTrackSegPhi( cerr << "TrackSegPhi : quality out of range: " << quality << endl; } */ -} - -//-------------- -// Destructor -- -//-------------- -L1MuBMTrackSegPhi::~L1MuBMTrackSegPhi() {} - -//-------------- -// Operations -- -//-------------- + } -// -// reset PHI Track Segment -// -void L1MuBMTrackSegPhi::reset() { - m_phi = 0; - m_phib = 0; - m_quality = Null; - m_tag = false; - m_bx = 0; - m_etaFlag = false; -} + //-------------- + // Destructor -- + //-------------- + L1MuBMTrackSegPhi::~L1MuBMTrackSegPhi() {} + + //-------------- + // Operations -- + //-------------- + + // + // reset PHI Track Segment + // + void L1MuBMTrackSegPhi::reset() { + m_phi = 0; + m_phib = 0; + m_quality = Null; + m_tag = false; + m_bx = 0; + m_etaFlag = false; + } -// -// return phi in global coordinates [0,2pi] -// -double L1MuBMTrackSegPhi::phiValue() const { - double tmp = static_cast(m_location.sector()) * M_PI / 6; - tmp += static_cast(m_phi) / 4096; - return (tmp > 0) ? tmp : (2 * M_PI + tmp); -} + // + // return phi in global coordinates [0,2pi] + // + double L1MuBMTrackSegPhi::phiValue() const { + double tmp = static_cast(m_location.sector()) * M_PI / 6; + tmp += static_cast(m_phi) / 4096; + return (tmp > 0) ? tmp : (2 * M_PI + tmp); + } -// -// return phib in radians -// -double L1MuBMTrackSegPhi::phibValue() const { return static_cast(m_phib) / 512; } + // + // return phib in radians + // + double L1MuBMTrackSegPhi::phibValue() const { return static_cast(m_phib) / 512; } + + // + // Equal operator + // + bool L1MuBMTrackSegPhi::operator==(const L1MuBMTrackSegPhi& id) const { + if (m_location != id.m_location) + return false; + if (m_phi != id.m_phi) + return false; + if (m_phib != id.m_phib) + return false; + if (m_quality != id.m_quality) + return false; + if (m_bx != id.m_bx) + return false; + return true; + } -// -// Equal operator -// -bool L1MuBMTrackSegPhi::operator==(const L1MuBMTrackSegPhi& id) const { - if (m_location != id.m_location) - return false; - if (m_phi != id.m_phi) + // + // Unequal operator + // + bool L1MuBMTrackSegPhi::operator!=(const L1MuBMTrackSegPhi& id) const { + if (m_location != id.m_location) + return true; + if (m_phi != id.m_phi) + return true; + if (m_phib != id.m_phib) + return true; + if (m_quality != id.m_quality) + return true; + if (m_bx != id.m_bx) + return true; return false; - if (m_phib != id.m_phib) - return false; - if (m_quality != id.m_quality) - return false; - if (m_bx != id.m_bx) - return false; - return true; -} - -// -// Unequal operator -// -bool L1MuBMTrackSegPhi::operator!=(const L1MuBMTrackSegPhi& id) const { - if (m_location != id.m_location) - return true; - if (m_phi != id.m_phi) - return true; - if (m_phib != id.m_phib) - return true; - if (m_quality != id.m_quality) - return true; - if (m_bx != id.m_bx) - return true; - return false; -} + } -// -// output stream operator phi track segment quality -// -ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi::TSQuality& quality) { - switch (quality) { - case L1MuBMTrackSegPhi::Li: - return s << "Li "; - case L1MuBMTrackSegPhi::Lo: - return s << "Lo "; - case L1MuBMTrackSegPhi::Hi: - return s << "Hi "; - case L1MuBMTrackSegPhi::Ho: - return s << "Ho "; - case L1MuBMTrackSegPhi::LL: - return s << "LL "; - case L1MuBMTrackSegPhi::HL: - return s << "HL "; - case L1MuBMTrackSegPhi::HH: - return s << "HH "; - case L1MuBMTrackSegPhi::Null: - return s << "Null "; - default: - return s << "unknown TS phi Quality "; + // + // output stream operator phi track segment quality + // + ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi::TSQuality& quality) { + switch (quality) { + case L1MuBMTrackSegPhi::Li: + return s << "Li "; + case L1MuBMTrackSegPhi::Lo: + return s << "Lo "; + case L1MuBMTrackSegPhi::Hi: + return s << "Hi "; + case L1MuBMTrackSegPhi::Ho: + return s << "Ho "; + case L1MuBMTrackSegPhi::LL: + return s << "LL "; + case L1MuBMTrackSegPhi::HL: + return s << "HL "; + case L1MuBMTrackSegPhi::HH: + return s << "HH "; + case L1MuBMTrackSegPhi::Null: + return s << "Null "; + default: + return s << "unknown TS phi Quality "; + } } -} -// -// output stream operator for phi track segments -// -ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi& id) { - s.setf(ios::right, ios::adjustfield); - s << (id.m_location) << "\t" - << "phi : " << setw(5) << id.m_phi << " " - << "phib : " << setw(4) << id.m_phib << " " - << "quality : " << setw(4) << id.m_quality; - - return s; -} + // + // output stream operator for phi track segments + // + ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi& id) { + s.setf(ios::right, ios::adjustfield); + s << (id.m_location) << "\t" + << "phi : " << setw(5) << id.m_phi << " " + << "phib : " << setw(4) << id.m_phib << " " + << "quality : " << setw(4) << id.m_quality; + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/L1TMuon/src/L1MuKBMTrack.cc b/DataFormats/L1TMuon/src/L1MuKBMTrack.cc index 035c5191c7fcd..5c668243b9eed 100644 --- a/DataFormats/L1TMuon/src/L1MuKBMTrack.cc +++ b/DataFormats/L1TMuon/src/L1MuKBMTrack.cc @@ -1,190 +1,193 @@ #include "DataFormats/L1TMuon/interface/L1MuKBMTrack.h" -L1MuKBMTrack::L1MuKBMTrack() : reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)) {} +namespace io_v1 { + L1MuKBMTrack::L1MuKBMTrack() + : reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)) {} + + L1MuKBMTrack::~L1MuKBMTrack() {} + + L1MuKBMTrack::L1MuKBMTrack(const L1MuKBMTCombinedStubRef& seed, int phi, int phiB) + : reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)), + covariance_(6, 0.0), + phi_(phi), + phiB_(phiB), + step_(seed->stNum()), + sector_(seed->scNum()), + wheel_(seed->whNum()), + quality_(seed->quality()), + bx_(seed->bxNum()), + rank_(seed->bxNum()) { + stubs_.push_back(seed); + residuals_.push_back(0); + residuals_.push_back(0); + residuals_.push_back(0); + } + + int L1MuKBMTrack::curvatureAtMuon() const { return curvMuon_; } + int L1MuKBMTrack::phiAtMuon() const { return phiMuon_; } + int L1MuKBMTrack::phiBAtMuon() const { return phiBMuon_; } + + int L1MuKBMTrack::curvatureAtVertex() const { return curvVertex_; } + + int L1MuKBMTrack::phiAtVertex() const { return phiVertex_; } + + int L1MuKBMTrack::dxy() const { return dxy_; } + + int L1MuKBMTrack::curvature() const { return curv_; } + + int L1MuKBMTrack::positionAngle() const { return phi_; } + + int L1MuKBMTrack::bendingAngle() const { return phiB_; } + + int L1MuKBMTrack::coarseEta() const { return coarseEta_; } + + int L1MuKBMTrack::approxChi2() const { return approxChi2_; } + int L1MuKBMTrack::trackCompatibility() const { return trackCompatibility_; } + + int L1MuKBMTrack::hitPattern() const { return hitPattern_; } + + int L1MuKBMTrack::step() const { return step_; } + int L1MuKBMTrack::sector() const { return sector_; } + int L1MuKBMTrack::wheel() const { return wheel_; } + + int L1MuKBMTrack::quality() const { return quality_; } + + float L1MuKBMTrack::ptUnconstrained() const { return ptUnconstrained_; } + + int L1MuKBMTrack::fineEta() const { return fineEta_; } + + bool L1MuKBMTrack::hasFineEta() const { return hasFineEta_; } + + int L1MuKBMTrack::bx() const { return bx_; } -L1MuKBMTrack::~L1MuKBMTrack() {} + int L1MuKBMTrack::rank() const { return rank_; } -L1MuKBMTrack::L1MuKBMTrack(const L1MuKBMTCombinedStubRef& seed, int phi, int phiB) - : reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)), - covariance_(6, 0.0), - phi_(phi), - phiB_(phiB), - step_(seed->stNum()), - sector_(seed->scNum()), - wheel_(seed->whNum()), - quality_(seed->quality()), - bx_(seed->bxNum()), - rank_(seed->bxNum()) { - stubs_.push_back(seed); - residuals_.push_back(0); - residuals_.push_back(0); - residuals_.push_back(0); -} + const L1MuKBMTCombinedStubRefVector& L1MuKBMTrack::stubs() const { return stubs_; } -int L1MuKBMTrack::curvatureAtMuon() const { return curvMuon_; } -int L1MuKBMTrack::phiAtMuon() const { return phiMuon_; } -int L1MuKBMTrack::phiBAtMuon() const { return phiBMuon_; } + int L1MuKBMTrack::residual(uint i) const { return residuals_[i]; } -int L1MuKBMTrack::curvatureAtVertex() const { return curvVertex_; } + void L1MuKBMTrack::setCoordinates(int step, int curv, int phi, int phiB) { + step_ = step; + curv_ = curv; + phiB_ = phiB; + phi_ = phi; + } + + void L1MuKBMTrack::setCoordinatesAtVertex(int curv, int phi, int dxy) { + curvVertex_ = curv; + phiVertex_ = phi; + dxy_ = dxy; + } + + void L1MuKBMTrack::setCoordinatesAtMuon(int curv, int phi, int phiB) { + curvMuon_ = curv; + phiMuon_ = phi; + phiBMuon_ = phiB; + } -int L1MuKBMTrack::phiAtVertex() const { return phiVertex_; } + void L1MuKBMTrack::setCoarseEta(int eta) { coarseEta_ = eta; } -int L1MuKBMTrack::dxy() const { return dxy_; } + void L1MuKBMTrack::setHitPattern(int pattern) { hitPattern_ = pattern; } -int L1MuKBMTrack::curvature() const { return curv_; } - -int L1MuKBMTrack::positionAngle() const { return phi_; } - -int L1MuKBMTrack::bendingAngle() const { return phiB_; } - -int L1MuKBMTrack::coarseEta() const { return coarseEta_; } - -int L1MuKBMTrack::approxChi2() const { return approxChi2_; } -int L1MuKBMTrack::trackCompatibility() const { return trackCompatibility_; } - -int L1MuKBMTrack::hitPattern() const { return hitPattern_; } - -int L1MuKBMTrack::step() const { return step_; } -int L1MuKBMTrack::sector() const { return sector_; } -int L1MuKBMTrack::wheel() const { return wheel_; } - -int L1MuKBMTrack::quality() const { return quality_; } - -float L1MuKBMTrack::ptUnconstrained() const { return ptUnconstrained_; } - -int L1MuKBMTrack::fineEta() const { return fineEta_; } - -bool L1MuKBMTrack::hasFineEta() const { return hasFineEta_; } - -int L1MuKBMTrack::bx() const { return bx_; } - -int L1MuKBMTrack::rank() const { return rank_; } - -const L1MuKBMTCombinedStubRefVector& L1MuKBMTrack::stubs() const { return stubs_; } - -int L1MuKBMTrack::residual(uint i) const { return residuals_[i]; } - -void L1MuKBMTrack::setCoordinates(int step, int curv, int phi, int phiB) { - step_ = step; - curv_ = curv; - phiB_ = phiB; - phi_ = phi; -} - -void L1MuKBMTrack::setCoordinatesAtVertex(int curv, int phi, int dxy) { - curvVertex_ = curv; - phiVertex_ = phi; - dxy_ = dxy; -} - -void L1MuKBMTrack::setCoordinatesAtMuon(int curv, int phi, int phiB) { - curvMuon_ = curv; - phiMuon_ = phi; - phiBMuon_ = phiB; -} - -void L1MuKBMTrack::setCoarseEta(int eta) { coarseEta_ = eta; } - -void L1MuKBMTrack::setHitPattern(int pattern) { hitPattern_ = pattern; } - -void L1MuKBMTrack::setApproxChi2(int chi) { approxChi2_ = chi; } -void L1MuKBMTrack::setTrackCompatibility(int chi) { trackCompatibility_ = chi; } - -void L1MuKBMTrack::setPtEtaPhi(double pt, double eta, double phi) { - PolarLorentzVector v(pt, eta, phi, 0.105); - setP4(v); -} -void L1MuKBMTrack::setPtUnconstrained(float pt) { ptUnconstrained_ = pt; } - -void L1MuKBMTrack::addStub(const L1MuKBMTCombinedStubRef& stub) { - if (stub->quality() < quality_) - quality_ = stub->quality(); - stubs_.push_back(stub); -} - -void L1MuKBMTrack::setFineEta(int eta) { - fineEta_ = eta; - hasFineEta_ = true; -} - -void L1MuKBMTrack::setRank(int rank) { rank_ = rank; } - -void L1MuKBMTrack::setKalmanGain( - unsigned int step, unsigned int K, float a1, float a2, float a3, float a4, float a5, float a6) { - switch (step) { - case 3: - kalmanGain3_.push_back(K); - kalmanGain3_.push_back(a1); - kalmanGain3_.push_back(a2); - kalmanGain3_.push_back(a3); - kalmanGain3_.push_back(a4); - kalmanGain3_.push_back(a5); - kalmanGain3_.push_back(a6); - break; - case 2: - kalmanGain2_.push_back(K); - kalmanGain2_.push_back(a1); - kalmanGain2_.push_back(a2); - kalmanGain2_.push_back(a3); - kalmanGain2_.push_back(a4); - kalmanGain2_.push_back(a5); - kalmanGain2_.push_back(a6); - break; - case 1: - kalmanGain1_.push_back(K); - kalmanGain1_.push_back(a1); - kalmanGain1_.push_back(a2); - kalmanGain1_.push_back(a3); - kalmanGain1_.push_back(a4); - kalmanGain1_.push_back(a5); - kalmanGain1_.push_back(a6); - break; - case 0: - kalmanGain0_.push_back(K); - kalmanGain0_.push_back(a1); - kalmanGain0_.push_back(a2); - kalmanGain0_.push_back(a3); - break; - - default: - printf("Critical ERROR on setting the Klamn gain\n"); + void L1MuKBMTrack::setApproxChi2(int chi) { approxChi2_ = chi; } + void L1MuKBMTrack::setTrackCompatibility(int chi) { trackCompatibility_ = chi; } + + void L1MuKBMTrack::setPtEtaPhi(double pt, double eta, double phi) { + PolarLorentzVector v(pt, eta, phi, 0.105); + setP4(v); } -} - -void L1MuKBMTrack::setResidual(uint i, int val) { residuals_[i] = val; } - -const std::vector& L1MuKBMTrack::kalmanGain(unsigned int step) const { - switch (step) { - case 3: - return kalmanGain3_; - case 2: - return kalmanGain2_; - case 1: - return kalmanGain1_; - case 0: - return kalmanGain0_; + void L1MuKBMTrack::setPtUnconstrained(float pt) { ptUnconstrained_ = pt; } + + void L1MuKBMTrack::addStub(const L1MuKBMTCombinedStubRef& stub) { + if (stub->quality() < quality_) + quality_ = stub->quality(); + stubs_.push_back(stub); } - return kalmanGain0_; -} -const std::vector& L1MuKBMTrack::covariance() const { return covariance_; } + void L1MuKBMTrack::setFineEta(int eta) { + fineEta_ = eta; + hasFineEta_ = true; + } -bool L1MuKBMTrack::overlapTrack(const L1MuKBMTrack& other) const { - for (const auto& s1 : stubs_) { - for (const auto& s2 : other.stubs()) { - if (s1->scNum() == s2->scNum() && s1->whNum() == s2->whNum() && s1->stNum() == s2->stNum() && - s1->tag() == s2->tag()) - return true; + void L1MuKBMTrack::setRank(int rank) { rank_ = rank; } + + void L1MuKBMTrack::setKalmanGain( + unsigned int step, unsigned int K, float a1, float a2, float a3, float a4, float a5, float a6) { + switch (step) { + case 3: + kalmanGain3_.push_back(K); + kalmanGain3_.push_back(a1); + kalmanGain3_.push_back(a2); + kalmanGain3_.push_back(a3); + kalmanGain3_.push_back(a4); + kalmanGain3_.push_back(a5); + kalmanGain3_.push_back(a6); + break; + case 2: + kalmanGain2_.push_back(K); + kalmanGain2_.push_back(a1); + kalmanGain2_.push_back(a2); + kalmanGain2_.push_back(a3); + kalmanGain2_.push_back(a4); + kalmanGain2_.push_back(a5); + kalmanGain2_.push_back(a6); + break; + case 1: + kalmanGain1_.push_back(K); + kalmanGain1_.push_back(a1); + kalmanGain1_.push_back(a2); + kalmanGain1_.push_back(a3); + kalmanGain1_.push_back(a4); + kalmanGain1_.push_back(a5); + kalmanGain1_.push_back(a6); + break; + case 0: + kalmanGain0_.push_back(K); + kalmanGain0_.push_back(a1); + kalmanGain0_.push_back(a2); + kalmanGain0_.push_back(a3); + break; + + default: + printf("Critical ERROR on setting the Klamn gain\n"); } } - return false; -} - -void L1MuKBMTrack::setCovariance(const CovarianceMatrix& c) { - covariance_[0] = c(0, 0); - covariance_[1] = c(0, 1); - covariance_[2] = c(1, 1); - covariance_[3] = c(0, 2); - covariance_[4] = c(1, 2); - covariance_[5] = c(2, 2); -} + + void L1MuKBMTrack::setResidual(uint i, int val) { residuals_[i] = val; } + + const std::vector& L1MuKBMTrack::kalmanGain(unsigned int step) const { + switch (step) { + case 3: + return kalmanGain3_; + case 2: + return kalmanGain2_; + case 1: + return kalmanGain1_; + case 0: + return kalmanGain0_; + } + return kalmanGain0_; + } + + const std::vector& L1MuKBMTrack::covariance() const { return covariance_; } + + bool L1MuKBMTrack::overlapTrack(const L1MuKBMTrack& other) const { + for (const auto& s1 : stubs_) { + for (const auto& s2 : other.stubs()) { + if (s1->scNum() == s2->scNum() && s1->whNum() == s2->whNum() && s1->stNum() == s2->stNum() && + s1->tag() == s2->tag()) + return true; + } + } + return false; + } + + void L1MuKBMTrack::setCovariance(const CovarianceMatrix& c) { + covariance_[0] = c(0, 0); + covariance_[1] = c(0, 1); + covariance_[2] = c(1, 1); + covariance_[3] = c(0, 2); + covariance_[4] = c(1, 2); + covariance_[5] = c(2, 2); + } +} // namespace io_v1 diff --git a/DataFormats/L1TMuon/src/RegionalMuonShower.cc b/DataFormats/L1TMuon/src/RegionalMuonShower.cc index ff91eafe92db7..1eab205b3c27b 100644 --- a/DataFormats/L1TMuon/src/RegionalMuonShower.cc +++ b/DataFormats/L1TMuon/src/RegionalMuonShower.cc @@ -1,52 +1,54 @@ #include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" -l1t::RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, - bool oneNominalOutOfTime, - bool twoLooseInTime, - bool twoLooseOutOfTime, - bool oneLooseInTime, - bool oneTightInTime, - bool oneTightOutOfTime) - : isOneNominalInTime_(oneNominalInTime), - isOneNominalOutOfTime_(oneNominalOutOfTime), - isOneTightInTime_(oneTightInTime), - isOneTightOutOfTime_(oneTightOutOfTime), - isTwoLooseInTime_(twoLooseInTime), - isTwoLooseOutOfTime_(twoLooseOutOfTime), - isOneLooseInTime_(oneLooseInTime), - link_(0), - processor_(0), - trackFinder_(l1t::tftype::bmtf) {} +namespace l1t::io_v1 { + RegionalMuonShower::RegionalMuonShower(bool oneNominalInTime, + bool oneNominalOutOfTime, + bool twoLooseInTime, + bool twoLooseOutOfTime, + bool oneLooseInTime, + bool oneTightInTime, + bool oneTightOutOfTime) + : isOneNominalInTime_(oneNominalInTime), + isOneNominalOutOfTime_(oneNominalOutOfTime), + isOneTightInTime_(oneTightInTime), + isOneTightOutOfTime_(oneTightOutOfTime), + isTwoLooseInTime_(twoLooseInTime), + isTwoLooseOutOfTime_(twoLooseOutOfTime), + isOneLooseInTime_(oneLooseInTime), + link_(0), + processor_(0), + trackFinder_(l1t::tftype::bmtf) {} -l1t::RegionalMuonShower::~RegionalMuonShower() {} + RegionalMuonShower::~RegionalMuonShower() {} -void l1t::RegionalMuonShower::setTFIdentifiers(int processor, tftype trackFinder) { - trackFinder_ = trackFinder; - processor_ = processor; + void RegionalMuonShower::setTFIdentifiers(int processor, tftype trackFinder) { + trackFinder_ = trackFinder; + processor_ = processor; - switch (trackFinder_) { - case tftype::emtf_pos: - link_ = processor_ + 36; // range 36...41 - break; - case tftype::omtf_pos: - link_ = processor_ + 42; // range 42...47 - break; - case tftype::bmtf: - link_ = processor_ + 48; // range 48...59 - break; - case tftype::omtf_neg: - link_ = processor_ + 60; // range 60...65 - break; - case tftype::emtf_neg: - link_ = processor_ + 66; // range 66...71 + switch (trackFinder_) { + case tftype::emtf_pos: + link_ = processor_ + 36; // range 36...41 + break; + case tftype::omtf_pos: + link_ = processor_ + 42; // range 42...47 + break; + case tftype::bmtf: + link_ = processor_ + 48; // range 48...59 + break; + case tftype::omtf_neg: + link_ = processor_ + 60; // range 60...65 + break; + case tftype::emtf_neg: + link_ = processor_ + 66; // range 66...71 + } } -} -bool l1t::RegionalMuonShower::isValid() const { - return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_ or isOneLooseInTime_); -} + bool RegionalMuonShower::isValid() const { + return (isOneNominalInTime_ or isTwoLooseInTime_ or isOneTightInTime_ or isOneLooseInTime_); + } -bool l1t::RegionalMuonShower::operator==(const l1t::RegionalMuonShower& rhs) const { - return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and isOneNominalInTime_ == rhs.isOneNominalInTime() and - isOneTightInTime_ == rhs.isOneTightInTime() and isOneLooseInTime_ == rhs.isOneLooseInTime()); -} + bool RegionalMuonShower::operator==(const l1t::RegionalMuonShower& rhs) const { + return (isTwoLooseInTime_ == rhs.isTwoLooseInTime() and isOneNominalInTime_ == rhs.isOneNominalInTime() and + isOneTightInTime_ == rhs.isOneTightInTime() and isOneLooseInTime_ == rhs.isOneLooseInTime()); + } +} // namespace l1t::io_v1 diff --git a/DataFormats/L1TMuon/src/classes_def.xml b/DataFormats/L1TMuon/src/classes_def.xml index f6be6aa508147..20fc5c0e6c849 100644 --- a/DataFormats/L1TMuon/src/classes_def.xml +++ b/DataFormats/L1TMuon/src/classes_def.xml @@ -1,26 +1,18 @@ - - - - + + - - - - + - - - - - + + - + @@ -48,29 +40,34 @@ - + + + - + + + + - + - - + + - - + + @@ -83,29 +80,24 @@ - - - - - - - + + - - + + - - + + - - + + diff --git a/DataFormats/L1TMuonPhase2/interface/MuonStub.h b/DataFormats/L1TMuonPhase2/interface/MuonStub.h index 36e78494c2958..389a003adca07 100644 --- a/DataFormats/L1TMuonPhase2/interface/MuonStub.h +++ b/DataFormats/L1TMuonPhase2/interface/MuonStub.h @@ -37,136 +37,136 @@ // --------------------- namespace l1t { + namespace io_v1 { + class MuonStub { + public: + /// default constructor + MuonStub(); + + /// constructor + MuonStub(int etaRegion, + int phiRegion, + int depthRegion, + uint tfLayer, + int coord1, + int coord2, + int id, + int bx, + int quality, + int eta1 = 0, + int eta2 = 0, + int etaQuality = -1, + int type = 0); + ~MuonStub(); + /// return wheel + inline int etaRegion() const { return etaRegion_; } + /// return sector + inline int phiRegion() const { return phiRegion_; } + /// return station + inline int depthRegion() const { return depthRegion_; } + /// return track finder layer + inline uint tfLayer() const { return tfLayer_; } + /// return phi + inline int coord1() const { return coord1_; } + /// return phib + inline int coord2() const { return coord2_; } + /// return quality code + inline int quality() const { return quality_; } + /// return tag (second TS tag) + inline int id() const { return id_; } + inline int index() const { return id_; } + /// return address + inline int address() const { + int addr = id_ | (phiRegion_ << 2); + if (etaRegion_ >= 0) { + return addr | (etaRegion_ << 8); + } else { + int twos_comp = ((-etaRegion_) ^ 0xf) + 1; + return addr | (twos_comp << 8); + } + } + + inline int kmtf_address() const { + int addr = id_ | (phiRegion_ << 2); + if (etaRegion_ >= 0) { + return addr | (etaRegion_ << 6); + } else { + int twos_comp = ((-etaRegion_) ^ 0x7) + 1; + return addr | (twos_comp << 6); + } + } - class MuonStub; + /// return bunch crossing + inline int bxNum() const { return bxNum_; } + + /// return eta + inline int eta1() const { return eta1_; } + inline int eta2() const { return eta2_; } + /// return first eta quality + inline int etaQuality() const { return etaQuality_; } + //return type + inline int type() const { return type_; } + + inline bool isBarrel() const { return (type_ == 1); } + inline bool isEndcap() const { return (type_ == 0); } + + inline double offline_coord1() const { return offline_coord1_; } + inline double offline_coord2() const { return offline_coord2_; } + inline double offline_eta1() const { return offline_eta1_; } + inline double offline_eta2() const { return offline_eta2_; } + + void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2) { + offline_coord1_ = coord1; + offline_coord2_ = coord2; + offline_eta1_ = eta1; + offline_eta2_ = eta2; + } + void setEta(int eta1, int eta2, int etaQ) { + eta1_ = eta1; + eta2_ = eta2; + etaQuality_ = etaQ; + } + void setID(int id) { id_ = id; } + /// equal operator + bool operator==(const MuonStub&) const; + /// unequal operator + bool operator!=(const MuonStub&) const; + + void print() const; + + const Phase2L1GMT::wordtype hybridStubWord() const; + void printHybridStub(const std::string module = "MuonStub", const uint spaces = 0, const bool label = true) const; + void printHybridStubWord(const std::string module = "MuonStub", + const uint spaces = 0, + const bool label = true) const; + + private: + int etaRegion_; //In the barrel this is wheel. In the endcap it is 6-ring + int phiRegion_; //In the barrel it is sector. In the endcap it is chamber + int depthRegion_; //Station + uint tfLayer_; //TF Layer + int coord1_; // global position angle in units of 30 degrees/2048 + int coord2_; // bending angle only in barrel for now + int id_; // stub id in case of more stubs per chamber + int quality_; // + int bxNum_; // bunch crossing identifier + int eta1_; // eta coordinate - in units of 3.0/512. + int eta2_; // eta coordinate - in units of 3.0/512. + int etaQuality_; // quality of the eta information + int type_; //Type: 0 TwinMux or DT, 1 RPC Barrel, 2 CSC, 3 RPC endcap + /////////members that are not hardware but used for offline studies/////////////////////////////// + double offline_coord1_; //offline coordinate 1 + double offline_coord2_; //offline coordinate two + double offline_eta1_; //offline eta1 + double offline_eta2_; //offline eta2 + }; + + } // namespace io_v1 + using MuonStub = io_v1::MuonStub; typedef std::vector MuonStubCollection; typedef edm::Ref MuonStubRef; typedef std::vector > MuonStubRefVector; - class MuonStub { - public: - /// default constructor - MuonStub(); - - /// constructor - MuonStub(int etaRegion, - int phiRegion, - int depthRegion, - uint tfLayer, - int coord1, - int coord2, - int id, - int bx, - int quality, - int eta1 = 0, - int eta2 = 0, - int etaQuality = -1, - int type = 0); - ~MuonStub(); - /// return wheel - inline int etaRegion() const { return etaRegion_; } - /// return sector - inline int phiRegion() const { return phiRegion_; } - /// return station - inline int depthRegion() const { return depthRegion_; } - /// return track finder layer - inline uint tfLayer() const { return tfLayer_; } - /// return phi - inline int coord1() const { return coord1_; } - /// return phib - inline int coord2() const { return coord2_; } - /// return quality code - inline int quality() const { return quality_; } - /// return tag (second TS tag) - inline int id() const { return id_; } - inline int index() const { return id_; } - /// return address - inline int address() const { - int addr = id_ | (phiRegion_ << 2); - if (etaRegion_ >= 0) { - return addr | (etaRegion_ << 8); - } else { - int twos_comp = ((-etaRegion_) ^ 0xf) + 1; - return addr | (twos_comp << 8); - } - } - - inline int kmtf_address() const { - int addr = id_ | (phiRegion_ << 2); - if (etaRegion_ >= 0) { - return addr | (etaRegion_ << 6); - } else { - int twos_comp = ((-etaRegion_) ^ 0x7) + 1; - return addr | (twos_comp << 6); - } - } - - /// return bunch crossing - inline int bxNum() const { return bxNum_; } - - /// return eta - inline int eta1() const { return eta1_; } - inline int eta2() const { return eta2_; } - /// return first eta quality - inline int etaQuality() const { return etaQuality_; } - //return type - inline int type() const { return type_; } - - inline bool isBarrel() const { return (type_ == 1); } - inline bool isEndcap() const { return (type_ == 0); } - - inline double offline_coord1() const { return offline_coord1_; } - inline double offline_coord2() const { return offline_coord2_; } - inline double offline_eta1() const { return offline_eta1_; } - inline double offline_eta2() const { return offline_eta2_; } - - void setOfflineQuantities(double coord1, double coord2, double eta1, double eta2) { - offline_coord1_ = coord1; - offline_coord2_ = coord2; - offline_eta1_ = eta1; - offline_eta2_ = eta2; - } - void setEta(int eta1, int eta2, int etaQ) { - eta1_ = eta1; - eta2_ = eta2; - etaQuality_ = etaQ; - } - - void setID(int id) { id_ = id; } - /// equal operator - bool operator==(const MuonStub&) const; - /// unequal operator - bool operator!=(const MuonStub&) const; - - void print() const; - - const Phase2L1GMT::wordtype hybridStubWord() const; - void printHybridStub(const std::string module = "MuonStub", const uint spaces = 0, const bool label = true) const; - void printHybridStubWord(const std::string module = "MuonStub", - const uint spaces = 0, - const bool label = true) const; - - private: - int etaRegion_; //In the barrel this is wheel. In the endcap it is 6-ring - int phiRegion_; //In the barrel it is sector. In the endcap it is chamber - int depthRegion_; //Station - uint tfLayer_; //TF Layer - int coord1_; // global position angle in units of 30 degrees/2048 - int coord2_; // bending angle only in barrel for now - int id_; // stub id in case of more stubs per chamber - int quality_; // - int bxNum_; // bunch crossing identifier - int eta1_; // eta coordinate - in units of 3.0/512. - int eta2_; // eta coordinate - in units of 3.0/512. - int etaQuality_; // quality of the eta information - int type_; //Type: 0 TwinMux or DT, 1 RPC Barrel, 2 CSC, 3 RPC endcap - /////////members that are not hardware but used for offline studies/////////////////////////////// - double offline_coord1_; //offline coordinate 1 - double offline_coord2_; //offline coordinate two - double offline_eta1_; //offline eta1 - double offline_eta2_; //offline eta2 - }; - } // namespace l1t #endif diff --git a/DataFormats/L1TMuonPhase2/interface/SAMuon.h b/DataFormats/L1TMuonPhase2/interface/SAMuon.h index 31c53af75d299..73b6c618d2f42 100644 --- a/DataFormats/L1TMuonPhase2/interface/SAMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/SAMuon.h @@ -11,81 +11,80 @@ #include "DataFormats/L1TMuonPhase2/interface/MuonStub.h" namespace l1t { - - class SAMuon; - + namespace io_v1 { + class SAMuon : public L1Candidate { + public: + SAMuon(); + + SAMuon(const l1t::Muon& mu, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); + + ~SAMuon() override; + + const bool hwCharge() const { return hwCharge_; } + const int hwZ0() const { return hwZ0_; } + const int hwD0() const { return hwD0_; } + const uint hwBeta() const { return hwBeta_; } + void setBeta(uint beta) { hwBeta_ = beta; } + void setTF(tftype tf) { tf_ = tf; } + unsigned int trackID() const { return trackID_; } + + void setTrackID(unsigned int ID) { trackID_ = ID; } + + const tftype tfType() const { return tf_; } + // For GT, returning ap_ type + const Phase2L1GMT::valid_sa_t apValid() const { return Phase2L1GMT::valid_sa_t(hwPt() > 0); }; + const Phase2L1GMT::pt_sa_t apPt() const { return Phase2L1GMT::pt_sa_t(hwPt()); }; + const Phase2L1GMT::phi_sa_t apPhi() const { return Phase2L1GMT::phi_sa_t(hwPhi()); }; + const Phase2L1GMT::eta_sa_t apEta() const { return Phase2L1GMT::eta_sa_t(hwEta()); }; + const Phase2L1GMT::z0_sa_t apZ0() const { return Phase2L1GMT::z0_sa_t(hwZ0()); }; + const Phase2L1GMT::d0_sa_t apD0() const { return Phase2L1GMT::d0_sa_t(hwD0()); }; + const Phase2L1GMT::q_sa_t apCharge() const { return Phase2L1GMT::q_sa_t(hwCharge()); }; + const Phase2L1GMT::qual_sa_t apQualFlags() const { return Phase2L1GMT::qual_sa_t(hwQual()); }; + + // For HLT + const double phZ0() const { return Phase2L1GMT::LSBSAz0 * hwZ0(); } + const double phD0() const { return Phase2L1GMT::LSBSAd0 * hwD0(); } + const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } + const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } + const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } + const int phCharge() const { return pow(-1, hwCharge()); } + + const uint64_t word() const { return word_; } + void setWord(uint64_t word) { word_ = word; } + void print() const; + + bool operator<(const SAMuon& other) const { + if (hwPt() == other.hwPt()) + return (hwEta() < other.hwEta()); + else + return (hwPt() < other.hwPt()); + } + bool operator>(const SAMuon& other) const { + if (hwPt() == other.hwPt()) + return (hwEta() > other.hwEta()); + else + return (hwPt() > other.hwPt()); + } + + void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } + void setStubs(const MuonStubRefVector& stubs) { stubs_ = stubs; } + const MuonStubRefVector stubs() const { return stubs_; } + + private: + bool hwCharge_; + int hwZ0_; + int hwD0_; + uint hwBeta_; + uint64_t word_; + MuonStubRefVector stubs_; + unsigned int trackID_; + tftype tf_; + }; + } // namespace io_v1 + using SAMuon = io_v1::SAMuon; typedef std::vector SAMuonCollection; typedef edm::Ref SAMuonRef; typedef std::vector > SAMuonRefVector; - - class SAMuon : public L1Candidate { - public: - SAMuon(); - - SAMuon(const l1t::Muon& mu, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); - - ~SAMuon() override; - - const bool hwCharge() const { return hwCharge_; } - const int hwZ0() const { return hwZ0_; } - const int hwD0() const { return hwD0_; } - const uint hwBeta() const { return hwBeta_; } - void setBeta(uint beta) { hwBeta_ = beta; } - void setTF(tftype tf) { tf_ = tf; } - unsigned int trackID() const { return trackID_; } - - void setTrackID(unsigned int ID) { trackID_ = ID; } - - const tftype tfType() const { return tf_; } - // For GT, returning ap_ type - const Phase2L1GMT::valid_sa_t apValid() const { return Phase2L1GMT::valid_sa_t(hwPt() > 0); }; - const Phase2L1GMT::pt_sa_t apPt() const { return Phase2L1GMT::pt_sa_t(hwPt()); }; - const Phase2L1GMT::phi_sa_t apPhi() const { return Phase2L1GMT::phi_sa_t(hwPhi()); }; - const Phase2L1GMT::eta_sa_t apEta() const { return Phase2L1GMT::eta_sa_t(hwEta()); }; - const Phase2L1GMT::z0_sa_t apZ0() const { return Phase2L1GMT::z0_sa_t(hwZ0()); }; - const Phase2L1GMT::d0_sa_t apD0() const { return Phase2L1GMT::d0_sa_t(hwD0()); }; - const Phase2L1GMT::q_sa_t apCharge() const { return Phase2L1GMT::q_sa_t(hwCharge()); }; - const Phase2L1GMT::qual_sa_t apQualFlags() const { return Phase2L1GMT::qual_sa_t(hwQual()); }; - - // For HLT - const double phZ0() const { return Phase2L1GMT::LSBSAz0 * hwZ0(); } - const double phD0() const { return Phase2L1GMT::LSBSAd0 * hwD0(); } - const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } - const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } - const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } - const int phCharge() const { return pow(-1, hwCharge()); } - - const uint64_t word() const { return word_; } - void setWord(uint64_t word) { word_ = word; } - void print() const; - - bool operator<(const SAMuon& other) const { - if (hwPt() == other.hwPt()) - return (hwEta() < other.hwEta()); - else - return (hwPt() < other.hwPt()); - } - bool operator>(const SAMuon& other) const { - if (hwPt() == other.hwPt()) - return (hwEta() > other.hwEta()); - else - return (hwPt() > other.hwPt()); - } - - void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } - void setStubs(const MuonStubRefVector& stubs) { stubs_ = stubs; } - const MuonStubRefVector stubs() const { return stubs_; } - - private: - bool hwCharge_; - int hwZ0_; - int hwD0_; - uint hwBeta_; - uint64_t word_; - MuonStubRefVector stubs_; - unsigned int trackID_; - tftype tf_; - }; } // namespace l1t #endif diff --git a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h index 8946a8195afb2..215766cfd274a 100644 --- a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h @@ -13,88 +13,88 @@ #include "DataFormats/L1TMuonPhase2/interface/Constants.h" namespace l1t { + namespace io_v1 { + class TrackerMuon : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef std::vector L1TTTrackCollection; - class TrackerMuon; + TrackerMuon(); - typedef std::vector TrackerMuonCollection; - typedef edm::Ref TrackerMuonRef; - typedef std::vector > TrackerMuonRefVector; - - class TrackerMuon : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; + TrackerMuon( + const edm::Ptr& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); - TrackerMuon(); + ~TrackerMuon() override; - TrackerMuon( - const edm::Ptr& trk, bool charge, uint pt, int eta, int phi, int z0, int d0, uint quality); + const edm::Ptr& trkPtr() const { return trkPtr_; } + const SAMuonRefVector muonRef() const { return muRef_; } - ~TrackerMuon() override; + const bool hwCharge() const { return hwCharge_; } + const int hwZ0() const { return hwZ0_; } + const int hwD0() const { return hwD0_; } + const int hwIsoSum() const { return hwIsoSum_; } + const int hwIsoSumAp() const { return hwIsoSumAp_; } + const uint hwBeta() const { return hwBeta_; } + void setBeta(uint beta) { hwBeta_ = beta; } + void setMuonRef(const l1t::SAMuonRefVector& p) { muRef_ = p; } + void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; } + void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } - const edm::Ptr& trkPtr() const { return trkPtr_; } - const SAMuonRefVector muonRef() const { return muRef_; } + // For GT, returning ap_ type + const Phase2L1GMT::valid_gt_t apValid() const { return Phase2L1GMT::valid_gt_t(hwPt() > 0); }; + const Phase2L1GMT::pt_gt_t apPt() const { return Phase2L1GMT::pt_gt_t(hwPt()); }; + const Phase2L1GMT::phi_gt_t apPhi() const { return Phase2L1GMT::phi_gt_t(hwPhi()); }; + const Phase2L1GMT::eta_gt_t apEta() const { return Phase2L1GMT::eta_gt_t(hwEta()); }; + const Phase2L1GMT::z0_gt_t apZ0() const { return Phase2L1GMT::z0_gt_t(hwZ0()); }; + const Phase2L1GMT::d0_gt_t apD0() const { return Phase2L1GMT::d0_gt_t(hwD0()); }; + const Phase2L1GMT::q_gt_t apCharge() const { return Phase2L1GMT::q_gt_t(hwCharge()); }; + const Phase2L1GMT::qual_gt_t apQualFlags() const { return Phase2L1GMT::qual_gt_t(hwQual()); }; + const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIsoSumAp()); }; + const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); }; - const bool hwCharge() const { return hwCharge_; } - const int hwZ0() const { return hwZ0_; } - const int hwD0() const { return hwD0_; } - const int hwIsoSum() const { return hwIsoSum_; } - const int hwIsoSumAp() const { return hwIsoSumAp_; } - const uint hwBeta() const { return hwBeta_; } - void setBeta(uint beta) { hwBeta_ = beta; } - void setMuonRef(const l1t::SAMuonRefVector& p) { muRef_ = p; } - void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; } - void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } + // For HLT + const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); } + const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); } + const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } + const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } + const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } + const double phIso() const { return Phase2L1GMT::LSBGTiso * hwIsoSumAp(); } + const int phCharge() const { return pow(-1, hwCharge()); } + const uint numberOfMatches() const { return numberOfMatches_; } + const uint numberOfStations() const { return stubs_.size(); } + const std::array word() const { return word_; } + void setWord(std::array word) { word_ = word; } + void print() const; + const MuonStubRefVector stubs() const { return stubs_; } + void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } + void setNumberOfMatches(uint matches) { numberOfMatches_ = matches; } + bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); } + bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); } - // For GT, returning ap_ type - const Phase2L1GMT::valid_gt_t apValid() const { return Phase2L1GMT::valid_gt_t(hwPt() > 0); }; - const Phase2L1GMT::pt_gt_t apPt() const { return Phase2L1GMT::pt_gt_t(hwPt()); }; - const Phase2L1GMT::phi_gt_t apPhi() const { return Phase2L1GMT::phi_gt_t(hwPhi()); }; - const Phase2L1GMT::eta_gt_t apEta() const { return Phase2L1GMT::eta_gt_t(hwEta()); }; - const Phase2L1GMT::z0_gt_t apZ0() const { return Phase2L1GMT::z0_gt_t(hwZ0()); }; - const Phase2L1GMT::d0_gt_t apD0() const { return Phase2L1GMT::d0_gt_t(hwD0()); }; - const Phase2L1GMT::q_gt_t apCharge() const { return Phase2L1GMT::q_gt_t(hwCharge()); }; - const Phase2L1GMT::qual_gt_t apQualFlags() const { return Phase2L1GMT::qual_gt_t(hwQual()); }; - const Phase2L1GMT::iso_gt_t apIso() const { return Phase2L1GMT::iso_gt_t(hwIsoSumAp()); }; - const Phase2L1GMT::beta_gt_t apBeta() const { return Phase2L1GMT::beta_gt_t(hwBeta()); }; - - // For HLT - const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); } - const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); } - const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } - const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } - const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } - const double phIso() const { return Phase2L1GMT::LSBGTiso * hwIsoSumAp(); } - const int phCharge() const { return pow(-1, hwCharge()); } - const uint numberOfMatches() const { return numberOfMatches_; } - const uint numberOfStations() const { return stubs_.size(); } - const std::array word() const { return word_; } - void setWord(std::array word) { word_ = word; } - void print() const; - const MuonStubRefVector stubs() const { return stubs_; } - void addStub(const MuonStubRef& stub) { stubs_.push_back(stub); } - void setNumberOfMatches(uint matches) { numberOfMatches_ = matches; } - bool operator<(const TrackerMuon& other) const { return (hwPt() < other.hwPt()); } - bool operator>(const TrackerMuon& other) const { return (hwPt() > other.hwPt()); } + private: + // used for the Naive producer + edm::Ptr trkPtr_; + bool hwCharge_; + int hwZ0_; + int hwD0_; + uint hwBeta_; + // The tracker muon is encoded in 96 bits as a 2-element array of uint64_t + std::array word_ = {{0, 0}}; + //Store the eneryg sum for isolation + int hwIsoSum_; + //Store the eneryg sum for isolation with ap_type + int hwIsoSumAp_; + uint numberOfMatches_; + uint numberOfStations_; + SAMuonRefVector muRef_; + MuonStubRefVector stubs_; + }; + } // namespace io_v1 + using TrackerMuon = io_v1::TrackerMuon; + typedef std::vector TrackerMuonCollection; + typedef edm::Ref TrackerMuonRef; + typedef std::vector > TrackerMuonRefVector; - private: - // used for the Naive producer - edm::Ptr trkPtr_; - bool hwCharge_; - int hwZ0_; - int hwD0_; - uint hwBeta_; - // The tracker muon is encoded in 96 bits as a 2-element array of uint64_t - std::array word_ = {{0, 0}}; - //Store the eneryg sum for isolation - int hwIsoSum_; - //Store the eneryg sum for isolation with ap_type - int hwIsoSumAp_; - uint numberOfMatches_; - uint numberOfStations_; - SAMuonRefVector muRef_; - MuonStubRefVector stubs_; - }; } // namespace l1t #endif diff --git a/DataFormats/L1TMuonPhase2/src/classes_def.xml b/DataFormats/L1TMuonPhase2/src/classes_def.xml index 3af19882e9fc8..4c34f5483adcf 100644 --- a/DataFormats/L1TMuonPhase2/src/classes_def.xml +++ b/DataFormats/L1TMuonPhase2/src/classes_def.xml @@ -1,32 +1,29 @@ - - + + - - + + - - - - + + - - + + - - - + + - - + + - + @@ -40,9 +37,8 @@ - - - + + diff --git a/DataFormats/L1TParticleFlow/interface/PFCandidate.h b/DataFormats/L1TParticleFlow/interface/PFCandidate.h index ff6e026acdfa3..63c2a6b1d6fa7 100644 --- a/DataFormats/L1TParticleFlow/interface/PFCandidate.h +++ b/DataFormats/L1TParticleFlow/interface/PFCandidate.h @@ -7,81 +7,82 @@ #include "DataFormats/L1Trigger/interface/RegionalOutput.h" namespace l1t { - - class PFCandidate : public L1Candidate { - public: - typedef l1t::SAMuonRef MuonRef; - typedef edm::Ptr L1CandPtr; - enum ParticleType { ChargedHadron = 0, Electron = 1, NeutralHadron = 2, Photon = 3, Muon = 4 }; - - PFCandidate() {} - PFCandidate(ParticleType kind, - int charge, - const LorentzVector& p, - float puppiWeight = -1, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : PFCandidate(kind, charge, PolarLorentzVector(p), puppiWeight, hwpt, hweta, hwphi) {} - PFCandidate(ParticleType kind, - int charge, - const PolarLorentzVector& p, - float puppiWeight = -1, - int hwpt = 0, - int hweta = 0, - int hwphi = 0); - - ParticleType id() const { return ParticleType(hwQual()); } - - const PFTrackRef& pfTrack() const { return trackRef_; } - void setPFTrack(const PFTrackRef& ref) { trackRef_ = ref; } - - const L1CandPtr& caloPtr() const { return caloPtr_; } - void setCaloPtr(const L1CandPtr& ptr) { caloPtr_ = ptr; } - - const MuonRef& muon() const { return muonRef_; } - void setMuon(const MuonRef& ref) { muonRef_ = ref; } - - /// PUPPI weight (-1 if not available) - float puppiWeight() const { return puppiWeight_; } - - void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); } - void setDxy(float dxy) { dxy_ = dxy; } - void setCaloEta(float caloeta) { caloEta_ = caloeta; } - void setCaloPhi(float calophi) { caloPhi_ = calophi; } - - float z0() const { return vz(); } - float dxy() const { return dxy_; } - float caloEta() const { return caloEta_; } - float caloPhi() const { return caloPhi_; } - - int16_t hwZ0() const { return hwZ0_; } - int16_t hwDxy() const { return hwDxy_; } - uint16_t hwTkQuality() const { return hwTkQuality_; } - uint16_t hwPuppiWeight() const { return hwPuppiWeight_; } - uint16_t hwEmID() const { return hwEmID_; } - uint64_t encodedPuppi64() const { return encodedPuppi64_; } - - void setHwZ0(int16_t hwZ0) { hwZ0_ = hwZ0; } - void setHwDxy(int16_t hwDxy) { hwDxy_ = hwDxy; } - void setHwTkQuality(uint16_t hwTkQuality) { hwTkQuality_ = hwTkQuality; } - void setHwPuppiWeight(uint16_t hwPuppiWeight) { hwPuppiWeight_ = hwPuppiWeight; } - void setHwEmID(uint16_t hwEmID) { hwEmID_ = hwEmID; } - void setEncodedPuppi64(uint64_t encodedPuppi64) { encodedPuppi64_ = encodedPuppi64; } - - private: - L1CandPtr caloPtr_; - PFTrackRef trackRef_; - MuonRef muonRef_; - float dxy_, puppiWeight_, caloEta_, caloPhi_; - - int16_t hwZ0_, hwDxy_; - uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_; - uint64_t encodedPuppi64_; - - void setPdgIdFromParticleType(int charge, ParticleType kind); - }; - + namespace io_v1 { + class PFCandidate : public L1Candidate { + public: + typedef l1t::SAMuonRef MuonRef; + typedef edm::Ptr L1CandPtr; + enum ParticleType { ChargedHadron = 0, Electron = 1, NeutralHadron = 2, Photon = 3, Muon = 4 }; + + PFCandidate() {} + PFCandidate(ParticleType kind, + int charge, + const LorentzVector& p, + float puppiWeight = -1, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : PFCandidate(kind, charge, PolarLorentzVector(p), puppiWeight, hwpt, hweta, hwphi) {} + PFCandidate(ParticleType kind, + int charge, + const PolarLorentzVector& p, + float puppiWeight = -1, + int hwpt = 0, + int hweta = 0, + int hwphi = 0); + + ParticleType id() const { return ParticleType(hwQual()); } + + const PFTrackRef& pfTrack() const { return trackRef_; } + void setPFTrack(const PFTrackRef& ref) { trackRef_ = ref; } + + const L1CandPtr& caloPtr() const { return caloPtr_; } + void setCaloPtr(const L1CandPtr& ptr) { caloPtr_ = ptr; } + + const MuonRef& muon() const { return muonRef_; } + void setMuon(const MuonRef& ref) { muonRef_ = ref; } + + /// PUPPI weight (-1 if not available) + float puppiWeight() const { return puppiWeight_; } + + void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); } + void setDxy(float dxy) { dxy_ = dxy; } + void setCaloEta(float caloeta) { caloEta_ = caloeta; } + void setCaloPhi(float calophi) { caloPhi_ = calophi; } + + float z0() const { return vz(); } + float dxy() const { return dxy_; } + float caloEta() const { return caloEta_; } + float caloPhi() const { return caloPhi_; } + + int16_t hwZ0() const { return hwZ0_; } + int16_t hwDxy() const { return hwDxy_; } + uint16_t hwTkQuality() const { return hwTkQuality_; } + uint16_t hwPuppiWeight() const { return hwPuppiWeight_; } + uint16_t hwEmID() const { return hwEmID_; } + uint64_t encodedPuppi64() const { return encodedPuppi64_; } + + void setHwZ0(int16_t hwZ0) { hwZ0_ = hwZ0; } + void setHwDxy(int16_t hwDxy) { hwDxy_ = hwDxy; } + void setHwTkQuality(uint16_t hwTkQuality) { hwTkQuality_ = hwTkQuality; } + void setHwPuppiWeight(uint16_t hwPuppiWeight) { hwPuppiWeight_ = hwPuppiWeight; } + void setHwEmID(uint16_t hwEmID) { hwEmID_ = hwEmID; } + void setEncodedPuppi64(uint64_t encodedPuppi64) { encodedPuppi64_ = encodedPuppi64; } + + private: + L1CandPtr caloPtr_; + PFTrackRef trackRef_; + MuonRef muonRef_; + float dxy_, puppiWeight_, caloEta_, caloPhi_; + + int16_t hwZ0_, hwDxy_; + uint16_t hwTkQuality_, hwPuppiWeight_, hwEmID_; + uint64_t encodedPuppi64_; + + void setPdgIdFromParticleType(int charge, ParticleType kind); + }; + } // namespace io_v1 + using PFCandidate = io_v1::PFCandidate; typedef std::vector PFCandidateCollection; typedef edm::Ref PFCandidateRef; typedef edm::RefVector PFCandidateRefVector; diff --git a/DataFormats/L1TParticleFlow/interface/PFCluster.h b/DataFormats/L1TParticleFlow/interface/PFCluster.h index 6d2dd6713ef29..dccc202c8d7b3 100644 --- a/DataFormats/L1TParticleFlow/interface/PFCluster.h +++ b/DataFormats/L1TParticleFlow/interface/PFCluster.h @@ -9,105 +9,111 @@ #include namespace l1t { + namespace io_v1 { + class PFCluster : public L1Candidate { + public: + /// constituent information. note that this is not going to be available in the hardware! + typedef std::pair, float> ConstituentAndFraction; + typedef std::vector ConstituentsAndFractions; + + PFCluster() {} + PFCluster(float pt, + float eta, + float phi, + float hOverE = 0, + bool isEM = false, + float ptError = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), + hOverE_(hOverE), + ptError_(ptError), + encoding_(HWEncoding::None), + digiDataW0_(0), + digiDataW1_(0) { + setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) + } + PFCluster(const LorentzVector& p4, + float hOverE, + bool isEM, + float ptError = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), hOverE_(hOverE), ptError_(ptError) { + setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) + } + + enum class HWEncoding { None = 0, Had = 1, Em = 2 }; + + float hOverE() const { return hOverE_; } + void setHOverE(float hOverE) { hOverE_ = hOverE; } + + // NOTE: this might not be consistent with the value stored in the HW digi + float emEt() const { + if (hOverE_ == -1) + return 0; + return pt() / (1 + hOverE_); + } + + // change the pt. H/E also recalculated to keep emEt constant + void calibratePt(float newpt, float preserveEmEt = true); - class PFCluster : public L1Candidate { - public: - /// constituent information. note that this is not going to be available in the hardware! - typedef std::pair, float> ConstituentAndFraction; - typedef std::vector ConstituentsAndFractions; - - PFCluster() {} - PFCluster(float pt, - float eta, - float phi, - float hOverE = 0, - bool isEM = false, - float ptError = 0, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : L1Candidate(PolarLorentzVector(pt, eta, phi, 0), hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), - hOverE_(hOverE), - ptError_(ptError), - encoding_(HWEncoding::None), - digiDataW0_(0), - digiDataW1_(0) { - setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) - } - PFCluster( - const LorentzVector& p4, float hOverE, bool isEM, float ptError = 0, int hwpt = 0, int hweta = 0, int hwphi = 0) - : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/isEM ? 1 : 0), hOverE_(hOverE), ptError_(ptError) { - setPdgId(isEM ? 22 : 130); // photon : non-photon(K0) - } - - enum class HWEncoding { None = 0, Had = 1, Em = 2 }; - - float hOverE() const { return hOverE_; } - void setHOverE(float hOverE) { hOverE_ = hOverE; } - - // NOTE: this might not be consistent with the value stored in the HW digi - float emEt() const { - if (hOverE_ == -1) - return 0; - return pt() / (1 + hOverE_); - } - - // change the pt. H/E also recalculated to keep emEt constant - void calibratePt(float newpt, float preserveEmEt = true); - - /// constituent information. note that this is not going to be available in the hardware! - const ConstituentsAndFractions& constituentsAndFractions() const { return constituents_; } - /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately - void addConstituent(const edm::Ptr& cand, float fraction = 1.0) { - constituents_.emplace_back(cand, fraction); - } - - float ptError() const { return ptError_; } - void setPtError(float ptError) { ptError_ = ptError; } - - bool isEM() const { return hwQual(); } - void setIsEM(bool isEM) { setHwQual(isEM); } - unsigned int hwEmID() const { return hwQual(); } - - std::variant caloDigiObj() const { - switch (encoding_) { - case HWEncoding::Had: - return l1ct::HadCaloObj::unpack(binaryWord()); - case HWEncoding::Em: - return l1ct::EmCaloObj::unpack(binaryWord()); - default: - throw std::runtime_error("No encoding for this cluster"); + /// constituent information. note that this is not going to be available in the hardware! + const ConstituentsAndFractions& constituentsAndFractions() const { return constituents_; } + /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately + void addConstituent(const edm::Ptr& cand, float fraction = 1.0) { + constituents_.emplace_back(cand, fraction); } - } - void setCaloDigi(const l1ct::HadCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Had); } + float ptError() const { return ptError_; } + void setPtError(float ptError) { ptError_ = ptError; } + + bool isEM() const { return hwQual(); } + void setIsEM(bool isEM) { setHwQual(isEM); } + unsigned int hwEmID() const { return hwQual(); } + + std::variant caloDigiObj() const { + switch (encoding_) { + case HWEncoding::Had: + return l1ct::HadCaloObj::unpack(binaryWord()); + case HWEncoding::Em: + return l1ct::EmCaloObj::unpack(binaryWord()); + default: + throw std::runtime_error("No encoding for this cluster"); + } + } - void setCaloDigi(const l1ct::EmCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Em); } + void setCaloDigi(const l1ct::HadCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Had); } - HWEncoding encoding() const { return encoding_; } + void setCaloDigi(const l1ct::EmCaloObj& obj) { setBinaryWord(obj.pack(), HWEncoding::Em); } - private: - float hOverE_, ptError_; + HWEncoding encoding() const { return encoding_; } - ConstituentsAndFractions constituents_; + private: + float hOverE_, ptError_; - template - void setBinaryWord(ap_uint word, HWEncoding encoding) { - digiDataW0_ = word; - digiDataW1_ = (word >> 64); - encoding_ = encoding; - } + ConstituentsAndFractions constituents_; - template - ap_uint binaryWord() const { - return ap_uint(digiDataW0_) | (ap_uint(digiDataW1_) << 64); - } + template + void setBinaryWord(ap_uint word, HWEncoding encoding) { + digiDataW0_ = word; + digiDataW1_ = (word >> 64); + encoding_ = encoding; + } - HWEncoding encoding_; - uint64_t digiDataW0_; - uint64_t digiDataW1_; - }; + template + ap_uint binaryWord() const { + return ap_uint(digiDataW0_) | (ap_uint(digiDataW1_) << 64); + } + HWEncoding encoding_; + uint64_t digiDataW0_; + uint64_t digiDataW1_; + }; + } // namespace io_v1 + using PFCluster = io_v1::PFCluster; typedef std::vector PFClusterCollection; typedef edm::Ref PFClusterRef; } // namespace l1t diff --git a/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h b/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h index 5bb7f7503318d..ce3e8edb48e7d 100644 --- a/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h +++ b/DataFormats/L1TParticleFlow/interface/PFClusterFwd.h @@ -2,6 +2,9 @@ #define DataFormats_L1TParticleFlow_PFClusterFwd_h namespace l1t { - class PFCluster; -} + namespace io_v1 { + class PFCluster; + } + using PFCluster = io_v1::PFCluster; +} // namespace l1t #endif diff --git a/DataFormats/L1TParticleFlow/interface/PFJet.h b/DataFormats/L1TParticleFlow/interface/PFJet.h index 1889033c04112..1b9a0ee59791f 100644 --- a/DataFormats/L1TParticleFlow/interface/PFJet.h +++ b/DataFormats/L1TParticleFlow/interface/PFJet.h @@ -8,94 +8,96 @@ #include "DataFormats/Common/interface/Ptr.h" namespace l1t { + namespace io_v1 { + class PFJet : public L1Candidate { + public: + /// constituent information. note that this is not going to be available in the hardware! + typedef std::vector> Constituents; + + PFJet() {} + PFJet(float pt, float eta, float phi, float mass, int hwpt = 0, int hweta = 0, int hwphi = 0) + : L1Candidate(PolarLorentzVector(pt, eta, phi, mass), hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(pt) {} + + PFJet(const LorentzVector& p4, int hwpt = 0, int hweta = 0, int hwphi = 0) + : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(p4.Pt()) {} + + // change the pt (but doesn't change the raw pt) + void calibratePt(float newpt); + + // return the raw pT() + float rawPt() const { return rawPt_; } + + /// constituent information. note that this is not going to be available in the hardware! + const Constituents& constituents() const { return constituents_; } + /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately + void addConstituent(const edm::Ptr& cand) { constituents_.emplace_back(cand); } + + // add jet tag prediction results + void addTagScores(std::vector scores, std::vector classes, float ptcorrection) { + tagScores_ = scores; + tagClasses_ = classes; + ptCorrection_ = ptcorrection; + } - class PFJet : public L1Candidate { - public: - /// constituent information. note that this is not going to be available in the hardware! - typedef std::vector> Constituents; - - PFJet() {} - PFJet(float pt, float eta, float phi, float mass, int hwpt = 0, int hweta = 0, int hwphi = 0) - : L1Candidate(PolarLorentzVector(pt, eta, phi, mass), hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(pt) {} - - PFJet(const LorentzVector& p4, int hwpt = 0, int hweta = 0, int hwphi = 0) - : L1Candidate(p4, hwpt, hweta, hwphi, /*hwQuality=*/0), rawPt_(p4.Pt()) {} - - // change the pt (but doesn't change the raw pt) - void calibratePt(float newpt); - - // return the raw pT() - float rawPt() const { return rawPt_; } - - /// constituent information. note that this is not going to be available in the hardware! - const Constituents& constituents() const { return constituents_; } - /// adds a candidate to this cluster; note that this only records the information, it's up to you to also set the 4-vector appropriately - void addConstituent(const edm::Ptr& cand) { constituents_.emplace_back(cand); } + std::vector getTagScores() const { return tagScores_; } + std::vector getTagClasses() const { return tagClasses_; } - // add jet tag prediction results - void addTagScores(std::vector scores, std::vector classes, float ptcorrection) { - tagScores_ = scores; - tagClasses_ = classes; - ptCorrection_ = ptcorrection; - } + float getTagScore(l1ct::JetTagClass tagClass) const { + // get the tag score for a specific tagClass + auto it = std::find(tagClasses_.begin(), tagClasses_.end(), tagClass); + if (it != tagClasses_.end()) { + return tagScores_[std::distance(tagClasses_.begin(), it)]; + } + return -1.0f; // Return an invalid/default score if tagClass is not found + } - std::vector getTagScores() const { return tagScores_; } - std::vector getTagClasses() const { return tagClasses_; } + float getTagScore(const std::string& tagClassStr) const { + // get the tag score for a specific tagClass + l1ct::JetTagClass tagClass(tagClassStr); + return getTagScore(tagClass); + } - float getTagScore(l1ct::JetTagClass tagClass) const { - // get the tag score for a specific tagClass - auto it = std::find(tagClasses_.begin(), tagClasses_.end(), tagClass); - if (it != tagClasses_.end()) { - return tagScores_[std::distance(tagClasses_.begin(), it)]; + float getPtCorrection() const { return ptCorrection_; } + + // candidate interface + size_t numberOfDaughters() const override { return constituents_.size(); } + const reco::Candidate* daughter(size_type i) const override { return constituents_[i].get(); } + using reco::LeafCandidate::daughter; // avoid hiding the base + edm::Ptr daughterPtr(size_type i) const { return constituents_[i]; } + // more candidate interface + size_t numberOfSourceCandidatePtrs() const override { return constituents_.size(); } + reco::CandidatePtr sourceCandidatePtr(size_type i) const override { return daughterPtr(i); } + + // Get and set the encodedJet_ bits. The Jet is encoded in 128 bits as a 2-element array of uint64_t + // We store encodings both for Correlator internal usage and for Global Trigger + enum class HWEncoding { CT, GT, GTWide }; + static const std::unordered_map encodingMapping; + static HWEncoding encodingFromString(const std::string& name); + + typedef std::array PackedJet; + const PackedJet& encodedJet(const HWEncoding encoding = HWEncoding::GT) const { + return encodedJet_[static_cast(encoding)]; + } + void setEncodedJet(const HWEncoding encoding, const PackedJet jet) { + encodedJet_[static_cast(encoding)] = jet; } - return -1.0f; // Return an invalid/default score if tagClass is not found - } - - float getTagScore(const std::string& tagClassStr) const { - // get the tag score for a specific tagClass - l1ct::JetTagClass tagClass(tagClassStr); - return getTagScore(tagClass); - } - - float getPtCorrection() const { return ptCorrection_; } - - // candidate interface - size_t numberOfDaughters() const override { return constituents_.size(); } - const reco::Candidate* daughter(size_type i) const override { return constituents_[i].get(); } - using reco::LeafCandidate::daughter; // avoid hiding the base - edm::Ptr daughterPtr(size_type i) const { return constituents_[i]; } - // more candidate interface - size_t numberOfSourceCandidatePtrs() const override { return constituents_.size(); } - reco::CandidatePtr sourceCandidatePtr(size_type i) const override { return daughterPtr(i); } - - // Get and set the encodedJet_ bits. The Jet is encoded in 128 bits as a 2-element array of uint64_t - // We store encodings both for Correlator internal usage and for Global Trigger - enum class HWEncoding { CT, GT, GTWide }; - static const std::unordered_map encodingMapping; - static HWEncoding encodingFromString(const std::string& name); - - typedef std::array PackedJet; - const PackedJet& encodedJet(const HWEncoding encoding = HWEncoding::GT) const { - return encodedJet_[static_cast(encoding)]; - } - void setEncodedJet(const HWEncoding encoding, const PackedJet jet) { - encodedJet_[static_cast(encoding)] = jet; - } - - // Accessors to HW objects with ap_* types from encoded words - const PackedJet& getHWJetGT() const { return encodedJet(HWEncoding::GT); } - const PackedJet& getHWJetGTWide() const { return encodedJet(HWEncoding::GTWide); } - const PackedJet& getHWJetCT() const { return encodedJet(HWEncoding::CT); } - - private: - float rawPt_; - Constituents constituents_; - std::vector tagClasses_; - std::vector tagScores_; - float ptCorrection_; - std::array encodedJet_ = {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}; - }; + // Accessors to HW objects with ap_* types from encoded words + const PackedJet& getHWJetGT() const { return encodedJet(HWEncoding::GT); } + const PackedJet& getHWJetGTWide() const { return encodedJet(HWEncoding::GTWide); } + const PackedJet& getHWJetCT() const { return encodedJet(HWEncoding::CT); } + + private: + float rawPt_; + Constituents constituents_; + std::vector tagClasses_; + std::vector tagScores_; + float ptCorrection_; + std::array encodedJet_ = {{{{0, 0}}, {{0, 0}}, {{0, 0}}}}; + }; + + } // namespace io_v1 + using PFJet = io_v1::PFJet; typedef std::vector PFJetCollection; typedef edm::Ref PFJetRef; typedef edm::RefVector PFJetRefVector; diff --git a/DataFormats/L1TParticleFlow/interface/PFTau.h b/DataFormats/L1TParticleFlow/interface/PFTau.h index 0a2fb9a3fe489..938ef22f6fd14 100644 --- a/DataFormats/L1TParticleFlow/interface/PFTau.h +++ b/DataFormats/L1TParticleFlow/interface/PFTau.h @@ -23,70 +23,72 @@ namespace l1t { static constexpr double PFTAU_NN_PT_CUTOFF = 100.0; - class PFTau : public L1Candidate { - public: - PFTau() {} - enum { unidentified = 0, oneprong = 1, oneprongpi0 = 2, threeprong = 3 }; - PFTau(const LorentzVector& p, - float iVector[80], - float iso = -1, - float fulliso = -1, - int id = 0, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : PFTau(PolarLorentzVector(p), iVector, iso, id, hwpt, hweta, hwphi) {} - PFTau(const PolarLorentzVector& p, - float iVector[80], - float iso = -1, - float fulliso = -1, - int id = 0, - int hwpt = 0, - int hweta = 0, - int hwphi = 0); - float chargedIso() const { return iso_; } - float fullIso() const { return fullIso_; } - int id() const { return id_; } - - void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); } - void setDxy(float dxy) { dxy_ = dxy; } - - float z0() const { return vz(); } - float dxy() const { return dxy_; } - const float* NNValues() const { return NNValues_; } - - bool passMass() const { return (mass() < 2 + pt() / PTSCALING_MASSCUT); } - bool passLooseNN() const { return iso_ > PFTAU_NN_LOOSE_CUT; } - bool passLooseNNMass() const { - if (!passMass()) - return false; - return passLooseNN(); - } - bool passLoosePF() const { return fullIso_ < PFTAU_PF_LOOSE_CUT; } - bool passTightNN() const { return iso_ > PFTAU_NN_TIGHT_CUT; } - bool passTightNNMass() const { - if (!passMass()) - return false; - return passTightNN(); - } - bool passTightPF() const { return fullIso_ < PFTAU_PF_TIGHT_CUT; } - - //Tau encoding for GT - void set_encodedTau(l1gt::PackedTau encodedTau) { encodedTau_ = encodedTau; } - l1gt::PackedTau encodedTau() const { return encodedTau_; } //Can be unpacked using l1gt::Tau::unpack() - - //Return the l1gt Tau object from the encoded objects - l1gt::Tau getHWTauGT() const { return l1gt::Tau::unpack(encodedTau_); } - - private: - float NNValues_[80]; // Values for each of the 80 NN inputs - float iso_; - float fullIso_; - int id_; - float dxy_; - l1gt::PackedTau encodedTau_; - }; - + namespace io_v1 { + class PFTau : public L1Candidate { + public: + PFTau() {} + enum { unidentified = 0, oneprong = 1, oneprongpi0 = 2, threeprong = 3 }; + PFTau(const LorentzVector& p, + float iVector[80], + float iso = -1, + float fulliso = -1, + int id = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : PFTau(PolarLorentzVector(p), iVector, iso, id, hwpt, hweta, hwphi) {} + PFTau(const PolarLorentzVector& p, + float iVector[80], + float iso = -1, + float fulliso = -1, + int id = 0, + int hwpt = 0, + int hweta = 0, + int hwphi = 0); + float chargedIso() const { return iso_; } + float fullIso() const { return fullIso_; } + int id() const { return id_; } + + void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); } + void setDxy(float dxy) { dxy_ = dxy; } + + float z0() const { return vz(); } + float dxy() const { return dxy_; } + const float* NNValues() const { return NNValues_; } + + bool passMass() const { return (mass() < 2 + pt() / PTSCALING_MASSCUT); } + bool passLooseNN() const { return iso_ > PFTAU_NN_LOOSE_CUT; } + bool passLooseNNMass() const { + if (!passMass()) + return false; + return passLooseNN(); + } + bool passLoosePF() const { return fullIso_ < PFTAU_PF_LOOSE_CUT; } + bool passTightNN() const { return iso_ > PFTAU_NN_TIGHT_CUT; } + bool passTightNNMass() const { + if (!passMass()) + return false; + return passTightNN(); + } + bool passTightPF() const { return fullIso_ < PFTAU_PF_TIGHT_CUT; } + + //Tau encoding for GT + void set_encodedTau(l1gt::PackedTau encodedTau) { encodedTau_ = encodedTau; } + l1gt::PackedTau encodedTau() const { return encodedTau_; } //Can be unpacked using l1gt::Tau::unpack() + + //Return the l1gt Tau object from the encoded objects + l1gt::Tau getHWTauGT() const { return l1gt::Tau::unpack(encodedTau_); } + + private: + float NNValues_[80]; // Values for each of the 80 NN inputs + float iso_; + float fullIso_; + int id_; + float dxy_; + l1gt::PackedTau encodedTau_; + }; + } // namespace io_v1 + using PFTau = io_v1::PFTau; typedef std::vector PFTauCollection; typedef edm::Ref PFTauRef; diff --git a/DataFormats/L1TParticleFlow/interface/PFTrack.h b/DataFormats/L1TParticleFlow/interface/PFTrack.h index 50cb946063d6e..f4edef175349f 100644 --- a/DataFormats/L1TParticleFlow/interface/PFTrack.h +++ b/DataFormats/L1TParticleFlow/interface/PFTrack.h @@ -8,84 +8,85 @@ #include "DataFormats/Common/interface/Ref.h" namespace l1t { + namespace io_v1 { + class PFTrack : public L1Candidate { + public: + typedef TTTrack L1TTTrackType; + typedef edm::Ref> TrackRef; - class PFTrack : public L1Candidate { - public: - typedef TTTrack L1TTTrackType; - typedef edm::Ref> TrackRef; + PFTrack() {} + PFTrack(int charge, + const reco::Particle::LorentzVector& p4, + const reco::Particle::Point& vtx, + const TrackRef& tkPtr, + int nPar, + float caloEta, + float caloPhi, + float trkPtError = -1, + float caloPtError = -1, + int quality = 1, + bool isMuon = false, + int hwpt = 0, + int hweta = 0, + int hwphi = 0) + : L1Candidate(p4, hwpt, hweta, hwphi, quality), + trackRef_(tkPtr), + caloEta_(caloEta), + caloPhi_(caloPhi), + trkPtError_(trkPtError), + caloPtError_(caloPtError), + isMuon_(isMuon), + nPar_(nPar), + trackWord_(*tkPtr) { + setCharge(charge); + setVertex(vtx); + } - PFTrack() {} - PFTrack(int charge, - const reco::Particle::LorentzVector& p4, - const reco::Particle::Point& vtx, - const TrackRef& tkPtr, - int nPar, - float caloEta, - float caloPhi, - float trkPtError = -1, - float caloPtError = -1, - int quality = 1, - bool isMuon = false, - int hwpt = 0, - int hweta = 0, - int hwphi = 0) - : L1Candidate(p4, hwpt, hweta, hwphi, quality), - trackRef_(tkPtr), - caloEta_(caloEta), - caloPhi_(caloPhi), - trkPtError_(trkPtError), - caloPtError_(caloPtError), - isMuon_(isMuon), - nPar_(nPar), - trackWord_(*tkPtr) { - setCharge(charge); - setVertex(vtx); - } + const TrackRef& track() const { return trackRef_; } + void setTrack(const TrackRef& ref) { trackRef_ = ref; } - const TrackRef& track() const { return trackRef_; } - void setTrack(const TrackRef& ref) { trackRef_ = ref; } + /// eta coordinate propagated at the calorimeter surface used for track-cluster matching + float caloEta() const { return caloEta_; } + /// phi coordinate propagated at the calorimeter surface used for track-cluster matching + float caloPhi() const { return caloPhi_; } + void setCaloEtaPhi(float eta, float phi) { + caloEta_ = eta; + caloPhi_ = phi; + } - /// eta coordinate propagated at the calorimeter surface used for track-cluster matching - float caloEta() const { return caloEta_; } - /// phi coordinate propagated at the calorimeter surface used for track-cluster matching - float caloPhi() const { return caloPhi_; } - void setCaloEtaPhi(float eta, float phi) { - caloEta_ = eta; - caloPhi_ = phi; - } + /// uncertainty on track pt + float trkPtError() const { return trkPtError_; } + void setTrkPtError(float ptErr) { trkPtError_ = ptErr; } - /// uncertainty on track pt - float trkPtError() const { return trkPtError_; } - void setTrkPtError(float ptErr) { trkPtError_ = ptErr; } + /// uncertainty on calorimetric response for a hadron with pt equal to this track's pt + float caloPtError() const { return caloPtError_; } + void setCaloPtError(float ptErr) { caloPtError_ = ptErr; } - /// uncertainty on calorimetric response for a hadron with pt equal to this track's pt - float caloPtError() const { return caloPtError_; } - void setCaloPtError(float ptErr) { caloPtError_ = ptErr; } + bool isMuon() const override { return isMuon_; } + void setIsMuon(bool isMuon) { isMuon_ = isMuon; } - bool isMuon() const override { return isMuon_; } - void setIsMuon(bool isMuon) { isMuon_ = isMuon; } + int quality() const { return hwQual(); } + void setQuality(int quality) { setHwQual(quality); } - int quality() const { return hwQual(); } - void setQuality(int quality) { setHwQual(quality); } + unsigned int nPar() const { return nPar_; } + unsigned int nStubs() const { return track()->getStubRefs().size(); } + float normalizedChi2() const { return track()->chi2Red(); } + float chi2() const { return track()->chi2(); } - unsigned int nPar() const { return nPar_; } - unsigned int nStubs() const { return track()->getStubRefs().size(); } - float normalizedChi2() const { return track()->chi2Red(); } - float chi2() const { return track()->chi2(); } - - const TTTrack_TrackWord& trackWord() const { return trackWord_; } - TTTrack_TrackWord& trackWord() { return trackWord_; } - - private: - TrackRef trackRef_; - float caloEta_, caloPhi_; - float trkPtError_; - float caloPtError_; - bool isMuon_; - unsigned int nPar_; - TTTrack_TrackWord trackWord_; - }; + const TTTrack_TrackWord& trackWord() const { return trackWord_; } + TTTrack_TrackWord& trackWord() { return trackWord_; } + private: + TrackRef trackRef_; + float caloEta_, caloPhi_; + float trkPtError_; + float caloPtError_; + bool isMuon_; + unsigned int nPar_; + TTTrack_TrackWord trackWord_; + }; + } // namespace io_v1 + using PFTrack = io_v1::PFTrack; typedef std::vector PFTrackCollection; typedef edm::Ref PFTrackRef; typedef edm::RefVector PFTrackRefVector; diff --git a/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h b/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h index 6043dbfafff91..49eb68927e63a 100644 --- a/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h +++ b/DataFormats/L1TParticleFlow/interface/PFTrackFwd.h @@ -2,6 +2,9 @@ #define DataFormats_L1TParticleFlow_PFTrackFwd_h namespace l1t { - class PFTrack; -} + namespace io_v1 { + class PFTrack; + } + using PFTrack = io_v1::PFTrack; +} // namespace l1t #endif diff --git a/DataFormats/L1TParticleFlow/interface/jets.h b/DataFormats/L1TParticleFlow/interface/jets.h index 9a49248309765..c9a3e399bb86b 100644 --- a/DataFormats/L1TParticleFlow/interface/jets.h +++ b/DataFormats/L1TParticleFlow/interface/jets.h @@ -12,53 +12,59 @@ namespace l1ct { - // all possible tag categories (can be extended for new / separate taggers) - class JetTagClass { - public: - enum JetTagClassValue : uint8_t { b, c, uds, g, tau_p, tau_n, mu, e }; - JetTagClass() = default; - JetTagClass(JetTagClassValue aJetTagClassValue) : value_(aJetTagClassValue) {} - JetTagClass(std::string aJetTagClassValueString) { - auto it = labels_.find(aJetTagClassValueString); - if (it != labels_.end()) { - value_ = it->second; - } else { - // TODO throw an error - value_ = JetTagClass::JetTagClassValue::uds; + namespace io_v1 { + + // all possible tag categories (can be extended for new / separate taggers) + class JetTagClass { + public: + enum JetTagClassValue : uint8_t { b, c, uds, g, tau_p, tau_n, mu, e }; + JetTagClass() = default; + JetTagClass(JetTagClassValue aJetTagClassValue) : value_(aJetTagClassValue) {} + JetTagClass(std::string aJetTagClassValueString) { + auto it = labels_.find(aJetTagClassValueString); + if (it != labels_.end()) { + value_ = it->second; + } else { + // TODO throw an error + value_ = JetTagClass::JetTagClassValue::uds; + } } - } - inline bool operator==(const JetTagClass &other) const { return value_ == other.value_; } + inline bool operator==(const JetTagClass &other) const { return value_ == other.value_; } - private: - JetTagClassValue value_; - static const std::unordered_map labels_; + private: + JetTagClassValue value_; + static const std::unordered_map labels_; - friend std::ostream &operator<<(std::ostream &ost, const l1ct::JetTagClass &jtc) { - auto it = std::find_if( - std::begin(jtc.labels_), std::end(jtc.labels_), [&jtc](auto &&p) { return p.second == jtc.value_; }); - if (it != std::end(jtc.labels_)) { - ost << it->first; + friend std::ostream &operator<<(std::ostream &ost, const l1ct::io_v1::JetTagClass &jtc) { + auto it = std::find_if( + std::begin(jtc.labels_), std::end(jtc.labels_), [&jtc](auto &&p) { return p.second == jtc.value_; }); + if (it != std::end(jtc.labels_)) { + ost << it->first; + } + return ost; } - return ost; - } - }; // JetTagClass + }; // JetTagClass - // Define a separate class/struct for jet tag handling - struct JetTagClassHandler { - static const unsigned NTagFields = 8; - static const JetTagClass tagClassesDefault_[NTagFields]; + // Define a separate class/struct for jet tag handling + struct JetTagClassHandler { + static const unsigned NTagFields = 8; + static const JetTagClass tagClassesDefault_[NTagFields]; - JetTagClass tagClassesArray[NTagFields]; + JetTagClass tagClassesArray[NTagFields]; - JetTagClassHandler() { - // Copy the default values to the array - for (unsigned i = 0; i < NTagFields; i++) { - tagClassesArray[i] = tagClassesDefault_[i]; + JetTagClassHandler() { + // Copy the default values to the array + for (unsigned i = 0; i < NTagFields; i++) { + tagClassesArray[i] = tagClassesDefault_[i]; + } } - } - }; + }; + + } // namespace io_v1 + using JetTagClass = io_v1::JetTagClass; + using JetTagClassHandler = io_v1::JetTagClassHandler; struct Jet { pt_t hwPt; diff --git a/DataFormats/L1TParticleFlow/interface/layer1_emulator.h b/DataFormats/L1TParticleFlow/interface/layer1_emulator.h index 22ae2df1758a9..3ae30b47236f3 100644 --- a/DataFormats/L1TParticleFlow/interface/layer1_emulator.h +++ b/DataFormats/L1TParticleFlow/interface/layer1_emulator.h @@ -12,16 +12,20 @@ #include "DataFormats/L1Trigger/interface/L1CandidateFwd.h" namespace l1t { - class PFCandidate; - class SAMuon; + namespace io_v1 { + class PFCandidate; + class SAMuon; + } // namespace io_v1 + using PFCandidate = io_v1::PFCandidate; + using SAMuon = io_v1::SAMuon; } // namespace l1t namespace l1ct { struct HadCaloObjEmu : public HadCaloObj { - const l1t::L1Candidate *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { HadCaloObj::clear(); src = nullptr; @@ -29,9 +33,9 @@ namespace l1ct { }; struct EmCaloObjEmu : public EmCaloObj { - const l1t::L1Candidate *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { EmCaloObj::clear(); src = nullptr; @@ -39,9 +43,9 @@ namespace l1ct { }; struct CommonCaloObjEmu : public CommonCaloObj { - const l1t::L1Candidate *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { CommonCaloObj::clear(); src = nullptr; @@ -51,9 +55,9 @@ namespace l1ct { struct TkObjEmu : public TkObj { uint16_t hwChi2; float simPt, simCaloEta, simCaloPhi, simVtxEta, simVtxPhi, simZ0, simD0; - const l1t::PFTrack *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::PFTrack* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { TkObj::clear(); src = nullptr; @@ -69,9 +73,9 @@ namespace l1ct { }; struct MuObjEmu : public MuObj { - const l1t::SAMuon *src = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::SAMuon* src = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { MuObj::clear(); src = nullptr; @@ -79,12 +83,12 @@ namespace l1ct { }; struct PFChargedObjEmu : public PFChargedObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFTrack *srcTrack = nullptr; - const l1t::SAMuon *srcMu = nullptr; - const l1t::PFCandidate *srcCand = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFTrack* srcTrack = nullptr; + const l1t::SAMuon* srcMu = nullptr; + const l1t::PFCandidate* srcCand = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { PFChargedObj::clear(); srcCluster = nullptr; @@ -95,10 +99,10 @@ namespace l1ct { }; struct PFNeutralObjEmu : public PFNeutralObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFCandidate *srcCand = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFCandidate* srcCand = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { PFNeutralObj::clear(); srcCluster = nullptr; @@ -117,17 +121,17 @@ namespace l1ct { float localEta(float globalEta) const; float localPhi(float globalPhi) const; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; }; struct PuppiObjEmu : public PuppiObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFTrack *srcTrack = nullptr; - const l1t::SAMuon *srcMu = nullptr; - const l1t::PFCandidate *srcCand = nullptr; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFTrack* srcTrack = nullptr; + const l1t::SAMuon* srcMu = nullptr; + const l1t::PFCandidate* srcCand = nullptr; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { PuppiObj::clear(); srcCluster = nullptr; @@ -135,21 +139,21 @@ namespace l1ct { srcMu = nullptr; srcCand = nullptr; } - inline void fill(const PFRegionEmu ®ion, const PFChargedObjEmu &src) { + inline void fill(const PFRegionEmu& region, const PFChargedObjEmu& src) { PuppiObj::fill(region, src); srcCluster = src.srcCluster; srcTrack = src.srcTrack; srcMu = src.srcMu; srcCand = src.srcCand; } - inline void fill(const PFRegionEmu ®ion, const PFNeutralObjEmu &src, pt_t puppiPt, puppiWgt_t puppiWgt) { + inline void fill(const PFRegionEmu& region, const PFNeutralObjEmu& src, pt_t puppiPt, puppiWgt_t puppiWgt) { PuppiObj::fill(region, src, puppiPt, puppiWgt); srcCluster = src.srcCluster; srcTrack = nullptr; srcMu = nullptr; srcCand = src.srcCand; } - inline void fill(const PFRegionEmu ®ion, const HadCaloObjEmu &src, pt_t puppiPt, puppiWgt_t puppiWgt) { + inline void fill(const PFRegionEmu& region, const HadCaloObjEmu& src, pt_t puppiPt, puppiWgt_t puppiWgt) { PuppiObj::fill(region, src, puppiPt, puppiWgt); srcCluster = src.src; srcTrack = nullptr; @@ -159,7 +163,7 @@ namespace l1ct { }; struct EGObjEmu : public EGIsoObj { - const l1t::L1Candidate *srcCluster = nullptr; + const l1t::L1Candidate* srcCluster = nullptr; void clear() { srcCluster = nullptr; EGIsoObj::clear(); @@ -167,13 +171,13 @@ namespace l1ct { }; struct EGIsoObjEmu : public EGIsoObj { - const l1t::L1Candidate *srcCluster; + const l1t::L1Candidate* srcCluster; // NOTE: we use an index to the persistable RefPtr when we reshuffle collections // this way we avoid complex object in the object interface which needs to be used in standalone programs int src_idx; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { EGIsoObj::clear(); srcCluster = nullptr; @@ -203,14 +207,14 @@ namespace l1ct { }; struct EGIsoEleObjEmu : public EGIsoEleObj { - const l1t::L1Candidate *srcCluster = nullptr; - const l1t::PFTrack *srcTrack = nullptr; + const l1t::L1Candidate* srcCluster = nullptr; + const l1t::PFTrack* srcTrack = nullptr; // NOTE: we use an index to the persistable RefPtr when we reshuffle collections // this way we avoid complex object in the object interface which needs to be used in standalone programs int src_idx; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear() { EGIsoEleObj::clear(); srcCluster = nullptr; @@ -238,8 +242,8 @@ namespace l1ct { }; struct PVObjEmu : public PVObj { - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; }; template @@ -252,8 +256,8 @@ namespace l1ct { // convenience forwarding of some methods typedef typename std::vector::const_iterator const_iterator; typedef typename std::vector::iterator iterator; - inline const T &operator[](unsigned int i) const { return obj[i]; } - inline T &operator[](unsigned int i) { return obj[i]; } + inline const T& operator[](unsigned int i) const { return obj[i]; } + inline T& operator[](unsigned int i) { return obj[i]; } inline const_iterator begin() const { return obj.begin(); } inline iterator begin() { return obj.begin(); } inline const_iterator end() const { return obj.end(); } @@ -271,8 +275,8 @@ namespace l1ct { std::vector>> gctEm; // the 36 EM clusters from the GCT // (The trigger towers that follow the clusters are not included in the above data) - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -282,8 +286,8 @@ namespace l1ct { std::vector> track; DetectorSector muon; // muons are global - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -297,8 +301,8 @@ namespace l1ct { PFInputRegion() {} PFInputRegion(float etamin, float etamax, float phicenter, float phiwidth, float etaextra, float phiextra) : region(etamin, etamax, phicenter, phiwidth, etaextra, phiextra) {} - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -312,8 +316,8 @@ namespace l1ct { std::vector egphoton; std::vector egelectron; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); // for multiplicities @@ -331,7 +335,7 @@ namespace l1ct { egisoeleType = 9, nObjTypes = 10 }; - static constexpr const char *objTypeName[nObjTypes] = { + static constexpr const char* objTypeName[nObjTypes] = { "", "Charged", "Neutral", "Electron", "Muon", "ChargedHadron", "NeutralHadron", "Photon", "EGIso", "EGIsoEle"}; unsigned int nObj(ObjType type, bool puppi) const; }; @@ -344,8 +348,8 @@ namespace l1ct { std::vector egphoton; std::vector egelectron; - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); }; @@ -363,8 +367,8 @@ namespace l1ct { Event() : run(0), lumi(0), event(0) {} - bool read(std::fstream &from); - bool write(std::fstream &to) const; + bool read(std::fstream& from); + bool write(std::fstream& to) const; void clear(); void init(uint32_t run, uint32_t lumi, uint64_t event); inline l1ct::PVObjEmu pv(unsigned int ipv = 0) const { @@ -384,7 +388,7 @@ namespace l1ct { }; template - void toFirmware(const std::vector &in, unsigned int NMAX, T2 out[/*NMAX*/]) { + void toFirmware(const std::vector& in, unsigned int NMAX, T2 out[/*NMAX*/]) { unsigned int n = std::min(in.size(), NMAX); for (unsigned int i = 0; i < n; ++i) out[i] = in[i]; diff --git a/DataFormats/L1TParticleFlow/src/classes_def.xml b/DataFormats/L1TParticleFlow/src/classes_def.xml index e45d86590aa53..0bc23121ef7c3 100644 --- a/DataFormats/L1TParticleFlow/src/classes_def.xml +++ b/DataFormats/L1TParticleFlow/src/classes_def.xml @@ -1,21 +1,16 @@ - - - - - - + + - - - - + + + @@ -23,13 +18,8 @@ - - - - - - - + + @@ -39,31 +29,17 @@ - - - setCaloPtr(edm::refToPtr(onfile.clusterRef_)); - ]]> - - - - - - - - - + + - + - - - - + + @@ -71,11 +47,8 @@ - - - - - + + diff --git a/DataFormats/L1TParticleFlow/src/jets.cpp b/DataFormats/L1TParticleFlow/src/jets.cpp index 3c585c70fe987..7d855303a43b0 100644 --- a/DataFormats/L1TParticleFlow/src/jets.cpp +++ b/DataFormats/L1TParticleFlow/src/jets.cpp @@ -1,20 +1,21 @@ #include "DataFormats/L1TParticleFlow/interface/jets.h" -const std::unordered_map l1ct::JetTagClass::labels_ = { - {"b", l1ct::JetTagClass::JetTagClassValue::b}, - {"c", l1ct::JetTagClass::JetTagClassValue::c}, - {"uds", l1ct::JetTagClass::JetTagClassValue::uds}, - {"g", l1ct::JetTagClass::JetTagClassValue::g}, - {"tau_p", l1ct::JetTagClass::JetTagClassValue::tau_p}, - {"tau_n", l1ct::JetTagClass::JetTagClassValue::tau_n}, - {"mu", l1ct::JetTagClass::JetTagClassValue::mu}, - {"e", l1ct::JetTagClass::JetTagClassValue::e}}; +const std::unordered_map l1ct::io_v1::JetTagClass::labels_ = { + {"b", l1ct::io_v1::JetTagClass::JetTagClassValue::b}, + {"c", l1ct::io_v1::JetTagClass::JetTagClassValue::c}, + {"uds", l1ct::io_v1::JetTagClass::JetTagClassValue::uds}, + {"g", l1ct::io_v1::JetTagClass::JetTagClassValue::g}, + {"tau_p", l1ct::io_v1::JetTagClass::JetTagClassValue::tau_p}, + {"tau_n", l1ct::io_v1::JetTagClass::JetTagClassValue::tau_n}, + {"mu", l1ct::io_v1::JetTagClass::JetTagClassValue::mu}, + {"e", l1ct::io_v1::JetTagClass::JetTagClassValue::e}}; -const l1ct::JetTagClass l1ct::JetTagClassHandler::tagClassesDefault_[NTagFields] = {l1ct::JetTagClass("b"), - l1ct::JetTagClass("c"), - l1ct::JetTagClass("uds"), - l1ct::JetTagClass("g"), - l1ct::JetTagClass("tau_p"), - l1ct::JetTagClass("tau_n"), - l1ct::JetTagClass("mu"), - l1ct::JetTagClass("e")}; +const l1ct::io_v1::JetTagClass l1ct::io_v1::JetTagClassHandler::tagClassesDefault_[NTagFields] = { + l1ct::io_v1::JetTagClass("b"), + l1ct::io_v1::JetTagClass("c"), + l1ct::io_v1::JetTagClass("uds"), + l1ct::io_v1::JetTagClass("g"), + l1ct::io_v1::JetTagClass("tau_p"), + l1ct::io_v1::JetTagClass("tau_n"), + l1ct::io_v1::JetTagClass("mu"), + l1ct::io_v1::JetTagClass("e")}; diff --git a/DataFormats/L1TrackTrigger/src/classes_def.xml b/DataFormats/L1TrackTrigger/src/classes_def.xml index 3cccc46c8db6f..ea05eea555e9c 100644 --- a/DataFormats/L1TrackTrigger/src/classes_def.xml +++ b/DataFormats/L1TrackTrigger/src/classes_def.xml @@ -24,16 +24,8 @@ - - - - - - + + diff --git a/DataFormats/L1Trigger/interface/EGamma.h b/DataFormats/L1Trigger/interface/EGamma.h index a94949770e485..164bb1a3cf811 100644 --- a/DataFormats/L1Trigger/interface/EGamma.h +++ b/DataFormats/L1Trigger/interface/EGamma.h @@ -7,64 +7,65 @@ namespace l1t { - class EGamma; - typedef BXVector EGammaBxCollection; - typedef edm::Ref EGammaRef; - typedef edm::RefVector EGammaRefVector; - typedef std::vector EGammaVectorRef; - - typedef ObjectRefBxCollection EGammaRefBxCollection; - typedef ObjectRefPair EGammaRefPair; - typedef ObjectRefPairBxCollection EGammaRefPairBxCollection; + namespace io_v1 { + class EGamma : public L1Candidate { + public: + EGamma() { clear_extended(); } - class EGamma : public L1Candidate { - public: - EGamma() { clear_extended(); } + // ctor from base allowed, but note that extended variables will be set to zero: + EGamma(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } - // ctor from base allowed, but note that extended variables will be set to zero: - EGamma(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } + EGamma(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - EGamma(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + EGamma(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - EGamma(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + ~EGamma() override; - ~EGamma() override; + void setTowerIEta(short int ieta); // ieta of seed tower + void setTowerIPhi(short int iphi); // iphi of seed tower + void setRawEt(short int pt); // raw (uncalibrated) cluster sum + void setIsoEt(short int iso); // raw isolation sum - cluster sum + void setFootprintEt(short int fp); // raw footprint + void setNTT(short int ntt); // n towers above threshold + void setShape(short int s); // cluster shape variable + void setTowerHoE(short int HoE); // H/E as computed in Layer-1 - void setTowerIEta(short int ieta); // ieta of seed tower - void setTowerIPhi(short int iphi); // iphi of seed tower - void setRawEt(short int pt); // raw (uncalibrated) cluster sum - void setIsoEt(short int iso); // raw isolation sum - cluster sum - void setFootprintEt(short int fp); // raw footprint - void setNTT(short int ntt); // n towers above threshold - void setShape(short int s); // cluster shape variable - void setTowerHoE(short int HoE); // H/E as computed in Layer-1 + short int towerIEta() const; + short int towerIPhi() const; + short int rawEt() const; + short int isoEt() const; + short int footprintEt() const; + short int nTT() const; + short int shape() const; + short int towerHoE() const; - short int towerIEta() const; - short int towerIPhi() const; - short int rawEt() const; - short int isoEt() const; - short int footprintEt() const; - short int nTT() const; - short int shape() const; - short int towerHoE() const; + bool operator==(const l1t::io_v1::EGamma& rhs) const; + inline bool operator!=(const l1t::io_v1::EGamma& rhs) const { return !(operator==(rhs)); }; - bool operator==(const l1t::EGamma& rhs) const; - inline bool operator!=(const l1t::EGamma& rhs) const { return !(operator==(rhs)); }; + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global EG + void clear_extended(); + short int towerIEta_; + short int towerIPhi_; + short int rawEt_; + short int isoEt_; + short int footprintEt_; + short int nTT_; + short int shape_; + short int towerHoE_; + }; + } // namespace io_v1 + using EGamma = io_v1::EGamma; + typedef BXVector EGammaBxCollection; + typedef edm::Ref EGammaRef; + typedef edm::RefVector EGammaRefVector; + typedef std::vector EGammaVectorRef; - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global EG - void clear_extended(); - short int towerIEta_; - short int towerIPhi_; - short int rawEt_; - short int isoEt_; - short int footprintEt_; - short int nTT_; - short int shape_; - short int towerHoE_; - }; + typedef ObjectRefBxCollection EGammaRefBxCollection; + typedef ObjectRefPair EGammaRefPair; + typedef ObjectRefPairBxCollection EGammaRefPairBxCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/EtSum.h b/DataFormats/L1Trigger/interface/EtSum.h index ed359c85826a7..7eb1a9f329443 100644 --- a/DataFormats/L1Trigger/interface/EtSum.h +++ b/DataFormats/L1Trigger/interface/EtSum.h @@ -7,7 +7,69 @@ namespace l1t { - class EtSum; + namespace io_v1 { + class EtSum : public L1Candidate { + public: + enum EtSumType { + kTotalEt, + kTotalHt, + kMissingEt, + kMissingHt, + kTotalEtx, + kTotalEty, + kTotalHtx, + kTotalHty, + kMissingEtHF, + kTotalEtxHF, + kTotalEtyHF, + kMinBiasHFP0, + kMinBiasHFM0, + kMinBiasHFP1, + kMinBiasHFM1, + kTotalEtHF, + kTotalEtEm, + kTotalHtHF, + kTotalHtxHF, + kTotalHtyHF, + kMissingHtHF, + kTowerCount, + kCentrality, + kAsymEt, + kAsymHt, + kAsymEtHF, + kAsymHtHF, + kZDCP, + kZDCM, + kUninitialized + }; + + EtSum() : type_{kUninitialized} {} + explicit EtSum(EtSumType type) : type_{type} {} + + EtSum(const LorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + + EtSum(const PolarLorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + + ~EtSum() override; + + void setType(EtSumType type); + + EtSumType getType() const; + + bool operator==(const l1t::io_v1::EtSum& rhs) const; + inline bool operator!=(const l1t::io_v1::EtSum& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // type of EtSum + EtSumType type_; + + // additional hardware quantities common to L1 global EtSum + // there are currently none + }; + } // namespace io_v1 + using EtSum = io_v1::EtSum; typedef BXVector EtSumBxCollection; typedef edm::Ref EtSumRef; typedef edm::RefVector EtSumRefVector; @@ -22,67 +84,6 @@ namespace l1t { typedef ObjectRefPair EtSumRefPair; typedef ObjectRefPairBxCollection EtSumRefPairBxCollection; - class EtSum : public L1Candidate { - public: - enum EtSumType { - kTotalEt, - kTotalHt, - kMissingEt, - kMissingHt, - kTotalEtx, - kTotalEty, - kTotalHtx, - kTotalHty, - kMissingEtHF, - kTotalEtxHF, - kTotalEtyHF, - kMinBiasHFP0, - kMinBiasHFM0, - kMinBiasHFP1, - kMinBiasHFM1, - kTotalEtHF, - kTotalEtEm, - kTotalHtHF, - kTotalHtxHF, - kTotalHtyHF, - kMissingHtHF, - kTowerCount, - kCentrality, - kAsymEt, - kAsymHt, - kAsymEtHF, - kAsymHtHF, - kZDCP, - kZDCM, - kUninitialized - }; - - EtSum() : type_{kUninitialized} {} - explicit EtSum(EtSumType type) : type_{type} {} - - EtSum(const LorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - - EtSum(const PolarLorentzVector& p4, EtSumType type, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - - ~EtSum() override; - - void setType(EtSumType type); - - EtSumType getType() const; - - bool operator==(const l1t::EtSum& rhs) const; - inline bool operator!=(const l1t::EtSum& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // type of EtSum - EtSumType type_; - - // additional hardware quantities common to L1 global EtSum - // there are currently none - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/Jet.h b/DataFormats/L1Trigger/interface/Jet.h index 855f5ea118e0e..aa22ef1588956 100644 --- a/DataFormats/L1Trigger/interface/Jet.h +++ b/DataFormats/L1Trigger/interface/Jet.h @@ -6,8 +6,47 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { - - class Jet; + namespace io_v1 { + class Jet : public L1Candidate { + public: + Jet() { clear_extended(); } + Jet(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + Jet(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); + + ~Jet() override; + + void setTowerIEta(short int ieta); // ieta of seed tower + void setTowerIPhi(short int iphi); // iphi of seed tower + void setRawEt(short int et); // raw (uncalibrated) cluster sum + void setSeedEt(short int et); + void setPUEt(short int et); + void setPUDonutEt(unsigned int i, short int et); + + short int towerIEta() const; + short int towerIPhi() const; + short int rawEt() const; + short int seedEt() const; + short int puEt() const; + short int puDonutEt(int i) const; + + bool operator==(const l1t::io_v1::Jet& rhs) const; + inline bool operator!=(const l1t::io_v1::Jet& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global jet + void clear_extended(); + short int towerIEta_; + short int towerIPhi_; + short int rawEt_; + short int seedEt_; + short int puEt_; + short int puDonutEt_[4]; + }; + + } // namespace io_v1 + using Jet = io_v1::Jet; typedef BXVector JetBxCollection; typedef edm::Ref JetRef; typedef edm::RefVector JetRefVector; @@ -17,44 +56,6 @@ namespace l1t { typedef ObjectRefPair JetRefPair; typedef ObjectRefPairBxCollection JetRefPairBxCollection; - class Jet : public L1Candidate { - public: - Jet() { clear_extended(); } - Jet(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - Jet(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0); - - ~Jet() override; - - void setTowerIEta(short int ieta); // ieta of seed tower - void setTowerIPhi(short int iphi); // iphi of seed tower - void setRawEt(short int et); // raw (uncalibrated) cluster sum - void setSeedEt(short int et); - void setPUEt(short int et); - void setPUDonutEt(unsigned int i, short int et); - - short int towerIEta() const; - short int towerIPhi() const; - short int rawEt() const; - short int seedEt() const; - short int puEt() const; - short int puDonutEt(int i) const; - - bool operator==(const l1t::Jet& rhs) const; - inline bool operator!=(const l1t::Jet& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global jet - void clear_extended(); - short int towerIEta_; - short int towerIPhi_; - short int rawEt_; - short int seedEt_; - short int puEt_; - short int puDonutEt_[4]; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/L1Candidate.h b/DataFormats/L1Trigger/interface/L1Candidate.h index 27aeb4688f830..fdb98890742bb 100644 --- a/DataFormats/L1Trigger/interface/L1Candidate.h +++ b/DataFormats/L1Trigger/interface/L1Candidate.h @@ -5,51 +5,51 @@ #include "DataFormats/L1Trigger/interface/BXVector.h" namespace l1t { - class L1Candidate; + namespace io_v1 { + // All L1 data formats which encode physically meaningful quantities inherit from Candidate + class L1Candidate : public reco::LeafCandidate { + public: + L1Candidate(); + + // construct from *both* physical and integer values + L1Candidate(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + + L1Candidate(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + + ~L1Candidate() override; + + // methods to set integer values + // in general, these should not be needed + void setHwPt(int pt) { hwPt_ = pt; } + void setHwEta(int eta) { hwEta_ = eta; } + void setHwPhi(int phi) { hwPhi_ = phi; } + void setHwQual(int qual) { hwQual_ = qual; } + void setHwIso(int iso) { hwIso_ = iso; } + + // methods to retrieve integer values + int hwPt() const { return hwPt_; } + int hwEta() const { return hwEta_; } + int hwPhi() const { return hwPhi_; } + int hwQual() const { return hwQual_; } + int hwIso() const { return hwIso_; } + + virtual bool operator==(const l1t::io_v1::L1Candidate& rhs) const; + virtual inline bool operator!=(const l1t::io_v1::L1Candidate& rhs) const { return !(operator==(rhs)); }; + + private: + // integer "hardware" values + int hwPt_; + int hwEta_; + int hwPhi_; + int hwQual_; + int hwIso_; + }; + } // namespace io_v1 + using L1Candidate = io_v1::L1Candidate; typedef BXVector L1CandidateBxCollection; typedef edm::Ref L1CandidateRef; typedef edm::RefVector L1CandidateRefVector; typedef std::vector L1CandidateVectorRef; - - // All L1 data formats which encode physically meaningful quantities inherit from Candidate - class L1Candidate : public reco::LeafCandidate { - public: - L1Candidate(); - - // construct from *both* physical and integer values - L1Candidate(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - - L1Candidate(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - - ~L1Candidate() override; - - // methods to set integer values - // in general, these should not be needed - void setHwPt(int pt) { hwPt_ = pt; } - void setHwEta(int eta) { hwEta_ = eta; } - void setHwPhi(int phi) { hwPhi_ = phi; } - void setHwQual(int qual) { hwQual_ = qual; } - void setHwIso(int iso) { hwIso_ = iso; } - - // methods to retrieve integer values - int hwPt() const { return hwPt_; } - int hwEta() const { return hwEta_; } - int hwPhi() const { return hwPhi_; } - int hwQual() const { return hwQual_; } - int hwIso() const { return hwIso_; } - - virtual bool operator==(const l1t::L1Candidate& rhs) const; - virtual inline bool operator!=(const l1t::L1Candidate& rhs) const { return !(operator==(rhs)); }; - - private: - // integer "hardware" values - int hwPt_; - int hwEta_; - int hwPhi_; - int hwQual_; - int hwIso_; - }; - }; // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/L1CandidateFwd.h b/DataFormats/L1Trigger/interface/L1CandidateFwd.h index 9975c4e1ac577..d060cad54c367 100644 --- a/DataFormats/L1Trigger/interface/L1CandidateFwd.h +++ b/DataFormats/L1Trigger/interface/L1CandidateFwd.h @@ -2,6 +2,9 @@ #define DataFormats_L1Trigger_L1CandidateFwd_h namespace l1t { - class L1Candidate; -} + namespace io_v1 { + class L1Candidate; + } + using L1Candidate = io_v1::L1Candidate; +} // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/L1TriggerError.h b/DataFormats/L1Trigger/interface/L1TriggerError.h index fadd370fbc9f0..bb87cd3dde2d2 100644 --- a/DataFormats/L1Trigger/interface/L1TriggerError.h +++ b/DataFormats/L1Trigger/interface/L1TriggerError.h @@ -15,30 +15,32 @@ // Original Author: Jim Brooke // Created: // +namespace io_v1 { + class L1TriggerError { + public: + /// construct from an error code + explicit L1TriggerError(unsigned short prodID = 0, unsigned short code = 0); -class L1TriggerError { -public: - /// construct from an error code - explicit L1TriggerError(unsigned short prodID = 0, unsigned short code = 0); + /// dtor + ~L1TriggerError(); - /// dtor - ~L1TriggerError(); + /// set error + void setCode(int code) { code_ = code; } - /// set error - void setCode(int code) { code_ = code; } + /// get error + unsigned code() { return code_; } - /// get error - unsigned code() { return code_; } + /// producer ID + unsigned prodID(); - /// producer ID - unsigned prodID(); + /// producer error + unsigned prodErr(); - /// producer error - unsigned prodErr(); - -private: - unsigned code_; -}; + private: + unsigned code_; + }; +} // namespace io_v1 +using L1TriggerError = io_v1::L1TriggerError; #include diff --git a/DataFormats/L1Trigger/interface/Muon.h b/DataFormats/L1Trigger/interface/Muon.h index 148325be95648..a5e52cfc22432 100644 --- a/DataFormats/L1Trigger/interface/Muon.h +++ b/DataFormats/L1Trigger/interface/Muon.h @@ -7,8 +7,135 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { - - class Muon; + namespace io_v1 { + class Muon : public L1Candidate { + public: + Muon(); + + Muon(const LorentzVector& p4, + int pt = 0, + int eta = 0, + int phi = 0, + int qual = 0, + int charge = 0, + int chargeValid = 0, + int iso = 0, + int tfMuonIndex = -1, + int tag = 0, + bool debug = false, + int isoSum = 0, + int dPhi = 0, + int dEta = 0, + int rank = 0, + int hwEtaAtVtx = 0, + int hwPhiAtVtx = 0, + double etaAtVtx = 0., + double phiAtVtx = 0., + int hwPtUnconstrained = 0, + double ptUnconstrained = 0., + int dXY = 0); + + Muon(const PolarLorentzVector& p4, + int pt = 0, + int eta = 0, + int phi = 0, + int qual = 0, + int charge = 0, + int chargeValid = 0, + int iso = 0, + int tfMuonIndex = -1, + int tag = 0, + bool debug = false, + int isoSum = 0, + int dPhi = 0, + int dEta = 0, + int rank = 0, + int hwEtaAtVtx = 0, + int hwPhiAtVtx = 0, + double etaAtVtx = 0., + double phiAtVtx = 0., + int hwPtUnconstrained = 0, + double ptUnconstrained = 0., + int dXY = 0); + + ~Muon() override; + + // set values + inline void setHwCharge(int charge) { hwCharge_ = charge; }; + inline void setHwChargeValid(int valid) { hwChargeValid_ = valid; }; + inline void setTfMuonIndex(int index) { tfMuonIndex_ = index; }; + inline void setHwTag(int tag) { hwTag_ = tag; }; + + inline void setHwEtaAtVtx(int hwEtaAtVtx) { hwEtaAtVtx_ = hwEtaAtVtx; }; + inline void setHwPhiAtVtx(int hwPhiAtVtx) { hwPhiAtVtx_ = hwPhiAtVtx; }; + inline void setEtaAtVtx(double etaAtVtx) { etaAtVtx_ = etaAtVtx; }; + inline void setPhiAtVtx(double phiAtVtx) { phiAtVtx_ = phiAtVtx; }; + + inline void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }; + inline void setHwDPhiExtra(int dPhi) { hwDPhiExtra_ = dPhi; }; + inline void setHwDEtaExtra(int dEta) { hwDEtaExtra_ = dEta; }; + inline void setHwRank(int rank) { hwRank_ = rank; }; + + inline void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }; + inline void setPtUnconstrained(double ptUnconstrained) { ptUnconstrained_ = ptUnconstrained; }; + inline void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }; + + inline void setDebug(bool debug) { debug_ = debug; }; + + // methods to retrieve values + inline int hwCharge() const { return hwCharge_; }; + inline int hwChargeValid() const { return hwChargeValid_; }; + inline int tfMuonIndex() const { return tfMuonIndex_; }; + inline int hwTag() const { return hwTag_; }; + + inline int hwEtaAtVtx() const { return hwEtaAtVtx_; }; + inline int hwPhiAtVtx() const { return hwPhiAtVtx_; }; + inline double etaAtVtx() const { return etaAtVtx_; }; + inline double phiAtVtx() const { return phiAtVtx_; }; + + inline int hwIsoSum() const { return hwIsoSum_; }; + inline int hwDPhiExtra() const { return hwDPhiExtra_; }; + inline int hwDEtaExtra() const { return hwDEtaExtra_; }; + inline int hwRank() const { return hwRank_; }; + + inline int hwPtUnconstrained() const { return hwPtUnconstrained_; }; + inline double ptUnconstrained() const { return ptUnconstrained_; }; + inline int hwDXY() const { return hwDXY_; }; + + inline bool debug() const { return debug_; }; + + bool operator==(const l1t::io_v1::Muon& rhs) const; + inline bool operator!=(const l1t::io_v1::Muon& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global jet + int hwCharge_; + int hwChargeValid_; + int tfMuonIndex_; + int hwTag_; + + // additional hardware quantities only available if debug flag is set + bool debug_; + int hwIsoSum_; + int hwDPhiExtra_; + int hwDEtaExtra_; + int hwRank_; + + // muon coordinates at the vertex + int hwEtaAtVtx_; + int hwPhiAtVtx_; + double etaAtVtx_; + double phiAtVtx_; + + // displacement information + int hwPtUnconstrained_; + double ptUnconstrained_; + int hwDXY_; + }; + } // namespace io_v1 + using Muon = io_v1::Muon; typedef BXVector MuonBxCollection; typedef edm::Ref MuonRef; typedef edm::RefVector MuonRefVector; @@ -18,133 +145,6 @@ namespace l1t { typedef ObjectRefPair MuonRefPair; typedef ObjectRefPairBxCollection MuonRefPairBxCollection; - class Muon : public L1Candidate { - public: - Muon(); - - Muon(const LorentzVector& p4, - int pt = 0, - int eta = 0, - int phi = 0, - int qual = 0, - int charge = 0, - int chargeValid = 0, - int iso = 0, - int tfMuonIndex = -1, - int tag = 0, - bool debug = false, - int isoSum = 0, - int dPhi = 0, - int dEta = 0, - int rank = 0, - int hwEtaAtVtx = 0, - int hwPhiAtVtx = 0, - double etaAtVtx = 0., - double phiAtVtx = 0., - int hwPtUnconstrained = 0, - double ptUnconstrained = 0., - int dXY = 0); - - Muon(const PolarLorentzVector& p4, - int pt = 0, - int eta = 0, - int phi = 0, - int qual = 0, - int charge = 0, - int chargeValid = 0, - int iso = 0, - int tfMuonIndex = -1, - int tag = 0, - bool debug = false, - int isoSum = 0, - int dPhi = 0, - int dEta = 0, - int rank = 0, - int hwEtaAtVtx = 0, - int hwPhiAtVtx = 0, - double etaAtVtx = 0., - double phiAtVtx = 0., - int hwPtUnconstrained = 0, - double ptUnconstrained = 0., - int dXY = 0); - - ~Muon() override; - - // set values - inline void setHwCharge(int charge) { hwCharge_ = charge; }; - inline void setHwChargeValid(int valid) { hwChargeValid_ = valid; }; - inline void setTfMuonIndex(int index) { tfMuonIndex_ = index; }; - inline void setHwTag(int tag) { hwTag_ = tag; }; - - inline void setHwEtaAtVtx(int hwEtaAtVtx) { hwEtaAtVtx_ = hwEtaAtVtx; }; - inline void setHwPhiAtVtx(int hwPhiAtVtx) { hwPhiAtVtx_ = hwPhiAtVtx; }; - inline void setEtaAtVtx(double etaAtVtx) { etaAtVtx_ = etaAtVtx; }; - inline void setPhiAtVtx(double phiAtVtx) { phiAtVtx_ = phiAtVtx; }; - - inline void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; }; - inline void setHwDPhiExtra(int dPhi) { hwDPhiExtra_ = dPhi; }; - inline void setHwDEtaExtra(int dEta) { hwDEtaExtra_ = dEta; }; - inline void setHwRank(int rank) { hwRank_ = rank; }; - - inline void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }; - inline void setPtUnconstrained(double ptUnconstrained) { ptUnconstrained_ = ptUnconstrained; }; - inline void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }; - - inline void setDebug(bool debug) { debug_ = debug; }; - - // methods to retrieve values - inline int hwCharge() const { return hwCharge_; }; - inline int hwChargeValid() const { return hwChargeValid_; }; - inline int tfMuonIndex() const { return tfMuonIndex_; }; - inline int hwTag() const { return hwTag_; }; - - inline int hwEtaAtVtx() const { return hwEtaAtVtx_; }; - inline int hwPhiAtVtx() const { return hwPhiAtVtx_; }; - inline double etaAtVtx() const { return etaAtVtx_; }; - inline double phiAtVtx() const { return phiAtVtx_; }; - - inline int hwIsoSum() const { return hwIsoSum_; }; - inline int hwDPhiExtra() const { return hwDPhiExtra_; }; - inline int hwDEtaExtra() const { return hwDEtaExtra_; }; - inline int hwRank() const { return hwRank_; }; - - inline int hwPtUnconstrained() const { return hwPtUnconstrained_; }; - inline double ptUnconstrained() const { return ptUnconstrained_; }; - inline int hwDXY() const { return hwDXY_; }; - - inline bool debug() const { return debug_; }; - - bool operator==(const l1t::Muon& rhs) const; - inline bool operator!=(const l1t::Muon& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global jet - int hwCharge_; - int hwChargeValid_; - int tfMuonIndex_; - int hwTag_; - - // additional hardware quantities only available if debug flag is set - bool debug_; - int hwIsoSum_; - int hwDPhiExtra_; - int hwDEtaExtra_; - int hwRank_; - - // muon coordinates at the vertex - int hwEtaAtVtx_; - int hwPhiAtVtx_; - double etaAtVtx_; - double phiAtVtx_; - - // displacement information - int hwPtUnconstrained_; - double ptUnconstrained_; - int hwDXY_; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/MuonShower.h b/DataFormats/L1Trigger/interface/MuonShower.h index cb3fd7a7c6b09..2541ec1f960e9 100644 --- a/DataFormats/L1Trigger/interface/MuonShower.h +++ b/DataFormats/L1Trigger/interface/MuonShower.h @@ -14,30 +14,20 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { - - class MuonShower; - typedef BXVector MuonShowerBxCollection; - typedef edm::Ref MuonShowerRef; - typedef edm::RefVector MuonShowerRefVector; - typedef std::vector MuonShowerVectorRef; - - typedef ObjectRefBxCollection MuonShowerRefBxCollection; - typedef ObjectRefPair MuonShowerRefPair; - typedef ObjectRefPairBxCollection MuonShowerRefPairBxCollection; - - class MuonShower : public L1Candidate { - public: - MuonShower(bool oneNominalInTime = false, - bool oneNominalOutOfTime = false, - bool twoLooseInTime = false, - bool twoLooseOutOfTime = false, - bool oneTightInTime = false, - bool oneTightOutOfTime = false, - bool twoLooseDiffSectorsIntime = false); - - ~MuonShower() override; - - /* + namespace io_v1 { + class MuonShower : public L1Candidate { + public: + MuonShower(bool oneNominalInTime = false, + bool oneNominalOutOfTime = false, + bool twoLooseInTime = false, + bool twoLooseOutOfTime = false, + bool oneTightInTime = false, + bool oneTightOutOfTime = false, + bool twoLooseDiffSectorsIntime = false); + + ~MuonShower() override; + + /* * We currently have three valid cases: * - 1 nominal shower (baseline trigger for physics at Run-3) * - 1 tight shower (backup trigger) @@ -57,42 +47,52 @@ namespace l1t { * - 2 loose showers in differnt sectors -> mus2 */ - void setOneNominalInTime(const bool bit) { oneNominalInTime_ = bit; } - void setOneTightInTime(const bool bit) { oneTightInTime_ = bit; } - void setTwoLooseDiffSectorsInTime(const bool bit) { twoLooseDiffSectorsInTime_ = bit; } - void setMusOutOfTime0(const bool bit) { musOutOfTime0_ = bit; } - void setMusOutOfTime1(const bool bit) { musOutOfTime1_ = bit; } - - bool isOneNominalInTime() const { return oneNominalInTime_; } - bool isOneTightInTime() const { return oneTightInTime_; } - bool isTwoLooseDiffSectorsInTime() const { return twoLooseDiffSectorsInTime_; } - bool musOutOfTime0() const { return musOutOfTime0_; } - bool musOutOfTime1() const { return musOutOfTime1_; } - - // at least one bit must be valid - bool isValid() const; - - // to be developed during Run-3 - bool isTwoLooseInTime() const { return false; } - // these options require more study - bool isOneNominalOutOfTime() const { return false; } - bool isTwoLooseOutOfTime() const { return false; } - bool isOneTightOutOfTime() const { return false; } - - bool operator==(const l1t::MuonShower& rhs) const; - inline bool operator!=(const l1t::MuonShower& rhs) const { return !(operator==(rhs)); }; + void setOneNominalInTime(const bool bit) { oneNominalInTime_ = bit; } + void setOneTightInTime(const bool bit) { oneTightInTime_ = bit; } + void setTwoLooseDiffSectorsInTime(const bool bit) { twoLooseDiffSectorsInTime_ = bit; } + void setMusOutOfTime0(const bool bit) { musOutOfTime0_ = bit; } + void setMusOutOfTime1(const bool bit) { musOutOfTime1_ = bit; } + + bool isOneNominalInTime() const { return oneNominalInTime_; } + bool isOneTightInTime() const { return oneTightInTime_; } + bool isTwoLooseDiffSectorsInTime() const { return twoLooseDiffSectorsInTime_; } + bool musOutOfTime0() const { return musOutOfTime0_; } + bool musOutOfTime1() const { return musOutOfTime1_; } + + // at least one bit must be valid + bool isValid() const; + + // to be developed during Run-3 + bool isTwoLooseInTime() const { return false; } + // these options require more study + bool isOneNominalOutOfTime() const { return false; } + bool isTwoLooseOutOfTime() const { return false; } + bool isOneTightOutOfTime() const { return false; } + + bool operator==(const l1t::io_v1::MuonShower& rhs) const; + inline bool operator!=(const l1t::io_v1::MuonShower& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // Run-3 definitions as provided in DN-20-033 + // in time and out-of-time qualities. only 2 bits each. + bool oneNominalInTime_; + bool oneTightInTime_; + bool twoLooseDiffSectorsInTime_; + bool musOutOfTime0_; + bool musOutOfTime1_; + }; + } // namespace io_v1 + using MuonShower = io_v1::MuonShower; + typedef BXVector MuonShowerBxCollection; + typedef edm::Ref MuonShowerRef; + typedef edm::RefVector MuonShowerRefVector; + typedef std::vector MuonShowerVectorRef; - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // Run-3 definitions as provided in DN-20-033 - // in time and out-of-time qualities. only 2 bits each. - bool oneNominalInTime_; - bool oneTightInTime_; - bool twoLooseDiffSectorsInTime_; - bool musOutOfTime0_; - bool musOutOfTime1_; - }; + typedef ObjectRefBxCollection MuonShowerRefBxCollection; + typedef ObjectRefPair MuonShowerRefPair; + typedef ObjectRefPairBxCollection MuonShowerRefPairBxCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h b/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h index 87c73fee53320..504f05723a20b 100644 --- a/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h +++ b/DataFormats/L1Trigger/interface/P2GTAlgoBlock.h @@ -7,54 +7,54 @@ #include namespace l1t { - - class P2GTAlgoBlock; + namespace io_v1 { + class P2GTAlgoBlock { + public: + P2GTAlgoBlock() + : decisionBeforeBxMaskAndPrescale_(false), + decisionBeforePrescale_(false), + decisionFinal_(false), + decisionFinalPreview_(false), + isVeto_(false), + triggerTypes_(0), + trigObjects_() {} + + P2GTAlgoBlock(bool decisionBeforeBxMaskAndPrescale, + bool decisionBeforePrescale, + bool decisionFinal, + bool decisionFinalPreview, + bool isVeto, + int triggerTypes, + P2GTCandidateVectorRef trigObjects) + : decisionBeforeBxMaskAndPrescale_(decisionBeforeBxMaskAndPrescale), + decisionBeforePrescale_(decisionBeforePrescale), + decisionFinal_(decisionFinal), + decisionFinalPreview_(decisionFinalPreview), + isVeto_(isVeto), + triggerTypes_(triggerTypes), + trigObjects_(std::move(trigObjects)) {} + + bool decisionBeforeBxMaskAndPrescale() const { return decisionBeforeBxMaskAndPrescale_; } + bool decisionBeforePrescale() const { return decisionBeforePrescale_; } + bool decisionFinal() const { return decisionFinal_; } + bool decisionFinalPreview() const { return decisionFinalPreview_; } + bool isVeto() const { return isVeto_; } + int triggerTypes() const { return triggerTypes_; } + const P2GTCandidateVectorRef& trigObjects() const { return trigObjects_; } + + private: + const bool decisionBeforeBxMaskAndPrescale_; + const bool decisionBeforePrescale_; + const bool decisionFinal_; + const bool decisionFinalPreview_; + const bool isVeto_; + const int triggerTypes_; + const P2GTCandidateVectorRef trigObjects_; + }; + } // namespace io_v1 + using P2GTAlgoBlock = io_v1::P2GTAlgoBlock; typedef std::map P2GTAlgoBlockMap; - class P2GTAlgoBlock { - public: - P2GTAlgoBlock() - : decisionBeforeBxMaskAndPrescale_(false), - decisionBeforePrescale_(false), - decisionFinal_(false), - decisionFinalPreview_(false), - isVeto_(false), - triggerTypes_(0), - trigObjects_() {} - - P2GTAlgoBlock(bool decisionBeforeBxMaskAndPrescale, - bool decisionBeforePrescale, - bool decisionFinal, - bool decisionFinalPreview, - bool isVeto, - int triggerTypes, - P2GTCandidateVectorRef trigObjects) - : decisionBeforeBxMaskAndPrescale_(decisionBeforeBxMaskAndPrescale), - decisionBeforePrescale_(decisionBeforePrescale), - decisionFinal_(decisionFinal), - decisionFinalPreview_(decisionFinalPreview), - isVeto_(isVeto), - triggerTypes_(triggerTypes), - trigObjects_(std::move(trigObjects)) {} - - bool decisionBeforeBxMaskAndPrescale() const { return decisionBeforeBxMaskAndPrescale_; } - bool decisionBeforePrescale() const { return decisionBeforePrescale_; } - bool decisionFinal() const { return decisionFinal_; } - bool decisionFinalPreview() const { return decisionFinalPreview_; } - bool isVeto() const { return isVeto_; } - int triggerTypes() const { return triggerTypes_; } - const P2GTCandidateVectorRef& trigObjects() const { return trigObjects_; } - - private: - const bool decisionBeforeBxMaskAndPrescale_; - const bool decisionBeforePrescale_; - const bool decisionFinal_; - const bool decisionFinalPreview_; - const bool isVeto_; - const int triggerTypes_; - const P2GTCandidateVectorRef trigObjects_; - }; - } // namespace l1t #endif // DataFormats_L1Trigger_P2GTAlgoBlock_h diff --git a/DataFormats/L1Trigger/interface/P2GTCandidate.h b/DataFormats/L1Trigger/interface/P2GTCandidate.h index a9c9e15420f33..bb5c1fdcc8514 100644 --- a/DataFormats/L1Trigger/interface/P2GTCandidate.h +++ b/DataFormats/L1Trigger/interface/P2GTCandidate.h @@ -13,345 +13,346 @@ namespace l1t { class L1GTProducer; - class P2GTCandidate; - typedef std::vector P2GTCandidateCollection; - typedef edm::Ref P2GTCandidateRef; - typedef edm::RefVector P2GTCandidateRefVector; - typedef std::vector P2GTCandidateVectorRef; + namespace io_v1 { + class P2GTCandidate : public reco::LeafCandidate { + public: + using Base = reco::LeafCandidate; + + using Base::Base; + + friend class l1t::L1GTProducer; + + typedef ap_uint<16> hwPT_t; + typedef ap_int<13> hwPhi_t; + typedef ap_int<14> hwEta_t; + typedef ap_int<18> hwZ0_t; + typedef ap_uint<11> hwIsolationPT_t; + typedef ap_uint<6> hwQualityFlags_t; + typedef ap_uint<10> hwQualityScore_t; + typedef ap_uint<1> hwCharge_t; + typedef ap_int<12> hwD0_t; + typedef ap_uint<4> hwBeta_t; + typedef ap_uint<10> hwMass_t; + typedef ap_uint<16> hwIndex_t; + typedef ap_uint<10> hwSeed_pT_t; + typedef ap_int<10> hwSeed_z0_t; + typedef ap_uint<16> hwScalarSumPT_t; + typedef ap_uint<5> hwNumber_of_tracks_t; + typedef ap_uint<4> hwNumber_of_displaced_tracks_t; + typedef ap_uint<12> hwSum_pT_pv_t; + typedef ap_uint<2> hwType_t; + typedef ap_uint<8> hwNumber_of_tracks_in_pv_t; + typedef ap_uint<10> hwNumber_of_tracks_not_in_pv_t; + + // Similar to std::optional but avoids inheritance for ROOT file embedding + template + struct Optional { + Optional() : value_(0), set_(false) {} + Optional(T value) : value_(value), set_(true) {} + + operator T() const { return value_; } + operator bool() const { return set_; } + + bool operator==(bool rhs) const { return set_ == rhs; } + bool operator!=(bool rhs) const { return set_ != rhs; } + + private: + T value_; + bool set_; + }; + + enum ObjectType { + Undefined, + GCTNonIsoEg, + GCTIsoEg, + GCTJets, + GCTTaus, + GCTHtSum, + GCTEtSum, + GMTSaPromptMuons, + GMTSaDisplacedMuons, + GMTTkMuons, + GMTTopo, + GTTPromptJets, + GTTDisplacedJets, + GTTPhiCandidates, + GTTRhoCandidates, + GTTBsCandidates, + GTTHadronicTaus, + GTTPromptTracks, + GTTDisplacedTracks, + GTTPrimaryVert, + GTTPromptHtSum, + GTTDisplacedHtSum, + GTTEtSum, + CL2JetsSC4, + CL2JetsSC8, + CL2Taus, + CL2Electrons, + CL2Photons, + CL2HtSum, + CL2EtSum + }; + + void setHwPT(hwPT_t hwPT) { hwPT_ = hwPT.to_int(); } + void setHwPhi(hwPhi_t hwPhi) { hwPhi_ = hwPhi.to_int(); } + void setHwEta(hwEta_t hwEta) { hwEta_ = hwEta.to_int(); } + void setHwZ0(hwZ0_t hwZ0) { hwZ0_ = hwZ0.to_int(); } + void setHwIsolationPT(hwIsolationPT_t hwIso) { hwIsolationPT_ = hwIso.to_int(); } + void setHwQualityFlags(hwQualityFlags_t hwQualityFlags) { hwQualityFlags_ = hwQualityFlags.to_int(); } + void setHwQualityScore(hwQualityScore_t hwQualityScore) { hwQualityScore_ = hwQualityScore.to_int(); } + void setHwCharge(hwCharge_t hwCharge) { hwCharge_ = hwCharge.to_int(); } + void setHwD0(hwD0_t hwD0) { hwD0_ = hwD0.to_int(); } + void setHwBeta(hwBeta_t hwBeta) { hwBeta_ = hwBeta.to_int(); } + void setHwMass(hwMass_t hwMass) { hwMass_ = hwMass.to_int(); } + void setHwIndex(hwIndex_t hwIndex) { hwIndex_ = hwIndex.to_int(); } + void setHwSeed_pT(hwSeed_pT_t hwSeed_pT) { hwSeed_pT_ = hwSeed_pT.to_int(); } + void setHwSeed_z0(hwSeed_z0_t hwSeed_z0) { hwSeed_z0_ = hwSeed_z0.to_int(); } + void setHwScalarSumPT(hwScalarSumPT_t hwScalarSumPT) { hwScalarSumPT_ = hwScalarSumPT.to_int(); } + void setHwNumber_of_tracks(hwNumber_of_tracks_t hwNumber_of_tracks) { + hwNumber_of_tracks_ = hwNumber_of_tracks.to_int(); + } - class P2GTCandidate : public reco::LeafCandidate { - public: - using Base = reco::LeafCandidate; - - using Base::Base; - - friend class L1GTProducer; - - typedef ap_uint<16> hwPT_t; - typedef ap_int<13> hwPhi_t; - typedef ap_int<14> hwEta_t; - typedef ap_int<18> hwZ0_t; - typedef ap_uint<11> hwIsolationPT_t; - typedef ap_uint<6> hwQualityFlags_t; - typedef ap_uint<10> hwQualityScore_t; - typedef ap_uint<1> hwCharge_t; - typedef ap_int<12> hwD0_t; - typedef ap_uint<4> hwBeta_t; - typedef ap_uint<10> hwMass_t; - typedef ap_uint<16> hwIndex_t; - typedef ap_uint<10> hwSeed_pT_t; - typedef ap_int<10> hwSeed_z0_t; - typedef ap_uint<16> hwScalarSumPT_t; - typedef ap_uint<5> hwNumber_of_tracks_t; - typedef ap_uint<4> hwNumber_of_displaced_tracks_t; - typedef ap_uint<12> hwSum_pT_pv_t; - typedef ap_uint<2> hwType_t; - typedef ap_uint<8> hwNumber_of_tracks_in_pv_t; - typedef ap_uint<10> hwNumber_of_tracks_not_in_pv_t; - - // Similar to std::optional but avoids inheritance for ROOT file embedding - template - struct Optional { - Optional() : value_(0), set_(false) {} - Optional(T value) : value_(value), set_(true) {} - - operator T() const { return value_; } - operator bool() const { return set_; } - - bool operator==(bool rhs) const { return set_ == rhs; } - bool operator!=(bool rhs) const { return set_ != rhs; } + void setHwNumber_of_displaced_tracks(hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks) { + hwNumber_of_displaced_tracks_ = hwNumber_of_displaced_tracks.to_int(); + } - private: - T value_; - bool set_; - }; + void setHwSum_pT_pv(hwSum_pT_pv_t hwSum_pT_pv) { hwSum_pT_pv_ = hwSum_pT_pv.to_int(); } + void setHwType(hwType_t hwType) { hwType_ = hwType.to_int(); } + void setHwNumber_of_tracks_in_pv(hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv) { + hwNumber_of_tracks_in_pv_ = hwNumber_of_tracks_in_pv.to_int(); + } + void setHwNumber_of_tracks_not_in_pv(hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv) { + hwNumber_of_tracks_not_in_pv_ = hwNumber_of_tracks_not_in_pv.to_int(); + } - enum ObjectType { - Undefined, - GCTNonIsoEg, - GCTIsoEg, - GCTJets, - GCTTaus, - GCTHtSum, - GCTEtSum, - GMTSaPromptMuons, - GMTSaDisplacedMuons, - GMTTkMuons, - GMTTopo, - GTTPromptJets, - GTTDisplacedJets, - GTTPhiCandidates, - GTTRhoCandidates, - GTTBsCandidates, - GTTHadronicTaus, - GTTPromptTracks, - GTTDisplacedTracks, - GTTPrimaryVert, - GTTPromptHtSum, - GTTDisplacedHtSum, - GTTEtSum, - CL2JetsSC4, - CL2JetsSC8, - CL2Taus, - CL2Electrons, - CL2Photons, - CL2HtSum, - CL2EtSum - }; + hwPT_t hwPT() const { + if (!hwPT_) { + throw std::invalid_argument("Object doesn't have pT"); + } + return static_cast(hwPT_); + } - void setHwPT(hwPT_t hwPT) { hwPT_ = hwPT.to_int(); } - void setHwPhi(hwPhi_t hwPhi) { hwPhi_ = hwPhi.to_int(); } - void setHwEta(hwEta_t hwEta) { hwEta_ = hwEta.to_int(); } - void setHwZ0(hwZ0_t hwZ0) { hwZ0_ = hwZ0.to_int(); } - void setHwIsolationPT(hwIsolationPT_t hwIso) { hwIsolationPT_ = hwIso.to_int(); } - void setHwQualityFlags(hwQualityFlags_t hwQualityFlags) { hwQualityFlags_ = hwQualityFlags.to_int(); } - void setHwQualityScore(hwQualityScore_t hwQualityScore) { hwQualityScore_ = hwQualityScore.to_int(); } - void setHwCharge(hwCharge_t hwCharge) { hwCharge_ = hwCharge.to_int(); } - void setHwD0(hwD0_t hwD0) { hwD0_ = hwD0.to_int(); } - void setHwBeta(hwBeta_t hwBeta) { hwBeta_ = hwBeta.to_int(); } - void setHwMass(hwMass_t hwMass) { hwMass_ = hwMass.to_int(); } - void setHwIndex(hwIndex_t hwIndex) { hwIndex_ = hwIndex.to_int(); } - void setHwSeed_pT(hwSeed_pT_t hwSeed_pT) { hwSeed_pT_ = hwSeed_pT.to_int(); } - void setHwSeed_z0(hwSeed_z0_t hwSeed_z0) { hwSeed_z0_ = hwSeed_z0.to_int(); } - void setHwScalarSumPT(hwScalarSumPT_t hwScalarSumPT) { hwScalarSumPT_ = hwScalarSumPT.to_int(); } - void setHwNumber_of_tracks(hwNumber_of_tracks_t hwNumber_of_tracks) { - hwNumber_of_tracks_ = hwNumber_of_tracks.to_int(); - } - - void setHwNumber_of_displaced_tracks(hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks) { - hwNumber_of_displaced_tracks_ = hwNumber_of_displaced_tracks.to_int(); - } - - void setHwSum_pT_pv(hwSum_pT_pv_t hwSum_pT_pv) { hwSum_pT_pv_ = hwSum_pT_pv.to_int(); } - void setHwType(hwType_t hwType) { hwType_ = hwType.to_int(); } - void setHwNumber_of_tracks_in_pv(hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv) { - hwNumber_of_tracks_in_pv_ = hwNumber_of_tracks_in_pv.to_int(); - } - void setHwNumber_of_tracks_not_in_pv(hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv) { - hwNumber_of_tracks_not_in_pv_ = hwNumber_of_tracks_not_in_pv.to_int(); - } - - hwPT_t hwPT() const { - if (!hwPT_) { - throw std::invalid_argument("Object doesn't have pT"); + hwPhi_t hwPhi() const { + if (!hwPhi_) { + throw std::invalid_argument("Object doesn't have phi"); + } + return static_cast(hwPhi_); } - return static_cast(hwPT_); - } - hwPhi_t hwPhi() const { - if (!hwPhi_) { - throw std::invalid_argument("Object doesn't have phi"); + hwEta_t hwEta() const { + if (!hwEta_) { + throw std::invalid_argument("Object doesn't have eta"); + } + return static_cast(hwEta_); } - return static_cast(hwPhi_); - } - hwEta_t hwEta() const { - if (!hwEta_) { - throw std::invalid_argument("Object doesn't have eta"); + hwZ0_t hwZ0() const { + if (!hwZ0_) { + throw std::invalid_argument("Object doesn't have z0"); + } + return static_cast(hwZ0_); } - return static_cast(hwEta_); - } - hwZ0_t hwZ0() const { - if (!hwZ0_) { - throw std::invalid_argument("Object doesn't have z0"); + hwIsolationPT_t hwIsolationPT() const { + if (!hwIsolationPT_) { + throw std::invalid_argument("Object doesn't have isolationPT"); + } + return static_cast(hwIsolationPT_); } - return static_cast(hwZ0_); - } - hwIsolationPT_t hwIsolationPT() const { - if (!hwIsolationPT_) { - throw std::invalid_argument("Object doesn't have isolationPT"); + hwQualityFlags_t hwQualityFlags() const { + if (!hwQualityFlags_) { + throw std::invalid_argument("Object doesn't have qualityFlags"); + } + return static_cast(hwQualityFlags_); } - return static_cast(hwIsolationPT_); - } - hwQualityFlags_t hwQualityFlags() const { - if (!hwQualityFlags_) { - throw std::invalid_argument("Object doesn't have qualityFlags"); + hwQualityScore_t hwQualityScore() const { + if (!hwQualityScore_) { + throw std::invalid_argument("Object doesn't have qualityScore"); + } + return static_cast(hwQualityScore_); } - return static_cast(hwQualityFlags_); - } - hwQualityScore_t hwQualityScore() const { - if (!hwQualityScore_) { - throw std::invalid_argument("Object doesn't have qualityScore"); + hwCharge_t hwCharge() const { + if (!hwCharge_) { + throw std::invalid_argument("Object doesn't have charge"); + } + return static_cast(hwCharge_); } - return static_cast(hwQualityScore_); - } - hwCharge_t hwCharge() const { - if (!hwCharge_) { - throw std::invalid_argument("Object doesn't have charge"); + hwD0_t hwD0() const { + if (!hwD0_) { + throw std::invalid_argument("Object doesn't have d0"); + } + return static_cast(hwD0_); } - return static_cast(hwCharge_); - } - hwD0_t hwD0() const { - if (!hwD0_) { - throw std::invalid_argument("Object doesn't have d0"); + hwBeta_t hwBeta() const { + if (!hwBeta_) { + throw std::invalid_argument("Object doesn't have beta"); + } + return static_cast(hwBeta_); } - return static_cast(hwD0_); - } - hwBeta_t hwBeta() const { - if (!hwBeta_) { - throw std::invalid_argument("Object doesn't have beta"); + hwMass_t hwMass() const { + if (!hwMass_) { + throw std::invalid_argument("Object doesn't have mass"); + } + return static_cast(hwMass_); } - return static_cast(hwBeta_); - } - hwMass_t hwMass() const { - if (!hwMass_) { - throw std::invalid_argument("Object doesn't have mass"); + hwIndex_t hwIndex() const { + if (!hwIndex_) { + throw std::invalid_argument("Object doesn't have index"); + } + return static_cast(hwIndex_); } - return static_cast(hwMass_); - } - hwIndex_t hwIndex() const { - if (!hwIndex_) { - throw std::invalid_argument("Object doesn't have index"); + hwSeed_pT_t hwSeed_pT() const { + if (!hwSeed_pT_) { + throw std::invalid_argument("Object doesn't have seed_pT"); + } + return static_cast(hwSeed_pT_); } - return static_cast(hwIndex_); - } - hwSeed_pT_t hwSeed_pT() const { - if (!hwSeed_pT_) { - throw std::invalid_argument("Object doesn't have seed_pT"); + hwSeed_z0_t hwSeed_z0() const { + if (!hwSeed_z0_) { + throw std::invalid_argument("Object doesn't have seed_z0"); + } + return static_cast(hwSeed_z0_); } - return static_cast(hwSeed_pT_); - } - hwSeed_z0_t hwSeed_z0() const { - if (!hwSeed_z0_) { - throw std::invalid_argument("Object doesn't have seed_z0"); + hwScalarSumPT_t hwScalarSumPT() const { + if (!hwScalarSumPT_) { + throw std::invalid_argument("Object doesn't have scalarSumPT"); + } + return static_cast(hwScalarSumPT_); } - return static_cast(hwSeed_z0_); - } - hwScalarSumPT_t hwScalarSumPT() const { - if (!hwScalarSumPT_) { - throw std::invalid_argument("Object doesn't have scalarSumPT"); + hwNumber_of_tracks_t hwNumber_of_tracks() const { + if (!hwNumber_of_tracks_) { + throw std::invalid_argument("Object doesn't have number_of_tracks"); + } + return static_cast(hwNumber_of_tracks_); } - return static_cast(hwScalarSumPT_); - } - hwNumber_of_tracks_t hwNumber_of_tracks() const { - if (!hwNumber_of_tracks_) { - throw std::invalid_argument("Object doesn't have number_of_tracks"); + hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks() const { + if (!hwNumber_of_displaced_tracks_) { + throw std::invalid_argument("Object doesn't have hwNumber_of_displaced_tracks"); + } + return static_cast(hwNumber_of_displaced_tracks_); } - return static_cast(hwNumber_of_tracks_); - } - hwNumber_of_displaced_tracks_t hwNumber_of_displaced_tracks() const { - if (!hwNumber_of_displaced_tracks_) { - throw std::invalid_argument("Object doesn't have hwNumber_of_displaced_tracks"); + hwSum_pT_pv_t hwSum_pT_pv() const { + if (!hwSum_pT_pv_) { + throw std::invalid_argument("Object doesn't have sum_pT_pv"); + } + return static_cast(hwSum_pT_pv_); } - return static_cast(hwNumber_of_displaced_tracks_); - } - hwSum_pT_pv_t hwSum_pT_pv() const { - if (!hwSum_pT_pv_) { - throw std::invalid_argument("Object doesn't have sum_pT_pv"); + hwType_t hwType() const { + if (!hwType_) { + throw std::invalid_argument("Object doesn't have type"); + } + return static_cast(hwType_); } - return static_cast(hwSum_pT_pv_); - } - hwType_t hwType() const { - if (!hwType_) { - throw std::invalid_argument("Object doesn't have type"); + hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv() const { + if (!hwNumber_of_tracks_in_pv_) { + throw std::invalid_argument("Object doesn't have number_of_tracks_in_pv"); + } + return static_cast(hwNumber_of_tracks_in_pv_); } - return static_cast(hwType_); - } - hwNumber_of_tracks_in_pv_t hwNumber_of_tracks_in_pv() const { - if (!hwNumber_of_tracks_in_pv_) { - throw std::invalid_argument("Object doesn't have number_of_tracks_in_pv"); + hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv() const { + if (!hwNumber_of_tracks_not_in_pv_) { + throw std::invalid_argument("Object doesn't have hwNumber_of_tracks_not_in_pv"); + } + return static_cast(hwNumber_of_tracks_not_in_pv_); } - return static_cast(hwNumber_of_tracks_in_pv_); - } - hwNumber_of_tracks_not_in_pv_t hwNumber_of_tracks_not_in_pv() const { - if (!hwNumber_of_tracks_not_in_pv_) { - throw std::invalid_argument("Object doesn't have hwNumber_of_tracks_not_in_pv"); + ObjectType objectType() const { return objectType_; } + + // Nano SimpleCandidateFlatTableProducer accessor functions + int hwPT_toInt() const { return hwPT().to_int(); } + int hwPhi_toInt() const { return hwPhi().to_int(); } + int hwEta_toInt() const { return hwEta().to_int(); } + int hwZ0_toInt() const { return hwZ0().to_int(); } + int hwIsolationPT_toInt() const { return hwIsolationPT().to_int(); } + int hwQualityFlags_toInt() const { return hwQualityFlags().to_int(); } + int hwQualityScore_toInt() const { return hwQualityScore().to_int(); } + int hwCharge_toInt() const { return hwCharge().to_int(); } + int hwD0_toInt() const { return hwD0().to_int(); } + int hwBeta_toInt() const { return hwBeta().to_int(); } + int hwMass_toInt() const { return hwMass().to_int(); } + int hwIndex_toInt() const { return hwIndex().to_int(); } + int hwSeed_pT_toInt() const { return hwSeed_pT().to_int(); } + int hwSeed_z0_toInt() const { return hwSeed_z0().to_int(); } + int hwScalarSumPT_toInt() const { return hwScalarSumPT().to_int(); } + int hwNumber_of_tracks_toInt() const { return hwNumber_of_tracks().to_int(); } + int hwNumber_of_displaced_tracks_toInt() const { return hwNumber_of_displaced_tracks().to_int(); } + int hwSum_pT_pv_toInt() const { return hwSum_pT_pv().to_int(); } + int hwType_toInt() const { return hwType().to_int(); } + int hwNumber_of_tracks_in_pv_toInt() const { return hwNumber_of_tracks_in_pv().to_int(); } + int hwNumber_of_tracks_not_in_pv_toInt() const { return hwNumber_of_tracks_not_in_pv().to_int(); } + + bool operator==(const P2GTCandidate& rhs) const; + bool operator!=(const P2GTCandidate& rhs) const; + + bool isElectron() const override { return objectType_ == CL2Electrons; }; + + bool isMuon() const override { + return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons || objectType_ == GMTTkMuons; + }; + + bool isStandAloneMuon() const override { + return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons; + }; + + bool isTrackerMuon() const override { return objectType_ == GMTTkMuons; } + + bool isPhoton() const override { return objectType_ == CL2Photons; } + + bool isJet() const override { + return objectType_ == GCTJets || objectType_ == GTTPromptJets || objectType_ == GTTDisplacedJets || + objectType_ == CL2JetsSC4 || objectType_ == CL2JetsSC8; } - return static_cast(hwNumber_of_tracks_not_in_pv_); - } - - ObjectType objectType() const { return objectType_; } - - // Nano SimpleCandidateFlatTableProducer accessor functions - int hwPT_toInt() const { return hwPT().to_int(); } - int hwPhi_toInt() const { return hwPhi().to_int(); } - int hwEta_toInt() const { return hwEta().to_int(); } - int hwZ0_toInt() const { return hwZ0().to_int(); } - int hwIsolationPT_toInt() const { return hwIsolationPT().to_int(); } - int hwQualityFlags_toInt() const { return hwQualityFlags().to_int(); } - int hwQualityScore_toInt() const { return hwQualityScore().to_int(); } - int hwCharge_toInt() const { return hwCharge().to_int(); } - int hwD0_toInt() const { return hwD0().to_int(); } - int hwBeta_toInt() const { return hwBeta().to_int(); } - int hwMass_toInt() const { return hwMass().to_int(); } - int hwIndex_toInt() const { return hwIndex().to_int(); } - int hwSeed_pT_toInt() const { return hwSeed_pT().to_int(); } - int hwSeed_z0_toInt() const { return hwSeed_z0().to_int(); } - int hwScalarSumPT_toInt() const { return hwScalarSumPT().to_int(); } - int hwNumber_of_tracks_toInt() const { return hwNumber_of_tracks().to_int(); } - int hwNumber_of_displaced_tracks_toInt() const { return hwNumber_of_displaced_tracks().to_int(); } - int hwSum_pT_pv_toInt() const { return hwSum_pT_pv().to_int(); } - int hwType_toInt() const { return hwType().to_int(); } - int hwNumber_of_tracks_in_pv_toInt() const { return hwNumber_of_tracks_in_pv().to_int(); } - int hwNumber_of_tracks_not_in_pv_toInt() const { return hwNumber_of_tracks_not_in_pv().to_int(); } - - bool operator==(const P2GTCandidate& rhs) const; - bool operator!=(const P2GTCandidate& rhs) const; - - bool isElectron() const override { return objectType_ == CL2Electrons; }; - - bool isMuon() const override { - return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons || objectType_ == GMTTkMuons; - }; - bool isStandAloneMuon() const override { - return objectType_ == GMTSaPromptMuons || objectType_ == GMTSaDisplacedMuons; + private: + Optional hwPT_; + Optional hwPhi_; + Optional hwEta_; + Optional hwZ0_; + Optional hwIsolationPT_; + Optional hwQualityFlags_; + Optional hwQualityScore_; + Optional hwCharge_; + Optional hwD0_; + Optional hwBeta_; + Optional hwMass_; + Optional hwIndex_; + Optional hwSeed_pT_; + Optional hwSeed_z0_; + Optional hwScalarSumPT_; + Optional hwNumber_of_tracks_; + Optional hwNumber_of_displaced_tracks_; + + // TODO ? + Optional hwSum_pT_pv_; + Optional hwType_; + Optional hwNumber_of_tracks_in_pv_; + Optional hwNumber_of_tracks_not_in_pv_; + + ObjectType objectType_ = Undefined; }; - - bool isTrackerMuon() const override { return objectType_ == GMTTkMuons; } - - bool isPhoton() const override { return objectType_ == CL2Photons; } - - bool isJet() const override { - return objectType_ == GCTJets || objectType_ == GTTPromptJets || objectType_ == GTTDisplacedJets || - objectType_ == CL2JetsSC4 || objectType_ == CL2JetsSC8; - } - - private: - Optional hwPT_; - Optional hwPhi_; - Optional hwEta_; - Optional hwZ0_; - Optional hwIsolationPT_; - Optional hwQualityFlags_; - Optional hwQualityScore_; - Optional hwCharge_; - Optional hwD0_; - Optional hwBeta_; - Optional hwMass_; - Optional hwIndex_; - Optional hwSeed_pT_; - Optional hwSeed_z0_; - Optional hwScalarSumPT_; - Optional hwNumber_of_tracks_; - Optional hwNumber_of_displaced_tracks_; - - // TODO ? - Optional hwSum_pT_pv_; - Optional hwType_; - Optional hwNumber_of_tracks_in_pv_; - Optional hwNumber_of_tracks_not_in_pv_; - - ObjectType objectType_ = Undefined; - }; + } // namespace io_v1 + using P2GTCandidate = io_v1::P2GTCandidate; + typedef std::vector P2GTCandidateCollection; + typedef edm::Ref P2GTCandidateRef; + typedef edm::RefVector P2GTCandidateRefVector; + typedef std::vector P2GTCandidateVectorRef; }; // namespace l1t diff --git a/DataFormats/L1Trigger/interface/Tau.h b/DataFormats/L1Trigger/interface/Tau.h index 0f87895de4ae4..333c99fdc3674 100644 --- a/DataFormats/L1Trigger/interface/Tau.h +++ b/DataFormats/L1Trigger/interface/Tau.h @@ -6,8 +6,53 @@ #include "DataFormats/L1Trigger/interface/L1TObjComparison.h" namespace l1t { + namespace io_v1 { + class Tau : public L1Candidate { + public: + Tau() { clear_extended(); } - class Tau; + // ctor from base allowed, but note that extended variables will be set to zero: + Tau(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } + + Tau(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + Tau(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); + + ~Tau() override; + + void setTowerIEta(short int ieta); // ieta of seed tower + void setTowerIPhi(short int iphi); // iphi of seed tower + void setRawEt(short int et); // raw (uncalibrated) cluster sum + void setIsoEt(short int et); // raw isolation sum - cluster sum + void setNTT(short int ntt); // n towers above threshold + void setHasEM(bool hasEM); + void setIsMerged(bool isMerged); + + short int towerIEta() const; + short int towerIPhi() const; + short int rawEt() const; + short int isoEt() const; + short int nTT() const; + bool hasEM() const; + bool isMerged() const; + + bool operator==(const l1t::io_v1::Tau& rhs) const; + inline bool operator!=(const l1t::io_v1::Tau& rhs) const { return !(operator==(rhs)); }; + + private: + using L1Candidate::operator==; + using L1Candidate::operator!=; + // additional hardware quantities common to L1 global tau + void clear_extended(); + short int towerIEta_; + short int towerIPhi_; + short int rawEt_; + short int isoEt_; + short int nTT_; + bool hasEM_; + bool isMerged_; + }; + } // namespace io_v1 + using Tau = io_v1::Tau; typedef BXVector TauBxCollection; typedef edm::Ref TauRef; typedef edm::RefVector TauRefVector; @@ -16,52 +61,6 @@ namespace l1t { typedef ObjectRefBxCollection TauRefBxCollection; typedef ObjectRefPair TauRefPair; typedef ObjectRefPairBxCollection TauRefPairBxCollection; - - class Tau : public L1Candidate { - public: - Tau() { clear_extended(); } - - // ctor from base allowed, but note that extended variables will be set to zero: - Tau(const L1Candidate& rhs) : L1Candidate(rhs) { clear_extended(); } - - Tau(const LorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - Tau(const PolarLorentzVector& p4, int pt = 0, int eta = 0, int phi = 0, int qual = 0, int iso = 0); - - ~Tau() override; - - void setTowerIEta(short int ieta); // ieta of seed tower - void setTowerIPhi(short int iphi); // iphi of seed tower - void setRawEt(short int et); // raw (uncalibrated) cluster sum - void setIsoEt(short int et); // raw isolation sum - cluster sum - void setNTT(short int ntt); // n towers above threshold - void setHasEM(bool hasEM); - void setIsMerged(bool isMerged); - - short int towerIEta() const; - short int towerIPhi() const; - short int rawEt() const; - short int isoEt() const; - short int nTT() const; - bool hasEM() const; - bool isMerged() const; - - bool operator==(const l1t::Tau& rhs) const; - inline bool operator!=(const l1t::Tau& rhs) const { return !(operator==(rhs)); }; - - private: - using L1Candidate::operator==; - using L1Candidate::operator!=; - // additional hardware quantities common to L1 global tau - void clear_extended(); - short int towerIEta_; - short int towerIPhi_; - short int rawEt_; - short int isoEt_; - short int nTT_; - bool hasEM_; - bool isMerged_; - }; - } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/interface/TkJetWord.h b/DataFormats/L1Trigger/interface/TkJetWord.h index 25a6f87528071..5a908dcc88e19 100644 --- a/DataFormats/L1Trigger/interface/TkJetWord.h +++ b/DataFormats/L1Trigger/interface/TkJetWord.h @@ -15,179 +15,180 @@ #include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" namespace l1t { + namespace io_v1 { + class TkJetWord { + public: + // ----------constants, enums and typedefs --------- + static constexpr double MAX_Z0 = 30.; + static constexpr double MAX_ETA = 8.; + + enum TkJetBitWidths { + kPtSize = 16, + kPtMagSize = 11, + kGlbEtaSize = 14, + kGlbPhiSize = 13, + kZ0Size = 10, + kNtSize = 5, + kXtSize = 4, + kDispFlagSize = 1, + kUnassignedSize = 65, + kTkJetWordSize = + kPtSize + kGlbEtaSize + kGlbPhiSize + kZ0Size + kNtSize + kXtSize + kDispFlagSize + kUnassignedSize, + }; + + enum TkJetBitLocations { + kPtLSB = 0, + kPtMSB = kPtLSB + TkJetBitWidths::kPtSize - 1, + kGlbPhiLSB = kPtMSB + 1, + kGlbPhiMSB = kGlbPhiLSB + TkJetBitWidths::kGlbPhiSize - 1, + kGlbEtaLSB = kGlbPhiMSB + 1, + kGlbEtaMSB = kGlbEtaLSB + TkJetBitWidths::kGlbEtaSize - 1, + kZ0LSB = kGlbEtaMSB + 1, + kZ0MSB = kZ0LSB + TkJetBitWidths::kZ0Size - 1, + kNtLSB = kZ0MSB + 1, + kNtMSB = kNtLSB + TkJetBitWidths::kNtSize - 1, + kXtLSB = kNtMSB + 1, + kXtMSB = kXtLSB + TkJetBitWidths::kXtSize - 1, + kDispFlagLSB = kXtMSB + 1, + kDispFlagMSB = kDispFlagLSB + TkJetBitWidths::kDispFlagSize - 1, + kUnassignedLSB = kDispFlagMSB + 1, + kUnassignedMSB = kUnassignedLSB + TkJetBitWidths::kUnassignedSize - 1, + }; + + typedef ap_ufixed pt_t; + typedef ap_int glbeta_t; + typedef ap_int glbphi_t; + typedef ap_int z0_t; // 40cm / 0.1 + typedef ap_uint nt_t; //number of tracks + typedef ap_uint nx_t; //number of tracks with xbit = 1 + typedef ap_uint dispflag_t; + typedef ap_uint tkjetunassigned_t; // Unassigned bits + typedef std::bitset tkjetword_bs_t; + typedef ap_uint tkjetword_t; + + public: + // ----------Constructors -------------------------- + TkJetWord() {} + TkJetWord(pt_t pt, + glbeta_t eta, + glbphi_t phi, + z0_t z0, + nt_t nt, + nx_t nx, + dispflag_t dispflag, + tkjetunassigned_t unassigned); + + ~TkJetWord() {} + + // ----------copy constructor ---------------------- + TkJetWord(const TkJetWord& word) { tkJetWord_ = word.tkJetWord_; } + + // ----------operators ----------------------------- + TkJetWord& operator=(const TkJetWord& word) { + tkJetWord_ = word.tkJetWord_; + return *this; + } - class TkJetWord { - public: - // ----------constants, enums and typedefs --------- - static constexpr double MAX_Z0 = 30.; - static constexpr double MAX_ETA = 8.; - - enum TkJetBitWidths { - kPtSize = 16, - kPtMagSize = 11, - kGlbEtaSize = 14, - kGlbPhiSize = 13, - kZ0Size = 10, - kNtSize = 5, - kXtSize = 4, - kDispFlagSize = 1, - kUnassignedSize = 65, - kTkJetWordSize = - kPtSize + kGlbEtaSize + kGlbPhiSize + kZ0Size + kNtSize + kXtSize + kDispFlagSize + kUnassignedSize, - }; - - enum TkJetBitLocations { - kPtLSB = 0, - kPtMSB = kPtLSB + TkJetBitWidths::kPtSize - 1, - kGlbPhiLSB = kPtMSB + 1, - kGlbPhiMSB = kGlbPhiLSB + TkJetBitWidths::kGlbPhiSize - 1, - kGlbEtaLSB = kGlbPhiMSB + 1, - kGlbEtaMSB = kGlbEtaLSB + TkJetBitWidths::kGlbEtaSize - 1, - kZ0LSB = kGlbEtaMSB + 1, - kZ0MSB = kZ0LSB + TkJetBitWidths::kZ0Size - 1, - kNtLSB = kZ0MSB + 1, - kNtMSB = kNtLSB + TkJetBitWidths::kNtSize - 1, - kXtLSB = kNtMSB + 1, - kXtMSB = kXtLSB + TkJetBitWidths::kXtSize - 1, - kDispFlagLSB = kXtMSB + 1, - kDispFlagMSB = kDispFlagLSB + TkJetBitWidths::kDispFlagSize - 1, - kUnassignedLSB = kDispFlagMSB + 1, - kUnassignedMSB = kUnassignedLSB + TkJetBitWidths::kUnassignedSize - 1, - }; - - typedef ap_ufixed pt_t; - typedef ap_int glbeta_t; - typedef ap_int glbphi_t; - typedef ap_int z0_t; // 40cm / 0.1 - typedef ap_uint nt_t; //number of tracks - typedef ap_uint nx_t; //number of tracks with xbit = 1 - typedef ap_uint dispflag_t; - typedef ap_uint tkjetunassigned_t; // Unassigned bits - typedef std::bitset tkjetword_bs_t; - typedef ap_uint tkjetword_t; - - public: - // ----------Constructors -------------------------- - TkJetWord() {} - TkJetWord(pt_t pt, - glbeta_t eta, - glbphi_t phi, - z0_t z0, - nt_t nt, - nx_t nx, - dispflag_t dispflag, - tkjetunassigned_t unassigned); - - ~TkJetWord() {} - - // ----------copy constructor ---------------------- - TkJetWord(const TkJetWord& word) { tkJetWord_ = word.tkJetWord_; } - - // ----------operators ----------------------------- - TkJetWord& operator=(const TkJetWord& word) { - tkJetWord_ = word.tkJetWord_; - return *this; - } - - // ----------member functions (getters) ------------ - // These functions return arbitarary precision words (lists of bits) for each quantity - pt_t ptWord() const { - pt_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kPtMSB, TkJetBitLocations::kPtLSB); - return ret; - } - glbeta_t glbEtaWord() const { - glbeta_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kGlbEtaMSB, TkJetBitLocations::kGlbEtaLSB); - return ret; - } - glbphi_t glbPhiWord() const { - glbphi_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kGlbPhiMSB, TkJetBitLocations::kGlbPhiLSB); - return ret; - } - z0_t z0Word() const { - z0_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kZ0MSB, TkJetBitLocations::kZ0LSB); - return ret; - } - nt_t ntWord() const { - nt_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kNtMSB, TkJetBitLocations::kNtLSB); - return ret; - } - nx_t xtWord() const { - nx_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kXtMSB, TkJetBitLocations::kXtLSB); - return ret; - } - dispflag_t dispFlagWord() const { - dispflag_t ret; - ret.V = tkJetWord()(TkJetBitLocations::kDispFlagMSB, TkJetBitLocations::kDispFlagLSB); - return ret; - } - - tkjetunassigned_t unassignedWord() const { - return tkJetWord()(TkJetBitLocations::kUnassignedMSB, TkJetBitLocations::kUnassignedLSB); - } - tkjetword_t tkJetWord() const { return tkjetword_t(tkJetWord_.to_string().c_str(), 2); } - - // These functions return the packed bits in integer format for each quantity - // Signed quantities have the sign enconded in the left-most bit. - unsigned int ptBits() const { return ptWord().range().to_uint(); } - unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } - unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } - unsigned int z0Bits() const { return z0Word().range().to_uint(); } - unsigned int ntBits() const { return ntWord().to_uint(); } - unsigned int xtBits() const { return xtWord().to_uint(); } - unsigned int dispFlagBits() const { return dispFlagWord().to_uint(); } - unsigned int unassignedBits() const { return unassignedWord().to_uint(); } - - // These functions return the unpacked and converted values - // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word - float pt() const { return ptWord().to_float(); } - float glbeta() const { - return unpackSignedValue( - glbEtaWord(), TkJetBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkJetBitWidths::kGlbEtaSize)); - } - float glbphi() const { - return unpackSignedValue( - glbPhiWord(), TkJetBitWidths::kGlbPhiSize, (2. * std::abs(M_PI)) / (1 << TkJetBitWidths::kGlbPhiSize)); - } - float z0() const { - return unpackSignedValue(z0Word(), TkJetBitWidths::kZ0Size, MAX_Z0 / (1 << TkJetBitWidths::kZ0Size)); - } - int nt() const { return (ap_ufixed(ntWord())).to_int(); } - int xt() const { return (ap_ufixed(xtWord())).to_int(); } - int dispflag() const { return (ap_ufixed(dispFlagWord())).to_int(); } - unsigned int unassigned() const { return unassignedWord().to_uint(); } - - // ----------member functions (setters) ------------ - void setTkJetWord(pt_t pt, - glbeta_t eta, - glbphi_t phi, - z0_t z0, - nt_t nt, - nx_t nx, - dispflag_t dispflag, - tkjetunassigned_t unassigned); - - private: - // ----------private member functions -------------- - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + // ----------member functions (getters) ------------ + // These functions return arbitarary precision words (lists of bits) for each quantity + pt_t ptWord() const { + pt_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kPtMSB, TkJetBitLocations::kPtLSB); + return ret; + } + glbeta_t glbEtaWord() const { + glbeta_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kGlbEtaMSB, TkJetBitLocations::kGlbEtaLSB); + return ret; + } + glbphi_t glbPhiWord() const { + glbphi_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kGlbPhiMSB, TkJetBitLocations::kGlbPhiLSB); + return ret; + } + z0_t z0Word() const { + z0_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kZ0MSB, TkJetBitLocations::kZ0LSB); + return ret; + } + nt_t ntWord() const { + nt_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kNtMSB, TkJetBitLocations::kNtLSB); + return ret; + } + nx_t xtWord() const { + nx_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kXtMSB, TkJetBitLocations::kXtLSB); + return ret; + } + dispflag_t dispFlagWord() const { + dispflag_t ret; + ret.V = tkJetWord()(TkJetBitLocations::kDispFlagMSB, TkJetBitLocations::kDispFlagLSB); + return ret; } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; - } - // ----------member data --------------------------- - tkjetword_bs_t tkJetWord_; - }; + tkjetunassigned_t unassignedWord() const { + return tkJetWord()(TkJetBitLocations::kUnassignedMSB, TkJetBitLocations::kUnassignedLSB); + } + tkjetword_t tkJetWord() const { return tkjetword_t(tkJetWord_.to_string().c_str(), 2); } + + // These functions return the packed bits in integer format for each quantity + // Signed quantities have the sign enconded in the left-most bit. + unsigned int ptBits() const { return ptWord().range().to_uint(); } + unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } + unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } + unsigned int z0Bits() const { return z0Word().range().to_uint(); } + unsigned int ntBits() const { return ntWord().to_uint(); } + unsigned int xtBits() const { return xtWord().to_uint(); } + unsigned int dispFlagBits() const { return dispFlagWord().to_uint(); } + unsigned int unassignedBits() const { return unassignedWord().to_uint(); } + + // These functions return the unpacked and converted values + // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word + float pt() const { return ptWord().to_float(); } + float glbeta() const { + return unpackSignedValue( + glbEtaWord(), TkJetBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkJetBitWidths::kGlbEtaSize)); + } + float glbphi() const { + return unpackSignedValue( + glbPhiWord(), TkJetBitWidths::kGlbPhiSize, (2. * std::abs(M_PI)) / (1 << TkJetBitWidths::kGlbPhiSize)); + } + float z0() const { + return unpackSignedValue(z0Word(), TkJetBitWidths::kZ0Size, MAX_Z0 / (1 << TkJetBitWidths::kZ0Size)); + } + int nt() const { return (ap_ufixed(ntWord())).to_int(); } + int xt() const { return (ap_ufixed(xtWord())).to_int(); } + int dispflag() const { return (ap_ufixed(dispFlagWord())).to_int(); } + unsigned int unassigned() const { return unassignedWord().to_uint(); } + + // ----------member functions (setters) ------------ + void setTkJetWord(pt_t pt, + glbeta_t eta, + glbphi_t phi, + z0_t z0, + nt_t nt, + nx_t nx, + dispflag_t dispflag, + tkjetunassigned_t unassigned); + + private: + // ----------private member functions -------------- + double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { + int isign = 1; + unsigned int digitized_maximum = (1 << nBits) - 1; + if (bits & (1 << (nBits - 1))) { // check the sign + isign = -1; + bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + } + return (double(bits & digitized_maximum) + 0.5) * lsb * isign; + } + // ----------member data --------------------------- + tkjetword_bs_t tkJetWord_; + }; + } // namespace io_v1 + using TkJetWord = io_v1::TkJetWord; typedef std::vector TkJetWordCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/TkTripletWord.h b/DataFormats/L1Trigger/interface/TkTripletWord.h index 42afd72cacceb..69f8aecb7894f 100644 --- a/DataFormats/L1Trigger/interface/TkTripletWord.h +++ b/DataFormats/L1Trigger/interface/TkTripletWord.h @@ -13,246 +13,247 @@ #include "DataFormats/L1TrackTrigger/interface/TTTrack_TrackWord.h" namespace l1t { + namespace io_v1 { + class TkTripletWord { + public: + // ----------constants, enums and typedefs --------- + static constexpr double MAX_MASS = 1000.; + static constexpr double MAX_ETA = 8.; + static constexpr double MAX_CHARGE = 3.; + static constexpr double MAX_Z0 = 25.; - class TkTripletWord { - public: - // ----------constants, enums and typedefs --------- - static constexpr double MAX_MASS = 1000.; - static constexpr double MAX_ETA = 8.; - static constexpr double MAX_CHARGE = 3.; - static constexpr double MAX_Z0 = 25.; + enum TkTripletBitWidths { + // The sizes of the triplet word components and total word size + kValidSize = 1, // Width of the valid bit + kPtSize = 16, // Width of the triplet pt + kPtMagSize = 11, + kGlbEtaSize = 14, // Width of the triplet eta + kGlbPhiSize = 13, // Width of the triplet phi + kMassSize = 16, // Width of the triplet mass + kChargeSize = 3, // Width of the triplet charge + kDiTrackMinMassSize = 16, // Width of the mass of min mass pair + kDiTrackMaxMassSize = 16, // Width of the mass of max mass pair + kDiTrackMinZ0Size = 8, // Width of the Dz of min Dz pair + kDiTrackMaxZ0Size = 8, // Width of the Dz of max Dz pair + kUnassignedSize = 17, + kTkTripletWordSize = kValidSize + kPtSize + kGlbEtaSize + kGlbPhiSize + kMassSize + kChargeSize + + kDiTrackMinMassSize + kDiTrackMaxMassSize + kDiTrackMinZ0Size + kDiTrackMaxZ0Size + + kUnassignedSize, + }; - enum TkTripletBitWidths { - // The sizes of the triplet word components and total word size - kValidSize = 1, // Width of the valid bit - kPtSize = 16, // Width of the triplet pt - kPtMagSize = 11, - kGlbEtaSize = 14, // Width of the triplet eta - kGlbPhiSize = 13, // Width of the triplet phi - kMassSize = 16, // Width of the triplet mass - kChargeSize = 3, // Width of the triplet charge - kDiTrackMinMassSize = 16, // Width of the mass of min mass pair - kDiTrackMaxMassSize = 16, // Width of the mass of max mass pair - kDiTrackMinZ0Size = 8, // Width of the Dz of min Dz pair - kDiTrackMaxZ0Size = 8, // Width of the Dz of max Dz pair - kUnassignedSize = 17, - kTkTripletWordSize = kValidSize + kPtSize + kGlbEtaSize + kGlbPhiSize + kMassSize + kChargeSize + - kDiTrackMinMassSize + kDiTrackMaxMassSize + kDiTrackMinZ0Size + kDiTrackMaxZ0Size + - kUnassignedSize, - }; - - enum TkTripletBitLocations { - // The location of the least significant bit (LSB) and most significant bit (MSB) in the triplet word for different fields - kValidLSB = 0, - kValidMSB = kValidLSB + TkTripletBitWidths::kValidSize - 1, - kPtLSB = kValidMSB + 1, - kPtMSB = kPtLSB + TkTripletBitWidths::kPtSize - 1, - kGlbPhiLSB = kPtMSB + 1, - kGlbPhiMSB = kGlbPhiLSB + TkTripletBitWidths::kGlbPhiSize - 1, - kGlbEtaLSB = kGlbPhiMSB + 1, - kGlbEtaMSB = kGlbEtaLSB + TkTripletBitWidths::kGlbEtaSize - 1, - kMassLSB = kGlbEtaMSB + 1, - kMassMSB = kMassLSB + TkTripletBitWidths::kMassSize - 1, - kChargeLSB = kMassMSB + 1, - kChargeMSB = kChargeLSB + TkTripletBitWidths::kChargeSize - 1, - kDiTrackMinMassLSB = kChargeMSB + 1, - kDiTrackMinMassMSB = kDiTrackMinMassLSB + TkTripletBitWidths::kDiTrackMinMassSize - 1, - kDiTrackMaxMassLSB = kDiTrackMinMassMSB + 1, - kDiTrackMaxMassMSB = kDiTrackMaxMassLSB + TkTripletBitWidths::kDiTrackMaxMassSize - 1, - kDiTrackMinZ0LSB = kDiTrackMaxMassMSB + 1, - kDiTrackMinZ0MSB = kDiTrackMinZ0LSB + TkTripletBitWidths::kDiTrackMinZ0Size - 1, - kDiTrackMaxZ0LSB = kDiTrackMinZ0MSB + 1, - kDiTrackMaxZ0MSB = kDiTrackMaxZ0LSB + TkTripletBitWidths::kDiTrackMaxZ0Size - 1, - kUnassignedLSB = kDiTrackMaxZ0MSB + 1, - kUnassignedMSB = kUnassignedLSB + TkTripletBitWidths::kUnassignedSize - 1, - }; + enum TkTripletBitLocations { + // The location of the least significant bit (LSB) and most significant bit (MSB) in the triplet word for different fields + kValidLSB = 0, + kValidMSB = kValidLSB + TkTripletBitWidths::kValidSize - 1, + kPtLSB = kValidMSB + 1, + kPtMSB = kPtLSB + TkTripletBitWidths::kPtSize - 1, + kGlbPhiLSB = kPtMSB + 1, + kGlbPhiMSB = kGlbPhiLSB + TkTripletBitWidths::kGlbPhiSize - 1, + kGlbEtaLSB = kGlbPhiMSB + 1, + kGlbEtaMSB = kGlbEtaLSB + TkTripletBitWidths::kGlbEtaSize - 1, + kMassLSB = kGlbEtaMSB + 1, + kMassMSB = kMassLSB + TkTripletBitWidths::kMassSize - 1, + kChargeLSB = kMassMSB + 1, + kChargeMSB = kChargeLSB + TkTripletBitWidths::kChargeSize - 1, + kDiTrackMinMassLSB = kChargeMSB + 1, + kDiTrackMinMassMSB = kDiTrackMinMassLSB + TkTripletBitWidths::kDiTrackMinMassSize - 1, + kDiTrackMaxMassLSB = kDiTrackMinMassMSB + 1, + kDiTrackMaxMassMSB = kDiTrackMaxMassLSB + TkTripletBitWidths::kDiTrackMaxMassSize - 1, + kDiTrackMinZ0LSB = kDiTrackMaxMassMSB + 1, + kDiTrackMinZ0MSB = kDiTrackMinZ0LSB + TkTripletBitWidths::kDiTrackMinZ0Size - 1, + kDiTrackMaxZ0LSB = kDiTrackMinZ0MSB + 1, + kDiTrackMaxZ0MSB = kDiTrackMaxZ0LSB + TkTripletBitWidths::kDiTrackMaxZ0Size - 1, + kUnassignedLSB = kDiTrackMaxZ0MSB + 1, + kUnassignedMSB = kUnassignedLSB + TkTripletBitWidths::kUnassignedSize - 1, + }; - // vertex parameters types - typedef ap_uint valid_t; //valid - typedef ap_ufixed pt_t; //triplet pt - typedef ap_int glbeta_t; //triplet eta - typedef ap_int glbphi_t; //triplet phi - typedef ap_int mass_t; //triplet mass - typedef ap_int charge_t; //triplet Q - typedef ap_int ditrack_minmass_t; //pair min mass - typedef ap_int ditrack_maxmass_t; //pair max mass - typedef ap_int ditrack_minz0_t; //pair dz min - typedef ap_int ditrack_maxz0_t; //pair dz max - typedef ap_uint unassigned_t; - typedef std::bitset tktripletword_bs_t; - typedef ap_uint tktripletword_t; + // vertex parameters types + typedef ap_uint valid_t; //valid + typedef ap_ufixed pt_t; //triplet pt + typedef ap_int glbeta_t; //triplet eta + typedef ap_int glbphi_t; //triplet phi + typedef ap_int mass_t; //triplet mass + typedef ap_int charge_t; //triplet Q + typedef ap_int ditrack_minmass_t; //pair min mass + typedef ap_int ditrack_maxmass_t; //pair max mass + typedef ap_int ditrack_minz0_t; //pair dz min + typedef ap_int ditrack_maxz0_t; //pair dz max + typedef ap_uint unassigned_t; + typedef std::bitset tktripletword_bs_t; + typedef ap_uint tktripletword_t; - public: - // ----------Constructors -------------------------- - TkTripletWord() {} - TkTripletWord(valid_t valid, - pt_t pt, - glbeta_t eta, - glbphi_t phi, - mass_t mass, - charge_t charge, - ditrack_minmass_t ditrack_minmass, - ditrack_maxmass_t ditrack_maxmass, - ditrack_minz0_t ditrack_minz0_t, - ditrack_maxz0_t ditrack_maxz0_t, - unassigned_t unassigned); + public: + // ----------Constructors -------------------------- + TkTripletWord() {} + TkTripletWord(valid_t valid, + pt_t pt, + glbeta_t eta, + glbphi_t phi, + mass_t mass, + charge_t charge, + ditrack_minmass_t ditrack_minmass, + ditrack_maxmass_t ditrack_maxmass, + ditrack_minz0_t ditrack_minz0_t, + ditrack_maxz0_t ditrack_maxz0_t, + unassigned_t unassigned); - ~TkTripletWord() {} + ~TkTripletWord() {} - // ----------copy constructor ---------------------- - TkTripletWord(const TkTripletWord& word) { tkTripletWord_ = word.tkTripletWord_; } + // ----------copy constructor ---------------------- + TkTripletWord(const TkTripletWord& word) { tkTripletWord_ = word.tkTripletWord_; } - // ----------operators ----------------------------- - TkTripletWord& operator=(const TkTripletWord& word) { - tkTripletWord_ = word.tkTripletWord_; - return *this; - } + // ----------operators ----------------------------- + TkTripletWord& operator=(const TkTripletWord& word) { + tkTripletWord_ = word.tkTripletWord_; + return *this; + } - // ----------member functions (getters) ------------ - // These functions return arbitarary precision words (lists of bits) for each quantity - valid_t validWord() const { - return tkTripletWord()(TkTripletBitLocations::kValidMSB, TkTripletBitLocations::kValidLSB); - } - pt_t ptWord() const { - pt_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kPtMSB, TkTripletBitLocations::kPtLSB); - return ret; - } - glbeta_t glbEtaWord() const { - glbeta_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kGlbEtaMSB, TkTripletBitLocations::kGlbEtaLSB); - return ret; - } - glbphi_t glbPhiWord() const { - glbphi_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kGlbPhiMSB, TkTripletBitLocations::kGlbPhiLSB); - return ret; - } - mass_t massWord() const { - mass_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kMassMSB, TkTripletBitLocations::kMassLSB); - return ret; - } - charge_t chargeWord() const { - charge_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kChargeMSB, TkTripletBitLocations::kChargeLSB); - return ret; - } + // ----------member functions (getters) ------------ + // These functions return arbitarary precision words (lists of bits) for each quantity + valid_t validWord() const { + return tkTripletWord()(TkTripletBitLocations::kValidMSB, TkTripletBitLocations::kValidLSB); + } + pt_t ptWord() const { + pt_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kPtMSB, TkTripletBitLocations::kPtLSB); + return ret; + } + glbeta_t glbEtaWord() const { + glbeta_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kGlbEtaMSB, TkTripletBitLocations::kGlbEtaLSB); + return ret; + } + glbphi_t glbPhiWord() const { + glbphi_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kGlbPhiMSB, TkTripletBitLocations::kGlbPhiLSB); + return ret; + } + mass_t massWord() const { + mass_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kMassMSB, TkTripletBitLocations::kMassLSB); + return ret; + } + charge_t chargeWord() const { + charge_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kChargeMSB, TkTripletBitLocations::kChargeLSB); + return ret; + } - ditrack_minmass_t ditrackMinMassWord() const { - ditrack_minmass_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinMassMSB, TkTripletBitLocations::kDiTrackMinMassLSB); - return ret; - } - ditrack_maxmass_t ditrackMaxMassWord() const { - ditrack_maxmass_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxMassMSB, TkTripletBitLocations::kDiTrackMaxMassLSB); - return ret; - } - ditrack_minz0_t ditrackMinZ0Word() const { - ditrack_minz0_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinZ0MSB, TkTripletBitLocations::kDiTrackMinZ0LSB); - return ret; - } - ditrack_maxz0_t ditrackMaxZ0Word() const { - ditrack_maxz0_t ret; - ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxZ0MSB, TkTripletBitLocations::kDiTrackMaxZ0LSB); - return ret; - } - unassigned_t unassignedWord() const { - return tkTripletWord()(TkTripletBitLocations::kUnassignedMSB, TkTripletBitLocations::kUnassignedLSB); - } - tktripletword_t tkTripletWord() const { return tktripletword_t(tkTripletWord_.to_string().c_str(), 2); } + ditrack_minmass_t ditrackMinMassWord() const { + ditrack_minmass_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinMassMSB, TkTripletBitLocations::kDiTrackMinMassLSB); + return ret; + } + ditrack_maxmass_t ditrackMaxMassWord() const { + ditrack_maxmass_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxMassMSB, TkTripletBitLocations::kDiTrackMaxMassLSB); + return ret; + } + ditrack_minz0_t ditrackMinZ0Word() const { + ditrack_minz0_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMinZ0MSB, TkTripletBitLocations::kDiTrackMinZ0LSB); + return ret; + } + ditrack_maxz0_t ditrackMaxZ0Word() const { + ditrack_maxz0_t ret; + ret.V = tkTripletWord()(TkTripletBitLocations::kDiTrackMaxZ0MSB, TkTripletBitLocations::kDiTrackMaxZ0LSB); + return ret; + } + unassigned_t unassignedWord() const { + return tkTripletWord()(TkTripletBitLocations::kUnassignedMSB, TkTripletBitLocations::kUnassignedLSB); + } + tktripletword_t tkTripletWord() const { return tktripletword_t(tkTripletWord_.to_string().c_str(), 2); } - // These functions return the packed bits in integer format for each quantity - // Signed quantities have the sign enconded in the left-most bit. - unsigned int validBits() const { return validWord().to_uint(); } - unsigned int ptBits() const { return ptWord().to_uint(); } - unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } - unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } - unsigned int massBits() const { return massWord().to_uint(); } - unsigned int chargeBits() const { return chargeWord().to_uint(); } - unsigned int ditrackMinMassBits() const { return ditrackMinMassWord().to_uint(); } - unsigned int ditrackMaxMassBits() const { return ditrackMaxMassWord().to_uint(); } - unsigned int ditrackMinZ0Bits() const { return ditrackMinZ0Word().to_uint(); } - unsigned int ditrackMaxZ0Bits() const { return ditrackMaxZ0Word().to_uint(); } - unsigned int unassignedBits() const { return unassignedWord().to_uint(); } + // These functions return the packed bits in integer format for each quantity + // Signed quantities have the sign enconded in the left-most bit. + unsigned int validBits() const { return validWord().to_uint(); } + unsigned int ptBits() const { return ptWord().to_uint(); } + unsigned int glbEtaBits() const { return glbEtaWord().to_uint(); } + unsigned int glbPhiBits() const { return glbPhiWord().to_uint(); } + unsigned int massBits() const { return massWord().to_uint(); } + unsigned int chargeBits() const { return chargeWord().to_uint(); } + unsigned int ditrackMinMassBits() const { return ditrackMinMassWord().to_uint(); } + unsigned int ditrackMaxMassBits() const { return ditrackMaxMassWord().to_uint(); } + unsigned int ditrackMinZ0Bits() const { return ditrackMinZ0Word().to_uint(); } + unsigned int ditrackMaxZ0Bits() const { return ditrackMaxZ0Word().to_uint(); } + unsigned int unassignedBits() const { return unassignedWord().to_uint(); } - // These functions return the unpacked and converted values - // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word - bool valid() const { return validWord().to_bool(); } - float pt() const { return ptWord().to_float(); } - float glbeta() const { - return unpackSignedValue( - glbEtaWord(), TkTripletBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkTripletBitWidths::kGlbEtaSize)); - } - float glbphi() const { - return unpackSignedValue(glbPhiWord(), - TkTripletBitWidths::kGlbPhiSize, - (2. * std::abs(M_PI)) / (1 << TkTripletBitWidths::kGlbPhiSize)); - } - float mass() const { - return unpackSignedValue( - massWord(), TkTripletBitWidths::kMassSize, MAX_MASS / (1 << TkTripletBitWidths::kMassSize)); - } - int charge() const { - return unpackSignedValue( - chargeWord(), TkTripletBitWidths::kChargeSize, MAX_CHARGE / (1 << TkTripletBitWidths::kChargeSize)); - } - float ditrackMinMass() const { - return unpackSignedValue(ditrackMinMassWord(), - TkTripletBitWidths::kDiTrackMinMassSize, - MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMinMassSize)); - } - float ditrackMaxMass() const { - return unpackSignedValue(ditrackMaxMassWord(), - TkTripletBitWidths::kDiTrackMaxMassSize, - MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMaxMassSize)); - } - float ditrackMinZ0() const { - return unpackSignedValue(ditrackMinZ0Word(), - TkTripletBitWidths::kDiTrackMinZ0Size, - MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMinZ0Size)); - } - float ditrackMaxZ0() const { - return unpackSignedValue(ditrackMaxZ0Word(), - TkTripletBitWidths::kDiTrackMaxZ0Size, - MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMaxZ0Size)); - } - unsigned int unassigned() const { return unassignedWord().to_uint(); } + // These functions return the unpacked and converted values + // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word + bool valid() const { return validWord().to_bool(); } + float pt() const { return ptWord().to_float(); } + float glbeta() const { + return unpackSignedValue( + glbEtaWord(), TkTripletBitWidths::kGlbEtaSize, (MAX_ETA) / (1 << TkTripletBitWidths::kGlbEtaSize)); + } + float glbphi() const { + return unpackSignedValue(glbPhiWord(), + TkTripletBitWidths::kGlbPhiSize, + (2. * std::abs(M_PI)) / (1 << TkTripletBitWidths::kGlbPhiSize)); + } + float mass() const { + return unpackSignedValue( + massWord(), TkTripletBitWidths::kMassSize, MAX_MASS / (1 << TkTripletBitWidths::kMassSize)); + } + int charge() const { + return unpackSignedValue( + chargeWord(), TkTripletBitWidths::kChargeSize, MAX_CHARGE / (1 << TkTripletBitWidths::kChargeSize)); + } + float ditrackMinMass() const { + return unpackSignedValue(ditrackMinMassWord(), + TkTripletBitWidths::kDiTrackMinMassSize, + MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMinMassSize)); + } + float ditrackMaxMass() const { + return unpackSignedValue(ditrackMaxMassWord(), + TkTripletBitWidths::kDiTrackMaxMassSize, + MAX_MASS / (1 << TkTripletBitWidths::kDiTrackMaxMassSize)); + } + float ditrackMinZ0() const { + return unpackSignedValue(ditrackMinZ0Word(), + TkTripletBitWidths::kDiTrackMinZ0Size, + MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMinZ0Size)); + } + float ditrackMaxZ0() const { + return unpackSignedValue(ditrackMaxZ0Word(), + TkTripletBitWidths::kDiTrackMaxZ0Size, + MAX_Z0 / (1 << TkTripletBitWidths::kDiTrackMaxZ0Size)); + } + unsigned int unassigned() const { return unassignedWord().to_uint(); } - // ----------member functions (setters) ------------ - void setTkTripletWord(valid_t valid, - pt_t pt, - glbeta_t eta, - glbphi_t phi, - mass_t mass, - charge_t charge, - ditrack_minmass_t ditrack_minmass, - ditrack_maxmass_t ditrack_maxmass, - ditrack_minz0_t ditrack_minz0, - ditrack_maxz0_t ditrack_maxz0, - unassigned_t unassigned); + // ----------member functions (setters) ------------ + void setTkTripletWord(valid_t valid, + pt_t pt, + glbeta_t eta, + glbphi_t phi, + mass_t mass, + charge_t charge, + ditrack_minmass_t ditrack_minmass, + ditrack_maxmass_t ditrack_maxmass, + ditrack_minz0_t ditrack_minz0, + ditrack_maxz0_t ditrack_maxz0, + unassigned_t unassigned); - template - inline void packIntoWord(unsigned int& currentOffset, unsigned int wordChunkSize, packVarType& packVar); + template + inline void packIntoWord(unsigned int& currentOffset, unsigned int wordChunkSize, packVarType& packVar); - private: - // ----------private member functions -------------- - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + private: + // ----------private member functions -------------- + double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { + int isign = 1; + unsigned int digitized_maximum = (1 << nBits) - 1; + if (bits & (1 << (nBits - 1))) { // check the sign + isign = -1; + bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + } + return (double(bits & digitized_maximum) + 0.5) * lsb * isign; } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; - } - - // ----------member data --------------------------- - tktripletword_bs_t tkTripletWord_; - }; + // ----------member data --------------------------- + tktripletword_bs_t tkTripletWord_; + }; + } // namespace io_v1 + using TkTripletWord = io_v1::TkTripletWord; typedef std::vector TkTripletWordCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/Vertex.h b/DataFormats/L1Trigger/interface/Vertex.h index d26e1a02ac4aa..3b53906a18c5a 100644 --- a/DataFormats/L1Trigger/interface/Vertex.h +++ b/DataFormats/L1Trigger/interface/Vertex.h @@ -8,26 +8,27 @@ #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" namespace l1t { - - class Vertex { - public: - typedef TTTrack Track_t; - - Vertex() : pt_(0.0), z0_(0.0) {} - Vertex(float pt, float z0, const std::vector>& tracks) : pt_(pt), z0_(z0), tracks_(tracks) {} - ~Vertex() {} - - float pt() const { return pt_; } - float z0() const { return z0_; } - - const std::vector>& tracks() const { return tracks_; } - - private: - float pt_; - float z0_; - std::vector> tracks_; - }; - + namespace io_v1 { + class Vertex { + public: + typedef TTTrack Track_t; + + Vertex() : pt_(0.0), z0_(0.0) {} + Vertex(float pt, float z0, const std::vector>& tracks) : pt_(pt), z0_(z0), tracks_(tracks) {} + ~Vertex() {} + + float pt() const { return pt_; } + float z0() const { return z0_; } + + const std::vector>& tracks() const { return tracks_; } + + private: + float pt_; + float z0_; + std::vector> tracks_; + }; + } // namespace io_v1 + using Vertex = io_v1::Vertex; typedef std::vector VertexCollection; } // namespace l1t diff --git a/DataFormats/L1Trigger/interface/VertexWord.h b/DataFormats/L1Trigger/interface/VertexWord.h index 21ed4091824d3..3b434e59b9691 100644 --- a/DataFormats/L1Trigger/interface/VertexWord.h +++ b/DataFormats/L1Trigger/interface/VertexWord.h @@ -22,178 +22,181 @@ #include namespace l1t { - - class VertexWord { - public: - // ----------constants, enums and typedefs --------- - enum VertexBitWidths { - // The sizes of the vertex word components and total word size - kValidSize = 1, // Width of the valid bit - kZ0Size = 15, // Width of z-position - kZ0MagSize = 6, // Width of z-position magnitude (signed) - kNTrackInPVSize = 8, // Width of the multiplicity in the PV (unsigned) - kSumPtSize = 12, // Width of pT - kSumPtMagSize = 10, // Width of pT magnitude (unsigned) - kQualitySize = 3, // Width of the quality field - kNTrackOutPVSize = 10, // Width of the multiplicity outside the PV (unsigned) - kUnassignedSize = 15, // Width of the unassigned bits - - kVertexWordSize = kValidSize + kZ0Size + kNTrackInPVSize + kSumPtSize + kQualitySize + kNTrackOutPVSize + - kUnassignedSize, // Width of the vertex word in bits - }; - - enum VertexBitLocations { - // The location of the least significant bit (LSB) and most significant bit (MSB) in the vertex word for different fields - kValidLSB = 0, - kValidMSB = kValidLSB + VertexBitWidths::kValidSize - 1, - kZ0LSB = kValidMSB + 1, - kZ0MSB = kZ0LSB + VertexBitWidths::kZ0Size - 1, - kNTrackInPVLSB = kZ0MSB + 1, - kNTrackInPVMSB = kNTrackInPVLSB + VertexBitWidths::kNTrackInPVSize - 1, - kSumPtLSB = kNTrackInPVMSB + 1, - kSumPtMSB = kSumPtLSB + VertexBitWidths::kSumPtSize - 1, - kQualityLSB = kSumPtMSB + 1, - kQualityMSB = kQualityLSB + VertexBitWidths::kQualitySize - 1, - kNTrackOutPVLSB = kQualityMSB + 1, - kNTrackOutPVMSB = kNTrackOutPVLSB + VertexBitWidths::kNTrackOutPVSize - 1, - kUnassignedLSB = kNTrackOutPVMSB + 1, - kUnassignedMSB = kUnassignedLSB + VertexBitWidths::kUnassignedSize - 1 - }; - - // vertex parameters types - typedef ap_uint vtxvalid_t; // Vertex validity - typedef ap_fixed vtxz0_t; // Vertex z0 - typedef ap_ufixed - vtxmultiplicity_t; // NTracks in vertex - typedef ap_ufixed - vtxsumpt_t; // Vertex Sum pT - typedef ap_uint vtxquality_t; // Vertex quality - typedef ap_ufixed - vtxinversemult_t; // NTracks outside vertex - typedef ap_uint vtxunassigned_t; // Unassigned bits - - // vertex word types - typedef std::bitset vtxword_bs_t; // Entire track word; - typedef ap_uint vtxword_t; // Entire vertex word; - - // reference types - typedef edm::Ref VertexRef; // Reference to a persistent l1t::Vertex - - public: - // ----------Constructors -------------------------- - VertexWord() {} - VertexWord(unsigned int valid, - double z0, - unsigned int multiplicity, - double pt, - unsigned int quality, - unsigned int inverseMultiplicity, - unsigned int unassigned); - VertexWord(unsigned int valid, - unsigned int z0, - unsigned int multiplicity, - unsigned int pt, - unsigned int quality, - unsigned int inverseMultiplicity, - unsigned int unassigned); - VertexWord(vtxvalid_t valid, - vtxz0_t z0, - vtxmultiplicity_t multiplicity, - vtxsumpt_t pt, - vtxquality_t quality, - vtxinversemult_t inverseMultiplicity, - vtxunassigned_t unassigned); - - ~VertexWord() {} - - // ----------copy constructor ---------------------- - VertexWord(const VertexWord& word) { vertexWord_ = word.vertexWord_; } - - // ----------operators ----------------------------- - VertexWord& operator=(const VertexWord& word) { - vertexWord_ = word.vertexWord_; - return *this; - } - - // ----------member functions (getters) ------------ - // These functions return arbitarary precision words (lists of bits) for each quantity - vtxvalid_t validWord() const { return vertexWord()(VertexBitLocations::kValidMSB, VertexBitLocations::kValidLSB); } - vtxz0_t z0Word() const { - vtxz0_t ret; - ret.V = vertexWord()(VertexBitLocations::kZ0MSB, VertexBitLocations::kZ0LSB); - return ret; - } - vtxmultiplicity_t multiplicityWord() const { - return vertexWord()(VertexBitLocations::kNTrackInPVMSB, VertexBitLocations::kNTrackInPVLSB); - } - vtxsumpt_t ptWord() const { - vtxsumpt_t ret; - ret.V = vertexWord()(VertexBitLocations::kSumPtMSB, VertexBitLocations::kSumPtLSB); - return ret; - } - vtxquality_t qualityWord() const { - return vertexWord()(VertexBitLocations::kQualityMSB, VertexBitLocations::kQualityLSB); - } - vtxinversemult_t inverseMultiplicityWord() const { - return vertexWord()(VertexBitLocations::kNTrackOutPVMSB, VertexBitLocations::kNTrackOutPVLSB); - } - vtxunassigned_t unassignedWord() const { - return vertexWord()(VertexBitLocations::kUnassignedMSB, VertexBitLocations::kUnassignedLSB); - } - vtxword_t vertexWord() const { return vtxword_t(vertexWord_.to_string().c_str(), 2); } - - // These functions return the packed bits in integer format for each quantity - // Signed quantities have the sign enconded in the left-most bit. - unsigned int validBits() const { return validWord().to_uint(); } - unsigned int z0Bits() const { return z0Word().range().to_uint(); } - unsigned int multiplicityBits() const { return multiplicityWord().to_uint(); } - unsigned int ptBits() const { return ptWord().range().to_uint(); } - unsigned int qualityBits() const { return qualityWord().to_uint(); } - unsigned int inverseMultiplicityBits() const { return inverseMultiplicityWord().to_uint(); } - unsigned int unassignedBits() const { return unassignedWord().to_uint(); } - - // These functions return the unpacked and converted values - // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word - bool valid() const { return validWord().to_bool(); } - double z0() const { return z0Word().to_double(); } - unsigned int multiplicity() const { return multiplicityWord().to_uint(); } - double pt() const { return ptWord().to_double(); } - unsigned int quality() const { return qualityWord().to_uint(); } - unsigned int inverseMultiplicity() const { return inverseMultiplicityWord().to_uint(); } - unsigned int unassigned() const { return unassignedWord().to_uint(); } - - // return reference to floating point vertex - VertexRef vertexRef() const { return vertexRef_; } - - // ----------member functions (setters) ------------ - void setVertexWord(vtxvalid_t valid, - vtxz0_t z0, - vtxmultiplicity_t multiplicity, - vtxsumpt_t pt, - vtxquality_t quality, - vtxinversemult_t inverseMultiplicity, - vtxunassigned_t unassigned); - - // set reference to floating point vertex - void setVertexRef(const VertexRef& ref) { vertexRef_ = ref; } - - private: - // ----------private member functions -------------- - double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { - int isign = 1; - unsigned int digitized_maximum = (1 << nBits) - 1; - if (bits & (1 << (nBits - 1))) { // check the sign - isign = -1; - bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + namespace io_v1 { + class VertexWord { + public: + // ----------constants, enums and typedefs --------- + enum VertexBitWidths { + // The sizes of the vertex word components and total word size + kValidSize = 1, // Width of the valid bit + kZ0Size = 15, // Width of z-position + kZ0MagSize = 6, // Width of z-position magnitude (signed) + kNTrackInPVSize = 8, // Width of the multiplicity in the PV (unsigned) + kSumPtSize = 12, // Width of pT + kSumPtMagSize = 10, // Width of pT magnitude (unsigned) + kQualitySize = 3, // Width of the quality field + kNTrackOutPVSize = 10, // Width of the multiplicity outside the PV (unsigned) + kUnassignedSize = 15, // Width of the unassigned bits + + kVertexWordSize = kValidSize + kZ0Size + kNTrackInPVSize + kSumPtSize + kQualitySize + kNTrackOutPVSize + + kUnassignedSize, // Width of the vertex word in bits + }; + + enum VertexBitLocations { + // The location of the least significant bit (LSB) and most significant bit (MSB) in the vertex word for different fields + kValidLSB = 0, + kValidMSB = kValidLSB + VertexBitWidths::kValidSize - 1, + kZ0LSB = kValidMSB + 1, + kZ0MSB = kZ0LSB + VertexBitWidths::kZ0Size - 1, + kNTrackInPVLSB = kZ0MSB + 1, + kNTrackInPVMSB = kNTrackInPVLSB + VertexBitWidths::kNTrackInPVSize - 1, + kSumPtLSB = kNTrackInPVMSB + 1, + kSumPtMSB = kSumPtLSB + VertexBitWidths::kSumPtSize - 1, + kQualityLSB = kSumPtMSB + 1, + kQualityMSB = kQualityLSB + VertexBitWidths::kQualitySize - 1, + kNTrackOutPVLSB = kQualityMSB + 1, + kNTrackOutPVMSB = kNTrackOutPVLSB + VertexBitWidths::kNTrackOutPVSize - 1, + kUnassignedLSB = kNTrackOutPVMSB + 1, + kUnassignedMSB = kUnassignedLSB + VertexBitWidths::kUnassignedSize - 1 + }; + + // vertex parameters types + typedef ap_uint vtxvalid_t; // Vertex validity + typedef ap_fixed vtxz0_t; // Vertex z0 + typedef ap_ufixed + vtxmultiplicity_t; // NTracks in vertex + typedef ap_ufixed + vtxsumpt_t; // Vertex Sum pT + typedef ap_uint vtxquality_t; // Vertex quality + typedef ap_ufixed + vtxinversemult_t; // NTracks outside vertex + typedef ap_uint vtxunassigned_t; // Unassigned bits + + // vertex word types + typedef std::bitset vtxword_bs_t; // Entire track word; + typedef ap_uint vtxword_t; // Entire vertex word; + + // reference types + typedef edm::Ref VertexRef; // Reference to a persistent l1t::Vertex + + public: + // ----------Constructors -------------------------- + VertexWord() {} + VertexWord(unsigned int valid, + double z0, + unsigned int multiplicity, + double pt, + unsigned int quality, + unsigned int inverseMultiplicity, + unsigned int unassigned); + VertexWord(unsigned int valid, + unsigned int z0, + unsigned int multiplicity, + unsigned int pt, + unsigned int quality, + unsigned int inverseMultiplicity, + unsigned int unassigned); + VertexWord(vtxvalid_t valid, + vtxz0_t z0, + vtxmultiplicity_t multiplicity, + vtxsumpt_t pt, + vtxquality_t quality, + vtxinversemult_t inverseMultiplicity, + vtxunassigned_t unassigned); + + ~VertexWord() {} + + // ----------copy constructor ---------------------- + VertexWord(const VertexWord& word) { vertexWord_ = word.vertexWord_; } + + // ----------operators ----------------------------- + VertexWord& operator=(const VertexWord& word) { + vertexWord_ = word.vertexWord_; + return *this; } - return (double(bits & digitized_maximum) + 0.5) * lsb * isign; - } - // ----------member data --------------------------- - vtxword_bs_t vertexWord_; - VertexRef vertexRef_; - }; + // ----------member functions (getters) ------------ + // These functions return arbitarary precision words (lists of bits) for each quantity + vtxvalid_t validWord() const { + return vertexWord()(VertexBitLocations::kValidMSB, VertexBitLocations::kValidLSB); + } + vtxz0_t z0Word() const { + vtxz0_t ret; + ret.V = vertexWord()(VertexBitLocations::kZ0MSB, VertexBitLocations::kZ0LSB); + return ret; + } + vtxmultiplicity_t multiplicityWord() const { + return vertexWord()(VertexBitLocations::kNTrackInPVMSB, VertexBitLocations::kNTrackInPVLSB); + } + vtxsumpt_t ptWord() const { + vtxsumpt_t ret; + ret.V = vertexWord()(VertexBitLocations::kSumPtMSB, VertexBitLocations::kSumPtLSB); + return ret; + } + vtxquality_t qualityWord() const { + return vertexWord()(VertexBitLocations::kQualityMSB, VertexBitLocations::kQualityLSB); + } + vtxinversemult_t inverseMultiplicityWord() const { + return vertexWord()(VertexBitLocations::kNTrackOutPVMSB, VertexBitLocations::kNTrackOutPVLSB); + } + vtxunassigned_t unassignedWord() const { + return vertexWord()(VertexBitLocations::kUnassignedMSB, VertexBitLocations::kUnassignedLSB); + } + vtxword_t vertexWord() const { return vtxword_t(vertexWord_.to_string().c_str(), 2); } + + // These functions return the packed bits in integer format for each quantity + // Signed quantities have the sign enconded in the left-most bit. + unsigned int validBits() const { return validWord().to_uint(); } + unsigned int z0Bits() const { return z0Word().range().to_uint(); } + unsigned int multiplicityBits() const { return multiplicityWord().to_uint(); } + unsigned int ptBits() const { return ptWord().range().to_uint(); } + unsigned int qualityBits() const { return qualityWord().to_uint(); } + unsigned int inverseMultiplicityBits() const { return inverseMultiplicityWord().to_uint(); } + unsigned int unassignedBits() const { return unassignedWord().to_uint(); } + + // These functions return the unpacked and converted values + // These functions return real numbers converted from the digitized quantities by unpacking the 64-bit vertex word + bool valid() const { return validWord().to_bool(); } + double z0() const { return z0Word().to_double(); } + unsigned int multiplicity() const { return multiplicityWord().to_uint(); } + double pt() const { return ptWord().to_double(); } + unsigned int quality() const { return qualityWord().to_uint(); } + unsigned int inverseMultiplicity() const { return inverseMultiplicityWord().to_uint(); } + unsigned int unassigned() const { return unassignedWord().to_uint(); } + + // return reference to floating point vertex + VertexRef vertexRef() const { return vertexRef_; } + + // ----------member functions (setters) ------------ + void setVertexWord(vtxvalid_t valid, + vtxz0_t z0, + vtxmultiplicity_t multiplicity, + vtxsumpt_t pt, + vtxquality_t quality, + vtxinversemult_t inverseMultiplicity, + vtxunassigned_t unassigned); + + // set reference to floating point vertex + void setVertexRef(const VertexRef& ref) { vertexRef_ = ref; } + + private: + // ----------private member functions -------------- + double unpackSignedValue(unsigned int bits, unsigned int nBits, double lsb) const { + int isign = 1; + unsigned int digitized_maximum = (1 << nBits) - 1; + if (bits & (1 << (nBits - 1))) { // check the sign + isign = -1; + bits = (1 << (nBits + 1)) - bits; // if negative, flip everything for two's complement encoding + } + return (double(bits & digitized_maximum) + 0.5) * lsb * isign; + } + // ----------member data --------------------------- + vtxword_bs_t vertexWord_; + VertexRef vertexRef_; + }; + } // namespace io_v1 + using VertexWord = io_v1::VertexWord; typedef std::vector VertexWordCollection; typedef edm::Ref VertexWordRef; } // namespace l1t diff --git a/DataFormats/L1Trigger/src/EtSum.cc b/DataFormats/L1Trigger/src/EtSum.cc index 7a1a571a96342..fafc3a3788fc2 100644 --- a/DataFormats/L1Trigger/src/EtSum.cc +++ b/DataFormats/L1Trigger/src/EtSum.cc @@ -1,17 +1,19 @@ #include "DataFormats/L1Trigger/interface/EtSum.h" -l1t::EtSum::EtSum(const LorentzVector& p4, EtSumType type, int pt, int eta, int phi, int qual) - : L1Candidate(p4, pt, eta, phi, qual, 0), type_(type) {} +namespace l1t::io_v1 { + EtSum::EtSum(const LorentzVector& p4, EtSumType type, int pt, int eta, int phi, int qual) + : L1Candidate(p4, pt, eta, phi, qual, 0), type_(type) {} -l1t::EtSum::EtSum(const PolarLorentzVector& p4, EtSumType type, int pt, int eta, int phi, int qual) - : L1Candidate(p4, pt, eta, phi, qual, 0), type_(type) {} + EtSum::EtSum(const PolarLorentzVector& p4, EtSumType type, int pt, int eta, int phi, int qual) + : L1Candidate(p4, pt, eta, phi, qual, 0), type_(type) {} -l1t::EtSum::~EtSum() {} + EtSum::~EtSum() {} -void l1t::EtSum::setType(EtSumType type) { type_ = type; } + void EtSum::setType(EtSumType type) { type_ = type; } -l1t::EtSum::EtSumType l1t::EtSum::getType() const { return type_; } + EtSum::EtSumType l1t::EtSum::getType() const { return type_; } -bool l1t::EtSum::operator==(const l1t::EtSum& rhs) const { - return l1t::L1Candidate::operator==(static_cast(rhs)) && type_ == rhs.getType(); -} + bool EtSum::operator==(const l1t::EtSum& rhs) const { + return l1t::L1Candidate::operator==(static_cast(rhs)) && type_ == rhs.getType(); + } +} // namespace l1t::io_v1 diff --git a/DataFormats/L1Trigger/src/L1Candidate.cc b/DataFormats/L1Trigger/src/L1Candidate.cc index 3259195778cac..90be0249b07aa 100644 --- a/DataFormats/L1Trigger/src/L1Candidate.cc +++ b/DataFormats/L1Trigger/src/L1Candidate.cc @@ -1,17 +1,19 @@ #include "DataFormats/L1Trigger/interface/L1Candidate.h" -l1t::L1Candidate::L1Candidate() : hwPt_(0), hwEta_(0), hwPhi_(0), hwQual_(0), hwIso_(0) {} +namespace l1t::io_v1 { + L1Candidate::L1Candidate() : hwPt_(0), hwEta_(0), hwPhi_(0), hwQual_(0), hwIso_(0) {} -l1t::L1Candidate::L1Candidate(const LorentzVector& p4, int pt, int eta, int phi, int qual, int iso) - : LeafCandidate((char)0, p4), hwPt_(pt), hwEta_(eta), hwPhi_(phi), hwQual_(qual), hwIso_(iso) {} + L1Candidate::L1Candidate(const LorentzVector& p4, int pt, int eta, int phi, int qual, int iso) + : LeafCandidate((char)0, p4), hwPt_(pt), hwEta_(eta), hwPhi_(phi), hwQual_(qual), hwIso_(iso) {} -l1t::L1Candidate::L1Candidate(const PolarLorentzVector& p4, int pt, int eta, int phi, int qual, int iso) - : LeafCandidate((char)0, p4), hwPt_(pt), hwEta_(eta), hwPhi_(phi), hwQual_(qual), hwIso_(iso) {} + L1Candidate::L1Candidate(const PolarLorentzVector& p4, int pt, int eta, int phi, int qual, int iso) + : LeafCandidate((char)0, p4), hwPt_(pt), hwEta_(eta), hwPhi_(phi), hwQual_(qual), hwIso_(iso) {} -l1t::L1Candidate::~L1Candidate() {} + L1Candidate::~L1Candidate() {} -bool l1t::L1Candidate::operator==(const l1t::L1Candidate& rhs) const { - return hwPt_ == rhs.hwPt() && hwEta_ == rhs.hwEta() && hwPhi_ == rhs.hwPhi() && hwQual_ == rhs.hwQual() && - hwIso_ == rhs.hwIso(); -} + bool L1Candidate::operator==(const l1t::L1Candidate& rhs) const { + return hwPt_ == rhs.hwPt() && hwEta_ == rhs.hwEta() && hwPhi_ == rhs.hwPhi() && hwQual_ == rhs.hwQual() && + hwIso_ == rhs.hwIso(); + } +} // namespace l1t::io_v1 diff --git a/DataFormats/L1Trigger/src/Muon.cc b/DataFormats/L1Trigger/src/Muon.cc index bdb1905885b2a..fd57a9acbbec0 100644 --- a/DataFormats/L1Trigger/src/Muon.cc +++ b/DataFormats/L1Trigger/src/Muon.cc @@ -1,110 +1,113 @@ #include "DataFormats/L1Trigger/interface/Muon.h" -l1t::Muon::Muon() - : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), - hwCharge_(0), - hwChargeValid_(0), - tfMuonIndex_(-1), - hwTag_(0), - debug_(false), - hwIsoSum_(0), - hwDPhiExtra_(0), - hwDEtaExtra_(0), - hwRank_(0), - hwEtaAtVtx_(0), - hwPhiAtVtx_(0), - etaAtVtx_(0.), - phiAtVtx_(0.), - hwPtUnconstrained_(0), - ptUnconstrained_(0.), - hwDXY_(0) {} +namespace l1t::io_v1 { -l1t::Muon::Muon(const LorentzVector& p4, - int pt, - int eta, - int phi, - int qual, - int charge, - int chargeValid, - int iso, - int tfMuonIndex, - int tag, - bool debug, - int isoSum, - int dPhi, - int dEta, - int rank, - int hwEtaAtVtx, - int hwPhiAtVtx, - double etaAtVtx, - double phiAtVtx, - int hwPtUnconstrained, - double ptUnconstrained, - int dXY) - : L1Candidate(p4, pt, eta, phi, qual, iso), - hwCharge_(charge), - hwChargeValid_(chargeValid), - tfMuonIndex_(tfMuonIndex), - hwTag_(tag), - debug_(debug), - hwIsoSum_(isoSum), - hwDPhiExtra_(dPhi), - hwDEtaExtra_(dEta), - hwRank_(rank), - hwEtaAtVtx_(hwEtaAtVtx), - hwPhiAtVtx_(hwPhiAtVtx), - etaAtVtx_(etaAtVtx), - phiAtVtx_(phiAtVtx), - hwPtUnconstrained_(hwPtUnconstrained), - ptUnconstrained_(ptUnconstrained), - hwDXY_(dXY) {} + Muon::Muon() + : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), + hwCharge_(0), + hwChargeValid_(0), + tfMuonIndex_(-1), + hwTag_(0), + debug_(false), + hwIsoSum_(0), + hwDPhiExtra_(0), + hwDEtaExtra_(0), + hwRank_(0), + hwEtaAtVtx_(0), + hwPhiAtVtx_(0), + etaAtVtx_(0.), + phiAtVtx_(0.), + hwPtUnconstrained_(0), + ptUnconstrained_(0.), + hwDXY_(0) {} -l1t::Muon::Muon(const PolarLorentzVector& p4, - int pt, - int eta, - int phi, - int qual, - int charge, - int chargeValid, - int iso, - int tfMuonIndex, - int tag, - bool debug, - int isoSum, - int dPhi, - int dEta, - int rank, - int hwEtaAtVtx, - int hwPhiAtVtx, - double etaAtVtx, - double phiAtVtx, - int hwPtUnconstrained, - double ptUnconstrained, - int dXY) - : L1Candidate(p4, pt, eta, phi, qual, iso), - hwCharge_(charge), - hwChargeValid_(chargeValid), - tfMuonIndex_(tfMuonIndex), - hwTag_(tag), - debug_(debug), - hwIsoSum_(isoSum), - hwDPhiExtra_(dPhi), - hwDEtaExtra_(dEta), - hwRank_(rank), - hwEtaAtVtx_(hwEtaAtVtx), - hwPhiAtVtx_(hwPhiAtVtx), - etaAtVtx_(etaAtVtx), - phiAtVtx_(phiAtVtx), - hwPtUnconstrained_(hwPtUnconstrained), - ptUnconstrained_(ptUnconstrained), - hwDXY_(dXY) {} + Muon::Muon(const LorentzVector& p4, + int pt, + int eta, + int phi, + int qual, + int charge, + int chargeValid, + int iso, + int tfMuonIndex, + int tag, + bool debug, + int isoSum, + int dPhi, + int dEta, + int rank, + int hwEtaAtVtx, + int hwPhiAtVtx, + double etaAtVtx, + double phiAtVtx, + int hwPtUnconstrained, + double ptUnconstrained, + int dXY) + : L1Candidate(p4, pt, eta, phi, qual, iso), + hwCharge_(charge), + hwChargeValid_(chargeValid), + tfMuonIndex_(tfMuonIndex), + hwTag_(tag), + debug_(debug), + hwIsoSum_(isoSum), + hwDPhiExtra_(dPhi), + hwDEtaExtra_(dEta), + hwRank_(rank), + hwEtaAtVtx_(hwEtaAtVtx), + hwPhiAtVtx_(hwPhiAtVtx), + etaAtVtx_(etaAtVtx), + phiAtVtx_(phiAtVtx), + hwPtUnconstrained_(hwPtUnconstrained), + ptUnconstrained_(ptUnconstrained), + hwDXY_(dXY) {} -l1t::Muon::~Muon() {} + Muon::Muon(const PolarLorentzVector& p4, + int pt, + int eta, + int phi, + int qual, + int charge, + int chargeValid, + int iso, + int tfMuonIndex, + int tag, + bool debug, + int isoSum, + int dPhi, + int dEta, + int rank, + int hwEtaAtVtx, + int hwPhiAtVtx, + double etaAtVtx, + double phiAtVtx, + int hwPtUnconstrained, + double ptUnconstrained, + int dXY) + : L1Candidate(p4, pt, eta, phi, qual, iso), + hwCharge_(charge), + hwChargeValid_(chargeValid), + tfMuonIndex_(tfMuonIndex), + hwTag_(tag), + debug_(debug), + hwIsoSum_(isoSum), + hwDPhiExtra_(dPhi), + hwDEtaExtra_(dEta), + hwRank_(rank), + hwEtaAtVtx_(hwEtaAtVtx), + hwPhiAtVtx_(hwPhiAtVtx), + etaAtVtx_(etaAtVtx), + phiAtVtx_(phiAtVtx), + hwPtUnconstrained_(hwPtUnconstrained), + ptUnconstrained_(ptUnconstrained), + hwDXY_(dXY) {} -bool l1t::Muon::operator==(const l1t::Muon& rhs) const { - return l1t::L1Candidate::operator==(static_cast(rhs)) && hwCharge_ == rhs.hwCharge() && - hwChargeValid_ == rhs.hwChargeValid() && tfMuonIndex_ == rhs.tfMuonIndex() && - hwEtaAtVtx_ == rhs.hwEtaAtVtx() && hwPhiAtVtx_ == rhs.hwPhiAtVtx() && - hwPtUnconstrained_ == rhs.hwPtUnconstrained() && ptUnconstrained_ == rhs.ptUnconstrained() && - hwDXY_ == rhs.hwDXY(); -} + Muon::~Muon() {} + + bool Muon::operator==(const Muon& rhs) const { + return L1Candidate::operator==(static_cast(rhs)) && hwCharge_ == rhs.hwCharge() && + hwChargeValid_ == rhs.hwChargeValid() && tfMuonIndex_ == rhs.tfMuonIndex() && + hwEtaAtVtx_ == rhs.hwEtaAtVtx() && hwPhiAtVtx_ == rhs.hwPhiAtVtx() && + hwPtUnconstrained_ == rhs.hwPtUnconstrained() && ptUnconstrained_ == rhs.ptUnconstrained() && + hwDXY_ == rhs.hwDXY(); + } +} // namespace l1t::io_v1 diff --git a/DataFormats/L1Trigger/src/MuonShower.cc b/DataFormats/L1Trigger/src/MuonShower.cc index 9f4de93739996..81d6896f5c636 100644 --- a/DataFormats/L1Trigger/src/MuonShower.cc +++ b/DataFormats/L1Trigger/src/MuonShower.cc @@ -1,29 +1,31 @@ #include "DataFormats/L1Trigger/interface/MuonShower.h" -l1t::MuonShower::MuonShower(bool oneNominalInTime, - bool oneNominalOutOfTime, - bool twoLooseInTime, - bool twoLooseOutOfTime, - bool oneTightInTime, - bool oneTightOutOfTime, - bool twoLooseDiffSectorsInTime) - : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), - // in this object it makes more sense to the different shower types to - // the 4 bits, so that the object easily interfaces with the uGT emulator - oneNominalInTime_(oneNominalInTime), - oneTightInTime_(oneTightInTime), - twoLooseDiffSectorsInTime_(twoLooseDiffSectorsInTime), - musOutOfTime0_(false), - musOutOfTime1_(false) {} +namespace l1t::io_v1 { + MuonShower::MuonShower(bool oneNominalInTime, + bool oneNominalOutOfTime, + bool twoLooseInTime, + bool twoLooseOutOfTime, + bool oneTightInTime, + bool oneTightOutOfTime, + bool twoLooseDiffSectorsInTime) + : L1Candidate(math::PtEtaPhiMLorentzVector{0., 0., 0., 0.}, 0., 0., 0., 0, 0), + // in this object it makes more sense to the different shower types to + // the 4 bits, so that the object easily interfaces with the uGT emulator + oneNominalInTime_(oneNominalInTime), + oneTightInTime_(oneTightInTime), + twoLooseDiffSectorsInTime_(twoLooseDiffSectorsInTime), + musOutOfTime0_(false), + musOutOfTime1_(false) {} -l1t::MuonShower::~MuonShower() {} + MuonShower::~MuonShower() {} -bool l1t::MuonShower::isValid() const { - return oneNominalInTime_ or oneTightInTime_ or twoLooseDiffSectorsInTime_ or musOutOfTime0_ or musOutOfTime1_; -} + bool MuonShower::isValid() const { + return oneNominalInTime_ or oneTightInTime_ or twoLooseDiffSectorsInTime_ or musOutOfTime0_ or musOutOfTime1_; + } -bool l1t::MuonShower::operator==(const l1t::MuonShower& rhs) const { - return (oneNominalInTime_ == rhs.isOneNominalInTime() and oneTightInTime_ == rhs.isOneTightInTime() and - musOutOfTime0_ == rhs.musOutOfTime0() and musOutOfTime1_ == rhs.musOutOfTime1() and - twoLooseDiffSectorsInTime_ == rhs.isTwoLooseDiffSectorsInTime()); -} + bool MuonShower::operator==(const MuonShower& rhs) const { + return (oneNominalInTime_ == rhs.isOneNominalInTime() and oneTightInTime_ == rhs.isOneTightInTime() and + musOutOfTime0_ == rhs.musOutOfTime0() and musOutOfTime1_ == rhs.musOutOfTime1() and + twoLooseDiffSectorsInTime_ == rhs.isTwoLooseDiffSectorsInTime()); + } +} // namespace l1t::io_v1 diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index ae574642ceb45..b974886982dc5 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -1,12 +1,10 @@ - - - - + + - + @@ -15,10 +13,9 @@ - - - - + + + @@ -29,23 +26,20 @@ - - + + - + - - - - - + + - + @@ -53,23 +47,17 @@ - - - - + + - - - - - - - - - + + + + + - + @@ -78,15 +66,12 @@ - - - - - + + - - + + @@ -101,14 +86,11 @@ - - - - - + + - + @@ -117,20 +99,12 @@ - - - - - - - - - - + + - + - + @@ -139,15 +113,12 @@ - - - - - + + - + - + @@ -156,46 +127,31 @@ - - - - - + + - - - - - + + - - - - - + + - - - - + + - - - - - + + - - + + - - - + + @@ -211,8 +167,8 @@ - - + + @@ -239,33 +195,31 @@ - + - + - + - + - + - - + + - - + + - - + + - - - - + + @@ -304,34 +258,33 @@ - - + + - - + + - - + + - + - - - + + - - + + - - + + - - - + + + @@ -341,12 +294,11 @@ - - - + + - - + + diff --git a/DataFormats/LTCDigi/src/classes_def.xml b/DataFormats/LTCDigi/src/classes_def.xml index eeb27b5f21d2f..978c93ff4fc23 100644 --- a/DataFormats/LTCDigi/src/classes_def.xml +++ b/DataFormats/LTCDigi/src/classes_def.xml @@ -1,7 +1,6 @@ - - - + + diff --git a/DataFormats/Luminosity/src/classes_def.xml b/DataFormats/Luminosity/src/classes_def.xml index 52c6c5668725f..180d3ad7eb9d6 100644 --- a/DataFormats/Luminosity/src/classes_def.xml +++ b/DataFormats/Luminosity/src/classes_def.xml @@ -5,26 +5,23 @@ - - + + - - - - + + - - + + - - + + - - - + + - - + + @@ -36,24 +33,20 @@ - - - + + - - - + + - - - + + - - - + + diff --git a/DataFormats/METReco/interface/BeamHaloSummary.h b/DataFormats/METReco/interface/BeamHaloSummary.h index e32e0701f8d1a..6847278abedb4 100644 --- a/DataFormats/METReco/interface/BeamHaloSummary.h +++ b/DataFormats/METReco/interface/BeamHaloSummary.h @@ -22,80 +22,86 @@ namespace reco { class BeamHaloInfoProducer; + namespace io_v1 { - class BeamHaloSummary { - friend class reco::BeamHaloInfoProducer; + class BeamHaloSummary { + friend class reco::BeamHaloInfoProducer; - public: - //constructors - BeamHaloSummary(); - BeamHaloSummary(CSCHaloData& csc, EcalHaloData& ecal, HcalHaloData& hcal, GlobalHaloData& global); + public: + //constructors + BeamHaloSummary(); + BeamHaloSummary(CSCHaloData& csc, EcalHaloData& ecal, HcalHaloData& hcal, GlobalHaloData& global); - //destructor - virtual ~BeamHaloSummary() {} + //destructor + virtual ~BeamHaloSummary() {} - const bool HcalLooseHaloId() const { return !HcalHaloReport.empty() ? HcalHaloReport[0] : false; } - const bool HcalTightHaloId() const { return HcalHaloReport.size() > 1 ? HcalHaloReport[1] : false; } + const bool HcalLooseHaloId() const { return !HcalHaloReport.empty() ? HcalHaloReport[0] : false; } + const bool HcalTightHaloId() const { return HcalHaloReport.size() > 1 ? HcalHaloReport[1] : false; } - const bool EcalLooseHaloId() const { return !EcalHaloReport.empty() ? EcalHaloReport[0] : false; } - const bool EcalTightHaloId() const { return EcalHaloReport.size() > 1 ? EcalHaloReport[1] : false; } + const bool EcalLooseHaloId() const { return !EcalHaloReport.empty() ? EcalHaloReport[0] : false; } + const bool EcalTightHaloId() const { return EcalHaloReport.size() > 1 ? EcalHaloReport[1] : false; } - const bool CSCLooseHaloId() const { return !CSCHaloReport.empty() ? CSCHaloReport[0] : false; } - const bool CSCTightHaloId() const { return CSCHaloReport.size() > 1 ? CSCHaloReport[1] : false; } - const bool CSCTightHaloIdTrkMuUnveto() const { return CSCHaloReport.size() > 4 ? CSCHaloReport[4] : false; } - const bool CSCTightHaloId2015() const { return CSCHaloReport.size() > 5 ? CSCHaloReport[5] : false; } + const bool CSCLooseHaloId() const { return !CSCHaloReport.empty() ? CSCHaloReport[0] : false; } + const bool CSCTightHaloId() const { return CSCHaloReport.size() > 1 ? CSCHaloReport[1] : false; } + const bool CSCTightHaloIdTrkMuUnveto() const { return CSCHaloReport.size() > 4 ? CSCHaloReport[4] : false; } + const bool CSCTightHaloId2015() const { return CSCHaloReport.size() > 5 ? CSCHaloReport[5] : false; } - const bool GlobalLooseHaloId() const { return !GlobalHaloReport.empty() ? GlobalHaloReport[0] : false; } - const bool GlobalTightHaloId() const { return GlobalHaloReport.size() > 1 ? GlobalHaloReport[1] : false; } - const bool GlobalTightHaloId2016() const { return GlobalHaloReport.size() > 2 ? GlobalHaloReport[2] : false; } - const bool GlobalSuperTightHaloId2016() const { return GlobalHaloReport.size() > 3 ? GlobalHaloReport[3] : false; } + const bool GlobalLooseHaloId() const { return !GlobalHaloReport.empty() ? GlobalHaloReport[0] : false; } + const bool GlobalTightHaloId() const { return GlobalHaloReport.size() > 1 ? GlobalHaloReport[1] : false; } + const bool GlobalTightHaloId2016() const { return GlobalHaloReport.size() > 2 ? GlobalHaloReport[2] : false; } + const bool GlobalSuperTightHaloId2016() const { + return GlobalHaloReport.size() > 3 ? GlobalHaloReport[3] : false; + } - const bool EventSmellsLikeHalo() const { - return HcalLooseHaloId() || EcalLooseHaloId() || CSCLooseHaloId() || GlobalLooseHaloId(); - } - const bool LooseId() const { return EventSmellsLikeHalo(); } - const bool TightId() const { - return HcalTightHaloId() || EcalTightHaloId() || CSCTightHaloId() || GlobalTightHaloId(); - } - const bool ExtremeTightId() const { return GlobalTightHaloId(); } + const bool EventSmellsLikeHalo() const { + return HcalLooseHaloId() || EcalLooseHaloId() || CSCLooseHaloId() || GlobalLooseHaloId(); + } + const bool LooseId() const { return EventSmellsLikeHalo(); } + const bool TightId() const { + return HcalTightHaloId() || EcalTightHaloId() || CSCTightHaloId() || GlobalTightHaloId(); + } + const bool ExtremeTightId() const { return GlobalTightHaloId(); } - // Getters - std::vector& GetHcalHaloReport() { return HcalHaloReport; } - const std::vector& GetHcalHaloReport() const { return HcalHaloReport; } + // Getters + std::vector& GetHcalHaloReport() { return HcalHaloReport; } + const std::vector& GetHcalHaloReport() const { return HcalHaloReport; } - std::vector& GetEcalHaloReport() { return EcalHaloReport; } - const std::vector& GetEcalHaloReport() const { return EcalHaloReport; } + std::vector& GetEcalHaloReport() { return EcalHaloReport; } + const std::vector& GetEcalHaloReport() const { return EcalHaloReport; } - std::vector& GetCSCHaloReport() { return CSCHaloReport; } - const std::vector& GetCSCHaloReport() const { return CSCHaloReport; } + std::vector& GetCSCHaloReport() { return CSCHaloReport; } + const std::vector& GetCSCHaloReport() const { return CSCHaloReport; } - std::vector& GetGlobalHaloReport() { return GlobalHaloReport; } - const std::vector& GetGlobalHaloReport() const { return GlobalHaloReport; } + std::vector& GetGlobalHaloReport() { return GlobalHaloReport; } + const std::vector& GetGlobalHaloReport() const { return GlobalHaloReport; } - std::vector& GetHcaliPhiSuspects() { return HcaliPhiSuspects; } - const std::vector& GetHcaliPhiSuspects() const { return HcaliPhiSuspects; } + std::vector& GetHcaliPhiSuspects() { return HcaliPhiSuspects; } + const std::vector& GetHcaliPhiSuspects() const { return HcaliPhiSuspects; } - std::vector& GetEcaliPhiSuspects() { return EcaliPhiSuspects; } - const std::vector& GetEcaliPhiSuspects() const { return EcaliPhiSuspects; } + std::vector& GetEcaliPhiSuspects() { return EcaliPhiSuspects; } + const std::vector& GetEcaliPhiSuspects() const { return EcaliPhiSuspects; } - std::vector& GetGlobaliPhiSuspects() { return GlobaliPhiSuspects; } - const std::vector& GetGlobaliPhiSuspects() const { return GlobaliPhiSuspects; } + std::vector& GetGlobaliPhiSuspects() { return GlobaliPhiSuspects; } + const std::vector& GetGlobaliPhiSuspects() const { return GlobaliPhiSuspects; } - std::vector& getProblematicStrips() { return problematicStrips; } - const std::vector& getProblematicStrips() const { return problematicStrips; } + std::vector& getProblematicStrips() { return problematicStrips; } + const std::vector& getProblematicStrips() const { return problematicStrips; } - private: - std::vector HcalHaloReport; - std::vector EcalHaloReport; - std::vector CSCHaloReport; - std::vector GlobalHaloReport; + private: + std::vector HcalHaloReport; + std::vector EcalHaloReport; + std::vector CSCHaloReport; + std::vector GlobalHaloReport; - std::vector HcaliPhiSuspects; - std::vector EcaliPhiSuspects; - std::vector GlobaliPhiSuspects; + std::vector HcaliPhiSuspects; + std::vector EcaliPhiSuspects; + std::vector GlobaliPhiSuspects; - std::vector problematicStrips; - }; + std::vector problematicStrips; + }; + + } // namespace io_v1 + using BeamHaloSummary = io_v1::BeamHaloSummary; } // namespace reco diff --git a/DataFormats/METReco/interface/CSCHaloData.h b/DataFormats/METReco/interface/CSCHaloData.h index 1d50c0fd1b48d..28973e0183238 100644 --- a/DataFormats/METReco/interface/CSCHaloData.h +++ b/DataFormats/METReco/interface/CSCHaloData.h @@ -20,144 +20,148 @@ */ namespace reco { - - class CSCHaloData { - public: - // Default constructor - CSCHaloData(); - - virtual ~CSCHaloData() {} - - // Number of HaloTriggers in +/- endcap - int NumberOfHaloTriggers(HaloData::Endcap z = HaloData::both) const; - int NumberOfHaloTriggers_TrkMuUnVeto(HaloData::Endcap z = HaloData::both) const; - int NHaloTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTriggers(z); } - - // Number of Halo Tracks in +/- endcap - int NumberOfHaloTracks(HaloData::Endcap z = HaloData::both) const; - int NHaloTracks(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTracks(z); } - - // Halo trigger bit from the HLT - bool CSCHaloHLTAccept() const { return HLTAccept; } - - // Number of chamber-level triggers with non-collision timing - short int NumberOfOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const; - short int NOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfOutOfTimeTriggers(z); } - // Number of CSCRecHits with non-collision timing - short int NumberOfOutTimeHits() const { return nOutOfTimeHits; } - short int NOutOfTimeHits() const { return nOutOfTimeHits; } - // Look at number of muons with timing consistent with incoming particles - short int NTracksSmalldT() const { return nTracks_Small_dT; } - short int NTracksSmallBeta() const { return nTracks_Small_beta; } - short int NTracksSmallBetaAndSmalldT() const { return nTracks_Small_dT_Small_beta; } - - // MLR - short int NFlatHaloSegments() const { return nFlatHaloSegments; } - bool GetSegmentsInBothEndcaps() const { return segments_in_both_endcaps; } - bool GetSegmentIsCaloMatched() const { return segmentiscalomatched; } - bool GetSegmentIsHCaloMatched() const { return segmentisHcalomatched; } - bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } - bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } - // End MLR - short int NFlatHaloSegments_TrkMuUnVeto() const { return nFlatHaloSegments_TrkMuUnVeto; } - bool GetSegmentsInBothEndcaps_Loose_TrkMuUnVeto() const { return segments_in_both_endcaps_loose_TrkMuUnVeto; } - bool GetSegmentsInBothEndcaps_Loose_dTcut_TrkMuUnVeto() const { - return segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; - } - - // Get Reference to the Tracks - edm::RefVector& GetTracks() { return TheTrackRefs; } - const edm::RefVector& GetTracks() const { return TheTrackRefs; } - - // Set Number of Halo Triggers - void SetNumberOfHaloTriggers(int PlusZ, int MinusZ) { - nTriggers_PlusZ = PlusZ; - nTriggers_MinusZ = MinusZ; - } - void SetNumberOfHaloTriggers_TrkMuUnVeto(int PlusZ, int MinusZ) { - nTriggers_PlusZ_TrkMuUnVeto = PlusZ; - nTriggers_MinusZ_TrkMuUnVeto = MinusZ; - } - // Set number of chamber-level triggers with non-collision timing - void SetNOutOfTimeTriggers(short int PlusZ, short int MinusZ) { - nOutOfTimeTriggers_PlusZ = PlusZ; - nOutOfTimeTriggers_MinusZ = MinusZ; - } - // Set number of CSCRecHits with non-collision timing - void SetNOutOfTimeHits(short int num) { nOutOfTimeHits = num; } - // Set number of tracks with timing consistent with incoming particles - void SetNIncomingTracks(short int n_small_dT, short int n_small_beta, short int n_small_both) { - nTracks_Small_dT = n_small_dT; - nTracks_Small_beta = n_small_beta; - nTracks_Small_dT_Small_beta = n_small_both; - } - - // Set HLT Bit - void SetHLTBit(bool status) { HLTAccept = status; } - - // Get GlobalPoints of CSC tracking rechits nearest to the calorimeters - //std::vector& GetCSCTrackImpactPositions() const {return TheGlobalPositions;} - const std::vector& GetCSCTrackImpactPositions() const { return TheGlobalPositions; } - std::vector& GetCSCTrackImpactPositions() { return TheGlobalPositions; } - - // MLR - // Set # of CSCSegments that appear to be part of a halo muon - // If there is more than 1 muon, this is the number of segments in the halo muon - // with the largest number of segments that pass the cut. - void SetNFlatHaloSegments(short int nSegments) { nFlatHaloSegments = nSegments; } - void SetSegmentsBothEndcaps(bool b) { segments_in_both_endcaps = b; } - // End MLR - void SetNFlatHaloSegments_TrkMuUnVeto(short int nSegments) { nFlatHaloSegments_TrkMuUnVeto = nSegments; } - void SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(bool b) { segments_in_both_endcaps_loose_TrkMuUnVeto = b; } - void SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(bool b) { - segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto = b; - } - void SetSegmentIsCaloMatched(bool b) { segmentiscalomatched = b; } - void SetSegmentIsHCaloMatched(bool b) { segmentisHcalomatched = b; } - void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } - void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } - - private: - edm::RefVector TheTrackRefs; - - // The GlobalPoints from constituent rechits nearest to the calorimeter of CSC tracks - std::vector TheGlobalPositions; - int nTriggers_PlusZ; - int nTriggers_MinusZ; - int nTriggers_PlusZ_TrkMuUnVeto; - int nTriggers_MinusZ_TrkMuUnVeto; - // CSC halo trigger reported by the HLT - bool HLTAccept; - - int nTracks_PlusZ; - int nTracks_MinusZ; - - // number of out-of-time chamber-level triggers (assumes the event triggered at the bx of the beam crossing) - short int nOutOfTimeTriggers_PlusZ; - short int nOutOfTimeTriggers_MinusZ; - // number of out-of-time CSCRecHit2Ds (assumes the event triggered at the bx of the beam crossing) - short int nOutOfTimeHits; - // number of cosmic muon outer (CSC) tracks with (T_segment_outer - T_segment_inner) < max_dt_muon_segment - short int nTracks_Small_dT; - // number of cosmic muon outer (CSC) tracks with free inverse beta < max_free_inverse_beta - short int nTracks_Small_beta; - // number of cosmic muon outer (CSC) tracks with both - // (T_segment_outer - T_segment_inner) < max_dt_muon_segment and free inverse beta < max_free_inverse_beta - short int nTracks_Small_dT_Small_beta; - - // MLR - // number of CSCSegments that are flat and have the same (r,phi) - short int nFlatHaloSegments; - bool segments_in_both_endcaps; - // end MLR - short int nFlatHaloSegments_TrkMuUnVeto; - bool segments_in_both_endcaps_loose_TrkMuUnVeto; - bool segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; - bool segmentiscalomatched; - bool segmentisHcalomatched; - bool segmentisEBcalomatched; - bool segmentisEEcalomatched; - }; + namespace io_v1 { + + class CSCHaloData { + public: + // Default constructor + CSCHaloData(); + + virtual ~CSCHaloData() {} + + // Number of HaloTriggers in +/- endcap + int NumberOfHaloTriggers(HaloData::Endcap z = HaloData::both) const; + int NumberOfHaloTriggers_TrkMuUnVeto(HaloData::Endcap z = HaloData::both) const; + int NHaloTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTriggers(z); } + + // Number of Halo Tracks in +/- endcap + int NumberOfHaloTracks(HaloData::Endcap z = HaloData::both) const; + int NHaloTracks(HaloData::Endcap z = HaloData::both) const { return NumberOfHaloTracks(z); } + + // Halo trigger bit from the HLT + bool CSCHaloHLTAccept() const { return HLTAccept; } + + // Number of chamber-level triggers with non-collision timing + short int NumberOfOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const; + short int NOutOfTimeTriggers(HaloData::Endcap z = HaloData::both) const { return NumberOfOutOfTimeTriggers(z); } + // Number of CSCRecHits with non-collision timing + short int NumberOfOutTimeHits() const { return nOutOfTimeHits; } + short int NOutOfTimeHits() const { return nOutOfTimeHits; } + // Look at number of muons with timing consistent with incoming particles + short int NTracksSmalldT() const { return nTracks_Small_dT; } + short int NTracksSmallBeta() const { return nTracks_Small_beta; } + short int NTracksSmallBetaAndSmalldT() const { return nTracks_Small_dT_Small_beta; } + + // MLR + short int NFlatHaloSegments() const { return nFlatHaloSegments; } + bool GetSegmentsInBothEndcaps() const { return segments_in_both_endcaps; } + bool GetSegmentIsCaloMatched() const { return segmentiscalomatched; } + bool GetSegmentIsHCaloMatched() const { return segmentisHcalomatched; } + bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } + bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } + // End MLR + short int NFlatHaloSegments_TrkMuUnVeto() const { return nFlatHaloSegments_TrkMuUnVeto; } + bool GetSegmentsInBothEndcaps_Loose_TrkMuUnVeto() const { return segments_in_both_endcaps_loose_TrkMuUnVeto; } + bool GetSegmentsInBothEndcaps_Loose_dTcut_TrkMuUnVeto() const { + return segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; + } + + // Get Reference to the Tracks + edm::RefVector& GetTracks() { return TheTrackRefs; } + const edm::RefVector& GetTracks() const { return TheTrackRefs; } + + // Set Number of Halo Triggers + void SetNumberOfHaloTriggers(int PlusZ, int MinusZ) { + nTriggers_PlusZ = PlusZ; + nTriggers_MinusZ = MinusZ; + } + void SetNumberOfHaloTriggers_TrkMuUnVeto(int PlusZ, int MinusZ) { + nTriggers_PlusZ_TrkMuUnVeto = PlusZ; + nTriggers_MinusZ_TrkMuUnVeto = MinusZ; + } + // Set number of chamber-level triggers with non-collision timing + void SetNOutOfTimeTriggers(short int PlusZ, short int MinusZ) { + nOutOfTimeTriggers_PlusZ = PlusZ; + nOutOfTimeTriggers_MinusZ = MinusZ; + } + // Set number of CSCRecHits with non-collision timing + void SetNOutOfTimeHits(short int num) { nOutOfTimeHits = num; } + // Set number of tracks with timing consistent with incoming particles + void SetNIncomingTracks(short int n_small_dT, short int n_small_beta, short int n_small_both) { + nTracks_Small_dT = n_small_dT; + nTracks_Small_beta = n_small_beta; + nTracks_Small_dT_Small_beta = n_small_both; + } + + // Set HLT Bit + void SetHLTBit(bool status) { HLTAccept = status; } + + // Get GlobalPoints of CSC tracking rechits nearest to the calorimeters + //std::vector& GetCSCTrackImpactPositions() const {return TheGlobalPositions;} + const std::vector& GetCSCTrackImpactPositions() const { return TheGlobalPositions; } + std::vector& GetCSCTrackImpactPositions() { return TheGlobalPositions; } + + // MLR + // Set # of CSCSegments that appear to be part of a halo muon + // If there is more than 1 muon, this is the number of segments in the halo muon + // with the largest number of segments that pass the cut. + void SetNFlatHaloSegments(short int nSegments) { nFlatHaloSegments = nSegments; } + void SetSegmentsBothEndcaps(bool b) { segments_in_both_endcaps = b; } + // End MLR + void SetNFlatHaloSegments_TrkMuUnVeto(short int nSegments) { nFlatHaloSegments_TrkMuUnVeto = nSegments; } + void SetSegmentsBothEndcaps_Loose_TrkMuUnVeto(bool b) { segments_in_both_endcaps_loose_TrkMuUnVeto = b; } + void SetSegmentsBothEndcaps_Loose_dTcut_TrkMuUnVeto(bool b) { + segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto = b; + } + void SetSegmentIsCaloMatched(bool b) { segmentiscalomatched = b; } + void SetSegmentIsHCaloMatched(bool b) { segmentisHcalomatched = b; } + void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } + void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } + + private: + edm::RefVector TheTrackRefs; + + // The GlobalPoints from constituent rechits nearest to the calorimeter of CSC tracks + std::vector TheGlobalPositions; + int nTriggers_PlusZ; + int nTriggers_MinusZ; + int nTriggers_PlusZ_TrkMuUnVeto; + int nTriggers_MinusZ_TrkMuUnVeto; + // CSC halo trigger reported by the HLT + bool HLTAccept; + + int nTracks_PlusZ; + int nTracks_MinusZ; + + // number of out-of-time chamber-level triggers (assumes the event triggered at the bx of the beam crossing) + short int nOutOfTimeTriggers_PlusZ; + short int nOutOfTimeTriggers_MinusZ; + // number of out-of-time CSCRecHit2Ds (assumes the event triggered at the bx of the beam crossing) + short int nOutOfTimeHits; + // number of cosmic muon outer (CSC) tracks with (T_segment_outer - T_segment_inner) < max_dt_muon_segment + short int nTracks_Small_dT; + // number of cosmic muon outer (CSC) tracks with free inverse beta < max_free_inverse_beta + short int nTracks_Small_beta; + // number of cosmic muon outer (CSC) tracks with both + // (T_segment_outer - T_segment_inner) < max_dt_muon_segment and free inverse beta < max_free_inverse_beta + short int nTracks_Small_dT_Small_beta; + + // MLR + // number of CSCSegments that are flat and have the same (r,phi) + short int nFlatHaloSegments; + bool segments_in_both_endcaps; + // end MLR + short int nFlatHaloSegments_TrkMuUnVeto; + bool segments_in_both_endcaps_loose_TrkMuUnVeto; + bool segments_in_both_endcaps_loose_dtcut_TrkMuUnVeto; + bool segmentiscalomatched; + bool segmentisHcalomatched; + bool segmentisEBcalomatched; + bool segmentisEEcalomatched; + }; + + } // namespace io_v1 + using CSCHaloData = io_v1::CSCHaloData; } // namespace reco diff --git a/DataFormats/METReco/interface/CaloMET.h b/DataFormats/METReco/interface/CaloMET.h index df27993fd7141..3dd8692bb2932 100644 --- a/DataFormats/METReco/interface/CaloMET.h +++ b/DataFormats/METReco/interface/CaloMET.h @@ -18,69 +18,72 @@ #include "DataFormats/METReco/interface/CorrMETData.h" namespace reco { - class CaloMET : public MET { - public: - /* Constructors*/ - CaloMET(); - CaloMET(const SpecificCaloMETData& calo_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) - : MET(sumet_, fP4, fVertex), calo_data(calo_data_) {} - CaloMET(const SpecificCaloMETData& calo_data_, - double sumet_, - const std::vector& corr_, - const LorentzVector& fP4, - const Point& fVertex) - : MET(sumet_, corr_, fP4, fVertex), calo_data(calo_data_) {} - /* Default destructor*/ - ~CaloMET() override {} + namespace io_v1 { + class CaloMET : public MET { + public: + /* Constructors*/ + CaloMET(); + CaloMET(const SpecificCaloMETData& calo_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) + : MET(sumet_, fP4, fVertex), calo_data(calo_data_) {} + CaloMET(const SpecificCaloMETData& calo_data_, + double sumet_, + const std::vector& corr_, + const LorentzVector& fP4, + const Point& fVertex) + : MET(sumet_, corr_, fP4, fVertex), calo_data(calo_data_) {} + /* Default destructor*/ + ~CaloMET() override {} - /* Returns the maximum energy deposited in ECAL towers */ - double maxEtInEmTowers() const { return calo_data.MaxEtInEmTowers; }; - /* Returns the maximum energy deposited in HCAL towers */ - double maxEtInHadTowers() const { return calo_data.MaxEtInHadTowers; }; - /* Returns the event hadronic energy fraction */ - double etFractionHadronic() const { return calo_data.EtFractionHadronic; }; - /* Returns the event electromagnetic energy fraction */ - double emEtFraction() const { return calo_data.EtFractionEm; }; - /* Returns the event hadronic energy in HB */ - double hadEtInHB() const { return calo_data.HadEtInHB; }; - /* Returns the event hadronic energy in HO */ - double hadEtInHO() const { return calo_data.HadEtInHO; }; - /* Returns the event hadronic energy in HE */ - double hadEtInHE() const { return calo_data.HadEtInHE; }; - /* Returns the event hadronic energy in HF */ - double hadEtInHF() const { return calo_data.HadEtInHF; }; - /* Returns the event electromagnetic energy in EB */ - double emEtInEB() const { return calo_data.EmEtInEB; }; - /* Returns the event electromagnetic energy in EE */ - double emEtInEE() const { return calo_data.EmEtInEE; }; - /* Returns the event electromagnetic energy extracted from HF */ - double emEtInHF() const { return calo_data.EmEtInHF; }; - /* Returns the event MET Significance */ - double metSignificance() const { return this->significance(); }; - /* Returns the event SET in HF+ */ - double CaloSETInpHF() const { return calo_data.CaloSETInpHF; }; - /* Returns the event SET in HF- */ - double CaloSETInmHF() const { return calo_data.CaloSETInmHF; }; - /* Returns the event MET in HF+ */ - double CaloMETInpHF() const { return calo_data.CaloMETInpHF; }; - /* Returns the event MET in HF- */ - double CaloMETInmHF() const { return calo_data.CaloMETInmHF; }; - /* Returns the event MET-phi in HF+ */ - double CaloMETPhiInpHF() const { return calo_data.CaloMETPhiInpHF; }; - /* Returns the event MET-phi in HF- */ - double CaloMETPhiInmHF() const { return calo_data.CaloMETPhiInmHF; }; + /* Returns the maximum energy deposited in ECAL towers */ + double maxEtInEmTowers() const { return calo_data.MaxEtInEmTowers; }; + /* Returns the maximum energy deposited in HCAL towers */ + double maxEtInHadTowers() const { return calo_data.MaxEtInHadTowers; }; + /* Returns the event hadronic energy fraction */ + double etFractionHadronic() const { return calo_data.EtFractionHadronic; }; + /* Returns the event electromagnetic energy fraction */ + double emEtFraction() const { return calo_data.EtFractionEm; }; + /* Returns the event hadronic energy in HB */ + double hadEtInHB() const { return calo_data.HadEtInHB; }; + /* Returns the event hadronic energy in HO */ + double hadEtInHO() const { return calo_data.HadEtInHO; }; + /* Returns the event hadronic energy in HE */ + double hadEtInHE() const { return calo_data.HadEtInHE; }; + /* Returns the event hadronic energy in HF */ + double hadEtInHF() const { return calo_data.HadEtInHF; }; + /* Returns the event electromagnetic energy in EB */ + double emEtInEB() const { return calo_data.EmEtInEB; }; + /* Returns the event electromagnetic energy in EE */ + double emEtInEE() const { return calo_data.EmEtInEE; }; + /* Returns the event electromagnetic energy extracted from HF */ + double emEtInHF() const { return calo_data.EmEtInHF; }; + /* Returns the event MET Significance */ + double metSignificance() const { return this->significance(); }; + /* Returns the event SET in HF+ */ + double CaloSETInpHF() const { return calo_data.CaloSETInpHF; }; + /* Returns the event SET in HF- */ + double CaloSETInmHF() const { return calo_data.CaloSETInmHF; }; + /* Returns the event MET in HF+ */ + double CaloMETInpHF() const { return calo_data.CaloMETInpHF; }; + /* Returns the event MET in HF- */ + double CaloMETInmHF() const { return calo_data.CaloMETInmHF; }; + /* Returns the event MET-phi in HF+ */ + double CaloMETPhiInpHF() const { return calo_data.CaloMETPhiInpHF; }; + /* Returns the event MET-phi in HF- */ + double CaloMETPhiInmHF() const { return calo_data.CaloMETPhiInmHF; }; - //Set Met Significance - void SetMetSignificance(double metsig) { calo_data.METSignificance = metsig; } + //Set Met Significance + void SetMetSignificance(double metsig) { calo_data.METSignificance = metsig; } - // block accessors - SpecificCaloMETData getSpecific() const { return calo_data; } + // block accessors + SpecificCaloMETData getSpecific() const { return calo_data; } - private: - bool overlap(const Candidate&) const override; - // Data members - //Variables specific to to the CaloMET class - SpecificCaloMETData calo_data; - }; + private: + bool overlap(const Candidate&) const override; + // Data members + //Variables specific to to the CaloMET class + SpecificCaloMETData calo_data; + }; + } // namespace io_v1 + using CaloMET = io_v1::CaloMET; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/CaloMETFwd.h b/DataFormats/METReco/interface/CaloMETFwd.h index ca6d4a2edf37e..65157ff3178d4 100644 --- a/DataFormats/METReco/interface/CaloMETFwd.h +++ b/DataFormats/METReco/interface/CaloMETFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class CaloMET; + namespace io_v1 { + class CaloMET; + } + using CaloMET = io_v1::CaloMET; /// collection of CaloMET objects typedef std::vector CaloMETCollection; /// edm references diff --git a/DataFormats/METReco/interface/EcalHaloData.h b/DataFormats/METReco/interface/EcalHaloData.h index ac44b310aaf50..fc4acdf9c45ac 100644 --- a/DataFormats/METReco/interface/EcalHaloData.h +++ b/DataFormats/METReco/interface/EcalHaloData.h @@ -18,50 +18,53 @@ #include "DataFormats/METReco/interface/HaloClusterCandidateECAL.h" namespace reco { - class EcalHaloData { - public: - //Constructor - EcalHaloData(); - //Destructor - ~EcalHaloData() {} + namespace io_v1 { + class EcalHaloData { + public: + //Constructor + EcalHaloData(); + //Destructor + ~EcalHaloData() {} - // Number of Halo-like superclusters as a function of the roundness and angular cuts - //int NumberOfHaloSuperClusters(int iRoundness=2, int iAngle=2) const; - int NumberOfHaloSuperClusters(float roundness = 100., float angle = 4.0) const; + // Number of Halo-like superclusters as a function of the roundness and angular cuts + //int NumberOfHaloSuperClusters(int iRoundness=2, int iAngle=2) const; + int NumberOfHaloSuperClusters(float roundness = 100., float angle = 4.0) const; - // Return collection of 5-degree Phi Wedges built from Ecal RecHits - const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } - std::vector& GetPhiWedges() { return PhiWedgeCollection; } + // Return collection of 5-degree Phi Wedges built from Ecal RecHits + const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } + std::vector& GetPhiWedges() { return PhiWedgeCollection; } - // Get Reference to the SuperClusters - edm::RefVector& GetSuperClusters() { return TheSuperClusterRefs; } - const edm::RefVector& GetSuperClusters() const { return TheSuperClusterRefs; } + // Get Reference to the SuperClusters + edm::RefVector& GetSuperClusters() { return TheSuperClusterRefs; } + const edm::RefVector& GetSuperClusters() const { return TheSuperClusterRefs; } - // Store Shower Shape variables for SuperClusters - edm::ValueMap& GetShowerShapesRoundness() { return ShowerShapes_Roundness; } - const edm::ValueMap& GetShowerShapesRoundness() const { return ShowerShapes_Roundness; } + // Store Shower Shape variables for SuperClusters + edm::ValueMap& GetShowerShapesRoundness() { return ShowerShapes_Roundness; } + const edm::ValueMap& GetShowerShapesRoundness() const { return ShowerShapes_Roundness; } - edm::ValueMap& GetShowerShapesAngle() { return ShowerShapes_Angle; } - const edm::ValueMap& GetShowerShapesAngle() const { return ShowerShapes_Angle; } + edm::ValueMap& GetShowerShapesAngle() { return ShowerShapes_Angle; } + const edm::ValueMap& GetShowerShapesAngle() const { return ShowerShapes_Angle; } - const std::vector& getHaloClusterCandidatesEB() const { return thehaloclustercands_eb; } - std::vector& getHaloClusterCandidatesEB() { return thehaloclustercands_eb; } - const std::vector& getHaloClusterCandidatesEE() const { return thehaloclustercands_ee; } - std::vector& getHaloClusterCandidatesEE() { return thehaloclustercands_ee; } + const std::vector& getHaloClusterCandidatesEB() const { return thehaloclustercands_eb; } + std::vector& getHaloClusterCandidatesEB() { return thehaloclustercands_eb; } + const std::vector& getHaloClusterCandidatesEE() const { return thehaloclustercands_ee; } + std::vector& getHaloClusterCandidatesEE() { return thehaloclustercands_ee; } - void setHaloClusterCandidatesEB(const std::vector& x) { thehaloclustercands_eb = x; } - void setHaloClusterCandidatesEE(const std::vector& x) { thehaloclustercands_ee = x; } + void setHaloClusterCandidatesEB(const std::vector& x) { thehaloclustercands_eb = x; } + void setHaloClusterCandidatesEE(const std::vector& x) { thehaloclustercands_ee = x; } - private: - std::vector PhiWedgeCollection; - edm::RefVector TheSuperClusterRefs; + private: + std::vector PhiWedgeCollection; + edm::RefVector TheSuperClusterRefs; - edm::ValueMap ShowerShapes_Roundness; - edm::ValueMap ShowerShapes_Angle; + edm::ValueMap ShowerShapes_Roundness; + edm::ValueMap ShowerShapes_Angle; - std::vector thehaloclustercands_eb; - std::vector thehaloclustercands_ee; - }; + std::vector thehaloclustercands_eb; + std::vector thehaloclustercands_ee; + }; + } // namespace io_v1 + using EcalHaloData = io_v1::EcalHaloData; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/GenMET.h b/DataFormats/METReco/interface/GenMET.h index a3d0ff6bdbab6..5ace52a6791a2 100644 --- a/DataFormats/METReco/interface/GenMET.h +++ b/DataFormats/METReco/interface/GenMET.h @@ -17,68 +17,71 @@ #include "DataFormats/METReco/interface/MET.h" namespace reco { - class GenMET : public MET { - public: - /* Constructors*/ - GenMET(); - GenMET(const SpecificGenMETData& gen_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) - : MET(sumet_, fP4, fVertex), gen_data(gen_data_) {} - /* Default destructor*/ - ~GenMET() override {} - - //Get Neutral EM Et Fraction - double NeutralEMEtFraction() const { return gen_data.NeutralEMEtFraction; } - - //Get Neutral EM Et - double NeutralEMEt() const { return gen_data.NeutralEMEtFraction * sumEt(); } - - //Get Charged EM Et Fraction - double ChargedEMEtFraction() const { return gen_data.ChargedEMEtFraction; } - - //Get Charged EM Et - double ChargedEMEt() const { return gen_data.ChargedEMEtFraction * sumEt(); } - - //Get Neutral Had Et Fraction - double NeutralHadEtFraction() const { return gen_data.NeutralHadEtFraction; } - - //Get Neutral Had Et - double NeutralHadEt() const { return gen_data.NeutralHadEtFraction * sumEt(); } - - //Get Charged Had Et Fraction - double ChargedHadEtFraction() const { return gen_data.ChargedHadEtFraction; } - - //Get Charged Had Et - double ChargedHadEt() const { return gen_data.ChargedHadEtFraction * sumEt(); } - - //Get Muon Et Fraction - double MuonEtFraction() const { return gen_data.MuonEtFraction; } - - //Get Muon Et - double MuonEt() const { return gen_data.MuonEtFraction * sumEt(); } - - //Get Invisible Et Fraction - double InvisibleEtFraction() const { return gen_data.InvisibleEtFraction; } - - //Get Invisible Et - double InvisibleEt() const { return gen_data.InvisibleEtFraction * sumEt(); } - - // Old Accessors (to be removed as soon as possible) - /** Returns energy of electromagnetic particles*/ - double emEnergy() const { return gen_data.m_EmEnergy; }; - /** Returns energy of hadronic particles*/ - double hadEnergy() const { return gen_data.m_HadEnergy; }; - /** Returns invisible energy*/ - double invisibleEnergy() const { return gen_data.m_InvisibleEnergy; }; - /** Returns other energy (undecayed Sigmas etc.)*/ - double auxiliaryEnergy() const { return gen_data.m_AuxiliaryEnergy; }; - // block accessors - - // block accessors - private: - bool overlap(const Candidate&) const override; - // Data members - //Variables specific to to the GenMET class - SpecificGenMETData gen_data; - }; + namespace io_v1 { + class GenMET : public MET { + public: + /* Constructors*/ + GenMET(); + GenMET(const SpecificGenMETData& gen_data_, double sumet_, const LorentzVector& fP4, const Point& fVertex) + : MET(sumet_, fP4, fVertex), gen_data(gen_data_) {} + /* Default destructor*/ + ~GenMET() override {} + + //Get Neutral EM Et Fraction + double NeutralEMEtFraction() const { return gen_data.NeutralEMEtFraction; } + + //Get Neutral EM Et + double NeutralEMEt() const { return gen_data.NeutralEMEtFraction * sumEt(); } + + //Get Charged EM Et Fraction + double ChargedEMEtFraction() const { return gen_data.ChargedEMEtFraction; } + + //Get Charged EM Et + double ChargedEMEt() const { return gen_data.ChargedEMEtFraction * sumEt(); } + + //Get Neutral Had Et Fraction + double NeutralHadEtFraction() const { return gen_data.NeutralHadEtFraction; } + + //Get Neutral Had Et + double NeutralHadEt() const { return gen_data.NeutralHadEtFraction * sumEt(); } + + //Get Charged Had Et Fraction + double ChargedHadEtFraction() const { return gen_data.ChargedHadEtFraction; } + + //Get Charged Had Et + double ChargedHadEt() const { return gen_data.ChargedHadEtFraction * sumEt(); } + + //Get Muon Et Fraction + double MuonEtFraction() const { return gen_data.MuonEtFraction; } + + //Get Muon Et + double MuonEt() const { return gen_data.MuonEtFraction * sumEt(); } + + //Get Invisible Et Fraction + double InvisibleEtFraction() const { return gen_data.InvisibleEtFraction; } + + //Get Invisible Et + double InvisibleEt() const { return gen_data.InvisibleEtFraction * sumEt(); } + + // Old Accessors (to be removed as soon as possible) + /** Returns energy of electromagnetic particles*/ + double emEnergy() const { return gen_data.m_EmEnergy; }; + /** Returns energy of hadronic particles*/ + double hadEnergy() const { return gen_data.m_HadEnergy; }; + /** Returns invisible energy*/ + double invisibleEnergy() const { return gen_data.m_InvisibleEnergy; }; + /** Returns other energy (undecayed Sigmas etc.)*/ + double auxiliaryEnergy() const { return gen_data.m_AuxiliaryEnergy; }; + // block accessors + + // block accessors + private: + bool overlap(const Candidate&) const override; + // Data members + //Variables specific to to the GenMET class + SpecificGenMETData gen_data; + }; + } // namespace io_v1 + using GenMET = io_v1::GenMET; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/GenMETFwd.h b/DataFormats/METReco/interface/GenMETFwd.h index fd43865918b44..e6ae162012612 100644 --- a/DataFormats/METReco/interface/GenMETFwd.h +++ b/DataFormats/METReco/interface/GenMETFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class GenMET; + namespace io_v1 { + class GenMET; + } + using io_v1::GenMET; /// collection of GenMET objects typedef std::vector GenMETCollection; /// edm references diff --git a/DataFormats/METReco/interface/GlobalHaloData.h b/DataFormats/METReco/interface/GlobalHaloData.h index 1570bd51c3200..76e1aa3cad291 100644 --- a/DataFormats/METReco/interface/GlobalHaloData.h +++ b/DataFormats/METReco/interface/GlobalHaloData.h @@ -14,84 +14,87 @@ #include "DataFormats/METReco/interface/MET.h" namespace reco { - class GlobalHaloData { - public: - // Constructor - GlobalHaloData(); - // Destructor - ~GlobalHaloData() {} - - //A good cut-variable to isolate halo events with no overlapping physics from collisions - float METOverSumEt() const { return METOverSumEt_; } - - //Correction to CaloMET x-component - float DeltaMEx() const { return dMEx_; } - - //Correction to CaloMET y-component - float DeltaMEy() const { return dMEy_; } - - //Correction to SumEt - float DeltaSumEt() const { return dSumEt_; } - - //Get CaloMET Object corrected for BeamHalo - reco::CaloMET GetCorrectedCaloMET(const reco::CaloMET& RawMET) const; - - std::vector& GetMatchedHcalPhiWedges() { return HcalPhiWedges; } - const std::vector& GetMatchedHcalPhiWedges() const { return HcalPhiWedges; } - - std::vector& GetMatchedEcalPhiWedges() { return EcalPhiWedges; } - const std::vector& GetMatchedEcalPhiWedges() const { return EcalPhiWedges; } - - edm::RefVector& GetEBRechits() { return ecalebrhRefs; } - const edm::RefVector& GetEBRechits() const { return ecalebrhRefs; } - - edm::RefVector& GetEERechits() { return ecaleerhRefs; } - const edm::RefVector& GetEERechits() const { return ecaleerhRefs; } - - edm::RefVector& GetHBHERechits() { return hbherhRefs; } - const edm::RefVector& GetHBHERechits() const { return hbherhRefs; } - - bool GetSegmentIsHBCaloMatched() const { return segmentisHBcalomatched; } - bool GetSegmentIsHECaloMatched() const { return segmentisHEcalomatched; } - bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } - bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } - - bool GetHaloPatternFoundEB() const { return halopatternfoundEB; } - bool GetHaloPatternFoundEE() const { return halopatternfoundEE; } - bool GetHaloPatternFoundHB() const { return halopatternfoundHB; } - bool GetHaloPatternFoundHE() const { return halopatternfoundHE; } - - //Setters - void SetMETOverSumEt(float x) { METOverSumEt_ = x; } - void SetMETCorrections(float x, float y) { - dMEx_ = x; - dMEy_ = y; - } - - void SetSegmentIsHBCaloMatched(bool b) { segmentisHBcalomatched = b; } - void SetSegmentIsHECaloMatched(bool b) { segmentisHEcalomatched = b; } - void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } - void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } - void SetHaloPatternFoundEB(bool b) { halopatternfoundEB = b; } - void SetHaloPatternFoundEE(bool b) { halopatternfoundEE = b; } - void SetHaloPatternFoundHB(bool b) { halopatternfoundHB = b; } - void SetHaloPatternFoundHE(bool b) { halopatternfoundHE = b; } - - private: - float METOverSumEt_; - float dMEx_; - float dMEy_; - float dSumEt_; - - std::vector HcalPhiWedges; - std::vector EcalPhiWedges; - - bool segmentisEBcalomatched, segmentisEEcalomatched, segmentisHBcalomatched, segmentisHEcalomatched; - bool halopatternfoundEB, halopatternfoundEE, halopatternfoundHB, halopatternfoundHE; - - edm::RefVector ecalebrhRefs; - edm::RefVector ecaleerhRefs; - edm::RefVector hbherhRefs; - }; + namespace io_v1 { + class GlobalHaloData { + public: + // Constructor + GlobalHaloData(); + // Destructor + ~GlobalHaloData() {} + + //A good cut-variable to isolate halo events with no overlapping physics from collisions + float METOverSumEt() const { return METOverSumEt_; } + + //Correction to CaloMET x-component + float DeltaMEx() const { return dMEx_; } + + //Correction to CaloMET y-component + float DeltaMEy() const { return dMEy_; } + + //Correction to SumEt + float DeltaSumEt() const { return dSumEt_; } + + //Get CaloMET Object corrected for BeamHalo + reco::CaloMET GetCorrectedCaloMET(const reco::CaloMET& RawMET) const; + + std::vector& GetMatchedHcalPhiWedges() { return HcalPhiWedges; } + const std::vector& GetMatchedHcalPhiWedges() const { return HcalPhiWedges; } + + std::vector& GetMatchedEcalPhiWedges() { return EcalPhiWedges; } + const std::vector& GetMatchedEcalPhiWedges() const { return EcalPhiWedges; } + + edm::RefVector& GetEBRechits() { return ecalebrhRefs; } + const edm::RefVector& GetEBRechits() const { return ecalebrhRefs; } + + edm::RefVector& GetEERechits() { return ecaleerhRefs; } + const edm::RefVector& GetEERechits() const { return ecaleerhRefs; } + + edm::RefVector& GetHBHERechits() { return hbherhRefs; } + const edm::RefVector& GetHBHERechits() const { return hbherhRefs; } + + bool GetSegmentIsHBCaloMatched() const { return segmentisHBcalomatched; } + bool GetSegmentIsHECaloMatched() const { return segmentisHEcalomatched; } + bool GetSegmentIsEBCaloMatched() const { return segmentisEBcalomatched; } + bool GetSegmentIsEECaloMatched() const { return segmentisEEcalomatched; } + + bool GetHaloPatternFoundEB() const { return halopatternfoundEB; } + bool GetHaloPatternFoundEE() const { return halopatternfoundEE; } + bool GetHaloPatternFoundHB() const { return halopatternfoundHB; } + bool GetHaloPatternFoundHE() const { return halopatternfoundHE; } + + //Setters + void SetMETOverSumEt(float x) { METOverSumEt_ = x; } + void SetMETCorrections(float x, float y) { + dMEx_ = x; + dMEy_ = y; + } + + void SetSegmentIsHBCaloMatched(bool b) { segmentisHBcalomatched = b; } + void SetSegmentIsHECaloMatched(bool b) { segmentisHEcalomatched = b; } + void SetSegmentIsEBCaloMatched(bool b) { segmentisEBcalomatched = b; } + void SetSegmentIsEECaloMatched(bool b) { segmentisEEcalomatched = b; } + void SetHaloPatternFoundEB(bool b) { halopatternfoundEB = b; } + void SetHaloPatternFoundEE(bool b) { halopatternfoundEE = b; } + void SetHaloPatternFoundHB(bool b) { halopatternfoundHB = b; } + void SetHaloPatternFoundHE(bool b) { halopatternfoundHE = b; } + + private: + float METOverSumEt_; + float dMEx_; + float dMEy_; + float dSumEt_; + + std::vector HcalPhiWedges; + std::vector EcalPhiWedges; + + bool segmentisEBcalomatched, segmentisEEcalomatched, segmentisHBcalomatched, segmentisHEcalomatched; + bool halopatternfoundEB, halopatternfoundEE, halopatternfoundHB, halopatternfoundHE; + + edm::RefVector ecalebrhRefs; + edm::RefVector ecaleerhRefs; + edm::RefVector hbherhRefs; + }; + } // namespace io_v1 + using GlobalHaloData = io_v1::GlobalHaloData; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/HaloClusterCandidateECAL.h b/DataFormats/METReco/interface/HaloClusterCandidateECAL.h index 19603a19d42e6..13277f4efe07c 100644 --- a/DataFormats/METReco/interface/HaloClusterCandidateECAL.h +++ b/DataFormats/METReco/interface/HaloClusterCandidateECAL.h @@ -18,72 +18,75 @@ #include "DataFormats/Math/interface/deltaPhi.h" namespace reco { - class HaloClusterCandidateECAL { - public: - HaloClusterCandidateECAL(); - ~HaloClusterCandidateECAL() {} + namespace io_v1 { + class HaloClusterCandidateECAL { + public: + HaloClusterCandidateECAL(); + ~HaloClusterCandidateECAL() {} - double getClusterEt() const { return et; } - double getSeedEt() const { return seed_et; } - double getSeedEta() const { return seed_eta; } - double getSeedPhi() const { return seed_phi; } - double getSeedZ() const { return seed_Z; } - double getSeedR() const { return seed_R; } - double getSeedTime() const { return seed_time; } - double getTimeDiscriminator() const { return timediscriminator; } - bool getIsHaloFromPattern() const { return ishalofrompattern; } - bool getIsHaloFromPattern_HLT() const { return ishalofrompattern_hlt; } - const edm::RefVector& getBeamHaloRecHitsCandidates() const { return bhrhcandidates; } + double getClusterEt() const { return et; } + double getSeedEt() const { return seed_et; } + double getSeedEta() const { return seed_eta; } + double getSeedPhi() const { return seed_phi; } + double getSeedZ() const { return seed_Z; } + double getSeedR() const { return seed_R; } + double getSeedTime() const { return seed_time; } + double getTimeDiscriminator() const { return timediscriminator; } + bool getIsHaloFromPattern() const { return ishalofrompattern; } + bool getIsHaloFromPattern_HLT() const { return ishalofrompattern_hlt; } + const edm::RefVector& getBeamHaloRecHitsCandidates() const { return bhrhcandidates; } - //Specific to EB: - double getEtStripIPhiSeedPlus1() const { return etstrip_iphiseedplus1; } - double getEtStripIPhiSeedMinus1() const { return etstrip_iphiseedminus1; } - double getHoverE() const { return hovere; } - int getNbofCrystalsInEta() const { return numberofcrystalsineta; } - //Specific to EE: - double getH2overE() const { return h2overe; } - int getNbEarlyCrystals() const { return nbearlycrystals; } - int getNbLateCrystals() const { return nblatecrystals; } - int getClusterSize() const { return clustersize; } + //Specific to EB: + double getEtStripIPhiSeedPlus1() const { return etstrip_iphiseedplus1; } + double getEtStripIPhiSeedMinus1() const { return etstrip_iphiseedminus1; } + double getHoverE() const { return hovere; } + int getNbofCrystalsInEta() const { return numberofcrystalsineta; } + //Specific to EE: + double getH2overE() const { return h2overe; } + int getNbEarlyCrystals() const { return nbearlycrystals; } + int getNbLateCrystals() const { return nblatecrystals; } + int getClusterSize() const { return clustersize; } - void setClusterEt(double x) { et = x; } - void setSeedEt(double x) { seed_et = x; } - void setSeedEta(double x) { seed_eta = x; } - void setSeedPhi(double x) { seed_phi = x; } - void setSeedZ(double x) { seed_Z = x; } - void setSeedR(double x) { seed_R = x; } - void setSeedTime(double x) { seed_time = x; } - void setTimeDiscriminator(double x) { timediscriminator = x; } - void setIsHaloFromPattern(bool x) { ishalofrompattern = x; } - void setIsHaloFromPattern_HLT(bool x) { ishalofrompattern_hlt = x; } - void setBeamHaloRecHitsCandidates(edm::RefVector x) { bhrhcandidates = x; } - //Specific to EB: - void setEtStripIPhiSeedPlus1(double x) { etstrip_iphiseedplus1 = x; } - void setEtStripIPhiSeedMinus1(double x) { etstrip_iphiseedminus1 = x; } - void setHoverE(double x) { hovere = x; } - void setNbofCrystalsInEta(double x) { numberofcrystalsineta = x; } - //Specific to EE: - void setH2overE(double x) { h2overe = x; } - void setNbEarlyCrystals(int x) { nbearlycrystals = x; } - void setNbLateCrystals(int x) { nblatecrystals = x; } - void setClusterSize(int x) { clustersize = x; } + void setClusterEt(double x) { et = x; } + void setSeedEt(double x) { seed_et = x; } + void setSeedEta(double x) { seed_eta = x; } + void setSeedPhi(double x) { seed_phi = x; } + void setSeedZ(double x) { seed_Z = x; } + void setSeedR(double x) { seed_R = x; } + void setSeedTime(double x) { seed_time = x; } + void setTimeDiscriminator(double x) { timediscriminator = x; } + void setIsHaloFromPattern(bool x) { ishalofrompattern = x; } + void setIsHaloFromPattern_HLT(bool x) { ishalofrompattern_hlt = x; } + void setBeamHaloRecHitsCandidates(edm::RefVector x) { bhrhcandidates = x; } + //Specific to EB: + void setEtStripIPhiSeedPlus1(double x) { etstrip_iphiseedplus1 = x; } + void setEtStripIPhiSeedMinus1(double x) { etstrip_iphiseedminus1 = x; } + void setHoverE(double x) { hovere = x; } + void setNbofCrystalsInEta(double x) { numberofcrystalsineta = x; } + //Specific to EE: + void setH2overE(double x) { h2overe = x; } + void setNbEarlyCrystals(int x) { nbearlycrystals = x; } + void setNbLateCrystals(int x) { nblatecrystals = x; } + void setClusterSize(int x) { clustersize = x; } - private: - double et; - double seed_et, seed_eta, seed_phi, seed_Z, seed_R, seed_time; - double timediscriminator; - bool ishalofrompattern; - bool ishalofrompattern_hlt; - //Specific to EB: - double hovere; - int numberofcrystalsineta; - double etstrip_iphiseedplus1, etstrip_iphiseedminus1; - //Specific to EE: - double h2overe; - int nbearlycrystals, nblatecrystals, clustersize; + private: + double et; + double seed_et, seed_eta, seed_phi, seed_Z, seed_R, seed_time; + double timediscriminator; + bool ishalofrompattern; + bool ishalofrompattern_hlt; + //Specific to EB: + double hovere; + int numberofcrystalsineta; + double etstrip_iphiseedplus1, etstrip_iphiseedminus1; + //Specific to EE: + double h2overe; + int nbearlycrystals, nblatecrystals, clustersize; - edm::RefVector bhrhcandidates; - }; + edm::RefVector bhrhcandidates; + }; + } // namespace io_v1 + using HaloClusterCandidateECAL = io_v1::HaloClusterCandidateECAL; typedef std::vector HaloClusterCandidateECALCollection; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/HaloClusterCandidateHCAL.h b/DataFormats/METReco/interface/HaloClusterCandidateHCAL.h index f5700a08b3a5a..18cc899a93706 100644 --- a/DataFormats/METReco/interface/HaloClusterCandidateHCAL.h +++ b/DataFormats/METReco/interface/HaloClusterCandidateHCAL.h @@ -18,72 +18,75 @@ #include "DataFormats/Math/interface/deltaPhi.h" namespace reco { - class HaloClusterCandidateHCAL { - public: - HaloClusterCandidateHCAL(); - ~HaloClusterCandidateHCAL() {} + namespace io_v1 { + class HaloClusterCandidateHCAL { + public: + HaloClusterCandidateHCAL(); + ~HaloClusterCandidateHCAL() {} - double getClusterEt() const { return et; } - double getSeedEt() const { return seed_et; } - double getSeedEta() const { return seed_eta; } - double getSeedPhi() const { return seed_phi; } - double getSeedZ() const { return seed_Z; } - double getSeedR() const { return seed_R; } - double getSeedTime() const { return seed_time; } - bool getIsHaloFromPattern() const { return ishalofrompattern; } - bool getIsHaloFromPattern_HLT() const { return ishalofrompattern_hlt; } - double getEoverH() const { return eoverh; } - double getEtStripPhiSeedPlus1() const { return etstrip_phiseedplus1; } - double getEtStripPhiSeedMinus1() const { return etstrip_phiseedminus1; } - edm::RefVector getBeamHaloRecHitsCandidates() const { return bhrhcandidates; } - //Specific to HB: - int getNbTowersInEta() const { return nbtowersineta; } - double getTimeDiscriminatorITBH() const { return timediscriminatoritbh; } - double getTimeDiscriminatorOTBH() const { return timediscriminatorotbh; } - //Specific to HE: - double getH1overH123() const { return h1overh123; } - int getClusterSize() const { return clustersize; } - double getTimeDiscriminator() const { return timediscriminator; } + double getClusterEt() const { return et; } + double getSeedEt() const { return seed_et; } + double getSeedEta() const { return seed_eta; } + double getSeedPhi() const { return seed_phi; } + double getSeedZ() const { return seed_Z; } + double getSeedR() const { return seed_R; } + double getSeedTime() const { return seed_time; } + bool getIsHaloFromPattern() const { return ishalofrompattern; } + bool getIsHaloFromPattern_HLT() const { return ishalofrompattern_hlt; } + double getEoverH() const { return eoverh; } + double getEtStripPhiSeedPlus1() const { return etstrip_phiseedplus1; } + double getEtStripPhiSeedMinus1() const { return etstrip_phiseedminus1; } + edm::RefVector getBeamHaloRecHitsCandidates() const { return bhrhcandidates; } + //Specific to HB: + int getNbTowersInEta() const { return nbtowersineta; } + double getTimeDiscriminatorITBH() const { return timediscriminatoritbh; } + double getTimeDiscriminatorOTBH() const { return timediscriminatorotbh; } + //Specific to HE: + double getH1overH123() const { return h1overh123; } + int getClusterSize() const { return clustersize; } + double getTimeDiscriminator() const { return timediscriminator; } - void setClusterEt(double x) { et = x; } - void setSeedEt(double x) { seed_et = x; } - void setSeedEta(double x) { seed_eta = x; } - void setSeedPhi(double x) { seed_phi = x; } - void setSeedZ(double x) { seed_Z = x; } - void setSeedR(double x) { seed_R = x; } - void setSeedTime(double x) { seed_time = x; } - void setIsHaloFromPattern(bool x) { ishalofrompattern = x; } - void setIsHaloFromPattern_HLT(bool x) { ishalofrompattern_hlt = x; } - void setEoverH(double x) { eoverh = x; } - void setEtStripPhiSeedPlus1(double x) { etstrip_phiseedplus1 = x; } - void setEtStripPhiSeedMinus1(double x) { etstrip_phiseedminus1 = x; } - void setBeamHaloRecHitsCandidates(edm::RefVector x) { bhrhcandidates = x; } - //Specific to HB: - void setNbTowersInEta(double x) { nbtowersineta = x; } - void setTimeDiscriminatorITBH(double x) { timediscriminatoritbh = x; } - void setTimeDiscriminatorOTBH(double x) { timediscriminatorotbh = x; } - //Specific to HE: - void setH1overH123(double x) { h1overh123 = x; } - void setClusterSize(int x) { clustersize = x; } - void setTimeDiscriminator(double x) { timediscriminator = x; } + void setClusterEt(double x) { et = x; } + void setSeedEt(double x) { seed_et = x; } + void setSeedEta(double x) { seed_eta = x; } + void setSeedPhi(double x) { seed_phi = x; } + void setSeedZ(double x) { seed_Z = x; } + void setSeedR(double x) { seed_R = x; } + void setSeedTime(double x) { seed_time = x; } + void setIsHaloFromPattern(bool x) { ishalofrompattern = x; } + void setIsHaloFromPattern_HLT(bool x) { ishalofrompattern_hlt = x; } + void setEoverH(double x) { eoverh = x; } + void setEtStripPhiSeedPlus1(double x) { etstrip_phiseedplus1 = x; } + void setEtStripPhiSeedMinus1(double x) { etstrip_phiseedminus1 = x; } + void setBeamHaloRecHitsCandidates(edm::RefVector x) { bhrhcandidates = x; } + //Specific to HB: + void setNbTowersInEta(double x) { nbtowersineta = x; } + void setTimeDiscriminatorITBH(double x) { timediscriminatoritbh = x; } + void setTimeDiscriminatorOTBH(double x) { timediscriminatorotbh = x; } + //Specific to HE: + void setH1overH123(double x) { h1overh123 = x; } + void setClusterSize(int x) { clustersize = x; } + void setTimeDiscriminator(double x) { timediscriminator = x; } - private: - double et; - double seed_et, seed_eta, seed_phi, seed_Z, seed_R, seed_time; - bool ishalofrompattern; - bool ishalofrompattern_hlt; - double eoverh; - double etstrip_phiseedplus1, etstrip_phiseedminus1; - //Specific to HB: - int nbtowersineta; - double timediscriminatoritbh, timediscriminatorotbh; - //Specific to HE: - double h1overh123; - int clustersize; - double timediscriminator; + private: + double et; + double seed_et, seed_eta, seed_phi, seed_Z, seed_R, seed_time; + bool ishalofrompattern; + bool ishalofrompattern_hlt; + double eoverh; + double etstrip_phiseedplus1, etstrip_phiseedminus1; + //Specific to HB: + int nbtowersineta; + double timediscriminatoritbh, timediscriminatorotbh; + //Specific to HE: + double h1overh123; + int clustersize; + double timediscriminator; - edm::RefVector bhrhcandidates; - }; + edm::RefVector bhrhcandidates; + }; + } // namespace io_v1 + using HaloClusterCandidateHCAL = io_v1::HaloClusterCandidateHCAL; typedef std::vector HaloClusterCandidateHCALCollection; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/HcalHaloData.h b/DataFormats/METReco/interface/HcalHaloData.h index 1ad3f6e86026c..eb61bd3f95887 100644 --- a/DataFormats/METReco/interface/HcalHaloData.h +++ b/DataFormats/METReco/interface/HcalHaloData.h @@ -34,36 +34,39 @@ struct HaloTowerStrip { }; namespace reco { + namespace io_v1 { - class HcalHaloData { - public: - //constructor - HcalHaloData(); - //destructor - ~HcalHaloData() {} + class HcalHaloData { + public: + //constructor + HcalHaloData(); + //destructor + ~HcalHaloData() {} - // Return collection of 5-degree Phi Wedges built from Hcal RecHits - const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } - std::vector& GetPhiWedges() { return PhiWedgeCollection; } + // Return collection of 5-degree Phi Wedges built from Hcal RecHits + const std::vector& GetPhiWedges() const { return PhiWedgeCollection; } + std::vector& GetPhiWedges() { return PhiWedgeCollection; } - // Return collection of problematic strips (pairs of # of problematic HCAL cells and CaloTowerDetId) - const std::vector& getProblematicStrips() const { return problematicStripCollection; } - std::vector& getProblematicStrips() { return problematicStripCollection; } + // Return collection of problematic strips (pairs of # of problematic HCAL cells and CaloTowerDetId) + const std::vector& getProblematicStrips() const { return problematicStripCollection; } + std::vector& getProblematicStrips() { return problematicStripCollection; } - const std::vector& getHaloClusterCandidatesHB() const { return thehaloclustercands_hb; } - std::vector& getHaloClusterCandidatesHB() { return thehaloclustercands_hb; } + const std::vector& getHaloClusterCandidatesHB() const { return thehaloclustercands_hb; } + std::vector& getHaloClusterCandidatesHB() { return thehaloclustercands_hb; } - const std::vector& getHaloClusterCandidatesHE() const { return thehaloclustercands_he; } - std::vector& getHaloClusterCandidatesHE() { return thehaloclustercands_he; } + const std::vector& getHaloClusterCandidatesHE() const { return thehaloclustercands_he; } + std::vector& getHaloClusterCandidatesHE() { return thehaloclustercands_he; } - void setHaloClusterCandidatesHB(const std::vector& x) { thehaloclustercands_hb = x; }; - void setHaloClusterCandidatesHE(const std::vector& x) { thehaloclustercands_he = x; }; + void setHaloClusterCandidatesHB(const std::vector& x) { thehaloclustercands_hb = x; }; + void setHaloClusterCandidatesHE(const std::vector& x) { thehaloclustercands_he = x; }; - private: - std::vector PhiWedgeCollection; - std::vector problematicStripCollection; - std::vector thehaloclustercands_hb; - std::vector thehaloclustercands_he; - }; + private: + std::vector PhiWedgeCollection; + std::vector problematicStripCollection; + std::vector thehaloclustercands_hb; + std::vector thehaloclustercands_he; + }; + } // namespace io_v1 + using HcalHaloData = io_v1::HcalHaloData; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/MET.h b/DataFormats/METReco/interface/MET.h index 966797ea4a334..1de4a8282ea78 100644 --- a/DataFormats/METReco/interface/MET.h +++ b/DataFormats/METReco/interface/MET.h @@ -37,59 +37,62 @@ //____________________________________________________________________________|| namespace reco { typedef ROOT::Math::SMatrix METCovMatrix; + namespace io_v1 { - class MET : public RecoCandidate { - public: - MET(); - MET(const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); - MET(double sumet_, const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); - MET(double sumet_, - const std::vector& corr_, - const LorentzVector& p4_, - const Point& vtx_, - bool isWeighted = false); + class MET : public RecoCandidate { + public: + MET(); + MET(const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); + MET(double sumet_, const LorentzVector& p4_, const Point& vtx_, bool isWeighted = false); + MET(double sumet_, + const std::vector& corr_, + const LorentzVector& p4_, + const Point& vtx_, + bool isWeighted = false); - MET* clone() const override; + MET* clone() const override; - //________________________________________________________________________|| - //scalar sum of transverse energy over all objects - double sumEt() const { return sumet; } - //MET Significance = MET / std::sqrt(SumET) - double mEtSig() const { return (sumet ? (this->et() / std::sqrt(sumet)) : (0.0)); } - //real MET significance - double significance() const; - //longitudinal component of the vector sum of energy over all object - //(useful for data quality monitoring) - double e_longitudinal() const { return elongit; } + //________________________________________________________________________|| + //scalar sum of transverse energy over all objects + double sumEt() const { return sumet; } + //MET Significance = MET / std::sqrt(SumET) + double mEtSig() const { return (sumet ? (this->et() / std::sqrt(sumet)) : (0.0)); } + //real MET significance + double significance() const; + //longitudinal component of the vector sum of energy over all object + //(useful for data quality monitoring) + double e_longitudinal() const { return elongit; } - //________________________________________________________________________|| - //Define different methods for the corrections to individual MET elements - std::vector dmEx() const; - std::vector dmEy() const; - std::vector dsumEt() const; - std::vector mEtCorr() const { return corr; } + //________________________________________________________________________|| + //Define different methods for the corrections to individual MET elements + std::vector dmEx() const; + std::vector dmEy() const; + std::vector dsumEt() const; + std::vector mEtCorr() const { return corr; } - //________________________________________________________________________|| - void setSignificanceMatrix(const reco::METCovMatrix& matrix); - reco::METCovMatrix getSignificanceMatrix(void) const; + //________________________________________________________________________|| + void setSignificanceMatrix(const reco::METCovMatrix& matrix); + reco::METCovMatrix getSignificanceMatrix(void) const; - /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) - void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } - /// boolean if weights were applied by algorithm (e.g. PUPPI weights) - int isWeighted() const { return mIsWeighted; } + /// Set boolean if weights were applied by algorithm (e.g. PUPPI weights) + void setIsWeighted(bool isWeighted) { mIsWeighted = isWeighted; } + /// boolean if weights were applied by algorithm (e.g. PUPPI weights) + int isWeighted() const { return mIsWeighted; } - private: - bool overlap(const Candidate&) const override; - double sumet; - double elongit; - // bookkeeping for the significance - double signif_dxx; - double signif_dyy; - double signif_dyx; - double signif_dxy; - std::vector corr; - bool mIsWeighted; - }; + private: + bool overlap(const Candidate&) const override; + double sumet; + double elongit; + // bookkeeping for the significance + double signif_dxx; + double signif_dyy; + double signif_dyx; + double signif_dxy; + std::vector corr; + bool mIsWeighted; + }; + } // namespace io_v1 + using MET = io_v1::MET; } // namespace reco //____________________________________________________________________________|| diff --git a/DataFormats/METReco/interface/METFwd.h b/DataFormats/METReco/interface/METFwd.h index 10445de5ed3ad..9647033931584 100644 --- a/DataFormats/METReco/interface/METFwd.h +++ b/DataFormats/METReco/interface/METFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class MET; + namespace io_v1 { + class MET; + } + using MET = io_v1::MET; /// collection of MET objects typedef std::vector METCollection; /// edm references diff --git a/DataFormats/METReco/interface/PFMET.h b/DataFormats/METReco/interface/PFMET.h index beaedf91ad123..6321c0557dd47 100644 --- a/DataFormats/METReco/interface/PFMET.h +++ b/DataFormats/METReco/interface/PFMET.h @@ -15,66 +15,69 @@ date: 10/27/08 #include "DataFormats/METReco/interface/MET.h" #include "DataFormats/METReco/interface/SpecificPFMETData.h" namespace reco { - class PFMET : public MET { - public: - PFMET(); - PFMET(const SpecificPFMETData& pf_data_, - double sumet_, - const LorentzVector& fP4, - const Point& fVertex, - bool isWeighted = false) - : MET(sumet_, fP4, fVertex, isWeighted), pf_data(pf_data_) {} + namespace io_v1 { + class PFMET : public MET { + public: + PFMET(); + PFMET(const SpecificPFMETData& pf_data_, + double sumet_, + const LorentzVector& fP4, + const Point& fVertex, + bool isWeighted = false) + : MET(sumet_, fP4, fVertex, isWeighted), pf_data(pf_data_) {} - ~PFMET() override {} + ~PFMET() override {} - //getters - double photonEtFraction() const { return pf_data.NeutralEMFraction; } - double photonEt() const { return pf_data.NeutralEMFraction * sumEt(); } + //getters + double photonEtFraction() const { return pf_data.NeutralEMFraction; } + double photonEt() const { return pf_data.NeutralEMFraction * sumEt(); } - double neutralHadronEtFraction() const { return pf_data.NeutralHadFraction; } - double neutralHadronEt() const { return pf_data.NeutralHadFraction * sumEt(); } + double neutralHadronEtFraction() const { return pf_data.NeutralHadFraction; } + double neutralHadronEt() const { return pf_data.NeutralHadFraction * sumEt(); } - double electronEtFraction() const { return pf_data.ChargedEMFraction; } - double electronEt() const { return pf_data.ChargedEMFraction * sumEt(); } + double electronEtFraction() const { return pf_data.ChargedEMFraction; } + double electronEt() const { return pf_data.ChargedEMFraction * sumEt(); } - double chargedHadronEtFraction() const { return pf_data.ChargedHadFraction; } - double chargedHadronEt() const { return pf_data.ChargedHadFraction * sumEt(); } + double chargedHadronEtFraction() const { return pf_data.ChargedHadFraction; } + double chargedHadronEt() const { return pf_data.ChargedHadFraction * sumEt(); } - double muonEtFraction() const { return pf_data.MuonFraction; } - double muonEt() const { return pf_data.MuonFraction * sumEt(); } + double muonEtFraction() const { return pf_data.MuonFraction; } + double muonEt() const { return pf_data.MuonFraction * sumEt(); } - double HFHadronEtFraction() const { return pf_data.Type6Fraction; } - double HFHadronEt() const { return pf_data.Type6Fraction * sumEt(); } + double HFHadronEtFraction() const { return pf_data.Type6Fraction; } + double HFHadronEt() const { return pf_data.Type6Fraction * sumEt(); } - double HFEMEtFraction() const { return pf_data.Type7Fraction; } - double HFEMEt() const { return pf_data.Type7Fraction * sumEt(); } + double HFEMEtFraction() const { return pf_data.Type7Fraction; } + double HFEMEt() const { return pf_data.Type7Fraction * sumEt(); } - // Old accessors (should be removed in future) - double NeutralEMEtFraction() const { return pf_data.NeutralEMFraction; } - double NeutralEMEt() const { return pf_data.NeutralEMFraction * sumEt(); } - double NeutralHadEtFraction() const { return pf_data.NeutralHadFraction; } - double NeutralHadEt() const { return pf_data.NeutralHadFraction * sumEt(); } - double ChargedEMEtFraction() const { return pf_data.ChargedEMFraction; } - double ChargedEMEt() const { return pf_data.ChargedEMFraction * sumEt(); } - double ChargedHadEtFraction() const { return pf_data.ChargedHadFraction; } - double ChargedHadEt() const { return pf_data.ChargedHadFraction * sumEt(); } - double MuonEtFraction() const { return pf_data.MuonFraction; } - double MuonEt() const { return pf_data.MuonFraction * sumEt(); } - double Type6EtFraction() const { return pf_data.Type6Fraction; } - double Type6Et() const { return pf_data.Type6Fraction * sumEt(); } - double Type7EtFraction() const { return pf_data.Type7Fraction; } - double Type7Et() const { return pf_data.Type7Fraction * sumEt(); } - double NeutralEMFraction() const { return pf_data.NeutralEMFraction; } - double NeutralHadFraction() const { return pf_data.NeutralHadFraction; } - double ChargedEMFraction() const { return pf_data.ChargedEMFraction; } - double ChargedHadFraction() const { return pf_data.ChargedHadFraction; } - double MuonFraction() const { return pf_data.MuonFraction; } + // Old accessors (should be removed in future) + double NeutralEMEtFraction() const { return pf_data.NeutralEMFraction; } + double NeutralEMEt() const { return pf_data.NeutralEMFraction * sumEt(); } + double NeutralHadEtFraction() const { return pf_data.NeutralHadFraction; } + double NeutralHadEt() const { return pf_data.NeutralHadFraction * sumEt(); } + double ChargedEMEtFraction() const { return pf_data.ChargedEMFraction; } + double ChargedEMEt() const { return pf_data.ChargedEMFraction * sumEt(); } + double ChargedHadEtFraction() const { return pf_data.ChargedHadFraction; } + double ChargedHadEt() const { return pf_data.ChargedHadFraction * sumEt(); } + double MuonEtFraction() const { return pf_data.MuonFraction; } + double MuonEt() const { return pf_data.MuonFraction * sumEt(); } + double Type6EtFraction() const { return pf_data.Type6Fraction; } + double Type6Et() const { return pf_data.Type6Fraction * sumEt(); } + double Type7EtFraction() const { return pf_data.Type7Fraction; } + double Type7Et() const { return pf_data.Type7Fraction * sumEt(); } + double NeutralEMFraction() const { return pf_data.NeutralEMFraction; } + double NeutralHadFraction() const { return pf_data.NeutralHadFraction; } + double ChargedEMFraction() const { return pf_data.ChargedEMFraction; } + double ChargedHadFraction() const { return pf_data.ChargedHadFraction; } + double MuonFraction() const { return pf_data.MuonFraction; } - // block accessors - SpecificPFMETData getSpecific() const { return pf_data; } + // block accessors + SpecificPFMETData getSpecific() const { return pf_data; } - private: - SpecificPFMETData pf_data; - }; + private: + SpecificPFMETData pf_data; + }; + } // namespace io_v1 + using PFMET = io_v1::PFMET; } // namespace reco #endif diff --git a/DataFormats/METReco/interface/PFMETFwd.h b/DataFormats/METReco/interface/PFMETFwd.h index 90be275bf24bc..db672b94715c7 100644 --- a/DataFormats/METReco/interface/PFMETFwd.h +++ b/DataFormats/METReco/interface/PFMETFwd.h @@ -9,7 +9,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class PFMET; + namespace io_v1 { + class PFMET; + } + using PFMET = io_v1::PFMET; /// collection of PFMET objects typedef std::vector PFMETCollection; /// edm references diff --git a/DataFormats/METReco/src/HaloClusterCandidateECAL.cc b/DataFormats/METReco/src/HaloClusterCandidateECAL.cc index 52831ffd30f70..bcb4d4b6a6190 100644 --- a/DataFormats/METReco/src/HaloClusterCandidateECAL.cc +++ b/DataFormats/METReco/src/HaloClusterCandidateECAL.cc @@ -1,6 +1,7 @@ #include "DataFormats/METReco/interface/HaloClusterCandidateECAL.h" using namespace reco; +using namespace reco::io_v1; HaloClusterCandidateECAL::HaloClusterCandidateECAL() : et(0), seed_et(0), diff --git a/DataFormats/METReco/src/HaloClusterCandidateHCAL.cc b/DataFormats/METReco/src/HaloClusterCandidateHCAL.cc index f92ec02efbb6c..33e40df69b9e7 100644 --- a/DataFormats/METReco/src/HaloClusterCandidateHCAL.cc +++ b/DataFormats/METReco/src/HaloClusterCandidateHCAL.cc @@ -1,6 +1,7 @@ #include "DataFormats/METReco/interface/HaloClusterCandidateHCAL.h" using namespace reco; +using namespace reco::io_v1; HaloClusterCandidateHCAL::HaloClusterCandidateHCAL() : et(0), seed_et(0), diff --git a/DataFormats/METReco/src/classes_def.xml b/DataFormats/METReco/src/classes_def.xml index 17fc07b6c7c3f..a360c855cdb66 100644 --- a/DataFormats/METReco/src/classes_def.xml +++ b/DataFormats/METReco/src/classes_def.xml @@ -1,24 +1,21 @@ - - - - + + - - - + + - - + + @@ -30,128 +27,105 @@ - - - + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + - - - + + + - - - + + + - - - + + + - - - + + + - - + + - - + + - - - - - - - + + - - - + + + - - - - - + + + + + @@ -159,27 +133,22 @@ - - + + - - - + + - + - - - - - - + + - + @@ -188,32 +157,26 @@ - - - - + + - + - - - + + - + - - - - - + + - + - - + + @@ -222,14 +185,14 @@ - - + + - - + + diff --git a/DataFormats/MuonDetId/interface/CSCDetId.h b/DataFormats/MuonDetId/interface/CSCDetId.h index 3a60ff78b4541..e206d37321a1d 100644 --- a/DataFormats/MuonDetId/interface/CSCDetId.h +++ b/DataFormats/MuonDetId/interface/CSCDetId.h @@ -19,113 +19,115 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/MuonDetId/interface/MuonSubdetId.h" -class CSCDetId : public DetId { -public: - /// Default constructor; fills the common part in the base - /// and leaves 0 in all other fields - CSCDetId() : DetId(DetId::Muon, MuonSubdetId::CSC) {} - - /// Construct from a packed id. It is required that the Detector part of - /// id is Muon and the SubDet part is CSC, otherwise an exception is thrown. - CSCDetId(uint32_t id) : DetId(id) {} - CSCDetId(DetId id) : DetId(id) {} - - /// Construct from fully qualified identifier. - /// Input values are required to be within legal ranges, otherwise an - /// exception is thrown.
- /// iendcap: 1=forward (+Z), 2=backward(-Z) - CSCDetId(int iendcap, int istation, int iring, int ichamber, int ilayer = 0) : DetId(DetId::Muon, MuonSubdetId::CSC) { - id_ |= init(iendcap, istation, iring, ichamber, ilayer); - } - - /** Chamber CSCDetId from a Layer CSCDetId +namespace io_v1 { + class CSCDetId : public DetId { + public: + /// Default constructor; fills the common part in the base + /// and leaves 0 in all other fields + CSCDetId() : DetId(DetId::Muon, MuonSubdetId::CSC) {} + + /// Construct from a packed id. It is required that the Detector part of + /// id is Muon and the SubDet part is CSC, otherwise an exception is thrown. + CSCDetId(uint32_t id) : DetId(id) {} + CSCDetId(DetId id) : DetId(id) {} + + /// Construct from fully qualified identifier. + /// Input values are required to be within legal ranges, otherwise an + /// exception is thrown.
+ /// iendcap: 1=forward (+Z), 2=backward(-Z) + CSCDetId(int iendcap, int istation, int iring, int ichamber, int ilayer = 0) + : DetId(DetId::Muon, MuonSubdetId::CSC) { + id_ |= init(iendcap, istation, iring, ichamber, ilayer); + } + + /** Chamber CSCDetId from a Layer CSCDetId */ - CSCDetId chamberId() const { - // build chamber id by removing layer bits - return CSCDetId(id_ - layer()); - } + CSCDetId chamberId() const { + // build chamber id by removing layer bits + return CSCDetId(id_ - layer()); + } - /** + /** * Return Layer label. * */ - int layer() const { return (id_ & MASK_LAYER); } + int layer() const { return (id_ & MASK_LAYER); } - /** + /** * Return Chamber label. * */ - int chamber() const { return ((id_ >> START_CHAMBER) & MASK_CHAMBER); } + int chamber() const { return ((id_ >> START_CHAMBER) & MASK_CHAMBER); } - /** + /** * Return Ring label. * */ - int ring() const { - if (((id_ >> START_STATION) & MASK_STATION) == 1) - return (detIdToInt((id_ >> START_RING) & MASK_RING)); - else - return (((id_ >> START_RING) & MASK_RING)); - } - - /** + int ring() const { + if (((id_ >> START_STATION) & MASK_STATION) == 1) + return (detIdToInt((id_ >> START_RING) & MASK_RING)); + else + return (((id_ >> START_RING) & MASK_RING)); + } + + /** * Return Station label. * */ - int station() const { return ((id_ >> START_STATION) & MASK_STATION); } + int station() const { return ((id_ >> START_STATION) & MASK_STATION); } - /** + /** * Return Endcap label. 1=forward (+Z); 2=backward (-Z) * */ - int endcap() const { return ((id_ >> START_ENDCAP) & MASK_ENDCAP); } + int endcap() const { return ((id_ >> START_ENDCAP) & MASK_ENDCAP); } - /** + /** * What is the sign of global z? * */ - short int zendcap() const { return (endcap() != 1 ? -1 : +1); } + short int zendcap() const { return (endcap() != 1 ? -1 : +1); } - /** + /** * Chamber type (integer 1-10) */ - unsigned short iChamberType() const { return iChamberType(station(), ring()); } + unsigned short iChamberType() const { return iChamberType(station(), ring()); } - /** + /** * Geometric channel no. from geometric strip no. - identical except for ME1a ganged strips * * Note that 'Geometric' means increasing number corresponds to increasing local x coordinate. * \warning There is no attempt here to handle cabling or readout questions. * If you need that look at CondFormats/CSCObjects/CSCChannelTranslator. */ - int channel(int istrip) { - if (ring() == 4) - // strips 1-48 mapped to channels 1-16: - // 1+17+33->1, 2+18+34->2, .... 16+32+48->16 - return 1 + (istrip - 1) % 16; - else - return istrip; - } - - /** + int channel(int istrip) { + if (ring() == 4) + // strips 1-48 mapped to channels 1-16: + // 1+17+33->1, 2+18+34->2, .... 16+32+48->16 + return 1 + (istrip - 1) % 16; + else + return istrip; + } + + /** * Simple accessors */ - bool isME1a() const; - bool isME1b() const; - bool isME11() const; - bool isME12() const; - bool isME13() const; - bool isME21() const; - bool isME22() const; - bool isME31() const; - bool isME32() const; - bool isME41() const; - bool isME42() const; - - // static methods - // Used when we need information about subdetector labels. - - /** + bool isME1a() const; + bool isME1b() const; + bool isME11() const; + bool isME12() const; + bool isME13() const; + bool isME21() const; + bool isME22() const; + bool isME31() const; + bool isME32() const; + bool isME41() const; + bool isME42() const; + + // static methods + // Used when we need information about subdetector labels. + + /** * Returns the unique integer 'rawId' which labels each CSC layer. * * The arguments are the integer labels for, respectively,
@@ -139,56 +141,56 @@ class CSCDetId : public DetId { * starting from the component ids. * */ - static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer) { - return ((DetId::Muon & 0xF) << (DetId::kDetOffset)) | // set Muon flag - ((MuonSubdetId::CSC & 0x7) << (DetId::kSubdetOffset)) | // set CSC flag - init(iendcap, istation, iring, ichamber, ilayer); - } // set CSC id + static int rawIdMaker(int iendcap, int istation, int iring, int ichamber, int ilayer) { + return ((DetId::Muon & 0xF) << (DetId::kDetOffset)) | // set Muon flag + ((MuonSubdetId::CSC & 0x7) << (DetId::kSubdetOffset)) | // set CSC flag + init(iendcap, istation, iring, ichamber, ilayer); + } // set CSC id - /** + /** * Return Layer label for supplied CSCDetId index. * */ - static int layer(int index) { return (index & MASK_LAYER); } + static int layer(int index) { return (index & MASK_LAYER); } - /** + /** * Return Chamber label for supplied CSCDetId index. * */ - static int chamber(int index) { return ((index >> START_CHAMBER) & MASK_CHAMBER); } + static int chamber(int index) { return ((index >> START_CHAMBER) & MASK_CHAMBER); } - /** + /** * Return Ring label for supplied CSCDetId index. * */ - static int ring(int index) { - if (((index >> START_STATION) & MASK_STATION) == 1) - return (detIdToInt((index >> START_RING) & MASK_RING)); - else - return ((index >> START_RING) & MASK_RING); - } - - /** + static int ring(int index) { + if (((index >> START_STATION) & MASK_STATION) == 1) + return (detIdToInt((index >> START_RING) & MASK_RING)); + else + return ((index >> START_RING) & MASK_RING); + } + + /** * Return Station label for supplied CSCDetId index. * */ - static int station(int index) { return ((index >> START_STATION) & MASK_STATION); } + static int station(int index) { return ((index >> START_STATION) & MASK_STATION); } - /** + /** * Return Endcap label for supplied CSCDetId index. * */ - static int endcap(int index) { return ((index >> START_ENDCAP) & MASK_ENDCAP); } + static int endcap(int index) { return ((index >> START_ENDCAP) & MASK_ENDCAP); } - /** + /** * Return a unique integer 1-10 for a station, ring pair: * 1 for S = 1 and R=4 inner strip part of ME11 (ME1a) * 2,3,4 = R+1 for S = 1 and R = 1,2,3 (ME11 means ME1b) * 5-10 = 2*S+R for S = 2,3,4 and R = 1,2 */ - static unsigned short iChamberType(unsigned short istation, unsigned short iring); + static unsigned short iChamberType(unsigned short istation, unsigned short iring); - /** + /** * Return trigger-level sector id for an Endcap Muon chamber. * * This method encapsulates the information about which chambers @@ -207,9 +209,9 @@ class CSCDetId : public DetId { * We count from one not zero. * */ - int triggerSector() const; + int triggerSector() const; - /** + /** * Return trigger-level CSC id within a sector for an Endcap Muon chamber. * * This id is an index within a sector such that the 3 inner ring chambers @@ -222,50 +224,51 @@ class CSCDetId : public DetId { * and software changes. * */ - int triggerCscId() const; + int triggerCscId() const; - /** + /** * Lower and upper counts for the subdetector hierarchy */ - static int minEndcapId() { return MIN_ENDCAP; } - static int maxEndcapId() { return MAX_ENDCAP; } - static int minStationId() { return MIN_STATION; } - static int maxStationId() { return MAX_STATION; } - static int minRingId() { return MIN_RING; } - static int maxRingId() { return MAX_RING; } - static int minChamberId() { return MIN_CHAMBER; } - static int maxChamberId() { return MAX_CHAMBER; } - static int minLayerId() { return MIN_LAYER; } - static int maxLayerId() { return MAX_LAYER; } - - /** + static int minEndcapId() { return MIN_ENDCAP; } + static int maxEndcapId() { return MAX_ENDCAP; } + static int minStationId() { return MIN_STATION; } + static int maxStationId() { return MAX_STATION; } + static int minRingId() { return MIN_RING; } + static int maxRingId() { return MAX_RING; } + static int minChamberId() { return MIN_CHAMBER; } + static int maxChamberId() { return MAX_CHAMBER; } + static int minLayerId() { return MIN_LAYER; } + static int maxLayerId() { return MAX_LAYER; } + + /** * Returns the chamber name in the format * ME$sign$station/$ring/$chamber. Example: ME+1/1/9 */ - static std::string chamberName(int endcap, int station, int ring, int chamber); - static std::string chamberName(int iChamberType); - std::string chamberName() const; - /** + static std::string chamberName(int endcap, int station, int ring, int chamber); + static std::string chamberName(int iChamberType); + std::string chamberName() const; + /** * Returns the layer name in the format * ME$sign$station/$ring/$chamber/$layer. Example: ME+1/1/9/1 */ - static std::string layerName(int endcap, int station, int ring, int chamber, int layer); - std::string layerName() const; + static std::string layerName(int endcap, int station, int ring, int chamber, int layer); + std::string layerName() const; -private: - /** + private: + /** * Method for initialization within ctors. * */ - static uint32_t init(int iendcap, int istation, int iring, int ichamber, int ilayer) { - if (istation == 1) - iring = intToDetId(iring); + static uint32_t init(int iendcap, int istation, int iring, int ichamber, int ilayer) { + if (istation == 1) + iring = intToDetId(iring); - return (ilayer & MASK_LAYER) | ((ichamber & MASK_CHAMBER) << START_CHAMBER) | ((iring & MASK_RING) << START_RING) | - ((istation & MASK_STATION) << START_STATION) | ((iendcap & MASK_ENDCAP) << START_ENDCAP); - } + return (ilayer & MASK_LAYER) | ((ichamber & MASK_CHAMBER) << START_CHAMBER) | + ((iring & MASK_RING) << START_RING) | ((istation & MASK_STATION) << START_STATION) | + ((iendcap & MASK_ENDCAP) << START_ENDCAP); + } - /** + /** * * Methods for reordering CSCDetId for ME1 detectors. * @@ -275,47 +278,48 @@ class CSCDetId : public DetId { * least ME12 and ME13 have ring numbers which match in hardware and software! * */ - static int intToDetId(int iring) { - // change iring = 1, 2, 3, 4 input to 2, 3, 4, 1 for use inside the DetId - // i.e. ME1b, ME12, ME13, ME1a externally become stored internally in order ME1a, ME1b, ME12, ME13 - int i = (iring + 1) % 4; - if (i == 0) - i = 4; - return i; - } - - static int detIdToInt(int iring) { - // reverse intToDetId: change 1, 2, 3, 4 inside the DetId to 4, 1, 2, 3 for external use - // i.e. output ring # 1, 2, 3, 4 in ME1 means ME1b, ME12, ME13, ME1a as usual in the offline software. - int i = (iring - 1); - if (i == 0) - i = 4; - return i; - } - - // The following define the bit-packing implementation... - - // The maximum numbers of various parts - enum eMaxNum { MAX_ENDCAP = 2, MAX_STATION = 4, MAX_RING = 4, MAX_CHAMBER = 36, MAX_LAYER = 6 }; - // We count from 1 - enum eMinNum { MIN_ENDCAP = 1, MIN_STATION = 1, MIN_RING = 1, MIN_CHAMBER = 1, MIN_LAYER = 1 }; - - // BITS_det is no. of binary bits required to label 'det' but allow 0 as a wild-card character - // Keep as multiples of 3 so that number can be easily decodable from octal - enum eNumBitDet { BITS_ENDCAP = 3, BITS_STATION = 3, BITS_RING = 3, BITS_CHAMBER = 6, BITS_LAYER = 3 }; - - // MASK_det is binary bits set to pick off the bits for 'det' (defined as octal) - enum eMaskBitDet { MASK_ENDCAP = 07, MASK_STATION = 07, MASK_RING = 07, MASK_CHAMBER = 077, MASK_LAYER = 07 }; - - // START_det is bit position (counting from zero) at which bits for 'det' start in 'rawId' word - enum eStartBitDet { - START_CHAMBER = BITS_LAYER, - START_RING = START_CHAMBER + BITS_CHAMBER, - START_STATION = START_RING + BITS_RING, - START_ENDCAP = START_STATION + BITS_STATION + static int intToDetId(int iring) { + // change iring = 1, 2, 3, 4 input to 2, 3, 4, 1 for use inside the DetId + // i.e. ME1b, ME12, ME13, ME1a externally become stored internally in order ME1a, ME1b, ME12, ME13 + int i = (iring + 1) % 4; + if (i == 0) + i = 4; + return i; + } + + static int detIdToInt(int iring) { + // reverse intToDetId: change 1, 2, 3, 4 inside the DetId to 4, 1, 2, 3 for external use + // i.e. output ring # 1, 2, 3, 4 in ME1 means ME1b, ME12, ME13, ME1a as usual in the offline software. + int i = (iring - 1); + if (i == 0) + i = 4; + return i; + } + + // The following define the bit-packing implementation... + + // The maximum numbers of various parts + enum eMaxNum { MAX_ENDCAP = 2, MAX_STATION = 4, MAX_RING = 4, MAX_CHAMBER = 36, MAX_LAYER = 6 }; + // We count from 1 + enum eMinNum { MIN_ENDCAP = 1, MIN_STATION = 1, MIN_RING = 1, MIN_CHAMBER = 1, MIN_LAYER = 1 }; + + // BITS_det is no. of binary bits required to label 'det' but allow 0 as a wild-card character + // Keep as multiples of 3 so that number can be easily decodable from octal + enum eNumBitDet { BITS_ENDCAP = 3, BITS_STATION = 3, BITS_RING = 3, BITS_CHAMBER = 6, BITS_LAYER = 3 }; + + // MASK_det is binary bits set to pick off the bits for 'det' (defined as octal) + enum eMaskBitDet { MASK_ENDCAP = 07, MASK_STATION = 07, MASK_RING = 07, MASK_CHAMBER = 077, MASK_LAYER = 07 }; + + // START_det is bit position (counting from zero) at which bits for 'det' start in 'rawId' word + enum eStartBitDet { + START_CHAMBER = BITS_LAYER, + START_RING = START_CHAMBER + BITS_CHAMBER, + START_STATION = START_RING + BITS_RING, + START_ENDCAP = START_STATION + BITS_STATION + }; }; -}; - -std::ostream& operator<<(std::ostream& os, const CSCDetId& id); + std::ostream& operator<<(std::ostream& os, const CSCDetId& id); +} // namespace io_v1 +using CSCDetId = io_v1::CSCDetId; #endif diff --git a/DataFormats/MuonDetId/interface/CSCDetIdFwd.h b/DataFormats/MuonDetId/interface/CSCDetIdFwd.h index 10dbdcff55c04..2d847a87cdbf6 100644 --- a/DataFormats/MuonDetId/interface/CSCDetIdFwd.h +++ b/DataFormats/MuonDetId/interface/CSCDetIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_MuonDetId_CSCDetIdFwd_h #define DataFormats_MuonDetId_CSCDetIdFwd_h -class CSCDetId; +namespace io_v1 { + class CSCDetId; +} +using CSCDetId = io_v1::CSCDetId; #endif diff --git a/DataFormats/MuonDetId/interface/DTChamberId.h b/DataFormats/MuonDetId/interface/DTChamberId.h index 54ee5c47e545c..cac588c9fae18 100644 --- a/DataFormats/MuonDetId/interface/DTChamberId.h +++ b/DataFormats/MuonDetId/interface/DTChamberId.h @@ -11,104 +11,106 @@ #include -class DTChamberId : public DetId { -public: - /// Default constructor. - /// Fills the common part in the base and leaves 0 in all other fields - DTChamberId(); - - /// Construct from a packed id. - /// It is required that the packed id represents a valid DT DetId - /// (proper Detector and SubDet fields), otherwise an exception is thrown. - /// Any bits outside the DTChamberId fields are zeroed; apart for - /// this, no check is done on the vaildity of the values. - DTChamberId(uint32_t id); - DTChamberId(DetId id); - - /// Construct from indexes. - /// Input values are required to be within legal ranges, otherwise an - /// exception is thrown. - DTChamberId(int wheel, int station, int sector); - - /// Copy Constructor. - /// Any bits outside the DTChamberId fields are zeroed; apart for - /// this, no check is done on the vaildity of the values. - DTChamberId(const DTChamberId& chId); - - /// Assignment Operator. - DTChamberId& operator=(const DTChamberId& chId) = default; - - /// Return the wheel number - int wheel() const { return int((id_ >> wheelStartBit_) & wheelMask_) + minWheelId - 1; } - - /// Return the station number - int station() const { return ((id_ >> stationStartBit_) & stationMask_); } - - /// Return the sector number. Sectors are numbered from 1 to 12, - /// starting at phi=0 and increasing with phi. - /// In station 4, where the top and bottom setcors are made of two chambers, - /// two additional sector numbers are used, 13 (after sector 4, top) - /// and 14 (after sector 10, bottom). - int sector() const { return ((id_ >> sectorStartBit_) & sectorMask_); } - - /// lowest station id - static const int minStationId = 1; - /// highest station id - static const int maxStationId = 4; - /// lowest sector id. 0 indicates all sectors (a station) - static const int minSectorId = 0; - /// highest sector id. - static const int maxSectorId = 14; - /// lowest wheel number - static const int minWheelId = -2; - /// highest wheel number - static const int maxWheelId = 2; - /// loweset super layer id. 0 indicates a full chamber - static const int minSuperLayerId = 0; - /// highest superlayer id - static const int maxSuperLayerId = 3; - /// lowest layer id. 0 indicates a full SL - static const int minLayerId = 0; - /// highest layer id - static const int maxLayerId = 4; - /// lowest wire id (numbering starts from 1 or 2). 0 indicates a full layer - static const int minWireId = 0; - /// highest wire id (chambers have 48 to 96 wires) - static const int maxWireId = 97; - -protected: - /// two bits would be enough, but we could use the number "0" as a wildcard - static const int wireNumBits_ = 7; - static const int wireStartBit_ = 3; - static const int layerNumBits_ = 3; - static const int layerStartBit_ = wireStartBit_ + wireNumBits_; - static const int slayerNumBits_ = 2; - static const int slayerStartBit_ = layerStartBit_ + layerNumBits_; - static const int wheelNumBits_ = 3; - static const int wheelStartBit_ = slayerStartBit_ + slayerNumBits_; - static const int sectorNumBits_ = 4; - static const int sectorStartBit_ = wheelStartBit_ + wheelNumBits_; - /// two bits would be enough, but we could use the number "0" as a wildcard - static const int stationNumBits_ = 3; - static const int stationStartBit_ = sectorStartBit_ + sectorNumBits_; - - static const uint32_t wheelMask_ = 0x7; - static const uint32_t stationMask_ = 0x7; - static const uint32_t sectorMask_ = 0xf; - static const uint32_t slMask_ = 0x3; - static const uint32_t lMask_ = 0x7; - static const uint32_t wireMask_ = 0x7f; - - static const uint32_t layerIdMask_ = ~(wireMask_ << wireStartBit_); - static const uint32_t slIdMask_ = ~((wireMask_ << wireStartBit_) | (lMask_ << layerStartBit_)); - static const uint32_t chamberIdMask_ = - ~((wireMask_ << wireStartBit_) | (lMask_ << layerStartBit_) | (slMask_ << slayerStartBit_)); - - // Perform a consistency check of the id with a DT Id - // It thorows an exception if this is not the case - void checkMuonId(); -}; - -std::ostream& operator<<(std::ostream& os, const DTChamberId& id); - +namespace io_v1 { + class DTChamberId : public DetId { + public: + /// Default constructor. + /// Fills the common part in the base and leaves 0 in all other fields + DTChamberId(); + + /// Construct from a packed id. + /// It is required that the packed id represents a valid DT DetId + /// (proper Detector and SubDet fields), otherwise an exception is thrown. + /// Any bits outside the DTChamberId fields are zeroed; apart for + /// this, no check is done on the vaildity of the values. + DTChamberId(uint32_t id); + DTChamberId(DetId id); + + /// Construct from indexes. + /// Input values are required to be within legal ranges, otherwise an + /// exception is thrown. + DTChamberId(int wheel, int station, int sector); + + /// Copy Constructor. + /// Any bits outside the DTChamberId fields are zeroed; apart for + /// this, no check is done on the vaildity of the values. + DTChamberId(const DTChamberId& chId); + + /// Assignment Operator. + DTChamberId& operator=(const DTChamberId& chId) = default; + + /// Return the wheel number + int wheel() const { return int((id_ >> wheelStartBit_) & wheelMask_) + minWheelId - 1; } + + /// Return the station number + int station() const { return ((id_ >> stationStartBit_) & stationMask_); } + + /// Return the sector number. Sectors are numbered from 1 to 12, + /// starting at phi=0 and increasing with phi. + /// In station 4, where the top and bottom setcors are made of two chambers, + /// two additional sector numbers are used, 13 (after sector 4, top) + /// and 14 (after sector 10, bottom). + int sector() const { return ((id_ >> sectorStartBit_) & sectorMask_); } + + /// lowest station id + static const int minStationId = 1; + /// highest station id + static const int maxStationId = 4; + /// lowest sector id. 0 indicates all sectors (a station) + static const int minSectorId = 0; + /// highest sector id. + static const int maxSectorId = 14; + /// lowest wheel number + static const int minWheelId = -2; + /// highest wheel number + static const int maxWheelId = 2; + /// loweset super layer id. 0 indicates a full chamber + static const int minSuperLayerId = 0; + /// highest superlayer id + static const int maxSuperLayerId = 3; + /// lowest layer id. 0 indicates a full SL + static const int minLayerId = 0; + /// highest layer id + static const int maxLayerId = 4; + /// lowest wire id (numbering starts from 1 or 2). 0 indicates a full layer + static const int minWireId = 0; + /// highest wire id (chambers have 48 to 96 wires) + static const int maxWireId = 97; + + protected: + /// two bits would be enough, but we could use the number "0" as a wildcard + static const int wireNumBits_ = 7; + static const int wireStartBit_ = 3; + static const int layerNumBits_ = 3; + static const int layerStartBit_ = wireStartBit_ + wireNumBits_; + static const int slayerNumBits_ = 2; + static const int slayerStartBit_ = layerStartBit_ + layerNumBits_; + static const int wheelNumBits_ = 3; + static const int wheelStartBit_ = slayerStartBit_ + slayerNumBits_; + static const int sectorNumBits_ = 4; + static const int sectorStartBit_ = wheelStartBit_ + wheelNumBits_; + /// two bits would be enough, but we could use the number "0" as a wildcard + static const int stationNumBits_ = 3; + static const int stationStartBit_ = sectorStartBit_ + sectorNumBits_; + + static const uint32_t wheelMask_ = 0x7; + static const uint32_t stationMask_ = 0x7; + static const uint32_t sectorMask_ = 0xf; + static const uint32_t slMask_ = 0x3; + static const uint32_t lMask_ = 0x7; + static const uint32_t wireMask_ = 0x7f; + + static const uint32_t layerIdMask_ = ~(wireMask_ << wireStartBit_); + static const uint32_t slIdMask_ = ~((wireMask_ << wireStartBit_) | (lMask_ << layerStartBit_)); + static const uint32_t chamberIdMask_ = + ~((wireMask_ << wireStartBit_) | (lMask_ << layerStartBit_) | (slMask_ << slayerStartBit_)); + + // Perform a consistency check of the id with a DT Id + // It thorows an exception if this is not the case + void checkMuonId(); + }; + + std::ostream& operator<<(std::ostream& os, const DTChamberId& id); +} // namespace io_v1 +using DTChamberId = io_v1::DTChamberId; #endif diff --git a/DataFormats/MuonDetId/interface/DTChamberIdFwd.h b/DataFormats/MuonDetId/interface/DTChamberIdFwd.h index 0796612b2a38e..14266ad3f9b57 100644 --- a/DataFormats/MuonDetId/interface/DTChamberIdFwd.h +++ b/DataFormats/MuonDetId/interface/DTChamberIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_MuonDetId_DTChamberIdFwd_h #define DataFormats_MuonDetId_DTChamberIdFwd_h -class DTChamberId; +namespace io_v1 { + class DTChamberId; +} +using DTChamberId = io_v1::DTChamberId; #endif diff --git a/DataFormats/MuonDetId/interface/DTLayerId.h b/DataFormats/MuonDetId/interface/DTLayerId.h index 887ad2ce4fa51..9a37f609c3863 100644 --- a/DataFormats/MuonDetId/interface/DTLayerId.h +++ b/DataFormats/MuonDetId/interface/DTLayerId.h @@ -9,45 +9,47 @@ #include -class DTLayerId : public DTSuperLayerId { -public: - /// Default constructor. - /// Fills the common part in the base and leaves 0 in all other fields - DTLayerId(); - - /// Construct from a packed id. - /// It is required that the packed id represents a valid DT DetId - /// (proper Detector and SubDet fields), otherwise an exception is thrown. - /// Any bits outside the DTLayerId fields are zeroed; apart for - /// this, no check is done on the vaildity of the values. - explicit DTLayerId(uint32_t id); - - /// Construct from indexes. - /// Input values are required to be within legal ranges, otherwise an - /// exception is thrown. - DTLayerId(int wheel, int station, int sector, int superlayer, int layer); - - /// Copy Constructor. - /// Any bits outside the DTLayerId fields are zeroed; apart for - /// this, no check is done on the vaildity of the values. - DTLayerId(const DTLayerId& layerId); - - /// Assignment Operator. - DTLayerId& operator=(const DTLayerId& layerId) = default; - - /// Constructor from a camberId and SL and layer numbers - DTLayerId(const DTChamberId& chId, int superlayer, int layer); - - /// Constructor from a SuperLayerId and layer number - DTLayerId(const DTSuperLayerId& slId, int layer); - - /// Return the layer number - int layer() const { return ((id_ >> layerStartBit_) & lMask_); } - - /// Return the corresponding SuperLayerId - DTSuperLayerId superlayerId() const { return DTSuperLayerId(id_ & slIdMask_); } -}; - -std::ostream& operator<<(std::ostream& os, const DTLayerId& id); - +namespace io_v1 { + class DTLayerId : public DTSuperLayerId { + public: + /// Default constructor. + /// Fills the common part in the base and leaves 0 in all other fields + DTLayerId(); + + /// Construct from a packed id. + /// It is required that the packed id represents a valid DT DetId + /// (proper Detector and SubDet fields), otherwise an exception is thrown. + /// Any bits outside the DTLayerId fields are zeroed; apart for + /// this, no check is done on the vaildity of the values. + explicit DTLayerId(uint32_t id); + + /// Construct from indexes. + /// Input values are required to be within legal ranges, otherwise an + /// exception is thrown. + DTLayerId(int wheel, int station, int sector, int superlayer, int layer); + + /// Copy Constructor. + /// Any bits outside the DTLayerId fields are zeroed; apart for + /// this, no check is done on the vaildity of the values. + DTLayerId(const DTLayerId& layerId); + + /// Assignment Operator. + DTLayerId& operator=(const DTLayerId& layerId) = default; + + /// Constructor from a camberId and SL and layer numbers + DTLayerId(const DTChamberId& chId, int superlayer, int layer); + + /// Constructor from a SuperLayerId and layer number + DTLayerId(const DTSuperLayerId& slId, int layer); + + /// Return the layer number + int layer() const { return ((id_ >> layerStartBit_) & lMask_); } + + /// Return the corresponding SuperLayerId + DTSuperLayerId superlayerId() const { return DTSuperLayerId(id_ & slIdMask_); } + }; + + std::ostream& operator<<(std::ostream& os, const DTLayerId& id); +} // namespace io_v1 +using DTLayerId = io_v1::DTLayerId; #endif diff --git a/DataFormats/MuonDetId/interface/DTLayerIdFwd.h b/DataFormats/MuonDetId/interface/DTLayerIdFwd.h index e29101d7f31d1..a0643df0d4614 100644 --- a/DataFormats/MuonDetId/interface/DTLayerIdFwd.h +++ b/DataFormats/MuonDetId/interface/DTLayerIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_MuonDetId_DTLayerIdFwd_h #define DataFormats_MuonDetId_DTLayerIdFwd_h -class DTLayerId; +namespace io_v1 { + class DTLayerId; +} +using DTLayerId = io_v1::DTLayerId; #endif diff --git a/DataFormats/MuonDetId/interface/GEMDetId.h b/DataFormats/MuonDetId/interface/GEMDetId.h index e234726d77efa..46de99892f83c 100644 --- a/DataFormats/MuonDetId/interface/GEMDetId.h +++ b/DataFormats/MuonDetId/interface/GEMDetId.h @@ -15,267 +15,269 @@ #include #include -class GEMDetId : public DetId { -public: - static constexpr int32_t minRegionId = -1; - static constexpr int32_t maxRegionId = 1; - static constexpr int32_t minRingId = 1; - static constexpr int32_t maxRingId = 3; - static constexpr int32_t minStationId0 = 0; - static constexpr int32_t minStationId = 1; - // in the detId there is space to go up to 5 stations. Only 3 implemented now (0,1,2) - static constexpr int32_t maxStationId = 2; - static constexpr int32_t minChamberId = 0; - static constexpr int32_t maxChamberId = 36; - static constexpr int32_t minLayerId = 0; // LayerId = 0 is superChamber - static constexpr int32_t maxLayerId0 = 6; - static constexpr int32_t maxLayerId = 2; // GE1/GE2 has 2 layers - static constexpr int32_t minEtaPartitionId = 0; - static constexpr int32_t maxEtaPartitionId = 16; - static constexpr int32_t minRollId = minEtaPartitionId; - static constexpr int32_t maxRollId = maxEtaPartitionId; - -private: - static constexpr uint32_t RegionNumBits = 2; - static constexpr uint32_t RegionStartBit = 0; - static constexpr uint32_t RegionMask = 0x3; - static constexpr uint32_t RingNumBits = 3; - static constexpr uint32_t RingStartBit = RegionStartBit + RegionNumBits; - static constexpr uint32_t RingMask = 0x7; - static constexpr uint32_t StationNumBits = 3; - static constexpr uint32_t StationStartBit = RingStartBit + RingNumBits; - static constexpr uint32_t StationMask = 0x7; - static constexpr uint32_t ChamberNumBits = 6; - static constexpr uint32_t ChamberStartBit = StationStartBit + StationNumBits; - static constexpr uint32_t ChamberStartBitM = RegionStartBit + RegionNumBits; - static constexpr uint32_t ChamberMask = 0x3F; - static constexpr uint32_t LayerNumBits = 5; - static constexpr uint32_t LayerNumBitsP = 2; - static constexpr uint32_t LayerStartBit = ChamberStartBit + ChamberNumBits; - static constexpr uint32_t LayerStartBitM = ChamberStartBitM + ChamberNumBits; - static constexpr uint32_t LayerMask = 0x1F; - static constexpr uint32_t LayerMaskP = 0x3; - static constexpr uint32_t EtaPartitionNumBits = 5; - static constexpr uint32_t EtaPartitionStartBit = LayerStartBit + LayerNumBits; - static constexpr uint32_t EtaPartitionStartBitP = LayerStartBit + LayerNumBitsP; - static constexpr uint32_t EtaPartitionStartBitM = LayerStartBitM + LayerNumBits; - static constexpr uint32_t EtaPartitionMask = 0x1F; - static constexpr uint32_t FormatNumBits = 1; - static constexpr uint32_t FormatStartBit = EtaPartitionStartBit + EtaPartitionNumBits; - static constexpr uint32_t FormatMask = 0x1; - static constexpr uint32_t kGEMIdFormat = 0x1000000; - static constexpr uint32_t kMuonIdMask = 0xF0000000; - -public: - static constexpr uint32_t chamberIdMask = ~(EtaPartitionMask << EtaPartitionStartBit); - static constexpr uint32_t superChamberIdMask = chamberIdMask + ~(LayerMask << LayerStartBit); - -public: - /** Create a null detId */ - constexpr GEMDetId() : DetId(DetId::Muon, MuonSubdetId::GEM) {} - /** Construct from a packed id. It is required that the Detector part of +namespace io_v1 { + class GEMDetId : public DetId { + public: + static constexpr int32_t minRegionId = -1; + static constexpr int32_t maxRegionId = 1; + static constexpr int32_t minRingId = 1; + static constexpr int32_t maxRingId = 3; + static constexpr int32_t minStationId0 = 0; + static constexpr int32_t minStationId = 1; + // in the detId there is space to go up to 5 stations. Only 3 implemented now (0,1,2) + static constexpr int32_t maxStationId = 2; + static constexpr int32_t minChamberId = 0; + static constexpr int32_t maxChamberId = 36; + static constexpr int32_t minLayerId = 0; // LayerId = 0 is superChamber + static constexpr int32_t maxLayerId0 = 6; + static constexpr int32_t maxLayerId = 2; // GE1/GE2 has 2 layers + static constexpr int32_t minEtaPartitionId = 0; + static constexpr int32_t maxEtaPartitionId = 16; + static constexpr int32_t minRollId = minEtaPartitionId; + static constexpr int32_t maxRollId = maxEtaPartitionId; + + private: + static constexpr uint32_t RegionNumBits = 2; + static constexpr uint32_t RegionStartBit = 0; + static constexpr uint32_t RegionMask = 0x3; + static constexpr uint32_t RingNumBits = 3; + static constexpr uint32_t RingStartBit = RegionStartBit + RegionNumBits; + static constexpr uint32_t RingMask = 0x7; + static constexpr uint32_t StationNumBits = 3; + static constexpr uint32_t StationStartBit = RingStartBit + RingNumBits; + static constexpr uint32_t StationMask = 0x7; + static constexpr uint32_t ChamberNumBits = 6; + static constexpr uint32_t ChamberStartBit = StationStartBit + StationNumBits; + static constexpr uint32_t ChamberStartBitM = RegionStartBit + RegionNumBits; + static constexpr uint32_t ChamberMask = 0x3F; + static constexpr uint32_t LayerNumBits = 5; + static constexpr uint32_t LayerNumBitsP = 2; + static constexpr uint32_t LayerStartBit = ChamberStartBit + ChamberNumBits; + static constexpr uint32_t LayerStartBitM = ChamberStartBitM + ChamberNumBits; + static constexpr uint32_t LayerMask = 0x1F; + static constexpr uint32_t LayerMaskP = 0x3; + static constexpr uint32_t EtaPartitionNumBits = 5; + static constexpr uint32_t EtaPartitionStartBit = LayerStartBit + LayerNumBits; + static constexpr uint32_t EtaPartitionStartBitP = LayerStartBit + LayerNumBitsP; + static constexpr uint32_t EtaPartitionStartBitM = LayerStartBitM + LayerNumBits; + static constexpr uint32_t EtaPartitionMask = 0x1F; + static constexpr uint32_t FormatNumBits = 1; + static constexpr uint32_t FormatStartBit = EtaPartitionStartBit + EtaPartitionNumBits; + static constexpr uint32_t FormatMask = 0x1; + static constexpr uint32_t kGEMIdFormat = 0x1000000; + static constexpr uint32_t kMuonIdMask = 0xF0000000; + + public: + static constexpr uint32_t chamberIdMask = ~(EtaPartitionMask << EtaPartitionStartBit); + static constexpr uint32_t superChamberIdMask = chamberIdMask + ~(LayerMask << LayerStartBit); + + public: + /** Create a null detId */ + constexpr GEMDetId() : DetId(DetId::Muon, MuonSubdetId::GEM) {} + /** Construct from a packed id. It is required that the Detector part of id is Muon and the SubDet part is GEM, otherwise an exception is thrown*/ - constexpr GEMDetId(uint32_t id) : DetId(id) { - if (det() != DetId::Muon || (subdetId() != MuonSubdetId::GEM && subdetId() != MuonSubdetId::ME0)) - throw cms::Exception("InvalidDetId") - << "GEMDetId ctor: det: " << det() << " subdet: " << subdetId() << " is not a valid GEM id\n"; - - if (v11Format()) - id_ = v12Form(id); - } - /** Construct from a generic cell ID */ - constexpr GEMDetId(DetId id) : DetId(id) { - if (det() != DetId::Muon || (subdetId() != MuonSubdetId::GEM && subdetId() != MuonSubdetId::ME0)) - throw cms::Exception("InvalidDetId") - << "GEMDetId ctor: det: " << det() << " subdet: " << subdetId() << " is not a valid GEM id\n"; - if (v11Format()) - id_ = v12Form(id.rawId()); - } - /// Construct from fully qualified identifier. - constexpr GEMDetId(int region, int ring, int station, int layer, int chamber, int ieta) - : DetId(DetId::Muon, MuonSubdetId::GEM) { - if (region < minRegionId || region > maxRegionId || ring < minRingId || ring > maxRingId || - station < minStationId0 || station > maxStationId || layer < minLayerId || layer > maxLayerId0 || - chamber < minChamberId || chamber > maxChamberId || ieta < minEtaPartitionId || ieta > maxEtaPartitionId) - throw cms::Exception("InvalidDetId") - << "GEMDetId ctor: Invalid parameters: region " << region << " ring " << ring << " station " << station - << " layer " << layer << " chamber " << chamber << " ieta " << ieta << std::endl; - - int regionInBits = region - minRegionId; - int ringInBits = ring - minRingId; - int stationInBits = station - minStationId0; - int layerInBits = layer - minLayerId; - int chamberInBits = chamber - (minChamberId + 1); - int ietaInBits = ieta; - - id_ |= ((regionInBits & RegionMask) << RegionStartBit | (ringInBits & RingMask) << RingStartBit | - (stationInBits & StationMask) << StationStartBit | (layerInBits & LayerMask) << LayerStartBit | - (chamberInBits & ChamberMask) << ChamberStartBit | (ietaInBits & EtaPartitionMask) << EtaPartitionStartBit | - kGEMIdFormat); - } - - /** Assignment from a generic cell id */ - constexpr GEMDetId& operator=(const DetId& gen) { - if (!gen.null()) { - int subdet = gen.subdetId(); - if (gen.det() != Muon || (subdet != MuonSubdetId::GEM && subdet != MuonSubdetId::ME0)) + constexpr GEMDetId(uint32_t id) : DetId(id) { + if (det() != DetId::Muon || (subdetId() != MuonSubdetId::GEM && subdetId() != MuonSubdetId::ME0)) throw cms::Exception("InvalidDetId") - << "GEMDetId ctor: Cannot assign GEMDetID from " << std::hex << gen.rawId() << std::dec; + << "GEMDetId ctor: det: " << det() << " subdet: " << subdetId() << " is not a valid GEM id\n"; + if (v11Format()) - id_ = v12Form(gen.rawId()); - else + id_ = v12Form(id); + } + /** Construct from a generic cell ID */ + constexpr GEMDetId(DetId id) : DetId(id) { + if (det() != DetId::Muon || (subdetId() != MuonSubdetId::GEM && subdetId() != MuonSubdetId::ME0)) + throw cms::Exception("InvalidDetId") + << "GEMDetId ctor: det: " << det() << " subdet: " << subdetId() << " is not a valid GEM id\n"; + if (v11Format()) + id_ = v12Form(id.rawId()); + } + /// Construct from fully qualified identifier. + constexpr GEMDetId(int region, int ring, int station, int layer, int chamber, int ieta) + : DetId(DetId::Muon, MuonSubdetId::GEM) { + if (region < minRegionId || region > maxRegionId || ring < minRingId || ring > maxRingId || + station < minStationId0 || station > maxStationId || layer < minLayerId || layer > maxLayerId0 || + chamber < minChamberId || chamber > maxChamberId || ieta < minEtaPartitionId || ieta > maxEtaPartitionId) + throw cms::Exception("InvalidDetId") + << "GEMDetId ctor: Invalid parameters: region " << region << " ring " << ring << " station " << station + << " layer " << layer << " chamber " << chamber << " ieta " << ieta << std::endl; + + int regionInBits = region - minRegionId; + int ringInBits = ring - minRingId; + int stationInBits = station - minStationId0; + int layerInBits = layer - minLayerId; + int chamberInBits = chamber - (minChamberId + 1); + int ietaInBits = ieta; + + id_ |= ((regionInBits & RegionMask) << RegionStartBit | (ringInBits & RingMask) << RingStartBit | + (stationInBits & StationMask) << StationStartBit | (layerInBits & LayerMask) << LayerStartBit | + (chamberInBits & ChamberMask) << ChamberStartBit | + (ietaInBits & EtaPartitionMask) << EtaPartitionStartBit | kGEMIdFormat); + } + + /** Assignment from a generic cell id */ + constexpr GEMDetId& operator=(const DetId& gen) { + if (!gen.null()) { + int subdet = gen.subdetId(); + if (gen.det() != Muon || (subdet != MuonSubdetId::GEM && subdet != MuonSubdetId::ME0)) + throw cms::Exception("InvalidDetId") + << "GEMDetId ctor: Cannot assign GEMDetID from " << std::hex << gen.rawId() << std::dec; + if (v11Format()) + id_ = v12Form(gen.rawId()); + else + id_ = gen.rawId(); + } else { id_ = gen.rawId(); - } else { - id_ = gen.rawId(); + } + return (*this); + } + + /** Comparison operator */ + constexpr bool operator==(const GEMDetId& gen) const { + uint32_t rawid = gen.rawId(); + if (rawid == id_) + return true; + int reg(0), ri(0), stn(-1), lay(0), chamb(0), iet(0); + unpackId(rawid, reg, ri, stn, lay, chamb, iet); + return (((id_ & kMuonIdMask) == (rawid & kMuonIdMask)) && (reg == region()) && (ri == ring()) && + (stn == station()) && (lay == layer()) && (chamb == chamber()) && (iet == ieta())); } - return (*this); - } - - /** Comparison operator */ - constexpr bool operator==(const GEMDetId& gen) const { - uint32_t rawid = gen.rawId(); - if (rawid == id_) - return true; - int reg(0), ri(0), stn(-1), lay(0), chamb(0), iet(0); - unpackId(rawid, reg, ri, stn, lay, chamb, iet); - return (((id_ & kMuonIdMask) == (rawid & kMuonIdMask)) && (reg == region()) && (ri == ring()) && - (stn == station()) && (lay == layer()) && (chamb == chamber()) && (iet == ieta())); - } - constexpr bool operator!=(const GEMDetId& gen) const { - uint32_t rawid = gen.rawId(); - if (rawid == id_) - return false; - int reg(0), ri(0), stn(-1), lay(0), chamb(0), iet(0); - unpackId(rawid, reg, ri, stn, lay, chamb, iet); - return (((id_ & kMuonIdMask) != (rawid & kMuonIdMask)) || (reg != region()) || (ri != ring()) || - (stn != station()) || (lay != layer()) || (chamb != chamber()) || (iet != ieta())); - } - - /** Sort Operator based on the raw detector id */ - constexpr bool operator<(const GEMDetId& r) const { - if (r.station() == this->station()) { - if (this->layer() == r.layer()) { - return this->rawId() < r.rawId(); + constexpr bool operator!=(const GEMDetId& gen) const { + uint32_t rawid = gen.rawId(); + if (rawid == id_) + return false; + int reg(0), ri(0), stn(-1), lay(0), chamb(0), iet(0); + unpackId(rawid, reg, ri, stn, lay, chamb, iet); + return (((id_ & kMuonIdMask) != (rawid & kMuonIdMask)) || (reg != region()) || (ri != ring()) || + (stn != station()) || (lay != layer()) || (chamb != chamber()) || (iet != ieta())); + } + + /** Sort Operator based on the raw detector id */ + constexpr bool operator<(const GEMDetId& r) const { + if (r.station() == this->station()) { + if (this->layer() == r.layer()) { + return this->rawId() < r.rawId(); + } else { + return (this->layer() < r.layer()); + } } else { - return (this->layer() < r.layer()); + return this->station() < r.station(); } - } else { - return this->station() < r.station(); } - } - /** Check the format */ - constexpr bool v11Format() const { return ((id_ & kGEMIdFormat) == 0); } + /** Check the format */ + constexpr bool v11Format() const { return ((id_ & kGEMIdFormat) == 0); } - /** Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap */ - constexpr int region() const { return (static_cast((id_ >> RegionStartBit) & RegionMask) + minRegionId); } + /** Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap */ + constexpr int region() const { return (static_cast((id_ >> RegionStartBit) & RegionMask) + minRegionId); } - /** Ring id: GEM are installed only on ring 1 + /** Ring id: GEM are installed only on ring 1 the ring is the group of chambers with same r (distance of beam axis) and increasing phi */ - constexpr int ring() const { return (static_cast((id_ >> RingStartBit) & RingMask) + minRingId); } + constexpr int ring() const { return (static_cast((id_ >> RingStartBit) & RingMask) + minRingId); } - /** Station id : the station is the set of chambers at same disk */ - constexpr int station() const { return (static_cast((id_ >> StationStartBit) & StationMask) + minStationId0); } + /** Station id : the station is the set of chambers at same disk */ + constexpr int station() const { return (static_cast((id_ >> StationStartBit) & StationMask) + minStationId0); } - /** Chamber id: it identifies a chamber in a ring it goes from 1 to 36 + /** Chamber id: it identifies a chamber in a ring it goes from 1 to 36 for GE1 and GE2 and 1 to 18 for ME0 */ - constexpr int chamber() const { - return (static_cast((id_ >> ChamberStartBit) & ChamberMask) + (minChamberId + 1)); - } + constexpr int chamber() const { + return (static_cast((id_ >> ChamberStartBit) & ChamberMask) + (minChamberId + 1)); + } - /** Layer id: each station have two layers of chambers for GE1 and GE2: + /** Layer id: each station have two layers of chambers for GE1 and GE2: layer 1 is the inner chamber and layer 2 is the outer chamber For ME0 there are 6 layers of chambers */ - constexpr int layer() const { return (static_cast((id_ >> LayerStartBit) & LayerMask) + minLayerId); } + constexpr int layer() const { return (static_cast((id_ >> LayerStartBit) & LayerMask) + minLayerId); } - /** EtaPartition id (also known as eta partition): each chamber is divided along + /** EtaPartition id (also known as eta partition): each chamber is divided along the strip direction in several parts (ietas) GEM up to 12 */ - constexpr int roll() const { - return (static_cast((id_ >> EtaPartitionStartBit) & EtaPartitionMask)); // value 0 is used as wild card - } - - /** Return the corresponding EtaPartition id (same as roll) */ - constexpr int ieta() const { - return (static_cast((id_ >> EtaPartitionStartBit) & EtaPartitionMask)); // value 0 is used as wild card - } + constexpr int roll() const { + return (static_cast((id_ >> EtaPartitionStartBit) & EtaPartitionMask)); // value 0 is used as wild card + } - /** Return the corresponding ChamberId */ - constexpr GEMDetId chamberId() const { return GEMDetId(id_ & chamberIdMask); } + /** Return the corresponding EtaPartition id (same as roll) */ + constexpr int ieta() const { + return (static_cast((id_ >> EtaPartitionStartBit) & EtaPartitionMask)); // value 0 is used as wild card + } - /** Return the corresponding superChamberId */ - constexpr GEMDetId superChamberId() const { return GEMDetId(id_ & superChamberIdMask); } + /** Return the corresponding ChamberId */ + constexpr GEMDetId chamberId() const { return GEMDetId(id_ & chamberIdMask); } - /** Return the corresponding LayerId (mask eta partition) */ - constexpr GEMDetId layerId() const { return GEMDetId(id_ & chamberIdMask); } + /** Return the corresponding superChamberId */ + constexpr GEMDetId superChamberId() const { return GEMDetId(id_ & superChamberIdMask); } - /** Return total # of layers for this type of detector */ - constexpr int nlayers() const { - return ((station() == 0) ? maxLayerId0 : ((station() > maxStationId) ? 0 : maxLayerId)); - } + /** Return the corresponding LayerId (mask eta partition) */ + constexpr GEMDetId layerId() const { return GEMDetId(id_ & chamberIdMask); } - constexpr uint32_t v12Form() const { return v12Form(id_); } + /** Return total # of layers for this type of detector */ + constexpr int nlayers() const { + return ((station() == 0) ? maxLayerId0 : ((station() > maxStationId) ? 0 : maxLayerId)); + } - constexpr static uint32_t v12Form(const uint32_t& inpid) { - uint32_t rawid(inpid); - if ((rawid & kGEMIdFormat) == 0) { - int region(0), ring(0), station(-1), layer(0), chamber(0), ieta(0); - unpackId(rawid, region, ring, station, layer, chamber, ieta); - int regionInBits = region - minRegionId; - int ringInBits = ring - minRingId; - int stationInBits = station - minStationId0; - int layerInBits = layer - minLayerId; - int chamberInBits = chamber - (minChamberId + 1); - int ietaInBits = ieta; - rawid = (((DetId::Muon & DetId::kDetMask) << DetId::kDetOffset) | - ((MuonSubdetId::GEM & DetId::kSubdetMask) << DetId::kSubdetOffset) | - ((regionInBits & RegionMask) << RegionStartBit) | ((ringInBits & RingMask) << RingStartBit) | - ((stationInBits & StationMask) << StationStartBit) | ((layerInBits & LayerMask) << LayerStartBit) | - ((chamberInBits & ChamberMask) << ChamberStartBit) | - ((ietaInBits & EtaPartitionMask) << EtaPartitionStartBit) | kGEMIdFormat); + constexpr uint32_t v12Form() const { return v12Form(id_); } + + constexpr static uint32_t v12Form(const uint32_t& inpid) { + uint32_t rawid(inpid); + if ((rawid & kGEMIdFormat) == 0) { + int region(0), ring(0), station(-1), layer(0), chamber(0), ieta(0); + unpackId(rawid, region, ring, station, layer, chamber, ieta); + int regionInBits = region - minRegionId; + int ringInBits = ring - minRingId; + int stationInBits = station - minStationId0; + int layerInBits = layer - minLayerId; + int chamberInBits = chamber - (minChamberId + 1); + int ietaInBits = ieta; + rawid = (((DetId::Muon & DetId::kDetMask) << DetId::kDetOffset) | + ((MuonSubdetId::GEM & DetId::kSubdetMask) << DetId::kSubdetOffset) | + ((regionInBits & RegionMask) << RegionStartBit) | ((ringInBits & RingMask) << RingStartBit) | + ((stationInBits & StationMask) << StationStartBit) | ((layerInBits & LayerMask) << LayerStartBit) | + ((chamberInBits & ChamberMask) << ChamberStartBit) | + ((ietaInBits & EtaPartitionMask) << EtaPartitionStartBit) | kGEMIdFormat); + } + return rawid; } - return rawid; - } - - // subsystem - GEMSubDetId::Station subsystem() const; - bool isGE11() const; - bool isGE21() const; - bool isME0() const; - -private: - constexpr void v12FromV11(const uint32_t& rawid) { id_ = v12Form(rawid); } - - constexpr static void unpackId( - const uint32_t& rawid, int& region, int& ring, int& station, int& layer, int& chamber, int& ieta) { - if (((rawid >> DetId::kDetOffset) & DetId::kDetMask) == DetId::Muon) { - int subdet = ((rawid >> DetId::kSubdetOffset) & DetId::kSubdetMask); - if (subdet == MuonSubdetId::GEM) { - region = static_cast(((rawid >> RegionStartBit) & RegionMask) + minRegionId); - ring = (static_cast((rawid >> RingStartBit) & RingMask) + minRingId); - chamber = (static_cast((rawid >> ChamberStartBit) & ChamberMask) + (minChamberId + 1)); - if ((rawid & kGEMIdFormat) == 0) { - station = (static_cast((rawid >> StationStartBit) & StationMask) + minStationId); - layer = (static_cast((rawid >> LayerStartBit) & LayerMaskP) + minLayerId); - ieta = (static_cast((rawid >> EtaPartitionStartBitP) & EtaPartitionMask)); - } else { - station = (static_cast((rawid >> StationStartBit) & StationMask) + minStationId0); - layer = (static_cast((rawid >> LayerStartBit) & LayerMask) + minLayerId); - ieta = (static_cast((rawid >> EtaPartitionStartBit) & EtaPartitionMask)); + + // subsystem + GEMSubDetId::Station subsystem() const; + bool isGE11() const; + bool isGE21() const; + bool isME0() const; + + private: + constexpr void v12FromV11(const uint32_t& rawid) { id_ = v12Form(rawid); } + + constexpr static void unpackId( + const uint32_t& rawid, int& region, int& ring, int& station, int& layer, int& chamber, int& ieta) { + if (((rawid >> DetId::kDetOffset) & DetId::kDetMask) == DetId::Muon) { + int subdet = ((rawid >> DetId::kSubdetOffset) & DetId::kSubdetMask); + if (subdet == MuonSubdetId::GEM) { + region = static_cast(((rawid >> RegionStartBit) & RegionMask) + minRegionId); + ring = (static_cast((rawid >> RingStartBit) & RingMask) + minRingId); + chamber = (static_cast((rawid >> ChamberStartBit) & ChamberMask) + (minChamberId + 1)); + if ((rawid & kGEMIdFormat) == 0) { + station = (static_cast((rawid >> StationStartBit) & StationMask) + minStationId); + layer = (static_cast((rawid >> LayerStartBit) & LayerMaskP) + minLayerId); + ieta = (static_cast((rawid >> EtaPartitionStartBitP) & EtaPartitionMask)); + } else { + station = (static_cast((rawid >> StationStartBit) & StationMask) + minStationId0); + layer = (static_cast((rawid >> LayerStartBit) & LayerMask) + minLayerId); + ieta = (static_cast((rawid >> EtaPartitionStartBit) & EtaPartitionMask)); + } + } else if (subdet == MuonSubdetId::ME0) { + region = static_cast(((rawid >> RegionStartBit) & RegionMask) + minRegionId); + ring = 1; + station = 0; + chamber = (static_cast((rawid >> ChamberStartBitM) & ChamberMask) + (minChamberId)); + layer = (static_cast((rawid >> LayerStartBitM) & LayerMask) + minLayerId); + ieta = (static_cast((rawid >> EtaPartitionStartBitM) & EtaPartitionMask)); } - } else if (subdet == MuonSubdetId::ME0) { - region = static_cast(((rawid >> RegionStartBit) & RegionMask) + minRegionId); - ring = 1; - station = 0; - chamber = (static_cast((rawid >> ChamberStartBitM) & ChamberMask) + (minChamberId)); - layer = (static_cast((rawid >> LayerStartBitM) & LayerMask) + minLayerId); - ieta = (static_cast((rawid >> EtaPartitionStartBitM) & EtaPartitionMask)); } } - } - -}; // GEMDetId -std::ostream& operator<<(std::ostream& os, const GEMDetId& id); + }; // GEMDetId + std::ostream& operator<<(std::ostream& os, const GEMDetId& id); +} // namespace io_v1 +using GEMDetId = io_v1::GEMDetId; #endif diff --git a/DataFormats/MuonDetId/interface/GEMDetIdFwd.h b/DataFormats/MuonDetId/interface/GEMDetIdFwd.h index 18c5517c3d3a8..48d4401931879 100644 --- a/DataFormats/MuonDetId/interface/GEMDetIdFwd.h +++ b/DataFormats/MuonDetId/interface/GEMDetIdFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_MuonDetId_GEMDetIdFwd_h #define DataFormats_MuonDetId_GEMDetIdFwd_h -class GEMDetId; +namespace io_v1 { + class GEMDetId; +} +using GEMDetId = io_v1::GEMDetId; #endif diff --git a/DataFormats/MuonDetId/interface/RPCDetId.h b/DataFormats/MuonDetId/interface/RPCDetId.h index b7fd834ae363a..dc0c63be8d272 100644 --- a/DataFormats/MuonDetId/interface/RPCDetId.h +++ b/DataFormats/MuonDetId/interface/RPCDetId.h @@ -13,163 +13,166 @@ #include -class RPCDetId : public DetId { -public: - RPCDetId(); - - /// Construct from a packed id. It is required that the Detector part of - /// id is Muon and the SubDet part is RPC, otherwise an exception is thrown. - RPCDetId(uint32_t id); - RPCDetId(DetId id); - - /// Construct from fully qualified identifier. - RPCDetId(int region, int ring, int station, int sector, int layer, int subsector, int roll); - - /// Sort Operator based on the raw detector id - bool operator<(const RPCDetId& r) const { - if (r.station() == this->station()) { - if (this->layer() == r.layer()) { - return this->rawId() < r.rawId(); +namespace io_v1 { + class RPCDetId : public DetId { + public: + RPCDetId(); + + /// Construct from a packed id. It is required that the Detector part of + /// id is Muon and the SubDet part is RPC, otherwise an exception is thrown. + RPCDetId(uint32_t id); + RPCDetId(DetId id); + + /// Construct from fully qualified identifier. + RPCDetId(int region, int ring, int station, int sector, int layer, int subsector, int roll); + + /// Sort Operator based on the raw detector id + bool operator<(const RPCDetId& r) const { + if (r.station() == this->station()) { + if (this->layer() == r.layer()) { + return this->rawId() < r.rawId(); + } else { + return (this->layer() < r.layer()); + } } else { - return (this->layer() < r.layer()); + return this->station() < r.station(); } - } else { - return this->station() < r.station(); } - } - - void buildfromDB(int region, - int ring, - int layer, - int sector, - const std::string& subsector, - const std::string& roll, - const std::string& dbname); - - /// Built from the trigger det Index - void buildfromTrIndex(int trIndex); - - /// Region id: 0 for Barrel, +/-1 For +/- Endcap - int region() const { return int((id_ >> RegionStartBit_) & RegionMask_) + minRegionId; } - - /// Ring id: Wheel number in Barrel (from -2 to +2) Ring Number in Endcap (from 1 to 3) - /// Ring has a different meaning in Barrel and Endcap! In Barrel it is wheel, in Endcap - /// it is the physical ring located on a disk (a disk contains three rings). In Endcap - /// the ring is the group of chambers with same r (distance of beam axis) and increasing phi - int ring() const { - int ring_ = (id_ >> RingStartBit_) & RingMask_; - - if (ring_ < RingBarrelOffSet) { - if (this->region() == 0) { - throw cms::Exception("InvalidDetId") << "RPCDetId ctor:" - << " Ring - Region Inconsistency, " - << " region " << this->region() << " ring " << ring_ << std::endl; - } - - return int(ring_ + minRingForwardId); - } else { // if(ring_ >= RingBarrelOffSet) - return int(ring_ - RingBarrelOffSet + minRingBarrelId); + void buildfromDB(int region, + int ring, + int layer, + int sector, + const std::string& subsector, + const std::string& roll, + const std::string& dbname); + + /// Built from the trigger det Index + void buildfromTrIndex(int trIndex); + + /// Region id: 0 for Barrel, +/-1 For +/- Endcap + int region() const { return int((id_ >> RegionStartBit_) & RegionMask_) + minRegionId; } + + /// Ring id: Wheel number in Barrel (from -2 to +2) Ring Number in Endcap (from 1 to 3) + /// Ring has a different meaning in Barrel and Endcap! In Barrel it is wheel, in Endcap + /// it is the physical ring located on a disk (a disk contains three rings). In Endcap + /// the ring is the group of chambers with same r (distance of beam axis) and increasing phi + int ring() const { + int ring_ = (id_ >> RingStartBit_) & RingMask_; + + if (ring_ < RingBarrelOffSet) { + if (this->region() == 0) { + throw cms::Exception("InvalidDetId") << "RPCDetId ctor:" + << " Ring - Region Inconsistency, " + << " region " << this->region() << " ring " << ring_ << std::endl; + } + + return int(ring_ + minRingForwardId); + + } else { // if(ring_ >= RingBarrelOffSet) + return int(ring_ - RingBarrelOffSet + minRingBarrelId); + } } - } - /// Station id : For Barrel: the four groups of chambers at same r (distance from beam axis) and increasing phi - /// For Endcap: the three groups of chambers at same z (distance from interaction point), i.e. the disk - int station() const { return int((id_ >> StationStartBit_) & StationMask_) + minStationId; } + /// Station id : For Barrel: the four groups of chambers at same r (distance from beam axis) and increasing phi + /// For Endcap: the three groups of chambers at same z (distance from interaction point), i.e. the disk + int station() const { return int((id_ >> StationStartBit_) & StationMask_) + minStationId; } - /// Sector id: the group of chambers at same phi (and increasing r) - int sector() const { return int((id_ >> SectorStartBit_) & SectorMask_) + (minSectorId + 1); } + /// Sector id: the group of chambers at same phi (and increasing r) + int sector() const { return int((id_ >> SectorStartBit_) & SectorMask_) + (minSectorId + 1); } - /// Layer id: each station can have two layers of chambers: layer 1 is the inner chamber and layer 2 is the outer chamber (when present) - /// Only in Barrel: RB1 and RB2. - int layer() const { return int((id_ >> LayerStartBit_) & LayerMask_) + minLayerId; } + /// Layer id: each station can have two layers of chambers: layer 1 is the inner chamber and layer 2 is the outer chamber (when present) + /// Only in Barrel: RB1 and RB2. + int layer() const { return int((id_ >> LayerStartBit_) & LayerMask_) + minLayerId; } - /// SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel, from 1 to 6 in Endcap) - int subsector() const { return int((id_ >> SubSectorStartBit_) & SubSectorMask_) + (minSubSectorId + 1); } + /// SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel, from 1 to 6 in Endcap) + int subsector() const { return int((id_ >> SubSectorStartBit_) & SubSectorMask_) + (minSubSectorId + 1); } - /// Roll id (also known as eta partition): each chamber is divided along the strip direction in - /// two or three parts (rolls) for Barrel and two, three or four parts for endcap - int roll() const { - return int((id_ >> RollStartBit_) & RollMask_); // value 0 is used as wild card - } + /// Roll id (also known as eta partition): each chamber is divided along the strip direction in + /// two or three parts (rolls) for Barrel and two, three or four parts for endcap + int roll() const { + return int((id_ >> RollStartBit_) & RollMask_); // value 0 is used as wild card + } - int trIndex() const { return trind; } + int trIndex() const { return trind; } - /// Return the corresponding ChamberId - RPCDetId chamberId() const { return RPCDetId(id_ & chamberIdMask_); } + /// Return the corresponding ChamberId + RPCDetId chamberId() const { return RPCDetId(id_ & chamberIdMask_); } - static constexpr int minRegionId = -1; - static constexpr int maxRegionId = 1; + static constexpr int minRegionId = -1; + static constexpr int maxRegionId = 1; - static constexpr int minRingForwardId = 1; - static constexpr int maxRingForwardId = 3; - static constexpr int minRingBarrelId = -2; - static constexpr int maxRingBarrelId = 2; - static constexpr int RingBarrelOffSet = 3; + static constexpr int minRingForwardId = 1; + static constexpr int maxRingForwardId = 3; + static constexpr int minRingBarrelId = -2; + static constexpr int maxRingBarrelId = 2; + static constexpr int RingBarrelOffSet = 3; - static constexpr int minStationId = 1; - static constexpr int maxStationId = 4; + static constexpr int minStationId = 1; + static constexpr int maxStationId = 4; - static constexpr int minSectorId = 0; - static constexpr int maxSectorId = 12; - static constexpr int minSectorBarrelId = 1; - static constexpr int maxSectorBarrelId = 12; - static constexpr int minSectorForwardId = 1; - static constexpr int maxSectorForwardId = 6; + static constexpr int minSectorId = 0; + static constexpr int maxSectorId = 12; + static constexpr int minSectorBarrelId = 1; + static constexpr int maxSectorBarrelId = 12; + static constexpr int minSectorForwardId = 1; + static constexpr int maxSectorForwardId = 6; - static constexpr int minLayerId = 1; - static constexpr int maxLayerId = 2; + static constexpr int minLayerId = 1; + static constexpr int maxLayerId = 2; - static constexpr int minSubSectorId = 0; - static constexpr int maxSubSectorId = 6; - static constexpr int minSubSectorBarrelId = 1; - static constexpr int maxSubSectorBarrelId = 4; - static constexpr int minSubSectorForwardId = 1; - static constexpr int maxSubSectorForwardId = 6; + static constexpr int minSubSectorId = 0; + static constexpr int maxSubSectorId = 6; + static constexpr int minSubSectorBarrelId = 1; + static constexpr int maxSubSectorBarrelId = 4; + static constexpr int minSubSectorForwardId = 1; + static constexpr int maxSubSectorForwardId = 6; - static constexpr int minRollId = 0; - static constexpr int maxRollId = 5; // used to be 4 ... need 5 for upgrade - // if we decide to divide the upgrade RE3/1 and RE4/1 up to eta=2.4 - // and we want basically to have 0.10 eta / roll ... + static constexpr int minRollId = 0; + static constexpr int maxRollId = 5; // used to be 4 ... need 5 for upgrade + // if we decide to divide the upgrade RE3/1 and RE4/1 up to eta=2.4 + // and we want basically to have 0.10 eta / roll ... -private: - static constexpr int RegionNumBits_ = 2; - static constexpr int RegionStartBit_ = 0; - static constexpr int RegionMask_ = 0X3; + private: + static constexpr int RegionNumBits_ = 2; + static constexpr int RegionStartBit_ = 0; + static constexpr int RegionMask_ = 0X3; - static constexpr int RingNumBits_ = 3; - static constexpr int RingStartBit_ = RegionStartBit_ + RegionNumBits_; - static constexpr unsigned int RingMask_ = 0X7; + static constexpr int RingNumBits_ = 3; + static constexpr int RingStartBit_ = RegionStartBit_ + RegionNumBits_; + static constexpr unsigned int RingMask_ = 0X7; - static constexpr int StationNumBits_ = 2; - static constexpr int StationStartBit_ = RingStartBit_ + RingNumBits_; - static constexpr unsigned int StationMask_ = 0X3; + static constexpr int StationNumBits_ = 2; + static constexpr int StationStartBit_ = RingStartBit_ + RingNumBits_; + static constexpr unsigned int StationMask_ = 0X3; - static constexpr int SectorNumBits_ = 4; - static constexpr int SectorStartBit_ = StationStartBit_ + StationNumBits_; - static constexpr unsigned int SectorMask_ = 0XF; + static constexpr int SectorNumBits_ = 4; + static constexpr int SectorStartBit_ = StationStartBit_ + StationNumBits_; + static constexpr unsigned int SectorMask_ = 0XF; - static constexpr int LayerNumBits_ = 1; - static constexpr int LayerStartBit_ = SectorStartBit_ + SectorNumBits_; - static constexpr unsigned int LayerMask_ = 0X1; + static constexpr int LayerNumBits_ = 1; + static constexpr int LayerStartBit_ = SectorStartBit_ + SectorNumBits_; + static constexpr unsigned int LayerMask_ = 0X1; - static constexpr int SubSectorNumBits_ = 3; - static constexpr int SubSectorStartBit_ = LayerStartBit_ + LayerNumBits_; - static constexpr unsigned int SubSectorMask_ = 0X7; + static constexpr int SubSectorNumBits_ = 3; + static constexpr int SubSectorStartBit_ = LayerStartBit_ + LayerNumBits_; + static constexpr unsigned int SubSectorMask_ = 0X7; - static constexpr int RollNumBits_ = 3; - static constexpr int RollStartBit_ = SubSectorStartBit_ + SubSectorNumBits_; - static constexpr unsigned int RollMask_ = 0X7; + static constexpr int RollNumBits_ = 3; + static constexpr int RollStartBit_ = SubSectorStartBit_ + SubSectorNumBits_; + static constexpr unsigned int RollMask_ = 0X7; -public: - static constexpr uint32_t chamberIdMask_ = ~(RollMask_ << RollStartBit_); + public: + static constexpr uint32_t chamberIdMask_ = ~(RollMask_ << RollStartBit_); -private: - void init(int region, int ring, int station, int sector, int layer, int subsector, int roll); + private: + void init(int region, int ring, int station, int sector, int layer, int subsector, int roll); - int trind; -}; // RPCDetId + int trind; + }; // RPCDetId -std::ostream& operator<<(std::ostream& os, const RPCDetId& id); + std::ostream& operator<<(std::ostream& os, const RPCDetId& id); +} // namespace io_v1 +using RPCDetId = io_v1::RPCDetId; #endif diff --git a/DataFormats/MuonDetId/interface/RPCDetIdFwd.h b/DataFormats/MuonDetId/interface/RPCDetIdFwd.h index 6d443a0920b0c..296aaeddd618b 100644 --- a/DataFormats/MuonDetId/interface/RPCDetIdFwd.h +++ b/DataFormats/MuonDetId/interface/RPCDetIdFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_MuonDetId_RPCDetIdFwd_h #define DataFormats_MuonDetId_RPCDetIdFwd_h -class RPCDetId; - +namespace io_v1 { + class RPCDetId; +} +using RPCDetId = io_v1::RPCDetId; #endif diff --git a/DataFormats/MuonDetId/src/CSCDetId.cc b/DataFormats/MuonDetId/src/CSCDetId.cc index ec02ed72097c8..f56c6b775ddf2 100644 --- a/DataFormats/MuonDetId/src/CSCDetId.cc +++ b/DataFormats/MuonDetId/src/CSCDetId.cc @@ -93,10 +93,12 @@ std::string CSCDetId::chamberName() const { return chamberName(endcap(), station std::string CSCDetId::layerName() const { return layerName(endcap(), station(), ring(), chamber(), layer()); } -std::ostream& operator<<(std::ostream& os, const CSCDetId& id) { - // Note that there is no endl to end the output +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const CSCDetId& id) { + // Note that there is no endl to end the output - os << " E:" << id.endcap() << " S:" << id.station() << " R:" << id.ring() << " C:" << id.chamber() - << " L:" << id.layer(); - return os; -} + os << " E:" << id.endcap() << " S:" << id.station() << " R:" << id.ring() << " C:" << id.chamber() + << " L:" << id.layer(); + return os; + } +} // namespace io_v1 diff --git a/DataFormats/MuonDetId/src/DTChamberId.cc b/DataFormats/MuonDetId/src/DTChamberId.cc index 2371d3563e1df..31a43cb372572 100644 --- a/DataFormats/MuonDetId/src/DTChamberId.cc +++ b/DataFormats/MuonDetId/src/DTChamberId.cc @@ -45,8 +45,10 @@ void DTChamberId::checkMuonId() { } } -std::ostream& operator<<(std::ostream& os, const DTChamberId& id) { - os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " "; +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const DTChamberId& id) { + os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " "; - return os; -} + return os; + } +} // namespace io_v1 diff --git a/DataFormats/MuonDetId/src/DTLayerId.cc b/DataFormats/MuonDetId/src/DTLayerId.cc index 92a57b0ccd685..9a53370062030 100644 --- a/DataFormats/MuonDetId/src/DTLayerId.cc +++ b/DataFormats/MuonDetId/src/DTLayerId.cc @@ -57,9 +57,11 @@ DTLayerId::DTLayerId(int wheel, int station, int sector, int superlayer, int lay id_ |= (layer & lMask_) << layerStartBit_; } -std::ostream& operator<<(std::ostream& os, const DTLayerId& id) { - os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " Sl:" << id.superlayer() - << " La:" << id.layer() << " "; +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const DTLayerId& id) { + os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " Sl:" << id.superlayer() + << " La:" << id.layer() << " "; - return os; -} + return os; + } +} // namespace io_v1 diff --git a/DataFormats/MuonDetId/src/GEMDetId.cc b/DataFormats/MuonDetId/src/GEMDetId.cc index 5f8a01dddbc6c..7a87eef2ef4b2 100644 --- a/DataFormats/MuonDetId/src/GEMDetId.cc +++ b/DataFormats/MuonDetId/src/GEMDetId.cc @@ -12,9 +12,11 @@ bool GEMDetId::isGE21() const { return subsystem() == GEMSubDetId::Station::GE21 bool GEMDetId::isME0() const { return subsystem() == GEMSubDetId::Station::ME0; } -std::ostream& operator<<(std::ostream& os, const GEMDetId& id) { - os << " Re " << id.region() << " Ri " << id.ring() << " St " << id.station() << " La " << id.layer() << " Ch " - << id.chamber() << " Et " << id.roll() << " "; +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const GEMDetId& id) { + os << " Re " << id.region() << " Ri " << id.ring() << " St " << id.station() << " La " << id.layer() << " Ch " + << id.chamber() << " Et " << id.roll() << " "; - return os; -} + return os; + } +} // namespace io_v1 diff --git a/DataFormats/MuonDetId/src/RPCDetId.cc b/DataFormats/MuonDetId/src/RPCDetId.cc index 4169b594fcf74..29a26559eecfb 100644 --- a/DataFormats/MuonDetId/src/RPCDetId.cc +++ b/DataFormats/MuonDetId/src/RPCDetId.cc @@ -254,9 +254,11 @@ void RPCDetId::init(int region, int ring, int station, int sector, int layer, in (rollInBits & RollMask_) << RollStartBit_; } -std::ostream& operator<<(std::ostream& os, const RPCDetId& id) { - os << " Re " << id.region() << " Ri " << id.ring() << " St " << id.station() << " Se " << id.sector() << " La " - << id.layer() << " Su " << id.subsector() << " Ro " << id.roll() << " Tr " << id.trIndex() << " "; +namespace io_v1 { + std::ostream& operator<<(std::ostream& os, const RPCDetId& id) { + os << " Re " << id.region() << " Ri " << id.ring() << " St " << id.station() << " Se " << id.sector() << " La " + << id.layer() << " Su " << id.subsector() << " Ro " << id.roll() << " Tr " << id.trIndex() << " "; - return os; -} + return os; + } +} // namespace io_v1 diff --git a/DataFormats/MuonDetId/src/classes.h b/DataFormats/MuonDetId/src/classes.h index 2d818802e45db..10966063d2e3c 100644 --- a/DataFormats/MuonDetId/src/classes.h +++ b/DataFormats/MuonDetId/src/classes.h @@ -12,3 +12,4 @@ #include "DataFormats/MuonDetId/interface/GEMDetId.h" #include "DataFormats/MuonDetId/interface/ME0DetId.h" #include "DataFormats/MuonDetId/interface/GEMSubDetId.h" +#include diff --git a/DataFormats/MuonDetId/src/classes_def.xml b/DataFormats/MuonDetId/src/classes_def.xml index 1300b8be38dc7..a48adac4b808b 100644 --- a/DataFormats/MuonDetId/src/classes_def.xml +++ b/DataFormats/MuonDetId/src/classes_def.xml @@ -1,59 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rawId())); - *newObj=tmp; - ]]> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + diff --git a/DataFormats/MuonReco/interface/CaloMuon.h b/DataFormats/MuonReco/interface/CaloMuon.h index feaaad7c5ec4f..2f3526da66953 100644 --- a/DataFormats/MuonReco/interface/CaloMuon.h +++ b/DataFormats/MuonReco/interface/CaloMuon.h @@ -17,63 +17,67 @@ #include "DataFormats/TrackReco/interface/Track.h" namespace reco { + namespace io_v1 { - class CaloMuon { - public: - CaloMuon(); - virtual ~CaloMuon() {} + class CaloMuon { + public: + CaloMuon(); + virtual ~CaloMuon() {} - /// reference to Track reconstructed in the tracker only - virtual TrackRef innerTrack() const { return innerTrack_; } - virtual TrackRef track() const { return innerTrack(); } - /// set reference to Track - virtual void setInnerTrack(const TrackRef& t) { innerTrack_ = t; } - virtual void setTrack(const TrackRef& t) { setInnerTrack(t); } - /// energy deposition - bool isEnergyValid() const { return energyValid_; } - /// get energy deposition information - MuonEnergy calEnergy() const { return calEnergy_; } - /// set energy deposition information - void setCalEnergy(const MuonEnergy& calEnergy) { - calEnergy_ = calEnergy; - energyValid_ = true; - } + /// reference to Track reconstructed in the tracker only + virtual TrackRef innerTrack() const { return innerTrack_; } + virtual TrackRef track() const { return innerTrack(); } + /// set reference to Track + virtual void setInnerTrack(const TrackRef& t) { innerTrack_ = t; } + virtual void setTrack(const TrackRef& t) { setInnerTrack(t); } + /// energy deposition + bool isEnergyValid() const { return energyValid_; } + /// get energy deposition information + MuonEnergy calEnergy() const { return calEnergy_; } + /// set energy deposition information + void setCalEnergy(const MuonEnergy& calEnergy) { + calEnergy_ = calEnergy; + energyValid_ = true; + } - /// Muon hypothesis compatibility block - /// Relative likelihood based on ECAL, HCAL, HO energy defined as - /// L_muon/(L_muon+L_not_muon) - float caloCompatibility() const { return caloCompatibility_; } - void setCaloCompatibility(float input) { caloCompatibility_ = input; } - bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } + /// Muon hypothesis compatibility block + /// Relative likelihood based on ECAL, HCAL, HO energy defined as + /// L_muon/(L_muon+L_not_muon) + float caloCompatibility() const { return caloCompatibility_; } + void setCaloCompatibility(float input) { caloCompatibility_ = input; } + bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } - /// a bunch of useful accessors - int charge() const { return innerTrack_.get()->charge(); } - /// polar angle - double theta() const { return innerTrack_.get()->theta(); } - /// momentum vector magnitude - double p() const { return innerTrack_.get()->p(); } - /// track transverse momentum - double pt() const { return innerTrack_.get()->pt(); } - /// x coordinate of momentum vector - double px() const { return innerTrack_.get()->px(); } - /// y coordinate of momentum vector - double py() const { return innerTrack_.get()->py(); } - /// z coordinate of momentum vector - double pz() const { return innerTrack_.get()->pz(); } - /// azimuthal angle of momentum vector - double phi() const { return innerTrack_.get()->phi(); } - /// pseudorapidity of momentum vector - double eta() const { return innerTrack_.get()->eta(); } + /// a bunch of useful accessors + int charge() const { return innerTrack_.get()->charge(); } + /// polar angle + double theta() const { return innerTrack_.get()->theta(); } + /// momentum vector magnitude + double p() const { return innerTrack_.get()->p(); } + /// track transverse momentum + double pt() const { return innerTrack_.get()->pt(); } + /// x coordinate of momentum vector + double px() const { return innerTrack_.get()->px(); } + /// y coordinate of momentum vector + double py() const { return innerTrack_.get()->py(); } + /// z coordinate of momentum vector + double pz() const { return innerTrack_.get()->pz(); } + /// azimuthal angle of momentum vector + double phi() const { return innerTrack_.get()->phi(); } + /// pseudorapidity of momentum vector + double eta() const { return innerTrack_.get()->eta(); } - private: - /// reference to Track reconstructed in the tracker only - TrackRef innerTrack_; - /// energy deposition - MuonEnergy calEnergy_; - bool energyValid_; - /// muon hypothesis compatibility with observer calorimeter energy - float caloCompatibility_; - }; + private: + /// reference to Track reconstructed in the tracker only + TrackRef innerTrack_; + /// energy deposition + MuonEnergy calEnergy_; + bool energyValid_; + /// muon hypothesis compatibility with observer calorimeter energy + float caloCompatibility_; + }; + + } // namespace io_v1 + using CaloMuon = io_v1::CaloMuon; } // namespace reco diff --git a/DataFormats/MuonReco/interface/Muon.h b/DataFormats/MuonReco/interface/Muon.h index c0b70c30b14e8..7e0ec19e5cedf 100644 --- a/DataFormats/MuonReco/interface/Muon.h +++ b/DataFormats/MuonReco/interface/Muon.h @@ -23,420 +23,423 @@ #include "DataFormats/TrackReco/interface/Track.h" namespace reco { + namespace io_v1 { + + class Muon : public RecoCandidate { + public: + Muon(); + /// constructor from values + Muon(Charge, const LorentzVector&, const Point& = Point(0, 0, 0)); + /// create a clone + Muon* clone() const override; + + /// map for Global Muon refitters + enum MuonTrackType { None, InnerTrack, OuterTrack, CombinedTrack, TPFMS, Picky, DYT }; + typedef std::map MuonTrackRefMap; + typedef std::pair MuonTrackTypePair; + + /// + /// ====================== TRACK BLOCK =========================== + /// + /// reference to Track reconstructed in the tracker only + using reco::RecoCandidate::track; + virtual TrackRef innerTrack() const { return innerTrack_; } + TrackRef track() const override { return innerTrack(); } + /// reference to Track reconstructed in the muon detector only + virtual TrackRef outerTrack() const { return outerTrack_; } + TrackRef standAloneMuon() const override { return outerTrack(); } + /// reference to Track reconstructed in both tracked and muon detector + virtual TrackRef globalTrack() const { return globalTrack_; } + TrackRef combinedMuon() const override { return globalTrack(); } + + virtual TrackRef tpfmsTrack() const { return muonTrackFromMap(TPFMS); } + virtual TrackRef pickyTrack() const { return muonTrackFromMap(Picky); } + virtual TrackRef dytTrack() const { return muonTrackFromMap(DYT); } + + const Track* bestTrack() const override { return muonTrack(bestTrackType_).get(); } + TrackBaseRef bestTrackRef() const override { return reco::TrackBaseRef(muonTrack(bestTrackType_)); } + virtual TrackRef muonBestTrack() const { return muonTrack(bestTrackType_); } + virtual MuonTrackType muonBestTrackType() const { return bestTrackType_; } + virtual TrackRef tunePMuonBestTrack() const { return muonTrack(bestTunePTrackType_); } + virtual MuonTrackType tunePMuonBestTrackType() const { return bestTunePTrackType_; } + + bool isAValidMuonTrack(const MuonTrackType& type) const; + TrackRef muonTrack(const MuonTrackType&) const; + + TrackRef muonTrackFromMap(const MuonTrackType& type) const { + MuonTrackRefMap::const_iterator iter = refittedTrackMap_.find(type); + if (iter != refittedTrackMap_.end()) + return iter->second; + else + return TrackRef(); + } - class Muon : public RecoCandidate { - public: - Muon(); - /// constructor from values - Muon(Charge, const LorentzVector&, const Point& = Point(0, 0, 0)); - /// create a clone - Muon* clone() const override; - - /// map for Global Muon refitters - enum MuonTrackType { None, InnerTrack, OuterTrack, CombinedTrack, TPFMS, Picky, DYT }; - typedef std::map MuonTrackRefMap; - typedef std::pair MuonTrackTypePair; - - /// - /// ====================== TRACK BLOCK =========================== - /// - /// reference to Track reconstructed in the tracker only - using reco::RecoCandidate::track; - virtual TrackRef innerTrack() const { return innerTrack_; } - TrackRef track() const override { return innerTrack(); } - /// reference to Track reconstructed in the muon detector only - virtual TrackRef outerTrack() const { return outerTrack_; } - TrackRef standAloneMuon() const override { return outerTrack(); } - /// reference to Track reconstructed in both tracked and muon detector - virtual TrackRef globalTrack() const { return globalTrack_; } - TrackRef combinedMuon() const override { return globalTrack(); } - - virtual TrackRef tpfmsTrack() const { return muonTrackFromMap(TPFMS); } - virtual TrackRef pickyTrack() const { return muonTrackFromMap(Picky); } - virtual TrackRef dytTrack() const { return muonTrackFromMap(DYT); } - - const Track* bestTrack() const override { return muonTrack(bestTrackType_).get(); } - TrackBaseRef bestTrackRef() const override { return reco::TrackBaseRef(muonTrack(bestTrackType_)); } - virtual TrackRef muonBestTrack() const { return muonTrack(bestTrackType_); } - virtual MuonTrackType muonBestTrackType() const { return bestTrackType_; } - virtual TrackRef tunePMuonBestTrack() const { return muonTrack(bestTunePTrackType_); } - virtual MuonTrackType tunePMuonBestTrackType() const { return bestTunePTrackType_; } - - bool isAValidMuonTrack(const MuonTrackType& type) const; - TrackRef muonTrack(const MuonTrackType&) const; - - TrackRef muonTrackFromMap(const MuonTrackType& type) const { - MuonTrackRefMap::const_iterator iter = refittedTrackMap_.find(type); - if (iter != refittedTrackMap_.end()) - return iter->second; - else - return TrackRef(); - } - - /// set reference to Track - virtual void setInnerTrack(const TrackRef& t); - virtual void setTrack(const TrackRef& t); - /// set reference to Track - virtual void setOuterTrack(const TrackRef& t); - virtual void setStandAlone(const TrackRef& t); - /// set reference to Track - virtual void setGlobalTrack(const TrackRef& t); - virtual void setCombined(const TrackRef& t); - // set reference to the Best Track - virtual void setBestTrack(MuonTrackType muonType) { bestTrackType_ = muonType; } - // set reference to the Best Track by PF - virtual void setTunePBestTrack(MuonTrackType muonType) { bestTunePTrackType_ = muonType; } - - void setMuonTrack(const MuonTrackType&, const TrackRef&); - - ///set reference to PFCandidate - /// - /// ====================== PF BLOCK =========================== - /// - - reco::Candidate::LorentzVector pfP4() const { return pfP4_; } - virtual void setPFP4(const reco::Candidate::LorentzVector& p4_); - - /// - /// ====================== ENERGY BLOCK =========================== - /// - /// energy deposition - bool isEnergyValid() const { return energyValid_; } - /// get energy deposition information - MuonEnergy calEnergy() const { return calEnergy_; } - /// set energy deposition information - void setCalEnergy(const MuonEnergy& calEnergy) { - calEnergy_ = calEnergy; - energyValid_ = true; - } - - /// - /// ====================== Quality BLOCK =========================== - /// - /// energy deposition - bool isQualityValid() const { return qualityValid_; } - /// get energy deposition information - MuonQuality combinedQuality() const { return combinedQuality_; } - /// set energy deposition information - void setCombinedQuality(const MuonQuality& combinedQuality) { - combinedQuality_ = combinedQuality; - qualityValid_ = true; - } - - /// - /// ====================== TIMING BLOCK =========================== - /// - /// timing information - bool isTimeValid() const { return (time_.nDof > 0); } - /// get DT/CSC combined timing information - MuonTime time() const { return time_; } - /// set DT/CSC combined timing information - void setTime(const MuonTime& time) { time_ = time; } - /// get RPC timing information - MuonTime rpcTime() const { return rpcTime_; } - /// set RPC timing information - void setRPCTime(const MuonTime& time) { rpcTime_ = time; } - - /// - /// ====================== MUON MATCH BLOCK =========================== - /// - bool isMatchesValid() const { return matchesValid_; } - /// get muon matching information - std::vector& matches() { return muMatches_; } - const std::vector& matches() const { return muMatches_; } - /// set muon matching information - void setMatches(const std::vector& matches) { - muMatches_ = matches; - matchesValid_ = true; - } - - /// - /// ====================== MUON COMPATIBILITY BLOCK =========================== - /// - /// Relative likelihood based on ECAL, HCAL, HO energy defined as - /// L_muon/(L_muon+L_not_muon) - float caloCompatibility() const { return caloCompatibility_; } - void setCaloCompatibility(float input) { caloCompatibility_ = input; } - bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } - - /// - /// ====================== ISOLATION BLOCK =========================== - /// - /// Summary of muon isolation information - const MuonIsolation& isolationR03() const { return isolationR03_; } - const MuonIsolation& isolationR05() const { return isolationR05_; } - - const MuonPFIsolation& pfIsolationR03() const { return pfIsolationR03_; } - const MuonPFIsolation& pfMeanDRIsoProfileR03() const { return pfIsoMeanDRR03_; } - const MuonPFIsolation& pfSumDRIsoProfileR03() const { return pfIsoSumDRR03_; } - const MuonPFIsolation& pfIsolationR04() const { return pfIsolationR04_; } - const MuonPFIsolation& pfMeanDRIsoProfileR04() const { return pfIsoMeanDRR04_; } - const MuonPFIsolation& pfSumDRIsoProfileR04() const { return pfIsoSumDRR04_; } - - void setIsolation(const MuonIsolation& isoR03, const MuonIsolation& isoR05); - bool isIsolationValid() const { return isolationValid_; } - void setPFIsolation(const std::string& label, const reco::MuonPFIsolation& deposit); - - bool isPFIsolationValid() const { return pfIsolationValid_; } - - /// define arbitration schemes - // WARNING: There can be not more than 7 arbritration types. If - // have more it will break the matching logic for types - // defined in MuonSegmentMatch - - enum ArbitrationType { - NoArbitration, - SegmentArbitration, - SegmentAndTrackArbitration, - SegmentAndTrackArbitrationCleaned, - RPCHitAndTrackArbitration, - GEMSegmentAndTrackArbitration, - ME0SegmentAndTrackArbitration, - GEMHitAndTrackArbitration - }; + /// set reference to Track + virtual void setInnerTrack(const TrackRef& t); + virtual void setTrack(const TrackRef& t); + /// set reference to Track + virtual void setOuterTrack(const TrackRef& t); + virtual void setStandAlone(const TrackRef& t); + /// set reference to Track + virtual void setGlobalTrack(const TrackRef& t); + virtual void setCombined(const TrackRef& t); + // set reference to the Best Track + virtual void setBestTrack(MuonTrackType muonType) { bestTrackType_ = muonType; } + // set reference to the Best Track by PF + virtual void setTunePBestTrack(MuonTrackType muonType) { bestTunePTrackType_ = muonType; } + + void setMuonTrack(const MuonTrackType&, const TrackRef&); + + ///set reference to PFCandidate + /// + /// ====================== PF BLOCK =========================== + /// + + reco::Candidate::LorentzVector pfP4() const { return pfP4_; } + virtual void setPFP4(const reco::Candidate::LorentzVector& p4_); + + /// + /// ====================== ENERGY BLOCK =========================== + /// + /// energy deposition + bool isEnergyValid() const { return energyValid_; } + /// get energy deposition information + MuonEnergy calEnergy() const { return calEnergy_; } + /// set energy deposition information + void setCalEnergy(const MuonEnergy& calEnergy) { + calEnergy_ = calEnergy; + energyValid_ = true; + } - /// - /// ====================== STANDARD SELECTORS =========================== - /// - // When adding new selectors, also update DataFormats/MuonReco/interface/MuonSelectors.h string to enum map - enum Selector { - CutBasedIdLoose = 0, - CutBasedIdMedium = 1, - CutBasedIdMediumPrompt = 2, // medium with IP cuts - CutBasedIdTight = 3, - CutBasedIdGlobalHighPt = 4, // high pt muon for Z',W' (better momentum resolution) - CutBasedIdTrkHighPt = 5, // high pt muon for boosted Z (better efficiency) - PFIsoVeryLoose = 6, // reliso<0.40 - PFIsoLoose = 7, // reliso<0.25 - PFIsoMedium = 8, // reliso<0.20 - PFIsoTight = 9, // reliso<0.15 - PFIsoVeryTight = 10, // reliso<0.10 - TkIsoLoose = 11, // reliso<0.10 - TkIsoTight = 12, // reliso<0.05 - SoftCutBasedId = 13, - SoftMvaId = 14, - MvaLoose = 15, - MvaMedium = 16, - MvaTight = 17, - MiniIsoLoose = 18, // reliso<0.40 - MiniIsoMedium = 19, // reliso<0.20 - MiniIsoTight = 20, // reliso<0.10 - MiniIsoVeryTight = 21, // reliso<0.05 - TriggerIdLoose = 22, // robust selector for HLT - InTimeMuon = 23, - PFIsoVeryVeryTight = 24, // reliso<0.05 - MultiIsoLoose = 25, // miniIso with ptRatio and ptRel - MultiIsoMedium = 26, // miniIso with ptRatio and ptRel - PuppiIsoLoose = 27, - PuppiIsoMedium = 28, - PuppiIsoTight = 29, - MvaVTight = 30, - MvaVVTight = 31, - LowPtMvaLoose = 32, - LowPtMvaMedium = 33, - MvaIDwpMedium = 34, - MvaIDwpTight = 35, - }; + /// + /// ====================== Quality BLOCK =========================== + /// + /// energy deposition + bool isQualityValid() const { return qualityValid_; } + /// get energy deposition information + MuonQuality combinedQuality() const { return combinedQuality_; } + /// set energy deposition information + void setCombinedQuality(const MuonQuality& combinedQuality) { + combinedQuality_ = combinedQuality; + qualityValid_ = true; + } - bool passed(uint64_t selection) const { return (selectors_ & selection) == selection; } - bool passed(Selector selection) const { return passed(static_cast(1UL << selection)); } - uint64_t selectors() const { return selectors_; } - void setSelectors(uint64_t selectors) { selectors_ = selectors; } - void setSelector(Selector selector, bool passed) { - auto selector64 = 1UL << selector; - if (passed) - selectors_ |= selector64; - else - selectors_ &= ~selector64; - } - - /// - /// ====================== USEFUL METHODs =========================== - /// - /// number of chambers (MuonChamberMatches include RPC rolls, GEM and ME0 segments) - int numberOfChambers() const { return muMatches_.size(); } - /// number of chambers CSC or DT matches only (MuonChamberMatches include RPC rolls) - int numberOfChambersCSCorDT() const; - /// get number of chambers with matched segments - int numberOfMatches(ArbitrationType type = SegmentAndTrackArbitration) const; - /// get number of stations with matched segments - /// just adds the bits returned by stationMask - int numberOfMatchedStations(ArbitrationType type = SegmentAndTrackArbitration) const; - /// expected number of stations with matching segments based on the absolute - /// distance from the edge of a chamber - unsigned int expectedNnumberOfMatchedStations(float minDistanceFromEdge = 10.0) const; - /// get bit map of stations with matched segments - /// bits 0-1-2-3 = DT stations 1-2-3-4 - /// bits 4-5-6-7 = CSC stations 1-2-3-4 - unsigned int stationMask(ArbitrationType type = SegmentAndTrackArbitration) const; - /// get bit map of stations with tracks within - /// given distance (in cm) of chamber edges - /// bit assignments are same as above - int numberOfMatchedRPCLayers(ArbitrationType type = RPCHitAndTrackArbitration) const; - unsigned int RPClayerMask(ArbitrationType type = RPCHitAndTrackArbitration) const; - unsigned int stationGapMaskDistance(float distanceCut = 10.) const; - /// same as above for given number of sigmas - unsigned int stationGapMaskPull(float sigmaCut = 3.) const; - /// # of digis in a given station layer - int nDigisInStation(int station, int muonSubdetId) const; - /// tag a shower in a given station layer - bool hasShowerInStation(int station, int muonSubdetId, int nDtDigisCut = 20, int nCscDigisCut = 36) const; - /// count the number of showers along a muon track - int numberOfShowers(int nDtDigisCut = 20, int nCscDigisCut = 36) const; - - /// muon type - type of the algorithm that reconstructed this muon - /// multiple algorithms can reconstruct the same muon - static const unsigned int GlobalMuon = 1 << 1; - static const unsigned int TrackerMuon = 1 << 2; - static const unsigned int StandAloneMuon = 1 << 3; - static const unsigned int CaloMuon = 1 << 4; - static const unsigned int PFMuon = 1 << 5; - static const unsigned int RPCMuon = 1 << 6; - static const unsigned int GEMMuon = 1 << 7; - static const unsigned int ME0Muon = 1 << 8; - static const unsigned int ScoutingMuon = 1 << 9; - - void setType(unsigned int type) { type_ = type; } - unsigned int type() const { return type_; } - - // override of method in base class reco::Candidate - bool isMuon() const override { return true; } - bool isGlobalMuon() const override { return type_ & GlobalMuon; } - bool isTrackerMuon() const override { return type_ & TrackerMuon; } - bool isStandAloneMuon() const override { return type_ & StandAloneMuon; } - bool isCaloMuon() const override { return type_ & CaloMuon; } - bool isPFMuon() const { return type_ & PFMuon; } //fix me ! Has to go to type - bool isRPCMuon() const { return type_ & RPCMuon; } - bool isGEMMuon() const { return type_ & GEMMuon; } - bool isME0Muon() const { return type_ & ME0Muon; } - bool isScoutingMuon() const { return type_ & ScoutingMuon; } - - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to Track reconstructed in the tracker only - TrackRef innerTrack_; - /// reference to Track reconstructed in the muon detector only - TrackRef outerTrack_; - /// reference to Track reconstructed in both tracked and muon detector - TrackRef globalTrack_; - /// reference to the Global Track refitted with dedicated TeV reconstructors - MuonTrackRefMap refittedTrackMap_; - /// reference to the Track chosen to assign the momentum value to the muon - MuonTrackType bestTrackType_; - /// reference to the Track chosen to assign the momentum value to the muon by PF - MuonTrackType bestTunePTrackType_; - - /// energy deposition - MuonEnergy calEnergy_; - /// quality block - MuonQuality combinedQuality_; - /// Information on matching between tracks and segments - std::vector muMatches_; - /// timing - MuonTime time_; - MuonTime rpcTime_; - bool energyValid_; - bool matchesValid_; - bool isolationValid_; - bool pfIsolationValid_; - bool qualityValid_; - /// muon hypothesis compatibility with observer calorimeter energy - float caloCompatibility_; - /// Isolation information for two cones with dR=0.3 and dR=0.5 - MuonIsolation isolationR03_; - MuonIsolation isolationR05_; - - /// PF Isolation information for two cones with dR=0.3 and dR=0.4 - MuonPFIsolation pfIsolationR03_; - MuonPFIsolation pfIsoMeanDRR03_; - MuonPFIsolation pfIsoSumDRR03_; - MuonPFIsolation pfIsolationR04_; - MuonPFIsolation pfIsoMeanDRR04_; - MuonPFIsolation pfIsoSumDRR04_; - - /// muon type mask - unsigned int type_; - - //PF muon p4 - reco::Candidate::LorentzVector pfP4_; - - // FixMe: Still missing trigger information - - /// get vector of muon chambers for given station and detector - const std::vector chambers(int station, int muonSubdetId) const; - /// get pointers to best segment and corresponding chamber in vector of chambers - std::pair pair( - const std::vector&, ArbitrationType type = SegmentAndTrackArbitration) const; - /// selector bitmap - uint64_t selectors_; - - public: - /// get number of segments - int numberOfSegments(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - /// get deltas between (best) segment and track - /// If no chamber or no segment returns 999999 - float dX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float dY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float dDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float dDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float pullX(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - float pullY(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - float pullDxDz(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - float pullDyDz(int station, - int muonSubdetId, - ArbitrationType type = SegmentAndTrackArbitration, - bool includeSegmentError = true) const; - /// get (best) segment information - /// If no segment returns 999999 - float segmentX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float segmentDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - /// get track information in chamber that contains (best) segment - /// If no segment, get track information in chamber that has the most negative distance between the track - /// and the nearest chamber edge (the chamber with the deepest track) - /// If no chamber returns 999999 - float trackEdgeX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackEdgeY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDist(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - float trackDistErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; - - float t0(int n = 0) { - int i = 0; - for (auto& chamber : muMatches_) { - int segmentMatchesSize = (int)chamber.segmentMatches.size(); - if (i + segmentMatchesSize < n) { - i += segmentMatchesSize; - continue; + /// + /// ====================== TIMING BLOCK =========================== + /// + /// timing information + bool isTimeValid() const { return (time_.nDof > 0); } + /// get DT/CSC combined timing information + MuonTime time() const { return time_; } + /// set DT/CSC combined timing information + void setTime(const MuonTime& time) { time_ = time; } + /// get RPC timing information + MuonTime rpcTime() const { return rpcTime_; } + /// set RPC timing information + void setRPCTime(const MuonTime& time) { rpcTime_ = time; } + + /// + /// ====================== MUON MATCH BLOCK =========================== + /// + bool isMatchesValid() const { return matchesValid_; } + /// get muon matching information + std::vector& matches() { return muMatches_; } + const std::vector& matches() const { return muMatches_; } + /// set muon matching information + void setMatches(const std::vector& matches) { + muMatches_ = matches; + matchesValid_ = true; + } + + /// + /// ====================== MUON COMPATIBILITY BLOCK =========================== + /// + /// Relative likelihood based on ECAL, HCAL, HO energy defined as + /// L_muon/(L_muon+L_not_muon) + float caloCompatibility() const { return caloCompatibility_; } + void setCaloCompatibility(float input) { caloCompatibility_ = input; } + bool isCaloCompatibilityValid() const { return caloCompatibility_ >= 0; } + + /// + /// ====================== ISOLATION BLOCK =========================== + /// + /// Summary of muon isolation information + const MuonIsolation& isolationR03() const { return isolationR03_; } + const MuonIsolation& isolationR05() const { return isolationR05_; } + + const MuonPFIsolation& pfIsolationR03() const { return pfIsolationR03_; } + const MuonPFIsolation& pfMeanDRIsoProfileR03() const { return pfIsoMeanDRR03_; } + const MuonPFIsolation& pfSumDRIsoProfileR03() const { return pfIsoSumDRR03_; } + const MuonPFIsolation& pfIsolationR04() const { return pfIsolationR04_; } + const MuonPFIsolation& pfMeanDRIsoProfileR04() const { return pfIsoMeanDRR04_; } + const MuonPFIsolation& pfSumDRIsoProfileR04() const { return pfIsoSumDRR04_; } + + void setIsolation(const MuonIsolation& isoR03, const MuonIsolation& isoR05); + bool isIsolationValid() const { return isolationValid_; } + void setPFIsolation(const std::string& label, const reco::MuonPFIsolation& deposit); + + bool isPFIsolationValid() const { return pfIsolationValid_; } + + /// define arbitration schemes + // WARNING: There can be not more than 7 arbritration types. If + // have more it will break the matching logic for types + // defined in MuonSegmentMatch + + enum ArbitrationType { + NoArbitration, + SegmentArbitration, + SegmentAndTrackArbitration, + SegmentAndTrackArbitrationCleaned, + RPCHitAndTrackArbitration, + GEMSegmentAndTrackArbitration, + ME0SegmentAndTrackArbitration, + GEMHitAndTrackArbitration + }; + + /// + /// ====================== STANDARD SELECTORS =========================== + /// + // When adding new selectors, also update DataFormats/MuonReco/interface/MuonSelectors.h string to enum map + enum Selector { + CutBasedIdLoose = 0, + CutBasedIdMedium = 1, + CutBasedIdMediumPrompt = 2, // medium with IP cuts + CutBasedIdTight = 3, + CutBasedIdGlobalHighPt = 4, // high pt muon for Z',W' (better momentum resolution) + CutBasedIdTrkHighPt = 5, // high pt muon for boosted Z (better efficiency) + PFIsoVeryLoose = 6, // reliso<0.40 + PFIsoLoose = 7, // reliso<0.25 + PFIsoMedium = 8, // reliso<0.20 + PFIsoTight = 9, // reliso<0.15 + PFIsoVeryTight = 10, // reliso<0.10 + TkIsoLoose = 11, // reliso<0.10 + TkIsoTight = 12, // reliso<0.05 + SoftCutBasedId = 13, + SoftMvaId = 14, + MvaLoose = 15, + MvaMedium = 16, + MvaTight = 17, + MiniIsoLoose = 18, // reliso<0.40 + MiniIsoMedium = 19, // reliso<0.20 + MiniIsoTight = 20, // reliso<0.10 + MiniIsoVeryTight = 21, // reliso<0.05 + TriggerIdLoose = 22, // robust selector for HLT + InTimeMuon = 23, + PFIsoVeryVeryTight = 24, // reliso<0.05 + MultiIsoLoose = 25, // miniIso with ptRatio and ptRel + MultiIsoMedium = 26, // miniIso with ptRatio and ptRel + PuppiIsoLoose = 27, + PuppiIsoMedium = 28, + PuppiIsoTight = 29, + MvaVTight = 30, + MvaVVTight = 31, + LowPtMvaLoose = 32, + LowPtMvaMedium = 33, + MvaIDwpMedium = 34, + MvaIDwpTight = 35, + }; + + bool passed(uint64_t selection) const { return (selectors_ & selection) == selection; } + bool passed(Selector selection) const { return passed(static_cast(1UL << selection)); } + uint64_t selectors() const { return selectors_; } + void setSelectors(uint64_t selectors) { selectors_ = selectors; } + void setSelector(Selector selector, bool passed) { + auto selector64 = 1UL << selector; + if (passed) + selectors_ |= selector64; + else + selectors_ &= ~selector64; + } + + /// + /// ====================== USEFUL METHODs =========================== + /// + /// number of chambers (MuonChamberMatches include RPC rolls, GEM and ME0 segments) + int numberOfChambers() const { return muMatches_.size(); } + /// number of chambers CSC or DT matches only (MuonChamberMatches include RPC rolls) + int numberOfChambersCSCorDT() const; + /// get number of chambers with matched segments + int numberOfMatches(ArbitrationType type = SegmentAndTrackArbitration) const; + /// get number of stations with matched segments + /// just adds the bits returned by stationMask + int numberOfMatchedStations(ArbitrationType type = SegmentAndTrackArbitration) const; + /// expected number of stations with matching segments based on the absolute + /// distance from the edge of a chamber + unsigned int expectedNnumberOfMatchedStations(float minDistanceFromEdge = 10.0) const; + /// get bit map of stations with matched segments + /// bits 0-1-2-3 = DT stations 1-2-3-4 + /// bits 4-5-6-7 = CSC stations 1-2-3-4 + unsigned int stationMask(ArbitrationType type = SegmentAndTrackArbitration) const; + /// get bit map of stations with tracks within + /// given distance (in cm) of chamber edges + /// bit assignments are same as above + int numberOfMatchedRPCLayers(ArbitrationType type = RPCHitAndTrackArbitration) const; + unsigned int RPClayerMask(ArbitrationType type = RPCHitAndTrackArbitration) const; + unsigned int stationGapMaskDistance(float distanceCut = 10.) const; + /// same as above for given number of sigmas + unsigned int stationGapMaskPull(float sigmaCut = 3.) const; + /// # of digis in a given station layer + int nDigisInStation(int station, int muonSubdetId) const; + /// tag a shower in a given station layer + bool hasShowerInStation(int station, int muonSubdetId, int nDtDigisCut = 20, int nCscDigisCut = 36) const; + /// count the number of showers along a muon track + int numberOfShowers(int nDtDigisCut = 20, int nCscDigisCut = 36) const; + + /// muon type - type of the algorithm that reconstructed this muon + /// multiple algorithms can reconstruct the same muon + static const unsigned int GlobalMuon = 1 << 1; + static const unsigned int TrackerMuon = 1 << 2; + static const unsigned int StandAloneMuon = 1 << 3; + static const unsigned int CaloMuon = 1 << 4; + static const unsigned int PFMuon = 1 << 5; + static const unsigned int RPCMuon = 1 << 6; + static const unsigned int GEMMuon = 1 << 7; + static const unsigned int ME0Muon = 1 << 8; + static const unsigned int ScoutingMuon = 1 << 9; + + void setType(unsigned int type) { type_ = type; } + unsigned int type() const { return type_; } + + // override of method in base class reco::Candidate + bool isMuon() const override { return true; } + bool isGlobalMuon() const override { return type_ & GlobalMuon; } + bool isTrackerMuon() const override { return type_ & TrackerMuon; } + bool isStandAloneMuon() const override { return type_ & StandAloneMuon; } + bool isCaloMuon() const override { return type_ & CaloMuon; } + bool isPFMuon() const { return type_ & PFMuon; } //fix me ! Has to go to type + bool isRPCMuon() const { return type_ & RPCMuon; } + bool isGEMMuon() const { return type_ & GEMMuon; } + bool isME0Muon() const { return type_ & ME0Muon; } + bool isScoutingMuon() const { return type_ & ScoutingMuon; } + + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to Track reconstructed in the tracker only + TrackRef innerTrack_; + /// reference to Track reconstructed in the muon detector only + TrackRef outerTrack_; + /// reference to Track reconstructed in both tracked and muon detector + TrackRef globalTrack_; + /// reference to the Global Track refitted with dedicated TeV reconstructors + MuonTrackRefMap refittedTrackMap_; + /// reference to the Track chosen to assign the momentum value to the muon + MuonTrackType bestTrackType_; + /// reference to the Track chosen to assign the momentum value to the muon by PF + MuonTrackType bestTunePTrackType_; + + /// energy deposition + MuonEnergy calEnergy_; + /// quality block + MuonQuality combinedQuality_; + /// Information on matching between tracks and segments + std::vector muMatches_; + /// timing + MuonTime time_; + MuonTime rpcTime_; + bool energyValid_; + bool matchesValid_; + bool isolationValid_; + bool pfIsolationValid_; + bool qualityValid_; + /// muon hypothesis compatibility with observer calorimeter energy + float caloCompatibility_; + /// Isolation information for two cones with dR=0.3 and dR=0.5 + MuonIsolation isolationR03_; + MuonIsolation isolationR05_; + + /// PF Isolation information for two cones with dR=0.3 and dR=0.4 + MuonPFIsolation pfIsolationR03_; + MuonPFIsolation pfIsoMeanDRR03_; + MuonPFIsolation pfIsoSumDRR03_; + MuonPFIsolation pfIsolationR04_; + MuonPFIsolation pfIsoMeanDRR04_; + MuonPFIsolation pfIsoSumDRR04_; + + /// muon type mask + unsigned int type_; + + //PF muon p4 + reco::Candidate::LorentzVector pfP4_; + + // FixMe: Still missing trigger information + + /// get vector of muon chambers for given station and detector + const std::vector chambers(int station, int muonSubdetId) const; + /// get pointers to best segment and corresponding chamber in vector of chambers + std::pair pair( + const std::vector&, ArbitrationType type = SegmentAndTrackArbitration) const; + /// selector bitmap + uint64_t selectors_; + + public: + /// get number of segments + int numberOfSegments(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + /// get deltas between (best) segment and track + /// If no chamber or no segment returns 999999 + float dX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float dY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float dDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float dDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float pullX(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + float pullY(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + float pullDxDz(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + float pullDyDz(int station, + int muonSubdetId, + ArbitrationType type = SegmentAndTrackArbitration, + bool includeSegmentError = true) const; + /// get (best) segment information + /// If no segment returns 999999 + float segmentX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float segmentDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + /// get track information in chamber that contains (best) segment + /// If no segment, get track information in chamber that has the most negative distance between the track + /// and the nearest chamber edge (the chamber with the deepest track) + /// If no chamber returns 999999 + float trackEdgeX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackEdgeY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackX(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackY(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDxDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDyDz(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackXErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackYErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDxDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDyDzErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDist(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + float trackDistErr(int station, int muonSubdetId, ArbitrationType type = SegmentAndTrackArbitration) const; + + float t0(int n = 0) { + int i = 0; + for (auto& chamber : muMatches_) { + int segmentMatchesSize = (int)chamber.segmentMatches.size(); + if (i + segmentMatchesSize < n) { + i += segmentMatchesSize; + continue; + } + return chamber.segmentMatches[n - i].t0; } - return chamber.segmentMatches[n - i].t0; + return 0; } - return 0; - } - }; + }; + } // namespace io_v1 + using Muon = io_v1::Muon; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonChamberMatch.h b/DataFormats/MuonReco/interface/MuonChamberMatch.h index a25677889d0f4..84075633f06ad 100644 --- a/DataFormats/MuonReco/interface/MuonChamberMatch.h +++ b/DataFormats/MuonReco/interface/MuonChamberMatch.h @@ -8,37 +8,42 @@ #include namespace reco { - class MuonChamberMatch { - public: - std::vector segmentMatches; // segments matching propagated track trajectory - std::vector gemMatches; // segments matching propagated track trajectory - std::vector gemHitMatches; // segments matching propagated track trajectory - std::vector me0Matches; // segments matching propagated track trajectory - std::vector truthMatches; // SimHit projection matching propagated track trajectory - std::vector rpcMatches; // rpc hits matching propagated track trajectory - float edgeX; // distance to closest edge in X (negative - inside, positive - outside) - float edgeY; // distance to closest edge in Y (negative - inside, positive - outside) - float x; // X position of the track - float y; // Y position of the track - float xErr; // propagation uncertainty in X - float yErr; // propagation uncertainty in Y - float dXdZ; // dX/dZ of the track - float dYdZ; // dY/dZ of the track - float dXdZErr; // propagation uncertainty in dX/dZ - float dYdZErr; // propagation uncertainty in dY/dZ - DetId id; // chamber ID + namespace io_v1 { + class MuonChamberMatch { + public: + std::vector segmentMatches; // segments matching propagated track trajectory + std::vector gemMatches; // segments matching propagated track trajectory + std::vector gemHitMatches; // segments matching propagated track trajectory + std::vector me0Matches; // segments matching propagated track trajectory + std::vector truthMatches; // SimHit projection matching propagated track trajectory + std::vector rpcMatches; // rpc hits matching propagated track trajectory + float edgeX; // distance to closest edge in X (negative - inside, positive - outside) + float edgeY; // distance to closest edge in Y (negative - inside, positive - outside) + float x; // X position of the track + float y; // Y position of the track + float xErr; // propagation uncertainty in X + float yErr; // propagation uncertainty in Y + float dXdZ; // dX/dZ of the track + float dYdZ; // dY/dZ of the track + float dXdZErr; // propagation uncertainty in dX/dZ + float dYdZErr; // propagation uncertainty in dY/dZ + DetId id; // chamber ID - int nDigisInRange; // # of DT/CSC digis in the chamber close-by to the propagated track + int nDigisInRange; // # of DT/CSC digis in the chamber close-by to the propagated track - int detector() const { return id.subdetId(); } - int station() const; + int detector() const { return id.subdetId(); } + int station() const; - std::pair getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const; - float dist() const { return getDistancePair(edgeX, edgeY, xErr, yErr).first; } // distance to absolute closest edge - float distErr() const { - return getDistancePair(edgeX, edgeY, xErr, yErr).second; - } // propagation uncertainty in above distance - }; + std::pair getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const; + float dist() const { + return getDistancePair(edgeX, edgeY, xErr, yErr).first; + } // distance to absolute closest edge + float distErr() const { + return getDistancePair(edgeX, edgeY, xErr, yErr).second; + } // propagation uncertainty in above distance + }; + } // namespace io_v1 + using MuonChamberMatch = io_v1::MuonChamberMatch; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h b/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h index 0716eb833ad67..7af18504b01db 100644 --- a/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h +++ b/DataFormats/MuonReco/interface/MuonCosmicCompatibility.h @@ -2,27 +2,30 @@ #define MuonReco_MuonCosmicCompatibility_h namespace reco { - struct MuonCosmicCompatibility { - /// combined cosmic-likeness: 0 == not cosmic-like - float cosmicCompatibility; - /// cosmic-likeness based on time: 0 == prompt-like - float timeCompatibility; - /// cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks - float backToBackCompatibility; - /// cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used) - float overlapCompatibility; - /// cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like - float ipCompatibility; - /// cosmic-likeness based on the event activity information: tracker track multiplicity and vertex quality. 0 == cosmic-like - float vertexCompatibility; + namespace io_v1 { + struct MuonCosmicCompatibility { + /// combined cosmic-likeness: 0 == not cosmic-like + float cosmicCompatibility; + /// cosmic-likeness based on time: 0 == prompt-like + float timeCompatibility; + /// cosmic-likeness based on presence of a track in opp side: 0 == no matching opp tracks + float backToBackCompatibility; + /// cosmic-likeness based on overlap with traversing cosmic muon (only muon/STA hits are used) + float overlapCompatibility; + /// cosmic-likeness based on the 2D impact parameters (dxy, dz wrt to PV). 0 == cosmic-like + float ipCompatibility; + /// cosmic-likeness based on the event activity information: tracker track multiplicity and vertex quality. 0 == cosmic-like + float vertexCompatibility; - MuonCosmicCompatibility() - : cosmicCompatibility(0), - timeCompatibility(0), - backToBackCompatibility(0), - overlapCompatibility(0), - ipCompatibility(0), - vertexCompatibility(0) {} - }; + MuonCosmicCompatibility() + : cosmicCompatibility(0), + timeCompatibility(0), + backToBackCompatibility(0), + overlapCompatibility(0), + ipCompatibility(0), + vertexCompatibility(0) {} + }; + } // namespace io_v1 + using MuonCosmicCompatibility = io_v1::MuonCosmicCompatibility; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonFwd.h b/DataFormats/MuonReco/interface/MuonFwd.h index fa351f8363016..401745a5e8f72 100644 --- a/DataFormats/MuonReco/interface/MuonFwd.h +++ b/DataFormats/MuonReco/interface/MuonFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Muon; + namespace io_v1 { + class Muon; + } + using Muon = io_v1::Muon; /// collection of Muon objects typedef std::vector MuonCollection; /// presistent reference to a Muon @@ -19,12 +22,16 @@ namespace reco { typedef MuonRefVector::iterator muon_iterator; /// Links between the three tracks which can define a muon - class MuonTrackLinks; - + namespace io_v1 { + class MuonTrackLinks; + } + using MuonTrackLinks = io_v1::MuonTrackLinks; /// collection of MuonTrackLinks typedef std::vector MuonTrackLinksCollection; - - class CaloMuon; + namespace io_v1 { + class CaloMuon; + } + using CaloMuon = io_v1::CaloMuon; /// collection of Muon objects typedef std::vector CaloMuonCollection; } // namespace reco diff --git a/DataFormats/MuonReco/interface/MuonMETCorrectionData.h b/DataFormats/MuonReco/interface/MuonMETCorrectionData.h index cb38bd46d980d..73067e7bbc753 100644 --- a/DataFormats/MuonReco/interface/MuonMETCorrectionData.h +++ b/DataFormats/MuonReco/interface/MuonMETCorrectionData.h @@ -4,37 +4,40 @@ #include namespace reco { - class MuonMETCorrectionData { - public: - enum Type { - NotUsed = 0, - CombinedTrackUsed = 1, - GlobalTrackUsed = 1, - InnerTrackUsed = 2, - TrackUsed = 2, - OuterTrackUsed = 3, - StandAloneTrackUsed = 3, - TreatedAsPion = 4, - MuonP4V4QUsed = 5, - MuonCandidateValuesUsed = 5 - }; + namespace io_v1 { + class MuonMETCorrectionData { + public: + enum Type { + NotUsed = 0, + CombinedTrackUsed = 1, + GlobalTrackUsed = 1, + InnerTrackUsed = 2, + TrackUsed = 2, + OuterTrackUsed = 3, + StandAloneTrackUsed = 3, + TreatedAsPion = 4, + MuonP4V4QUsed = 5, + MuonCandidateValuesUsed = 5 + }; - MuonMETCorrectionData() : type_(0), corrX_(0), corrY_(0) {} - MuonMETCorrectionData(Type type, float corrX, float corrY) : type_(type), corrX_(corrX), corrY_(corrY) {} + MuonMETCorrectionData() : type_(0), corrX_(0), corrY_(0) {} + MuonMETCorrectionData(Type type, float corrX, float corrY) : type_(type), corrX_(corrX), corrY_(corrY) {} - Type type() { return Type(type_); } - float corrX() { return corrX_; } - float corrY() { return corrY_; } - float x() { return corrX_; } - float y() { return corrY_; } - float pt() { return sqrt(x() * x() + y() * y()); } + Type type() { return Type(type_); } + float corrX() { return corrX_; } + float corrY() { return corrY_; } + float x() { return corrX_; } + float y() { return corrY_; } + float pt() { return sqrt(x() * x() + y() * y()); } - protected: - int type_; - float corrX_; - float corrY_; - }; + protected: + int type_; + float corrX_; + float corrY_; + }; + } // namespace io_v1 + using MuonMETCorrectionData = io_v1::MuonMETCorrectionData; } // namespace reco #endif //MuonReco_MuonMETCorrectionData_h diff --git a/DataFormats/MuonReco/interface/MuonSegmentMatch.h b/DataFormats/MuonReco/interface/MuonSegmentMatch.h index 6cfcdd8b13e50..76c4242844fbe 100644 --- a/DataFormats/MuonReco/interface/MuonSegmentMatch.h +++ b/DataFormats/MuonReco/interface/MuonSegmentMatch.h @@ -9,53 +9,56 @@ #include "DataFormats/GEMRecHit/interface/ME0SegmentCollection.h" namespace reco { - class MuonSegmentMatch { - public: - /// segment mask flags - static const unsigned int Arbitrated = 1 << 8; // is arbitrated (multiple muons) - static const unsigned int BestInChamberByDX = 1 << 9; // best delta x in single muon chamber - static const unsigned int BestInChamberByDR = 1 << 10; // best delta r in single muon chamber - static const unsigned int BestInChamberByDXSlope = 1 << 11; // best delta dx/dz in single muon chamber - static const unsigned int BestInChamberByDRSlope = 1 << 12; // best delta dy/dz in single muon chamber - static const unsigned int BestInStationByDX = 1 << 13; // best delta x in single muon station - static const unsigned int BestInStationByDR = 1 << 14; // best delta r in single muon station - static const unsigned int BestInStationByDXSlope = 1 << 15; // best delta dx/dz in single muon station - static const unsigned int BestInStationByDRSlope = 1 << 16; // best delta dy/dz in single muon station - static const unsigned int BelongsToTrackByDX = 1 << 17; // best delta x of multiple muons - static const unsigned int BelongsToTrackByDR = 1 << 18; // best delta r of multiple muons - static const unsigned int BelongsToTrackByDXSlope = 1 << 19; // best delta dx/dz of multiple muons - static const unsigned int BelongsToTrackByDRSlope = 1 << 20; // best delta dy/dz of multiple muons - static const unsigned int BelongsToTrackByME1aClean = 1 << 21; // won ME1a segment sharing cleaning - static const unsigned int BelongsToTrackByOvlClean = 1 << 22; // won chamber overlap segment sharing cleaning - static const unsigned int BelongsToTrackByClusClean = 1 << 23; // won cluster sharing cleaning - // won any arbitration cleaning type, including defaults - static const unsigned int BelongsToTrackByCleaning = 1 << 24; - - float x; // X position of the matched segment - float y; // Y position of the matched segment - float xErr; // uncertainty in X - float yErr; // uncertainty in Y - float dXdZ; // dX/dZ of the matched segment - float dYdZ; // dY/dZ of the matched segment - float dXdZErr; // uncertainty in dX/dZ - float dYdZErr; // uncertainty in dY/dZ - unsigned int mask; // arbitration mask - bool hasZed_; // contains local y information (only relevant for segments in DT) - bool hasPhi_; // contains local x information (only relevant for segments in DT) - - bool isMask(unsigned int flag = Arbitrated) const { return (mask & flag) == flag; } - void setMask(unsigned int flag) { mask |= flag; } - float t0; - - DTRecSegment4DRef dtSegmentRef; - CSCSegmentRef cscSegmentRef; - GEMSegmentRef gemSegmentRef; - ME0SegmentRef me0SegmentRef; - MuonSegmentMatch() : x(0), y(0), xErr(0), yErr(0), dXdZ(0), dYdZ(0), dXdZErr(0), dYdZErr(0) {} - - bool hasZed() const { return hasZed_; } - bool hasPhi() const { return hasPhi_; } - }; + namespace io_v1 { + class MuonSegmentMatch { + public: + /// segment mask flags + static const unsigned int Arbitrated = 1 << 8; // is arbitrated (multiple muons) + static const unsigned int BestInChamberByDX = 1 << 9; // best delta x in single muon chamber + static const unsigned int BestInChamberByDR = 1 << 10; // best delta r in single muon chamber + static const unsigned int BestInChamberByDXSlope = 1 << 11; // best delta dx/dz in single muon chamber + static const unsigned int BestInChamberByDRSlope = 1 << 12; // best delta dy/dz in single muon chamber + static const unsigned int BestInStationByDX = 1 << 13; // best delta x in single muon station + static const unsigned int BestInStationByDR = 1 << 14; // best delta r in single muon station + static const unsigned int BestInStationByDXSlope = 1 << 15; // best delta dx/dz in single muon station + static const unsigned int BestInStationByDRSlope = 1 << 16; // best delta dy/dz in single muon station + static const unsigned int BelongsToTrackByDX = 1 << 17; // best delta x of multiple muons + static const unsigned int BelongsToTrackByDR = 1 << 18; // best delta r of multiple muons + static const unsigned int BelongsToTrackByDXSlope = 1 << 19; // best delta dx/dz of multiple muons + static const unsigned int BelongsToTrackByDRSlope = 1 << 20; // best delta dy/dz of multiple muons + static const unsigned int BelongsToTrackByME1aClean = 1 << 21; // won ME1a segment sharing cleaning + static const unsigned int BelongsToTrackByOvlClean = 1 << 22; // won chamber overlap segment sharing cleaning + static const unsigned int BelongsToTrackByClusClean = 1 << 23; // won cluster sharing cleaning + // won any arbitration cleaning type, including defaults + static const unsigned int BelongsToTrackByCleaning = 1 << 24; + + float x; // X position of the matched segment + float y; // Y position of the matched segment + float xErr; // uncertainty in X + float yErr; // uncertainty in Y + float dXdZ; // dX/dZ of the matched segment + float dYdZ; // dY/dZ of the matched segment + float dXdZErr; // uncertainty in dX/dZ + float dYdZErr; // uncertainty in dY/dZ + unsigned int mask; // arbitration mask + bool hasZed_; // contains local y information (only relevant for segments in DT) + bool hasPhi_; // contains local x information (only relevant for segments in DT) + + bool isMask(unsigned int flag = Arbitrated) const { return (mask & flag) == flag; } + void setMask(unsigned int flag) { mask |= flag; } + float t0; + + DTRecSegment4DRef dtSegmentRef; + CSCSegmentRef cscSegmentRef; + GEMSegmentRef gemSegmentRef; + ME0SegmentRef me0SegmentRef; + MuonSegmentMatch() : x(0), y(0), xErr(0), yErr(0), dXdZ(0), dYdZ(0), dXdZErr(0), dYdZErr(0) {} + + bool hasZed() const { return hasZed_; } + bool hasPhi() const { return hasPhi_; } + }; + } // namespace io_v1 + using MuonSegmentMatch = io_v1::MuonSegmentMatch; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonShower.h b/DataFormats/MuonReco/interface/MuonShower.h index 79e92c746c542..45f3f39269b70 100644 --- a/DataFormats/MuonReco/interface/MuonShower.h +++ b/DataFormats/MuonReco/interface/MuonShower.h @@ -4,17 +4,20 @@ #include namespace reco { - struct MuonShower { - /// number of all the muon RecHits per chamber crossed by a track (1D hits) - std::vector nStationHits; - /// number of the muon RecHits used by segments per chamber crossed by a track - std::vector nStationCorrelatedHits; - /// the transverse size of the hit cluster - std::vector stationShowerSizeT; - /// the radius of the cone containing the all the hits around the track - std::vector stationShowerDeltaR; + namespace io_v1 { + struct MuonShower { + /// number of all the muon RecHits per chamber crossed by a track (1D hits) + std::vector nStationHits; + /// number of the muon RecHits used by segments per chamber crossed by a track + std::vector nStationCorrelatedHits; + /// the transverse size of the hit cluster + std::vector stationShowerSizeT; + /// the radius of the cone containing the all the hits around the track + std::vector stationShowerDeltaR; - MuonShower() : nStationHits(0), nStationCorrelatedHits(0), stationShowerSizeT(0), stationShowerDeltaR(0) {} - }; + MuonShower() : nStationHits(0), nStationCorrelatedHits(0), stationShowerSizeT(0), stationShowerDeltaR(0) {} + }; + } // namespace io_v1 + using MuonShower = io_v1::MuonShower; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonSimInfo.h b/DataFormats/MuonReco/interface/MuonSimInfo.h index 819c5c87e618d..7d09d57fb630a 100644 --- a/DataFormats/MuonReco/interface/MuonSimInfo.h +++ b/DataFormats/MuonReco/interface/MuonSimInfo.h @@ -71,31 +71,35 @@ namespace reco { }; - class MuonSimInfo { - public: - MuonSimInfo(); - typedef math::XYZPointD Point; ///< point in the space - typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector - MuonSimType primaryClass; - ExtendedMuonSimType extendedClass; - int flavour; - int pdgId; // pdg ID of matching tracking particle - int g4processType; // Geant process producing the particle - int motherPdgId; - int motherFlavour; - int motherStatus; // Status of the first gen particle - int grandMotherPdgId; - int grandMotherFlavour; - int heaviestMotherFlavour; - int tpId; - int tpEvent; - int tpBX; // bunch crossing - int charge; - LorentzVector p4; - Point vertex; - Point motherVertex; - float tpAssoQuality; - }; + namespace io_v1 { + + class MuonSimInfo { + public: + MuonSimInfo(); + typedef math::XYZPointD Point; ///< point in the space + typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector + MuonSimType primaryClass; + ExtendedMuonSimType extendedClass; + int flavour; + int pdgId; // pdg ID of matching tracking particle + int g4processType; // Geant process producing the particle + int motherPdgId; + int motherFlavour; + int motherStatus; // Status of the first gen particle + int grandMotherPdgId; + int grandMotherFlavour; + int heaviestMotherFlavour; + int tpId; + int tpEvent; + int tpBX; // bunch crossing + int charge; + LorentzVector p4; + Point vertex; + Point motherVertex; + float tpAssoQuality; + }; + } // namespace io_v1 + using MuonSimInfo = io_v1::MuonSimInfo; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonTimeExtra.h b/DataFormats/MuonReco/interface/MuonTimeExtra.h index 545f754715aca..4459e0ac6a1c8 100644 --- a/DataFormats/MuonReco/interface/MuonTimeExtra.h +++ b/DataFormats/MuonReco/interface/MuonTimeExtra.h @@ -11,73 +11,76 @@ */ namespace reco { + namespace io_v1 { - class MuonTimeExtra { - public: - MuonTimeExtra(); + class MuonTimeExtra { + public: + MuonTimeExtra(); - enum Direction { OutsideIn = -1, Undefined = 0, InsideOut = 1 }; + enum Direction { OutsideIn = -1, Undefined = 0, InsideOut = 1 }; - /// number of measurements used in timing calculation - int nDof() const { return nDof_; }; - void setNDof(const int nDof) { nDof_ = nDof; }; + /// number of measurements used in timing calculation + int nDof() const { return nDof_; }; + void setNDof(const int nDof) { nDof_ = nDof; }; - /// 1/beta for prompt particle hypothesis - /// (time is constraint to the bunch crossing time) - float inverseBeta() const { return inverseBeta_; }; - float inverseBetaErr() const { return inverseBetaErr_; }; - void setInverseBeta(const float iBeta) { inverseBeta_ = iBeta; }; - void setInverseBetaErr(const float iBetaErr) { inverseBetaErr_ = iBetaErr; }; + /// 1/beta for prompt particle hypothesis + /// (time is constraint to the bunch crossing time) + float inverseBeta() const { return inverseBeta_; }; + float inverseBetaErr() const { return inverseBetaErr_; }; + void setInverseBeta(const float iBeta) { inverseBeta_ = iBeta; }; + void setInverseBetaErr(const float iBetaErr) { inverseBetaErr_ = iBetaErr; }; - /// unconstrained 1/beta (time is free) - /// Sign convention: - /// positive - outward moving particle - /// negative - inward moving particle - float freeInverseBeta() const { return freeInverseBeta_; }; - float freeInverseBetaErr() const { return freeInverseBetaErr_; }; - void setFreeInverseBeta(const float iBeta) { freeInverseBeta_ = iBeta; }; - void setFreeInverseBetaErr(const float iBetaErr) { freeInverseBetaErr_ = iBetaErr; }; + /// unconstrained 1/beta (time is free) + /// Sign convention: + /// positive - outward moving particle + /// negative - inward moving particle + float freeInverseBeta() const { return freeInverseBeta_; }; + float freeInverseBetaErr() const { return freeInverseBetaErr_; }; + void setFreeInverseBeta(const float iBeta) { freeInverseBeta_ = iBeta; }; + void setFreeInverseBetaErr(const float iBetaErr) { freeInverseBetaErr_ = iBetaErr; }; - /// time of arrival at the IP for the Beta=1 hypothesis - /// a) particle is moving from inside out - float timeAtIpInOut() const { return timeAtIpInOut_; }; - float timeAtIpInOutErr() const { return timeAtIpInOutErr_; }; - void setTimeAtIpInOut(const float timeIp) { timeAtIpInOut_ = timeIp; }; - void setTimeAtIpInOutErr(const float timeErr) { timeAtIpInOutErr_ = timeErr; }; - /// b) particle is moving from outside in - float timeAtIpOutIn() const { return timeAtIpOutIn_; }; - float timeAtIpOutInErr() const { return timeAtIpOutInErr_; }; - void setTimeAtIpOutIn(const float timeIp) { timeAtIpOutIn_ = timeIp; }; - void setTimeAtIpOutInErr(const float timeErr) { timeAtIpOutInErr_ = timeErr; }; + /// time of arrival at the IP for the Beta=1 hypothesis + /// a) particle is moving from inside out + float timeAtIpInOut() const { return timeAtIpInOut_; }; + float timeAtIpInOutErr() const { return timeAtIpInOutErr_; }; + void setTimeAtIpInOut(const float timeIp) { timeAtIpInOut_ = timeIp; }; + void setTimeAtIpInOutErr(const float timeErr) { timeAtIpInOutErr_ = timeErr; }; + /// b) particle is moving from outside in + float timeAtIpOutIn() const { return timeAtIpOutIn_; }; + float timeAtIpOutInErr() const { return timeAtIpOutInErr_; }; + void setTimeAtIpOutIn(const float timeIp) { timeAtIpOutIn_ = timeIp; }; + void setTimeAtIpOutInErr(const float timeErr) { timeAtIpOutInErr_ = timeErr; }; - /// direction estimation based on time dispersion - Direction direction() const { - if (nDof_ < 2) - return Undefined; - if (timeAtIpInOutErr_ > timeAtIpOutInErr_) - return OutsideIn; - return InsideOut; - } + /// direction estimation based on time dispersion + Direction direction() const { + if (nDof_ < 2) + return Undefined; + if (timeAtIpInOutErr_ > timeAtIpOutInErr_) + return OutsideIn; + return InsideOut; + } - private: - /// number of measurements used in timing calculation - int nDof_; + private: + /// number of measurements used in timing calculation + int nDof_; - /// 1/beta for prompt particle hypothesis - float inverseBeta_; - float inverseBetaErr_; + /// 1/beta for prompt particle hypothesis + float inverseBeta_; + float inverseBetaErr_; - /// unconstrained 1/beta (time is free) - float freeInverseBeta_; - float freeInverseBetaErr_; + /// unconstrained 1/beta (time is free) + float freeInverseBeta_; + float freeInverseBetaErr_; - /// time of arrival at the IP for the Beta=1 hypothesis - float timeAtIpInOut_; - float timeAtIpInOutErr_; - float timeAtIpOutIn_; - float timeAtIpOutInErr_; - }; + /// time of arrival at the IP for the Beta=1 hypothesis + float timeAtIpInOut_; + float timeAtIpInOutErr_; + float timeAtIpOutIn_; + float timeAtIpOutInErr_; + }; + } // namespace io_v1 + using MuonTimeExtra = io_v1::MuonTimeExtra; } // namespace reco #endif diff --git a/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h b/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h index 4ccab26f7eeec..f0cdc5714e479 100644 --- a/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h +++ b/DataFormats/MuonReco/interface/MuonTimeExtraFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/ValueMap.h" namespace reco { - class MuonTimeExtra; + namespace io_v1 { + class MuonTimeExtra; + } + using MuonTimeExtra = io_v1::MuonTimeExtra; /// collection of MuonTimeExtra objects /* typedef std::vector MuonTimeExtraCollection; diff --git a/DataFormats/MuonReco/interface/MuonTrackLinks.h b/DataFormats/MuonReco/interface/MuonTrackLinks.h index 4e2d08cd17320..c9bb9c3593aa7 100644 --- a/DataFormats/MuonReco/interface/MuonTrackLinks.h +++ b/DataFormats/MuonReco/interface/MuonTrackLinks.h @@ -12,49 +12,52 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" namespace reco { + namespace io_v1 { - class MuonTrackLinks { - public: - /// Default Constructor - MuonTrackLinks() {} + class MuonTrackLinks { + public: + /// Default Constructor + MuonTrackLinks() {} - /// Constructor - MuonTrackLinks(reco::TrackRef tk, reco::TrackRef sta, reco::TrackRef glb) - : theTkTrack(tk), theStaTrack(sta), theGlbTrack(glb) {} + /// Constructor + MuonTrackLinks(reco::TrackRef tk, reco::TrackRef sta, reco::TrackRef glb) + : theTkTrack(tk), theStaTrack(sta), theGlbTrack(glb) {} - /// Destructor - virtual ~MuonTrackLinks() {} + /// Destructor + virtual ~MuonTrackLinks() {} - // Operations + // Operations - /// get the tracker's track which match with the stand alone muon tracks - inline reco::TrackRef trackerTrack() const { return theTkTrack; } + /// get the tracker's track which match with the stand alone muon tracks + inline reco::TrackRef trackerTrack() const { return theTkTrack; } - /// get the track built with the muon spectrometer alone - inline reco::TrackRef standAloneTrack() const { return theStaTrack; } + /// get the track built with the muon spectrometer alone + inline reco::TrackRef standAloneTrack() const { return theStaTrack; } - /// get the combined track - inline reco::TrackRef globalTrack() const { return theGlbTrack; } + /// get the combined track + inline reco::TrackRef globalTrack() const { return theGlbTrack; } - /// set the ref to tracker's track - inline void setTrackerTrack(reco::TrackRef tk) { theTkTrack = tk; } + /// set the ref to tracker's track + inline void setTrackerTrack(reco::TrackRef tk) { theTkTrack = tk; } - /// set the ref to stand alone track - inline void setStandAloneTrack(reco::TrackRef sta) { theStaTrack = sta; } + /// set the ref to stand alone track + inline void setStandAloneTrack(reco::TrackRef sta) { theStaTrack = sta; } - /// set the ref to combined track - inline void setGlobalTrack(reco::TrackRef glb) { theGlbTrack = glb; } + /// set the ref to combined track + inline void setGlobalTrack(reco::TrackRef glb) { theGlbTrack = glb; } - protected: - private: - /// ref to tracker's track which match with the stand alone muon tracks - reco::TrackRef theTkTrack; + protected: + private: + /// ref to tracker's track which match with the stand alone muon tracks + reco::TrackRef theTkTrack; - /// ref to the track built with the muon spectrometer alone - reco::TrackRef theStaTrack; + /// ref to the track built with the muon spectrometer alone + reco::TrackRef theStaTrack; - /// ref to the combined track - reco::TrackRef theGlbTrack; - }; + /// ref to the combined track + reco::TrackRef theGlbTrack; + }; + } // namespace io_v1 + using MuonTrackLinks = io_v1::MuonTrackLinks; } // namespace reco #endif diff --git a/DataFormats/MuonReco/src/MuonChamberMatch.cc b/DataFormats/MuonReco/src/MuonChamberMatch.cc index 7f04410d68e98..1e9ec855a604d 100644 --- a/DataFormats/MuonReco/src/MuonChamberMatch.cc +++ b/DataFormats/MuonReco/src/MuonChamberMatch.cc @@ -7,6 +7,7 @@ #include "DataFormats/MuonReco/interface/MuonChamberMatch.h" #include using namespace reco; +using namespace reco::io_v1; int MuonChamberMatch::station() const { if (detector() == MuonSubdetId::DT) { // DT diff --git a/DataFormats/MuonReco/src/classes_def.xml b/DataFormats/MuonReco/src/classes_def.xml index a959e417cf705..5140a17e2d51f 100644 --- a/DataFormats/MuonReco/src/classes_def.xml +++ b/DataFormats/MuonReco/src/classes_def.xml @@ -8,70 +8,54 @@ not be used as version numbers. By convention, CMS will use 3 as the initial version number of a class which has never been stored before. --> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - + + + + + + - - + + - - + + - + - + - - - + + - - - - - - + + - - - + + - - + + @@ -82,55 +66,53 @@ initial version number of a class which has never been stored before. - - + + - - - - + + - + - - + + - - + + - + - + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - + - - + + @@ -143,33 +125,33 @@ initial version number of a class which has never been stored before. - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + @@ -187,8 +169,8 @@ initial version number of a class which has never been stored before. - - + + @@ -201,24 +183,24 @@ initial version number of a class which has never been stored before. - - - - + + + + - - + + - - - - + + + + diff --git a/DataFormats/MuonSeed/interface/L2MuonTrajectorySeed.h b/DataFormats/MuonSeed/interface/L2MuonTrajectorySeed.h index 5b7c0955f2a3d..5120e582866d7 100644 --- a/DataFormats/MuonSeed/interface/L2MuonTrajectorySeed.h +++ b/DataFormats/MuonSeed/interface/L2MuonTrajectorySeed.h @@ -15,41 +15,44 @@ #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h" #include "DataFormats/TrajectoryState/interface/PTrajectoryStateOnDet.h" -class L2MuonTrajectorySeed : public TrajectorySeed { -public: - /// Default constructor - L2MuonTrajectorySeed(); - - /// Constructor - L2MuonTrajectorySeed(PTrajectoryStateOnDet const& ptsos, - RecHitContainer const& rh, - PropagationDirection dir, - l1extra::L1MuonParticleRef l1Ref); - - /// Constructor for stage2 L1 - L2MuonTrajectorySeed(PTrajectoryStateOnDet const& ptsos, - RecHitContainer const& rh, - PropagationDirection dir, - l1t::MuonRef l1Ref); - - L2MuonTrajectorySeed(PTrajectoryStateOnDet const& ptsos, - RecHitContainer const& rh, - PropagationDirection dir, - l1t::TrackerMuonRef l1TkMuRef); - - /// Destructor - ~L2MuonTrajectorySeed() override {} - - // Operations - - /// Get L1 info - inline l1extra::L1MuonParticleRef l1Particle() const { return theL1Particle; } - inline l1t::MuonRef l1tParticle() const { return theL1TParticle; } - inline l1t::TrackerMuonRef l1TkMu() const { return theL1TkMu; } - -private: - l1extra::L1MuonParticleRef theL1Particle; - l1t::MuonRef theL1TParticle; - l1t::TrackerMuonRef theL1TkMu; -}; +namespace io_v1 { + class L2MuonTrajectorySeed : public TrajectorySeed { + public: + /// Default constructor + L2MuonTrajectorySeed(); + + /// Constructor + L2MuonTrajectorySeed(PTrajectoryStateOnDet const& ptsos, + RecHitContainer const& rh, + PropagationDirection dir, + l1extra::L1MuonParticleRef l1Ref); + + /// Constructor for stage2 L1 + L2MuonTrajectorySeed(PTrajectoryStateOnDet const& ptsos, + RecHitContainer const& rh, + PropagationDirection dir, + l1t::MuonRef l1Ref); + + L2MuonTrajectorySeed(PTrajectoryStateOnDet const& ptsos, + RecHitContainer const& rh, + PropagationDirection dir, + l1t::TrackerMuonRef l1TkMuRef); + + /// Destructor + ~L2MuonTrajectorySeed() override {} + + // Operations + + /// Get L1 info + inline l1extra::L1MuonParticleRef l1Particle() const { return theL1Particle; } + inline l1t::MuonRef l1tParticle() const { return theL1TParticle; } + inline l1t::TrackerMuonRef l1TkMu() const { return theL1TkMu; } + + private: + l1extra::L1MuonParticleRef theL1Particle; + l1t::MuonRef theL1TParticle; + l1t::TrackerMuonRef theL1TkMu; + }; +} // namespace io_v1 +using L2MuonTrajectorySeed = io_v1::L2MuonTrajectorySeed; #endif diff --git a/DataFormats/MuonSeed/src/classes_def.xml b/DataFormats/MuonSeed/src/classes_def.xml index 21f77e436c2d7..51e293f52e52b 100644 --- a/DataFormats/MuonSeed/src/classes_def.xml +++ b/DataFormats/MuonSeed/src/classes_def.xml @@ -1,37 +1,32 @@ - - - - - + + - - + + - - - - - - + + + + + + - - + + - - + + - - - + + + - - - - + + diff --git a/DataFormats/NanoAOD/src/classes_def.xml b/DataFormats/NanoAOD/src/classes_def.xml index 188873a69e885..8a069ce77c651 100644 --- a/DataFormats/NanoAOD/src/classes_def.xml +++ b/DataFormats/NanoAOD/src/classes_def.xml @@ -3,13 +3,8 @@ - - - - - - - + + @@ -35,9 +30,8 @@ - - - + + diff --git a/DataFormats/OnlineMetaData/interface/CTPPSRecord.h b/DataFormats/OnlineMetaData/interface/CTPPSRecord.h index a6b731ffa380d..059966ee78d93 100644 --- a/DataFormats/OnlineMetaData/interface/CTPPSRecord.h +++ b/DataFormats/OnlineMetaData/interface/CTPPSRecord.h @@ -17,62 +17,64 @@ #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" #include "DataFormats/Provenance/interface/Timestamp.h" -class CTPPSRecord { -public: - enum RomanPot { - RP_45_210_FR_BT, - RP_45_210_FR_HR, - RP_45_210_FR_TP, - RP_45_220_C1, - RP_45_220_FR_BT, - RP_45_220_FR_HR, - RP_45_220_FR_TP, - RP_45_220_NR_BT, - RP_45_220_NR_HR, - RP_45_220_NR_TP, - RP_56_210_FR_BT, - RP_56_210_FR_HR, - RP_56_210_FR_TP, - RP_56_220_C1, - RP_56_220_FR_BT, - RP_56_220_FR_HR, - RP_56_220_FR_TP, - RP_56_220_NR_BT, - RP_56_220_NR_HR, - RP_56_220_NR_TP, - Last - }; - - enum Status { unused, bad, warning, ok }; +namespace io_v1 { + class CTPPSRecord { + public: + enum RomanPot { + RP_45_210_FR_BT, + RP_45_210_FR_HR, + RP_45_210_FR_TP, + RP_45_220_C1, + RP_45_220_FR_BT, + RP_45_220_FR_HR, + RP_45_220_FR_TP, + RP_45_220_NR_BT, + RP_45_220_NR_HR, + RP_45_220_NR_TP, + RP_56_210_FR_BT, + RP_56_210_FR_HR, + RP_56_210_FR_TP, + RP_56_220_C1, + RP_56_220_FR_BT, + RP_56_220_FR_HR, + RP_56_220_FR_TP, + RP_56_220_NR_BT, + RP_56_220_NR_HR, + RP_56_220_NR_TP, + Last + }; - CTPPSRecord(); - explicit CTPPSRecord(const online::CTPPS_v1&); - virtual ~CTPPSRecord(); + enum Status { unused, bad, warning, ok }; - /// Return the time of the last change - const edm::Timestamp& timestamp() const { return timestamp_; } + CTPPSRecord(); + explicit CTPPSRecord(const online::CTPPS_v1&); + virtual ~CTPPSRecord(); - /// Get the names of all roman pots - typedef std::array RomanPotNames; - const RomanPotNames& romanPotNames() const { return romanPotNames_; } + /// Return the time of the last change + const edm::Timestamp& timestamp() const { return timestamp_; } - /// Return the name of the roman pot - const std::string& romanPotName(const uint8_t rp) const { return romanPotNames_.at(rp); } + /// Get the names of all roman pots + typedef std::array RomanPotNames; + const RomanPotNames& romanPotNames() const { return romanPotNames_; } - /// Return the status of the given roman pot - Status status(const uint8_t rp) const { return Status((status_ >> (rp * 2)) & 0x3); } + /// Return the name of the roman pot + const std::string& romanPotName(const uint8_t rp) const { return romanPotNames_.at(rp); } - /// Return the status as string - const std::string& statusName(const uint8_t rp) const { return statusNames_.at(status(rp)); } + /// Return the status of the given roman pot + Status status(const uint8_t rp) const { return Status((status_ >> (rp * 2)) & 0x3); } -private: - edm::Timestamp timestamp_; - uint64_t status_; - static const std::array statusNames_; - static const RomanPotNames romanPotNames_; -}; + /// Return the status as string + const std::string& statusName(const uint8_t rp) const { return statusNames_.at(status(rp)); } -/// Pretty-print operator for CTPPSRecord -std::ostream& operator<<(std::ostream&, const CTPPSRecord&); + private: + edm::Timestamp timestamp_; + uint64_t status_; + static const std::array statusNames_; + static const RomanPotNames romanPotNames_; + }; + /// Pretty-print operator for CTPPSRecord + std::ostream& operator<<(std::ostream&, const CTPPSRecord&); +} // namespace io_v1 +using CTPPSRecord = io_v1::CTPPSRecord; #endif // DATAFORMATS_ONLINEMETADATA_CTPPSRECORD_H diff --git a/DataFormats/OnlineMetaData/interface/DCSRecord.h b/DataFormats/OnlineMetaData/interface/DCSRecord.h index cda8d33cdbdd2..9447a1f5c019c 100644 --- a/DataFormats/OnlineMetaData/interface/DCSRecord.h +++ b/DataFormats/OnlineMetaData/interface/DCSRecord.h @@ -17,78 +17,82 @@ #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" #include "DataFormats/Provenance/interface/Timestamp.h" -class DCSRecord { -public: - // Adding new partitions requires to add a new bitset definition with - // the correct dimension to DataFormats/StdDictionaries/src/classes_def_others.xml - enum Partition { - EBp, - EBm, - EEp, - EEm, - HBHEa, - HBHEb, - HBHEc, - HF, - HO, - RPC, - DT0, - DTp, - DTm, - CSCp, - CSCm, - CASTOR, - ZDC, - TIBTID, - TOB, - TECp, - TECm, - BPIX, - FPIX, - ESp, - ESm, - GEMp, - GEMm, - Last - }; - - DCSRecord(); - explicit DCSRecord(const online::DCS_v1&); - explicit DCSRecord(const online::DCS_v2&); - virtual ~DCSRecord(); +namespace io_v1 { + class DCSRecord { + public: + // Adding new partitions requires to add a new bitset definition with + // the correct dimension to DataFormats/StdDictionaries/src/classes_def_others.xml + enum Partition { + EBp, + EBm, + EEp, + EEm, + HBHEa, + HBHEb, + HBHEc, + HF, + HO, + RPC, + DT0, + DTp, + DTm, + CSCp, + CSCm, + CASTOR, + ZDC, + TIBTID, + TOB, + TECp, + TECm, + BPIX, + FPIX, + ESp, + ESm, + GEMp, + GEMm, + Last + }; - /// Return the time of the last change - const edm::Timestamp& timestamp() const { return timestamp_; } + DCSRecord(); + explicit DCSRecord(const online::DCS_v1&); + explicit DCSRecord(const online::DCS_v2&); + virtual ~DCSRecord(); - /// Get the names of all high-voltage partitions - typedef std::array ParitionNames; - const ParitionNames& paritionNames() const { return partitionNames_; } + /// Return the time of the last change + const edm::Timestamp& timestamp() const { return timestamp_; } - /// Return the name of the high voltage of the given parition - const std::string& partitionName(const uint8_t partitionNumber) const { return partitionNames_.at(partitionNumber); } + /// Get the names of all high-voltage partitions + typedef std::array ParitionNames; + const ParitionNames& paritionNames() const { return partitionNames_; } - /// Return true if the high voltage of the given parition is ready - bool highVoltageReady(const uint8_t partitionNumber) const { return highVoltageReady_.test(partitionNumber); } + /// Return the name of the high voltage of the given parition + const std::string& partitionName(const uint8_t partitionNumber) const { + return partitionNames_.at(partitionNumber); + } - /// Return true if the high voltage bit of the given partition is valid - bool highVoltageValid(const uint8_t partitionNumber) const { return highVoltageValid_.test(partitionNumber); } + /// Return true if the high voltage of the given parition is ready + bool highVoltageReady(const uint8_t partitionNumber) const { return highVoltageReady_.test(partitionNumber); } - /// Return the current of the CMS magnet in A - float magnetCurrent() const { return magnetCurrent_; } + /// Return true if the high voltage bit of the given partition is valid + bool highVoltageValid(const uint8_t partitionNumber) const { return highVoltageValid_.test(partitionNumber); } - /// Return the magnetic field of the CMS magnet in T - /// The precision is 0.6 to 1.8 mT in the range of a current from 9500 to 18164 A (from Vyacheslav.Klyukhin@cern.ch) - float magneticField() const { return (0.0002067 * magnetCurrent_ + 0.0557973); } + /// Return the current of the CMS magnet in A + float magnetCurrent() const { return magnetCurrent_; } -private: - edm::Timestamp timestamp_; - std::bitset highVoltageReady_; - std::bitset highVoltageValid_; - float magnetCurrent_; - static const ParitionNames partitionNames_; -}; + /// Return the magnetic field of the CMS magnet in T + /// The precision is 0.6 to 1.8 mT in the range of a current from 9500 to 18164 A (from Vyacheslav.Klyukhin@cern.ch) + float magneticField() const { return (0.0002067 * magnetCurrent_ + 0.0557973); } -/// Pretty-print operator for DCSRecord -std::ostream& operator<<(std::ostream&, const DCSRecord&); + private: + edm::Timestamp timestamp_; + std::bitset highVoltageReady_; + std::bitset highVoltageValid_; + float magnetCurrent_; + static const ParitionNames partitionNames_; + }; + /// Pretty-print operator for DCSRecord + std::ostream& operator<<(std::ostream&, const DCSRecord&); +} // namespace io_v1 +using DCSRecord = io_v1::DCSRecord; #endif // DATAFORMATS_ONLINEMETADATA_DCSRECORD_H diff --git a/DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h b/DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h index cd6b80a5c74b8..887e3c9b8b1b8 100644 --- a/DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h +++ b/DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h @@ -14,36 +14,38 @@ #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" #include "DataFormats/Provenance/interface/Timestamp.h" -class OnlineLuminosityRecord { -public: - OnlineLuminosityRecord(); - OnlineLuminosityRecord(const online::Luminosity_v1&); - virtual ~OnlineLuminosityRecord(); - - /// Return the time when the lumi was recorded - const edm::Timestamp& timestamp() const { return timestamp_; } - - /// Return the lumi-section number - uint16_t lumiSection() const { return lumiSection_; } - - /// Return the lumi-nibble number - uint16_t lumiNibble() const { return lumiNibble_; } - - /// Return the luminosity for the current nibble - float instLumi() const { return instLumi_; } - - /// Return the average pileup for th current nibble - float avgPileUp() const { return avgPileUp_; } - -private: - edm::Timestamp timestamp_; - float instLumi_; - float avgPileUp_; - uint16_t lumiSection_; - uint16_t lumiNibble_; -}; - -/// Pretty-print operator for OnlineLuminosityRecord -std::ostream& operator<<(std::ostream&, const OnlineLuminosityRecord&); - +namespace io_v1 { + class OnlineLuminosityRecord { + public: + OnlineLuminosityRecord(); + OnlineLuminosityRecord(const online::Luminosity_v1&); + virtual ~OnlineLuminosityRecord(); + + /// Return the time when the lumi was recorded + const edm::Timestamp& timestamp() const { return timestamp_; } + + /// Return the lumi-section number + uint16_t lumiSection() const { return lumiSection_; } + + /// Return the lumi-nibble number + uint16_t lumiNibble() const { return lumiNibble_; } + + /// Return the luminosity for the current nibble + float instLumi() const { return instLumi_; } + + /// Return the average pileup for th current nibble + float avgPileUp() const { return avgPileUp_; } + + private: + edm::Timestamp timestamp_; + float instLumi_; + float avgPileUp_; + uint16_t lumiSection_; + uint16_t lumiNibble_; + }; + + /// Pretty-print operator for OnlineLuminosityRecord + std::ostream& operator<<(std::ostream&, const OnlineLuminosityRecord&); +} // namespace io_v1 +using OnlineLuminosityRecord = io_v1::OnlineLuminosityRecord; #endif // DATAFORMATS_ONLINEMETADATA_ONLINELUMINOSITYRECORD_H diff --git a/DataFormats/OnlineMetaData/src/CTPPSRecord.cc b/DataFormats/OnlineMetaData/src/CTPPSRecord.cc index cae6605ba0a21..84630d2e0f856 100644 --- a/DataFormats/OnlineMetaData/src/CTPPSRecord.cc +++ b/DataFormats/OnlineMetaData/src/CTPPSRecord.cc @@ -4,35 +4,37 @@ #include "DataFormats/OnlineMetaData/interface/CTPPSRecord.h" #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" -const CTPPSRecord::RomanPotNames CTPPSRecord::romanPotNames_ = { - {"RP_45_210_FR_BT", "RP_45_210_FR_HR", "RP_45_210_FR_TP", "RP_45_220_C1", "RP_45_220_FR_BT", - "RP_45_220_FR_HR", "RP_45_220_FR_TP", "RP_45_220_NR_BT", "RP_45_220_NR_HR", "RP_45_220_NR_TP", - "RP_56_210_FR_BT", "RP_56_210_FR_HR", "RP_56_210_FR_TP", "RP_56_220_C1", "RP_56_220_FR_BT", - "RP_56_220_FR_HR", "RP_56_220_FR_TP", "RP_56_220_NR_BT", "RP_56_220_NR_HR", "RP_56_220_NR_TP"}}; - -const std::array CTPPSRecord::statusNames_ = {{"unused", "bad", "warning", "ok"}}; - -CTPPSRecord::CTPPSRecord() : timestamp_(edm::Timestamp::invalidTimestamp()), status_(0) {} +namespace io_v1 { + const CTPPSRecord::RomanPotNames CTPPSRecord::romanPotNames_ = { + {"RP_45_210_FR_BT", "RP_45_210_FR_HR", "RP_45_210_FR_TP", "RP_45_220_C1", "RP_45_220_FR_BT", + "RP_45_220_FR_HR", "RP_45_220_FR_TP", "RP_45_220_NR_BT", "RP_45_220_NR_HR", "RP_45_220_NR_TP", + "RP_56_210_FR_BT", "RP_56_210_FR_HR", "RP_56_210_FR_TP", "RP_56_220_C1", "RP_56_220_FR_BT", + "RP_56_220_FR_HR", "RP_56_220_FR_TP", "RP_56_220_NR_BT", "RP_56_220_NR_HR", "RP_56_220_NR_TP"}}; + + const std::array CTPPSRecord::statusNames_ = {{"unused", "bad", "warning", "ok"}}; + + CTPPSRecord::CTPPSRecord() : timestamp_(edm::Timestamp::invalidTimestamp()), status_(0) {} + + CTPPSRecord::CTPPSRecord(const online::CTPPS_v1& ctpps) { + // DIP timestamp is in milliseconds + const uint64_t seconds = ctpps.timestamp / 1000; + const uint32_t microseconds = (ctpps.timestamp % 1000) * 1000; + timestamp_ = edm::Timestamp((seconds << 32) | microseconds); + status_ = ctpps.status; + } -CTPPSRecord::CTPPSRecord(const online::CTPPS_v1& ctpps) { - // DIP timestamp is in milliseconds - const uint64_t seconds = ctpps.timestamp / 1000; - const uint32_t microseconds = (ctpps.timestamp % 1000) * 1000; - timestamp_ = edm::Timestamp((seconds << 32) | microseconds); - status_ = ctpps.status; -} + CTPPSRecord::~CTPPSRecord() {} -CTPPSRecord::~CTPPSRecord() {} + std::ostream& operator<<(std::ostream& s, const CTPPSRecord& ctpps) { + const time_t ts = ctpps.timestamp().unixTime(); -std::ostream& operator<<(std::ostream& s, const CTPPSRecord& ctpps) { - const time_t ts = ctpps.timestamp().unixTime(); + s << "timeStamp: " << asctime(localtime(&ts)); + s << "Roman pot states:" << std::endl; - s << "timeStamp: " << asctime(localtime(&ts)); - s << "Roman pot states:" << std::endl; + for (uint8_t i = 0; i < CTPPSRecord::RomanPot::Last; ++i) { + s << " " << std::setw(16) << std::left << ctpps.romanPotName(i) << ": " << ctpps.statusName(i) << std::endl; + } - for (uint8_t i = 0; i < CTPPSRecord::RomanPot::Last; ++i) { - s << " " << std::setw(16) << std::left << ctpps.romanPotName(i) << ": " << ctpps.statusName(i) << std::endl; + return s; } - - return s; -} +} // namespace io_v1 diff --git a/DataFormats/OnlineMetaData/src/DCSRecord.cc b/DataFormats/OnlineMetaData/src/DCSRecord.cc index 19019c7a46bd2..eff6eb33218a7 100644 --- a/DataFormats/OnlineMetaData/src/DCSRecord.cc +++ b/DataFormats/OnlineMetaData/src/DCSRecord.cc @@ -4,53 +4,56 @@ #include "DataFormats/OnlineMetaData/interface/DCSRecord.h" #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" -const DCSRecord::ParitionNames DCSRecord::partitionNames_ = { - {"EBp", "EBm", "EEp", "EEm", "HBHEa", "HBHEb", "HBHEc", "HF", "HO", "RPC", "DT0", "DTp", "DTm", "CSCp", - "CSCm", "CASTOR", "ZDC", "TIBTID", "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm", "GEMp", "GEMm"}}; - -DCSRecord::DCSRecord() : timestamp_(edm::Timestamp::invalidTimestamp()), magnetCurrent_(-1) {} - -DCSRecord::DCSRecord(const online::DCS_v1& dcs) { - // DIP timestamp is in milliseconds - const uint64_t seconds = dcs.timestamp / 1000; - const uint32_t microseconds = (dcs.timestamp % 1000) * 1000; - timestamp_ = edm::Timestamp((seconds << 32) | microseconds); - highVoltageReady_ = dcs.highVoltageReady; - //bit always valid for V1 - highVoltageValid_ = 0xffffffff; - magnetCurrent_ = dcs.magnetCurrent; -} - -DCSRecord::DCSRecord(const online::DCS_v2& dcs) { - // DIP timestamp is in milliseconds - const uint64_t seconds = dcs.timestamp / 1000; - const uint32_t microseconds = (dcs.timestamp % 1000) * 1000; - timestamp_ = edm::Timestamp((seconds << 32) | microseconds); - highVoltageReady_ = dcs.highVoltageReady; - highVoltageValid_ = dcs.highVoltageValid; - magnetCurrent_ = dcs.magnetCurrent; -} - -DCSRecord::~DCSRecord() {} - -std::ostream& operator<<(std::ostream& s, const DCSRecord& dcs) { - const time_t ts = dcs.timestamp().unixTime(); - - s << "timeStamp: " << asctime(localtime(&ts)); - - std::streamsize ss = s.precision(); - s.setf(std::ios::fixed); - s.precision(3); - s << "Magnet current (A): " << std::fixed << std::setprecision(3) << dcs.magnetCurrent() << std::endl; - s.unsetf(std::ios::fixed); - s.precision(ss); - - s << "HV state per partition:" << std::endl; - - for (unsigned int i = 0; i < DCSRecord::Partition::Last; ++i) { - s << " " << std::setw(7) << std::left << dcs.partitionName(i) << ": " - << (!dcs.highVoltageValid(i) ? "N/A" : (dcs.highVoltageReady(i) ? "READY" : "OFF")) << std::endl; +namespace io_v1 { + const DCSRecord::ParitionNames DCSRecord::partitionNames_ = { + {"EBp", "EBm", "EEp", "EEm", "HBHEa", "HBHEb", "HBHEc", "HF", "HO", + "RPC", "DT0", "DTp", "DTm", "CSCp", "CSCm", "CASTOR", "ZDC", "TIBTID", + "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm", "GEMp", "GEMm"}}; + + DCSRecord::DCSRecord() : timestamp_(edm::Timestamp::invalidTimestamp()), magnetCurrent_(-1) {} + + DCSRecord::DCSRecord(const online::DCS_v1& dcs) { + // DIP timestamp is in milliseconds + const uint64_t seconds = dcs.timestamp / 1000; + const uint32_t microseconds = (dcs.timestamp % 1000) * 1000; + timestamp_ = edm::Timestamp((seconds << 32) | microseconds); + highVoltageReady_ = dcs.highVoltageReady; + //bit always valid for V1 + highVoltageValid_ = 0xffffffff; + magnetCurrent_ = dcs.magnetCurrent; } - return s; -} + DCSRecord::DCSRecord(const online::DCS_v2& dcs) { + // DIP timestamp is in milliseconds + const uint64_t seconds = dcs.timestamp / 1000; + const uint32_t microseconds = (dcs.timestamp % 1000) * 1000; + timestamp_ = edm::Timestamp((seconds << 32) | microseconds); + highVoltageReady_ = dcs.highVoltageReady; + highVoltageValid_ = dcs.highVoltageValid; + magnetCurrent_ = dcs.magnetCurrent; + } + + DCSRecord::~DCSRecord() {} + + std::ostream& operator<<(std::ostream& s, const DCSRecord& dcs) { + const time_t ts = dcs.timestamp().unixTime(); + + s << "timeStamp: " << asctime(localtime(&ts)); + + std::streamsize ss = s.precision(); + s.setf(std::ios::fixed); + s.precision(3); + s << "Magnet current (A): " << std::fixed << std::setprecision(3) << dcs.magnetCurrent() << std::endl; + s.unsetf(std::ios::fixed); + s.precision(ss); + + s << "HV state per partition:" << std::endl; + + for (unsigned int i = 0; i < DCSRecord::Partition::Last; ++i) { + s << " " << std::setw(7) << std::left << dcs.partitionName(i) << ": " + << (!dcs.highVoltageValid(i) ? "N/A" : (dcs.highVoltageReady(i) ? "READY" : "OFF")) << std::endl; + } + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/OnlineMetaData/src/OnlineLuminosityRecord.cc b/DataFormats/OnlineMetaData/src/OnlineLuminosityRecord.cc index 3507926f970fb..86ccdbac23d39 100644 --- a/DataFormats/OnlineMetaData/src/OnlineLuminosityRecord.cc +++ b/DataFormats/OnlineMetaData/src/OnlineLuminosityRecord.cc @@ -4,36 +4,38 @@ #include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h" #include "DataFormats/OnlineMetaData/interface/OnlineMetaDataRaw.h" -OnlineLuminosityRecord::OnlineLuminosityRecord() - : timestamp_(edm::Timestamp::invalidTimestamp()), instLumi_(0), avgPileUp_(0), lumiSection_(0), lumiNibble_(0) {} - -OnlineLuminosityRecord::OnlineLuminosityRecord(const online::Luminosity_v1& lumi) { - // DIP timestamp is in milliseconds - const uint64_t seconds = lumi.timestamp / 1000; - const uint32_t microseconds = (lumi.timestamp % 1000) * 1000; - timestamp_ = edm::Timestamp((seconds << 32) | microseconds); - instLumi_ = lumi.instLumi; - avgPileUp_ = lumi.avgPileUp; - lumiSection_ = lumi.lumiSection; - lumiNibble_ = lumi.lumiNibble; -} - -OnlineLuminosityRecord::~OnlineLuminosityRecord() {} - -std::ostream& operator<<(std::ostream& s, const OnlineLuminosityRecord& luminosity) { - const time_t ts = luminosity.timestamp().unixTime(); - - s << "timeStamp: " << asctime(localtime(&ts)); - s << "lumiSection: " << luminosity.lumiSection() << std::endl; - s << "lumiNibble: " << luminosity.lumiNibble() << std::endl; - - std::streamsize ss = s.precision(); - s.setf(std::ios::fixed); - s.precision(2); - s << "instLumi: " << luminosity.instLumi() << std::endl; - s << "avgPileUp: " << luminosity.avgPileUp() << std::endl; - s.unsetf(std::ios::fixed); - s.precision(ss); - - return s; -} +namespace io_v1 { + OnlineLuminosityRecord::OnlineLuminosityRecord() + : timestamp_(edm::Timestamp::invalidTimestamp()), instLumi_(0), avgPileUp_(0), lumiSection_(0), lumiNibble_(0) {} + + OnlineLuminosityRecord::OnlineLuminosityRecord(const online::Luminosity_v1& lumi) { + // DIP timestamp is in milliseconds + const uint64_t seconds = lumi.timestamp / 1000; + const uint32_t microseconds = (lumi.timestamp % 1000) * 1000; + timestamp_ = edm::Timestamp((seconds << 32) | microseconds); + instLumi_ = lumi.instLumi; + avgPileUp_ = lumi.avgPileUp; + lumiSection_ = lumi.lumiSection; + lumiNibble_ = lumi.lumiNibble; + } + + OnlineLuminosityRecord::~OnlineLuminosityRecord() {} + + std::ostream& operator<<(std::ostream& s, const OnlineLuminosityRecord& luminosity) { + const time_t ts = luminosity.timestamp().unixTime(); + + s << "timeStamp: " << asctime(localtime(&ts)); + s << "lumiSection: " << luminosity.lumiSection() << std::endl; + s << "lumiNibble: " << luminosity.lumiNibble() << std::endl; + + std::streamsize ss = s.precision(); + s.setf(std::ios::fixed); + s.precision(2); + s << "instLumi: " << luminosity.instLumi() << std::endl; + s << "avgPileUp: " << luminosity.avgPileUp() << std::endl; + s.unsetf(std::ios::fixed); + s.precision(ss); + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/OnlineMetaData/src/classes_def.xml b/DataFormats/OnlineMetaData/src/classes_def.xml index ea8f3e6d2b49b..4b65c7ca6a47c 100644 --- a/DataFormats/OnlineMetaData/src/classes_def.xml +++ b/DataFormats/OnlineMetaData/src/classes_def.xml @@ -1,24 +1,22 @@ - - + + - - - - + + - - + + - - - + + + - - - + + + diff --git a/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h b/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h index 9ca9bce8832c5..bdfe6979c9d63 100644 --- a/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h +++ b/DataFormats/ParticleFlowCandidate/interface/PFCandidate.h @@ -14,7 +14,7 @@ #include "DataFormats/Math/interface/Point3D.h" -#include "DataFormats/Candidate/interface/CompositeCandidate.h" +#include "DataFormats/Candidate/interface/LeafCandidate.h" #include "DataFormats/ParticleFlowReco/interface/PFBlockFwd.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" @@ -31,549 +31,551 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateEGammaExtraFwd.h" #include "DataFormats/EgammaCandidates/interface/PhotonFwd.h" namespace reco { - /**\class PFCandidate + namespace io_v1 { + /**\class PFCandidate \brief Particle reconstructed by the particle flow algorithm. \author Colin Bernet \date February 2007 */ - class PFCandidate : public CompositeCandidate { - public: - /// particle types - enum ParticleType { - X = 0, // undefined - h, // charged hadron - e, // electron - mu, // muon - gamma, // photon - h0, // neutral hadron - h_HF, // HF tower identified as a hadron - egamma_HF // HF tower identified as an EM particle - }; - - enum Flags { - NORMAL = 0, - E_PHI_SMODULES, - E_ETA_0, - E_ETA_MODULES, - E_BARREL_ENDCAP, - E_PRESHOWER_EDGE, - E_PRESHOWER, - E_ENDCAP_EDGE, - H_ETA_0, - H_BARREL_ENDCAP, - H_ENDCAP_VFCAL, - H_VFCAL_EDGE, - T_TO_DISP, - T_FROM_DISP, - T_FROM_V0, - T_FROM_GAMMACONV, - GAMMA_TO_GAMMACONV - }; - - enum PFVertexType { - kCandVertex = 0, - kTrkVertex = 1, - kComMuonVertex = 2, - kSAMuonVertex = 3, - kTrkMuonVertex = 4, - kGSFVertex = 5, - kTPFMSMuonVertex = 6, - kPickyMuonVertex = 7, - kDYTMuonVertex = 8 - }; - - /// default constructor - PFCandidate(); - - /// constructor from a reference (keeps track of source relationship) - PFCandidate(const PFCandidatePtr& sourcePtr); - - /* PFCandidate( Charge q, */ - /* const LorentzVector & p4, */ - /* ParticleType particleId, */ - /* reco::PFBlockRef blockRef ); */ - PFCandidate(Charge q, const LorentzVector& p4, ParticleType particleId); - - /// copy constructor - PFCandidate(const PFCandidate&); - - /// destructor - ~PFCandidate() override; - - PFCandidate& operator=(PFCandidate const&); - - /// return a clone - PFCandidate* clone() const override; - - /* /// set source ref */ - /* void setSourceRef(const PFCandidateRef& ref) { sourceRef_ = ref; } */ - - /* size_type numberOfSourceCandidateRefs() const {return 1;} */ - - /* CandidateBaseRef sourceCandidateRef( size_type i ) const { */ - /* return CandidateBaseRef(sourceRef_); */ - /* } */ - - using reco::Candidate::setSourceCandidatePtr; - void setSourceCandidatePtr(const PFCandidatePtr& ptr) { sourcePtr_ = ptr; } - - size_t numberOfSourceCandidatePtrs() const override { return 1; } + class PFCandidate : public LeafCandidate { + public: + /// particle types + enum ParticleType { + X = 0, // undefined + h, // charged hadron + e, // electron + mu, // muon + gamma, // photon + h0, // neutral hadron + h_HF, // HF tower identified as a hadron + egamma_HF // HF tower identified as an EM particle + }; + + enum Flags { + NORMAL = 0, + E_PHI_SMODULES, + E_ETA_0, + E_ETA_MODULES, + E_BARREL_ENDCAP, + E_PRESHOWER_EDGE, + E_PRESHOWER, + E_ENDCAP_EDGE, + H_ETA_0, + H_BARREL_ENDCAP, + H_ENDCAP_VFCAL, + H_VFCAL_EDGE, + T_TO_DISP, + T_FROM_DISP, + T_FROM_V0, + T_FROM_GAMMACONV, + GAMMA_TO_GAMMACONV + }; + + enum PFVertexType { + kCandVertex = 0, + kTrkVertex = 1, + kComMuonVertex = 2, + kSAMuonVertex = 3, + kTrkMuonVertex = 4, + kGSFVertex = 5, + kTPFMSMuonVertex = 6, + kPickyMuonVertex = 7, + kDYTMuonVertex = 8 + }; + + /// default constructor + PFCandidate(); + + /// constructor from a reference (keeps track of source relationship) + PFCandidate(const PFCandidatePtr& sourcePtr); + + /* PFCandidate( Charge q, */ + /* const LorentzVector & p4, */ + /* ParticleType particleId, */ + /* reco::PFBlockRef blockRef ); */ + PFCandidate(Charge q, const LorentzVector& p4, ParticleType particleId); + + /// copy constructor + PFCandidate(const PFCandidate&); + + /// destructor + ~PFCandidate() override; + + PFCandidate& operator=(PFCandidate const&); + + /// return a clone + PFCandidate* clone() const override; + + /* /// set source ref */ + /* void setSourceRef(const PFCandidateRef& ref) { sourceRef_ = ref; } */ + + /* size_type numberOfSourceCandidateRefs() const {return 1;} */ + + /* CandidateBaseRef sourceCandidateRef( size_type i ) const { */ + /* return CandidateBaseRef(sourceRef_); */ + /* } */ + + using reco::Candidate::setSourceCandidatePtr; + void setSourceCandidatePtr(const PFCandidatePtr& ptr) { sourcePtr_ = ptr; } + + size_t numberOfSourceCandidatePtrs() const override { return 1; } + + CandidatePtr sourceCandidatePtr(size_type i) const override { return sourcePtr_; } + + /// returns the pdg id corresponding to the particle type. + /// the particle type could be removed at some point to gain some space. + /// low priority + int translateTypeToPdgId(ParticleType type) const; + ParticleType translatePdgIdToType(int pdgid) const; + + /// set Particle Type + void setParticleType(ParticleType type); + + /// add an element to the current PFCandidate + /* void addElement( const reco::PFBlockElement* element ); */ + + /// add element in block + void addElementInBlock(const reco::PFBlockRef& blockref, unsigned elementIndex); + + /// set track reference + void setTrackRef(const reco::TrackRef& ref); + + /// return a reference to the corresponding track, if charged. + /// otherwise, return a null reference + reco::TrackRef trackRef() const; + + /// return a pointer to the best track, if available. + /// otherwise, return a null pointer + const reco::Track* bestTrack() const override { + if ((abs(pdgId()) == 11 || pdgId() == 22) && gsfTrackRef().isNonnull() && gsfTrackRef().isAvailable()) + return &(*gsfTrackRef()); + else if (trackRef().isNonnull() && trackRef().isAvailable()) + return &(*trackRef()); + else + return nullptr; + } + /// uncertainty on dz + float dzError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dzError(); + else + return 0; + } + /// uncertainty on dxy + float dxyError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dxyError(); + else + return 0; + } - CandidatePtr sourceCandidatePtr(size_type i) const override { return sourcePtr_; } + /// set gsftrack reference + void setGsfTrackRef(const reco::GsfTrackRef& ref); - /// returns the pdg id corresponding to the particle type. - /// the particle type could be removed at some point to gain some space. - /// low priority - int translateTypeToPdgId(ParticleType type) const; - ParticleType translatePdgIdToType(int pdgid) const; + /// return a reference to the corresponding GSF track, if an electron. + /// otherwise, return a null reference + reco::GsfTrackRef gsfTrackRef() const; - /// set Particle Type - void setParticleType(ParticleType type); + /// set muon reference + void setMuonRef(const reco::MuonRef& ref); - /// add an element to the current PFCandidate - /* void addElement( const reco::PFBlockElement* element ); */ + /// return a reference to the corresponding muon, if a muon. + /// otherwise, return a null reference + reco::MuonRef muonRef() const; - /// add element in block - void addElementInBlock(const reco::PFBlockRef& blockref, unsigned elementIndex); + /// set displaced vertex reference + void setDisplacedVertexRef(const reco::PFDisplacedVertexRef& ref, Flags flag); - /// set track reference - void setTrackRef(const reco::TrackRef& ref); + /// return a reference to the corresponding displaced vertex, + /// otherwise, return a null reference + reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const; - /// return a reference to the corresponding track, if charged. - /// otherwise, return a null reference - reco::TrackRef trackRef() const; + /// set ref to original reco conversion + void setConversionRef(const reco::ConversionRef& ref); - /// return a pointer to the best track, if available. - /// otherwise, return a null pointer - const reco::Track* bestTrack() const override { - if ((abs(pdgId()) == 11 || pdgId() == 22) && gsfTrackRef().isNonnull() && gsfTrackRef().isAvailable()) - return &(*gsfTrackRef()); - else if (trackRef().isNonnull() && trackRef().isAvailable()) - return &(*trackRef()); - else - return nullptr; - } - /// uncertainty on dz - float dzError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dzError(); - else - return 0; - } - /// uncertainty on dxy - float dxyError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dxyError(); - else - return 0; - } + /// return a reference to the original conversion + reco::ConversionRef conversionRef() const; - /// set gsftrack reference - void setGsfTrackRef(const reco::GsfTrackRef& ref); + /// set ref to original reco conversion + void setV0Ref(const reco::VertexCompositeCandidateRef& ref); - /// return a reference to the corresponding GSF track, if an electron. - /// otherwise, return a null reference - reco::GsfTrackRef gsfTrackRef() const; + /// return a reference to the original conversion + reco::VertexCompositeCandidateRef v0Ref() const; - /// set muon reference - void setMuonRef(const reco::MuonRef& ref); + /// return a reference to the corresponding GsfElectron if any + reco::GsfElectronRef gsfElectronRef() const; - /// return a reference to the corresponding muon, if a muon. - /// otherwise, return a null reference - reco::MuonRef muonRef() const; + /// return a reference to the electron extra + reco::PFCandidateElectronExtraRef electronExtraRef() const; - /// set displaced vertex reference - void setDisplacedVertexRef(const reco::PFDisplacedVertexRef& ref, Flags flag); + /// set corrected Ecal energy + void setEcalEnergy(float eeRaw, float eeCorr) { + rawEcalEnergy_ = eeRaw; + ecalERatio_ = std::abs(eeRaw) < 1.e-6 ? 1.0 : eeCorr / eeRaw; + } - /// return a reference to the corresponding displaced vertex, - /// otherwise, return a null reference - reco::PFDisplacedVertexRef displacedVertexRef(Flags type) const; + /// return corrected Ecal energy + double ecalEnergy() const { return ecalERatio_ * rawEcalEnergy_; } - /// set ref to original reco conversion - void setConversionRef(const reco::ConversionRef& ref); + /// return corrected Ecal energy + double rawEcalEnergy() const { return rawEcalEnergy_; } - /// return a reference to the original conversion - reco::ConversionRef conversionRef() const; + /// set corrected Hcal energy + void setHcalEnergy(float ehRaw, float ehCorr) { + rawHcalEnergy_ = ehRaw; + hcalERatio_ = std::abs(ehRaw) < 1.e-6 ? 1.0 : ehCorr / ehRaw; + } - /// set ref to original reco conversion - void setV0Ref(const reco::VertexCompositeCandidateRef& ref); + /// return corrected Hcal energy + double hcalEnergy() const { return hcalERatio_ * rawHcalEnergy_; } - /// return a reference to the original conversion - reco::VertexCompositeCandidateRef v0Ref() const; + /// return raw Hcal energy + double rawHcalEnergy() const { return rawHcalEnergy_; } - /// return a reference to the corresponding GsfElectron if any - reco::GsfElectronRef gsfElectronRef() const; + /// set corrected Hcal energy + void setHoEnergy(float eoRaw, float eoCorr) { + rawHoEnergy_ = eoRaw; + hoERatio_ = std::abs(eoRaw) < 1.e-6 ? 1.0 : eoCorr / eoRaw; + } - /// return a reference to the electron extra - reco::PFCandidateElectronExtraRef electronExtraRef() const; + /// return corrected Hcal energy + double hoEnergy() const { return hoERatio_ * rawHoEnergy_; } - /// set corrected Ecal energy - void setEcalEnergy(float eeRaw, float eeCorr) { - rawEcalEnergy_ = eeRaw; - ecalERatio_ = std::abs(eeRaw) < 1.e-6 ? 1.0 : eeCorr / eeRaw; - } + /// return raw Hcal energy + double rawHoEnergy() const { return rawHoEnergy_; } - /// return corrected Ecal energy - double ecalEnergy() const { return ecalERatio_ * rawEcalEnergy_; } + /// set GsfElectronRef + void setGsfElectronRef(const reco::GsfElectronRef& ref); - /// return corrected Ecal energy - double rawEcalEnergy() const { return rawEcalEnergy_; } + void setSuperClusterRef(const reco::SuperClusterRef& scRef); - /// set corrected Hcal energy - void setHcalEnergy(float ehRaw, float ehCorr) { - rawHcalEnergy_ = ehRaw; - hcalERatio_ = std::abs(ehRaw) < 1.e-6 ? 1.0 : ehCorr / ehRaw; - } + /// return a reference to the corresponding SuperCluster if any + reco::SuperClusterRef superClusterRef() const; - /// return corrected Hcal energy - double hcalEnergy() const { return hcalERatio_ * rawHcalEnergy_; } + /// set ref to the corresponding reco::Photon if any + void setPhotonRef(const reco::PhotonRef& phRef); - /// return raw Hcal energy - double rawHcalEnergy() const { return rawHcalEnergy_; } + /// return a reference to the corresponding Photon if any + reco::PhotonRef photonRef() const; - /// set corrected Hcal energy - void setHoEnergy(float eoRaw, float eoCorr) { - rawHoEnergy_ = eoRaw; - hoERatio_ = std::abs(eoRaw) < 1.e-6 ? 1.0 : eoCorr / eoRaw; - } + /// set the PF Photon Extra Ref + void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef& ref); - /// return corrected Hcal energy - double hoEnergy() const { return hoERatio_ * rawHoEnergy_; } + /// return a reference to the photon extra + reco::PFCandidatePhotonExtraRef photonExtraRef() const; - /// return raw Hcal energy - double rawHoEnergy() const { return rawHoEnergy_; } + /// set the PF EGamma Extra Ref + void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef& ref); - /// set GsfElectronRef - void setGsfElectronRef(const reco::GsfElectronRef& ref); + /// return a reference to the EGamma extra + reco::PFCandidateEGammaExtraRef egammaExtraRef() const; - void setSuperClusterRef(const reco::SuperClusterRef& scRef); + /// set corrected PS1 energy + void setPs1Energy(float e1) { ps1Energy_ = e1; } - /// return a reference to the corresponding SuperCluster if any - reco::SuperClusterRef superClusterRef() const; + /// return corrected PS1 energy + double pS1Energy() const { return ps1Energy_; } - /// set ref to the corresponding reco::Photon if any - void setPhotonRef(const reco::PhotonRef& phRef); + /// set corrected PS2 energy + void setPs2Energy(float e2) { ps2Energy_ = e2; } - /// return a reference to the corresponding Photon if any - reco::PhotonRef photonRef() const; + /// return corrected PS2 energy + double pS2Energy() const { return ps2Energy_; } - /// set the PF Photon Extra Ref - void setPFPhotonExtraRef(const reco::PFCandidatePhotonExtraRef& ref); + /// particle momentum *= rescaleFactor + void rescaleMomentum(double rescaleFactor); - /// return a reference to the photon extra - reco::PFCandidatePhotonExtraRef photonExtraRef() const; + /// set a given flag + void setFlag(Flags theFlag, bool value); - /// set the PF EGamma Extra Ref - void setPFEGammaExtraRef(const reco::PFCandidateEGammaExtraRef& ref); + /// return a given flag + bool flag(Flags theFlag) const; - /// return a reference to the EGamma extra - reco::PFCandidateEGammaExtraRef egammaExtraRef() const; + /// set uncertainty on momentum + void setDeltaP(double dp) { deltaP_ = dp; } - /// set corrected PS1 energy - void setPs1Energy(float e1) { ps1Energy_ = e1; } + /// uncertainty on 3-momentum + double deltaP() const { return deltaP_; } - /// return corrected PS1 energy - double pS1Energy() const { return ps1Energy_; } + // int pdgId() const { return translateTypeToPdgId( particleId_ ); } - /// set corrected PS2 energy - void setPs2Energy(float e2) { ps2Energy_ = e2; } + /// set mva for electron-pion discrimination. + /// For charged particles, this variable is set + /// to 0 for particles that are not preided + /// to 1 otherwise + /// For neutral particles, it is set to the default value - /// return corrected PS2 energy - double pS2Energy() const { return ps2Energy_; } + void set_mva_Isolated(float mvaI) { mva_Isolated_ = mvaI; } + // mva for isolated electrons + float mva_Isolated() const { return mva_Isolated_; } - /// particle momentum *= rescaleFactor - void rescaleMomentum(double rescaleFactor); + void set_mva_e_pi(float mvaNI) { mva_e_pi_ = mvaNI; } + /// mva for electron-pion discrimination + float mva_e_pi() const { return mva_e_pi_; } - /// set a given flag - void setFlag(Flags theFlag, bool value); + /// set mva for electron-muon discrimination + void set_mva_e_mu(float mva) { mva_e_mu_ = mva; } - /// return a given flag - bool flag(Flags theFlag) const; + /// mva for electron-muon discrimination + float mva_e_mu() const { return mva_e_mu_; } - /// set uncertainty on momentum - void setDeltaP(double dp) { deltaP_ = dp; } + /// set mva for pi-muon discrimination + void set_mva_pi_mu(float mva) { mva_pi_mu_ = mva; } - /// uncertainty on 3-momentum - double deltaP() const { return deltaP_; } + /// mva for pi-muon discrimination + float mva_pi_mu() const { return mva_pi_mu_; } - // int pdgId() const { return translateTypeToPdgId( particleId_ ); } + /// set mva for gamma detection + void set_mva_nothing_gamma(float mva) { mva_nothing_gamma_ = mva; } - /// set mva for electron-pion discrimination. - /// For charged particles, this variable is set - /// to 0 for particles that are not preided - /// to 1 otherwise - /// For neutral particles, it is set to the default value + /// mva for gamma detection + float mva_nothing_gamma() const { return mva_nothing_gamma_; } - void set_mva_Isolated(float mvaI) { mva_Isolated_ = mvaI; } - // mva for isolated electrons - float mva_Isolated() const { return mva_Isolated_; } + /// set mva for neutral hadron detection + void set_mva_nothing_nh(float mva) { mva_nothing_nh_ = mva; } - void set_mva_e_pi(float mvaNI) { mva_e_pi_ = mvaNI; } - /// mva for electron-pion discrimination - float mva_e_pi() const { return mva_e_pi_; } + /// mva for neutral hadron detection + float mva_nothing_nh() const { return mva_nothing_nh_; } - /// set mva for electron-muon discrimination - void set_mva_e_mu(float mva) { mva_e_mu_ = mva; } + /// set mva for neutral hadron - gamma discrimination + void set_mva_gamma_nh(float mva) { mva_gamma_nh_ = mva; } - /// mva for electron-muon discrimination - float mva_e_mu() const { return mva_e_mu_; } + // set DNN for electron PFID + // mva for ele PFID DNN sigIsolated class + float dnn_e_sigIsolated() const { return dnn_e_sigIsolated_; } + void set_dnn_e_sigIsolated(float mva) { dnn_e_sigIsolated_ = mva; } - /// set mva for pi-muon discrimination - void set_mva_pi_mu(float mva) { mva_pi_mu_ = mva; } + // mva for ele PFID DNN sigNonIsolated class + float dnn_e_sigNonIsolated() const { return dnn_e_sigNonIsolated_; } + void set_dnn_e_sigNonIsolated(float mva) { dnn_e_sigNonIsolated_ = mva; } - /// mva for pi-muon discrimination - float mva_pi_mu() const { return mva_pi_mu_; } + // mva for ele PFID DNN bkgNonIsolated class + float dnn_e_bkgNonIsolated() const { return dnn_e_bkgNonIsolated_; } + void set_dnn_e_bkgNonIsolated(float mva) { dnn_e_bkgNonIsolated_ = mva; } - /// set mva for gamma detection - void set_mva_nothing_gamma(float mva) { mva_nothing_gamma_ = mva; } + // mva for ele PFID DNN bkgTau class + float dnn_e_bkgTau() const { return dnn_e_bkgTau_; } + void set_dnn_e_bkgTau(float mva) { dnn_e_bkgTau_ = mva; } - /// mva for gamma detection - float mva_nothing_gamma() const { return mva_nothing_gamma_; } + // mva for ele PFID DNN bkgPhoton class + float dnn_e_bkgPhoton() const { return dnn_e_bkgPhoton_; } + void set_dnn_e_bkgPhoton(float mva) { dnn_e_bkgPhoton_ = mva; } - /// set mva for neutral hadron detection - void set_mva_nothing_nh(float mva) { mva_nothing_nh_ = mva; } + // set DNN for gamma PFID + float dnn_gamma() const { return dnn_gamma_; } + void set_dnn_gamma(float mva) { dnn_gamma_ = mva; } - /// mva for neutral hadron detection - float mva_nothing_nh() const { return mva_nothing_nh_; } + /// mva for neutral hadron - gamma discrimination + float mva_gamma_nh() const { return mva_gamma_nh_; } - /// set mva for neutral hadron - gamma discrimination - void set_mva_gamma_nh(float mva) { mva_gamma_nh_ = mva; } + /// set position at ECAL entrance + void setPositionAtECALEntrance(const math::XYZPointF& pos) { positionAtECALEntrance_ = pos; } - // set DNN for electron PFID - // mva for ele PFID DNN sigIsolated class - float dnn_e_sigIsolated() const { return dnn_e_sigIsolated_; } - void set_dnn_e_sigIsolated(float mva) { dnn_e_sigIsolated_ = mva; } + /// set the PF Electron Extra Ref + void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef& ref); - // mva for ele PFID DNN sigNonIsolated class - float dnn_e_sigNonIsolated() const { return dnn_e_sigNonIsolated_; } - void set_dnn_e_sigNonIsolated(float mva) { dnn_e_sigNonIsolated_ = mva; } + /// set the Best Muon Track Ref + void setMuonTrackType(const reco::Muon::MuonTrackType& type) { muonTrackType_ = type; } - // mva for ele PFID DNN bkgNonIsolated class - float dnn_e_bkgNonIsolated() const { return dnn_e_bkgNonIsolated_; } - void set_dnn_e_bkgNonIsolated(float mva) { dnn_e_bkgNonIsolated_ = mva; } + /// get the Best Muon Track Ref - // mva for ele PFID DNN bkgTau class - float dnn_e_bkgTau() const { return dnn_e_bkgTau_; } - void set_dnn_e_bkgTau(float mva) { dnn_e_bkgTau_ = mva; } + const reco::Muon::MuonTrackType bestMuonTrackType() const { return muonTrackType_; } - // mva for ele PFID DNN bkgPhoton class - float dnn_e_bkgPhoton() const { return dnn_e_bkgPhoton_; } - void set_dnn_e_bkgPhoton(float mva) { dnn_e_bkgPhoton_ = mva; } + /// \return position at ECAL entrance + const math::XYZPointF& positionAtECALEntrance() const { return positionAtECALEntrance_; } - // set DNN for gamma PFID - float dnn_gamma() const { return dnn_gamma_; } - void set_dnn_gamma(float mva) { dnn_gamma_ = mva; } + /// particle identification code + /// \todo use Particle::pdgId_ and remove this data member + virtual ParticleType particleId() const { return translatePdgIdToType(pdgId()); } - /// mva for neutral hadron - gamma discrimination - float mva_gamma_nh() const { return mva_gamma_nh_; } + /// return indices of elements used in the block + /* const std::vector& elementIndices() const { */ + /* return elementIndices_; */ + /* } */ + /// return elements + /* const edm::OwnVector< reco::PFBlockElement >& elements() const */ + /* {return elements_;} */ - /// set position at ECAL entrance - void setPositionAtECALEntrance(const math::XYZPointF& pos) { positionAtECALEntrance_ = pos; } + /// return elements in blocks + typedef std::pair ElementInBlock; + typedef std::vector ElementsInBlocks; - /// set the PF Electron Extra Ref - void setPFElectronExtraRef(const reco::PFCandidateElectronExtraRef& ref); + typedef edm::RefVector Blocks; + typedef std::vector Elements; - /// set the Best Muon Track Ref - void setMuonTrackType(const reco::Muon::MuonTrackType& type) { muonTrackType_ = type; } + const ElementsInBlocks& elementsInBlocks() const; - /// get the Best Muon Track Ref + static constexpr float bigMva_ = -999.; - const reco::Muon::MuonTrackType bestMuonTrackType() const { return muonTrackType_; } + friend std::ostream& operator<<(std::ostream& out, const PFCandidate& c); - /// \return position at ECAL entrance - const math::XYZPointF& positionAtECALEntrance() const { return positionAtECALEntrance_; } + const Point& vertex() const override; + double vx() const override { return vertex().x(); } + double vy() const override { return vertex().y(); } + double vz() const override { return vertex().z(); } - /// particle identification code - /// \todo use Particle::pdgId_ and remove this data member - virtual ParticleType particleId() const { return translatePdgIdToType(pdgId()); } + /// do we have a valid time information + bool isTimeValid() const { return timeError_ >= 0.f; } + /// \return the timing + float time() const { return time_; } + /// \return the timing uncertainty + float timeError() const { return timeError_; } + /// \set the timing information + void setTime(float time, float timeError = 0.f) { + time_ = time; + timeError_ = timeError; + } - /// return indices of elements used in the block - /* const std::vector& elementIndices() const { */ - /* return elementIndices_; */ - /* } */ - /// return elements - /* const edm::OwnVector< reco::PFBlockElement >& elements() const */ - /* {return elements_;} */ + /// fraction of hcal energy at a given depth (depth = 1 .. 7) + float hcalDepthEnergyFraction(unsigned int depth) const { return hcalDepthEnergyFractions_[depth - 1]; } + /// fraction of hcal energy at a given depth (index 0..6 for depth 1..7) + const std::array& hcalDepthEnergyFractions() const { return hcalDepthEnergyFractions_; } + /// set the fraction of hcal energy as function of depth (index 0..6 for depth 1..7) + void setHcalDepthEnergyFractions(const std::array& fracs) { hcalDepthEnergyFractions_ = fracs; } - /// return elements in blocks - typedef std::pair ElementInBlock; - typedef std::vector ElementsInBlocks; + private: + //function used before PR #31456, retained for backwards compatibility with old AOD where the vertex was not embedded + const math::XYZPoint& vertexLegacy(PFCandidate::PFVertexType vertexType) const; - typedef edm::RefVector Blocks; - typedef std::vector Elements; + /// Polymorphic overlap + bool overlap(const Candidate&) const override; - const ElementsInBlocks& elementsInBlocks() const; + void setFlag(unsigned shift, unsigned flag, bool value); - static constexpr float bigMva_ = -999.; - - friend std::ostream& operator<<(std::ostream& out, const PFCandidate& c); - - const Point& vertex() const override; - double vx() const override { return vertex().x(); } - double vy() const override { return vertex().y(); } - double vz() const override { return vertex().z(); } - - /// do we have a valid time information - bool isTimeValid() const { return timeError_ >= 0.f; } - /// \return the timing - float time() const { return time_; } - /// \return the timing uncertainty - float timeError() const { return timeError_; } - /// \set the timing information - void setTime(float time, float timeError = 0.f) { - time_ = time; - timeError_ = timeError; - } - - /// fraction of hcal energy at a given depth (depth = 1 .. 7) - float hcalDepthEnergyFraction(unsigned int depth) const { return hcalDepthEnergyFractions_[depth - 1]; } - /// fraction of hcal energy at a given depth (index 0..6 for depth 1..7) - const std::array& hcalDepthEnergyFractions() const { return hcalDepthEnergyFractions_; } - /// set the fraction of hcal energy as function of depth (index 0..6 for depth 1..7) - void setHcalDepthEnergyFractions(const std::array& fracs) { hcalDepthEnergyFractions_ = fracs; } - - private: - //function used before PR #31456, retained for backwards compatibility with old AOD where the vertex was not embedded - const math::XYZPoint& vertexLegacy(PFCandidate::PFVertexType vertexType) const; - - /// Polymorphic overlap - bool overlap(const Candidate&) const override; - - void setFlag(unsigned shift, unsigned flag, bool value); - - bool flag(unsigned shift, unsigned flag) const; + bool flag(unsigned shift, unsigned flag) const; #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) - mutable std::atomic elementsInBlocks_; + mutable std::atomic elementsInBlocks_; #else - mutable ElementsInBlocks* elementsInBlocks_; + mutable ElementsInBlocks* elementsInBlocks_; #endif - Blocks blocksStorage_; - Elements elementsStorage_; + Blocks blocksStorage_; + Elements elementsStorage_; - /// reference to the source PFCandidate, if any - /* PFCandidateRef sourceRef_; */ - PFCandidatePtr sourcePtr_; + /// reference to the source PFCandidate, if any + /* PFCandidateRef sourceRef_; */ + PFCandidatePtr sourcePtr_; - ///Reference to the best track if it is a muon - ///pF is allowed to switch the default muon track - reco::Muon::MuonTrackType muonTrackType_; + ///Reference to the best track if it is a muon + ///pF is allowed to switch the default muon track + reco::Muon::MuonTrackType muonTrackType_; - /// corrected ECAL energy ratio (corrected/raw) - float ecalERatio_; + /// corrected ECAL energy ratio (corrected/raw) + float ecalERatio_; - /// corrected HCAL energy ratio (corrected/raw) - float hcalERatio_; + /// corrected HCAL energy ratio (corrected/raw) + float hcalERatio_; - /// corrected HO energy ratio (corrected/raw) - float hoERatio_; + /// corrected HO energy ratio (corrected/raw) + float hoERatio_; - /// raw ECAL energy - float rawEcalEnergy_; + /// raw ECAL energy + float rawEcalEnergy_; - /// raw HCAL energy - float rawHcalEnergy_; + /// raw HCAL energy + float rawHcalEnergy_; - /// raw HO energy - float rawHoEnergy_; + /// raw HO energy + float rawHoEnergy_; - /// corrected PS1 energy - float ps1Energy_; + /// corrected PS1 energy + float ps1Energy_; - /// corrected PS2 energy - float ps2Energy_; + /// corrected PS2 energy + float ps2Energy_; - /// all flags, packed (ecal regional, hcal regional, tracking) - unsigned flags_; + /// all flags, packed (ecal regional, hcal regional, tracking) + unsigned flags_; - /// uncertainty on 3-momentum - float deltaP_; + /// uncertainty on 3-momentum + float deltaP_; - //legacy vertex type to read AOD created before PR #31456 - PFVertexType vertexType_; + //legacy vertex type to read AOD created before PR #31456 + PFVertexType vertexType_; - // mva for isolated electrons - float mva_Isolated_; + // mva for isolated electrons + float mva_Isolated_; - /// mva for electron-pion discrimination - float mva_e_pi_; + /// mva for electron-pion discrimination + float mva_e_pi_; - /// mva for electron-muon discrimination - float mva_e_mu_; + /// mva for electron-muon discrimination + float mva_e_mu_; - /// mva for pi-muon discrimination - float mva_pi_mu_; + /// mva for pi-muon discrimination + float mva_pi_mu_; - /// mva for gamma detection - float mva_nothing_gamma_; + /// mva for gamma detection + float mva_nothing_gamma_; - /// mva for neutral hadron detection - float mva_nothing_nh_; + /// mva for neutral hadron detection + float mva_nothing_nh_; - /// mva for neutral hadron - gamma discrimination - float mva_gamma_nh_; + /// mva for neutral hadron - gamma discrimination + float mva_gamma_nh_; - /// DNN for electron PFid: isolated signal - float dnn_e_sigIsolated_; + /// DNN for electron PFid: isolated signal + float dnn_e_sigIsolated_; - /// DNN for electron PFid: non-isolated signal - float dnn_e_sigNonIsolated_; + /// DNN for electron PFid: non-isolated signal + float dnn_e_sigNonIsolated_; - /// DNN for electron PFid: non-isolated bkg - float dnn_e_bkgNonIsolated_; + /// DNN for electron PFid: non-isolated bkg + float dnn_e_bkgNonIsolated_; - /// DNN for electron PFid: tau bkg - float dnn_e_bkgTau_; + /// DNN for electron PFid: tau bkg + float dnn_e_bkgTau_; - /// DNN for electron PFid: photon bkg - float dnn_e_bkgPhoton_; + /// DNN for electron PFid: photon bkg + float dnn_e_bkgPhoton_; - // DNN for gamma PFid - float dnn_gamma_; + // DNN for gamma PFid + float dnn_gamma_; - /// position at ECAL entrance, from the PFRecTrack - math::XYZPointF positionAtECALEntrance_; + /// position at ECAL entrance, from the PFRecTrack + math::XYZPointF positionAtECALEntrance_; - //more efficiently stored refs - void storeRefInfo(unsigned int iMask, - unsigned int iBit, - bool iIsValid, - const edm::RefCore& iCore, - size_t iKey, - const edm::EDProductGetter*); - bool getRefInfo( - unsigned int iMask, unsigned int iBit, edm::ProductID& oProdID, size_t& oIndex, size_t& aIndex) const; + //more efficiently stored refs + void storeRefInfo(unsigned int iMask, + unsigned int iBit, + bool iIsValid, + const edm::RefCore& iCore, + size_t iKey, + const edm::EDProductGetter*); + bool getRefInfo( + unsigned int iMask, unsigned int iBit, edm::ProductID& oProdID, size_t& oIndex, size_t& aIndex) const; - const edm::EDProductGetter* getter_; //transient - unsigned short storedRefsBitPattern_; - std::vector refsInfo_; - std::vector refsCollectionCache_; + const edm::EDProductGetter* getter_; //transient + unsigned short storedRefsBitPattern_; + std::vector refsInfo_; + std::vector refsCollectionCache_; - /// timing information (valid if timeError_ >= 0) - float time_; - /// timing information uncertainty (<0 if timing not available) - float timeError_; + /// timing information (valid if timeError_ >= 0) + float time_; + /// timing information uncertainty (<0 if timing not available) + float timeError_; - std::array hcalDepthEnergyFractions_; - }; - - /// particle ID component tag - struct PFParticleIdTag {}; + std::array hcalDepthEnergyFractions_; + }; - /// get default PFBlockRef component - /// as: pfcand->get(); - /* GET_DEFAULT_CANDIDATE_COMPONENT( PFCandidate, PFBlockRef, block ); */ + /// get default PFBlockRef component + /// as: pfcand->get(); + /* GET_DEFAULT_CANDIDATE_COMPONENT( PFCandidate, PFBlockRef, block ); */ - /// get int component - /// as: pfcand->get(); - GET_CANDIDATE_COMPONENT(PFCandidate, PFCandidate::ParticleType, particleId, PFParticleIdTag); + /// get int component + /// as: pfcand->get(); - std::ostream& operator<<(std::ostream& out, const PFCandidate& c); + std::ostream& operator<<(std::ostream& out, const PFCandidate& c); + } // namespace io_v1 + using PFCandidate = io_v1::PFCandidate; + /// particle ID component tag + struct PFParticleIdTag {}; + GET_CANDIDATE_COMPONENT(PFCandidate, PFCandidate::ParticleType, particleId, PFParticleIdTag); } // namespace reco #endif diff --git a/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h b/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h index b331f3867ebf2..e4532db72d94c 100644 --- a/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h +++ b/DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h @@ -9,8 +9,10 @@ #include "DataFormats/Common/interface/FwdPtr.h" namespace reco { - class PFCandidate; - + namespace io_v1 { + class PFCandidate; + } + using PFCandidate = io_v1::PFCandidate; /// collection of PFCandidates typedef std::vector PFCandidateCollection; diff --git a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc index 8763e0a2324c2..f4964b4ceed8a 100644 --- a/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc +++ b/DataFormats/ParticleFlowCandidate/src/PFCandidate.cc @@ -65,7 +65,7 @@ PFCandidate::PFCandidate(const PFCandidatePtr& sourcePtr) : PFCandidate(*sourceP } PFCandidate::PFCandidate(Charge charge, const LorentzVector& p4, ParticleType partId) - : CompositeCandidate(charge, p4), + : LeafCandidate(charge, p4), elementsInBlocks_(nullptr), ecalERatio_(1.), hcalERatio_(1.), @@ -123,7 +123,7 @@ PFCandidate::PFCandidate(Charge charge, const LorentzVector& p4, ParticleType pa } PFCandidate::PFCandidate(PFCandidate const& iOther) - : CompositeCandidate(iOther), + : LeafCandidate(static_cast(iOther)), elementsInBlocks_(nullptr), blocksStorage_(iOther.blocksStorage_), elementsStorage_(iOther.elementsStorage_), @@ -168,7 +168,7 @@ PFCandidate::PFCandidate(PFCandidate const& iOther) } PFCandidate& PFCandidate::operator=(PFCandidate const& iOther) { - CompositeCandidate::operator=(iOther); + LeafCandidate::operator=(iOther); auto tmp = iOther.elementsInBlocks_.load(std::memory_order_acquire); if (nullptr != tmp) { delete elementsInBlocks_.exchange(new ElementsInBlocks{*tmp}, std::memory_order_acq_rel); @@ -312,7 +312,7 @@ void PFCandidate::setFlag(Flags theFlag, bool value) { bool PFCandidate::flag(Flags theFlag) const { return (flags_ >> theFlag) & 1; } -ostream& reco::operator<<(ostream& out, const PFCandidate& c) { +ostream& reco::io_v1::operator<<(ostream& out, const PFCandidate& c) { if (!out) return out; diff --git a/DataFormats/ParticleFlowCandidate/src/classes_def.xml b/DataFormats/ParticleFlowCandidate/src/classes_def.xml index 83c9b00fd7441..05b041b032a7c 100644 --- a/DataFormats/ParticleFlowCandidate/src/classes_def.xml +++ b/DataFormats/ParticleFlowCandidate/src/classes_def.xml @@ -1,70 +1,54 @@ - - - - - - - - - - - - + + - + - + - + - - - - + + + + - - - + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - + + @@ -73,14 +57,8 @@ - - - - - - - - + + @@ -90,15 +68,15 @@ - + - - + + @@ -109,13 +87,8 @@ - - - - + + @@ -141,34 +114,34 @@ - - - - + + + + - + - - - - - + + + + + - - - + + + - - - - + + + + - + diff --git a/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h b/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h index 46b2818177396..0c4af5b6186fe 100644 --- a/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h +++ b/DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h @@ -9,29 +9,32 @@ #include "DataFormats/ParticleFlowReco/interface/PFCluster.h" namespace reco { - class HGCalMultiCluster : public reco::PFCluster { - public: - typedef edm::PtrVector::const_iterator component_iterator; - typedef edm::PtrVector ClusterCollection; + namespace io_v1 { + class HGCalMultiCluster : public reco::PFCluster { + public: + typedef edm::PtrVector::const_iterator component_iterator; + typedef edm::PtrVector ClusterCollection; - HGCalMultiCluster() : PFCluster() { this->setLayer(PFLayer::HGCAL); } + HGCalMultiCluster() : PFCluster() { this->setLayer(PFLayer::HGCAL); } - HGCalMultiCluster(double energy, double x, double y, double z, ClusterCollection& thecls); + HGCalMultiCluster(double energy, double x, double y, double z, ClusterCollection& thecls); - void push_back(const edm::Ptr& b) { myclusters.push_back(b); } + void push_back(const edm::Ptr& b) { myclusters.push_back(b); } - const edm::PtrVector& clusters() const { return myclusters; } + const edm::PtrVector& clusters() const { return myclusters; } - unsigned int size() const { return myclusters.size(); } - component_iterator begin() const { return myclusters.begin(); } - component_iterator end() const { return myclusters.end(); } + unsigned int size() const { return myclusters.size(); } + component_iterator begin() const { return myclusters.begin(); } + component_iterator end() const { return myclusters.end(); } - bool operator>(const HGCalMultiCluster& rhs) const { return (energy() > rhs.energy()); } + bool operator>(const HGCalMultiCluster& rhs) const { return (energy() > rhs.energy()); } - private: - edm::PtrVector myclusters; - }; + private: + edm::PtrVector myclusters; + }; + } // namespace io_v1 + using HGCalMultiCluster = io_v1::HGCalMultiCluster; typedef std::vector HGCalMultiClusterCollection; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlock.h b/DataFormats/ParticleFlowReco/interface/PFBlock.h index f4a9e109d8636..49d0769dfc895 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlock.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlock.h @@ -12,9 +12,10 @@ #include "DataFormats/Common/interface/OwnVector.h" namespace reco { + namespace io_v1 { - /// \brief Block of elements - /*! + /// \brief Block of elements + /*! \author Colin Bernet \date January 2006 @@ -23,86 +24,88 @@ namespace reco { - a set of links between these elements */ - class PFBlock { - public: - struct Link { - Link() : distance(-1), test(0) {} - Link(float d, char t) : distance(d), test(t) {} - float distance; - char test; - }; + class PFBlock { + public: + struct Link { + Link() : distance(-1), test(0) {} + Link(float d, char t) : distance(d), test(t) {} + float distance; + char test; + }; - typedef edm::OwnVector::const_iterator IE; - /* typedef std::vector< reco::PFBlockLink >::const_iterator IL; */ + typedef edm::OwnVector::const_iterator IE; + /* typedef std::vector< reco::PFBlockLink >::const_iterator IL; */ - // typedef std::vector< std::vector > LinkData; - typedef std::map LinkData; + // typedef std::vector< std::vector > LinkData; + typedef std::map LinkData; - enum LinkTest { LINKTEST_RECHIT, LINKTEST_NLINKTEST, LINKTEST_ALL }; + enum LinkTest { LINKTEST_RECHIT, LINKTEST_NLINKTEST, LINKTEST_ALL }; - PFBlock() {} - // PFBlock(const PFBlock& other); + PFBlock() {} + // PFBlock(const PFBlock& other); - /// add an element to the current PFBlock - /// the block will keep a copy. - void addElement(reco::PFBlockElement* element); + /// add an element to the current PFBlock + /// the block will keep a copy. + void addElement(reco::PFBlockElement* element); - void bookLinkData(); + void bookLinkData(); - /// makes the correspondance between a 2d element matrix and - /// the 1D vector which is the most compact way to store the matrix - bool matrix2vector(unsigned i, unsigned j, unsigned& index) const; + /// makes the correspondance between a 2d element matrix and + /// the 1D vector which is the most compact way to store the matrix + bool matrix2vector(unsigned i, unsigned j, unsigned& index) const; - /// set a link between elements of indices i1 and i2, of "distance" dist - /// the link is set in the linkData vector provided as an argument. - /// As indicated by the 'const' statement, 'this' is not modified. - void setLink(unsigned i1, unsigned i2, double dist, LinkData& linkData, LinkTest test = LINKTEST_RECHIT) const; + /// set a link between elements of indices i1 and i2, of "distance" dist + /// the link is set in the linkData vector provided as an argument. + /// As indicated by the 'const' statement, 'this' is not modified. + void setLink(unsigned i1, unsigned i2, double dist, LinkData& linkData, LinkTest test = LINKTEST_RECHIT) const; - /// lock an element ( unlink it from the others ) - /// Colin: this function is misleading - /// void lock(unsigned i, LinkData& linkData ) const; + /// lock an element ( unlink it from the others ) + /// Colin: this function is misleading + /// void lock(unsigned i, LinkData& linkData ) const; - /// fills a map with the elements associated to element i. - /// elements are sorted by increasing distance. - /// if specified, only the elements of type "type" will be considered - /// if specified, only the link calculated from a certain "test" will - /// be considered: distance test, etc.. - void associatedElements(unsigned i, - const LinkData& linkData, - std::multimap& sortedAssociates, - reco::PFBlockElement::Type type = PFBlockElement::NONE, - LinkTest test = LINKTEST_RECHIT) const; + /// fills a map with the elements associated to element i. + /// elements are sorted by increasing distance. + /// if specified, only the elements of type "type" will be considered + /// if specified, only the link calculated from a certain "test" will + /// be considered: distance test, etc.. + void associatedElements(unsigned i, + const LinkData& linkData, + std::multimap& sortedAssociates, + reco::PFBlockElement::Type type = PFBlockElement::NONE, + LinkTest test = LINKTEST_RECHIT) const; - /// \return distance of link - double dist(unsigned ie1, unsigned ie2, const LinkData& linkData, LinkTest test) const { - return dist(ie1, ie2, linkData); - } + /// \return distance of link + double dist(unsigned ie1, unsigned ie2, const LinkData& linkData, LinkTest test) const { + return dist(ie1, ie2, linkData); + } - /// \return distance of link - double dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const; + /// \return distance of link + double dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const; - /// \return elements - const edm::OwnVector& elements() const { return elements_; } + /// \return elements + const edm::OwnVector& elements() const { return elements_; } - /// \return link data - const LinkData& linkData() const { return linkData_; } + /// \return link data + const LinkData& linkData() const { return linkData_; } - /// \return link data - LinkData& linkData() { return linkData_; } + /// \return link data + LinkData& linkData() { return linkData_; } - private: - /// \return size of linkData_, calculated from the number of elements - unsigned linkDataSize() const; + private: + /// \return size of linkData_, calculated from the number of elements + unsigned linkDataSize() const; - /// link data (permanent) - LinkData linkData_; + /// link data (permanent) + LinkData linkData_; - /// all elements - edm::OwnVector elements_; - }; + /// all elements + edm::OwnVector elements_; + }; - std::ostream& operator<<(std::ostream& out, const PFBlock& co); + std::ostream& operator<<(std::ostream& out, const PFBlock& co); + } // namespace io_v1 + using PFBlock = io_v1::PFBlock; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElement.h b/DataFormats/ParticleFlowReco/interface/PFBlockElement.h index b5c44e4e9e478..2319c4d1955f6 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElement.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElement.h @@ -16,159 +16,166 @@ #include namespace reco { - class PFBlockElementCluster; - class PFBlockElementTrack; - - /// \brief Abstract base class for a PFBlock element (track, cluster...) - /// - /// this class contains a PFRecTrackRef of a - /// PFClusterRef, depending on the type of the element - class PFBlockElement { - public: - /// possible types for the element - /// do not modify this enum if you don't know what you're doing!!! - enum Type { - NONE = 0, - TRACK = 1, - PS1 = 2, - PS2 = 3, - ECAL = 4, - HCAL = 5, - GSF = 6, - BREM = 7, - HFEM = 8, - HFHAD = 9, - SC = 10, - HO = 11, - HGCAL = 12, - kNBETypes = 13 + namespace io_v1 { + + class PFBlockElementCluster; + class PFBlockElementTrack; + + /// \brief Abstract base class for a PFBlock element (track, cluster...) + /// + /// this class contains a PFRecTrackRef of a + /// PFClusterRef, depending on the type of the element + class PFBlockElement { + public: + /// possible types for the element + /// do not modify this enum if you don't know what you're doing!!! + enum Type { + NONE = 0, + TRACK = 1, + PS1 = 2, + PS2 = 3, + ECAL = 4, + HCAL = 5, + GSF = 6, + BREM = 7, + HFEM = 8, + HFHAD = 9, + SC = 10, + HO = 11, + HGCAL = 12, + kNBETypes = 13 + }; + + enum TrackType { DEFAULT = 0, T_FROM_DISP, T_TO_DISP, T_FROM_GAMMACONV, MUON, T_FROM_V0 }; + + /// standard constructor + PFBlockElement(Type type = NONE) + : type_(type), locked_(false), index_(static_cast(-1)), time_(0.f), timeError_(-1.f) {} + + /// destructor + virtual ~PFBlockElement() {} + + /// print the object inside the element + virtual void Dump(std::ostream& out = std::cout, const char* tab = " ") const; + + /// necessary to have the edm::OwnVector working + virtual PFBlockElement* clone() const = 0; + + /// lock element + void lock() { locked_ = true; } + + /// unlock element + void unLock() { locked_ = false; } + + /// \return type + Type type() const { return type_; } + + /// \return tracktype + virtual bool trackType(TrackType trType) const { return false; } + + /// \set the trackType + virtual void setTrackType(TrackType trType, bool value) { + std::cout << "Error in PFBlockElement::setTrackType : this base class method is not implemented" << std::endl; + } + + /// locked ? + bool locked() const { return locked_; } + + /// set index + void setIndex(unsigned index) { index_ = index; } + + /// \return index + unsigned index() const { return index_; } + + virtual const reco::TrackRef& trackRef() const { return nullTrack_; } + virtual const PFRecTrackRef& trackRefPF() const { return nullPFRecTrack_; } + virtual const PFClusterRef& clusterRef() const { return nullPFCluster_; } + virtual const PFDisplacedTrackerVertexRef& displacedVertexRef(TrackType trType) const { + return nullPFDispVertex_; + } + virtual const ConversionRefVector& convRefs() const { return nullConv_; } + virtual const MuonRef& muonRef() const { return nullMuon_; } + virtual const VertexCompositeCandidateRef& V0Ref() const { return nullVertex_; } + virtual void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef& niref, TrackType trType) { + std::cout << "Error in PFBlockElement::setDisplacedVertexRef : this base class method is not implemented" + << std::endl; + } + virtual void setConversionRef(const ConversionRef& convRef, TrackType trType) { + std::cout << "Error in PFBlockElement::setConversionRef : this base class method is not implemented" + << std::endl; + } + virtual void setMuonRef(const MuonRef& muref) { + std::cout << "Error in PFBlockElement::setMuonRef : this base class method is not implemented" << std::endl; + } + virtual void setV0Ref(const VertexCompositeCandidateRef& v0ref, TrackType trType) { + std::cout << "Error in PFBlockElement::setV0Ref : this base class method is not implemented" << std::endl; + } + + virtual bool isSecondary() const { return false; } + virtual bool isPrimary() const { return false; } + virtual bool isLinkedToDisplacedVertex() const { return false; } + + // Glowinski & Gouzevitch + void setMultilinks(const PFMultiLinksTC& ml, Type type) { multilinks_[type] = ml; } + void setIsValidMultilinks(bool isVal, Type type) { multilinks_[type].isValid = isVal; } + + bool isMultilinksValide(Type type) const { + const auto& it = multilinks_.find(type); + if (it != multilinks_.end()) + return it->second.isValid; + else + return false; // no multilinks_ for the specified type + } + const PFMultilinksType& getMultilinks(Type type) const { return multilinks_.at(type).linkedPFObjects; } + // ! Glowinski & Gouzevitch + + /// do we have a valid time information + bool isTimeValid() const { return timeError_ >= 0.f; } + /// \return the timing + float time() const { return time_; } + /// \return the timing uncertainty + float timeError() const { return timeError_; } + /// \set the timing information + void setTime(float time, float timeError = 0.f) { + time_ = time; + timeError_ = timeError; + } + + protected: + /// type, see PFBlockElementType + /// \todo replace by a char ? + Type type_; + + /// locked flag. + /// \todo can probably be transient. Could be replaced by a + /// "remaining energy". IS THIS STILL USED ? + bool locked_; + + /// index in block vector + unsigned index_; + + // Glowinski & Gouzevitch + // PFMultiLinks for each different link target type + std::map multilinks_; + // ! Glowinski & Gouzevitch + + /// timing information (valid if timeError_ >= 0) + float time_; + /// timing information uncertainty (<0 if timing not available) + float timeError_; + + const static reco::TrackRef nullTrack_; + const static PFRecTrackRef nullPFRecTrack_; + const static PFClusterRef nullPFCluster_; + const static PFDisplacedTrackerVertexRef nullPFDispVertex_; + const static ConversionRefVector nullConv_; + const static MuonRef nullMuon_; + const static VertexCompositeCandidateRef nullVertex_; }; - enum TrackType { DEFAULT = 0, T_FROM_DISP, T_TO_DISP, T_FROM_GAMMACONV, MUON, T_FROM_V0 }; - - /// standard constructor - PFBlockElement(Type type = NONE) - : type_(type), locked_(false), index_(static_cast(-1)), time_(0.f), timeError_(-1.f) {} - - /// destructor - virtual ~PFBlockElement() {} - - /// print the object inside the element - virtual void Dump(std::ostream& out = std::cout, const char* tab = " ") const; - - /// necessary to have the edm::OwnVector working - virtual PFBlockElement* clone() const = 0; - - /// lock element - void lock() { locked_ = true; } - - /// unlock element - void unLock() { locked_ = false; } - - /// \return type - Type type() const { return type_; } - - /// \return tracktype - virtual bool trackType(TrackType trType) const { return false; } - - /// \set the trackType - virtual void setTrackType(TrackType trType, bool value) { - std::cout << "Error in PFBlockElement::setTrackType : this base class method is not implemented" << std::endl; - } - - /// locked ? - bool locked() const { return locked_; } - - /// set index - void setIndex(unsigned index) { index_ = index; } - - /// \return index - unsigned index() const { return index_; } - - virtual const reco::TrackRef& trackRef() const { return nullTrack_; } - virtual const PFRecTrackRef& trackRefPF() const { return nullPFRecTrack_; } - virtual const PFClusterRef& clusterRef() const { return nullPFCluster_; } - virtual const PFDisplacedTrackerVertexRef& displacedVertexRef(TrackType trType) const { return nullPFDispVertex_; } - virtual const ConversionRefVector& convRefs() const { return nullConv_; } - virtual const MuonRef& muonRef() const { return nullMuon_; } - virtual const VertexCompositeCandidateRef& V0Ref() const { return nullVertex_; } - virtual void setDisplacedVertexRef(const PFDisplacedTrackerVertexRef& niref, TrackType trType) { - std::cout << "Error in PFBlockElement::setDisplacedVertexRef : this base class method is not implemented" - << std::endl; - } - virtual void setConversionRef(const ConversionRef& convRef, TrackType trType) { - std::cout << "Error in PFBlockElement::setConversionRef : this base class method is not implemented" << std::endl; - } - virtual void setMuonRef(const MuonRef& muref) { - std::cout << "Error in PFBlockElement::setMuonRef : this base class method is not implemented" << std::endl; - } - virtual void setV0Ref(const VertexCompositeCandidateRef& v0ref, TrackType trType) { - std::cout << "Error in PFBlockElement::setV0Ref : this base class method is not implemented" << std::endl; - } - - virtual bool isSecondary() const { return false; } - virtual bool isPrimary() const { return false; } - virtual bool isLinkedToDisplacedVertex() const { return false; } - - // Glowinski & Gouzevitch - void setMultilinks(const PFMultiLinksTC& ml, Type type) { multilinks_[type] = ml; } - void setIsValidMultilinks(bool isVal, Type type) { multilinks_[type].isValid = isVal; } - - bool isMultilinksValide(Type type) const { - const auto& it = multilinks_.find(type); - if (it != multilinks_.end()) - return it->second.isValid; - else - return false; // no multilinks_ for the specified type - } - const PFMultilinksType& getMultilinks(Type type) const { return multilinks_.at(type).linkedPFObjects; } - // ! Glowinski & Gouzevitch - - /// do we have a valid time information - bool isTimeValid() const { return timeError_ >= 0.f; } - /// \return the timing - float time() const { return time_; } - /// \return the timing uncertainty - float timeError() const { return timeError_; } - /// \set the timing information - void setTime(float time, float timeError = 0.f) { - time_ = time; - timeError_ = timeError; - } - - protected: - /// type, see PFBlockElementType - /// \todo replace by a char ? - Type type_; - - /// locked flag. - /// \todo can probably be transient. Could be replaced by a - /// "remaining energy". IS THIS STILL USED ? - bool locked_; - - /// index in block vector - unsigned index_; - - // Glowinski & Gouzevitch - // PFMultiLinks for each different link target type - std::map multilinks_; - // ! Glowinski & Gouzevitch - - /// timing information (valid if timeError_ >= 0) - float time_; - /// timing information uncertainty (<0 if timing not available) - float timeError_; - - const static reco::TrackRef nullTrack_; - const static PFRecTrackRef nullPFRecTrack_; - const static PFClusterRef nullPFCluster_; - const static PFDisplacedTrackerVertexRef nullPFDispVertex_; - const static ConversionRefVector nullConv_; - const static MuonRef nullMuon_; - const static VertexCompositeCandidateRef nullVertex_; - }; - - std::ostream& operator<<(std::ostream& out, const PFBlockElement& element); + std::ostream& operator<<(std::ostream& out, const PFBlockElement& element); + } // namespace io_v1 + using PFBlockElement = io_v1::PFBlockElement; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h b/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h index 5c39051b30860..c620f6b67d8e1 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockFwd.h @@ -7,7 +7,10 @@ /* #include "DataFormats/Common/interface/RefProd.h" */ namespace reco { - class PFBlock; + namespace io_v1 { + class PFBlock; + } + using PFBlock = io_v1::PFBlock; /// collection of PFBlock objects typedef std::vector PFBlockCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PFCluster.h b/DataFormats/ParticleFlowReco/interface/PFCluster.h index fed7e807557ee..a27217ab47c0c 100644 --- a/DataFormats/ParticleFlowReco/interface/PFCluster.h +++ b/DataFormats/ParticleFlowReco/interface/PFCluster.h @@ -18,8 +18,9 @@ class PFClusterAlgo; namespace reco { + namespace io_v1 { - /**\class PFCluster + /**\class PFCluster \brief Particle flow cluster, see clustering algorithm in PFClusterAlgo A particle flow cluster is defined by its energy and position, which are @@ -39,129 +40,131 @@ namespace reco { \author Colin Bernet \date July 2006 */ - class PFCluster : public CaloCluster { - public: - typedef std::vector>> EEtoPSAssociation; - // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, - // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase - // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. - typedef ROOT::Math::PositionVector3D> REPPoint; + class PFCluster : public CaloCluster { + public: + typedef std::vector>> EEtoPSAssociation; + // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5, + // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase + // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5. + typedef ROOT::Math::PositionVector3D> REPPoint; - PFCluster() : CaloCluster(CaloCluster::particleFlow), time_(-99.0), layer_(PFLayer::NONE) {} + PFCluster() : CaloCluster(CaloCluster::particleFlow), time_(-99.0), layer_(PFLayer::NONE) {} - /// constructor - PFCluster(PFLayer::Layer layer, double energy, double x, double y, double z); + /// constructor + PFCluster(PFLayer::Layer layer, double energy, double x, double y, double z); - /// resets clusters parameters - void reset(); + /// resets clusters parameters + void reset(); - /// reset only hits and fractions - void resetHitsAndFractions(); + /// reset only hits and fractions + void resetHitsAndFractions(); - /// add a given fraction of the rechit - void addRecHitFraction(const reco::PFRecHitFraction& frac); + /// add a given fraction of the rechit + void addRecHitFraction(const reco::PFRecHitFraction& frac); - /// vector of rechit fractions - const std::vector& recHitFractions() const { return rechits_; } + /// vector of rechit fractions + const std::vector& recHitFractions() const { return rechits_; } - /// set layer - void setLayer(PFLayer::Layer layer); + /// set layer + void setLayer(PFLayer::Layer layer); - /// cluster layer, see PFLayer.h in this directory - PFLayer::Layer layer() const; + /// cluster layer, see PFLayer.h in this directory + PFLayer::Layer layer() const; - /// cluster energy - double energy() const { return energy_; } + /// cluster energy + double energy() const { return energy_; } - /// \return cluster time - float time() const { return time_; } - /// \return the timing uncertainty - float timeError() const { return timeError_; } + /// \return cluster time + float time() const { return time_; } + /// \return the timing uncertainty + float timeError() const { return timeError_; } - /// cluster depth - double depth() const { return depth_; } + /// cluster depth + double depth() const { return depth_; } - void setTime(float time, float timeError = 0) { - time_ = time; - timeError_ = timeError; - } - void setTimeError(float timeError) { timeError_ = timeError; } - void setDepth(double depth) { depth_ = depth; } + void setTime(float time, float timeError = 0) { + time_ = time; + timeError_ = timeError; + } + void setTimeError(float timeError) { timeError_ = timeError; } + void setDepth(double depth) { depth_ = depth; } - /// cluster position: rho, eta, phi - const REPPoint& positionREP() const { return posrep_; } + /// cluster position: rho, eta, phi + const REPPoint& positionREP() const { return posrep_; } - /// computes posrep_ once and for all - void calculatePositionREP() { posrep_.SetCoordinates(position_.Rho(), position_.Eta(), position_.Phi()); } + /// computes posrep_ once and for all + void calculatePositionREP() { posrep_.SetCoordinates(position_.Rho(), position_.Eta(), position_.Phi()); } - /// \todo move to PFClusterTools - static double getDepthCorrection(double energy, bool isBelowPS = false, bool isHadron = false); + /// \todo move to PFClusterTools + static double getDepthCorrection(double energy, bool isBelowPS = false, bool isHadron = false); - /// some classes to make this fit into a template footprint - /// for RecoPFClusterRefCandidate so we can make jets and MET - /// out of PFClusters. + /// some classes to make this fit into a template footprint + /// for RecoPFClusterRefCandidate so we can make jets and MET + /// out of PFClusters. - /// dummy charge - double charge() const { return 0; } + /// dummy charge + double charge() const { return 0; } - /// transverse momentum, massless approximation - double pt() const { return (energy() * sin(position_.theta())); } + /// transverse momentum, massless approximation + double pt() const { return (energy() * sin(position_.theta())); } - /// angle - double theta() const { return position_.theta(); } + /// angle + double theta() const { return position_.theta(); } - /// dummy vertex access - math::XYZPoint const& vertex() const { return dummyVtx_; } - double vx() const { return vertex().x(); } - double vy() const { return vertex().y(); } - double vz() const { return vertex().z(); } + /// dummy vertex access + math::XYZPoint const& vertex() const { return dummyVtx_; } + double vx() const { return vertex().x(); } + double vy() const { return vertex().y(); } + double vz() const { return vertex().z(); } #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) - template - void pruneUsing(pruner prune) { - // remove_if+erase algo applied to both vectors... - auto iter = std::find_if_not(rechits_.begin(), rechits_.end(), prune); - if (iter == rechits_.end()) - return; - auto first = iter - rechits_.begin(); - for (auto i = first; ++i < int(rechits_.size());) { - if (prune(rechits_[i])) { - rechits_[first] = std::move(rechits_[i]); - hitsAndFractions_[first] = std::move(hitsAndFractions_[i]); - ++first; + template + void pruneUsing(pruner prune) { + // remove_if+erase algo applied to both vectors... + auto iter = std::find_if_not(rechits_.begin(), rechits_.end(), prune); + if (iter == rechits_.end()) + return; + auto first = iter - rechits_.begin(); + for (auto i = first; ++i < int(rechits_.size());) { + if (prune(rechits_[i])) { + rechits_[first] = std::move(rechits_[i]); + hitsAndFractions_[first] = std::move(hitsAndFractions_[i]); + ++first; + } } + rechits_.erase(rechits_.begin() + first, rechits_.end()); + hitsAndFractions_.erase(hitsAndFractions_.begin() + first, hitsAndFractions_.end()); } - rechits_.erase(rechits_.begin() + first, rechits_.end()); - hitsAndFractions_.erase(hitsAndFractions_.begin() + first, hitsAndFractions_.end()); - } #endif - private: - /// vector of rechit fractions (transient) - std::vector rechits_; + private: + /// vector of rechit fractions (transient) + std::vector rechits_; - /// cluster position: rho, eta, phi (transient) - REPPoint posrep_; + /// cluster position: rho, eta, phi (transient) + REPPoint posrep_; - /// Michalis: add timing and depth information - float time_; - float timeError_{0}; - double depth_{0}; + /// Michalis: add timing and depth information + float time_; + float timeError_{0}; + double depth_{0}; - /// transient layer - PFLayer::Layer layer_; + /// transient layer + PFLayer::Layer layer_; - /// depth corrections - static const constexpr double depthCorA_ = 0.89; - static const constexpr double depthCorB_ = 7.3; - static const constexpr double depthCorAp_ = 0.89; - static const constexpr double depthCorBp_ = 4.0; + /// depth corrections + static const constexpr double depthCorA_ = 0.89; + static const constexpr double depthCorB_ = 7.3; + static const constexpr double depthCorAp_ = 0.89; + static const constexpr double depthCorBp_ = 4.0; - static const math::XYZPoint dummyVtx_; - }; + static const math::XYZPoint dummyVtx_; + }; - std::ostream& operator<<(std::ostream& out, const PFCluster& cluster); + std::ostream& operator<<(std::ostream& out, const PFCluster& cluster); + } // namespace io_v1 + using PFCluster = io_v1::PFCluster; } // namespace reco #endif // DataFormats_ParticleFlowReco_PFCluster_h diff --git a/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h b/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h index d3bce22b1acc6..4d5c0bcf56336 100644 --- a/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFClusterFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class PFCluster; + namespace io_v1 { + class PFCluster; + } + using PFCluster = io_v1::PFCluster; /// collection of PFCluster objects typedef std::vector PFClusterCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PFConversion.h b/DataFormats/ParticleFlowReco/interface/PFConversion.h index 66f9f0d1e35b2..327f1fcbdde20 100644 --- a/DataFormats/ParticleFlowReco/interface/PFConversion.h +++ b/DataFormats/ParticleFlowReco/interface/PFConversion.h @@ -9,8 +9,6 @@ #include #include -class Conversion; - namespace reco { /**\class PFConversion diff --git a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h index 5be48b21c198e..fa3d3fa475a13 100644 --- a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h +++ b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertex.h @@ -10,9 +10,10 @@ #include namespace reco { + namespace io_v1 { - /// \brief Block of elements - /*! + /// \brief Block of elements + /*! \author Maxime Gouzevitch \date November 2009 @@ -20,247 +21,251 @@ namespace reco { tracks's hit-vertex distances, tracks types and the expected vertex type. */ - class PFDisplacedVertex : public Vertex { - public: - /// Information on the distance between track's hits and the Vertex - typedef std::pair PFTrackHitInfo; - typedef std::pair PFTrackHitFullInfo; - - /// Mass hypothesis enum - enum M_Hypo { M_CUSTOM, M_MASSLESS, M_PION, M_KAON, M_LAMBDA }; - - /// Classification of tracks according to the position with respect - /// to the Vertex. A Merged track is a track which has at least - /// two hits before and two hits after the vertex. It may come from - /// a primary track merged with a low quality secondary track. - enum VertexTrackType { T_NOT_FROM_VERTEX, T_TO_VERTEX, T_FROM_VERTEX, T_MERGED }; - - /// Classification of vertex according to different parameters such as the - /// Number of tracks, the invariant mass etc... - enum VertexType { - ANY = 0, - FAKE = 1, - LOOPER = 2, - NUCL = 10, - NUCL_LOOSE = 11, - NUCL_KINK = 12, - CONVERSION = 20, - CONVERSION_LOOSE = 21, - CONVERTED_BREMM = 22, - K0_DECAY = 30, - LAMBDA_DECAY = 31, - LAMBDABAR_DECAY = 32, - KPLUS_DECAY = 40, - KMINUS_DECAY = 41, - KPLUS_DECAY_LOOSE = 42, - KMINUS_DECAY_LOOSE = 43, - BSM_VERTEX = 100 - }; - - /// Default constructor - PFDisplacedVertex(); - - /// Constructor from the reco::Vertex - PFDisplacedVertex(reco::Vertex&); - - /// Add a new track to the vertex - void addElement(const TrackBaseRef& r, - const Track& refTrack, - const PFTrackHitFullInfo& hitInfo, - VertexTrackType trackType = T_NOT_FROM_VERTEX, - float w = 1.0); - - /// Clean the tracks collection and all the associated collections - void cleanTracks(); - - /// Set the type of this vertex - void setVertexType(VertexType vertexType) { vertexType_ = vertexType; } - - /// Estimate the direction of the vertex. This function produced a unitary vector. - /// It is calculated the axis linking the primary vertex of the event pvtx to this vertex - void setPrimaryDirection(const math::XYZPoint& pvtx); - - /// Get the type of this vertex - VertexType vertexType() { return vertexType_; } - - const std::vector trackHitFullInfos() const { return trackHitFullInfos_; } - - const std::vector trackTypes() const { return trackTypes_; } - - /// -------- Provide useful information -------- /// - - /// If a primary track was identified - const bool isTherePrimaryTracks() const { return isThereKindTracks(T_TO_VERTEX); } - - /// If a merged track was identified - const bool isThereMergedTracks() const { return isThereKindTracks(T_MERGED); } - - /// If a secondary track was identified - const bool isThereSecondaryTracks() const { return isThereKindTracks(T_FROM_VERTEX); } + class PFDisplacedVertex : public Vertex { + public: + /// Information on the distance between track's hits and the Vertex + typedef std::pair PFTrackHitInfo; + typedef std::pair PFTrackHitFullInfo; + + /// Mass hypothesis enum + enum M_Hypo { M_CUSTOM, M_MASSLESS, M_PION, M_KAON, M_LAMBDA }; + + /// Classification of tracks according to the position with respect + /// to the Vertex. A Merged track is a track which has at least + /// two hits before and two hits after the vertex. It may come from + /// a primary track merged with a low quality secondary track. + enum VertexTrackType { T_NOT_FROM_VERTEX, T_TO_VERTEX, T_FROM_VERTEX, T_MERGED }; + + /// Classification of vertex according to different parameters such as the + /// Number of tracks, the invariant mass etc... + enum VertexType { + ANY = 0, + FAKE = 1, + LOOPER = 2, + NUCL = 10, + NUCL_LOOSE = 11, + NUCL_KINK = 12, + CONVERSION = 20, + CONVERSION_LOOSE = 21, + CONVERTED_BREMM = 22, + K0_DECAY = 30, + LAMBDA_DECAY = 31, + LAMBDABAR_DECAY = 32, + KPLUS_DECAY = 40, + KMINUS_DECAY = 41, + KPLUS_DECAY_LOOSE = 42, + KMINUS_DECAY_LOOSE = 43, + BSM_VERTEX = 100 + }; + + /// Default constructor + PFDisplacedVertex(); + + /// Constructor from the reco::Vertex + PFDisplacedVertex(reco::Vertex&); + + /// Add a new track to the vertex + void addElement(const TrackBaseRef& r, + const Track& refTrack, + const PFTrackHitFullInfo& hitInfo, + VertexTrackType trackType = T_NOT_FROM_VERTEX, + float w = 1.0); + + /// Clean the tracks collection and all the associated collections + void cleanTracks(); + + /// Set the type of this vertex + void setVertexType(VertexType vertexType) { vertexType_ = vertexType; } + + /// Estimate the direction of the vertex. This function produced a unitary vector. + /// It is calculated the axis linking the primary vertex of the event pvtx to this vertex + void setPrimaryDirection(const math::XYZPoint& pvtx); + + /// Get the type of this vertex + VertexType vertexType() { return vertexType_; } + + const std::vector trackHitFullInfos() const { return trackHitFullInfos_; } + + const std::vector trackTypes() const { return trackTypes_; } + + /// -------- Provide useful information -------- /// + + /// If a primary track was identified + const bool isTherePrimaryTracks() const { return isThereKindTracks(T_TO_VERTEX); } + + /// If a merged track was identified + const bool isThereMergedTracks() const { return isThereKindTracks(T_MERGED); } + + /// If a secondary track was identified + const bool isThereSecondaryTracks() const { return isThereKindTracks(T_FROM_VERTEX); } + + /// If there is a track which was not identified + const bool isThereNotFromVertexTracks() const { return isThereKindTracks(T_NOT_FROM_VERTEX); } + + /// Is a primary track was identified + const bool isPrimaryTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_TO_VERTEX); + } + + /// Is a secondary track was identified + const bool isSecondaryTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_FROM_VERTEX); + } + + /// Is a secondary track was identified + const bool isMergedTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_MERGED); + } + + const PFTrackHitFullInfo trackHitFullInfo(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return trackHitFullInfos_[itrk]; + } + + /// Is primary or merged track + const bool isIncomingTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_MERGED) || isTrack(itrk, T_TO_VERTEX); + } + + /// Is secondary track + const bool isOutgoingTrack(const reco::TrackBaseRef& originalTrack) const { + size_t itrk = trackPosition(originalTrack); + return isTrack(itrk, T_FROM_VERTEX); + } + + /// Number of primary tracks was identified + const int nPrimaryTracks() const { return nKindTracks(T_TO_VERTEX); } + + /// Number of merged tracks was identified + const int nMergedTracks() const { return nKindTracks(T_MERGED); } + + /// Number of secondary tracks was identified + const int nSecondaryTracks() const { return nKindTracks(T_FROM_VERTEX); } + + /// Number of tracks which was not identified + const int nNotFromVertexTracks() const { return nKindTracks(T_NOT_FROM_VERTEX); } + + /// Number of tracks + const int nTracks() const { return trackTypes_.size(); } - /// If there is a track which was not identified - const bool isThereNotFromVertexTracks() const { return isThereKindTracks(T_NOT_FROM_VERTEX); } + // const reco::VertexTrackType vertexTrackType(reco::TrackBaseRef tkRef) const; - /// Is a primary track was identified - const bool isPrimaryTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_TO_VERTEX); - } + /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those + /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" + /// the value of custom shall be then provided in mass variable + const math::XYZTLorentzVector secondaryMomentum(std::string massHypo = "PI", + bool useRefitted = true, + double mass = 0.0) const { + return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); + } - /// Is a secondary track was identified - const bool isSecondaryTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_FROM_VERTEX); - } - - /// Is a secondary track was identified - const bool isMergedTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_MERGED); - } - - const PFTrackHitFullInfo trackHitFullInfo(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return trackHitFullInfos_[itrk]; - } - - /// Is primary or merged track - const bool isIncomingTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_MERGED) || isTrack(itrk, T_TO_VERTEX); - } - - /// Is secondary track - const bool isOutgoingTrack(const reco::TrackBaseRef& originalTrack) const { - size_t itrk = trackPosition(originalTrack); - return isTrack(itrk, T_FROM_VERTEX); - } - - /// Number of primary tracks was identified - const int nPrimaryTracks() const { return nKindTracks(T_TO_VERTEX); } - - /// Number of merged tracks was identified - const int nMergedTracks() const { return nKindTracks(T_MERGED); } - - /// Number of secondary tracks was identified - const int nSecondaryTracks() const { return nKindTracks(T_FROM_VERTEX); } - - /// Number of tracks which was not identified - const int nNotFromVertexTracks() const { return nKindTracks(T_NOT_FROM_VERTEX); } - - /// Number of tracks - const int nTracks() const { return trackTypes_.size(); } - - // const reco::VertexTrackType vertexTrackType(reco::TrackBaseRef tkRef) const; - - /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those - /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" - /// the value of custom shall be then provided in mass variable - const math::XYZTLorentzVector secondaryMomentum(std::string massHypo = "PI", + /// Momentum of primary or merged track calculated with a mass hypothesis. + const math::XYZTLorentzVector primaryMomentum(std::string massHypo = "PI", bool useRefitted = true, double mass = 0.0) const { - return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); - } - - /// Momentum of primary or merged track calculated with a mass hypothesis. - const math::XYZTLorentzVector primaryMomentum(std::string massHypo = "PI", - bool useRefitted = true, - double mass = 0.0) const { - return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); - } + return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); + } - /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those - /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" - /// the value of custom shall be then provided in mass variable - const math::XYZTLorentzVector secondaryMomentum(M_Hypo massHypo, bool useRefitted = true, double mass = 0.0) const { - return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); - } + /// Momentum of secondary tracks calculated with a mass hypothesis. Some of those + /// hypothesis are default: "PI" , "KAON", "LAMBDA", "MASSLESS", "CUSTOM" + /// the value of custom shall be then provided in mass variable + const math::XYZTLorentzVector secondaryMomentum(M_Hypo massHypo, + bool useRefitted = true, + double mass = 0.0) const { + return momentum(massHypo, T_FROM_VERTEX, useRefitted, mass); + } - /// Momentum of primary or merged track calculated with a mass hypothesis. - const math::XYZTLorentzVector primaryMomentum(M_Hypo massHypo, bool useRefitted = true, double mass = 0.0) const { - return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); - } + /// Momentum of primary or merged track calculated with a mass hypothesis. + const math::XYZTLorentzVector primaryMomentum(M_Hypo massHypo, bool useRefitted = true, double mass = 0.0) const { + return momentum(massHypo, T_TO_VERTEX, useRefitted, mass); + } - void calcKinematics() { - defaultPrimaryMomentum_ = momentum("PI", T_TO_VERTEX, false, 0.0); - defaultSecondaryMomentum_ = momentum("PI", T_FROM_VERTEX, true, 0.0); - } + void calcKinematics() { + defaultPrimaryMomentum_ = momentum("PI", T_TO_VERTEX, false, 0.0); + defaultSecondaryMomentum_ = momentum("PI", T_FROM_VERTEX, true, 0.0); + } - const double secondaryPt() const { return defaultPrimaryMomentum_.Pt(); } + const double secondaryPt() const { return defaultPrimaryMomentum_.Pt(); } - /// Momentum of primary or merged track calculated with a mass hypothesis. - const double primaryPt() const { return defaultSecondaryMomentum_.Pt(); } + /// Momentum of primary or merged track calculated with a mass hypothesis. + const double primaryPt() const { return defaultSecondaryMomentum_.Pt(); } - /// Total Charge - const int totalCharge() const; + /// Total Charge + const int totalCharge() const; - /// Angle PrimaryVertex-DisplacedVertex (or primary track if there is) - /// And secondary momentum - const double angle_io() const; + /// Angle PrimaryVertex-DisplacedVertex (or primary track if there is) + /// And secondary momentum + const double angle_io() const; - /// Primary Direction - const math::XYZVector primaryDirection() const; + /// Primary Direction + const math::XYZVector primaryDirection() const; - bool isFake() const { return vertexType_ == FAKE; } - bool isLooper() const { return vertexType_ == LOOPER; } - bool isNucl() const { return vertexType_ == NUCL; } - bool isNucl_Loose() const { return vertexType_ == NUCL_LOOSE; } - bool isNucl_Kink() const { return vertexType_ == NUCL_KINK; } - bool isConv() const { return vertexType_ == CONVERSION; } - bool isConv_Loose() const { return vertexType_ == CONVERSION_LOOSE; } - bool isConvertedBremm() const { return vertexType_ == CONVERTED_BREMM; } - bool isK0() const { return vertexType_ == K0_DECAY; } - bool isLambda() const { return vertexType_ == LAMBDA_DECAY; } - bool isLambdaBar() const { return vertexType_ == LAMBDABAR_DECAY; } - bool isKplus() const { return vertexType_ == KPLUS_DECAY; } - bool isKminus() const { return vertexType_ == KMINUS_DECAY; } - bool isKplus_Loose() const { return vertexType_ == KPLUS_DECAY_LOOSE; } - bool isKminus_Loose() const { return vertexType_ == KMINUS_DECAY_LOOSE; } - bool isBSM() const { return vertexType_ == BSM_VERTEX; } + bool isFake() const { return vertexType_ == FAKE; } + bool isLooper() const { return vertexType_ == LOOPER; } + bool isNucl() const { return vertexType_ == NUCL; } + bool isNucl_Loose() const { return vertexType_ == NUCL_LOOSE; } + bool isNucl_Kink() const { return vertexType_ == NUCL_KINK; } + bool isConv() const { return vertexType_ == CONVERSION; } + bool isConv_Loose() const { return vertexType_ == CONVERSION_LOOSE; } + bool isConvertedBremm() const { return vertexType_ == CONVERTED_BREMM; } + bool isK0() const { return vertexType_ == K0_DECAY; } + bool isLambda() const { return vertexType_ == LAMBDA_DECAY; } + bool isLambdaBar() const { return vertexType_ == LAMBDABAR_DECAY; } + bool isKplus() const { return vertexType_ == KPLUS_DECAY; } + bool isKminus() const { return vertexType_ == KMINUS_DECAY; } + bool isKplus_Loose() const { return vertexType_ == KPLUS_DECAY_LOOSE; } + bool isKminus_Loose() const { return vertexType_ == KMINUS_DECAY_LOOSE; } + bool isBSM() const { return vertexType_ == BSM_VERTEX; } - std::string nameVertexType() const; + std::string nameVertexType() const; - /// cout function - void Dump(std::ostream& out = std::cout) const; + /// cout function + void Dump(std::ostream& out = std::cout) const; - private: - /// --------- TOOLS -------------- /// + private: + /// --------- TOOLS -------------- /// - /// Common tool used to know if there are tracks of a given Kind - const bool isThereKindTracks(VertexTrackType) const; + /// Common tool used to know if there are tracks of a given Kind + const bool isThereKindTracks(VertexTrackType) const; - /// Common tool used to get the number of tracks of a given Kind - const int nKindTracks(VertexTrackType) const; + /// Common tool used to get the number of tracks of a given Kind + const int nKindTracks(VertexTrackType) const; - /// Common tool to calculate the momentum vector of tracks with a given Kind - const math::XYZTLorentzVector momentum(std::string, VertexTrackType, bool, double mass) const; + /// Common tool to calculate the momentum vector of tracks with a given Kind + const math::XYZTLorentzVector momentum(std::string, VertexTrackType, bool, double mass) const; - /// Common tool to calculate the momentum vector of tracks with a given Kind - const math::XYZTLorentzVector momentum(M_Hypo massHypo, VertexTrackType, bool, double mass) const; + /// Common tool to calculate the momentum vector of tracks with a given Kind + const math::XYZTLorentzVector momentum(M_Hypo massHypo, VertexTrackType, bool, double mass) const; - /// Get the mass with a given hypothesis - const double getMass2(M_Hypo, double) const; + /// Get the mass with a given hypothesis + const double getMass2(M_Hypo, double) const; - const size_t trackPosition(const reco::TrackBaseRef& originalTrack) const; + const size_t trackPosition(const reco::TrackBaseRef& originalTrack) const; - const bool isTrack(size_t itrk, VertexTrackType T) const { return trackTypes_[itrk] == T; } + const bool isTrack(size_t itrk, VertexTrackType T) const { return trackTypes_[itrk] == T; } - /// -------- MEMBERS -------- /// + /// -------- MEMBERS -------- /// - /// This vertex type - VertexType vertexType_; + /// This vertex type + VertexType vertexType_; - /// Types of the tracks associated to the vertex - std::vector trackTypes_; + /// Types of the tracks associated to the vertex + std::vector trackTypes_; - /// Information on the distance between track's hits and the Vertex - std::vector trackHitFullInfos_; + /// Information on the distance between track's hits and the Vertex + std::vector trackHitFullInfos_; - math::XYZVector primaryDirection_; + math::XYZVector primaryDirection_; - math::XYZTLorentzVector defaultPrimaryMomentum_; - math::XYZTLorentzVector defaultSecondaryMomentum_; - }; + math::XYZTLorentzVector defaultPrimaryMomentum_; + math::XYZTLorentzVector defaultSecondaryMomentum_; + }; + } // namespace io_v1 + using PFDisplacedVertex = io_v1::PFDisplacedVertex; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h index 3d2127192922d..a52fd7413a57d 100644 --- a/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFDisplacedVertexFwd.h @@ -7,7 +7,10 @@ /* #include "DataFormats/Common/interface/RefProd.h" */ namespace reco { - class PFDisplacedVertex; + namespace io_v1 { + class PFDisplacedVertex; + } + using PFDisplacedVertex = io_v1::PFDisplacedVertex; /// collection of PFDisplacedVertex objects typedef std::vector PFDisplacedVertexCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PFRecHit.h b/DataFormats/ParticleFlowReco/interface/PFRecHit.h index 1061eac96cce5..656d695b06a47 100644 --- a/DataFormats/ParticleFlowReco/interface/PFRecHit.h +++ b/DataFormats/ParticleFlowReco/interface/PFRecHit.h @@ -20,8 +20,9 @@ #include "Geometry/CaloGeometry/interface/CaloCellGeometryMayOwnPtr.h" namespace reco { + namespace io_v1 { - /**\class PFRecHit + /**\class PFRecHit \brief Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClusterAlgo \author Colin Bernet @@ -29,143 +30,148 @@ namespace reco { Feb 2014 [Michalis: 8 years later!Modifying the class to be able to generalize the neighbours for 3D calorimeters ] */ - class PFRecHit { - public: - using PositionType = GlobalPoint::BasicVectorType; - using REPPoint = RhoEtaPhi; - using RepCorners = CaloCellGeometry::RepCorners; - using REPPointVector = RepCorners; - using CornersVec = CaloCellGeometry::CornersVec; - - struct Neighbours { - using Pointer = unsigned int const*; - Neighbours() {} - Neighbours(Pointer ib, unsigned int n) : b(ib), e(ib + n) {} - Pointer b, e; - Pointer begin() const { return b; } - Pointer end() const { return e; } - unsigned int size() const { return e - b; } - }; + class PFRecHit { + public: + using PositionType = GlobalPoint::BasicVectorType; + using REPPoint = RhoEtaPhi; + using RepCorners = CaloCellGeometry::RepCorners; + using REPPointVector = RepCorners; + using CornersVec = CaloCellGeometry::CornersVec; + + struct Neighbours { + using Pointer = unsigned int const*; + Neighbours() {} + Neighbours(Pointer ib, unsigned int n) : b(ib), e(ib + n) {} + Pointer b, e; + Pointer begin() const { return b; } + Pointer end() const { return e; } + unsigned int size() const { return e - b; } + }; - enum { NONE = 0 }; - /// default constructor. Sets energy and position to zero - PFRecHit() {} + enum { NONE = 0 }; + /// default constructor. Sets energy and position to zero + PFRecHit() {} - PFRecHit( - CaloCellGeometryMayOwnPtr caloCell, unsigned int detId, PFLayer::Layer layer, float energy, uint32_t flags = 0) - : caloCell_(std::move(caloCell)), detId_(detId), layer_(layer), energy_(energy), flags_(flags) {} + PFRecHit(CaloCellGeometryMayOwnPtr caloCell, + unsigned int detId, + PFLayer::Layer layer, + float energy, + uint32_t flags = 0) + : caloCell_(std::move(caloCell)), detId_(detId), layer_(layer), energy_(energy), flags_(flags) {} - /// copy - PFRecHit(const PFRecHit& other) = default; - PFRecHit(PFRecHit&& other) = default; - PFRecHit& operator=(const PFRecHit& other) = default; - PFRecHit& operator=(PFRecHit&& other) = default; + /// copy + PFRecHit(const PFRecHit& other) = default; + PFRecHit(PFRecHit&& other) = default; + PFRecHit& operator=(const PFRecHit& other) = default; + PFRecHit& operator=(PFRecHit&& other) = default; - /// destructor - ~PFRecHit() = default; + /// destructor + ~PFRecHit() = default; - void setEnergy(float energy) { energy_ = energy; } + void setEnergy(float energy) { energy_ = energy; } - void addNeighbour(short x, short y, short z, unsigned int); - unsigned int getNeighbour(short x, short y, short z) const; - void setTime(double time) { time_ = time; } - void setDepth(int depth) { depth_ = depth; } - void clearNeighbours() { - neighbours_.clear(); - neighbourInfos_.clear(); - neighbours4_ = neighbours8_ = 0; - } + void addNeighbour(short x, short y, short z, unsigned int); + unsigned int getNeighbour(short x, short y, short z) const; + void setTime(double time) { time_ = time; } + void setDepth(int depth) { depth_ = depth; } + void clearNeighbours() { + neighbours_.clear(); + neighbourInfos_.clear(); + neighbours4_ = neighbours8_ = 0; + } - Neighbours neighbours4() const { return buildNeighbours(neighbours4_); } - Neighbours neighbours8() const { return buildNeighbours(neighbours8_); } + Neighbours neighbours4() const { return buildNeighbours(neighbours4_); } + Neighbours neighbours8() const { return buildNeighbours(neighbours8_); } - Neighbours neighbours() const { return buildNeighbours(neighbours_.size()); } + Neighbours neighbours() const { return buildNeighbours(neighbours_.size()); } - const std::vector& neighbourInfos() { return neighbourInfos_; } + const std::vector& neighbourInfos() { return neighbourInfos_; } - /// calo cell - CaloCellGeometry const& caloCell() const { return *(caloCell_.get()); } - bool hasCaloCell() const { return (caloCell_ != nullptr); } + /// calo cell + CaloCellGeometry const& caloCell() const { return *(caloCell_.get()); } + bool hasCaloCell() const { return (caloCell_ != nullptr); } - /// rechit detId - unsigned detId() const { return detId_; } + /// rechit detId + unsigned detId() const { return detId_; } - /// rechit layer - PFLayer::Layer layer() const { return layer_; } + /// rechit layer + PFLayer::Layer layer() const { return layer_; } - /// rechit energy - float energy() const { return energy_; } + /// rechit energy + float energy() const { return energy_; } - /// timing for cleaned hits - float time() const { return time_; } + /// timing for cleaned hits + float time() const { return time_; } - /// depth for segemntation - int depth() const { return depth_; } + /// depth for segemntation + int depth() const { return depth_; } - /// rechit momentum transverse to the beam, squared. - double pt2() const { return energy_ * energy_ * (position().perp2() / position().mag2()); } + /// rechit momentum transverse to the beam, squared. + double pt2() const { return energy_ * energy_ * (position().perp2() / position().mag2()); } - // Detector-dependent status flag - uint32_t flags() const { return flags_; } + // Detector-dependent status flag + uint32_t flags() const { return flags_; } - // - void setFlags(uint32_t flags) { flags_ = flags; } + // + void setFlags(uint32_t flags) { flags_ = flags; } - /// rechit cell centre x, y, z - PositionType const& position() const { return caloCell().getPosition().basicVector(); } + /// rechit cell centre x, y, z + PositionType const& position() const { return caloCell().getPosition().basicVector(); } - RhoEtaPhi const& positionREP() const { return caloCell().repPos(); } + RhoEtaPhi const& positionREP() const { return caloCell().repPos(); } - /// rechit corners - CornersVec const& getCornersXYZ() const { return caloCell().getCorners(); } + /// rechit corners + CornersVec const& getCornersXYZ() const { return caloCell().getCorners(); } - RepCorners const& getCornersREP() const { return caloCell().getCornersREP(); } + RepCorners const& getCornersREP() const { return caloCell().getCornersREP(); } - /// comparison >= operator - bool operator>=(const PFRecHit& rhs) const { return (energy_ >= rhs.energy_); } + /// comparison >= operator + bool operator>=(const PFRecHit& rhs) const { return (energy_ >= rhs.energy_); } - /// comparison > operator - bool operator>(const PFRecHit& rhs) const { return (energy_ > rhs.energy_); } + /// comparison > operator + bool operator>(const PFRecHit& rhs) const { return (energy_ > rhs.energy_); } - /// comparison <= operator - bool operator<=(const PFRecHit& rhs) const { return (energy_ <= rhs.energy_); } + /// comparison <= operator + bool operator<=(const PFRecHit& rhs) const { return (energy_ <= rhs.energy_); } - /// comparison < operator - bool operator<(const PFRecHit& rhs) const { return (energy_ < rhs.energy_); } + /// comparison < operator + bool operator<(const PFRecHit& rhs) const { return (energy_ < rhs.energy_); } - private: - Neighbours buildNeighbours(unsigned int n) const { return Neighbours(neighbours_.data(), n); } + private: + Neighbours buildNeighbours(unsigned int n) const { return Neighbours(neighbours_.data(), n); } - /// cell geometry - CaloCellGeometryMayOwnPtr caloCell_; + /// cell geometry + CaloCellGeometryMayOwnPtr caloCell_; - ///cell detid - unsigned int detId_ = 0; + ///cell detid + unsigned int detId_ = 0; - /// rechit layer - PFLayer::Layer layer_ = PFLayer::NONE; + /// rechit layer + PFLayer::Layer layer_ = PFLayer::NONE; - /// rechit energy - float energy_ = 0; + /// rechit energy + float energy_ = 0; - /// time - float time_ = -1; + /// time + float time_ = -1; - /// depth - int depth_ = 0; + /// depth + int depth_ = 0; - /// indices to existing neighbours (1 common side) - std::vector neighbours_; - std::vector neighbourInfos_; + /// indices to existing neighbours (1 common side) + std::vector neighbours_; + std::vector neighbourInfos_; - //Caching the neighbours4/8 per request of Lindsey - unsigned int neighbours4_ = 0; - unsigned int neighbours8_ = 0; + //Caching the neighbours4/8 per request of Lindsey + unsigned int neighbours4_ = 0; + unsigned int neighbours8_ = 0; - // Detector-dependent hit status flag - uint32_t flags_ = 0; - }; + // Detector-dependent hit status flag + uint32_t flags_ = 0; + }; + } // namespace io_v1 + using PFRecHit = io_v1::PFRecHit; } // namespace reco std::ostream& operator<<(std::ostream& out, const reco::PFRecHit& hit); diff --git a/DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h b/DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h index 9e6da95b9aada..67b8a6c6f0f59 100644 --- a/DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h +++ b/DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h @@ -7,38 +7,41 @@ #include "DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h" namespace reco { + namespace io_v1 { - /**\class PFRecHitFraction + /**\class PFRecHitFraction \brief Fraction of a PFRecHit (rechits can be shared between several PFCluster's) \author Colin Bernet \date July 2006 */ - class PFRecHitFraction { - public: - /// default constructor - PFRecHitFraction() : fraction_(-1) {} + class PFRecHitFraction { + public: + /// default constructor + PFRecHitFraction() : fraction_(-1) {} - /// constructor - PFRecHitFraction(const PFRecHitRef& recHitRef, double fraction) : recHitRef_(recHitRef), fraction_(fraction) {} + /// constructor + PFRecHitFraction(const PFRecHitRef& recHitRef, double fraction) : recHitRef_(recHitRef), fraction_(fraction) {} - /// \return index to rechit - const PFRecHitRef& recHitRef() const { return recHitRef_; } + /// \return index to rechit + const PFRecHitRef& recHitRef() const { return recHitRef_; } - /// \return energy fraction - double fraction() const { return fraction_; } + /// \return energy fraction + double fraction() const { return fraction_; } - private: - /// corresponding rechit - PFRecHitRef recHitRef_; + private: + /// corresponding rechit + PFRecHitRef recHitRef_; - /// fraction of the rechit energy owned by the cluster - double fraction_; - }; + /// fraction of the rechit energy owned by the cluster + double fraction_; + }; - std::ostream& operator<<(std::ostream& out, const PFRecHitFraction& hit); + std::ostream& operator<<(std::ostream& out, const PFRecHitFraction& hit); + } // namespace io_v1 + using PFRecHitFraction = io_v1::PFRecHitFraction; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h b/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h index 7300c34d5edd7..ffabb8816df18 100644 --- a/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefProd.h" namespace reco { - class PFRecHit; + namespace io_v1 { + class PFRecHit; + } + using PFRecHit = io_v1::PFRecHit; /// collection of PFRecHit objects typedef std::vector PFRecHitCollection; diff --git a/DataFormats/ParticleFlowReco/interface/PreId.h b/DataFormats/ParticleFlowReco/interface/PreId.h index adce7f0e7c423..78a9ef659afd5 100644 --- a/DataFormats/ParticleFlowReco/interface/PreId.h +++ b/DataFormats/ParticleFlowReco/interface/PreId.h @@ -10,114 +10,117 @@ #include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h" namespace reco { - class PreId { - public: - enum MatchingType { NONE = 0, ECALMATCH = 1, ESMATCH = 2, TRACKFILTERING = 3, MVA = 4, FINAL = 10 }; - - public: - PreId(unsigned nselection = 1) - : trackRef_(reco::TrackRef()), - clusterRef_(reco::PFClusterRef()), - matchingEop_(-999.), - EcalPos_(math::XYZPoint()), - meanShower_(math::XYZPoint()), - gsfChi2_(-999.), - dpt_(0.), - chi2Ratio_(0.) { - matching_.resize(nselection, false); - mva_.resize(nselection, -999.); - geomMatching_.resize(5, -999.); - } - void setTrack(reco::TrackRef trackref) { trackRef_ = trackref; } - - void setECALMatchingProperties(PFClusterRef clusterRef, - const math::XYZPoint &ecalpos, - const math::XYZPoint &meanShower, - float deta, - float dphi, - float chieta, - float chiphi, - float chi2, - float eop) { - clusterRef_ = clusterRef; - EcalPos_ = ecalpos; - meanShower_ = meanShower; - geomMatching_[0] = deta; - geomMatching_[1] = dphi; - geomMatching_[2] = chieta; - geomMatching_[3] = chiphi; - geomMatching_[4] = chi2; - matchingEop_ = eop; - } - - void setTrackProperties(float newchi2, float chi2ratio, float dpt) { - gsfChi2_ = newchi2; - chi2Ratio_ = chi2ratio; - dpt_ = dpt; - } - - void setFinalDecision(bool accepted, unsigned n = 0) { setMatching(FINAL, accepted, n); } - void setECALMatching(bool accepted, unsigned n = 0) { setMatching(ECALMATCH, accepted, n); } - void setESMatching(bool accepted, unsigned n = 0) { setMatching(ESMATCH, accepted, n); } - void setTrackFiltering(bool accepted, unsigned n = 0) { setMatching(TRACKFILTERING, accepted, n); } - void setMVA(bool accepted, float mva, unsigned n = 0) { - setMatching(MVA, accepted, n); - if (n < mva_.size()) - mva_[n] = mva; - } - - void setMatching(MatchingType type, bool result, unsigned n = 0); - bool matching(MatchingType type, unsigned n = 0) const { - if (n < matching_.size()) { - return matching_[n] & (1 << type); + namespace io_v1 { + class PreId { + public: + enum MatchingType { NONE = 0, ECALMATCH = 1, ESMATCH = 2, TRACKFILTERING = 3, MVA = 4, FINAL = 10 }; + + public: + PreId(unsigned nselection = 1) + : trackRef_(reco::TrackRef()), + clusterRef_(reco::PFClusterRef()), + matchingEop_(-999.), + EcalPos_(math::XYZPoint()), + meanShower_(math::XYZPoint()), + gsfChi2_(-999.), + dpt_(0.), + chi2Ratio_(0.) { + matching_.resize(nselection, false); + mva_.resize(nselection, -999.); + geomMatching_.resize(5, -999.); } - return false; - } - - /// Access methods - inline const std::vector &geomMatching() const { return geomMatching_; } - inline float eopMatch() const { return matchingEop_; } - inline float pt() const { return trackRef_->pt(); } - inline float eta() const { return trackRef_->eta(); } - inline float kfChi2() const { return trackRef_->normalizedChi2(); } - inline float kfNHits() const { return trackRef_->found(); } - - const math::XYZPoint &ecalPos() const { return EcalPos_; } - const math::XYZPoint &meanShower() const { return meanShower_; } - - inline float chi2Ratio() const { return chi2Ratio_; } - inline float gsfChi2() const { return gsfChi2_; } - - inline bool ecalMatching(unsigned n = 0) const { return matching(ECALMATCH, n); } - inline bool esMatching(unsigned n = 0) const { return matching(ESMATCH, n); } - inline bool trackFiltered(unsigned n = 0) const { return matching(TRACKFILTERING, n); } - inline bool mvaSelected(unsigned n = 0) const { return matching(MVA, n); } - inline bool preIded(unsigned n = 0) const { return matching(FINAL, n); } - - float mva(unsigned n = 0) const; - inline float dpt() const { return dpt_; } - reco::TrackRef trackRef() const { return trackRef_; } - PFClusterRef clusterRef() const { return clusterRef_; } - - private: - reco::TrackRef trackRef_; - PFClusterRef clusterRef_; - - std::vector geomMatching_; - float matchingEop_; - math::XYZPoint EcalPos_; - math::XYZPoint meanShower_; - - float gsfChi2_; - float dpt_; - float chi2Ratio_; - std::vector mva_; - - // bool goodpreid_; - // bool TkId_; - // bool EcalMatching_; - // bool PSMatching_; - std::vector matching_; - }; + void setTrack(reco::TrackRef trackref) { trackRef_ = trackref; } + + void setECALMatchingProperties(PFClusterRef clusterRef, + const math::XYZPoint &ecalpos, + const math::XYZPoint &meanShower, + float deta, + float dphi, + float chieta, + float chiphi, + float chi2, + float eop) { + clusterRef_ = clusterRef; + EcalPos_ = ecalpos; + meanShower_ = meanShower; + geomMatching_[0] = deta; + geomMatching_[1] = dphi; + geomMatching_[2] = chieta; + geomMatching_[3] = chiphi; + geomMatching_[4] = chi2; + matchingEop_ = eop; + } + + void setTrackProperties(float newchi2, float chi2ratio, float dpt) { + gsfChi2_ = newchi2; + chi2Ratio_ = chi2ratio; + dpt_ = dpt; + } + + void setFinalDecision(bool accepted, unsigned n = 0) { setMatching(FINAL, accepted, n); } + void setECALMatching(bool accepted, unsigned n = 0) { setMatching(ECALMATCH, accepted, n); } + void setESMatching(bool accepted, unsigned n = 0) { setMatching(ESMATCH, accepted, n); } + void setTrackFiltering(bool accepted, unsigned n = 0) { setMatching(TRACKFILTERING, accepted, n); } + void setMVA(bool accepted, float mva, unsigned n = 0) { + setMatching(MVA, accepted, n); + if (n < mva_.size()) + mva_[n] = mva; + } + + void setMatching(MatchingType type, bool result, unsigned n = 0); + bool matching(MatchingType type, unsigned n = 0) const { + if (n < matching_.size()) { + return matching_[n] & (1 << type); + } + return false; + } + + /// Access methods + inline const std::vector &geomMatching() const { return geomMatching_; } + inline float eopMatch() const { return matchingEop_; } + inline float pt() const { return trackRef_->pt(); } + inline float eta() const { return trackRef_->eta(); } + inline float kfChi2() const { return trackRef_->normalizedChi2(); } + inline float kfNHits() const { return trackRef_->found(); } + + const math::XYZPoint &ecalPos() const { return EcalPos_; } + const math::XYZPoint &meanShower() const { return meanShower_; } + + inline float chi2Ratio() const { return chi2Ratio_; } + inline float gsfChi2() const { return gsfChi2_; } + + inline bool ecalMatching(unsigned n = 0) const { return matching(ECALMATCH, n); } + inline bool esMatching(unsigned n = 0) const { return matching(ESMATCH, n); } + inline bool trackFiltered(unsigned n = 0) const { return matching(TRACKFILTERING, n); } + inline bool mvaSelected(unsigned n = 0) const { return matching(MVA, n); } + inline bool preIded(unsigned n = 0) const { return matching(FINAL, n); } + + float mva(unsigned n = 0) const; + inline float dpt() const { return dpt_; } + reco::TrackRef trackRef() const { return trackRef_; } + PFClusterRef clusterRef() const { return clusterRef_; } + + private: + reco::TrackRef trackRef_; + PFClusterRef clusterRef_; + + std::vector geomMatching_; + float matchingEop_; + math::XYZPoint EcalPos_; + math::XYZPoint meanShower_; + + float gsfChi2_; + float dpt_; + float chi2Ratio_; + std::vector mva_; + + // bool goodpreid_; + // bool TkId_; + // bool EcalMatching_; + // bool PSMatching_; + std::vector matching_; + }; + } // namespace io_v1 + using PreId = io_v1::PreId; } // namespace reco #endif diff --git a/DataFormats/ParticleFlowReco/interface/PreIdFwd.h b/DataFormats/ParticleFlowReco/interface/PreIdFwd.h index 153e100e2ac67..2dd12a34bb57b 100644 --- a/DataFormats/ParticleFlowReco/interface/PreIdFwd.h +++ b/DataFormats/ParticleFlowReco/interface/PreIdFwd.h @@ -3,7 +3,10 @@ #include #include "DataFormats/Common/interface/Ref.h" namespace reco { - class PreId; + namespace io_v1 { + class PreId; + } + using PreId = io_v1::PreId; typedef std::vector PreIdCollection; typedef edm::Ref PreIdRef; } // namespace reco diff --git a/DataFormats/ParticleFlowReco/src/PFBlock.cc b/DataFormats/ParticleFlowReco/src/PFBlock.cc index 4fed1990d5883..bc0f879cf2af6 100644 --- a/DataFormats/ParticleFlowReco/src/PFBlock.cc +++ b/DataFormats/ParticleFlowReco/src/PFBlock.cc @@ -132,7 +132,7 @@ double PFBlock::dist(unsigned ie1, unsigned ie2, const LinkData& linkData) const return Dist; } -ostream& reco::operator<<(ostream& out, const reco::PFBlock& block) { +ostream& reco::io_v1::operator<<(ostream& out, const reco::PFBlock& block) { if (!out) return out; const edm::OwnVector& elements = block.elements(); diff --git a/DataFormats/ParticleFlowReco/src/PFBlockElement.cc b/DataFormats/ParticleFlowReco/src/PFBlockElement.cc index da070c8783581..69c9a5f272251 100644 --- a/DataFormats/ParticleFlowReco/src/PFBlockElement.cc +++ b/DataFormats/ParticleFlowReco/src/PFBlockElement.cc @@ -5,15 +5,17 @@ #include "DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h" #include "DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h" -const reco::TrackRef reco::PFBlockElement::nullTrack_ = reco::TrackRef(); -const reco::PFRecTrackRef reco::PFBlockElement::nullPFRecTrack_ = reco::PFRecTrackRef(); -const reco::PFClusterRef reco::PFBlockElement::nullPFCluster_ = reco::PFClusterRef(); -const reco::PFDisplacedTrackerVertexRef reco::PFBlockElement::nullPFDispVertex_ = reco::PFDisplacedTrackerVertexRef(); -const reco::ConversionRefVector reco::PFBlockElement::nullConv_ = reco::ConversionRefVector(); -const reco::MuonRef reco::PFBlockElement::nullMuon_ = reco::MuonRef(); -const reco::VertexCompositeCandidateRef reco::PFBlockElement::nullVertex_ = reco::VertexCompositeCandidateRef(); +const reco::TrackRef reco::io_v1::PFBlockElement::nullTrack_ = reco::TrackRef(); +const reco::PFRecTrackRef reco::io_v1::PFBlockElement::nullPFRecTrack_ = reco::PFRecTrackRef(); +const reco::PFClusterRef reco::io_v1::PFBlockElement::nullPFCluster_ = reco::PFClusterRef(); +const reco::PFDisplacedTrackerVertexRef reco::io_v1::PFBlockElement::nullPFDispVertex_ = + reco::PFDisplacedTrackerVertexRef(); +const reco::ConversionRefVector reco::io_v1::PFBlockElement::nullConv_ = reco::ConversionRefVector(); +const reco::MuonRef reco::io_v1::PFBlockElement::nullMuon_ = reco::MuonRef(); +const reco::VertexCompositeCandidateRef reco::io_v1::PFBlockElement::nullVertex_ = reco::VertexCompositeCandidateRef(); using namespace reco; +using namespace reco::io_v1; // int PFBlockElement::instanceCounter_ = 0; @@ -27,7 +29,7 @@ void PFBlockElement::Dump(std::ostream& out, const char* pad) const { out << pad << "base element"; } -std::ostream& reco::operator<<(std::ostream& out, const PFBlockElement& element) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const PFBlockElement& element) { if (!out) return out; diff --git a/DataFormats/ParticleFlowReco/src/PFCluster.cc b/DataFormats/ParticleFlowReco/src/PFCluster.cc index b1cde8be83b7e..b792116e4733b 100644 --- a/DataFormats/ParticleFlowReco/src/PFCluster.cc +++ b/DataFormats/ParticleFlowReco/src/PFCluster.cc @@ -4,6 +4,7 @@ using namespace std; using namespace reco; +using namespace reco::io_v1; const math::XYZPoint PFCluster::dummyVtx_(0, 0, 0); @@ -60,7 +61,7 @@ PFLayer::Layer PFCluster::layer() const { return PFLayer::fromCaloID(caloID()); } -std::ostream& reco::operator<<(std::ostream& out, const PFCluster& cluster) { +std::ostream& reco::io_v1::operator<<(std::ostream& out, const PFCluster& cluster) { if (!out) return out; diff --git a/DataFormats/ParticleFlowReco/src/PFRecHitFraction.cc b/DataFormats/ParticleFlowReco/src/PFRecHitFraction.cc index 912eb2e2eaa69..7110a765f76a9 100644 --- a/DataFormats/ParticleFlowReco/src/PFRecHitFraction.cc +++ b/DataFormats/ParticleFlowReco/src/PFRecHitFraction.cc @@ -5,8 +5,9 @@ using namespace std; using namespace reco; +using namespace reco::io_v1; -ostream& reco::operator<<(std::ostream& out, const PFRecHitFraction& hit) { +ostream& reco::io_v1::operator<<(std::ostream& out, const PFRecHitFraction& hit) { if (!out) return out; diff --git a/DataFormats/ParticleFlowReco/src/classes_def_1.xml b/DataFormats/ParticleFlowReco/src/classes_def_1.xml index 01e4066163830..570c9fe40ce19 100644 --- a/DataFormats/ParticleFlowReco/src/classes_def_1.xml +++ b/DataFormats/ParticleFlowReco/src/classes_def_1.xml @@ -2,8 +2,8 @@ - - + + @@ -12,8 +12,8 @@ - - + + @@ -21,8 +21,8 @@ - - + + @@ -31,21 +31,19 @@ - - + + - + - - - - + + diff --git a/DataFormats/ParticleFlowReco/src/classes_def_2.xml b/DataFormats/ParticleFlowReco/src/classes_def_2.xml index 8951eddabfb17..7ac885d410bd1 100644 --- a/DataFormats/ParticleFlowReco/src/classes_def_2.xml +++ b/DataFormats/ParticleFlowReco/src/classes_def_2.xml @@ -1,96 +1,66 @@ - - - - - - - - - + + - - + + - - + + - - - + + + - - - + + + - - + + - - + + - - - - + + - - - - - - - - - - - - - - - + + - - - - - - - - + + + + + + + + + - - - + + - - - - - + + + @@ -98,48 +68,33 @@ - - - - - - + + + - - - - - + + - - - - - + + - - - - + + - - - - - - + + @@ -149,44 +104,25 @@ - + - - - - - - - - - + + - - - - - - - + + - - - - - - - + + - - + + - - - + + + - - + + - - + + - - - - - - - - - - - - - - + + - - - - - - - - - - - - - + - - - - - - - - - - - pfIsolationVariables(); - pfIsoVar.sumEcalClusterEt = onfile.ecalPFClusIso_; - pfIsoVar.sumHcalClusterEt = onfile.hcalPFClusIso_; - newObj->setPfIsolationVariables(pfIsoVar);]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - + + @@ -114,245 +39,115 @@ - - - - - - - - - - + + - + - + - + - + - + - + - + - + - + - + - - - - - - - - + + - - - - - - + + - - >(onfile.p4Jet_); ]]> - - - >(onfile.p4CorrJet_); ]]> - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.dxy_PCA_); ]]> - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.pvPos_); ]]> - - - - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.flightLength_); ]]> - - - ,ROOT::Math::DefaultCoordinateSystemTag>(onfile.svPos_); ]]> - - - - - - - - - - - - + + - - - - - - - - + - - getPflowIsolationVariables(); - pfIsoVar.sumEcalClusterEt = onfile.ecalPFClusIso_; - pfIsoVar.sumHcalClusterEt = onfile.hcalPFClusIso_; - newObj->setPflowIsolationVariables(pfIsoVar);]]> - - - + + - - - - - - - - - - - + - + - + - - - + + - - - - - - - - - + + - + - - - - - + + + - - - - + + - - - - + + - - - - - - - - + + - - - - + + - - - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -366,172 +161,126 @@ - + - + - + - + - + - - - - - ::max()*(logintpack::unpack8logClosed(onfile.packedPuppiweight_,-2,0,64)/2. + 0.5); - ]]> - - - ::max()*(logintpack::unpack8logClosed(onfile.packedPuppiweightNoLepDiff_+onfile.packedPuppiweight_,-2,0,64)/2. - logintpack::unpack8logClosed(onfile.packedPuppiweight_,-2,0,64)/2.); - ]]> - - - - - - - - - - + + + + - - - - - + - + - - - - - + + + + + - - + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - - - - + + + + + + - + - - - + + + - - - - - - + + + + + + - + - - + + - - - - - - + + + + + + - + - - - + + + @@ -585,17 +334,17 @@ - - - - - - + + + + + + - - - - + + + + @@ -612,41 +361,41 @@ - + - - - + + + - - - - + + + + - - - - + + + + - - + + - + @@ -655,7 +404,7 @@ - + diff --git a/DataFormats/PatCandidates/src/classes_def_other.xml b/DataFormats/PatCandidates/src/classes_def_other.xml index cf9459847ae20..f09755056ad86 100644 --- a/DataFormats/PatCandidates/src/classes_def_other.xml +++ b/DataFormats/PatCandidates/src/classes_def_other.xml @@ -5,8 +5,8 @@ - - + + @@ -18,42 +18,39 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - - @@ -62,8 +59,8 @@ - - + + diff --git a/DataFormats/PatCandidates/src/classes_def_trigger.xml b/DataFormats/PatCandidates/src/classes_def_trigger.xml index d6ccc0be3df01..0e224989b8e3e 100644 --- a/DataFormats/PatCandidates/src/classes_def_trigger.xml +++ b/DataFormats/PatCandidates/src/classes_def_trigger.xml @@ -1,10 +1,8 @@ - - - - + + @@ -17,7 +15,7 @@ - + @@ -26,28 +24,24 @@ - - - - - - + + - - - + + + - - + + - + - - + + @@ -58,9 +52,8 @@ - - - + + @@ -74,9 +67,8 @@ - - - + + @@ -87,8 +79,8 @@ - - + + @@ -99,14 +91,13 @@ - - + + - - - + + diff --git a/DataFormats/PatCandidates/src/classes_def_user.xml b/DataFormats/PatCandidates/src/classes_def_user.xml index f8b4d75544e1d..4c3baa4186c2e 100644 --- a/DataFormats/PatCandidates/src/classes_def_user.xml +++ b/DataFormats/PatCandidates/src/classes_def_user.xml @@ -2,8 +2,8 @@ - - + + @@ -39,9 +39,9 @@ - + - + diff --git a/DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h b/DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h index 79fa24da59ab1..11638f38915cd 100644 --- a/DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h +++ b/DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h @@ -7,37 +7,39 @@ #include "DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h" -class Phase2TrackerCluster1D { -public: - Phase2TrackerCluster1D() : data_(0) {} - Phase2TrackerCluster1D(unsigned int row, unsigned int col, unsigned int size) - : firstDigi_(row, col), data_((size & 0x7fff)) {} - Phase2TrackerCluster1D(unsigned int row, unsigned int col, unsigned int size, unsigned int threshold) - : firstDigi_(row, col), data_(((threshold & 0x1) << 15) | (size & 0x7fff)) {} - Phase2TrackerCluster1D(const Phase2TrackerDigi& firstDigi, unsigned int size) - : firstDigi_(firstDigi), data_((size & 0x7fff)) {} - Phase2TrackerCluster1D(const Phase2TrackerDigi& firstDigi, unsigned int size, unsigned int threshold) - : firstDigi_(firstDigi), data_(((threshold & 0x1) << 15) | (size & 0x7fff)) {} - - const Phase2TrackerDigi& firstDigi() const { return firstDigi_; } - unsigned int firstStrip() const { return firstDigi_.strip(); } - unsigned int firstRow() const { return firstDigi_.row(); } - unsigned int edge() const { return firstDigi_.edge(); } - unsigned int column() const { return firstDigi_.column(); } - uint16_t size() const { return (data_ & 0x7fff); } - uint16_t threshold() const { return ((data_ >> 15) & 0x1); } - float center() const { return float(firstStrip()) + 0.5f * size(); } - std::pair barycenter() const { return std::make_pair(column(), center()); } - -private: - Phase2TrackerDigi firstDigi_; - uint16_t data_; -}; - -inline bool operator<(const Phase2TrackerCluster1D& one, const Phase2TrackerCluster1D& other) { - return one.firstStrip() < other.firstStrip(); -} - +namespace io_v1 { + class Phase2TrackerCluster1D { + public: + Phase2TrackerCluster1D() : data_(0) {} + Phase2TrackerCluster1D(unsigned int row, unsigned int col, unsigned int size) + : firstDigi_(row, col), data_((size & 0x7fff)) {} + Phase2TrackerCluster1D(unsigned int row, unsigned int col, unsigned int size, unsigned int threshold) + : firstDigi_(row, col), data_(((threshold & 0x1) << 15) | (size & 0x7fff)) {} + Phase2TrackerCluster1D(const Phase2TrackerDigi& firstDigi, unsigned int size) + : firstDigi_(firstDigi), data_((size & 0x7fff)) {} + Phase2TrackerCluster1D(const Phase2TrackerDigi& firstDigi, unsigned int size, unsigned int threshold) + : firstDigi_(firstDigi), data_(((threshold & 0x1) << 15) | (size & 0x7fff)) {} + + const Phase2TrackerDigi& firstDigi() const { return firstDigi_; } + unsigned int firstStrip() const { return firstDigi_.strip(); } + unsigned int firstRow() const { return firstDigi_.row(); } + unsigned int edge() const { return firstDigi_.edge(); } + unsigned int column() const { return firstDigi_.column(); } + uint16_t size() const { return (data_ & 0x7fff); } + uint16_t threshold() const { return ((data_ >> 15) & 0x1); } + float center() const { return float(firstStrip()) + 0.5f * size(); } + std::pair barycenter() const { return std::make_pair(column(), center()); } + + private: + Phase2TrackerDigi firstDigi_; + uint16_t data_; + }; + + inline bool operator<(const Phase2TrackerCluster1D& one, const Phase2TrackerCluster1D& other) { + return one.firstStrip() < other.firstStrip(); + } +} // namespace io_v1 +using Phase2TrackerCluster1D = io_v1::Phase2TrackerCluster1D; typedef edmNew::DetSetVector Phase2TrackerCluster1DCollectionNew; #endif diff --git a/DataFormats/Phase2TrackerCluster/src/classes_def.xml b/DataFormats/Phase2TrackerCluster/src/classes_def.xml index 95a89e2b8804f..0e42f187401dc 100644 --- a/DataFormats/Phase2TrackerCluster/src/classes_def.xml +++ b/DataFormats/Phase2TrackerCluster/src/classes_def.xml @@ -1,17 +1,17 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h b/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h index c4da4ceaf130f..730728502ca25 100644 --- a/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h +++ b/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigi.h @@ -9,61 +9,65 @@ * Persistent digi for the Phase 2 tracker */ -class Phase2TrackerDigi { -public: - typedef uint16_t PackedDigiType; +namespace io_v1 { + class Phase2TrackerDigi { + public: + typedef uint16_t PackedDigiType; - Phase2TrackerDigi(unsigned int packed_channel) : theChannel(packed_channel) {} + Phase2TrackerDigi(unsigned int packed_channel) : theChannel(packed_channel) {} - Phase2TrackerDigi(unsigned int row, unsigned int col) { theChannel = pixelToChannel(row, col); } + Phase2TrackerDigi(unsigned int row, unsigned int col) { theChannel = pixelToChannel(row, col); } - Phase2TrackerDigi(unsigned int row, unsigned int col, bool ot_flag) { - theChannel = pixelToChannel(row, col); - if (ot_flag) - theChannel |= (1 << 15); - } + Phase2TrackerDigi(unsigned int row, unsigned int col, bool ot_flag) { + theChannel = pixelToChannel(row, col); + if (ot_flag) + theChannel |= (1 << 15); + } - Phase2TrackerDigi() : theChannel(0) {} + Phase2TrackerDigi() : theChannel(0) {} - // Access to digi information - pixel sensors - unsigned int row() const { return channelToRow(theChannel); } - unsigned int column() const { return channelToColumn(theChannel); } - // Access to digi information - strip sensors - unsigned int strip() const { return row(); } - unsigned int edge() const { return column(); } // CD: any better name for that? - // Access to the (raw) channel number - unsigned int channel() const { return 0x7FFF & theChannel; } - // Access Overthreshold bit - bool overThreshold() const { return (otBit(theChannel) ? true : false); } + // Access to digi information - pixel sensors + unsigned int row() const { return channelToRow(theChannel); } + unsigned int column() const { return channelToColumn(theChannel); } + // Access to digi information - strip sensors + unsigned int strip() const { return row(); } + unsigned int edge() const { return column(); } // CD: any better name for that? + // Access to the (raw) channel number + unsigned int channel() const { return 0x7FFF & theChannel; } + // Access Overthreshold bit + bool overThreshold() const { return (otBit(theChannel) ? true : false); } - static std::pair channelToPixel(unsigned int ch) { - return std::pair(channelToRow(ch), channelToColumn(ch)); - } + static std::pair channelToPixel(unsigned int ch) { + return std::pair(channelToRow(ch), channelToColumn(ch)); + } - static PackedDigiType pixelToChannel(unsigned int row, unsigned int col) { - assert(row < 1016); - assert(col < 32); - return row | (col << 10); - } + static PackedDigiType pixelToChannel(unsigned int row, unsigned int col) { + assert(row < 1016); + assert(col < 32); + return row | (col << 10); + } -private: - PackedDigiType theChannel; - static unsigned int channelToRow(unsigned int ch) { return ch & 0x03FF; } - static unsigned int channelToColumn(unsigned int ch) { return ((ch >> 10) & 0x1F); } - static unsigned int otBit(unsigned int ch) { return ((ch >> 15) & 0x1); } -}; + private: + PackedDigiType theChannel; + static unsigned int channelToRow(unsigned int ch) { return ch & 0x03FF; } + static unsigned int channelToColumn(unsigned int ch) { return ((ch >> 10) & 0x1F); } + static unsigned int otBit(unsigned int ch) { return ((ch >> 15) & 0x1); } + }; -// Comparison operators -inline bool operator<(const Phase2TrackerDigi& one, const Phase2TrackerDigi& other) { - return one.channel() < other.channel(); -} + // Comparison operators + inline bool operator<(const Phase2TrackerDigi& one, const Phase2TrackerDigi& other) { + return one.channel() < other.channel(); + } -// distance operators -inline int operator-(const Phase2TrackerDigi& one, const Phase2TrackerDigi& other) { - return int(one.channel()) - int(other.channel()); -} + // distance operators + inline int operator-(const Phase2TrackerDigi& one, const Phase2TrackerDigi& other) { + return int(one.channel()) - int(other.channel()); + } +} // namespace io_v1 +using Phase2TrackerDigi = io_v1::Phase2TrackerDigi; #include -inline std::ostream& operator<<(std::ostream& o, const Phase2TrackerDigi& digi) { return o << " " << digi.channel(); } - +namespace io_v1 { + inline std::ostream& operator<<(std::ostream& o, const Phase2TrackerDigi& digi) { return o << " " << digi.channel(); } +} // namespace io_v1 #endif // DataFormats_Phase2TrackerDigi_Phase2TrackerDigi_H diff --git a/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigiFwd.h b/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigiFwd.h index 12590ddbaae0b..93813ab3c09c6 100644 --- a/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigiFwd.h +++ b/DataFormats/Phase2TrackerDigi/interface/Phase2TrackerDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_Phase2TrackerDigi_Phase2TrackerDigiFwd_h #define DataFormats_Phase2TrackerDigi_Phase2TrackerDigiFwd_h -class Phase2TrackerDigi; +namespace io_v1 { + class Phase2TrackerDigi; +} +using Phase2TrackerDigi = io_v1::Phase2TrackerDigi; #endif diff --git a/DataFormats/Phase2TrackerDigi/src/classes_def.xml b/DataFormats/Phase2TrackerDigi/src/classes_def.xml index d16771941ea58..d824ca83f5380 100644 --- a/DataFormats/Phase2TrackerDigi/src/classes_def.xml +++ b/DataFormats/Phase2TrackerDigi/src/classes_def.xml @@ -1,37 +1,37 @@ - - + + - - - + + + - + - + - + - - - + + + - - + + diff --git a/DataFormats/ProtonReco/interface/ForwardProton.h b/DataFormats/ProtonReco/interface/ForwardProton.h index 84563ce96e0fc..4948ef4f37af8 100644 --- a/DataFormats/ProtonReco/interface/ForwardProton.h +++ b/DataFormats/ProtonReco/interface/ForwardProton.h @@ -16,157 +16,160 @@ #include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h" namespace reco { - class ForwardProton { - public: - /// parameter dimension - enum { dimension = 5 }; - /// indices to the covariance matrix - enum struct Index { xi, th_x, vtx_x, th_y, vtx_y, num_indices = dimension }; - /// dimension-parameter covariance matrix - typedef math::ErrorF::type CovarianceMatrix; - /// spatial vector - typedef math::XYZVectorF Vector; - /// point in the space - typedef math::XYZPointF Point; - /// type of reconstruction applied for this track - enum class ReconstructionMethod { invalid = -1, singleRP, multiRP }; - - public: - /// default constructor - ForwardProton(); - /// constructor from refit parameters, fitted vertex and momentum, and longitudinal fractional momentum loss - ForwardProton(double chi2, - double ndof, - const Point& vtx, - const Vector& momentum, - float xi, - const CovarianceMatrix& cov, - ReconstructionMethod method, - const CTPPSLocalTrackLiteRefVector& local_tracks, - bool valid, - const float time = 0., - const float time_err = 0.); - - /// fitted vertex position - const Point& vertex() const { return vertex_; } - /// fitted vertex horizontal position - float vx() const { return vertex_.x(); } - /// fitted vertex vertical position - float vy() const { return vertex_.y(); } - /// vertex longitudinal position (conventionally set to 0) - float vz() const { return vertex_.z(); } - /// fitted track direction - const Vector& momentum() const { return momentum_; } - /// scalar norm of fitted track momentum - float p() const { return momentum_.r(); } - /// scalar fitted track transverse momentum - float pt() const { return momentum_.rho(); } - /// fitted track momentum horizontal component - float px() const { return momentum_.x(); } - /// fitted track momentum vertical component - float py() const { return momentum_.y(); } - /// fitted track momentum longitudinal component - float pz() const { return momentum_.z(); } - - /// chi-squared of the fit - float chi2() const { return chi2_; } - /// number of degrees of freedom for the track fit - unsigned int ndof() const { return ndof_; } - /// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero) - float normalizedChi2() const { return (ndof_ != 0) ? chi2_ / ndof_ : chi2_ * 1.e6; } - - /// longitudinal fractional momentum loss - float xi() const { return xi_; } - /// vertical scattering angle, in rad - float thetaX() const { return px() / p(); } - /// horizontal scattering angle, in rad - float thetaY() const { return py() / p(); } - - // vertex position can be obtained via TrackBase::vx() and vy() functions - - /// return the uncertainty on a given component - double error(Index i) const { return sqrt(covariance_((unsigned int)i, (unsigned int)i)); } - - /// uncertainty on longitudinal fractional momentum loss - float xiError() const { return error(Index::xi); } - /// uncertainty on fitted momentum horizontal angle opening - float thetaXError() const { return error(Index::th_x); } - /// uncertainty on fitted momentum vertical angle opening - float thetaYError() const { return error(Index::th_y); } - /// uncertainty on fitted vertex horizontal position - float vxError() const { return error(Index::vtx_x); } - /// uncertainty on fitted vertex vertical position - float vyError() const { return error(Index::vtx_y); } - - /// proton mass in GeV - static float mass() { return mass_; } - - /// compute the squared four-momentum transfer from incident and scattered momenta, and angular information - static float calculateT(double beam_mom, double proton_mom, double theta); - - /// four-momentum transfer squared, in GeV^2 - float t() const; - - /// time of proton arrival at forward stations - float time() const { return time_; } - void setTime(float time) { time_ = time; } - - /// uncertainty on time of proton arrival at forward stations - float timeError() const { return time_err_; } - void setTimeError(float time_err) { time_err_ = time_err; } - - /// set the flag for the fit validity - void setValidFit(bool valid = true) { valid_fit_ = valid; } - /// flag for the fit validity - bool validFit() const { return valid_fit_; } - - /// set the reconstruction method for this track - void setMethod(const ReconstructionMethod& method) { method_ = method; } - /// reconstruction method for this track - ReconstructionMethod method() const { return method_; } - - /// store the list of RP tracks that contributed to this global track - void setContributingLocalTracks(const CTPPSLocalTrackLiteRefVector& v) { contributing_local_tracks_ = v; } - /// list of RP tracks that contributed to this global track - const CTPPSLocalTrackLiteRefVector& contributingLocalTracks() const { return contributing_local_tracks_; } - - /// LHC sector - enum class LHCSector { invalid = -1, sector45, sector56 }; - LHCSector lhcSector() const { - if (pz() < 0.) - return LHCSector::sector56; - if (pz() > 0.) - return LHCSector::sector45; - return LHCSector::invalid; - } - - private: - static constexpr float mass_ = 0.938272046; ///< proton mass, GeV - static constexpr float massSquared_ = 0.88035443; ///< proton mass squared, GeV^2 - - /// reconstructed vertex position at z/s = 0 - Point vertex_; - /// reconstructed momentum vector - Vector momentum_; - /// reconstructed time at forward detectors - float time_; - /// uncertainty on reconstructed time at forward detectors - float time_err_; - /// fractional momentum loss (positive for diffractive protons) - float xi_; - /// 5x5 covariance matrix - CovarianceMatrix covariance_; - /// chi-squared - float chi2_; - /// number of degrees of freedom - unsigned int ndof_; - /// fit validity flag - bool valid_fit_; - /// type of reconstruction applied - ReconstructionMethod method_; - /// collection of references to tracks contributing to this object definition - CTPPSLocalTrackLiteRefVector contributing_local_tracks_; - }; + namespace io_v1 { + class ForwardProton { + public: + /// parameter dimension + enum { dimension = 5 }; + /// indices to the covariance matrix + enum struct Index { xi, th_x, vtx_x, th_y, vtx_y, num_indices = dimension }; + /// dimension-parameter covariance matrix + typedef math::ErrorF::type CovarianceMatrix; + /// spatial vector + typedef math::XYZVectorF Vector; + /// point in the space + typedef math::XYZPointF Point; + /// type of reconstruction applied for this track + enum class ReconstructionMethod { invalid = -1, singleRP, multiRP }; + + public: + /// default constructor + ForwardProton(); + /// constructor from refit parameters, fitted vertex and momentum, and longitudinal fractional momentum loss + ForwardProton(double chi2, + double ndof, + const Point& vtx, + const Vector& momentum, + float xi, + const CovarianceMatrix& cov, + ReconstructionMethod method, + const CTPPSLocalTrackLiteRefVector& local_tracks, + bool valid, + const float time = 0., + const float time_err = 0.); + + /// fitted vertex position + const Point& vertex() const { return vertex_; } + /// fitted vertex horizontal position + float vx() const { return vertex_.x(); } + /// fitted vertex vertical position + float vy() const { return vertex_.y(); } + /// vertex longitudinal position (conventionally set to 0) + float vz() const { return vertex_.z(); } + /// fitted track direction + const Vector& momentum() const { return momentum_; } + /// scalar norm of fitted track momentum + float p() const { return momentum_.r(); } + /// scalar fitted track transverse momentum + float pt() const { return momentum_.rho(); } + /// fitted track momentum horizontal component + float px() const { return momentum_.x(); } + /// fitted track momentum vertical component + float py() const { return momentum_.y(); } + /// fitted track momentum longitudinal component + float pz() const { return momentum_.z(); } + + /// chi-squared of the fit + float chi2() const { return chi2_; } + /// number of degrees of freedom for the track fit + unsigned int ndof() const { return ndof_; } + /// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero) + float normalizedChi2() const { return (ndof_ != 0) ? chi2_ / ndof_ : chi2_ * 1.e6; } + + /// longitudinal fractional momentum loss + float xi() const { return xi_; } + /// vertical scattering angle, in rad + float thetaX() const { return px() / p(); } + /// horizontal scattering angle, in rad + float thetaY() const { return py() / p(); } + + // vertex position can be obtained via TrackBase::vx() and vy() functions + + /// return the uncertainty on a given component + double error(Index i) const { return sqrt(covariance_((unsigned int)i, (unsigned int)i)); } + + /// uncertainty on longitudinal fractional momentum loss + float xiError() const { return error(Index::xi); } + /// uncertainty on fitted momentum horizontal angle opening + float thetaXError() const { return error(Index::th_x); } + /// uncertainty on fitted momentum vertical angle opening + float thetaYError() const { return error(Index::th_y); } + /// uncertainty on fitted vertex horizontal position + float vxError() const { return error(Index::vtx_x); } + /// uncertainty on fitted vertex vertical position + float vyError() const { return error(Index::vtx_y); } + + /// proton mass in GeV + static float mass() { return mass_; } + + /// compute the squared four-momentum transfer from incident and scattered momenta, and angular information + static float calculateT(double beam_mom, double proton_mom, double theta); + + /// four-momentum transfer squared, in GeV^2 + float t() const; + + /// time of proton arrival at forward stations + float time() const { return time_; } + void setTime(float time) { time_ = time; } + + /// uncertainty on time of proton arrival at forward stations + float timeError() const { return time_err_; } + void setTimeError(float time_err) { time_err_ = time_err; } + + /// set the flag for the fit validity + void setValidFit(bool valid = true) { valid_fit_ = valid; } + /// flag for the fit validity + bool validFit() const { return valid_fit_; } + + /// set the reconstruction method for this track + void setMethod(const ReconstructionMethod& method) { method_ = method; } + /// reconstruction method for this track + ReconstructionMethod method() const { return method_; } + + /// store the list of RP tracks that contributed to this global track + void setContributingLocalTracks(const CTPPSLocalTrackLiteRefVector& v) { contributing_local_tracks_ = v; } + /// list of RP tracks that contributed to this global track + const CTPPSLocalTrackLiteRefVector& contributingLocalTracks() const { return contributing_local_tracks_; } + + /// LHC sector + enum class LHCSector { invalid = -1, sector45, sector56 }; + LHCSector lhcSector() const { + if (pz() < 0.) + return LHCSector::sector56; + if (pz() > 0.) + return LHCSector::sector45; + return LHCSector::invalid; + } + + private: + static constexpr float mass_ = 0.938272046; ///< proton mass, GeV + static constexpr float massSquared_ = 0.88035443; ///< proton mass squared, GeV^2 + + /// reconstructed vertex position at z/s = 0 + Point vertex_; + /// reconstructed momentum vector + Vector momentum_; + /// reconstructed time at forward detectors + float time_; + /// uncertainty on reconstructed time at forward detectors + float time_err_; + /// fractional momentum loss (positive for diffractive protons) + float xi_; + /// 5x5 covariance matrix + CovarianceMatrix covariance_; + /// chi-squared + float chi2_; + /// number of degrees of freedom + unsigned int ndof_; + /// fit validity flag + bool valid_fit_; + /// type of reconstruction applied + ReconstructionMethod method_; + /// collection of references to tracks contributing to this object definition + CTPPSLocalTrackLiteRefVector contributing_local_tracks_; + }; + } // namespace io_v1 + using ForwardProton = io_v1::ForwardProton; } // namespace reco #endif diff --git a/DataFormats/ProtonReco/interface/ForwardProtonFwd.h b/DataFormats/ProtonReco/interface/ForwardProtonFwd.h index 8ef9b32c6d078..9ec1e3eeec77b 100644 --- a/DataFormats/ProtonReco/interface/ForwardProtonFwd.h +++ b/DataFormats/ProtonReco/interface/ForwardProtonFwd.h @@ -17,7 +17,10 @@ #include namespace reco { - class ForwardProton; + namespace io_v1 { + class ForwardProton; + } + using ForwardProton = io_v1::ForwardProton; /// Collection of ForwardProton objects typedef std::vector ForwardProtonCollection; /// Persistent reference to a ForwardProton diff --git a/DataFormats/ProtonReco/src/classes_def.xml b/DataFormats/ProtonReco/src/classes_def.xml index 0e88cf81de42e..7ab8ec92a7c85 100644 --- a/DataFormats/ProtonReco/src/classes_def.xml +++ b/DataFormats/ProtonReco/src/classes_def.xml @@ -1,10 +1,10 @@ - - + + - - - - - + + + + + diff --git a/DataFormats/RPCDigi/interface/RPCDigi.h b/DataFormats/RPCDigi/interface/RPCDigi.h index 8125e8433a10b..c5d4b56c6f208 100644 --- a/DataFormats/RPCDigi/interface/RPCDigi.h +++ b/DataFormats/RPCDigi/interface/RPCDigi.h @@ -16,50 +16,52 @@ #include #include -class RPCDigi { -public: - explicit RPCDigi(int strip, int bx); - RPCDigi(); +namespace io_v1 { + class RPCDigi { + public: + explicit RPCDigi(int strip, int bx); + RPCDigi(); - bool operator==(const RPCDigi& digi) const; - bool operator<(const RPCDigi& digi) const; - void print() const; - int strip() const { return strip_; } - int bx() const { return bx_; } - double time() const { return time_; } - double coordinateX() const { return coordinateX_; } - double coordinateY() const { return coordinateY_; } - bool hasTime() const { return hasTime_; } - bool hasX() const { return hasX_; } - bool hasY() const { return hasY_; } - void hasTime(bool has) { hasTime_ = has; } - void hasX(bool has) { hasX_ = has; } - void hasY(bool has) { hasY_ = has; } - double deltaTime() const { return deltaTime_; } - double deltaX() const { return deltaX_; } - double deltaY() const { return deltaY_; } - void setTime(double time) { time_ = time; } - void setDeltaTime(double dt) { deltaTime_ = dt; } - void setX(double x) { coordinateX_ = x; } - void setY(double y) { coordinateY_ = y; } - void setDeltaX(double dx) { deltaX_ = dx; } - void setDeltaY(double dy) { deltaY_ = dy; } - bool isPseudoDigi() const { return hasX_ || hasY_; } + bool operator==(const RPCDigi& digi) const; + bool operator<(const RPCDigi& digi) const; + void print() const; + int strip() const { return strip_; } + int bx() const { return bx_; } + double time() const { return time_; } + double coordinateX() const { return coordinateX_; } + double coordinateY() const { return coordinateY_; } + bool hasTime() const { return hasTime_; } + bool hasX() const { return hasX_; } + bool hasY() const { return hasY_; } + void hasTime(bool has) { hasTime_ = has; } + void hasX(bool has) { hasX_ = has; } + void hasY(bool has) { hasY_ = has; } + double deltaTime() const { return deltaTime_; } + double deltaX() const { return deltaX_; } + double deltaY() const { return deltaY_; } + void setTime(double time) { time_ = time; } + void setDeltaTime(double dt) { deltaTime_ = dt; } + void setX(double x) { coordinateX_ = x; } + void setY(double y) { coordinateY_ = y; } + void setDeltaX(double dx) { deltaX_ = dx; } + void setDeltaY(double dy) { deltaY_ = dy; } + bool isPseudoDigi() const { return hasX_ || hasY_; } -private: - uint16_t strip_; - int32_t bx_; - double time_; - double coordinateX_; - double coordinateY_; - double deltaTime_; - double deltaX_; - double deltaY_; - bool hasTime_; - bool hasX_; - bool hasY_; -}; - -std::ostream& operator<<(std::ostream& o, const RPCDigi& digi); + private: + uint16_t strip_; + int32_t bx_; + double time_; + double coordinateX_; + double coordinateY_; + double deltaTime_; + double deltaX_; + double deltaY_; + bool hasTime_; + bool hasX_; + bool hasY_; + }; + std::ostream& operator<<(std::ostream& o, const RPCDigi& digi); +} // namespace io_v1 +using RPCDigi = io_v1::RPCDigi; #endif diff --git a/DataFormats/RPCDigi/interface/RPCDigiFwd.h b/DataFormats/RPCDigi/interface/RPCDigiFwd.h index a688f045cbb3d..5277a26c807f0 100644 --- a/DataFormats/RPCDigi/interface/RPCDigiFwd.h +++ b/DataFormats/RPCDigi/interface/RPCDigiFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_RPCDigi_RPCDigiFwd_h #define DataFormats_RPCDigi_RPCDigiFwd_h -class RPCDigi; - +namespace io_v1 { + class RPCDigi; +} +using RPCDigi = io_v1::RPCDigi; #endif diff --git a/DataFormats/RPCDigi/src/RPCDigi.cc b/DataFormats/RPCDigi/src/RPCDigi.cc index ad546042214ef..b1e8832c35da8 100644 --- a/DataFormats/RPCDigi/src/RPCDigi.cc +++ b/DataFormats/RPCDigi/src/RPCDigi.cc @@ -12,47 +12,51 @@ #include "DataFormats/RPCDigi/interface/RPCDigi.h" #include -RPCDigi::RPCDigi(int strip, int bx) - : strip_(strip), - bx_(bx), - time_(0), - coordinateX_(0), - coordinateY_(0), - deltaTime_(0), - deltaX_(0), - deltaY_(0), - hasTime_(false), - hasX_(false), - hasY_(false) {} +namespace io_v1 { + RPCDigi::RPCDigi(int strip, int bx) + : strip_(strip), + bx_(bx), + time_(0), + coordinateX_(0), + coordinateY_(0), + deltaTime_(0), + deltaX_(0), + deltaY_(0), + hasTime_(false), + hasX_(false), + hasY_(false) {} -RPCDigi::RPCDigi() - : strip_(0), - bx_(0), - time_(0), - coordinateX_(0), - coordinateY_(0), - deltaTime_(0), - deltaX_(0), - deltaY_(0), - hasTime_(false), - hasX_(false), - hasY_(false) {} + RPCDigi::RPCDigi() + : strip_(0), + bx_(0), + time_(0), + coordinateX_(0), + coordinateY_(0), + deltaTime_(0), + deltaX_(0), + deltaY_(0), + hasTime_(false), + hasX_(false), + hasY_(false) {} -// Comparison -bool RPCDigi::operator==(const RPCDigi& digi) const { - if (strip_ != digi.strip() || bx_ != digi.bx()) - return false; - return true; -} + // Comparison + bool RPCDigi::operator==(const RPCDigi& digi) const { + if (strip_ != digi.strip() || bx_ != digi.bx()) + return false; + return true; + } -///Precedence operator -bool RPCDigi::operator<(const RPCDigi& digi) const { - if (digi.bx() == this->bx()) - return digi.strip() < this->strip(); - else - return digi.bx() < this->bx(); -} + ///Precedence operator + bool RPCDigi::operator<(const RPCDigi& digi) const { + if (digi.bx() == this->bx()) + return digi.strip() < this->strip(); + else + return digi.bx() < this->bx(); + } -std::ostream& operator<<(std::ostream& o, const RPCDigi& digi) { return o << " " << digi.strip() << " " << digi.bx(); } + std::ostream& operator<<(std::ostream& o, const RPCDigi& digi) { + return o << " " << digi.strip() << " " << digi.bx(); + } -void RPCDigi::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; } + void RPCDigi::print() const { std::cout << "Strip " << strip() << " bx " << bx() << std::endl; } +} // namespace io_v1 diff --git a/DataFormats/RPCDigi/src/classes_def.xml b/DataFormats/RPCDigi/src/classes_def.xml index 5f5842115f977..9e52e7e1bf0a2 100644 --- a/DataFormats/RPCDigi/src/classes_def.xml +++ b/DataFormats/RPCDigi/src/classes_def.xml @@ -1,29 +1,29 @@ - - + + - - - - - + + + + + - - + + - - + + - - + + diff --git a/DataFormats/RPCRecHit/interface/RPCRecHit.h b/DataFormats/RPCRecHit/interface/RPCRecHit.h index 1b1d26bde526e..85d742ba3e747 100644 --- a/DataFormats/RPCRecHit/interface/RPCRecHit.h +++ b/DataFormats/RPCRecHit/interface/RPCRecHit.h @@ -11,89 +11,92 @@ #include "DataFormats/TrackingRecHit/interface/RecHit2DLocalPos.h" #include "DataFormats/MuonDetId/interface/RPCDetId.h" -class RPCRecHit : public RecHit2DLocalPos { -public: - RPCRecHit(const RPCDetId& rpcId, int bx); +namespace io_v1 { + class RPCRecHit : public RecHit2DLocalPos { + public: + RPCRecHit(const RPCDetId& rpcId, int bx); - /// Default constructor - RPCRecHit(); + /// Default constructor + RPCRecHit(); - /// Constructor from a local position, rpcId and digi time. - /// The 3-dimensional local error is defined as - /// resolution (the cell resolution) for the coordinate being measured - /// and 0 for the two other coordinates - RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos); + /// Constructor from a local position, rpcId and digi time. + /// The 3-dimensional local error is defined as + /// resolution (the cell resolution) for the coordinate being measured + /// and 0 for the two other coordinates + RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos); - /// Constructor from a local position and error, rpcId and bx. - RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err); + /// Constructor from a local position and error, rpcId and bx. + RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err); - /// Constructor from a local position and error, rpcId, bx, frist strip of cluster and cluster size. - RPCRecHit(const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err); + /// Constructor from a local position and error, rpcId, bx, frist strip of cluster and cluster size. + RPCRecHit( + const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err); - /// Destructor - ~RPCRecHit() override; + /// Destructor + ~RPCRecHit() override; - /// Return the 3-dimensional local position - LocalPoint localPosition() const override { return theLocalPosition; } + /// Return the 3-dimensional local position + LocalPoint localPosition() const override { return theLocalPosition; } - /// Return the 3-dimensional error on the local position - LocalError localPositionError() const override { return theLocalError; } + /// Return the 3-dimensional error on the local position + LocalError localPositionError() const override { return theLocalError; } - RPCRecHit* clone() const override; + RPCRecHit* clone() const override; - /// Access to component RecHits. - /// No components rechits: it returns a null vector - std::vector recHits() const override; + /// Access to component RecHits. + /// No components rechits: it returns a null vector + std::vector recHits() const override; - /// Non-const access to component RecHits. - /// No components rechits: it returns a null vector - std::vector recHits() override; + /// Non-const access to component RecHits. + /// No components rechits: it returns a null vector + std::vector recHits() override; - /// Set local position - void setPosition(LocalPoint pos) { theLocalPosition = pos; } + /// Set local position + void setPosition(LocalPoint pos) { theLocalPosition = pos; } - /// Set local position error - void setError(LocalError err) { theLocalError = err; } + /// Set local position error + void setError(LocalError err) { theLocalError = err; } - /// Set the local position and its error - void setPositionAndError(LocalPoint pos, LocalError err) { - theLocalPosition = pos; - theLocalError = err; - } + /// Set the local position and its error + void setPositionAndError(LocalPoint pos, LocalError err) { + theLocalPosition = pos; + theLocalError = err; + } - /// Set the time and its error - void setTimeAndError(float time, float err) { - theTime = time; - theTimeError = err; - } + /// Set the time and its error + void setTimeAndError(float time, float err) { + theTime = time; + theTimeError = err; + } - /// Return the rpcId - RPCDetId rpcId() const { return theRPCId; } + /// Return the rpcId + RPCDetId rpcId() const { return theRPCId; } - int BunchX() const { return theBx; } + int BunchX() const { return theBx; } - int firstClusterStrip() const { return theFirstStrip; } + int firstClusterStrip() const { return theFirstStrip; } - int clusterSize() const { return theClusterSize; } + int clusterSize() const { return theClusterSize; } - float time() const { return theTime; } + float time() const { return theTime; } - float timeError() const { return theTimeError; } + float timeError() const { return theTimeError; } - /// Comparison operator, based on the rpcId and the digi time - bool operator==(const RPCRecHit& hit) const; + /// Comparison operator, based on the rpcId and the digi time + bool operator==(const RPCRecHit& hit) const; -private: - RPCDetId theRPCId; - int theBx; - int theFirstStrip; - int theClusterSize; - // Position and error in the Local Ref. Frame of the RPCLayer - LocalPoint theLocalPosition; - LocalError theLocalError; - float theTime, theTimeError; -}; + private: + RPCDetId theRPCId; + int theBx; + int theFirstStrip; + int theClusterSize; + // Position and error in the Local Ref. Frame of the RPCLayer + LocalPoint theLocalPosition; + LocalError theLocalError; + float theTime, theTimeError; + }; + /// The ostream operator + std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit); +} // namespace io_v1 +using RPCRecHit = io_v1::RPCRecHit; #endif - -/// The ostream operator -std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit); diff --git a/DataFormats/RPCRecHit/interface/RPCRecHitCollection.h b/DataFormats/RPCRecHit/interface/RPCRecHitCollection.h index 1bf320e086b45..8ffcf77fe9181 100644 --- a/DataFormats/RPCRecHit/interface/RPCRecHitCollection.h +++ b/DataFormats/RPCRecHit/interface/RPCRecHitCollection.h @@ -9,12 +9,8 @@ #include "DataFormats/MuonDetId/interface/RPCDetId.h" #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" -#include "DataFormats/Common/interface/RangeMap.h" -#include "DataFormats/Common/interface/ClonePolicy.h" -#include "DataFormats/Common/interface/OwnVector.h" -#include +#include "DataFormats/Common/interface/IdToHitRange.h" -typedef edm::RangeMap >, edm::ClonePolicy > - RPCRecHitCollection; +using RPCRecHitCollection = edm::IdToHitRange; #endif diff --git a/DataFormats/RPCRecHit/interface/RPCRecHitFwd.h b/DataFormats/RPCRecHit/interface/RPCRecHitFwd.h index 9f9abf58842ee..20306d9af6381 100644 --- a/DataFormats/RPCRecHit/interface/RPCRecHitFwd.h +++ b/DataFormats/RPCRecHit/interface/RPCRecHitFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_RPCRecHit_RPCRecHitFwd_h #define DataFormats_RPCRecHit_RPCRecHitFwd_h -class RPCRecHit; - +namespace io_v1 { + class RPCRecHit; +} +using RPCRecHit = io_v1::RPCRecHit; #endif diff --git a/DataFormats/RPCRecHit/src/RPCRecHit.cc b/DataFormats/RPCRecHit/src/RPCRecHit.cc index 49272446736fe..63a9edd8447ce 100644 --- a/DataFormats/RPCRecHit/src/RPCRecHit.cc +++ b/DataFormats/RPCRecHit/src/RPCRecHit.cc @@ -6,92 +6,94 @@ #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" -RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx) - : RecHit2DLocalPos(rpcId), - theRPCId(rpcId), - theBx(bx), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(), - theLocalError(), - theTime(0), - theTimeError(-1) {} +namespace io_v1 { + RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx) + : RecHit2DLocalPos(rpcId), + theRPCId(rpcId), + theBx(bx), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(), + theLocalError(), + theTime(0), + theTimeError(-1) {} -RPCRecHit::RPCRecHit() - : RecHit2DLocalPos(), - theRPCId(), - theBx(99), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(), - theLocalError(), - theTime(0), - theTimeError(-1) {} + RPCRecHit::RPCRecHit() + : RecHit2DLocalPos(), + theRPCId(), + theBx(99), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(), + theLocalError(), + theTime(0), + theTimeError(-1) {} -RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos) - : RecHit2DLocalPos(rpcId), - theRPCId(rpcId), - theBx(bx), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(pos), - theTime(0), - theTimeError(-1) { - float stripResolution = 3.0; //cm this sould be taken from trimmed cluster size times strip size - // taken out from geometry service i.e. topology - theLocalError = LocalError(stripResolution * stripResolution, 0., 0.); //FIXME: is it really needed? -} + RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos) + : RecHit2DLocalPos(rpcId), + theRPCId(rpcId), + theBx(bx), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(pos), + theTime(0), + theTimeError(-1) { + float stripResolution = 3.0; //cm this sould be taken from trimmed cluster size times strip size + // taken out from geometry service i.e. topology + theLocalError = LocalError(stripResolution * stripResolution, 0., 0.); //FIXME: is it really needed? + } -// Constructor from a local position and error, wireId and digi time. -RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err) - : RecHit2DLocalPos(rpcId), - theRPCId(rpcId), - theBx(bx), - theFirstStrip(99), - theClusterSize(99), - theLocalPosition(pos), - theLocalError(err), - theTime(0), - theTimeError(-1) {} + // Constructor from a local position and error, wireId and digi time. + RPCRecHit::RPCRecHit(const RPCDetId& rpcId, int bx, const LocalPoint& pos, const LocalError& err) + : RecHit2DLocalPos(rpcId), + theRPCId(rpcId), + theBx(bx), + theFirstStrip(99), + theClusterSize(99), + theLocalPosition(pos), + theLocalError(err), + theTime(0), + theTimeError(-1) {} -// Constructor from a local position and error, wireId, bx and cluster size. -RPCRecHit::RPCRecHit( - const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err) - : RecHit2DLocalPos(rpcId), - theRPCId(rpcId), - theBx(bx), - theFirstStrip(firstStrip), - theClusterSize(clustSize), - theLocalPosition(pos), - theLocalError(err), - theTime(0), - theTimeError(-1) {} + // Constructor from a local position and error, wireId, bx and cluster size. + RPCRecHit::RPCRecHit( + const RPCDetId& rpcId, int bx, int firstStrip, int clustSize, const LocalPoint& pos, const LocalError& err) + : RecHit2DLocalPos(rpcId), + theRPCId(rpcId), + theBx(bx), + theFirstStrip(firstStrip), + theClusterSize(clustSize), + theLocalPosition(pos), + theLocalError(err), + theTime(0), + theTimeError(-1) {} -// Destructor -RPCRecHit::~RPCRecHit() {} + // Destructor + RPCRecHit::~RPCRecHit() {} -RPCRecHit* RPCRecHit::clone() const { return new RPCRecHit(*this); } + RPCRecHit* RPCRecHit::clone() const { return new RPCRecHit(*this); } -// Access to component RecHits. -// No components rechits: it returns a null vector -std::vector RPCRecHit::recHits() const { - std::vector nullvector; - return nullvector; -} + // Access to component RecHits. + // No components rechits: it returns a null vector + std::vector RPCRecHit::recHits() const { + std::vector nullvector; + return nullvector; + } -// Non-const access to component RecHits. -// No components rechits: it returns a null vector -std::vector RPCRecHit::recHits() { - std::vector nullvector; - return nullvector; -} + // Non-const access to component RecHits. + // No components rechits: it returns a null vector + std::vector RPCRecHit::recHits() { + std::vector nullvector; + return nullvector; + } -// Comparison operator, based on the wireId and the digi time -bool RPCRecHit::operator==(const RPCRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); } + // Comparison operator, based on the wireId and the digi time + bool RPCRecHit::operator==(const RPCRecHit& hit) const { return this->geographicalId() == hit.geographicalId(); } -// The ostream operator -std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit) { - os << "pos: " << hit.localPosition().x(); - os << " +/- " << sqrt(hit.localPositionError().xx()); - return os; -} + // The ostream operator + std::ostream& operator<<(std::ostream& os, const RPCRecHit& hit) { + os << "pos: " << hit.localPosition().x(); + os << " +/- " << sqrt(hit.localPositionError().xx()); + return os; + } +} // namespace io_v1 diff --git a/DataFormats/RPCRecHit/src/classes.h b/DataFormats/RPCRecHit/src/classes.h index 97133ba638800..2ef491f3c446a 100644 --- a/DataFormats/RPCRecHit/src/classes.h +++ b/DataFormats/RPCRecHit/src/classes.h @@ -1,3 +1,5 @@ #include "DataFormats/RPCRecHit/interface/RPCRecHit.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" +#include "DataFormats/Common/interface/OwnVector.h" +#include "DataFormats/Common/interface/RangeMap.h" #include "DataFormats/Common/interface/Wrapper.h" diff --git a/DataFormats/RPCRecHit/src/classes_def.xml b/DataFormats/RPCRecHit/src/classes_def.xml index 28c454093d78c..d9c341a44b392 100644 --- a/DataFormats/RPCRecHit/src/classes_def.xml +++ b/DataFormats/RPCRecHit/src/classes_def.xml @@ -1,23 +1,23 @@ - - - - + + - - + + - - - - + + + + + + - + diff --git a/DataFormats/RecoCandidate/interface/IsoDeposit.h b/DataFormats/RecoCandidate/interface/IsoDeposit.h index aa4c0d16f7506..1b3714f1f017d 100644 --- a/DataFormats/RecoCandidate/interface/IsoDeposit.h +++ b/DataFormats/RecoCandidate/interface/IsoDeposit.h @@ -45,264 +45,267 @@ namespace reco { } // namespace reco namespace reco { + namespace io_v1 { - class IsoDeposit { - public: - typedef isodeposit::Direction Direction; - typedef isodeposit::AbsVeto AbsVeto; - typedef isodeposit::AbsVetos AbsVetos; - typedef Direction::Distance Distance; - typedef std::multimap DepositsMultimap; - typedef DepositsMultimap::const_iterator DepIterator; - - // old style vetos - struct Veto { - Direction vetoDir; - float dR; - Veto() {} - Veto(Direction dir, double d) : vetoDir(dir), dR(d) {} - }; - typedef std::vector Vetos; - - //! Constructor - IsoDeposit(double eta = 0, double phi = 0); - IsoDeposit(const Direction& candDirection); - - //! Destructor - virtual ~IsoDeposit() {} - - //! Get direction of isolation cone - const Direction& direction() const { return theDirection; } - double eta() const { return theDirection.eta(); } - double phi() const { return theDirection.phi(); } - - //! Get veto area - const Veto& veto() const { return theVeto; } - //! Set veto - void setVeto(const Veto& aVeto) { theVeto = aVeto; } - - //! Add deposit (ie. transverse energy or pT) - void addDeposit(double dr, double deposit); // FIXME - temporary for backward compatibility - void addDeposit(const Direction& depDir, double deposit); - - //! Get deposit - double depositWithin(double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit wrt other direction - double depositWithin(Direction dir, - double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit - std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - double threshold = -1e+36, //threshold on counted deposits - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit wrt other direction - std::pair depositAndCountWithin(Direction dir, //wrt another direction - double coneSize, //dR in which deposit is computed - const Vetos& vetos = Vetos(), //additional vetos - double threshold = -1e+36, //threshold on deposits - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit with new style vetos - double depositWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos, //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get deposit - std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos, //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - //! Get energy or pT attached to cand trajectory - double candEnergy() const { return theCandTag; } - - //! Set energy or pT attached to cand trajectory - void addCandEnergy(double et) { theCandTag += et; } - - std::string print() const; - - class const_iterator { + class IsoDeposit { public: - const const_iterator& operator++() { - ++it_; - cacheReady_ = false; - return *this; - } - const const_iterator* operator->() const { return this; } - float dR() const { return it_->first.deltaR; } - float eta() const { - if (!cacheReady_) - doDir(); - return cache_.eta(); - } - float phi() const { - if (!cacheReady_) - doDir(); - return cache_.phi(); - } - float value() const { return it_->second; } - bool operator!=(const const_iterator& it2) { return it2.it_ != it_; } - friend class IsoDeposit; - - private: + typedef isodeposit::Direction Direction; + typedef isodeposit::AbsVeto AbsVeto; + typedef isodeposit::AbsVetos AbsVetos; typedef Direction::Distance Distance; - void doDir() const { - if (!cacheReady_) - cache_ = parent_->direction() + it_->first; - cacheReady_ = true; - } - const_iterator(const IsoDeposit* parent, std::multimap::const_iterator it) - : parent_(parent), it_(it), cache_(), cacheReady_(false) {} - const reco::IsoDeposit* parent_; - std::multimap::const_iterator it_; - CMS_THREAD_SAFE mutable Direction cache_; - mutable std::atomic cacheReady_; - }; - const_iterator begin() const { return const_iterator(this, theDeposits.begin()); } - const_iterator end() const { return const_iterator(this, theDeposits.end()); } - - class SumAlgo { - public: - SumAlgo() : sum_(0) {} - void operator+=(DepIterator deposit) { sum_ += deposit->second; } - void operator+=(double deposit) { sum_ += deposit; } - double result() const { return sum_; } - - private: - double sum_; - }; - class CountAlgo { - public: - CountAlgo() : count_(0) {} - void operator+=(DepIterator deposit) { count_++; } - void operator+=(double deposit) { count_++; } - double result() const { return count_; } - - private: - size_t count_; - }; - class Sum2Algo { - public: - Sum2Algo() : sum2_(0) {} - void operator+=(DepIterator deposit) { sum2_ += deposit->second * deposit->second; } - void operator+=(double deposit) { sum2_ += deposit * deposit; } - double result() const { return sum2_; } - - private: - double sum2_; - }; - class MaxAlgo { - public: - MaxAlgo() : max_(0) {} - void operator+=(DepIterator deposit) { - if (deposit->second > max_) - max_ = deposit->second; - } - void operator+=(double deposit) { - if (deposit > max_) - max_ = deposit; - } - double result() const { return max_; } + typedef std::multimap DepositsMultimap; + typedef DepositsMultimap::const_iterator DepIterator; + + // old style vetos + struct Veto { + Direction vetoDir; + float dR; + Veto() {} + Veto(Direction dir, double d) : vetoDir(dir), dR(d) {} + }; + typedef std::vector Vetos; + + //! Constructor + IsoDeposit(double eta = 0, double phi = 0); + IsoDeposit(const Direction& candDirection); + + //! Destructor + virtual ~IsoDeposit() {} + + //! Get direction of isolation cone + const Direction& direction() const { return theDirection; } + double eta() const { return theDirection.eta(); } + double phi() const { return theDirection.phi(); } + + //! Get veto area + const Veto& veto() const { return theVeto; } + //! Set veto + void setVeto(const Veto& aVeto) { theVeto = aVeto; } + + //! Add deposit (ie. transverse energy or pT) + void addDeposit(double dr, double deposit); // FIXME - temporary for backward compatibility + void addDeposit(const Direction& depDir, double deposit); + + //! Get deposit + double depositWithin(double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit wrt other direction + double depositWithin(Direction dir, + double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit + std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + double threshold = -1e+36, //threshold on counted deposits + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit wrt other direction + std::pair depositAndCountWithin(Direction dir, //wrt another direction + double coneSize, //dR in which deposit is computed + const Vetos& vetos = Vetos(), //additional vetos + double threshold = -1e+36, //threshold on deposits + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit with new style vetos + double depositWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos, //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get deposit + std::pair depositAndCountWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos, //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + + //! Get energy or pT attached to cand trajectory + double candEnergy() const { return theCandTag; } + + //! Set energy or pT attached to cand trajectory + void addCandEnergy(double et) { theCandTag += et; } + + std::string print() const; + + class const_iterator { + public: + const const_iterator& operator++() { + ++it_; + cacheReady_ = false; + return *this; + } + const const_iterator* operator->() const { return this; } + float dR() const { return it_->first.deltaR; } + float eta() const { + if (!cacheReady_) + doDir(); + return cache_.eta(); + } + float phi() const { + if (!cacheReady_) + doDir(); + return cache_.phi(); + } + float value() const { return it_->second; } + bool operator!=(const const_iterator& it2) { return it2.it_ != it_; } + friend class IsoDeposit; + + private: + typedef Direction::Distance Distance; + void doDir() const { + if (!cacheReady_) + cache_ = parent_->direction() + it_->first; + cacheReady_ = true; + } + const_iterator(const IsoDeposit* parent, std::multimap::const_iterator it) + : parent_(parent), it_(it), cache_(), cacheReady_(false) {} + const IsoDeposit* parent_; + std::multimap::const_iterator it_; + CMS_THREAD_SAFE mutable Direction cache_; + mutable std::atomic cacheReady_; + }; + const_iterator begin() const { return const_iterator(this, theDeposits.begin()); } + const_iterator end() const { return const_iterator(this, theDeposits.end()); } + + class SumAlgo { + public: + SumAlgo() : sum_(0) {} + void operator+=(DepIterator deposit) { sum_ += deposit->second; } + void operator+=(double deposit) { sum_ += deposit; } + double result() const { return sum_; } + + private: + double sum_; + }; + class CountAlgo { + public: + CountAlgo() : count_(0) {} + void operator+=(DepIterator deposit) { count_++; } + void operator+=(double deposit) { count_++; } + double result() const { return count_; } + + private: + size_t count_; + }; + class Sum2Algo { + public: + Sum2Algo() : sum2_(0) {} + void operator+=(DepIterator deposit) { sum2_ += deposit->second * deposit->second; } + void operator+=(double deposit) { sum2_ += deposit * deposit; } + double result() const { return sum2_; } + + private: + double sum2_; + }; + class MaxAlgo { + public: + MaxAlgo() : max_(0) {} + void operator+=(DepIterator deposit) { + if (deposit->second > max_) + max_ = deposit->second; + } + void operator+=(double deposit) { + if (deposit > max_) + max_ = deposit; + } + double result() const { return max_; } + + private: + double max_; + }; + + class MeanDRAlgo { + public: + MeanDRAlgo() : sum_(0.), count_(0.) {} + void operator+=(DepIterator deposit) { + sum_ += deposit->first.deltaR; + count_ += 1.0; + } + double result() const { return sum_ / std::max(1., count_); } + + private: + double sum_; + double count_; + }; + + class SumDRAlgo { + public: + SumDRAlgo() : sum_(0.) {} + void operator+=(DepIterator deposit) { sum_ += deposit->first.deltaR; } + double result() const { return sum_; } + + private: + double sum_; + }; + + //! Get some info about the deposit (e.g. sum, max, sum2, count) + template + double algoWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + //! Get some info about the deposit (e.g. sum, max, sum2, count) w.r.t. other direction + template + double algoWithin(const Direction&, + double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // count of the non-vetoed deposits in the cone + double countWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // sum of the non-vetoed deposits in the cone + double sumWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // sum of the non-vetoed deposits in the cone w.r.t. other direction + double sumWithin(const Direction& dir, + double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; // sum of the squares of the non-vetoed deposits in the cone + double sum2Within(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // maximum value among the non-vetoed deposits in the cone + double maxWithin(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; + // maximum value among the non-vetoed deposits in the cone + double nearestDR(double coneSize, //dR in which deposit is computed + const AbsVetos& vetos = AbsVetos(), //additional vetos + bool skipDepositVeto = false //skip exclusion of veto + ) const; private: - double max_; - }; + //! direcion of deposit (center of isolation cone) + Direction theDirection; - class MeanDRAlgo { - public: - MeanDRAlgo() : sum_(0.), count_(0.) {} - void operator+=(DepIterator deposit) { - sum_ += deposit->first.deltaR; - count_ += 1.0; - } - double result() const { return sum_ / std::max(1., count_); } + //! area to be excluded in computaion of depositWithin + Veto theVeto; - private: - double sum_; - double count_; - }; + //! float tagging cand, ment to be transverse energy or pT attached to cand, + float theCandTag; - class SumDRAlgo { - public: - SumDRAlgo() : sum_(0.) {} - void operator+=(DepIterator deposit) { sum_ += deposit->first.deltaR; } - double result() const { return sum_; } + //! the deposits identifed by relative position to center of cone and deposit value - private: - double sum_; + DepositsMultimap theDeposits; }; - //! Get some info about the deposit (e.g. sum, max, sum2, count) - template - double algoWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - //! Get some info about the deposit (e.g. sum, max, sum2, count) w.r.t. other direction - template - double algoWithin(const Direction&, - double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // count of the non-vetoed deposits in the cone - double countWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // sum of the non-vetoed deposits in the cone - double sumWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // sum of the non-vetoed deposits in the cone w.r.t. other direction - double sumWithin(const Direction& dir, - double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; // sum of the squares of the non-vetoed deposits in the cone - double sum2Within(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // maximum value among the non-vetoed deposits in the cone - double maxWithin(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - // maximum value among the non-vetoed deposits in the cone - double nearestDR(double coneSize, //dR in which deposit is computed - const AbsVetos& vetos = AbsVetos(), //additional vetos - bool skipDepositVeto = false //skip exclusion of veto - ) const; - - private: - //! direcion of deposit (center of isolation cone) - Direction theDirection; - - //! area to be excluded in computaion of depositWithin - Veto theVeto; - - //! float tagging cand, ment to be transverse energy or pT attached to cand, - float theCandTag; - - //! the deposits identifed by relative position to center of cone and deposit value - - DepositsMultimap theDeposits; - }; - + } // namespace io_v1 + using IsoDeposit = io_v1::IsoDeposit; } // namespace reco template diff --git a/DataFormats/RecoCandidate/interface/IsoDepositFwd.h b/DataFormats/RecoCandidate/interface/IsoDepositFwd.h index e6fd152bfb9d1..81daed9cdc07e 100644 --- a/DataFormats/RecoCandidate/interface/IsoDepositFwd.h +++ b/DataFormats/RecoCandidate/interface/IsoDepositFwd.h @@ -6,7 +6,10 @@ #define HAVE_COMMON_ISODEPOSITMAP 1 namespace reco { - class IsoDeposit; + namespace io_v1 { + class IsoDeposit; + } + using IsoDeposit = io_v1::IsoDeposit; //! keep it only as a part of ValueMap typedef edm::ValueMap IsoDepositMap; diff --git a/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h b/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h index e4b3e9150c04d..74c6526095b5e 100644 --- a/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h +++ b/DataFormats/RecoCandidate/interface/RecoChargedCandidate.h @@ -11,35 +11,38 @@ #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" namespace reco { + namespace io_v1 { - class RecoChargedCandidate : public RecoCandidate { - public: - /// default constructor - RecoChargedCandidate() : RecoCandidate() {} - /// constructor from values - RecoChargedCandidate( - Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// constructor from values - RecoChargedCandidate( - Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// destructor - ~RecoChargedCandidate() override; - /// returns a clone of the candidate - RecoChargedCandidate* clone() const override; - /// set reference to track - void setTrack(const reco::TrackRef& r) { track_ = r; } - /// reference to a track - reco::TrackRef track() const override; + class RecoChargedCandidate : public RecoCandidate { + public: + /// default constructor + RecoChargedCandidate() : RecoCandidate() {} + /// constructor from values + RecoChargedCandidate( + Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// constructor from values + RecoChargedCandidate( + Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// destructor + ~RecoChargedCandidate() override; + /// returns a clone of the candidate + RecoChargedCandidate* clone() const override; + /// set reference to track + void setTrack(const reco::TrackRef& r) { track_ = r; } + /// reference to a track + reco::TrackRef track() const override; - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to a track - reco::TrackRef track_; - }; + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to a track + reco::TrackRef track_; + }; + } // namespace io_v1 + using RecoChargedCandidate = io_v1::RecoChargedCandidate; } // namespace reco #endif diff --git a/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h b/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h index af334f56d5494..ea67c910e7bce 100644 --- a/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h +++ b/DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class RecoChargedCandidate; + namespace io_v1 { + class RecoChargedCandidate; + } + using RecoChargedCandidate = io_v1::RecoChargedCandidate; /// collectin of RecoChargedCandidate objects typedef std::vector RecoChargedCandidateCollection; diff --git a/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h b/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h index 1f4c32059297f..efd01af6a6607 100644 --- a/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h +++ b/DataFormats/RecoCandidate/interface/RecoChargedRefCandidate.h @@ -9,42 +9,46 @@ namespace reco { typedef LeafRefCandidateT RecoChargedRefCandidateBase; - class RecoChargedRefCandidate : public LeafRefCandidateT { - public: - RecoChargedRefCandidate() {} - RecoChargedRefCandidate(TrackRef ref, float m) : LeafRefCandidateT(ref, m) {} - - ~RecoChargedRefCandidate() override {} - - RecoChargedRefCandidate* clone() const override { return new RecoChargedRefCandidate(*this); } - - reco::TrackRef track() const { return getRef(); } - // return a pointer to the best track, if available. - // otherwise, return a null pointer - const reco::Track* bestTrack() const override { - if (track().isNonnull() && track().isAvailable()) - return &(*track()); - else - return nullptr; - } - - /// uncertainty on dz - float dzError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dzError(); - else - return 0; - } - /// uncertainty on dxy - float dxyError() const override { - const Track* tr = bestTrack(); - if (tr != nullptr) - return tr->dxyError(); - else - return 0; - } - }; + namespace io_v1 { + + class RecoChargedRefCandidate : public LeafRefCandidateT { + public: + RecoChargedRefCandidate() {} + RecoChargedRefCandidate(TrackRef ref, float m) : LeafRefCandidateT(ref, m) {} + + ~RecoChargedRefCandidate() override {} + + RecoChargedRefCandidate* clone() const override { return new RecoChargedRefCandidate(*this); } + + reco::TrackRef track() const { return getRef(); } + // return a pointer to the best track, if available. + // otherwise, return a null pointer + const reco::Track* bestTrack() const override { + if (track().isNonnull() && track().isAvailable()) + return &(*track()); + else + return nullptr; + } + + /// uncertainty on dz + float dzError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dzError(); + else + return 0; + } + /// uncertainty on dxy + float dxyError() const override { + const Track* tr = bestTrack(); + if (tr != nullptr) + return tr->dxyError(); + else + return 0; + } + }; + } // namespace io_v1 + using RecoChargedRefCandidate = io_v1::RecoChargedRefCandidate; } // namespace reco #endif diff --git a/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h b/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h index 1c5ffd455424e..61d7d0cc072ae 100644 --- a/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h +++ b/DataFormats/RecoCandidate/interface/RecoEcalCandidate.h @@ -11,35 +11,38 @@ #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" namespace reco { + namespace io_v1 { - class RecoEcalCandidate : public RecoCandidate { - public: - /// default constructor - RecoEcalCandidate() : RecoCandidate() {} - /// constructor from values - RecoEcalCandidate( - Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// constructor from values - RecoEcalCandidate( - Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) - : RecoCandidate(q, p4, vtx, pdgId, status) {} - /// destructor - ~RecoEcalCandidate() override; - /// returns a clone of the candidate - RecoEcalCandidate* clone() const override; - /// set reference to superCluster - void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } - /// reference to a superCluster - reco::SuperClusterRef superCluster() const override; + class RecoEcalCandidate : public RecoCandidate { + public: + /// default constructor + RecoEcalCandidate() : RecoCandidate() {} + /// constructor from values + RecoEcalCandidate( + Charge q, const LorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// constructor from values + RecoEcalCandidate( + Charge q, const PolarLorentzVector& p4, const Point& vtx = Point(0, 0, 0), int pdgId = 0, int status = 0) + : RecoCandidate(q, p4, vtx, pdgId, status) {} + /// destructor + ~RecoEcalCandidate() override; + /// returns a clone of the candidate + RecoEcalCandidate* clone() const override; + /// set reference to superCluster + void setSuperCluster(const reco::SuperClusterRef& r) { superCluster_ = r; } + /// reference to a superCluster + reco::SuperClusterRef superCluster() const override; - private: - /// check overlap with another candidate - bool overlap(const Candidate&) const override; - /// reference to a superCluster - reco::SuperClusterRef superCluster_; - }; + private: + /// check overlap with another candidate + bool overlap(const Candidate&) const override; + /// reference to a superCluster + reco::SuperClusterRef superCluster_; + }; + } // namespace io_v1 + using RecoEcalCandidate = io_v1::RecoEcalCandidate; } // namespace reco #endif diff --git a/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h b/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h index f5dfad4018448..a71aea7220a5b 100644 --- a/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h +++ b/DataFormats/RecoCandidate/interface/RecoEcalCandidateFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class RecoEcalCandidate; + namespace io_v1 { + class RecoEcalCandidate; + } + using RecoEcalCandidate = io_v1::RecoEcalCandidate; /// collectin of RecoEcalCandidate objects typedef std::vector RecoEcalCandidateCollection; diff --git a/DataFormats/RecoCandidate/src/classes_def.xml b/DataFormats/RecoCandidate/src/classes_def.xml index 4583ab537c2ad..b49cf12da7f19 100644 --- a/DataFormats/RecoCandidate/src/classes_def.xml +++ b/DataFormats/RecoCandidate/src/classes_def.xml @@ -1,40 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -42,112 +28,114 @@ - - - - - + + + + + + - - - - - + + + + + - + - - + + - - + + - + - - - - - - + + + + + + + - + - - - + + + - - + + - + - - - + + + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + diff --git a/DataFormats/Scalers/interface/BeamSpotOnline.h b/DataFormats/Scalers/interface/BeamSpotOnline.h index c1424fe42edb8..051874a10bcc9 100644 --- a/DataFormats/Scalers/interface/BeamSpotOnline.h +++ b/DataFormats/Scalers/interface/BeamSpotOnline.h @@ -25,79 +25,81 @@ /// \class BeamSpotOnline.h /// \brief Persistable copy of online BeamSpotOnline value -class BeamSpotOnline { -public: - BeamSpotOnline(); - BeamSpotOnline(const unsigned char* rawData); - virtual ~BeamSpotOnline(); - - /// name method - std::string name() const { return "BeamSpotOnline"; } - - /// empty method (= false) - bool empty() const { return false; } - - unsigned int trigType() const { return (trigType_); } - unsigned int eventID() const { return (eventID_); } - unsigned int sourceID() const { return (sourceID_); } - unsigned int bunchNumber() const { return (bunchNumber_); } - - int version() const { return (version_); } - timespec collectionTime() const { return (collectionTime_.get_timespec()); } - - float x() const { return (x_); } - float y() const { return (y_); } - float z() const { return (z_); } - float dxdz() const { return (dxdz_); } - float dydz() const { return (dydz_); } - float err_x() const { return (err_x_); } - float err_y() const { return (err_y_); } - float err_z() const { return (err_z_); } - float err_dxdz() const { return (err_dxdz_); } - float err_dydz() const { return (err_dydz_); } - float width_x() const { return (width_x_); } - float width_y() const { return (width_y_); } - float sigma_z() const { return (sigma_z_); } - float err_width_x() const { return (err_width_x_); } - float err_width_y() const { return (err_width_y_); } - float err_sigma_z() const { return (err_sigma_z_); } - - /// equality operator - int operator==(const BeamSpotOnline& e) const { return false; } - - /// inequality operator - int operator!=(const BeamSpotOnline& e) const { return false; } - -protected: - unsigned int trigType_; - unsigned int eventID_; - unsigned int sourceID_; - unsigned int bunchNumber_; - - int version_; - - TimeSpec collectionTime_; - float x_; - float y_; - float z_; - float dxdz_; - float dydz_; - float err_x_; - float err_y_; - float err_z_; - float err_dxdz_; - float err_dydz_; - float width_x_; - float width_y_; - float sigma_z_; - float err_width_x_; - float err_width_y_; - float err_sigma_z_; -}; - -/// Pretty-print operator for BeamSpotOnline -std::ostream& operator<<(std::ostream& s, const BeamSpotOnline& c); - +namespace io_v1 { + class BeamSpotOnline { + public: + BeamSpotOnline(); + BeamSpotOnline(const unsigned char* rawData); + virtual ~BeamSpotOnline(); + + /// name method + std::string name() const { return "BeamSpotOnline"; } + + /// empty method (= false) + bool empty() const { return false; } + + unsigned int trigType() const { return (trigType_); } + unsigned int eventID() const { return (eventID_); } + unsigned int sourceID() const { return (sourceID_); } + unsigned int bunchNumber() const { return (bunchNumber_); } + + int version() const { return (version_); } + timespec collectionTime() const { return (collectionTime_.get_timespec()); } + + float x() const { return (x_); } + float y() const { return (y_); } + float z() const { return (z_); } + float dxdz() const { return (dxdz_); } + float dydz() const { return (dydz_); } + float err_x() const { return (err_x_); } + float err_y() const { return (err_y_); } + float err_z() const { return (err_z_); } + float err_dxdz() const { return (err_dxdz_); } + float err_dydz() const { return (err_dydz_); } + float width_x() const { return (width_x_); } + float width_y() const { return (width_y_); } + float sigma_z() const { return (sigma_z_); } + float err_width_x() const { return (err_width_x_); } + float err_width_y() const { return (err_width_y_); } + float err_sigma_z() const { return (err_sigma_z_); } + + /// equality operator + int operator==(const BeamSpotOnline& e) const { return false; } + + /// inequality operator + int operator!=(const BeamSpotOnline& e) const { return false; } + + protected: + unsigned int trigType_; + unsigned int eventID_; + unsigned int sourceID_; + unsigned int bunchNumber_; + + int version_; + + TimeSpec collectionTime_; + float x_; + float y_; + float z_; + float dxdz_; + float dydz_; + float err_x_; + float err_y_; + float err_z_; + float err_dxdz_; + float err_dydz_; + float width_x_; + float width_y_; + float sigma_z_; + float err_width_x_; + float err_width_y_; + float err_sigma_z_; + }; + + /// Pretty-print operator for BeamSpotOnline + std::ostream& operator<<(std::ostream& s, const BeamSpotOnline& c); +} // namespace io_v1 +using BeamSpotOnline = io_v1::BeamSpotOnline; typedef std::vector BeamSpotOnlineCollection; #endif diff --git a/DataFormats/Scalers/interface/DcsStatus.h b/DataFormats/Scalers/interface/DcsStatus.h index eaf368e82bfda..76f7c2946383b 100644 --- a/DataFormats/Scalers/interface/DcsStatus.h +++ b/DataFormats/Scalers/interface/DcsStatus.h @@ -25,88 +25,90 @@ /// \class DcsStatus.h /// \brief Persistable copy of online DcsStatus flag values -class DcsStatus { -public: - static const int partitionList[]; - static const char* const partitionName[]; - - enum { - EBp = 0, - EBm = 1, - EEp = 2, - EEm = 3, - HBHEa = 5, - HBHEb = 6, - HBHEc = 7, - HF = 8, - HO = 9, - RPC = 12, - DT0 = 13, - DTp = 14, - DTm = 15, - CSCp = 16, - CSCm = 17, - CASTOR = 20, - ZDC = 22, - TIBTID = 24, - TOB = 25, - TECp = 26, - TECm = 27, - BPIX = 28, - FPIX = 29, - ESp = 30, - ESm = 31, - nPartitions = 25 +namespace io_v1 { + class DcsStatus { + public: + static const int partitionList[]; + static const char* const partitionName[]; + + enum { + EBp = 0, + EBm = 1, + EEp = 2, + EEm = 3, + HBHEa = 5, + HBHEb = 6, + HBHEc = 7, + HF = 8, + HO = 9, + RPC = 12, + DT0 = 13, + DTp = 14, + DTm = 15, + CSCp = 16, + CSCm = 17, + CASTOR = 20, + ZDC = 22, + TIBTID = 24, + TOB = 25, + TECp = 26, + TECm = 27, + BPIX = 28, + FPIX = 29, + ESp = 30, + ESm = 31, + nPartitions = 25 + }; + + DcsStatus(); + DcsStatus(const unsigned char* rawData); + virtual ~DcsStatus(); + + /// name method + std::string name() const { return "DcsStatus"; } + + /// empty method (= false) + bool empty() const { return false; } + + unsigned int trigType() const { return (trigType_); } + unsigned int eventID() const { return (eventID_); } + unsigned int sourceID() const { return (sourceID_); } + unsigned int bunchNumber() const { return (bunchNumber_); } + + int version() const { return (version_); } + timespec collectionTime() const { return (collectionTime_.get_timespec()); } + + unsigned int ready() const { return (ready_); } + + bool ready(int partitionNumber) const { return ((ready_ & (1 << partitionNumber)) != 0); } + + float magnetCurrent() const { return (magnetCurrent_); } + float magnetTemperature() const { return (magnetTemperature_); } + + /// equality operator + int operator==(const DcsStatus& e) const { return false; } + + /// inequality operator + int operator!=(const DcsStatus& e) const { return false; } + + protected: + unsigned int trigType_; + unsigned int eventID_; + unsigned int sourceID_; + unsigned int bunchNumber_; + + int version_; + + TimeSpec collectionTime_; + unsigned int ready_; + float magnetCurrent_; + float magnetTemperature_; }; - DcsStatus(); - DcsStatus(const unsigned char* rawData); - virtual ~DcsStatus(); - - /// name method - std::string name() const { return "DcsStatus"; } - - /// empty method (= false) - bool empty() const { return false; } - - unsigned int trigType() const { return (trigType_); } - unsigned int eventID() const { return (eventID_); } - unsigned int sourceID() const { return (sourceID_); } - unsigned int bunchNumber() const { return (bunchNumber_); } - - int version() const { return (version_); } - timespec collectionTime() const { return (collectionTime_.get_timespec()); } - - unsigned int ready() const { return (ready_); } - - bool ready(int partitionNumber) const { return ((ready_ & (1 << partitionNumber)) != 0); } - - float magnetCurrent() const { return (magnetCurrent_); } - float magnetTemperature() const { return (magnetTemperature_); } - - /// equality operator - int operator==(const DcsStatus& e) const { return false; } - - /// inequality operator - int operator!=(const DcsStatus& e) const { return false; } - -protected: - unsigned int trigType_; - unsigned int eventID_; - unsigned int sourceID_; - unsigned int bunchNumber_; - - int version_; - - TimeSpec collectionTime_; - unsigned int ready_; - float magnetCurrent_; - float magnetTemperature_; -}; - -/// Pretty-print operator for DcsStatus -std::ostream& operator<<(std::ostream& s, const DcsStatus& c); - + /// Pretty-print operator for DcsStatus + std::ostream& operator<<(std::ostream& s, const DcsStatus& c); +} // namespace io_v1 +using DcsStatus = io_v1::DcsStatus; typedef std::vector DcsStatusCollection; #endif diff --git a/DataFormats/Scalers/interface/L1AcceptBunchCrossing.h b/DataFormats/Scalers/interface/L1AcceptBunchCrossing.h index 989f210537002..a9ad118893240 100644 --- a/DataFormats/Scalers/interface/L1AcceptBunchCrossing.h +++ b/DataFormats/Scalers/interface/L1AcceptBunchCrossing.h @@ -34,52 +34,54 @@ /// \class L1AcceptBunchCrossings.h /// \brief Persistable copy of Scalers L1Accept bunch crossing info -class L1AcceptBunchCrossing { -public: - L1AcceptBunchCrossing(); - L1AcceptBunchCrossing(const int l1AcceptOffset__, - const unsigned int orbitNumber__, - const unsigned int bunchCrossing__, - const unsigned int eventType__); - L1AcceptBunchCrossing(const int index, const unsigned long long data); - virtual ~L1AcceptBunchCrossing(); +namespace io_v1 { + class L1AcceptBunchCrossing { + public: + L1AcceptBunchCrossing(); + L1AcceptBunchCrossing(const int l1AcceptOffset__, + const unsigned int orbitNumber__, + const unsigned int bunchCrossing__, + const unsigned int eventType__); + L1AcceptBunchCrossing(const int index, const unsigned long long data); + virtual ~L1AcceptBunchCrossing(); - enum { - ORBIT_NUMBER_SHIFT = 32ULL, - ORBIT_NUMBER_MASK = 0xFFFFFFFFULL, - BUNCH_CROSSING_SHIFT = 4ULL, - BUNCH_CROSSING_MASK = 0xFFFULL, - EVENT_TYPE_SHIFT = 0, - EVENT_TYPE_MASK = 0xFULL - }; - - /// name method - std::string name() const { return "L1AcceptBunchCrossing"; } + enum { + ORBIT_NUMBER_SHIFT = 32ULL, + ORBIT_NUMBER_MASK = 0xFFFFFFFFULL, + BUNCH_CROSSING_SHIFT = 4ULL, + BUNCH_CROSSING_MASK = 0xFFFULL, + EVENT_TYPE_SHIFT = 0, + EVENT_TYPE_MASK = 0xFULL + }; - /// empty method (= false) - bool empty() const { return false; } + /// name method + std::string name() const { return "L1AcceptBunchCrossing"; } - int l1AcceptOffset() const { return (l1AcceptOffset_); } - unsigned int orbitNumber() const { return (orbitNumber_); } - unsigned int bunchCrossing() const { return (bunchCrossing_); } - unsigned int eventType() const { return (eventType_); } + /// empty method (= false) + bool empty() const { return false; } - /// equality operator - int operator==(const L1AcceptBunchCrossing& e) const { return false; } + int l1AcceptOffset() const { return (l1AcceptOffset_); } + unsigned int orbitNumber() const { return (orbitNumber_); } + unsigned int bunchCrossing() const { return (bunchCrossing_); } + unsigned int eventType() const { return (eventType_); } - /// inequality operator - int operator!=(const L1AcceptBunchCrossing& e) const { return false; } + /// equality operator + int operator==(const L1AcceptBunchCrossing& e) const { return false; } -protected: - int l1AcceptOffset_; - unsigned int orbitNumber_; - unsigned int bunchCrossing_; - unsigned int eventType_; -}; + /// inequality operator + int operator!=(const L1AcceptBunchCrossing& e) const { return false; } -/// Pretty-print operator for L1AcceptBunchCrossings -std::ostream& operator<<(std::ostream& s, const L1AcceptBunchCrossing& c); + protected: + int l1AcceptOffset_; + unsigned int orbitNumber_; + unsigned int bunchCrossing_; + unsigned int eventType_; + }; + /// Pretty-print operator for L1AcceptBunchCrossings + std::ostream& operator<<(std::ostream& s, const L1AcceptBunchCrossing& c); +} // namespace io_v1 +using L1AcceptBunchCrossing = io_v1::L1AcceptBunchCrossing; typedef std::vector L1AcceptBunchCrossingCollection; #endif diff --git a/DataFormats/Scalers/interface/L1AcceptBunchCrossingFwd.h b/DataFormats/Scalers/interface/L1AcceptBunchCrossingFwd.h index 0505b27459ceb..67ab00730e881 100644 --- a/DataFormats/Scalers/interface/L1AcceptBunchCrossingFwd.h +++ b/DataFormats/Scalers/interface/L1AcceptBunchCrossingFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_Scalers_L1AcceptBunchCrossingFwd_h #define DataFormats_Scalers_L1AcceptBunchCrossingFwd_h -class L1AcceptBunchCrossing; +namespace io_v1 { + class L1AcceptBunchCrossing; +} +using L1AcceptBunchCrossing = io_v1::L1AcceptBunchCrossing; #endif diff --git a/DataFormats/Scalers/interface/L1TriggerScalers.h b/DataFormats/Scalers/interface/L1TriggerScalers.h index c512283975372..1ff118774b39d 100644 --- a/DataFormats/Scalers/interface/L1TriggerScalers.h +++ b/DataFormats/Scalers/interface/L1TriggerScalers.h @@ -25,110 +25,112 @@ /// \class L1TriggerScalers.h /// \brief Persistable copy of L1 Trigger Scalers -class L1TriggerScalers { -public: - enum { nL1Triggers = 128, nL1TestTriggers = 64 }; - - L1TriggerScalers(); - L1TriggerScalers(const unsigned char* rawData); - virtual ~L1TriggerScalers(); - - /// name method - std::string name() const { return "L1TriggerScalers"; } - - /// empty method (= false) - bool empty() const { return false; } - - // Data accessor methods - int version() const { return (version_); } - - unsigned int trigType() const { return (trigType_); } - unsigned int eventID() const { return (eventID_); } - unsigned int sourceID() const { return (sourceID_); } - unsigned int bunchNumber() const { return (bunchNumber_); } - - timespec collectionTimeSpecial() const { return (collectionTimeSpecial_.get_timespec()); } - - unsigned int orbitNumber() const { return (orbitNumber_); } - unsigned int luminositySection() const { return (luminositySection_); } - unsigned int bunchCrossingErrors() const { return (bunchCrossingErrors_); } - - timespec collectionTimeSummary() const { return (collectionTimeSummary_.get_timespec()); } - - unsigned int triggerNumber() const { return (triggerNumber_); } - unsigned int eventNumber() const { return (eventNumber_); } - unsigned int finalTriggersDistributed() const { return (finalTriggersDistributed_); } - unsigned int calibrationTriggers() const { return (calibrationTriggers_); } - unsigned int randomTriggers() const { return (randomTriggers_); } - unsigned int totalTestTriggers() const { return (totalTestTriggers_); } - unsigned int finalTriggersGenerated() const { return (finalTriggersGenerated_); } - unsigned int finalTriggersInvalidBC() const { return (finalTriggersInvalidBC_); } - - unsigned long long deadTime() const { return (deadTime_); } - unsigned long long lostFinalTriggers() const { return (lostFinalTriggers_); } - unsigned long long deadTimeActive() const { return (deadTimeActive_); } - unsigned long long lostFinalTriggersActive() const { return (lostFinalTriggersActive_); } - - unsigned long long deadTimeActivePrivate() const { return (deadTimeActivePrivate_); } - unsigned long long deadTimeActivePartition() const { return (deadTimeActivePartition_); } - unsigned long long deadTimeActiveThrottle() const { return (deadTimeActiveThrottle_); } - unsigned long long deadTimeActiveCalibration() const { return (deadTimeActiveCalibration_); } - unsigned long long deadTimeActiveTimeSlot() const { return (deadTimeActiveTimeSlot_); } - unsigned int numberResets() const { return (numberResets_); } - - timespec collectionTimeDetails() const { return (collectionTimeDetails_.get_timespec()); } - - std::vector triggers() const { return (triggers_); } - - std::vector testTriggers() const { return (testTriggers_); } - - /// equality operator - int operator==(const L1TriggerScalers& e) const { return false; } - - /// inequality operator - int operator!=(const L1TriggerScalers& e) const { return false; } - -protected: - int version_; - - unsigned int trigType_; - unsigned int eventID_; - unsigned int sourceID_; - unsigned int bunchNumber_; - - TimeSpec collectionTimeSpecial_; - unsigned int orbitNumber_; - unsigned int luminositySection_; - unsigned short bunchCrossingErrors_; - - TimeSpec collectionTimeSummary_; - unsigned int triggerNumber_; - unsigned int eventNumber_; - unsigned int finalTriggersDistributed_; - unsigned int calibrationTriggers_; - unsigned int randomTriggers_; - unsigned int totalTestTriggers_; - unsigned int finalTriggersGenerated_; - unsigned int finalTriggersInvalidBC_; - unsigned long long deadTime_; - unsigned long long lostFinalTriggers_; - unsigned long long deadTimeActive_; - unsigned long long lostFinalTriggersActive_; - unsigned long long deadTimeActivePrivate_; - unsigned long long deadTimeActivePartition_; - unsigned long long deadTimeActiveThrottle_; - unsigned long long deadTimeActiveCalibration_; - unsigned long long deadTimeActiveTimeSlot_; - unsigned int numberResets_; - - TimeSpec collectionTimeDetails_; - std::vector triggers_; - std::vector testTriggers_; -}; - -/// Pretty-print operator for L1TriggerScalers -std::ostream& operator<<(std::ostream& s, const L1TriggerScalers& c); - +namespace io_v1 { + class L1TriggerScalers { + public: + enum { nL1Triggers = 128, nL1TestTriggers = 64 }; + + L1TriggerScalers(); + L1TriggerScalers(const unsigned char* rawData); + virtual ~L1TriggerScalers(); + + /// name method + std::string name() const { return "L1TriggerScalers"; } + + /// empty method (= false) + bool empty() const { return false; } + + // Data accessor methods + int version() const { return (version_); } + + unsigned int trigType() const { return (trigType_); } + unsigned int eventID() const { return (eventID_); } + unsigned int sourceID() const { return (sourceID_); } + unsigned int bunchNumber() const { return (bunchNumber_); } + + timespec collectionTimeSpecial() const { return (collectionTimeSpecial_.get_timespec()); } + + unsigned int orbitNumber() const { return (orbitNumber_); } + unsigned int luminositySection() const { return (luminositySection_); } + unsigned int bunchCrossingErrors() const { return (bunchCrossingErrors_); } + + timespec collectionTimeSummary() const { return (collectionTimeSummary_.get_timespec()); } + + unsigned int triggerNumber() const { return (triggerNumber_); } + unsigned int eventNumber() const { return (eventNumber_); } + unsigned int finalTriggersDistributed() const { return (finalTriggersDistributed_); } + unsigned int calibrationTriggers() const { return (calibrationTriggers_); } + unsigned int randomTriggers() const { return (randomTriggers_); } + unsigned int totalTestTriggers() const { return (totalTestTriggers_); } + unsigned int finalTriggersGenerated() const { return (finalTriggersGenerated_); } + unsigned int finalTriggersInvalidBC() const { return (finalTriggersInvalidBC_); } + + unsigned long long deadTime() const { return (deadTime_); } + unsigned long long lostFinalTriggers() const { return (lostFinalTriggers_); } + unsigned long long deadTimeActive() const { return (deadTimeActive_); } + unsigned long long lostFinalTriggersActive() const { return (lostFinalTriggersActive_); } + + unsigned long long deadTimeActivePrivate() const { return (deadTimeActivePrivate_); } + unsigned long long deadTimeActivePartition() const { return (deadTimeActivePartition_); } + unsigned long long deadTimeActiveThrottle() const { return (deadTimeActiveThrottle_); } + unsigned long long deadTimeActiveCalibration() const { return (deadTimeActiveCalibration_); } + unsigned long long deadTimeActiveTimeSlot() const { return (deadTimeActiveTimeSlot_); } + unsigned int numberResets() const { return (numberResets_); } + + timespec collectionTimeDetails() const { return (collectionTimeDetails_.get_timespec()); } + + std::vector triggers() const { return (triggers_); } + + std::vector testTriggers() const { return (testTriggers_); } + + /// equality operator + int operator==(const L1TriggerScalers& e) const { return false; } + + /// inequality operator + int operator!=(const L1TriggerScalers& e) const { return false; } + + protected: + int version_; + + unsigned int trigType_; + unsigned int eventID_; + unsigned int sourceID_; + unsigned int bunchNumber_; + + TimeSpec collectionTimeSpecial_; + unsigned int orbitNumber_; + unsigned int luminositySection_; + unsigned short bunchCrossingErrors_; + + TimeSpec collectionTimeSummary_; + unsigned int triggerNumber_; + unsigned int eventNumber_; + unsigned int finalTriggersDistributed_; + unsigned int calibrationTriggers_; + unsigned int randomTriggers_; + unsigned int totalTestTriggers_; + unsigned int finalTriggersGenerated_; + unsigned int finalTriggersInvalidBC_; + unsigned long long deadTime_; + unsigned long long lostFinalTriggers_; + unsigned long long deadTimeActive_; + unsigned long long lostFinalTriggersActive_; + unsigned long long deadTimeActivePrivate_; + unsigned long long deadTimeActivePartition_; + unsigned long long deadTimeActiveThrottle_; + unsigned long long deadTimeActiveCalibration_; + unsigned long long deadTimeActiveTimeSlot_; + unsigned int numberResets_; + + TimeSpec collectionTimeDetails_; + std::vector triggers_; + std::vector testTriggers_; + }; + + /// Pretty-print operator for L1TriggerScalers + std::ostream& operator<<(std::ostream& s, const L1TriggerScalers& c); +} // namespace io_v1 +using L1TriggerScalers = io_v1::L1TriggerScalers; typedef std::vector L1TriggerScalersCollection; #endif diff --git a/DataFormats/Scalers/interface/L1TriggerScalersFwd.h b/DataFormats/Scalers/interface/L1TriggerScalersFwd.h index 9158fd94e6c82..7d7288a7d27ec 100644 --- a/DataFormats/Scalers/interface/L1TriggerScalersFwd.h +++ b/DataFormats/Scalers/interface/L1TriggerScalersFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_Scalers_L1TriggerScalersFwd_h #define DataFormats_Scalers_L1TriggerScalersFwd_h -class L1TriggerScalers; - +namespace io_v1 { + class L1TriggerScalers; +} +using L1TriggerScalers = io_v1::L1TriggerScalers; #endif diff --git a/DataFormats/Scalers/interface/Level1TriggerScalers.h b/DataFormats/Scalers/interface/Level1TriggerScalers.h index af9427983ddd3..183250bab1386 100644 --- a/DataFormats/Scalers/interface/Level1TriggerScalers.h +++ b/DataFormats/Scalers/interface/Level1TriggerScalers.h @@ -23,159 +23,163 @@ /// \class Level1TriggerScalers.h /// \brief Persistable copy of Level1 Trigger Scalers -class Level1TriggerScalers { -public: - enum { nLevel1Triggers = 128, nLevel1TestTriggers = 64, firstShortLSRun = 125574 }; - - static const unsigned long long N_BX = 3564ULL; - static const unsigned long long N_BX_ACTIVE = 2808ULL; - static const unsigned long long N_ORBITS_LUMI_SECTION = 0x100000ULL; - static const unsigned long long N_BX_LUMI_SECTION = N_ORBITS_LUMI_SECTION * N_BX; - - Level1TriggerScalers(); - Level1TriggerScalers(const unsigned char* rawData); - virtual ~Level1TriggerScalers(); - - /// name method - std::string name() const { return "Level1TriggerScalers"; } - - /// empty method (= false) - bool empty() const { return false; } - - // Data accessor methods - int version() const { return (version_); } - - unsigned int trigType() const { return (trigType_); } - unsigned int eventID() const { return (eventID_); } - unsigned int sourceID() const { return (sourceID_); } - unsigned int bunchNumber() const { return (bunchNumber_); } - - struct timespec collectionTime() const { return (collectionTime_.get_timespec()); } - - unsigned int lumiSegmentNr() const { return (lumiSegmentNr_); } - unsigned int lumiSegmentOrbits() const { return (lumiSegmentOrbits_); } - unsigned int orbitNr() const { return (orbitNr_); } - - unsigned int gtResets() const { return (gtResets_); } - unsigned int bunchCrossingErrors() const { return (bunchCrossingErrors_); } - unsigned long long gtTriggers() const { return (gtTriggers_); } - unsigned long long gtEvents() const { return (gtEvents_); } - float gtTriggersRate() const { return (gtTriggersRate_); } - float gtEventsRate() const { return (gtEventsRate_); } - int prescaleIndexAlgo() const { return (prescaleIndexAlgo_); } - int prescaleIndexTech() const { return (prescaleIndexTech_); } - - struct timespec collectionTimeLumiSeg() const { return (collectionTimeLumiSeg_.get_timespec()); } - - unsigned int lumiSegmentNrLumiSeg() const { return (lumiSegmentNrLumiSeg_); } - - unsigned long long triggersPhysicsGeneratedFDL() const { return (triggersPhysicsGeneratedFDL_); } - unsigned long long triggersPhysicsLost() const { return (triggersPhysicsLost_); } - unsigned long long triggersPhysicsLostBeamActive() const { return (triggersPhysicsLostBeamActive_); } - unsigned long long triggersPhysicsLostBeamInactive() const { return (triggersPhysicsLostBeamInactive_); } - unsigned long long l1AsPhysics() const { return (l1AsPhysics_); } - unsigned long long l1AsRandom() const { return (l1AsRandom_); } - unsigned long long l1AsTest() const { return (l1AsTest_); } - unsigned long long l1AsCalibration() const { return (l1AsCalibration_); } - unsigned long long deadtime() const { return (deadtime_); } - unsigned long long deadtimeBeamActive() const { return (deadtimeBeamActive_); } - unsigned long long deadtimeBeamActiveTriggerRules() const { return (deadtimeBeamActiveTriggerRules_); } - unsigned long long deadtimeBeamActiveCalibration() const { return (deadtimeBeamActiveCalibration_); } - unsigned long long deadtimeBeamActivePrivateOrbit() const { return (deadtimeBeamActivePrivateOrbit_); } - unsigned long long deadtimeBeamActivePartitionController() const { return (deadtimeBeamActivePartitionController_); } - unsigned long long deadtimeBeamActiveTimeSlot() const { return (deadtimeBeamActiveTimeSlot_); } - - unsigned int lastOrbitCounter0() const { return (lastOrbitCounter0_); } - unsigned int lastTestEnable() const { return (lastTestEnable_); } - unsigned int lastResync() const { return (lastResync_); } - unsigned int lastStart() const { return (lastStart_); } - unsigned int lastEventCounter0() const { return (lastEventCounter0_); } - unsigned int lastHardReset() const { return (lastHardReset_); } - unsigned long long spare0() const { return (spare0_); } - unsigned long long spare1() const { return (spare1_); } - unsigned long long spare2() const { return (spare2_); } - - static double rateLS(unsigned long long counts); - static double rateLS(unsigned int counts); - static double percentLS(unsigned long long counts); - static double percentLSActive(unsigned long long counts); - - static double rateLS(unsigned long long counts, int runNumber); - static double rateLS(unsigned int counts, int runNumber); - static double percentLS(unsigned long long counts, int runNumber); - static double percentLSActive(unsigned long long counts, int runNumber); - - std::vector gtAlgoCounts() const { return (gtAlgoCounts_); } - - std::vector gtTechCounts() const { return (gtTechCounts_); } - - /// equality operator - int operator==(const Level1TriggerScalers& e) const { return false; } - - /// inequality operator - int operator!=(const Level1TriggerScalers& e) const { return false; } - -protected: - int version_; - - unsigned int trigType_; - unsigned int eventID_; - unsigned int sourceID_; - unsigned int bunchNumber_; - - TimeSpec collectionTime_; - unsigned int lumiSegmentNr_; - unsigned int lumiSegmentOrbits_; - unsigned int orbitNr_; - unsigned int gtResets_; - unsigned int bunchCrossingErrors_; - unsigned long long gtTriggers_; - unsigned long long gtEvents_; - float gtTriggersRate_; - float gtEventsRate_; - int prescaleIndexAlgo_; - int prescaleIndexTech_; - - TimeSpec collectionTimeLumiSeg_; - unsigned int lumiSegmentNrLumiSeg_; - unsigned long long triggersPhysicsGeneratedFDL_; - unsigned long long triggersPhysicsLost_; - unsigned long long triggersPhysicsLostBeamActive_; - unsigned long long triggersPhysicsLostBeamInactive_; - unsigned long long l1AsPhysics_; - unsigned long long l1AsRandom_; - unsigned long long l1AsTest_; - unsigned long long l1AsCalibration_; - unsigned long long deadtime_; - unsigned long long deadtimeBeamActive_; - unsigned long long deadtimeBeamActiveTriggerRules_; - unsigned long long deadtimeBeamActiveCalibration_; - unsigned long long deadtimeBeamActivePrivateOrbit_; - unsigned long long deadtimeBeamActivePartitionController_; - unsigned long long deadtimeBeamActiveTimeSlot_; - - std::vector gtAlgoCounts_; - std::vector gtTechCounts_; - - // Orbit counter markers indicating when the last BGO - // command of a particular type was received, relative - // to the last OrbitCounter0 (OC0), for this L1 accept - unsigned int lastOrbitCounter0_; - unsigned int lastTestEnable_; - unsigned int lastResync_; - unsigned int lastStart_; - unsigned int lastEventCounter0_; - unsigned int lastHardReset_; - - // For future use - unsigned long long spare0_; - unsigned long long spare1_; - unsigned long long spare2_; -}; - -/// Pretty-print operator for Level1TriggerScalers -std::ostream& operator<<(std::ostream& s, const Level1TriggerScalers& c); - +namespace io_v1 { + class Level1TriggerScalers { + public: + enum { nLevel1Triggers = 128, nLevel1TestTriggers = 64, firstShortLSRun = 125574 }; + + static const unsigned long long N_BX = 3564ULL; + static const unsigned long long N_BX_ACTIVE = 2808ULL; + static const unsigned long long N_ORBITS_LUMI_SECTION = 0x100000ULL; + static const unsigned long long N_BX_LUMI_SECTION = N_ORBITS_LUMI_SECTION * N_BX; + + Level1TriggerScalers(); + Level1TriggerScalers(const unsigned char* rawData); + virtual ~Level1TriggerScalers(); + + /// name method + std::string name() const { return "Level1TriggerScalers"; } + + /// empty method (= false) + bool empty() const { return false; } + + // Data accessor methods + int version() const { return (version_); } + + unsigned int trigType() const { return (trigType_); } + unsigned int eventID() const { return (eventID_); } + unsigned int sourceID() const { return (sourceID_); } + unsigned int bunchNumber() const { return (bunchNumber_); } + + struct timespec collectionTime() const { return (collectionTime_.get_timespec()); } + + unsigned int lumiSegmentNr() const { return (lumiSegmentNr_); } + unsigned int lumiSegmentOrbits() const { return (lumiSegmentOrbits_); } + unsigned int orbitNr() const { return (orbitNr_); } + + unsigned int gtResets() const { return (gtResets_); } + unsigned int bunchCrossingErrors() const { return (bunchCrossingErrors_); } + unsigned long long gtTriggers() const { return (gtTriggers_); } + unsigned long long gtEvents() const { return (gtEvents_); } + float gtTriggersRate() const { return (gtTriggersRate_); } + float gtEventsRate() const { return (gtEventsRate_); } + int prescaleIndexAlgo() const { return (prescaleIndexAlgo_); } + int prescaleIndexTech() const { return (prescaleIndexTech_); } + + struct timespec collectionTimeLumiSeg() const { return (collectionTimeLumiSeg_.get_timespec()); } + + unsigned int lumiSegmentNrLumiSeg() const { return (lumiSegmentNrLumiSeg_); } + + unsigned long long triggersPhysicsGeneratedFDL() const { return (triggersPhysicsGeneratedFDL_); } + unsigned long long triggersPhysicsLost() const { return (triggersPhysicsLost_); } + unsigned long long triggersPhysicsLostBeamActive() const { return (triggersPhysicsLostBeamActive_); } + unsigned long long triggersPhysicsLostBeamInactive() const { return (triggersPhysicsLostBeamInactive_); } + unsigned long long l1AsPhysics() const { return (l1AsPhysics_); } + unsigned long long l1AsRandom() const { return (l1AsRandom_); } + unsigned long long l1AsTest() const { return (l1AsTest_); } + unsigned long long l1AsCalibration() const { return (l1AsCalibration_); } + unsigned long long deadtime() const { return (deadtime_); } + unsigned long long deadtimeBeamActive() const { return (deadtimeBeamActive_); } + unsigned long long deadtimeBeamActiveTriggerRules() const { return (deadtimeBeamActiveTriggerRules_); } + unsigned long long deadtimeBeamActiveCalibration() const { return (deadtimeBeamActiveCalibration_); } + unsigned long long deadtimeBeamActivePrivateOrbit() const { return (deadtimeBeamActivePrivateOrbit_); } + unsigned long long deadtimeBeamActivePartitionController() const { + return (deadtimeBeamActivePartitionController_); + } + unsigned long long deadtimeBeamActiveTimeSlot() const { return (deadtimeBeamActiveTimeSlot_); } + + unsigned int lastOrbitCounter0() const { return (lastOrbitCounter0_); } + unsigned int lastTestEnable() const { return (lastTestEnable_); } + unsigned int lastResync() const { return (lastResync_); } + unsigned int lastStart() const { return (lastStart_); } + unsigned int lastEventCounter0() const { return (lastEventCounter0_); } + unsigned int lastHardReset() const { return (lastHardReset_); } + unsigned long long spare0() const { return (spare0_); } + unsigned long long spare1() const { return (spare1_); } + unsigned long long spare2() const { return (spare2_); } + + static double rateLS(unsigned long long counts); + static double rateLS(unsigned int counts); + static double percentLS(unsigned long long counts); + static double percentLSActive(unsigned long long counts); + + static double rateLS(unsigned long long counts, int runNumber); + static double rateLS(unsigned int counts, int runNumber); + static double percentLS(unsigned long long counts, int runNumber); + static double percentLSActive(unsigned long long counts, int runNumber); + + std::vector gtAlgoCounts() const { return (gtAlgoCounts_); } + + std::vector gtTechCounts() const { return (gtTechCounts_); } + + /// equality operator + int operator==(const Level1TriggerScalers& e) const { return false; } + + /// inequality operator + int operator!=(const Level1TriggerScalers& e) const { return false; } + + protected: + int version_; + + unsigned int trigType_; + unsigned int eventID_; + unsigned int sourceID_; + unsigned int bunchNumber_; + + TimeSpec collectionTime_; + unsigned int lumiSegmentNr_; + unsigned int lumiSegmentOrbits_; + unsigned int orbitNr_; + unsigned int gtResets_; + unsigned int bunchCrossingErrors_; + unsigned long long gtTriggers_; + unsigned long long gtEvents_; + float gtTriggersRate_; + float gtEventsRate_; + int prescaleIndexAlgo_; + int prescaleIndexTech_; + + TimeSpec collectionTimeLumiSeg_; + unsigned int lumiSegmentNrLumiSeg_; + unsigned long long triggersPhysicsGeneratedFDL_; + unsigned long long triggersPhysicsLost_; + unsigned long long triggersPhysicsLostBeamActive_; + unsigned long long triggersPhysicsLostBeamInactive_; + unsigned long long l1AsPhysics_; + unsigned long long l1AsRandom_; + unsigned long long l1AsTest_; + unsigned long long l1AsCalibration_; + unsigned long long deadtime_; + unsigned long long deadtimeBeamActive_; + unsigned long long deadtimeBeamActiveTriggerRules_; + unsigned long long deadtimeBeamActiveCalibration_; + unsigned long long deadtimeBeamActivePrivateOrbit_; + unsigned long long deadtimeBeamActivePartitionController_; + unsigned long long deadtimeBeamActiveTimeSlot_; + + std::vector gtAlgoCounts_; + std::vector gtTechCounts_; + + // Orbit counter markers indicating when the last BGO + // command of a particular type was received, relative + // to the last OrbitCounter0 (OC0), for this L1 accept + unsigned int lastOrbitCounter0_; + unsigned int lastTestEnable_; + unsigned int lastResync_; + unsigned int lastStart_; + unsigned int lastEventCounter0_; + unsigned int lastHardReset_; + + // For future use + unsigned long long spare0_; + unsigned long long spare1_; + unsigned long long spare2_; + }; + + /// Pretty-print operator for Level1TriggerScalers + std::ostream& operator<<(std::ostream& s, const Level1TriggerScalers& c); +} // namespace io_v1 +using Level1TriggerScalers = io_v1::Level1TriggerScalers; typedef std::vector Level1TriggerScalersCollection; #endif diff --git a/DataFormats/Scalers/interface/Level1TriggerScalersFwd.h b/DataFormats/Scalers/interface/Level1TriggerScalersFwd.h index df334d28dbcfc..a8e8fc6f2a539 100644 --- a/DataFormats/Scalers/interface/Level1TriggerScalersFwd.h +++ b/DataFormats/Scalers/interface/Level1TriggerScalersFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_Scalers_Level1TriggerScalersFwd_h #define DataFormats_Scalers_Level1TriggerScalersFwd_h -class Level1TriggerScalers; - +namespace io_v1 { + class Level1TriggerScalers; +} +using Level1TriggerScalers = io_v1::Level1TriggerScalers; #endif diff --git a/DataFormats/Scalers/interface/LumiScalers.h b/DataFormats/Scalers/interface/LumiScalers.h index d6a7c3a95e6ed..bbc8262bf0c86 100644 --- a/DataFormats/Scalers/interface/LumiScalers.h +++ b/DataFormats/Scalers/interface/LumiScalers.h @@ -25,122 +25,124 @@ /// \class LumiScalers.h /// \brief Persistable copy of HF Lumi Scalers -class LumiScalers { -public: - LumiScalers(); - LumiScalers(const unsigned char* rawData); - virtual ~LumiScalers(); - - enum { nOcc = 2 }; - - /// name method - std::string name() const { return "LumiScalers"; } - - /// empty method (= false) - bool empty() const { return false; } - - unsigned int trigType() const { return (trigType_); } - unsigned int eventID() const { return (eventID_); } - unsigned int sourceID() const { return (sourceID_); } - unsigned int bunchNumber() const { return (bunchNumber_); } - - int version() const { return (version_); } - timespec collectionTime() const { return (collectionTime_.get_timespec()); } - float normalization() const { return (normalization_); } - float deadTimeNormalization() const { return (deadTimeNormalization_); } - - float lumiFill() const { return (lumiFill_); } - float lumiRun() const { return (lumiRun_); } - float liveLumiFill() const { return (liveLumiFill_); } - float liveLumiRun() const { return (liveLumiRun_); } - float instantLumi() const { return (instantLumi_); } - float instantLumiErr() const { return (instantLumiErr_); } - unsigned char instantLumiQlty() const { return (instantLumiQlty_); } - - float lumiETFill() const { return (lumiETFill_); } - float lumiETRun() const { return (lumiETRun_); } - float liveLumiETFill() const { return (liveLumiETFill_); } - float liveLumiETRun() const { return (liveLumiETRun_); } - float instantETLumi() const { return (instantETLumi_); } - float instantETLumiErr() const { return (instantETLumiErr_); } - unsigned char instantETLumiQlty() const { return (instantETLumiQlty_); } - - std::vector lumiOccFill() const { return (lumiOccFill_); } - std::vector lumiOccRun() const { return (lumiOccRun_); } - std::vector liveLumiOccFill() const { return (liveLumiOccFill_); } - std::vector liveLumiOccRun() const { return (liveLumiOccRun_); } - std::vector instantOccLumi() const { return (instantOccLumi_); } - std::vector instantOccLumiErr() const { return (instantOccLumiErr_); } - std::vector instantOccLumiQlty() const { return (instantOccLumiQlty_); } - std::vector lumiNoise() const { return (lumiNoise_); } - - unsigned int sectionNumber() const { return (sectionNumber_); } - unsigned int startOrbit() const { return (startOrbit_); } - unsigned int numOrbits() const { return (numOrbits_); } - - float pileup() const { return (pileup_); } - float pileupRMS() const { return (pileupRMS_); } - float bunchLumi() const { return (bunchLumi_); } - float spare() const { return (spare_); } - - /// equality operator - int operator==(const LumiScalers& e) const { return false; } - - /// inequality operator - int operator!=(const LumiScalers& e) const { return false; } - -protected: - unsigned int trigType_; - unsigned int eventID_; - unsigned int sourceID_; - unsigned int bunchNumber_; - - int version_; - - TimeSpec collectionTime_; - - float normalization_; - float deadTimeNormalization_; - - float lumiFill_; - float lumiRun_; - float liveLumiFill_; - float liveLumiRun_; - float instantLumi_; - float instantLumiErr_; - unsigned char instantLumiQlty_; - - float lumiETFill_; - float lumiETRun_; - float liveLumiETFill_; - float liveLumiETRun_; - float instantETLumi_; - float instantETLumiErr_; - - unsigned char instantETLumiQlty_; - - std::vector lumiOccFill_; - std::vector lumiOccRun_; - std::vector liveLumiOccFill_; - std::vector liveLumiOccRun_; - std::vector instantOccLumi_; - std::vector instantOccLumiErr_; - std::vector instantOccLumiQlty_; - std::vector lumiNoise_; - - unsigned int sectionNumber_; - unsigned int startOrbit_; - unsigned int numOrbits_; - - float pileup_; - float pileupRMS_; - float bunchLumi_; - float spare_; -}; - -/// Pretty-print operator for LumiScalers -std::ostream& operator<<(std::ostream& s, const LumiScalers& c); - +namespace io_v1 { + class LumiScalers { + public: + LumiScalers(); + LumiScalers(const unsigned char* rawData); + virtual ~LumiScalers(); + + enum { nOcc = 2 }; + + /// name method + std::string name() const { return "LumiScalers"; } + + /// empty method (= false) + bool empty() const { return false; } + + unsigned int trigType() const { return (trigType_); } + unsigned int eventID() const { return (eventID_); } + unsigned int sourceID() const { return (sourceID_); } + unsigned int bunchNumber() const { return (bunchNumber_); } + + int version() const { return (version_); } + timespec collectionTime() const { return (collectionTime_.get_timespec()); } + float normalization() const { return (normalization_); } + float deadTimeNormalization() const { return (deadTimeNormalization_); } + + float lumiFill() const { return (lumiFill_); } + float lumiRun() const { return (lumiRun_); } + float liveLumiFill() const { return (liveLumiFill_); } + float liveLumiRun() const { return (liveLumiRun_); } + float instantLumi() const { return (instantLumi_); } + float instantLumiErr() const { return (instantLumiErr_); } + unsigned char instantLumiQlty() const { return (instantLumiQlty_); } + + float lumiETFill() const { return (lumiETFill_); } + float lumiETRun() const { return (lumiETRun_); } + float liveLumiETFill() const { return (liveLumiETFill_); } + float liveLumiETRun() const { return (liveLumiETRun_); } + float instantETLumi() const { return (instantETLumi_); } + float instantETLumiErr() const { return (instantETLumiErr_); } + unsigned char instantETLumiQlty() const { return (instantETLumiQlty_); } + + std::vector lumiOccFill() const { return (lumiOccFill_); } + std::vector lumiOccRun() const { return (lumiOccRun_); } + std::vector liveLumiOccFill() const { return (liveLumiOccFill_); } + std::vector liveLumiOccRun() const { return (liveLumiOccRun_); } + std::vector instantOccLumi() const { return (instantOccLumi_); } + std::vector instantOccLumiErr() const { return (instantOccLumiErr_); } + std::vector instantOccLumiQlty() const { return (instantOccLumiQlty_); } + std::vector lumiNoise() const { return (lumiNoise_); } + + unsigned int sectionNumber() const { return (sectionNumber_); } + unsigned int startOrbit() const { return (startOrbit_); } + unsigned int numOrbits() const { return (numOrbits_); } + + float pileup() const { return (pileup_); } + float pileupRMS() const { return (pileupRMS_); } + float bunchLumi() const { return (bunchLumi_); } + float spare() const { return (spare_); } + + /// equality operator + int operator==(const LumiScalers& e) const { return false; } + + /// inequality operator + int operator!=(const LumiScalers& e) const { return false; } + + protected: + unsigned int trigType_; + unsigned int eventID_; + unsigned int sourceID_; + unsigned int bunchNumber_; + + int version_; + + TimeSpec collectionTime_; + + float normalization_; + float deadTimeNormalization_; + + float lumiFill_; + float lumiRun_; + float liveLumiFill_; + float liveLumiRun_; + float instantLumi_; + float instantLumiErr_; + unsigned char instantLumiQlty_; + + float lumiETFill_; + float lumiETRun_; + float liveLumiETFill_; + float liveLumiETRun_; + float instantETLumi_; + float instantETLumiErr_; + + unsigned char instantETLumiQlty_; + + std::vector lumiOccFill_; + std::vector lumiOccRun_; + std::vector liveLumiOccFill_; + std::vector liveLumiOccRun_; + std::vector instantOccLumi_; + std::vector instantOccLumiErr_; + std::vector instantOccLumiQlty_; + std::vector lumiNoise_; + + unsigned int sectionNumber_; + unsigned int startOrbit_; + unsigned int numOrbits_; + + float pileup_; + float pileupRMS_; + float bunchLumi_; + float spare_; + }; + + /// Pretty-print operator for LumiScalers + std::ostream& operator<<(std::ostream& s, const LumiScalers& c); +} // namespace io_v1 +using LumiScalers = io_v1::LumiScalers; typedef std::vector LumiScalersCollection; #endif diff --git a/DataFormats/Scalers/src/BeamSpotOnline.cc b/DataFormats/Scalers/src/BeamSpotOnline.cc index 9be64e741adee..28ab03460c1a5 100644 --- a/DataFormats/Scalers/src/BeamSpotOnline.cc +++ b/DataFormats/Scalers/src/BeamSpotOnline.cc @@ -7,101 +7,103 @@ #include #include -BeamSpotOnline::BeamSpotOnline() - : trigType_(0), - eventID_(0), - sourceID_(0), - bunchNumber_(0), - version_(0), - collectionTime_(0, 0), - x_((float)0.0), - y_((float)0.0), - z_((float)0.0), - dxdz_((float)0.0), - dydz_((float)0.0), - err_x_((float)0.0), - err_y_((float)0.0), - err_z_((float)0.0), - err_dxdz_((float)0.0), - err_dydz_((float)0.0), - width_x_((float)0.0), - width_y_((float)0.0), - sigma_z_((float)0.0), - err_width_x_((float)0.0), - err_width_y_((float)0.0), - err_sigma_z_((float)0.0) {} +namespace io_v1 { + BeamSpotOnline::BeamSpotOnline() + : trigType_(0), + eventID_(0), + sourceID_(0), + bunchNumber_(0), + version_(0), + collectionTime_(0, 0), + x_((float)0.0), + y_((float)0.0), + z_((float)0.0), + dxdz_((float)0.0), + dydz_((float)0.0), + err_x_((float)0.0), + err_y_((float)0.0), + err_z_((float)0.0), + err_dxdz_((float)0.0), + err_dydz_((float)0.0), + width_x_((float)0.0), + width_y_((float)0.0), + sigma_z_((float)0.0), + err_width_x_((float)0.0), + err_width_y_((float)0.0), + err_sigma_z_((float)0.0) {} -BeamSpotOnline::BeamSpotOnline(const unsigned char* rawData) { - BeamSpotOnline(); + BeamSpotOnline::BeamSpotOnline(const unsigned char* rawData) { + BeamSpotOnline(); - struct ScalersEventRecordRaw_v4 const* raw = reinterpret_cast(rawData); - trigType_ = (raw->header >> 56) & 0xFULL; - eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; - sourceID_ = (raw->header >> 8) & 0x00000FFFULL; - bunchNumber_ = (raw->header >> 20) & 0xFFFULL; + struct ScalersEventRecordRaw_v4 const* raw = reinterpret_cast(rawData); + trigType_ = (raw->header >> 56) & 0xFULL; + eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; + sourceID_ = (raw->header >> 8) & 0x00000FFFULL; + bunchNumber_ = (raw->header >> 20) & 0xFFFULL; - version_ = raw->version; - if (version_ >= 4) { - collectionTime_.set_tv_sec(static_cast(raw->beamSpotOnline.collectionTime_sec)); - collectionTime_.set_tv_nsec(raw->beamSpotOnline.collectionTime_nsec); - x_ = raw->beamSpotOnline.x; - y_ = raw->beamSpotOnline.y; - z_ = raw->beamSpotOnline.z; - dxdz_ = raw->beamSpotOnline.dxdz; - dydz_ = raw->beamSpotOnline.dydz; - err_x_ = raw->beamSpotOnline.err_x; - err_y_ = raw->beamSpotOnline.err_y; - err_z_ = raw->beamSpotOnline.err_z; - err_dxdz_ = raw->beamSpotOnline.err_dxdz; - err_dydz_ = raw->beamSpotOnline.err_dydz; - width_x_ = raw->beamSpotOnline.width_x; - width_y_ = raw->beamSpotOnline.width_y; - sigma_z_ = raw->beamSpotOnline.sigma_z; - err_width_x_ = raw->beamSpotOnline.err_width_x; - err_width_y_ = raw->beamSpotOnline.err_width_y; - err_sigma_z_ = raw->beamSpotOnline.err_sigma_z; + version_ = raw->version; + if (version_ >= 4) { + collectionTime_.set_tv_sec(static_cast(raw->beamSpotOnline.collectionTime_sec)); + collectionTime_.set_tv_nsec(raw->beamSpotOnline.collectionTime_nsec); + x_ = raw->beamSpotOnline.x; + y_ = raw->beamSpotOnline.y; + z_ = raw->beamSpotOnline.z; + dxdz_ = raw->beamSpotOnline.dxdz; + dydz_ = raw->beamSpotOnline.dydz; + err_x_ = raw->beamSpotOnline.err_x; + err_y_ = raw->beamSpotOnline.err_y; + err_z_ = raw->beamSpotOnline.err_z; + err_dxdz_ = raw->beamSpotOnline.err_dxdz; + err_dydz_ = raw->beamSpotOnline.err_dydz; + width_x_ = raw->beamSpotOnline.width_x; + width_y_ = raw->beamSpotOnline.width_y; + sigma_z_ = raw->beamSpotOnline.sigma_z; + err_width_x_ = raw->beamSpotOnline.err_width_x; + err_width_y_ = raw->beamSpotOnline.err_width_y; + err_sigma_z_ = raw->beamSpotOnline.err_sigma_z; + } } -} -BeamSpotOnline::~BeamSpotOnline() {} + BeamSpotOnline::~BeamSpotOnline() {} -/// Pretty-print operator for BeamSpotOnline -std::ostream& operator<<(std::ostream& s, const BeamSpotOnline& c) { - char zeit[128]; - constexpr size_t kLineBufferSize = 157; - char line[kLineBufferSize]; - struct tm* hora; + /// Pretty-print operator for BeamSpotOnline + std::ostream& operator<<(std::ostream& s, const BeamSpotOnline& c) { + char zeit[128]; + constexpr size_t kLineBufferSize = 157; + char line[kLineBufferSize]; + struct tm* hora; - s << "BeamSpotOnline Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl; + s << "BeamSpotOnline Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl; - timespec ts = c.collectionTime(); - hora = gmtime(&ts.tv_sec); - strftime(zeit, sizeof(zeit), "%Y.%m.%d %H:%M:%S", hora); - snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec); - s << line << std::endl; + timespec ts = c.collectionTime(); + hora = gmtime(&ts.tv_sec); + strftime(zeit, sizeof(zeit), "%Y.%m.%d %H:%M:%S", hora); + snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec); + s << line << std::endl; - snprintf(line, - kLineBufferSize, - " TrigType: %d EventID: %d BunchNumber: %d", - c.trigType(), - c.eventID(), - c.bunchNumber()); - s << line << std::endl; + snprintf(line, + kLineBufferSize, + " TrigType: %d EventID: %d BunchNumber: %d", + c.trigType(), + c.eventID(), + c.bunchNumber()); + s << line << std::endl; - snprintf( - line, kLineBufferSize, " x: %e +/- %e width: %e +/- %e", c.x(), c.err_x(), c.width_x(), c.err_width_x()); - s << line << std::endl; + snprintf( + line, kLineBufferSize, " x: %e +/- %e width: %e +/- %e", c.x(), c.err_x(), c.width_x(), c.err_width_x()); + s << line << std::endl; - snprintf( - line, kLineBufferSize, " y: %e +/- %e width: %e +/- %e", c.y(), c.err_y(), c.width_y(), c.err_width_y()); - s << line << std::endl; + snprintf( + line, kLineBufferSize, " y: %e +/- %e width: %e +/- %e", c.y(), c.err_y(), c.width_y(), c.err_width_y()); + s << line << std::endl; - snprintf( - line, kLineBufferSize, " z: %e +/- %e sigma: %e +/- %e", c.z(), c.err_z(), c.sigma_z(), c.err_sigma_z()); - s << line << std::endl; + snprintf( + line, kLineBufferSize, " z: %e +/- %e sigma: %e +/- %e", c.z(), c.err_z(), c.sigma_z(), c.err_sigma_z()); + s << line << std::endl; - snprintf( - line, kLineBufferSize, " dxdy: %e +/- %e dydz: %e +/- %e", c.dxdz(), c.err_dxdz(), c.dydz(), c.err_dydz()); - s << line << std::endl; - return s; -} + snprintf( + line, kLineBufferSize, " dxdy: %e +/- %e dydz: %e +/- %e", c.dxdz(), c.err_dxdz(), c.dydz(), c.err_dydz()); + s << line << std::endl; + return s; + } +} // namespace io_v1 diff --git a/DataFormats/Scalers/src/DcsStatus.cc b/DataFormats/Scalers/src/DcsStatus.cc index de14aa9c84a6e..061cc091dec2e 100644 --- a/DataFormats/Scalers/src/DcsStatus.cc +++ b/DataFormats/Scalers/src/DcsStatus.cc @@ -7,84 +7,86 @@ #include #include -const int DcsStatus::partitionList[DcsStatus::nPartitions] = {EBp, EBm, EEp, EEm, HBHEa, HBHEb, HBHEc, HF, HO, - RPC, DT0, DTp, DTm, CSCp, CSCm, CASTOR, ZDC, TIBTID, - TOB, TECp, TECm, BPIX, FPIX, ESp, ESm}; +namespace io_v1 { + const int DcsStatus::partitionList[DcsStatus::nPartitions] = { + EBp, EBm, EEp, EEm, HBHEa, HBHEb, HBHEc, HF, HO, RPC, DT0, DTp, DTm, + CSCp, CSCm, CASTOR, ZDC, TIBTID, TOB, TECp, TECm, BPIX, FPIX, ESp, ESm}; -const char* const DcsStatus::partitionName[DcsStatus::nPartitions] = { - "EBp", "EBm", "EEp", "EEm", "HBHEa", "HBHEb", "HBHEc", "HF", "HO", "RPC", "DT0", "DTp", "DTm", - "CSCp", "CSCm", "CASTOR", "ZDC", "TIBTID", "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm"}; + const char* const DcsStatus::partitionName[DcsStatus::nPartitions] = { + "EBp", "EBm", "EEp", "EEm", "HBHEa", "HBHEb", "HBHEc", "HF", "HO", "RPC", "DT0", "DTp", "DTm", + "CSCp", "CSCm", "CASTOR", "ZDC", "TIBTID", "TOB", "TECp", "TECm", "BPIX", "FPIX", "ESp", "ESm"}; -DcsStatus::DcsStatus() - : trigType_(0), - eventID_(0), - sourceID_(0), - bunchNumber_(0), - version_(0), - collectionTime_(0, 0), - ready_(0), - magnetCurrent_((float)0.0), - magnetTemperature_((float)0.0) {} + DcsStatus::DcsStatus() + : trigType_(0), + eventID_(0), + sourceID_(0), + bunchNumber_(0), + version_(0), + collectionTime_(0, 0), + ready_(0), + magnetCurrent_((float)0.0), + magnetTemperature_((float)0.0) {} -DcsStatus::DcsStatus(const unsigned char* rawData) { - DcsStatus(); + DcsStatus::DcsStatus(const unsigned char* rawData) { + DcsStatus(); - struct ScalersEventRecordRaw_v4 const* raw = reinterpret_cast(rawData); - trigType_ = (raw->header >> 56) & 0xFULL; - eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; - sourceID_ = (raw->header >> 8) & 0x00000FFFULL; - bunchNumber_ = (raw->header >> 20) & 0xFFFULL; + struct ScalersEventRecordRaw_v4 const* raw = reinterpret_cast(rawData); + trigType_ = (raw->header >> 56) & 0xFULL; + eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; + sourceID_ = (raw->header >> 8) & 0x00000FFFULL; + bunchNumber_ = (raw->header >> 20) & 0xFFFULL; - version_ = raw->version; - if (version_ >= 4) { - collectionTime_.set_tv_sec(static_cast(raw->dcsStatus.collectionTime_sec)); - collectionTime_.set_tv_nsec(raw->dcsStatus.collectionTime_nsec); - ready_ = raw->dcsStatus.ready; - magnetCurrent_ = raw->dcsStatus.magnetCurrent; - magnetTemperature_ = raw->dcsStatus.magnetTemperature; + version_ = raw->version; + if (version_ >= 4) { + collectionTime_.set_tv_sec(static_cast(raw->dcsStatus.collectionTime_sec)); + collectionTime_.set_tv_nsec(raw->dcsStatus.collectionTime_nsec); + ready_ = raw->dcsStatus.ready; + magnetCurrent_ = raw->dcsStatus.magnetCurrent; + magnetTemperature_ = raw->dcsStatus.magnetTemperature; + } } -} -DcsStatus::~DcsStatus() {} + DcsStatus::~DcsStatus() {} -/// Pretty-print operator for DcsStatus -std::ostream& operator<<(std::ostream& s, const DcsStatus& c) { - constexpr size_t kZeitBufferSize = 128; - char zeit[kZeitBufferSize]; - constexpr size_t kLineBufferSize = 157; - char line[kLineBufferSize]; - struct tm* hora; + /// Pretty-print operator for DcsStatus + std::ostream& operator<<(std::ostream& s, const DcsStatus& c) { + constexpr size_t kZeitBufferSize = 128; + char zeit[kZeitBufferSize]; + constexpr size_t kLineBufferSize = 157; + char line[kLineBufferSize]; + struct tm* hora; - s << "DcsStatus Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl; + s << "DcsStatus Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl; - timespec ts = c.collectionTime(); - hora = gmtime(&ts.tv_sec); - strftime(zeit, kZeitBufferSize, "%Y.%m.%d %H:%M:%S", hora); - snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec); - s << line << std::endl; + timespec ts = c.collectionTime(); + hora = gmtime(&ts.tv_sec); + strftime(zeit, kZeitBufferSize, "%Y.%m.%d %H:%M:%S", hora); + snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec); + s << line << std::endl; - snprintf(line, - kLineBufferSize, - " TrigType: %d EventID: %d BunchNumber: %d", - c.trigType(), - c.eventID(), - c.bunchNumber()); - s << line << std::endl; + snprintf(line, + kLineBufferSize, + " TrigType: %d EventID: %d BunchNumber: %d", + c.trigType(), + c.eventID(), + c.bunchNumber()); + s << line << std::endl; - snprintf( - line, kLineBufferSize, " MagnetCurrent: %e MagnetTemperature: %e", c.magnetCurrent(), c.magnetTemperature()); - s << line << std::endl; + snprintf( + line, kLineBufferSize, " MagnetCurrent: %e MagnetTemperature: %e", c.magnetCurrent(), c.magnetTemperature()); + s << line << std::endl; - snprintf(line, kLineBufferSize, " Ready: %d 0x%8.8X", c.ready(), c.ready()); - s << line << std::endl; + snprintf(line, kLineBufferSize, " Ready: %d 0x%8.8X", c.ready(), c.ready()); + s << line << std::endl; - for (int i = 0; i < DcsStatus::nPartitions; i++) { - if (c.ready(DcsStatus::partitionList[i])) { - snprintf(line, kLineBufferSize, " %2d %6s: READY", i, DcsStatus::partitionName[i]); - } else { - snprintf(line, kLineBufferSize, " %2d %6s: NOT READY", i, DcsStatus::partitionName[i]); + for (int i = 0; i < DcsStatus::nPartitions; i++) { + if (c.ready(DcsStatus::partitionList[i])) { + snprintf(line, kLineBufferSize, " %2d %6s: READY", i, DcsStatus::partitionName[i]); + } else { + snprintf(line, kLineBufferSize, " %2d %6s: NOT READY", i, DcsStatus::partitionName[i]); + } + s << line << std::endl; } - s << line << std::endl; + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/Scalers/src/L1AcceptBunchCrossing.cc b/DataFormats/Scalers/src/L1AcceptBunchCrossing.cc index 4e0767e98cf9d..0ff2426aa744a 100644 --- a/DataFormats/Scalers/src/L1AcceptBunchCrossing.cc +++ b/DataFormats/Scalers/src/L1AcceptBunchCrossing.cc @@ -6,40 +6,42 @@ #include "DataFormats/Scalers/interface/ScalersRaw.h" #include -L1AcceptBunchCrossing::L1AcceptBunchCrossing() - : l1AcceptOffset_(0), orbitNumber_(0), bunchCrossing_(0), eventType_(0) {} - -L1AcceptBunchCrossing::L1AcceptBunchCrossing(const int l1AcceptOffset__, - const unsigned int orbitNumber__, - const unsigned int bunchCrossing__, - const unsigned int eventType__) - : l1AcceptOffset_(l1AcceptOffset__), - orbitNumber_(orbitNumber__), - bunchCrossing_(bunchCrossing__), - eventType_(eventType__) {} - -L1AcceptBunchCrossing::L1AcceptBunchCrossing(const int index, const unsigned long long data) { - l1AcceptOffset_ = -index; - orbitNumber_ = (unsigned int)((data >> ORBIT_NUMBER_SHIFT) & ORBIT_NUMBER_MASK); - bunchCrossing_ = (unsigned int)((data >> BUNCH_CROSSING_SHIFT) & BUNCH_CROSSING_MASK); - eventType_ = (unsigned int)((data >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK); -} - -L1AcceptBunchCrossing::~L1AcceptBunchCrossing() {} - -/// Pretty-print operator for L1AcceptBunchCrossing -std::ostream& operator<<(std::ostream& s, const L1AcceptBunchCrossing& c) { - char line[128]; - - sprintf(line, - "L1AcceptBC Offset:%2d Orbit:%10d [0x%8.8X] BC:%4d [0x%3.3X] EvtTyp:%d", - c.l1AcceptOffset(), - c.orbitNumber(), - c.orbitNumber(), - c.bunchCrossing(), - c.bunchCrossing(), - c.eventType()); - s << line << std::endl; - - return s; -} +namespace io_v1 { + L1AcceptBunchCrossing::L1AcceptBunchCrossing() + : l1AcceptOffset_(0), orbitNumber_(0), bunchCrossing_(0), eventType_(0) {} + + L1AcceptBunchCrossing::L1AcceptBunchCrossing(const int l1AcceptOffset__, + const unsigned int orbitNumber__, + const unsigned int bunchCrossing__, + const unsigned int eventType__) + : l1AcceptOffset_(l1AcceptOffset__), + orbitNumber_(orbitNumber__), + bunchCrossing_(bunchCrossing__), + eventType_(eventType__) {} + + L1AcceptBunchCrossing::L1AcceptBunchCrossing(const int index, const unsigned long long data) { + l1AcceptOffset_ = -index; + orbitNumber_ = (unsigned int)((data >> ORBIT_NUMBER_SHIFT) & ORBIT_NUMBER_MASK); + bunchCrossing_ = (unsigned int)((data >> BUNCH_CROSSING_SHIFT) & BUNCH_CROSSING_MASK); + eventType_ = (unsigned int)((data >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK); + } + + L1AcceptBunchCrossing::~L1AcceptBunchCrossing() {} + + /// Pretty-print operator for L1AcceptBunchCrossing + std::ostream& operator<<(std::ostream& s, const L1AcceptBunchCrossing& c) { + char line[128]; + + sprintf(line, + "L1AcceptBC Offset:%2d Orbit:%10d [0x%8.8X] BC:%4d [0x%3.3X] EvtTyp:%d", + c.l1AcceptOffset(), + c.orbitNumber(), + c.orbitNumber(), + c.bunchCrossing(), + c.bunchCrossing(), + c.eventType()); + s << line << std::endl; + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/Scalers/src/L1TriggerScalers.cc b/DataFormats/Scalers/src/L1TriggerScalers.cc index f4815322749b2..552830d2856df 100644 --- a/DataFormats/Scalers/src/L1TriggerScalers.cc +++ b/DataFormats/Scalers/src/L1TriggerScalers.cc @@ -9,229 +9,231 @@ #include #include -L1TriggerScalers::L1TriggerScalers() - : version_(0), - collectionTimeSpecial_(0, 0), - orbitNumber_(0), - luminositySection_(0), - bunchCrossingErrors_(0), - collectionTimeSummary_(0, 0), - triggerNumber_(0), - eventNumber_(0), - finalTriggersDistributed_(0), - calibrationTriggers_(0), - randomTriggers_(0), - totalTestTriggers_(0), - finalTriggersGenerated_(0), - finalTriggersInvalidBC_(0), - deadTime_(0), - lostFinalTriggers_(0), - deadTimeActive_(0), - lostFinalTriggersActive_(0), - deadTimeActivePrivate_(0), - deadTimeActivePartition_(0), - deadTimeActiveThrottle_(0), - deadTimeActiveCalibration_(0), - deadTimeActiveTimeSlot_(0), - numberResets_(0), - collectionTimeDetails_(0, 0), - triggers_(nL1Triggers), - testTriggers_(nL1TestTriggers) {} - -L1TriggerScalers::L1TriggerScalers(const unsigned char* rawData) { - L1TriggerScalers(); - - struct ScalersEventRecordRaw_v1 const* raw = reinterpret_cast(rawData); - - trigType_ = (raw->header >> 56) & 0xFULL; - eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; - sourceID_ = (raw->header >> 8) & 0x00000FFFULL; - bunchNumber_ = (raw->header >> 20) & 0xFFFULL; - - version_ = raw->version; - if ((version_ == 1) || (version_ == 2)) { - collectionTimeSpecial_.set_tv_sec(static_cast(raw->trig.collectionTimeSpecial_sec)); - collectionTimeSpecial_.set_tv_nsec(raw->trig.collectionTimeSpecial_nsec); - orbitNumber_ = raw->trig.ORBIT_NUMBER; - luminositySection_ = raw->trig.LUMINOSITY_SEGMENT; - bunchCrossingErrors_ = raw->trig.BC_ERRORS; - - collectionTimeSummary_.set_tv_sec(static_cast(raw->trig.collectionTimeSummary_sec)); - collectionTimeSummary_.set_tv_nsec(raw->trig.collectionTimeSummary_nsec); - - triggerNumber_ = raw->trig.TRIGGER_NR; - eventNumber_ = raw->trig.EVENT_NR; - finalTriggersDistributed_ = raw->trig.FINOR_DISTRIBUTED; - calibrationTriggers_ = raw->trig.CAL_TRIGGER; - randomTriggers_ = raw->trig.RANDOM_TRIGGER; - totalTestTriggers_ = raw->trig.TEST_TRIGGER; - - finalTriggersGenerated_ = raw->trig.FINOR_GENERATED; - finalTriggersInvalidBC_ = raw->trig.FINOR_IN_INVALID_BC; - - deadTime_ = raw->trig.DEADTIME; - lostFinalTriggers_ = raw->trig.LOST_FINOR; - deadTimeActive_ = raw->trig.DEADTIMEA; - lostFinalTriggersActive_ = raw->trig.LOST_FINORA; - deadTimeActivePrivate_ = raw->trig.PRIV_DEADTIMEA; - deadTimeActivePartition_ = raw->trig.PTCSTATUS_DEADTIMEA; - deadTimeActiveThrottle_ = raw->trig.THROTTLE_DEADTIMEA; - deadTimeActiveCalibration_ = raw->trig.CALIBRATION_DEADTIMEA; - deadTimeActiveTimeSlot_ = raw->trig.TIMESLOT_DEADTIMEA; - numberResets_ = raw->trig.NR_OF_RESETS; - - collectionTimeDetails_.set_tv_sec(static_cast(raw->trig.collectionTimeDetails_sec)); - collectionTimeDetails_.set_tv_nsec(raw->trig.collectionTimeDetails_nsec); - - for (int i = 0; i < ScalersRaw::N_L1_TRIGGERS_v1; i++) { - triggers_.push_back(raw->trig.ALGO_RATE[i]); - } - - for (int i = 0; i < ScalersRaw::N_L1_TEST_TRIGGERS_v1; i++) { - testTriggers_.push_back(raw->trig.TEST_RATE[i]); +namespace io_v1 { + L1TriggerScalers::L1TriggerScalers() + : version_(0), + collectionTimeSpecial_(0, 0), + orbitNumber_(0), + luminositySection_(0), + bunchCrossingErrors_(0), + collectionTimeSummary_(0, 0), + triggerNumber_(0), + eventNumber_(0), + finalTriggersDistributed_(0), + calibrationTriggers_(0), + randomTriggers_(0), + totalTestTriggers_(0), + finalTriggersGenerated_(0), + finalTriggersInvalidBC_(0), + deadTime_(0), + lostFinalTriggers_(0), + deadTimeActive_(0), + lostFinalTriggersActive_(0), + deadTimeActivePrivate_(0), + deadTimeActivePartition_(0), + deadTimeActiveThrottle_(0), + deadTimeActiveCalibration_(0), + deadTimeActiveTimeSlot_(0), + numberResets_(0), + collectionTimeDetails_(0, 0), + triggers_(nL1Triggers), + testTriggers_(nL1TestTriggers) {} + + L1TriggerScalers::L1TriggerScalers(const unsigned char* rawData) { + L1TriggerScalers(); + + struct ScalersEventRecordRaw_v1 const* raw = reinterpret_cast(rawData); + + trigType_ = (raw->header >> 56) & 0xFULL; + eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; + sourceID_ = (raw->header >> 8) & 0x00000FFFULL; + bunchNumber_ = (raw->header >> 20) & 0xFFFULL; + + version_ = raw->version; + if ((version_ == 1) || (version_ == 2)) { + collectionTimeSpecial_.set_tv_sec(static_cast(raw->trig.collectionTimeSpecial_sec)); + collectionTimeSpecial_.set_tv_nsec(raw->trig.collectionTimeSpecial_nsec); + orbitNumber_ = raw->trig.ORBIT_NUMBER; + luminositySection_ = raw->trig.LUMINOSITY_SEGMENT; + bunchCrossingErrors_ = raw->trig.BC_ERRORS; + + collectionTimeSummary_.set_tv_sec(static_cast(raw->trig.collectionTimeSummary_sec)); + collectionTimeSummary_.set_tv_nsec(raw->trig.collectionTimeSummary_nsec); + + triggerNumber_ = raw->trig.TRIGGER_NR; + eventNumber_ = raw->trig.EVENT_NR; + finalTriggersDistributed_ = raw->trig.FINOR_DISTRIBUTED; + calibrationTriggers_ = raw->trig.CAL_TRIGGER; + randomTriggers_ = raw->trig.RANDOM_TRIGGER; + totalTestTriggers_ = raw->trig.TEST_TRIGGER; + + finalTriggersGenerated_ = raw->trig.FINOR_GENERATED; + finalTriggersInvalidBC_ = raw->trig.FINOR_IN_INVALID_BC; + + deadTime_ = raw->trig.DEADTIME; + lostFinalTriggers_ = raw->trig.LOST_FINOR; + deadTimeActive_ = raw->trig.DEADTIMEA; + lostFinalTriggersActive_ = raw->trig.LOST_FINORA; + deadTimeActivePrivate_ = raw->trig.PRIV_DEADTIMEA; + deadTimeActivePartition_ = raw->trig.PTCSTATUS_DEADTIMEA; + deadTimeActiveThrottle_ = raw->trig.THROTTLE_DEADTIMEA; + deadTimeActiveCalibration_ = raw->trig.CALIBRATION_DEADTIMEA; + deadTimeActiveTimeSlot_ = raw->trig.TIMESLOT_DEADTIMEA; + numberResets_ = raw->trig.NR_OF_RESETS; + + collectionTimeDetails_.set_tv_sec(static_cast(raw->trig.collectionTimeDetails_sec)); + collectionTimeDetails_.set_tv_nsec(raw->trig.collectionTimeDetails_nsec); + + for (int i = 0; i < ScalersRaw::N_L1_TRIGGERS_v1; i++) { + triggers_.push_back(raw->trig.ALGO_RATE[i]); + } + + for (int i = 0; i < ScalersRaw::N_L1_TEST_TRIGGERS_v1; i++) { + testTriggers_.push_back(raw->trig.TEST_RATE[i]); + } } } -} - -L1TriggerScalers::~L1TriggerScalers() {} - -/// Pretty-print operator for L1TriggerScalers -std::ostream& operator<<(std::ostream& s, L1TriggerScalers const& c) { - s << "L1TriggerScalers Version:" << c.version() << " SourceID: " << c.sourceID() << std::endl; - constexpr size_t kLineBufferSize = 164; - char line[kLineBufferSize]; - char zeitHeaven[128]; - char zeitHell[128]; - char zeitLimbo[128]; - struct tm* horaHeaven; - struct tm* horaHell; - struct tm* horaLimbo; - - sprintf(line, " TrigType: %d EventID: %d BunchNumber: %d", c.trigType(), c.eventID(), c.bunchNumber()); - s << line << std::endl; - - timespec secondsToHeaven = c.collectionTimeSummary(); - horaHeaven = gmtime(&secondsToHeaven.tv_sec); - strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven); - snprintf(line, kLineBufferSize, " CollectionTimeSummary: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec); - s << line << std::endl; - - timespec secondsToHell = c.collectionTimeSpecial(); - horaHell = gmtime(&secondsToHell.tv_sec); - strftime(zeitHell, sizeof(zeitHell), "%Y.%m.%d %H:%M:%S", horaHell); - snprintf(line, kLineBufferSize, " CollectionTimeSpecial: %s.%9.9d", zeitHell, (int)secondsToHell.tv_nsec); - s << line << std::endl; - - timespec secondsToLimbo = c.collectionTimeDetails(); - horaLimbo = gmtime(&secondsToLimbo.tv_sec); - strftime(zeitLimbo, sizeof(zeitLimbo), "%Y.%m.%d %H:%M:%S", horaLimbo); - snprintf(line, kLineBufferSize, " CollectionTimeDetails: %s.%9.9d", zeitLimbo, (int)secondsToLimbo.tv_nsec); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " LuminositySection: %15d BunchCrossingErrors: %15d", - c.luminositySection(), - c.bunchCrossingErrors()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggerNumber: %15d EventNumber: %15d", - c.triggerNumber(), - c.eventNumber()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggersDistributed: %10d TriggersGenerated: %15d", - c.finalTriggersDistributed(), - c.finalTriggersGenerated()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggersInvalidBC: %15d CalibrationTriggers: %15d", - c.finalTriggersInvalidBC(), - c.calibrationTriggers()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TestTriggers: %15d RandomTriggers: %15d", - c.totalTestTriggers(), - c.randomTriggers()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadTime: %15d DeadTimeActiveTimeSlot: %15ld", - c.numberResets(), - (long int)c.deadTime()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadTimeActive: %15ld DeadTimeActiveCalibration:%15ld", - (long int)c.deadTimeActive(), - (long int)c.deadTimeActiveCalibration()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " LostTriggers: %15ld DeadTimeActivePartition: %15ld", - (long int)c.lostFinalTriggers(), - (long int)c.deadTimeActivePartition()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " LostTriggersActive:%15ld DeadTimeActiveThrottle: %15ld", - (long int)c.lostFinalTriggersActive(), - (long int)c.deadTimeActiveThrottle()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " NumberResets: %15d DeadTimeActivePrivate: %15ld", - c.numberResets(), - (long int)c.deadTimeActivePrivate()); - s << line << std::endl; - - s << "Physics Triggers" << std::endl; - std::vector triggers = c.triggers(); - int length = triggers.size() / 4; - for (int i = 0; i < length; i++) { + + L1TriggerScalers::~L1TriggerScalers() {} + + /// Pretty-print operator for L1TriggerScalers + std::ostream& operator<<(std::ostream& s, L1TriggerScalers const& c) { + s << "L1TriggerScalers Version:" << c.version() << " SourceID: " << c.sourceID() << std::endl; + constexpr size_t kLineBufferSize = 164; + char line[kLineBufferSize]; + char zeitHeaven[128]; + char zeitHell[128]; + char zeitLimbo[128]; + struct tm* horaHeaven; + struct tm* horaHell; + struct tm* horaLimbo; + + sprintf(line, " TrigType: %d EventID: %d BunchNumber: %d", c.trigType(), c.eventID(), c.bunchNumber()); + s << line << std::endl; + + timespec secondsToHeaven = c.collectionTimeSummary(); + horaHeaven = gmtime(&secondsToHeaven.tv_sec); + strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven); + snprintf(line, kLineBufferSize, " CollectionTimeSummary: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec); + s << line << std::endl; + + timespec secondsToHell = c.collectionTimeSpecial(); + horaHell = gmtime(&secondsToHell.tv_sec); + strftime(zeitHell, sizeof(zeitHell), "%Y.%m.%d %H:%M:%S", horaHell); + snprintf(line, kLineBufferSize, " CollectionTimeSpecial: %s.%9.9d", zeitHell, (int)secondsToHell.tv_nsec); + s << line << std::endl; + + timespec secondsToLimbo = c.collectionTimeDetails(); + horaLimbo = gmtime(&secondsToLimbo.tv_sec); + strftime(zeitLimbo, sizeof(zeitLimbo), "%Y.%m.%d %H:%M:%S", horaLimbo); + snprintf(line, kLineBufferSize, " CollectionTimeDetails: %s.%9.9d", zeitLimbo, (int)secondsToLimbo.tv_nsec); + s << line << std::endl; + snprintf(line, kLineBufferSize, - " %3.3d: %10d %3.3d: %10d %3.3d: %10d %3.3d: %10d", - i, - triggers[i], - (i + length), - triggers[i + length], - (i + (length * 2)), - triggers[i + (length * 2)], - (i + (length * 3)), - triggers[i + (length * 3)]); + " LuminositySection: %15d BunchCrossingErrors: %15d", + c.luminositySection(), + c.bunchCrossingErrors()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " TriggerNumber: %15d EventNumber: %15d", + c.triggerNumber(), + c.eventNumber()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " TriggersDistributed: %10d TriggersGenerated: %15d", + c.finalTriggersDistributed(), + c.finalTriggersGenerated()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " TriggersInvalidBC: %15d CalibrationTriggers: %15d", + c.finalTriggersInvalidBC(), + c.calibrationTriggers()); s << line << std::endl; - } - s << "Test Triggers" << std::endl; - std::vector testTriggers = c.testTriggers(); - length = testTriggers.size() / 4; - for (int i = 0; i < length; i++) { snprintf(line, kLineBufferSize, - " %3.3d: %10d %3.3d: %10d %3.3d: %10d %3.3d: %10d", - i, - testTriggers[i], - (i + length), - testTriggers[i + length], - (i + (length * 2)), - testTriggers[i + (length * 2)], - (i + (length * 3)), - testTriggers[i + (length * 3)]); + " TestTriggers: %15d RandomTriggers: %15d", + c.totalTestTriggers(), + c.randomTriggers()); s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadTime: %15d DeadTimeActiveTimeSlot: %15ld", + c.numberResets(), + (long int)c.deadTime()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadTimeActive: %15ld DeadTimeActiveCalibration:%15ld", + (long int)c.deadTimeActive(), + (long int)c.deadTimeActiveCalibration()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " LostTriggers: %15ld DeadTimeActivePartition: %15ld", + (long int)c.lostFinalTriggers(), + (long int)c.deadTimeActivePartition()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " LostTriggersActive:%15ld DeadTimeActiveThrottle: %15ld", + (long int)c.lostFinalTriggersActive(), + (long int)c.deadTimeActiveThrottle()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " NumberResets: %15d DeadTimeActivePrivate: %15ld", + c.numberResets(), + (long int)c.deadTimeActivePrivate()); + s << line << std::endl; + + s << "Physics Triggers" << std::endl; + std::vector triggers = c.triggers(); + int length = triggers.size() / 4; + for (int i = 0; i < length; i++) { + snprintf(line, + kLineBufferSize, + " %3.3d: %10d %3.3d: %10d %3.3d: %10d %3.3d: %10d", + i, + triggers[i], + (i + length), + triggers[i + length], + (i + (length * 2)), + triggers[i + (length * 2)], + (i + (length * 3)), + triggers[i + (length * 3)]); + s << line << std::endl; + } + + s << "Test Triggers" << std::endl; + std::vector testTriggers = c.testTriggers(); + length = testTriggers.size() / 4; + for (int i = 0; i < length; i++) { + snprintf(line, + kLineBufferSize, + " %3.3d: %10d %3.3d: %10d %3.3d: %10d %3.3d: %10d", + i, + testTriggers[i], + (i + length), + testTriggers[i + length], + (i + (length * 2)), + testTriggers[i + (length * 2)], + (i + (length * 3)), + testTriggers[i + (length * 3)]); + s << line << std::endl; + } + return s; } - return s; -} +} // namespace io_v1 diff --git a/DataFormats/Scalers/src/Level1TriggerScalers.cc b/DataFormats/Scalers/src/Level1TriggerScalers.cc index 602a6c22a476d..410c3d7e15719 100644 --- a/DataFormats/Scalers/src/Level1TriggerScalers.cc +++ b/DataFormats/Scalers/src/Level1TriggerScalers.cc @@ -9,409 +9,414 @@ #include #include -Level1TriggerScalers::Level1TriggerScalers() - : version_(0), - trigType_(0), - eventID_(0), - sourceID_(0), - bunchNumber_(0), - collectionTime_(0, 0), - lumiSegmentNr_(0), - lumiSegmentOrbits_(0), - orbitNr_(0), - gtResets_(0), - bunchCrossingErrors_(0), - gtTriggers_(0), - gtEvents_(0), - gtTriggersRate_((float)0.0), - gtEventsRate_((float)0.0), - prescaleIndexAlgo_(0), - prescaleIndexTech_(0), - collectionTimeLumiSeg_(0, 0), - lumiSegmentNrLumiSeg_(0), - triggersPhysicsGeneratedFDL_(0), - triggersPhysicsLost_(0), - triggersPhysicsLostBeamActive_(0), - triggersPhysicsLostBeamInactive_(0), - l1AsPhysics_(0), - l1AsRandom_(0), - l1AsTest_(0), - l1AsCalibration_(0), - deadtime_(0), - deadtimeBeamActive_(0), - deadtimeBeamActiveTriggerRules_(0), - deadtimeBeamActiveCalibration_(0), - deadtimeBeamActivePrivateOrbit_(0), - deadtimeBeamActivePartitionController_(0), - deadtimeBeamActiveTimeSlot_(0), - gtAlgoCounts_(nLevel1Triggers), - gtTechCounts_(nLevel1TestTriggers), - lastOrbitCounter0_(0), - lastTestEnable_(0), - lastResync_(0), - lastStart_(0), - lastEventCounter0_(0), - lastHardReset_(0), - spare0_(0ULL), - spare1_(0ULL), - spare2_(0ULL) {} - -Level1TriggerScalers::Level1TriggerScalers(const unsigned char* rawData) { - Level1TriggerScalers(); - - struct ScalersEventRecordRaw_v5 const* raw = reinterpret_cast(rawData); - - trigType_ = (raw->header >> 56) & 0xFULL; - eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; - sourceID_ = (raw->header >> 8) & 0x00000FFFULL; - bunchNumber_ = (raw->header >> 20) & 0xFFFULL; - - version_ = raw->version; - if (version_ >= 3) { - collectionTime_.set_tv_sec(static_cast(raw->trig.collectionTime_sec)); - collectionTime_.set_tv_nsec(raw->trig.collectionTime_nsec); - - lumiSegmentNr_ = raw->trig.lumiSegmentNr; - lumiSegmentOrbits_ = raw->trig.lumiSegmentOrbits; - orbitNr_ = raw->trig.orbitNr; - gtResets_ = raw->trig.gtResets; - bunchCrossingErrors_ = raw->trig.bunchCrossingErrors; - gtTriggers_ = raw->trig.gtTriggers; - gtEvents_ = raw->trig.gtEvents; - gtTriggersRate_ = raw->trig.gtTriggersRate; - gtEventsRate_ = raw->trig.gtEventsRate; - prescaleIndexAlgo_ = raw->trig.prescaleIndexAlgo; - prescaleIndexTech_ = raw->trig.prescaleIndexTech; - - collectionTimeLumiSeg_.set_tv_sec(static_cast(raw->trig.collectionTimeLumiSeg_sec)); - collectionTimeLumiSeg_.set_tv_nsec(raw->trig.collectionTimeLumiSeg_nsec); - - lumiSegmentNrLumiSeg_ = raw->trig.lumiSegmentNrLumiSeg; - triggersPhysicsGeneratedFDL_ = raw->trig.triggersPhysicsGeneratedFDL; - triggersPhysicsLost_ = raw->trig.triggersPhysicsLost; - triggersPhysicsLostBeamActive_ = raw->trig.triggersPhysicsLostBeamActive; - triggersPhysicsLostBeamInactive_ = raw->trig.triggersPhysicsLostBeamInactive; - - l1AsPhysics_ = raw->trig.l1AsPhysics; - l1AsRandom_ = raw->trig.l1AsRandom; - l1AsTest_ = raw->trig.l1AsTest; - l1AsCalibration_ = raw->trig.l1AsCalibration; - deadtime_ = raw->trig.deadtime; - deadtimeBeamActive_ = raw->trig.deadtimeBeamActive; - deadtimeBeamActiveTriggerRules_ = raw->trig.deadtimeBeamActiveTriggerRules; - deadtimeBeamActiveCalibration_ = raw->trig.deadtimeBeamActiveCalibration; - deadtimeBeamActivePrivateOrbit_ = raw->trig.deadtimeBeamActivePrivateOrbit; - deadtimeBeamActivePartitionController_ = raw->trig.deadtimeBeamActivePartitionController; - deadtimeBeamActiveTimeSlot_ = raw->trig.deadtimeBeamActiveTimeSlot; - - for (int i = 0; i < ScalersRaw::N_L1_TRIGGERS_v1; i++) { - gtAlgoCounts_.push_back(raw->trig.gtAlgoCounts[i]); +namespace io_v1 { + Level1TriggerScalers::Level1TriggerScalers() + : version_(0), + trigType_(0), + eventID_(0), + sourceID_(0), + bunchNumber_(0), + collectionTime_(0, 0), + lumiSegmentNr_(0), + lumiSegmentOrbits_(0), + orbitNr_(0), + gtResets_(0), + bunchCrossingErrors_(0), + gtTriggers_(0), + gtEvents_(0), + gtTriggersRate_((float)0.0), + gtEventsRate_((float)0.0), + prescaleIndexAlgo_(0), + prescaleIndexTech_(0), + collectionTimeLumiSeg_(0, 0), + lumiSegmentNrLumiSeg_(0), + triggersPhysicsGeneratedFDL_(0), + triggersPhysicsLost_(0), + triggersPhysicsLostBeamActive_(0), + triggersPhysicsLostBeamInactive_(0), + l1AsPhysics_(0), + l1AsRandom_(0), + l1AsTest_(0), + l1AsCalibration_(0), + deadtime_(0), + deadtimeBeamActive_(0), + deadtimeBeamActiveTriggerRules_(0), + deadtimeBeamActiveCalibration_(0), + deadtimeBeamActivePrivateOrbit_(0), + deadtimeBeamActivePartitionController_(0), + deadtimeBeamActiveTimeSlot_(0), + gtAlgoCounts_(nLevel1Triggers), + gtTechCounts_(nLevel1TestTriggers), + lastOrbitCounter0_(0), + lastTestEnable_(0), + lastResync_(0), + lastStart_(0), + lastEventCounter0_(0), + lastHardReset_(0), + spare0_(0ULL), + spare1_(0ULL), + spare2_(0ULL) {} + + Level1TriggerScalers::Level1TriggerScalers(const unsigned char* rawData) { + Level1TriggerScalers(); + + struct ScalersEventRecordRaw_v5 const* raw = reinterpret_cast(rawData); + + trigType_ = (raw->header >> 56) & 0xFULL; + eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; + sourceID_ = (raw->header >> 8) & 0x00000FFFULL; + bunchNumber_ = (raw->header >> 20) & 0xFFFULL; + + version_ = raw->version; + if (version_ >= 3) { + collectionTime_.set_tv_sec(static_cast(raw->trig.collectionTime_sec)); + collectionTime_.set_tv_nsec(raw->trig.collectionTime_nsec); + + lumiSegmentNr_ = raw->trig.lumiSegmentNr; + lumiSegmentOrbits_ = raw->trig.lumiSegmentOrbits; + orbitNr_ = raw->trig.orbitNr; + gtResets_ = raw->trig.gtResets; + bunchCrossingErrors_ = raw->trig.bunchCrossingErrors; + gtTriggers_ = raw->trig.gtTriggers; + gtEvents_ = raw->trig.gtEvents; + gtTriggersRate_ = raw->trig.gtTriggersRate; + gtEventsRate_ = raw->trig.gtEventsRate; + prescaleIndexAlgo_ = raw->trig.prescaleIndexAlgo; + prescaleIndexTech_ = raw->trig.prescaleIndexTech; + + collectionTimeLumiSeg_.set_tv_sec(static_cast(raw->trig.collectionTimeLumiSeg_sec)); + collectionTimeLumiSeg_.set_tv_nsec(raw->trig.collectionTimeLumiSeg_nsec); + + lumiSegmentNrLumiSeg_ = raw->trig.lumiSegmentNrLumiSeg; + triggersPhysicsGeneratedFDL_ = raw->trig.triggersPhysicsGeneratedFDL; + triggersPhysicsLost_ = raw->trig.triggersPhysicsLost; + triggersPhysicsLostBeamActive_ = raw->trig.triggersPhysicsLostBeamActive; + triggersPhysicsLostBeamInactive_ = raw->trig.triggersPhysicsLostBeamInactive; + + l1AsPhysics_ = raw->trig.l1AsPhysics; + l1AsRandom_ = raw->trig.l1AsRandom; + l1AsTest_ = raw->trig.l1AsTest; + l1AsCalibration_ = raw->trig.l1AsCalibration; + deadtime_ = raw->trig.deadtime; + deadtimeBeamActive_ = raw->trig.deadtimeBeamActive; + deadtimeBeamActiveTriggerRules_ = raw->trig.deadtimeBeamActiveTriggerRules; + deadtimeBeamActiveCalibration_ = raw->trig.deadtimeBeamActiveCalibration; + deadtimeBeamActivePrivateOrbit_ = raw->trig.deadtimeBeamActivePrivateOrbit; + deadtimeBeamActivePartitionController_ = raw->trig.deadtimeBeamActivePartitionController; + deadtimeBeamActiveTimeSlot_ = raw->trig.deadtimeBeamActiveTimeSlot; + + for (int i = 0; i < ScalersRaw::N_L1_TRIGGERS_v1; i++) { + gtAlgoCounts_.push_back(raw->trig.gtAlgoCounts[i]); + } + + for (int i = 0; i < ScalersRaw::N_L1_TEST_TRIGGERS_v1; i++) { + gtTechCounts_.push_back(raw->trig.gtTechCounts[i]); + } + + if (version_ >= 5) { + lastOrbitCounter0_ = raw->lastOrbitCounter0; + lastTestEnable_ = raw->lastTestEnable; + lastResync_ = raw->lastResync; + lastStart_ = raw->lastStart; + lastEventCounter0_ = raw->lastEventCounter0; + lastHardReset_ = raw->lastHardReset; + spare0_ = raw->spare[0]; + spare1_ = raw->spare[1]; + spare2_ = raw->spare[2]; + } else { + lastOrbitCounter0_ = 0UL; + lastTestEnable_ = 0UL; + lastResync_ = 0UL; + lastStart_ = 0UL; + lastEventCounter0_ = 0UL; + lastHardReset_ = 0UL; + spare0_ = 0ULL; + spare1_ = 0ULL; + spare2_ = 0ULL; + } } + } + + Level1TriggerScalers::~Level1TriggerScalers() {} + + double Level1TriggerScalers::rateLS(unsigned int counts) { return (rateLS(counts, firstShortLSRun)); } + + double Level1TriggerScalers::rateLS(unsigned long long counts) { return (rateLS(counts, firstShortLSRun)); } - for (int i = 0; i < ScalersRaw::N_L1_TEST_TRIGGERS_v1; i++) { - gtTechCounts_.push_back(raw->trig.gtTechCounts[i]); + double Level1TriggerScalers::rateLS(unsigned int counts, int runNumber) { + unsigned long long counts64 = (unsigned long long)counts; + return (rateLS(counts64, runNumber)); + } + + double Level1TriggerScalers::rateLS(unsigned long long counts, int runNumber) { + double rate; + if ((runNumber >= firstShortLSRun) || (runNumber <= 1)) { + rate = ((double)counts) / 23.31040958083832; + } else { + rate = ((double)counts) / 93.24163832335329; } + return (rate); + } + + double Level1TriggerScalers::percentLS(unsigned long long counts) { return (percentLS(counts, firstShortLSRun)); } - if (version_ >= 5) { - lastOrbitCounter0_ = raw->lastOrbitCounter0; - lastTestEnable_ = raw->lastTestEnable; - lastResync_ = raw->lastResync; - lastStart_ = raw->lastStart; - lastEventCounter0_ = raw->lastEventCounter0; - lastHardReset_ = raw->lastHardReset; - spare0_ = raw->spare[0]; - spare1_ = raw->spare[1]; - spare2_ = raw->spare[2]; + double Level1TriggerScalers::percentLS(unsigned long long counts, int runNumber) { + double percent; + if ((runNumber >= firstShortLSRun) || (runNumber <= 1)) { + percent = ((double)counts) / 9342812.16; } else { - lastOrbitCounter0_ = 0UL; - lastTestEnable_ = 0UL; - lastResync_ = 0UL; - lastStart_ = 0UL; - lastEventCounter0_ = 0UL; - lastHardReset_ = 0UL; - spare0_ = 0ULL; - spare1_ = 0ULL; - spare2_ = 0ULL; + percent = ((double)counts) / 37371248.64; + } + if (percent > 100.0000) { + percent = 100.0; } + return (percent); } -} -Level1TriggerScalers::~Level1TriggerScalers() {} + double Level1TriggerScalers::percentLSActive(unsigned long long counts) { + return (percentLSActive(counts, firstShortLSRun)); + } -double Level1TriggerScalers::rateLS(unsigned int counts) { return (rateLS(counts, firstShortLSRun)); } + double Level1TriggerScalers::percentLSActive(unsigned long long counts, int runNumber) { + double percent; + if ((runNumber >= firstShortLSRun) || (runNumber <= 1)) { + percent = ((double)counts) / 7361003.52; + } else { + percent = ((double)counts) / 29444014.08; + } + if (percent > 100.0000) { + percent = 100.0; + } + return (percent); + } -double Level1TriggerScalers::rateLS(unsigned long long counts) { return (rateLS(counts, firstShortLSRun)); } + /// Pretty-print operator for Level1TriggerScalers + std::ostream& operator<<(std::ostream& s, Level1TriggerScalers const& c) { + s << "Level1TriggerScalers Version:" << c.version() << " SourceID: " << c.sourceID() << std::endl; + constexpr size_t kLineBufferSize = 164; + char line[kLineBufferSize]; + char zeitHeaven[128]; + struct tm* horaHeaven; -double Level1TriggerScalers::rateLS(unsigned int counts, int runNumber) { - unsigned long long counts64 = (unsigned long long)counts; - return (rateLS(counts64, runNumber)); -} + snprintf(line, + kLineBufferSize, + " TrigType: %d EventID: %d BunchNumber: %d", + c.trigType(), + c.eventID(), + c.bunchNumber()); + s << line << std::endl; -double Level1TriggerScalers::rateLS(unsigned long long counts, int runNumber) { - double rate; - if ((runNumber >= firstShortLSRun) || (runNumber <= 1)) { - rate = ((double)counts) / 23.31040958083832; - } else { - rate = ((double)counts) / 93.24163832335329; - } - return (rate); -} + struct timespec secondsToHeaven = c.collectionTime(); + horaHeaven = gmtime(&secondsToHeaven.tv_sec); + strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven); + snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec); + s << line << std::endl; -double Level1TriggerScalers::percentLS(unsigned long long counts) { return (percentLS(counts, firstShortLSRun)); } + snprintf(line, + kLineBufferSize, + " LumiSegmentNr: %10u LumiSegmentOrbits: %10u", + c.lumiSegmentNr(), + c.lumiSegmentOrbits()); + s << line << std::endl; -double Level1TriggerScalers::percentLS(unsigned long long counts, int runNumber) { - double percent; - if ((runNumber >= firstShortLSRun) || (runNumber <= 1)) { - percent = ((double)counts) / 9342812.16; - } else { - percent = ((double)counts) / 37371248.64; - } - if (percent > 100.0000) { - percent = 100.0; - } - return (percent); -} - -double Level1TriggerScalers::percentLSActive(unsigned long long counts) { - return (percentLSActive(counts, firstShortLSRun)); -} - -double Level1TriggerScalers::percentLSActive(unsigned long long counts, int runNumber) { - double percent; - if ((runNumber >= firstShortLSRun) || (runNumber <= 1)) { - percent = ((double)counts) / 7361003.52; - } else { - percent = ((double)counts) / 29444014.08; - } - if (percent > 100.0000) { - percent = 100.0; - } - return (percent); -} - -/// Pretty-print operator for Level1TriggerScalers -std::ostream& operator<<(std::ostream& s, Level1TriggerScalers const& c) { - s << "Level1TriggerScalers Version:" << c.version() << " SourceID: " << c.sourceID() << std::endl; - constexpr size_t kLineBufferSize = 164; - char line[kLineBufferSize]; - char zeitHeaven[128]; - struct tm* horaHeaven; - - snprintf(line, - kLineBufferSize, - " TrigType: %d EventID: %d BunchNumber: %d", - c.trigType(), - c.eventID(), - c.bunchNumber()); - s << line << std::endl; - - struct timespec secondsToHeaven = c.collectionTime(); - horaHeaven = gmtime(&secondsToHeaven.tv_sec); - strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven); - snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " LumiSegmentNr: %10u LumiSegmentOrbits: %10u", - c.lumiSegmentNr(), - c.lumiSegmentOrbits()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " LumiSegmentNrLumiSeg: %10u OrbitNr: %10u ", - c.lumiSegmentNrLumiSeg(), - c.orbitNr()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " GtResets: %10u BunchCrossingErrors: %10u", - c.gtResets(), - c.bunchCrossingErrors()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " PrescaleIndexAlgo: %10d PrescaleIndexTech: %10d", - c.prescaleIndexAlgo(), - c.prescaleIndexTech()); - s << line << std::endl; - - snprintf( - line, kLineBufferSize, " GtTriggers: %20llu %22.3f Hz", c.gtTriggers(), c.gtTriggersRate()); - s << line << std::endl; - - snprintf(line, kLineBufferSize, " GtEvents: %20llu %22.3f Hz", c.gtEvents(), c.gtEventsRate()); - s << line << std::endl; - - secondsToHeaven = c.collectionTimeLumiSeg(); - horaHeaven = gmtime(&secondsToHeaven.tv_sec); - strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven); - snprintf(line, kLineBufferSize, " CollectionTimeLumiSeg: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggersPhysicsGeneratedFDL: %20llu %22.3f Hz", - c.triggersPhysicsGeneratedFDL(), - Level1TriggerScalers::rateLS(c.triggersPhysicsGeneratedFDL())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggersPhysicsLost: %20llu %22.3f Hz", - c.triggersPhysicsLost(), - Level1TriggerScalers::rateLS(c.triggersPhysicsLost())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggersPhysicsLostBeamActive: %20llu %22.3f Hz", - c.triggersPhysicsLostBeamActive(), - Level1TriggerScalers::rateLS(c.triggersPhysicsLostBeamActive())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TriggersPhysicsLostBeamInactive: %20llu %22.3f Hz", - c.triggersPhysicsLostBeamInactive(), - Level1TriggerScalers::rateLS(c.triggersPhysicsLostBeamInactive())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " L1AsPhysics: %20llu %22.3f Hz", - c.l1AsPhysics(), - Level1TriggerScalers::rateLS(c.l1AsPhysics())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " L1AsRandom: %20llu %22.3f Hz", - c.l1AsRandom(), - Level1TriggerScalers::rateLS(c.l1AsRandom())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " L1AsTest: %20llu %22.3f Hz", - c.l1AsTest(), - Level1TriggerScalers::rateLS(c.l1AsTest())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " L1AsCalibration: %20llu %22.3f Hz", - c.l1AsCalibration(), - Level1TriggerScalers::rateLS(c.l1AsCalibration())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " Deadtime: %20llu %17.3f%%", - c.deadtime(), - Level1TriggerScalers::percentLS(c.deadtime())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadtimeBeamActive: %20llu %17.3f%%", - c.deadtimeBeamActive(), - Level1TriggerScalers::percentLSActive(c.deadtimeBeamActive())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadtimeBeamActiveTriggerRules: %20llu %17.3f%%", - c.deadtimeBeamActiveTriggerRules(), - Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveTriggerRules())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadtimeBeamActiveCalibration: %20llu %17.3f%%", - c.deadtimeBeamActiveCalibration(), - Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveCalibration())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadtimeBeamActivePrivateOrbit: %20llu %17.3f%%", - c.deadtimeBeamActivePrivateOrbit(), - Level1TriggerScalers::percentLSActive(c.deadtimeBeamActivePrivateOrbit())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadtimeBeamActivePartitionController:%20llu %17.3f%%", - c.deadtimeBeamActivePartitionController(), - Level1TriggerScalers::percentLSActive(c.deadtimeBeamActivePartitionController())); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " DeadtimeBeamActiveTimeSlot: %20llu %17.3f%%", - c.deadtimeBeamActiveTimeSlot(), - Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveTimeSlot())); - s << line << std::endl; - - s << "Physics GtAlgoCounts" << std::endl; - const std::vector gtAlgoCounts = c.gtAlgoCounts(); - int length = gtAlgoCounts.size() / 4; - for (int i = 0; i < length; i++) { snprintf(line, kLineBufferSize, - " %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u", - i, - gtAlgoCounts[i], - (i + length), - gtAlgoCounts[i + length], - (i + (length * 2)), - gtAlgoCounts[i + (length * 2)], - (i + (length * 3)), - gtAlgoCounts[i + (length * 3)]); + " LumiSegmentNrLumiSeg: %10u OrbitNr: %10u ", + c.lumiSegmentNrLumiSeg(), + c.orbitNr()); s << line << std::endl; - } - s << "Test GtTechCounts" << std::endl; - const std::vector gtTechCounts = c.gtTechCounts(); - length = gtTechCounts.size() / 4; - for (int i = 0; i < length; i++) { snprintf(line, kLineBufferSize, - " %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u", - i, - gtTechCounts[i], - (i + length), - gtTechCounts[i + length], - (i + (length * 2)), - gtTechCounts[i + (length * 2)], - (i + (length * 3)), - gtTechCounts[i + (length * 3)]); + " GtResets: %10u BunchCrossingErrors: %10u", + c.gtResets(), + c.bunchCrossingErrors()); s << line << std::endl; - } - if (c.version() >= 5) { - snprintf(line, kLineBufferSize, " LastOrbitCounter0: %10u 0x%8.8X", c.lastOrbitCounter0(), c.lastOrbitCounter0()); + snprintf(line, + kLineBufferSize, + " PrescaleIndexAlgo: %10d PrescaleIndexTech: %10d", + c.prescaleIndexAlgo(), + c.prescaleIndexTech()); s << line << std::endl; - snprintf(line, kLineBufferSize, " LastTestEnable: %10u 0x%8.8X", c.lastTestEnable(), c.lastTestEnable()); + snprintf( + line, kLineBufferSize, " GtTriggers: %20llu %22.3f Hz", c.gtTriggers(), c.gtTriggersRate()); s << line << std::endl; - snprintf(line, kLineBufferSize, " LastResync: %10u 0x%8.8X", c.lastResync(), c.lastResync()); + snprintf( + line, kLineBufferSize, " GtEvents: %20llu %22.3f Hz", c.gtEvents(), c.gtEventsRate()); s << line << std::endl; - snprintf(line, kLineBufferSize, " LastStart: %10u 0x%8.8X", c.lastStart(), c.lastStart()); + secondsToHeaven = c.collectionTimeLumiSeg(); + horaHeaven = gmtime(&secondsToHeaven.tv_sec); + strftime(zeitHeaven, sizeof(zeitHeaven), "%Y.%m.%d %H:%M:%S", horaHeaven); + snprintf(line, kLineBufferSize, " CollectionTimeLumiSeg: %s.%9.9d", zeitHeaven, (int)secondsToHeaven.tv_nsec); s << line << std::endl; - snprintf(line, kLineBufferSize, " LastEventCounter0: %10u 0x%8.8X", c.lastEventCounter0(), c.lastEventCounter0()); + snprintf(line, + kLineBufferSize, + " TriggersPhysicsGeneratedFDL: %20llu %22.3f Hz", + c.triggersPhysicsGeneratedFDL(), + Level1TriggerScalers::rateLS(c.triggersPhysicsGeneratedFDL())); s << line << std::endl; - snprintf(line, kLineBufferSize, " LastHardReset: %10u 0x%8.8X", c.lastHardReset(), c.lastHardReset()); + snprintf(line, + kLineBufferSize, + " TriggersPhysicsLost: %20llu %22.3f Hz", + c.triggersPhysicsLost(), + Level1TriggerScalers::rateLS(c.triggersPhysicsLost())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " TriggersPhysicsLostBeamActive: %20llu %22.3f Hz", + c.triggersPhysicsLostBeamActive(), + Level1TriggerScalers::rateLS(c.triggersPhysicsLostBeamActive())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " TriggersPhysicsLostBeamInactive: %20llu %22.3f Hz", + c.triggersPhysicsLostBeamInactive(), + Level1TriggerScalers::rateLS(c.triggersPhysicsLostBeamInactive())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " L1AsPhysics: %20llu %22.3f Hz", + c.l1AsPhysics(), + Level1TriggerScalers::rateLS(c.l1AsPhysics())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " L1AsRandom: %20llu %22.3f Hz", + c.l1AsRandom(), + Level1TriggerScalers::rateLS(c.l1AsRandom())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " L1AsTest: %20llu %22.3f Hz", + c.l1AsTest(), + Level1TriggerScalers::rateLS(c.l1AsTest())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " L1AsCalibration: %20llu %22.3f Hz", + c.l1AsCalibration(), + Level1TriggerScalers::rateLS(c.l1AsCalibration())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " Deadtime: %20llu %17.3f%%", + c.deadtime(), + Level1TriggerScalers::percentLS(c.deadtime())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadtimeBeamActive: %20llu %17.3f%%", + c.deadtimeBeamActive(), + Level1TriggerScalers::percentLSActive(c.deadtimeBeamActive())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadtimeBeamActiveTriggerRules: %20llu %17.3f%%", + c.deadtimeBeamActiveTriggerRules(), + Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveTriggerRules())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadtimeBeamActiveCalibration: %20llu %17.3f%%", + c.deadtimeBeamActiveCalibration(), + Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveCalibration())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadtimeBeamActivePrivateOrbit: %20llu %17.3f%%", + c.deadtimeBeamActivePrivateOrbit(), + Level1TriggerScalers::percentLSActive(c.deadtimeBeamActivePrivateOrbit())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadtimeBeamActivePartitionController:%20llu %17.3f%%", + c.deadtimeBeamActivePartitionController(), + Level1TriggerScalers::percentLSActive(c.deadtimeBeamActivePartitionController())); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " DeadtimeBeamActiveTimeSlot: %20llu %17.3f%%", + c.deadtimeBeamActiveTimeSlot(), + Level1TriggerScalers::percentLSActive(c.deadtimeBeamActiveTimeSlot())); s << line << std::endl; - } - return s; -} + s << "Physics GtAlgoCounts" << std::endl; + const std::vector gtAlgoCounts = c.gtAlgoCounts(); + int length = gtAlgoCounts.size() / 4; + for (int i = 0; i < length; i++) { + snprintf(line, + kLineBufferSize, + " %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u", + i, + gtAlgoCounts[i], + (i + length), + gtAlgoCounts[i + length], + (i + (length * 2)), + gtAlgoCounts[i + (length * 2)], + (i + (length * 3)), + gtAlgoCounts[i + (length * 3)]); + s << line << std::endl; + } + + s << "Test GtTechCounts" << std::endl; + const std::vector gtTechCounts = c.gtTechCounts(); + length = gtTechCounts.size() / 4; + for (int i = 0; i < length; i++) { + snprintf(line, + kLineBufferSize, + " %3.3d: %10u %3.3d: %10u %3.3d: %10u %3.3d: %10u", + i, + gtTechCounts[i], + (i + length), + gtTechCounts[i + length], + (i + (length * 2)), + gtTechCounts[i + (length * 2)], + (i + (length * 3)), + gtTechCounts[i + (length * 3)]); + s << line << std::endl; + } + + if (c.version() >= 5) { + snprintf( + line, kLineBufferSize, " LastOrbitCounter0: %10u 0x%8.8X", c.lastOrbitCounter0(), c.lastOrbitCounter0()); + s << line << std::endl; + + snprintf(line, kLineBufferSize, " LastTestEnable: %10u 0x%8.8X", c.lastTestEnable(), c.lastTestEnable()); + s << line << std::endl; + + snprintf(line, kLineBufferSize, " LastResync: %10u 0x%8.8X", c.lastResync(), c.lastResync()); + s << line << std::endl; + + snprintf(line, kLineBufferSize, " LastStart: %10u 0x%8.8X", c.lastStart(), c.lastStart()); + s << line << std::endl; + + snprintf( + line, kLineBufferSize, " LastEventCounter0: %10u 0x%8.8X", c.lastEventCounter0(), c.lastEventCounter0()); + s << line << std::endl; + + snprintf(line, kLineBufferSize, " LastHardReset: %10u 0x%8.8X", c.lastHardReset(), c.lastHardReset()); + s << line << std::endl; + } + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/Scalers/src/LumiScalers.cc b/DataFormats/Scalers/src/LumiScalers.cc index 70f99787d0824..7f07367476c64 100644 --- a/DataFormats/Scalers/src/LumiScalers.cc +++ b/DataFormats/Scalers/src/LumiScalers.cc @@ -8,228 +8,233 @@ #include #include -LumiScalers::LumiScalers() - : trigType_(0), - eventID_(0), - sourceID_(0), - bunchNumber_(0), - version_(0), - normalization_(0.0), - deadTimeNormalization_(0.0), - lumiFill_(0.0), - lumiRun_(0.0), - liveLumiFill_(0.0), - liveLumiRun_(0.0), - instantLumi_(0.0), - instantLumiErr_(0.0), - instantLumiQlty_(0), - lumiETFill_(0.0), - lumiETRun_(0.0), - liveLumiETFill_(0.0), - liveLumiETRun_(0.0), - instantETLumi_(0.0), - instantETLumiErr_(0.0), - instantETLumiQlty_(0), - lumiOccFill_(nOcc), - lumiOccRun_(nOcc), - liveLumiOccFill_(nOcc), - liveLumiOccRun_(nOcc), - instantOccLumi_(nOcc), - instantOccLumiErr_(nOcc), - instantOccLumiQlty_(nOcc), - lumiNoise_(nOcc), - sectionNumber_(0), - startOrbit_(0), - numOrbits_(0), - pileup_(0.0), - pileupRMS_(0.0), - bunchLumi_(0.0), - spare_(0.0) {} - -LumiScalers::LumiScalers(const unsigned char* rawData) { - LumiScalers(); - - struct ScalersEventRecordRaw_v1 const* raw = reinterpret_cast(rawData); - trigType_ = (raw->header >> 56) & 0xFULL; - eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; - sourceID_ = (raw->header >> 8) & 0x00000FFFULL; - bunchNumber_ = (raw->header >> 20) & 0xFFFULL; - version_ = raw->version; - - struct LumiScalersRaw_v1 const* lumi = nullptr; - - if (version_ >= 1) { - if (version_ <= 2) { - lumi = &(raw->lumi); - } else { - struct ScalersEventRecordRaw_v3 const* raw3 = reinterpret_cast(rawData); - lumi = &(raw3->lumi); - } - collectionTime_.set_tv_sec(static_cast(lumi->collectionTime_sec)); - collectionTime_.set_tv_nsec(lumi->collectionTime_nsec); - deadTimeNormalization_ = lumi->DeadtimeNormalization; - normalization_ = lumi->Normalization; - lumiFill_ = lumi->LumiFill; - lumiRun_ = lumi->LumiRun; - liveLumiFill_ = lumi->LiveLumiFill; - liveLumiRun_ = lumi->LiveLumiRun; - instantLumi_ = lumi->InstantLumi; - instantLumiErr_ = lumi->InstantLumiErr; - instantLumiQlty_ = lumi->InstantLumiQlty; - lumiETFill_ = lumi->LumiETFill; - lumiETRun_ = lumi->LumiETRun; - liveLumiETFill_ = lumi->LiveLumiETFill; - liveLumiETRun_ = lumi->LiveLumiETRun; - instantETLumi_ = lumi->InstantETLumi; - instantETLumiErr_ = lumi->InstantETLumiErr; - instantETLumiQlty_ = lumi->InstantETLumiQlty; - for (int i = 0; i < ScalersRaw::N_LUMI_OCC_v1; i++) { - lumiOccFill_.push_back(lumi->LumiOccFill[i]); - lumiOccRun_.push_back(lumi->LumiOccRun[i]); - liveLumiOccFill_.push_back(lumi->LiveLumiOccFill[i]); - liveLumiOccRun_.push_back(lumi->LiveLumiOccRun[i]); - instantOccLumi_.push_back(lumi->InstantOccLumi[i]); - instantOccLumiErr_.push_back(lumi->InstantOccLumiErr[i]); - instantOccLumiQlty_.push_back(lumi->InstantOccLumiQlty[i]); - lumiNoise_.push_back(lumi->lumiNoise[i]); - } - sectionNumber_ = lumi->sectionNumber; - startOrbit_ = lumi->startOrbit; - numOrbits_ = lumi->numOrbits; - - if (version_ >= 7) { - struct ScalersEventRecordRaw_v6 const* raw6 = (struct ScalersEventRecordRaw_v6 const*)rawData; - float const* fspare = reinterpret_cast(raw6->spare); - pileup_ = fspare[ScalersRaw::I_SPARE_PILEUP_v7]; - pileupRMS_ = fspare[ScalersRaw::I_SPARE_PILEUPRMS_v7]; - if (version_ >= 8) { - bunchLumi_ = fspare[ScalersRaw::I_SPARE_BUNCHLUMI_v8]; - spare_ = fspare[ScalersRaw::I_SPARE_SPARE_v8]; +namespace io_v1 { + LumiScalers::LumiScalers() + : trigType_(0), + eventID_(0), + sourceID_(0), + bunchNumber_(0), + version_(0), + normalization_(0.0), + deadTimeNormalization_(0.0), + lumiFill_(0.0), + lumiRun_(0.0), + liveLumiFill_(0.0), + liveLumiRun_(0.0), + instantLumi_(0.0), + instantLumiErr_(0.0), + instantLumiQlty_(0), + lumiETFill_(0.0), + lumiETRun_(0.0), + liveLumiETFill_(0.0), + liveLumiETRun_(0.0), + instantETLumi_(0.0), + instantETLumiErr_(0.0), + instantETLumiQlty_(0), + lumiOccFill_(nOcc), + lumiOccRun_(nOcc), + liveLumiOccFill_(nOcc), + liveLumiOccRun_(nOcc), + instantOccLumi_(nOcc), + instantOccLumiErr_(nOcc), + instantOccLumiQlty_(nOcc), + lumiNoise_(nOcc), + sectionNumber_(0), + startOrbit_(0), + numOrbits_(0), + pileup_(0.0), + pileupRMS_(0.0), + bunchLumi_(0.0), + spare_(0.0) {} + + LumiScalers::LumiScalers(const unsigned char* rawData) { + LumiScalers(); + + struct ScalersEventRecordRaw_v1 const* raw = reinterpret_cast(rawData); + trigType_ = (raw->header >> 56) & 0xFULL; + eventID_ = (raw->header >> 32) & 0x00FFFFFFULL; + sourceID_ = (raw->header >> 8) & 0x00000FFFULL; + bunchNumber_ = (raw->header >> 20) & 0xFFFULL; + version_ = raw->version; + + struct LumiScalersRaw_v1 const* lumi = nullptr; + + if (version_ >= 1) { + if (version_ <= 2) { + lumi = &(raw->lumi); + } else { + struct ScalersEventRecordRaw_v3 const* raw3 = reinterpret_cast(rawData); + lumi = &(raw3->lumi); + } + collectionTime_.set_tv_sec(static_cast(lumi->collectionTime_sec)); + collectionTime_.set_tv_nsec(lumi->collectionTime_nsec); + deadTimeNormalization_ = lumi->DeadtimeNormalization; + normalization_ = lumi->Normalization; + lumiFill_ = lumi->LumiFill; + lumiRun_ = lumi->LumiRun; + liveLumiFill_ = lumi->LiveLumiFill; + liveLumiRun_ = lumi->LiveLumiRun; + instantLumi_ = lumi->InstantLumi; + instantLumiErr_ = lumi->InstantLumiErr; + instantLumiQlty_ = lumi->InstantLumiQlty; + lumiETFill_ = lumi->LumiETFill; + lumiETRun_ = lumi->LumiETRun; + liveLumiETFill_ = lumi->LiveLumiETFill; + liveLumiETRun_ = lumi->LiveLumiETRun; + instantETLumi_ = lumi->InstantETLumi; + instantETLumiErr_ = lumi->InstantETLumiErr; + instantETLumiQlty_ = lumi->InstantETLumiQlty; + for (int i = 0; i < ScalersRaw::N_LUMI_OCC_v1; i++) { + lumiOccFill_.push_back(lumi->LumiOccFill[i]); + lumiOccRun_.push_back(lumi->LumiOccRun[i]); + liveLumiOccFill_.push_back(lumi->LiveLumiOccFill[i]); + liveLumiOccRun_.push_back(lumi->LiveLumiOccRun[i]); + instantOccLumi_.push_back(lumi->InstantOccLumi[i]); + instantOccLumiErr_.push_back(lumi->InstantOccLumiErr[i]); + instantOccLumiQlty_.push_back(lumi->InstantOccLumiQlty[i]); + lumiNoise_.push_back(lumi->lumiNoise[i]); + } + sectionNumber_ = lumi->sectionNumber; + startOrbit_ = lumi->startOrbit; + numOrbits_ = lumi->numOrbits; + + if (version_ >= 7) { + struct ScalersEventRecordRaw_v6 const* raw6 = (struct ScalersEventRecordRaw_v6 const*)rawData; + float const* fspare = reinterpret_cast(raw6->spare); + pileup_ = fspare[ScalersRaw::I_SPARE_PILEUP_v7]; + pileupRMS_ = fspare[ScalersRaw::I_SPARE_PILEUPRMS_v7]; + if (version_ >= 8) { + bunchLumi_ = fspare[ScalersRaw::I_SPARE_BUNCHLUMI_v8]; + spare_ = fspare[ScalersRaw::I_SPARE_SPARE_v8]; + } else { + bunchLumi_ = (float)0.0; + spare_ = (float)0.0; + } } else { + pileup_ = (float)0.0; + pileupRMS_ = (float)0.0; bunchLumi_ = (float)0.0; spare_ = (float)0.0; } - } else { - pileup_ = (float)0.0; - pileupRMS_ = (float)0.0; - bunchLumi_ = (float)0.0; - spare_ = (float)0.0; } } -} - -LumiScalers::~LumiScalers() {} - -/// Pretty-print operator for LumiScalers -std::ostream& operator<<(std::ostream& s, const LumiScalers& c) { - char zeit[128]; - constexpr size_t kLineBufferSize = 157; - char line[kLineBufferSize]; - struct tm* hora; - - s << "LumiScalers Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl; - - timespec ts = c.collectionTime(); - hora = gmtime(&ts.tv_sec); - strftime(zeit, sizeof(zeit), "%Y.%m.%d %H:%M:%S", hora); - snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " TrigType: %d EventID: %d BunchNumber: %d", - c.trigType(), - c.eventID(), - c.bunchNumber()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " SectionNumber: %10d StartOrbit: %10d NumOrbits: %10d", - c.sectionNumber(), - c.startOrbit(), - c.numOrbits()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " Normalization: %e DeadTimeNormalization: %e", - c.normalization(), - c.deadTimeNormalization()); - s << line << std::endl; - - // Integrated Luminosity - - snprintf(line, kLineBufferSize, " LumiFill: %e LumiRun: %e", c.lumiFill(), c.lumiRun()); - s << line << std::endl; - snprintf( - line, kLineBufferSize, " LiveLumiFill: %e LiveLumiRun: %e", c.liveLumiFill(), c.liveLumiRun()); - s << line << std::endl; - - snprintf(line, kLineBufferSize, " LumiETFill: %e LumiETRun: %e", c.lumiFill(), c.lumiRun()); - s << line << std::endl; - - snprintf( - line, kLineBufferSize, " LiveLumiETFill: %e LiveLumETiRun: %e", c.liveLumiETFill(), c.liveLumiETRun()); - s << line << std::endl; - - int length = c.instantOccLumi().size(); - for (int i = 0; i < length; i++) { + + LumiScalers::~LumiScalers() {} + + /// Pretty-print operator for LumiScalers + std::ostream& operator<<(std::ostream& s, const LumiScalers& c) { + char zeit[128]; + constexpr size_t kLineBufferSize = 157; + char line[kLineBufferSize]; + struct tm* hora; + + s << "LumiScalers Version: " << c.version() << " SourceID: " << c.sourceID() << std::endl; + + timespec ts = c.collectionTime(); + hora = gmtime(&ts.tv_sec); + strftime(zeit, sizeof(zeit), "%Y.%m.%d %H:%M:%S", hora); + snprintf(line, kLineBufferSize, " CollectionTime: %s.%9.9d", zeit, (int)ts.tv_nsec); + s << line << std::endl; + snprintf(line, kLineBufferSize, - " LumiOccFill[%d]: %e LumiOccRun[%d]: %e", - i, - c.lumiOccFill()[i], - i, - c.lumiOccRun()[i]); + " TrigType: %d EventID: %d BunchNumber: %d", + c.trigType(), + c.eventID(), + c.bunchNumber()); s << line << std::endl; snprintf(line, kLineBufferSize, - " LiveLumiOccFill[%d]: %e LiveLumiOccRun[%d]: %e", - i, - c.liveLumiOccFill()[i], - i, - c.liveLumiOccRun()[i]); + " SectionNumber: %10d StartOrbit: %10d NumOrbits: %10d", + c.sectionNumber(), + c.startOrbit(), + c.numOrbits()); s << line << std::endl; - } - // Instantaneous Luminosity - - snprintf(line, - kLineBufferSize, - " InstantLumi: %e Err: %e Qlty: %d", - c.instantLumi(), - c.instantLumiErr(), - c.instantLumiQlty()); - s << line << std::endl; - - snprintf(line, - kLineBufferSize, - " InstantETLumi: %e Err: %e Qlty: %d", - c.instantETLumi(), - c.instantETLumiErr(), - c.instantETLumiQlty()); - s << line << std::endl; - - for (int i = 0; i < length; i++) { snprintf(line, kLineBufferSize, - " InstantOccLumi[%d]: %e Err: %e Qlty: %d", - i, - c.instantOccLumi()[i], - c.instantOccLumiErr()[i], - c.instantOccLumiQlty()[i]); + " Normalization: %e DeadTimeNormalization: %e", + c.normalization(), + c.deadTimeNormalization()); s << line << std::endl; - snprintf(line, kLineBufferSize, " LumiNoise[%d]: %e", i, c.lumiNoise()[i]); + + // Integrated Luminosity + + snprintf(line, kLineBufferSize, " LumiFill: %e LumiRun: %e", c.lumiFill(), c.lumiRun()); s << line << std::endl; - } + snprintf( + line, kLineBufferSize, " LiveLumiFill: %e LiveLumiRun: %e", c.liveLumiFill(), c.liveLumiRun()); + s << line << std::endl; + + snprintf(line, kLineBufferSize, " LumiETFill: %e LumiETRun: %e", c.lumiFill(), c.lumiRun()); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " LiveLumiETFill: %e LiveLumETiRun: %e", + c.liveLumiETFill(), + c.liveLumiETRun()); + s << line << std::endl; + + int length = c.instantOccLumi().size(); + for (int i = 0; i < length; i++) { + snprintf(line, + kLineBufferSize, + " LumiOccFill[%d]: %e LumiOccRun[%d]: %e", + i, + c.lumiOccFill()[i], + i, + c.lumiOccRun()[i]); + s << line << std::endl; + + snprintf(line, + kLineBufferSize, + " LiveLumiOccFill[%d]: %e LiveLumiOccRun[%d]: %e", + i, + c.liveLumiOccFill()[i], + i, + c.liveLumiOccRun()[i]); + s << line << std::endl; + } - snprintf(line, kLineBufferSize, " Pileup: %f PileupRMS: %f", c.pileup(), c.pileupRMS()); - s << line << std::endl; + // Instantaneous Luminosity - snprintf(line, kLineBufferSize, " BunchLumi: %f Spare: %f", c.bunchLumi(), c.spare()); - s << line << std::endl; + snprintf(line, + kLineBufferSize, + " InstantLumi: %e Err: %e Qlty: %d", + c.instantLumi(), + c.instantLumiErr(), + c.instantLumiQlty()); + s << line << std::endl; - return s; -} + snprintf(line, + kLineBufferSize, + " InstantETLumi: %e Err: %e Qlty: %d", + c.instantETLumi(), + c.instantETLumiErr(), + c.instantETLumiQlty()); + s << line << std::endl; + + for (int i = 0; i < length; i++) { + snprintf(line, + kLineBufferSize, + " InstantOccLumi[%d]: %e Err: %e Qlty: %d", + i, + c.instantOccLumi()[i], + c.instantOccLumiErr()[i], + c.instantOccLumiQlty()[i]); + s << line << std::endl; + snprintf(line, kLineBufferSize, " LumiNoise[%d]: %e", i, c.lumiNoise()[i]); + s << line << std::endl; + } + + snprintf(line, kLineBufferSize, " Pileup: %f PileupRMS: %f", c.pileup(), c.pileupRMS()); + s << line << std::endl; + + snprintf(line, kLineBufferSize, " BunchLumi: %f Spare: %f", c.bunchLumi(), c.spare()); + s << line << std::endl; + + return s; + } +} // namespace io_v1 diff --git a/DataFormats/Scalers/src/classes_def.xml b/DataFormats/Scalers/src/classes_def.xml index 867e3769a5e05..bcfb814f74854 100644 --- a/DataFormats/Scalers/src/classes_def.xml +++ b/DataFormats/Scalers/src/classes_def.xml @@ -1,64 +1,61 @@ - - + + - - - + + - - + + - - - + + - - - + + - - + + - - + + - - + + - - + + - - + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - + + + diff --git a/DataFormats/SiPixelCluster/interface/SiPixelCluster.h b/DataFormats/SiPixelCluster/interface/SiPixelCluster.h index 9b65fda266145..fae340f42849f 100644 --- a/DataFormats/SiPixelCluster/interface/SiPixelCluster.h +++ b/DataFormats/SiPixelCluster/interface/SiPixelCluster.h @@ -25,218 +25,223 @@ #include "DataFormats/SiPixelDigi/interface/PixelDigiFwd.h" -class SiPixelCluster { -public: - // FIXME make it POD - class Pixel { +namespace io_v1 { + class SiPixelCluster { public: - constexpr Pixel() : x(0), y(0), adc(0) {} // for root - constexpr Pixel(int pix_x, int pix_y, int pix_adc) : x(pix_x), y(pix_y), adc(pix_adc) {} - uint16_t x; - uint16_t y; - uint16_t adc; - }; + // FIXME make it POD + class Pixel { + public: + constexpr Pixel() : x(0), y(0), adc(0) {} // for root + constexpr Pixel(int pix_x, int pix_y, int pix_adc) : x(pix_x), y(pix_y), adc(pix_adc) {} + uint16_t x; + uint16_t y; + uint16_t adc; + }; + + //--- Integer shift in x and y directions. + // FIXME make it POD + class Shift { + public: + constexpr Shift(int dx, int dy) : dx_(dx), dy_(dy) {} + constexpr Shift() : dx_(0), dy_(0) {} + constexpr int dx() const { return dx_; } + constexpr int dy() const { return dy_; } + + private: + int dx_; + int dy_; + }; + + //--- Position of a SiPixel + // FIXME make it POD + class PixelPos { + public: + constexpr PixelPos() : row_(0), col_(0) {} + constexpr PixelPos(int row, int col) : row_(row), col_(col) {} + constexpr int row() const { return row_; } + constexpr int col() const { return col_; } + constexpr PixelPos operator+(const Shift& shift) const { + return PixelPos(row() + shift.dx(), col() + shift.dy()); + } + constexpr bool operator==(const PixelPos& pos) const { return (row() == pos.row() && col() == pos.col()); } + + private: + int row_; + int col_; + }; + + typedef std::vector::const_iterator PixelDigiIter; + typedef std::pair PixelDigiRange; + + static constexpr unsigned int MAXSPAN = 255; + static constexpr unsigned int MAXPOS = 2047; + + static constexpr uint16_t invalidClusterId = std::numeric_limits::max(); + + /** Construct from a range of digis that form a cluster and from + * a DetID. The range is assumed to be non-empty. + */ - //--- Integer shift in x and y directions. - // FIXME make it POD - class Shift { - public: - constexpr Shift(int dx, int dy) : dx_(dx), dy_(dy) {} - constexpr Shift() : dx_(0), dy_(0) {} - constexpr int dx() const { return dx_; } - constexpr int dy() const { return dy_; } + SiPixelCluster() = default; + ~SiPixelCluster() = default; + SiPixelCluster(SiPixelCluster const&) = default; + SiPixelCluster(SiPixelCluster&&) = default; + SiPixelCluster& operator=(SiPixelCluster const&) = default; + SiPixelCluster& operator=(SiPixelCluster&&) = default; + + SiPixelCluster(unsigned int isize, + uint16_t const* adcs, + uint16_t const* xpos, + uint16_t const* ypos, + uint16_t xmin, + uint16_t ymin, + uint16_t id = invalidClusterId, + bool isSaturated = false) + : thePixelOffset(2 * isize), thePixelADC(adcs, adcs + isize), theOriginalClusterId(id) { + uint16_t maxCol = 0; + uint16_t maxRow = 0; + for (unsigned int i = 0; i < isize; ++i) { + uint16_t xoffset = xpos[i] - xmin; + uint16_t yoffset = ypos[i] - ymin; + thePixelOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset); + thePixelOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset); + if (xoffset > maxRow) + maxRow = xoffset; + if (yoffset > maxCol) + maxCol = yoffset; + } + packRow(xmin, maxRow); + packCol(ymin, maxCol); + isClusterSaturated = isSaturated; + } - private: - int dx_; - int dy_; - }; + // obsolete (only for regression tests) + SiPixelCluster(const PixelPos& pix, int adc); + void add(const PixelPos& pix, int adc); + + // Analog linear average position (barycenter) + float x() const { + float qm = 0.0; + int isize = thePixelADC.size(); + for (int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]) * (thePixelOffset[i * 2] + minPixelRow() + 0.5f); + return qm / charge(); + } - //--- Position of a SiPixel - // FIXME make it POD - class PixelPos { - public: - constexpr PixelPos() : row_(0), col_(0) {} - constexpr PixelPos(int row, int col) : row_(row), col_(col) {} - constexpr int row() const { return row_; } - constexpr int col() const { return col_; } - constexpr PixelPos operator+(const Shift& shift) const { return PixelPos(row() + shift.dx(), col() + shift.dy()); } - constexpr bool operator==(const PixelPos& pos) const { return (row() == pos.row() && col() == pos.col()); } + float y() const { + float qm = 0.0; + int isize = thePixelADC.size(); + for (int i = 0; i < isize; ++i) + qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + minPixelCol() + 0.5f); + return qm / charge(); + } - private: - int row_; - int col_; - }; + // Return number of pixels. + int size() const { return thePixelADC.size(); } + + // Return cluster dimension in the x direction. + int sizeX() const { return rowSpan() + 1; } + + // Return cluster dimension in the y direction. + int sizeY() const { return colSpan() + 1; } + + inline int charge() const { + int qm = 0; + int isize = thePixelADC.size(); + for (int i = 0; i < isize; ++i) + qm += thePixelADC[i]; + return qm; + } // Return total cluster charge. + + inline int minPixelRow() const { return theMinPixelRow; } // The min x index. + inline int maxPixelRow() const { return minPixelRow() + rowSpan(); } // The max x index. + inline int minPixelCol() const { return theMinPixelCol; } // The min y index. + inline int maxPixelCol() const { return minPixelCol() + colSpan(); } // The max y index. + + const std::vector& pixelOffset() const { return thePixelOffset; } + const std::vector& pixelADC() const { return thePixelADC; } + + // obsolete, use single pixel access below + const std::vector pixels() const { + std::vector oldPixVector; + int isize = thePixelADC.size(); + oldPixVector.reserve(isize); + for (int i = 0; i < isize; ++i) { + oldPixVector.push_back(pixel(i)); + } + return oldPixVector; + } - typedef std::vector::const_iterator PixelDigiIter; - typedef std::pair PixelDigiRange; + // infinite faster than above... + Pixel pixel(int i) const { + return Pixel(minPixelRow() + thePixelOffset[i * 2], minPixelCol() + thePixelOffset[i * 2 + 1], thePixelADC[i]); + } - static constexpr unsigned int MAXSPAN = 255; - static constexpr unsigned int MAXPOS = 2047; + private: + static int overflow_(uint16_t span) { return span == uint16_t(MAXSPAN); } - static constexpr uint16_t invalidClusterId = std::numeric_limits::max(); + public: + int colSpan() const { return thePixelColSpan; } - /** Construct from a range of digis that form a cluster and from - * a DetID. The range is assumed to be non-empty. - */ + int rowSpan() const { return thePixelRowSpan; } - SiPixelCluster() = default; - ~SiPixelCluster() = default; - SiPixelCluster(SiPixelCluster const&) = default; - SiPixelCluster(SiPixelCluster&&) = default; - SiPixelCluster& operator=(SiPixelCluster const&) = default; - SiPixelCluster& operator=(SiPixelCluster&&) = default; - - SiPixelCluster(unsigned int isize, - uint16_t const* adcs, - uint16_t const* xpos, - uint16_t const* ypos, - uint16_t xmin, - uint16_t ymin, - uint16_t id = invalidClusterId, - bool isSaturated = false) - : thePixelOffset(2 * isize), thePixelADC(adcs, adcs + isize), theOriginalClusterId(id) { - uint16_t maxCol = 0; - uint16_t maxRow = 0; - for (unsigned int i = 0; i < isize; ++i) { - uint16_t xoffset = xpos[i] - xmin; - uint16_t yoffset = ypos[i] - ymin; - thePixelOffset[i * 2] = std::min(uint16_t(MAXSPAN), xoffset); - thePixelOffset[i * 2 + 1] = std::min(uint16_t(MAXSPAN), yoffset); - if (xoffset > maxRow) - maxRow = xoffset; - if (yoffset > maxCol) - maxCol = yoffset; - } - packRow(xmin, maxRow); - packCol(ymin, maxCol); - isClusterSaturated = isSaturated; - } + bool overflowCol() const { return overflow_(thePixelColSpan); } - // obsolete (only for regression tests) - SiPixelCluster(const PixelPos& pix, int adc); - void add(const PixelPos& pix, int adc); - - // Analog linear average position (barycenter) - float x() const { - float qm = 0.0; - int isize = thePixelADC.size(); - for (int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]) * (thePixelOffset[i * 2] + minPixelRow() + 0.5f); - return qm / charge(); - } + bool overflowRow() const { return overflow_(thePixelRowSpan); } - float y() const { - float qm = 0.0; - int isize = thePixelADC.size(); - for (int i = 0; i < isize; ++i) - qm += float(thePixelADC[i]) * (thePixelOffset[i * 2 + 1] + minPixelCol() + 0.5f); - return qm / charge(); - } + bool overflow() const { return overflowCol() || overflowRow(); } - // Return number of pixels. - int size() const { return thePixelADC.size(); } - - // Return cluster dimension in the x direction. - int sizeX() const { return rowSpan() + 1; } - - // Return cluster dimension in the y direction. - int sizeY() const { return colSpan() + 1; } - - inline int charge() const { - int qm = 0; - int isize = thePixelADC.size(); - for (int i = 0; i < isize; ++i) - qm += thePixelADC[i]; - return qm; - } // Return total cluster charge. - - inline int minPixelRow() const { return theMinPixelRow; } // The min x index. - inline int maxPixelRow() const { return minPixelRow() + rowSpan(); } // The max x index. - inline int minPixelCol() const { return theMinPixelCol; } // The min y index. - inline int maxPixelCol() const { return minPixelCol() + colSpan(); } // The max y index. - - const std::vector& pixelOffset() const { return thePixelOffset; } - const std::vector& pixelADC() const { return thePixelADC; } - - // obsolete, use single pixel access below - const std::vector pixels() const { - std::vector oldPixVector; - int isize = thePixelADC.size(); - oldPixVector.reserve(isize); - for (int i = 0; i < isize; ++i) { - oldPixVector.push_back(pixel(i)); + void packCol(uint16_t ymin, uint16_t yspan) { + theMinPixelCol = ymin; + thePixelColSpan = std::min(yspan, uint16_t(MAXSPAN)); + } + void packRow(uint16_t xmin, uint16_t xspan) { + theMinPixelRow = xmin; + thePixelRowSpan = std::min(xspan, uint16_t(MAXSPAN)); } - return oldPixVector; - } - - // infinite faster than above... - Pixel pixel(int i) const { - return Pixel(minPixelRow() + thePixelOffset[i * 2], minPixelCol() + thePixelOffset[i * 2 + 1], thePixelADC[i]); - } - -private: - static int overflow_(uint16_t span) { return span == uint16_t(MAXSPAN); } -public: - int colSpan() const { return thePixelColSpan; } + // ggiurgiu@fnal.gov, 01/05/12 + // Getters and setters for the newly added data members (err_x and err_y). See below. + void setSplitClusterErrorX(float errx) { err_x = errx; } + void setSplitClusterErrorY(float erry) { err_y = erry; } + float getSplitClusterErrorX() const { return err_x; } + float getSplitClusterErrorY() const { return err_y; } - int rowSpan() const { return thePixelRowSpan; } + // the original id (they get sorted) + auto originalId() const { return theOriginalClusterId; } + void setOriginalId(uint16_t id) { theOriginalClusterId = id; } + bool isSaturated() const { return isClusterSaturated; } - bool overflowCol() const { return overflow_(thePixelColSpan); } + private: + std::vector thePixelOffset; + std::vector thePixelADC; - bool overflowRow() const { return overflow_(thePixelRowSpan); } + uint16_t theMinPixelRow = MAXPOS; // Minimum pixel index in the x direction (low edge). + uint16_t theMinPixelCol = MAXPOS; // Minimum pixel index in the y direction (left edge). + uint8_t thePixelRowSpan = 0; // Span pixel index in the x direction (low edge). + uint8_t thePixelColSpan = 0; // Span pixel index in the y direction (left edge). - bool overflow() const { return overflowCol() || overflowRow(); } + uint16_t theOriginalClusterId = invalidClusterId; + bool isClusterSaturated = false; - void packCol(uint16_t ymin, uint16_t yspan) { - theMinPixelCol = ymin; - thePixelColSpan = std::min(yspan, uint16_t(MAXSPAN)); - } - void packRow(uint16_t xmin, uint16_t xspan) { - theMinPixelRow = xmin; - thePixelRowSpan = std::min(xspan, uint16_t(MAXSPAN)); - } + float err_x = -99999.9f; + float err_y = -99999.9f; + }; - // ggiurgiu@fnal.gov, 01/05/12 - // Getters and setters for the newly added data members (err_x and err_y). See below. - void setSplitClusterErrorX(float errx) { err_x = errx; } - void setSplitClusterErrorY(float erry) { err_y = erry; } - float getSplitClusterErrorX() const { return err_x; } - float getSplitClusterErrorY() const { return err_y; } - - // the original id (they get sorted) - auto originalId() const { return theOriginalClusterId; } - void setOriginalId(uint16_t id) { theOriginalClusterId = id; } - bool isSaturated() const { return isClusterSaturated; } - -private: - std::vector thePixelOffset; - std::vector thePixelADC; - - uint16_t theMinPixelRow = MAXPOS; // Minimum pixel index in the x direction (low edge). - uint16_t theMinPixelCol = MAXPOS; // Minimum pixel index in the y direction (left edge). - uint8_t thePixelRowSpan = 0; // Span pixel index in the x direction (low edge). - uint8_t thePixelColSpan = 0; // Span pixel index in the y direction (left edge). - - uint16_t theOriginalClusterId = invalidClusterId; - bool isClusterSaturated = false; - - float err_x = -99999.9f; - float err_y = -99999.9f; -}; - -// Comparison operators (needed by DetSetVector) -inline bool operator<(const SiPixelCluster& one, const SiPixelCluster& other) { - if (one.minPixelRow() < other.minPixelRow()) { - return true; - } else if (one.minPixelRow() > other.minPixelRow()) { - return false; - } else if (one.minPixelCol() < other.minPixelCol()) { - return true; - } else { - return false; + // Comparison operators (needed by DetSetVector) + inline bool operator<(const SiPixelCluster& one, const SiPixelCluster& other) { + if (one.minPixelRow() < other.minPixelRow()) { + return true; + } else if (one.minPixelRow() > other.minPixelRow()) { + return false; + } else if (one.minPixelCol() < other.minPixelCol()) { + return true; + } else { + return false; + } } -} +} // namespace io_v1 +using SiPixelCluster = io_v1::SiPixelCluster; #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/Common/interface/DetSetVectorNew.h" diff --git a/DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h b/DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h index d0e7c53cb8cf0..212168cac35a6 100644 --- a/DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h +++ b/DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_SiPixelCluster_SiPixelClusterFwd_h #define DataFormats_SiPixelCluster_SiPixelClusterFwd_h -class SiPixelCluster; - +namespace io_v1 { + class SiPixelCluster; +} +using SiPixelCluster = io_v1::SiPixelCluster; #endif diff --git a/DataFormats/SiPixelCluster/src/SiPixelCluster.cc b/DataFormats/SiPixelCluster/src/SiPixelCluster.cc index 6d35e2a5196d8..8e4d07ddb1dd3 100644 --- a/DataFormats/SiPixelCluster/src/SiPixelCluster.cc +++ b/DataFormats/SiPixelCluster/src/SiPixelCluster.cc @@ -14,56 +14,58 @@ //! \author Petar Maksimovic, JHU //--------------------------------------------------------------------------- -SiPixelCluster::SiPixelCluster(const SiPixelCluster::PixelPos& pix, int adc) - : theMinPixelRow(pix.row()), theMinPixelCol(pix.col()) { - // First pixel in this cluster. - thePixelADC.push_back(adc); - thePixelOffset.push_back(0); - thePixelOffset.push_back(0); -} +namespace io_v1 { + SiPixelCluster::SiPixelCluster(const SiPixelCluster::PixelPos& pix, int adc) + : theMinPixelRow(pix.row()), theMinPixelCol(pix.col()) { + // First pixel in this cluster. + thePixelADC.push_back(adc); + thePixelOffset.push_back(0); + thePixelOffset.push_back(0); + } -void SiPixelCluster::add(const SiPixelCluster::PixelPos& pix, int adc) { - int ominRow = minPixelRow(); - int ominCol = minPixelCol(); - bool recalculate = false; + void SiPixelCluster::add(const SiPixelCluster::PixelPos& pix, int adc) { + int ominRow = minPixelRow(); + int ominCol = minPixelCol(); + bool recalculate = false; - int minRow = ominRow; - int minCol = ominCol; + int minRow = ominRow; + int minCol = ominCol; - if (pix.row() < minRow) { - minRow = pix.row(); - recalculate = true; - } - if (pix.col() < minCol) { - minCol = pix.col(); - recalculate = true; - } + if (pix.row() < minRow) { + minRow = pix.row(); + recalculate = true; + } + if (pix.col() < minCol) { + minCol = pix.col(); + recalculate = true; + } - if (recalculate) { - int maxCol = 0; - int maxRow = 0; - int isize = thePixelADC.size(); - for (int i = 0; i < isize; ++i) { - int xoffset = thePixelOffset[i * 2] + ominRow - minRow; - int yoffset = thePixelOffset[i * 2 + 1] + ominCol - minCol; - thePixelOffset[i * 2] = std::min(int(MAXSPAN), xoffset); - thePixelOffset[i * 2 + 1] = std::min(int(MAXSPAN), yoffset); - if (xoffset > maxRow) - maxRow = xoffset; - if (yoffset > maxCol) - maxCol = yoffset; + if (recalculate) { + int maxCol = 0; + int maxRow = 0; + int isize = thePixelADC.size(); + for (int i = 0; i < isize; ++i) { + int xoffset = thePixelOffset[i * 2] + ominRow - minRow; + int yoffset = thePixelOffset[i * 2 + 1] + ominCol - minCol; + thePixelOffset[i * 2] = std::min(int(MAXSPAN), xoffset); + thePixelOffset[i * 2 + 1] = std::min(int(MAXSPAN), yoffset); + if (xoffset > maxRow) + maxRow = xoffset; + if (yoffset > maxCol) + maxCol = yoffset; + } + packRow(minRow, maxRow); + packCol(minCol, maxCol); } - packRow(minRow, maxRow); - packCol(minCol, maxCol); - } - if ((!overflowRow()) && pix.row() > maxPixelRow()) - packRow(minRow, pix.row() - minRow); + if ((!overflowRow()) && pix.row() > maxPixelRow()) + packRow(minRow, pix.row() - minRow); - if ((!overflowCol()) && pix.col() > maxPixelCol()) - packCol(minCol, pix.col() - minCol); + if ((!overflowCol()) && pix.col() > maxPixelCol()) + packCol(minCol, pix.col() - minCol); - thePixelADC.push_back(adc); - thePixelOffset.push_back(std::min(int(MAXSPAN), pix.row() - minRow)); - thePixelOffset.push_back(std::min(int(MAXSPAN), pix.col() - minCol)); -} + thePixelADC.push_back(adc); + thePixelOffset.push_back(std::min(int(MAXSPAN), pix.row() - minRow)); + thePixelOffset.push_back(std::min(int(MAXSPAN), pix.col() - minCol)); + } +} // namespace io_v1 diff --git a/DataFormats/SiPixelCluster/src/classes_def.xml b/DataFormats/SiPixelCluster/src/classes_def.xml index caf4a64e0e795..9f2ad6f09dc66 100644 --- a/DataFormats/SiPixelCluster/src/classes_def.xml +++ b/DataFormats/SiPixelCluster/src/classes_def.xml @@ -1,54 +1,37 @@ - - - - - - + + - - - - - - - - >10;]]> - - - >10;]]> - - - - + + - - + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - + + - - - + + + diff --git a/DataFormats/SiPixelDetId/src/classes_def.xml b/DataFormats/SiPixelDetId/src/classes_def.xml index 82f2116b00eed..aa292b678e91d 100644 --- a/DataFormats/SiPixelDetId/src/classes_def.xml +++ b/DataFormats/SiPixelDetId/src/classes_def.xml @@ -1,11 +1,9 @@ - - - + + - - - + + diff --git a/DataFormats/SiPixelDigi/interface/PixelDigi.h b/DataFormats/SiPixelDigi/interface/PixelDigi.h index af41ca0ce24e7..cca8a5ab5433a 100644 --- a/DataFormats/SiPixelDigi/interface/PixelDigi.h +++ b/DataFormats/SiPixelDigi/interface/PixelDigi.h @@ -11,89 +11,94 @@ * Persistent digi for the Pixels. */ -class PixelDigi { -public: - typedef unsigned int PackedDigiType; - typedef unsigned int ChannelType; +namespace io_v1 { + class PixelDigi { + public: + typedef unsigned int PackedDigiType; + typedef unsigned int ChannelType; - explicit PixelDigi(PackedDigiType packed_value) : theData(packed_value) {} + explicit PixelDigi(PackedDigiType packed_value) : theData(packed_value) {} - PixelDigi(int row, int col, int adc) { init(row, col, adc); } - PixelDigi(int row, int col, int adc, int flag) { init(row, col, adc, flag); } + PixelDigi(int row, int col, int adc) { init(row, col, adc); } + PixelDigi(int row, int col, int adc, int flag) { init(row, col, adc, flag); } - PixelDigi(int chan, int adc) { - std::pair rc = channelToPixel(chan); - init(rc.first, rc.second, adc); - } + PixelDigi(int chan, int adc) { + std::pair rc = channelToPixel(chan); + init(rc.first, rc.second, adc); + } - PixelDigi() : theData(0) {} + PixelDigi() : theData(0) {} - void init(int row, int col, int adc, int flag = 0) { + void init(int row, int col, int adc, int flag = 0) { #ifdef FIXME_DEBUG - // This check is for the maximal row or col number that can be packed - // in a PixelDigi. The actual number of rows or columns in a detector - // may be smaller! - // it is done much better in Raw2Digi... - if (row < 0 || row > PixelChannelIdentifier::thePacking.max_row || col < 0 || - col > PixelChannelIdentifier::thePacking.max_column) { - std::cout << "PixelDigi constructor: row or column out packing range " << row << ' ' << col << std::endl; - } + // This check is for the maximal row or col number that can be packed + // in a PixelDigi. The actual number of rows or columns in a detector + // may be smaller! + // it is done much better in Raw2Digi... + if (row < 0 || row > PixelChannelIdentifier::thePacking.max_row || col < 0 || + col > PixelChannelIdentifier::thePacking.max_column) { + std::cout << "PixelDigi constructor: row or column out packing range " << row << ' ' << col << std::endl; + } #endif - // Set adc to max_adc in case of overflow - adc = (adc > PixelChannelIdentifier::thePacking.max_adc) ? PixelChannelIdentifier::thePacking.max_adc - : std::max(adc, 0); - - theData = (row << PixelChannelIdentifier::thePacking.row_shift) | - (col << PixelChannelIdentifier::thePacking.column_shift) | - (adc << PixelChannelIdentifier::thePacking.adc_shift) | - (flag << PixelChannelIdentifier::thePacking.flag_shift); - } + // Set adc to max_adc in case of overflow + adc = (adc > PixelChannelIdentifier::thePacking.max_adc) ? PixelChannelIdentifier::thePacking.max_adc + : std::max(adc, 0); - // Access to digi information - int row() const { - return (theData >> PixelChannelIdentifier::thePacking.row_shift) & PixelChannelIdentifier::thePacking.row_mask; - } - int column() const { - return (theData >> PixelChannelIdentifier::thePacking.column_shift) & - PixelChannelIdentifier::thePacking.column_mask; - } - int flag() const { - return (theData >> PixelChannelIdentifier::thePacking.flag_shift) & PixelChannelIdentifier::thePacking.flag_mask; - } - unsigned short adc() const { - return (theData >> PixelChannelIdentifier::thePacking.adc_shift) & PixelChannelIdentifier::thePacking.adc_mask; - } - PackedDigiType packedData() const { return theData; } + theData = (row << PixelChannelIdentifier::thePacking.row_shift) | + (col << PixelChannelIdentifier::thePacking.column_shift) | + (adc << PixelChannelIdentifier::thePacking.adc_shift) | + (flag << PixelChannelIdentifier::thePacking.flag_shift); + } - static std::pair channelToPixel(int ch) { - int row = (ch >> PixelChannelIdentifier::thePacking.column_width) & PixelChannelIdentifier::thePacking.row_mask; - int col = ch & PixelChannelIdentifier::thePacking.column_mask; - return std::pair(row, col); - } + // Access to digi information + int row() const { + return (theData >> PixelChannelIdentifier::thePacking.row_shift) & PixelChannelIdentifier::thePacking.row_mask; + } + int column() const { + return (theData >> PixelChannelIdentifier::thePacking.column_shift) & + PixelChannelIdentifier::thePacking.column_mask; + } + int flag() const { + return (theData >> PixelChannelIdentifier::thePacking.flag_shift) & PixelChannelIdentifier::thePacking.flag_mask; + } + unsigned short adc() const { + return (theData >> PixelChannelIdentifier::thePacking.adc_shift) & PixelChannelIdentifier::thePacking.adc_mask; + } + PackedDigiType packedData() const { return theData; } - static int pixelToChannel(int row, int col) { return (row << PixelChannelIdentifier::thePacking.column_width) | col; } + static std::pair channelToPixel(int ch) { + int row = (ch >> PixelChannelIdentifier::thePacking.column_width) & PixelChannelIdentifier::thePacking.row_mask; + int col = ch & PixelChannelIdentifier::thePacking.column_mask; + return std::pair(row, col); + } - int channel() const { return PixelChannelIdentifier::pixelToChannel(row(), column()); } + static int pixelToChannel(int row, int col) { + return (row << PixelChannelIdentifier::thePacking.column_width) | col; + } -private: - PackedDigiType theData; -}; + int channel() const { return PixelChannelIdentifier::pixelToChannel(row(), column()); } -// Comparison operators + private: + PackedDigiType theData; + }; -//inline bool operator<( const PixelDigi& one, const PixelDigi& other) { -// return one.channel() < other.channel(); -//} + // Comparison operators -inline bool operator<(const PixelDigi& one, const PixelDigi& other) { - return (one.packedData() & PixelChannelIdentifier::thePacking.rowcol_mask) < - (other.packedData() & PixelChannelIdentifier::thePacking.rowcol_mask); -} + //inline bool operator<( const PixelDigi& one, const PixelDigi& other) { + // return one.channel() < other.channel(); + //} + inline bool operator<(const PixelDigi& one, const PixelDigi& other) { + return (one.packedData() & PixelChannelIdentifier::thePacking.rowcol_mask) < + (other.packedData() & PixelChannelIdentifier::thePacking.rowcol_mask); + } +} // namespace io_v1 #include -inline std::ostream& operator<<(std::ostream& o, const PixelDigi& digi) { - return o << " " << digi.channel() << " " << digi.adc(); -} - +namespace io_v1 { + inline std::ostream& operator<<(std::ostream& o, const PixelDigi& digi) { + return o << " " << digi.channel() << " " << digi.adc(); + } +} // namespace io_v1 +using PixelDigi = io_v1::PixelDigi; #endif diff --git a/DataFormats/SiPixelDigi/interface/PixelDigiCollection.h b/DataFormats/SiPixelDigi/interface/PixelDigiCollection.h index 64a8af962fa83..1114fec370e83 100644 --- a/DataFormats/SiPixelDigi/interface/PixelDigiCollection.h +++ b/DataFormats/SiPixelDigi/interface/PixelDigiCollection.h @@ -6,23 +6,26 @@ #include #include -class PixelDigiCollection { -public: - typedef std::vector::const_iterator ContainerIterator; - typedef std::pair Range; - typedef std::pair IndexRange; - typedef std::map Registry; - typedef std::map::const_iterator RegistryIterator; +namespace io_v1 { + class PixelDigiCollection { + public: + typedef std::vector::const_iterator ContainerIterator; + typedef std::pair Range; + typedef std::pair IndexRange; + typedef std::map Registry; + typedef std::map::const_iterator RegistryIterator; - PixelDigiCollection() {} + PixelDigiCollection() {} - void put(Range input, unsigned int detID); - const Range get(unsigned int detID) const; - const std::vector detIDs() const; + void put(Range input, unsigned int detID); + const Range get(unsigned int detID) const; + const std::vector detIDs() const; -private: - std::vector container_; - Registry map_; -}; + private: + std::vector container_; + Registry map_; + }; +} // namespace io_v1 +using PixelDigiCollection = io_v1::PixelDigiCollection; #endif // TRACKINGOBJECTS_PIXELDIGICOLLECTION_H diff --git a/DataFormats/SiPixelDigi/interface/PixelDigiFwd.h b/DataFormats/SiPixelDigi/interface/PixelDigiFwd.h index 36896c86c7f9e..2686fde81641b 100644 --- a/DataFormats/SiPixelDigi/interface/PixelDigiFwd.h +++ b/DataFormats/SiPixelDigi/interface/PixelDigiFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_SiPixelDigi_PixelDigiFwd_h #define DataFormats_SiPixelDigi_PixelDigiFwd_h -class PixelDigi; +namespace io_v1 { + class PixelDigi; +} +using PixelDigi = io_v1::PixelDigi; #endif diff --git a/DataFormats/SiPixelDigi/src/PixelDigiCollection.cc b/DataFormats/SiPixelDigi/src/PixelDigiCollection.cc index 7a2b26f180400..87248a3f3c6af 100644 --- a/DataFormats/SiPixelDigi/src/PixelDigiCollection.cc +++ b/DataFormats/SiPixelDigi/src/PixelDigiCollection.cc @@ -2,67 +2,69 @@ #include #include -void PixelDigiCollection::put(Range input, unsigned int detID) { - // put in Digis of detID +namespace io_v1 { + void PixelDigiCollection::put(Range input, unsigned int detID) { + // put in Digis of detID - // store size of vector before put - IndexRange inputRange; + // store size of vector before put + IndexRange inputRange; - // put in PixelDigis from input - bool first = true; + // put in PixelDigis from input + bool first = true; - // fill input in temporary vector for sorting - std::vector temporary; - PixelDigiCollection::ContainerIterator sort_begin = input.first; - PixelDigiCollection::ContainerIterator sort_end = input.second; - for (; sort_begin != sort_end; ++sort_begin) { - temporary.push_back(*sort_begin); - } - std::sort(temporary.begin(), temporary.end()); + // fill input in temporary vector for sorting + std::vector temporary; + PixelDigiCollection::ContainerIterator sort_begin = input.first; + PixelDigiCollection::ContainerIterator sort_end = input.second; + for (; sort_begin != sort_end; ++sort_begin) { + temporary.push_back(*sort_begin); + } + std::sort(temporary.begin(), temporary.end()); - // iterators over input - PixelDigiCollection::ContainerIterator begin = temporary.begin(); - PixelDigiCollection::ContainerIterator end = temporary.end(); - for (; begin != end; ++begin) { - container_.push_back(*begin); - if (first) { - inputRange.first = container_.size() - 1; - first = false; + // iterators over input + PixelDigiCollection::ContainerIterator begin = temporary.begin(); + PixelDigiCollection::ContainerIterator end = temporary.end(); + for (; begin != end; ++begin) { + container_.push_back(*begin); + if (first) { + inputRange.first = container_.size() - 1; + first = false; + } } + inputRange.second = container_.size() - 1; + + // fill map + map_[detID] = inputRange; } - inputRange.second = container_.size() - 1; - // fill map - map_[detID] = inputRange; -} + const PixelDigiCollection::Range PixelDigiCollection::get(unsigned int detID) const { + // get Digis of detID + + auto found = map_.find(detID); + PixelDigiCollection::IndexRange returnIndexRange{}; + if (found != map_.end()) { + returnIndexRange = found->second; + } -const PixelDigiCollection::Range PixelDigiCollection::get(unsigned int detID) const { - // get Digis of detID + PixelDigiCollection::Range returnRange; + returnRange.first = container_.begin() + returnIndexRange.first; + returnRange.second = container_.begin() + returnIndexRange.second + 1; - auto found = map_.find(detID); - PixelDigiCollection::IndexRange returnIndexRange{}; - if (found != map_.end()) { - returnIndexRange = found->second; + return returnRange; } - PixelDigiCollection::Range returnRange; - returnRange.first = container_.begin() + returnIndexRange.first; - returnRange.second = container_.begin() + returnIndexRange.second + 1; - - return returnRange; -} + const std::vector PixelDigiCollection::detIDs() const { + // returns vector of detIDs in map -const std::vector PixelDigiCollection::detIDs() const { - // returns vector of detIDs in map + PixelDigiCollection::RegistryIterator begin = map_.begin(); + PixelDigiCollection::RegistryIterator end = map_.end(); - PixelDigiCollection::RegistryIterator begin = map_.begin(); - PixelDigiCollection::RegistryIterator end = map_.end(); + std::vector output; - std::vector output; + for (; begin != end; ++begin) { + output.push_back(begin->first); + } - for (; begin != end; ++begin) { - output.push_back(begin->first); + return output; } - - return output; -} +} // namespace io_v1 diff --git a/DataFormats/SiPixelDigi/src/classes_def.xml b/DataFormats/SiPixelDigi/src/classes_def.xml index de7779a5c00ea..210b4cb5ce222 100755 --- a/DataFormats/SiPixelDigi/src/classes_def.xml +++ b/DataFormats/SiPixelDigi/src/classes_def.xml @@ -1,28 +1,28 @@ - - + + - - + + - - - - - - - - + + + + + + + + - - + + - - + + - - + + @@ -35,8 +35,8 @@ - - + + diff --git a/DataFormats/SiPixelRawData/src/classes_def.xml b/DataFormats/SiPixelRawData/src/classes_def.xml index 776db710efe3d..344de39be2138 100644 --- a/DataFormats/SiPixelRawData/src/classes_def.xml +++ b/DataFormats/SiPixelRawData/src/classes_def.xml @@ -1,7 +1,6 @@ - - - + + diff --git a/DataFormats/SiStripCluster/src/classes_def.xml b/DataFormats/SiStripCluster/src/classes_def.xml index ceeb869ab8ccf..a58abdf07bb10 100755 --- a/DataFormats/SiStripCluster/src/classes_def.xml +++ b/DataFormats/SiStripCluster/src/classes_def.xml @@ -1,19 +1,9 @@ - - - - - - + + - - initQB();]]> - - - initQB(); } else { firstStrip_ |= SiStripCluster::approximateMask; }]]> - diff --git a/DataFormats/SiStripCommon/src/classes_def.xml b/DataFormats/SiStripCommon/src/classes_def.xml index a73d519113847..e3d4150561ef7 100644 --- a/DataFormats/SiStripCommon/src/classes_def.xml +++ b/DataFormats/SiStripCommon/src/classes_def.xml @@ -1,36 +1,26 @@ - - - - + + - - - - + + - - - - + + - - - - + + - - - + + - - - + + diff --git a/DataFormats/SiStripDetId/src/classes_def.xml b/DataFormats/SiStripDetId/src/classes_def.xml index 42da4209ac84d..891397f4aa18e 100644 --- a/DataFormats/SiStripDetId/src/classes_def.xml +++ b/DataFormats/SiStripDetId/src/classes_def.xml @@ -1,6 +1,5 @@ - - - + + diff --git a/DataFormats/SiStripDigi/src/classes_def.xml b/DataFormats/SiStripDigi/src/classes_def.xml index 3ba0352c0850a..bbd4e1adffa03 100644 --- a/DataFormats/SiStripDigi/src/classes_def.xml +++ b/DataFormats/SiStripDigi/src/classes_def.xml @@ -1,7 +1,7 @@ - - + + @@ -14,9 +14,8 @@ - - - + + @@ -29,9 +28,8 @@ - - - + + diff --git a/DataFormats/Streamer/src/classes_def.xml b/DataFormats/Streamer/src/classes_def.xml index c0bd3ad4ea1f2..3101fa2064e0c 100644 --- a/DataFormats/Streamer/src/classes_def.xml +++ b/DataFormats/Streamer/src/classes_def.xml @@ -1,21 +1,14 @@ - - - - - + + - - - - + + - - - - + + diff --git a/DataFormats/TCDS/interface/TCDSRecord.h b/DataFormats/TCDS/interface/TCDSRecord.h index 8536f763849fa..04125f5d8ab2d 100644 --- a/DataFormats/TCDS/interface/TCDSRecord.h +++ b/DataFormats/TCDS/interface/TCDSRecord.h @@ -16,150 +16,152 @@ #include "DataFormats/TCDS/interface/BSTRecord.h" #include "DataFormats/TCDS/interface/L1aInfo.h" -class TCDSRecord { -public: - enum BGo { - LumiNibble = 0, - BC0 = 1, - TestEnable = 2, - PrivateGap = 3, - PrivateOrbit = 4, - Resync = 5, - HardReset = 6, - EC0 = 7, - OC0 = 8, - Start = 9, - Stop = 10, - StartOfGap = 11, - WarningTestEnable = 13 - }; - - enum BSTstatus { - Unknown = 0x00000000, - Reset = 0x0000dead, - Unlocked = 0xfa11010c, - NoData = 0xfa110acc, - Okay = 0x0000bea0 - }; - - TCDSRecord(); - TCDSRecord(const unsigned char* rawData); - virtual ~TCDSRecord(); - - // MAC address of the CPM - uint64_t getMacAddress() const { return macAddress_; } - - // Software version of TCDS s/w - uint32_t getSwVersion() const { return swVersion_; } - - // Firmware version of the CPM - uint32_t getFwVersion() const { return fwVersion_; } - - // Version of the TCDS record - uint32_t getRecordVersion() const { return recordVersion_; } - - // Run number - uint32_t getRunNumber() const { return runNumber_; } - - // Lumi section number - uint32_t getLumiSection() const { return lumiSection_; } - - // Lumi nibble number - uint32_t getNibble() const { return nibble_; } - - // Number of nibbles per lumi section - uint16_t getNibblesPerLumiSection() const { return nibblesPerLumiSection_; } - - // The event type corresponding to edm::EventAuxiliary::ExperimentType - uint16_t getEventType() const { return eventType_; } - - // The trigger word contains sixteen boolean flags corresponding to the sixteen trigger types - // (see https://twiki.cern.ch/twiki/bin/view/CMS/TcdsEventRecord#TCDS_Event_Trigger_Type_Definiti) - // If a given trigger type fired for this event, the corresponding flag will be true. - uint16_t getTriggerTypeFlags() const { return triggerTypeFlags_; } - - // Input state at Triggered BX +/- 3, currently zeros - uint16_t getInputs() const { return inputs_; } +namespace io_v1 { + class TCDSRecord { + public: + enum BGo { + LumiNibble = 0, + BC0 = 1, + TestEnable = 2, + PrivateGap = 3, + PrivateOrbit = 4, + Resync = 5, + HardReset = 6, + EC0 = 7, + OC0 = 8, + Start = 9, + Stop = 10, + StartOfGap = 11, + WarningTestEnable = 13 + }; - // Bunch-crossing identified - uint16_t getBXID() const { return bxid_; } + enum BSTstatus { + Unknown = 0x00000000, + Reset = 0x0000dead, + Unlocked = 0xfa11010c, + NoData = 0xfa110acc, + Okay = 0x0000bea0 + }; + + TCDSRecord(); + TCDSRecord(const unsigned char* rawData); + virtual ~TCDSRecord(); + + // MAC address of the CPM + uint64_t getMacAddress() const { return macAddress_; } + + // Software version of TCDS s/w + uint32_t getSwVersion() const { return swVersion_; } + + // Firmware version of the CPM + uint32_t getFwVersion() const { return fwVersion_; } + + // Version of the TCDS record + uint32_t getRecordVersion() const { return recordVersion_; } + + // Run number + uint32_t getRunNumber() const { return runNumber_; } + + // Lumi section number + uint32_t getLumiSection() const { return lumiSection_; } + + // Lumi nibble number + uint32_t getNibble() const { return nibble_; } + + // Number of nibbles per lumi section + uint16_t getNibblesPerLumiSection() const { return nibblesPerLumiSection_; } + + // The event type corresponding to edm::EventAuxiliary::ExperimentType + uint16_t getEventType() const { return eventType_; } + + // The trigger word contains sixteen boolean flags corresponding to the sixteen trigger types + // (see https://twiki.cern.ch/twiki/bin/view/CMS/TcdsEventRecord#TCDS_Event_Trigger_Type_Definiti) + // If a given trigger type fired for this event, the corresponding flag will be true. + uint16_t getTriggerTypeFlags() const { return triggerTypeFlags_; } + + // Input state at Triggered BX +/- 3, currently zeros + uint16_t getInputs() const { return inputs_; } + + // Bunch-crossing identified + uint16_t getBXID() const { return bxid_; } + + // Orbit number + uint64_t getOrbitNr() const { return orbitNr_; } + + // Number of triggers since last EC0 + uint64_t getTriggerCount() const { return triggerCount_; } + + // Number of events since start of the run (last OC0) + uint64_t getEventNumber() const { return eventNumber_; } + + // BST reception status corresponding to TCDSRecord::BSTstatus + uint32_t getBstReceptionStatus() const { return bstReceptionStatus_; } + + // The BST message as received from the LHC + const BSTRecord& getBST() const { return bst_; } + + // Source FED ID + uint16_t getSourceID() const { return sourceid_; } + + // List of active paritions, currently not implemented + typedef std::bitset<96> ActivePartitions; + ActivePartitions getActivePartitions() const { return activePartitions_; } + + // History of recent L1 accepts + typedef std::vector L1aHistory; + const L1aHistory& getFullL1aHistory() const { return l1aHistory_; } + const L1aInfo& getL1aHistoryEntry(const uint8_t entry) const { return l1aHistory_.at(entry); } + + // Orbit number when the given Bgo was sent last + uint32_t getOrbitOfLastBgo(const uint16_t bgo) const { return lastBgos_.at(bgo); } + + // Orbit number of last OC0 + uint32_t getLastOrbitCounter0() const { return lastBgos_.at(BGo::OC0); } + + // Orbit number of last Test Enable + uint32_t getLastTestEnable() const { return lastBgos_.at(BGo::TestEnable); } + + // Orbit number of last Resync + uint32_t getLastResync() const { return lastBgos_.at(BGo::Resync); } - // Orbit number - uint64_t getOrbitNr() const { return orbitNr_; } + // Orbit number of last Start + uint32_t getLastStart() const { return lastBgos_.at(BGo::Start); } - // Number of triggers since last EC0 - uint64_t getTriggerCount() const { return triggerCount_; } + // Orbit number of last EC0 + uint32_t getLastEventCounter0() const { return lastBgos_.at(BGo::EC0); } - // Number of events since start of the run (last OC0) - uint64_t getEventNumber() const { return eventNumber_; } + // Orbit number of last Hard Reset + uint32_t getLastHardReset() const { return lastBgos_.at(BGo::HardReset); } - // BST reception status corresponding to TCDSRecord::BSTstatus - uint32_t getBstReceptionStatus() const { return bstReceptionStatus_; } + private: + uint64_t orbitNr_; + uint64_t triggerCount_; + uint64_t eventNumber_; + uint64_t macAddress_; + uint32_t swVersion_; + uint32_t fwVersion_; + uint32_t recordVersion_; + uint32_t runNumber_; + uint32_t bstReceptionStatus_; + uint32_t nibble_; + uint32_t lumiSection_; + uint16_t nibblesPerLumiSection_; + uint16_t eventType_; + uint16_t triggerTypeFlags_; + uint16_t inputs_; + uint16_t bxid_; + uint16_t sourceid_; - // The BST message as received from the LHC - const BSTRecord& getBST() const { return bst_; } + ActivePartitions activePartitions_; + L1aHistory l1aHistory_; - // Source FED ID - uint16_t getSourceID() const { return sourceid_; } + BSTRecord bst_; - // List of active paritions, currently not implemented - typedef std::bitset<96> ActivePartitions; - ActivePartitions getActivePartitions() const { return activePartitions_; } - - // History of recent L1 accepts - typedef std::vector L1aHistory; - const L1aHistory& getFullL1aHistory() const { return l1aHistory_; } - const L1aInfo& getL1aHistoryEntry(const uint8_t entry) const { return l1aHistory_.at(entry); } - - // Orbit number when the given Bgo was sent last - uint32_t getOrbitOfLastBgo(const uint16_t bgo) const { return lastBgos_.at(bgo); } - - // Orbit number of last OC0 - uint32_t getLastOrbitCounter0() const { return lastBgos_.at(BGo::OC0); } - - // Orbit number of last Test Enable - uint32_t getLastTestEnable() const { return lastBgos_.at(BGo::TestEnable); } - - // Orbit number of last Resync - uint32_t getLastResync() const { return lastBgos_.at(BGo::Resync); } - - // Orbit number of last Start - uint32_t getLastStart() const { return lastBgos_.at(BGo::Start); } - - // Orbit number of last EC0 - uint32_t getLastEventCounter0() const { return lastBgos_.at(BGo::EC0); } - - // Orbit number of last Hard Reset - uint32_t getLastHardReset() const { return lastBgos_.at(BGo::HardReset); } - -private: - uint64_t orbitNr_; - uint64_t triggerCount_; - uint64_t eventNumber_; - uint64_t macAddress_; - uint32_t swVersion_; - uint32_t fwVersion_; - uint32_t recordVersion_; - uint32_t runNumber_; - uint32_t bstReceptionStatus_; - uint32_t nibble_; - uint32_t lumiSection_; - uint16_t nibblesPerLumiSection_; - uint16_t eventType_; - uint16_t triggerTypeFlags_; - uint16_t inputs_; - uint16_t bxid_; - uint16_t sourceid_; - - ActivePartitions activePartitions_; - L1aHistory l1aHistory_; - - BSTRecord bst_; - - std::vector lastBgos_; -}; - -/// Pretty-print operator for TCDSRecord -std::ostream& operator<<(std::ostream&, const TCDSRecord&); + std::vector lastBgos_; + }; + /// Pretty-print operator for TCDSRecord + std::ostream& operator<<(std::ostream&, const TCDSRecord&); +} // namespace io_v1 +using TCDSRecord = io_v1::TCDSRecord; #endif // DATAFORMATS_TCDS_TCDSRECORD_H diff --git a/DataFormats/TCDS/interface/TCDSRecordFwd.h b/DataFormats/TCDS/interface/TCDSRecordFwd.h index 114925480f6aa..a9c271676206e 100644 --- a/DataFormats/TCDS/interface/TCDSRecordFwd.h +++ b/DataFormats/TCDS/interface/TCDSRecordFwd.h @@ -1,6 +1,9 @@ #ifndef DataFormats_TCDS_TCDSRecordFwd_h #define DataFormats_TCDS_TCDSRecordFwd_h -class TCDSRecord; +namespace io_v1 { + class TCDSRecord; +} +using TCDSRecord = io_v1::TCDSRecord; #endif diff --git a/DataFormats/TCDS/src/TCDSRecord.cc b/DataFormats/TCDS/src/TCDSRecord.cc index 08ef8c5afc3c2..73e0e5a2f33a7 100644 --- a/DataFormats/TCDS/src/TCDSRecord.cc +++ b/DataFormats/TCDS/src/TCDSRecord.cc @@ -4,100 +4,102 @@ #include "DataFormats/TCDS/interface/TCDSRecord.h" #include "DataFormats/TCDS/interface/TCDSRaw.h" -TCDSRecord::TCDSRecord() - : orbitNr_(0), - triggerCount_(0), - eventNumber_(0), - macAddress_(0), - swVersion_(0), - fwVersion_(0), - recordVersion_(0), - runNumber_(0), - bstReceptionStatus_(0), - nibble_(0), - lumiSection_(0), - nibblesPerLumiSection_(0), - eventType_(0), - triggerTypeFlags_(0), - inputs_(0), - bxid_(0), - sourceid_(0) {} +namespace io_v1 { + TCDSRecord::TCDSRecord() + : orbitNr_(0), + triggerCount_(0), + eventNumber_(0), + macAddress_(0), + swVersion_(0), + fwVersion_(0), + recordVersion_(0), + runNumber_(0), + bstReceptionStatus_(0), + nibble_(0), + lumiSection_(0), + nibblesPerLumiSection_(0), + eventType_(0), + triggerTypeFlags_(0), + inputs_(0), + bxid_(0), + sourceid_(0) {} -TCDSRecord::TCDSRecord(const unsigned char* rawData) { - tcds::Raw_v1 const* tcdsRaw = reinterpret_cast(rawData + FEDHeader::length); - const FEDHeader fedHeader(rawData); + TCDSRecord::TCDSRecord(const unsigned char* rawData) { + tcds::Raw_v1 const* tcdsRaw = reinterpret_cast(rawData + FEDHeader::length); + const FEDHeader fedHeader(rawData); - orbitNr_ = (tcdsRaw->header.orbitHigh << 16) | tcdsRaw->header.orbitLow; - triggerCount_ = tcdsRaw->header.triggerCount; - eventNumber_ = tcdsRaw->header.eventNumber; - macAddress_ = tcdsRaw->header.macAddress; - swVersion_ = tcdsRaw->header.swVersion; - fwVersion_ = tcdsRaw->header.fwVersion; - recordVersion_ = tcdsRaw->header.recordVersion; - runNumber_ = tcdsRaw->header.runNumber; - bstReceptionStatus_ = tcdsRaw->header.bstReceptionStatus; - nibble_ = tcdsRaw->header.nibble; - lumiSection_ = tcdsRaw->header.lumiSection; - nibblesPerLumiSection_ = tcdsRaw->header.nibblesPerLumiSection; - eventType_ = fedHeader.triggerType(); - triggerTypeFlags_ = tcdsRaw->header.triggerTypeFlags; - inputs_ = tcdsRaw->header.inputs; - bxid_ = tcdsRaw->header.bxid; - sourceid_ = fedHeader.sourceID(); + orbitNr_ = (tcdsRaw->header.orbitHigh << 16) | tcdsRaw->header.orbitLow; + triggerCount_ = tcdsRaw->header.triggerCount; + eventNumber_ = tcdsRaw->header.eventNumber; + macAddress_ = tcdsRaw->header.macAddress; + swVersion_ = tcdsRaw->header.swVersion; + fwVersion_ = tcdsRaw->header.fwVersion; + recordVersion_ = tcdsRaw->header.recordVersion; + runNumber_ = tcdsRaw->header.runNumber; + bstReceptionStatus_ = tcdsRaw->header.bstReceptionStatus; + nibble_ = tcdsRaw->header.nibble; + lumiSection_ = tcdsRaw->header.lumiSection; + nibblesPerLumiSection_ = tcdsRaw->header.nibblesPerLumiSection; + eventType_ = fedHeader.triggerType(); + triggerTypeFlags_ = tcdsRaw->header.triggerTypeFlags; + inputs_ = tcdsRaw->header.inputs; + bxid_ = tcdsRaw->header.bxid; + sourceid_ = fedHeader.sourceID(); - activePartitions_ = ActivePartitions(tcdsRaw->header.activePartitions0); - activePartitions_ |= ActivePartitions(tcdsRaw->header.activePartitions1) << 32; - activePartitions_ |= ActivePartitions(tcdsRaw->header.activePartitions2) << 64; + activePartitions_ = ActivePartitions(tcdsRaw->header.activePartitions0); + activePartitions_ |= ActivePartitions(tcdsRaw->header.activePartitions1) << 32; + activePartitions_ |= ActivePartitions(tcdsRaw->header.activePartitions2) << 64; - bst_ = BSTRecord(tcdsRaw->bst); + bst_ = BSTRecord(tcdsRaw->bst); - for (auto i = 0; i < tcds::l1aHistoryDepth_v1; ++i) { - l1aHistory_.emplace_back(L1aInfo(tcdsRaw->l1aHistory.l1aInfo[i])); - } + for (auto i = 0; i < tcds::l1aHistoryDepth_v1; ++i) { + l1aHistory_.emplace_back(L1aInfo(tcdsRaw->l1aHistory.l1aInfo[i])); + } - for (auto i = 0; i < tcds::bgoCount_v1; ++i) { - lastBgos_.emplace_back(((uint64_t)(tcdsRaw->bgoHistory.lastBGo[i].orbithigh) << 32) | - tcdsRaw->bgoHistory.lastBGo[i].orbitlow); + for (auto i = 0; i < tcds::bgoCount_v1; ++i) { + lastBgos_.emplace_back(((uint64_t)(tcdsRaw->bgoHistory.lastBGo[i].orbithigh) << 32) | + tcdsRaw->bgoHistory.lastBGo[i].orbitlow); + } } -} -TCDSRecord::~TCDSRecord() {} + TCDSRecord::~TCDSRecord() {} -std::ostream& operator<<(std::ostream& s, const TCDSRecord& record) { - s << "MacAddress: 0x" << std::hex << record.getMacAddress() << std::dec << std::endl; - s << "SwVersion: 0x" << std::hex << record.getSwVersion() << std::dec << std::endl; - s << "FwVersion: 0x" << std::hex << record.getFwVersion() << std::dec << std::endl; - s << "RecordVersion: " << record.getRecordVersion() << std::endl; - s << "RunNumber: " << record.getRunNumber() << std::endl; - s << "BstReceptionStatus: 0x" << std::hex << record.getBstReceptionStatus() << std::dec << std::endl; - s << "Nibble: " << record.getNibble() << std::endl; - s << "LumiSection: " << record.getLumiSection() << std::endl; - s << "NibblesPerLumiSection: " << record.getNibblesPerLumiSection() << std::endl; - s << "EventType: " << record.getEventType() << std::endl; - s << "TriggerTypeFlags: 0x" << std::hex << record.getTriggerTypeFlags() << std::dec << std::endl; - s << "Inputs: " << record.getInputs() << std::endl; - s << "OrbitNr: " << record.getOrbitNr() << std::endl; - s << "BXID: " << record.getBXID() << std::endl; - s << "TriggerCount: " << record.getTriggerCount() << std::endl; - s << "EventNumber: " << record.getEventNumber() << std::endl; - s << "ActivePartitions: " << record.getActivePartitions() << std::endl; - s << std::endl; + std::ostream& operator<<(std::ostream& s, const TCDSRecord& record) { + s << "MacAddress: 0x" << std::hex << record.getMacAddress() << std::dec << std::endl; + s << "SwVersion: 0x" << std::hex << record.getSwVersion() << std::dec << std::endl; + s << "FwVersion: 0x" << std::hex << record.getFwVersion() << std::dec << std::endl; + s << "RecordVersion: " << record.getRecordVersion() << std::endl; + s << "RunNumber: " << record.getRunNumber() << std::endl; + s << "BstReceptionStatus: 0x" << std::hex << record.getBstReceptionStatus() << std::dec << std::endl; + s << "Nibble: " << record.getNibble() << std::endl; + s << "LumiSection: " << record.getLumiSection() << std::endl; + s << "NibblesPerLumiSection: " << record.getNibblesPerLumiSection() << std::endl; + s << "EventType: " << record.getEventType() << std::endl; + s << "TriggerTypeFlags: 0x" << std::hex << record.getTriggerTypeFlags() << std::dec << std::endl; + s << "Inputs: " << record.getInputs() << std::endl; + s << "OrbitNr: " << record.getOrbitNr() << std::endl; + s << "BXID: " << record.getBXID() << std::endl; + s << "TriggerCount: " << record.getTriggerCount() << std::endl; + s << "EventNumber: " << record.getEventNumber() << std::endl; + s << "ActivePartitions: " << record.getActivePartitions() << std::endl; + s << std::endl; - s << "L1aHistory:" << std::endl; - for (auto l1Info : record.getFullL1aHistory()) - s << l1Info; - s << std::endl; + s << "L1aHistory:" << std::endl; + for (auto l1Info : record.getFullL1aHistory()) + s << l1Info; + s << std::endl; - s << record.getBST() << std::endl; - s << "LastOrbitCounter0: " << record.getLastOrbitCounter0() << std::endl; - s << "LastTestEnable: " << record.getLastTestEnable() << std::endl; - s << "LastResync: " << record.getLastResync() << std::endl; - s << "LastStart: " << record.getLastStart() << std::endl; - s << "LastEventCounter0: " << record.getLastEventCounter0() << std::endl; - s << "LastHardReset: " << record.getLastHardReset() << std::endl; + s << record.getBST() << std::endl; + s << "LastOrbitCounter0: " << record.getLastOrbitCounter0() << std::endl; + s << "LastTestEnable: " << record.getLastTestEnable() << std::endl; + s << "LastResync: " << record.getLastResync() << std::endl; + s << "LastStart: " << record.getLastStart() << std::endl; + s << "LastEventCounter0: " << record.getLastEventCounter0() << std::endl; + s << "LastHardReset: " << record.getLastHardReset() << std::endl; - for (auto i = 0; i < tcds::bgoCount_v1; ++i) - s << "Last BGo " << std::setw(2) << i << ": " << record.getOrbitOfLastBgo(i) << std::endl; + for (auto i = 0; i < tcds::bgoCount_v1; ++i) + s << "Last BGo " << std::setw(2) << i << ": " << record.getOrbitOfLastBgo(i) << std::endl; - return s; -} + return s; + } +} // namespace io_v1 diff --git a/DataFormats/TCDS/src/classes_def.xml b/DataFormats/TCDS/src/classes_def.xml index 01f0ec37efcf4..16e1283a17fb7 100644 --- a/DataFormats/TCDS/src/classes_def.xml +++ b/DataFormats/TCDS/src/classes_def.xml @@ -4,17 +4,16 @@ - - + + - - - + + - + - + diff --git a/DataFormats/TauReco/interface/BaseTau.h b/DataFormats/TauReco/interface/BaseTau.h index 12bb6bbc4f8e3..8d6d4b4652cd3 100644 --- a/DataFormats/TauReco/interface/BaseTau.h +++ b/DataFormats/TauReco/interface/BaseTau.h @@ -15,35 +15,38 @@ #include namespace reco { - class BaseTau : public RecoCandidate { - public: - BaseTau(); - BaseTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0)); - ~BaseTau() override {} - BaseTau* clone() const override; - - // rec. jet Lorentz-vector combining (Tracks and neutral ECAL Island BasicClusters) or (charged hadr. PFCandidates and gamma PFCandidates) - math::XYZTLorentzVector alternatLorentzVect() const; - void setalternatLorentzVect(const math::XYZTLorentzVector&); - - // leading Track - virtual reco::TrackRef leadTrack() const; - void setleadTrack(const TrackRef&); - - // Tracks which passed quality cuts and are inside a tracker signal cone around leading Track - virtual const reco::TrackRefVector& signalTracks() const; - void setsignalTracks(const TrackRefVector&); - - // Tracks which passed quality cuts and are inside a tracker isolation annulus around leading Track - virtual const reco::TrackRefVector& isolationTracks() const; - void setisolationTracks(const TrackRefVector&); - - private: - // check overlap with another candidate - bool overlap(const Candidate&) const override; - math::XYZTLorentzVector alternatLorentzVect_; - reco::TrackRef leadTrack_; - reco::TrackRefVector signalTracks_, isolationTracks_; - }; + namespace io_v1 { + class BaseTau : public RecoCandidate { + public: + BaseTau(); + BaseTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0)); + ~BaseTau() override {} + BaseTau* clone() const override; + + // rec. jet Lorentz-vector combining (Tracks and neutral ECAL Island BasicClusters) or (charged hadr. PFCandidates and gamma PFCandidates) + math::XYZTLorentzVector alternatLorentzVect() const; + void setalternatLorentzVect(const math::XYZTLorentzVector&); + + // leading Track + virtual reco::TrackRef leadTrack() const; + void setleadTrack(const TrackRef&); + + // Tracks which passed quality cuts and are inside a tracker signal cone around leading Track + virtual const reco::TrackRefVector& signalTracks() const; + void setsignalTracks(const TrackRefVector&); + + // Tracks which passed quality cuts and are inside a tracker isolation annulus around leading Track + virtual const reco::TrackRefVector& isolationTracks() const; + void setisolationTracks(const TrackRefVector&); + + private: + // check overlap with another candidate + bool overlap(const Candidate&) const override; + math::XYZTLorentzVector alternatLorentzVect_; + reco::TrackRef leadTrack_; + reco::TrackRefVector signalTracks_, isolationTracks_; + }; + } // namespace io_v1 + using BaseTau = io_v1::BaseTau; } // namespace reco #endif diff --git a/DataFormats/TauReco/interface/BaseTauFwd.h b/DataFormats/TauReco/interface/BaseTauFwd.h index 1fb4713c873ae..bc4687131ef4a 100644 --- a/DataFormats/TauReco/interface/BaseTauFwd.h +++ b/DataFormats/TauReco/interface/BaseTauFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class BaseTau; + namespace io_v1 { + class BaseTau; + } + using BaseTau = io_v1::BaseTau; /// collection of BaseTau objects typedef std::vector BaseTauCollection; /// presistent reference to a BaseTau diff --git a/DataFormats/TauReco/interface/PFRecoTauChargedHadron.h b/DataFormats/TauReco/interface/PFRecoTauChargedHadron.h index 7dae4001327da..21f3889eb7bf5 100644 --- a/DataFormats/TauReco/interface/PFRecoTauChargedHadron.h +++ b/DataFormats/TauReco/interface/PFRecoTauChargedHadron.h @@ -19,78 +19,82 @@ namespace reco { class PFRecoTauChargedHadronProducer; namespace reco { + namespace io_v1 { - class PFRecoTauChargedHadron : public CompositePtrCandidate { - public: - typedef edm::Ptr TrackPtr; + class PFRecoTauChargedHadron : public CompositePtrCandidate { + public: + typedef edm::Ptr TrackPtr; - enum PFRecoTauChargedHadronAlgorithm { - // Algorithm where each photon becomes a pi zero - kUndefined = 0, - kChargedPFCandidate = 1, - kTrack = 2, - kPFNeutralHadron = 3 - }; + enum PFRecoTauChargedHadronAlgorithm { + // Algorithm where each photon becomes a pi zero + kUndefined = 0, + kChargedPFCandidate = 1, + kTrack = 2, + kPFNeutralHadron = 3 + }; - PFRecoTauChargedHadron(); - PFRecoTauChargedHadron(PFRecoTauChargedHadronAlgorithm algo, Charge q); + PFRecoTauChargedHadron(); + PFRecoTauChargedHadron(PFRecoTauChargedHadronAlgorithm algo, Charge q); - /// constructor from a Candidate - PFRecoTauChargedHadron(const Candidate& c, PFRecoTauChargedHadronAlgorithm algo = kUndefined); + /// constructor from a Candidate + PFRecoTauChargedHadron(const Candidate& c, PFRecoTauChargedHadronAlgorithm algo = kUndefined); - /// constructor from values - PFRecoTauChargedHadron(Charge q, - const LorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int status = 0, - bool integerCharge = true, - PFRecoTauChargedHadronAlgorithm algo = kUndefined); + /// constructor from values + PFRecoTauChargedHadron(Charge q, + const LorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int status = 0, + bool integerCharge = true, + PFRecoTauChargedHadronAlgorithm algo = kUndefined); - /// destructor - ~PFRecoTauChargedHadron() override; + /// destructor + ~PFRecoTauChargedHadron() override; - /// reference to "charged" PFCandidate (either charged PFCandidate or PFNeutralHadron) - const CandidatePtr& getChargedPFCandidate() const; + /// reference to "charged" PFCandidate (either charged PFCandidate or PFNeutralHadron) + const CandidatePtr& getChargedPFCandidate() const; - /// reference to reco::Track - const TrackPtr& getTrack() const; + /// reference to reco::Track + const TrackPtr& getTrack() const; - /// reference to "lostTrack Candidate" when chadron built with tracks stored as pat::PackedCandidates - const CandidatePtr& getLostTrackCandidate() const; + /// reference to "lostTrack Candidate" when chadron built with tracks stored as pat::PackedCandidates + const CandidatePtr& getLostTrackCandidate() const; - /// references to additional neutral PFCandidates - const std::vector& getNeutralPFCandidates() const; + /// references to additional neutral PFCandidates + const std::vector& getNeutralPFCandidates() const; - /// position at ECAL entrance - const math::XYZPointF& positionAtECALEntrance() const; + /// position at ECAL entrance + const math::XYZPointF& positionAtECALEntrance() const; - /// Algorithm that built this charged hadron - PFRecoTauChargedHadronAlgorithm algo() const; + /// Algorithm that built this charged hadron + PFRecoTauChargedHadronAlgorithm algo() const; - /// Check whether a given algo produced this charged hadron - bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const; + /// Check whether a given algo produced this charged hadron + bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const; - void print(std::ostream& stream = std::cout) const; + void print(std::ostream& stream = std::cout) const; - private: - friend class tau::PFRecoTauChargedHadronFromPFCandidatePlugin; - template - friend class tau::PFRecoTauChargedHadronFromGenericTrackPlugin; - friend class tau::RecoTauConstructor; - friend class tau::PFRecoTauEnergyAlgorithmPlugin; - friend class ::PFRecoTauChargedHadronProducer; + private: + friend class tau::PFRecoTauChargedHadronFromPFCandidatePlugin; + template + friend class tau::PFRecoTauChargedHadronFromGenericTrackPlugin; + friend class tau::RecoTauConstructor; + friend class tau::PFRecoTauEnergyAlgorithmPlugin; + friend class ::PFRecoTauChargedHadronProducer; - PFRecoTauChargedHadronAlgorithm algo_; + PFRecoTauChargedHadronAlgorithm algo_; - CandidatePtr chargedPFCandidate_; - CandidatePtr lostTrackCandidate_; - TrackPtr track_; - std::vector neutralPFCandidates_; + CandidatePtr chargedPFCandidate_; + CandidatePtr lostTrackCandidate_; + TrackPtr track_; + std::vector neutralPFCandidates_; + + math::XYZPointF positionAtECALEntrance_; + }; - math::XYZPointF positionAtECALEntrance_; - }; + std::ostream& operator<<(std::ostream& stream, const PFRecoTauChargedHadron& c); - std::ostream& operator<<(std::ostream& stream, const PFRecoTauChargedHadron& c); + } // namespace io_v1 + using PFRecoTauChargedHadron = io_v1::PFRecoTauChargedHadron; } // end namespace reco diff --git a/DataFormats/TauReco/interface/PFRecoTauChargedHadronFwd.h b/DataFormats/TauReco/interface/PFRecoTauChargedHadronFwd.h index 7e5e2e236de44..9b0277f698b90 100644 --- a/DataFormats/TauReco/interface/PFRecoTauChargedHadronFwd.h +++ b/DataFormats/TauReco/interface/PFRecoTauChargedHadronFwd.h @@ -9,7 +9,10 @@ #include namespace reco { - class PFRecoTauChargedHadron; + namespace io_v1 { + class PFRecoTauChargedHadron; + } + using PFRecoTauChargedHadron = io_v1::PFRecoTauChargedHadron; /// collection of PFRecoTauChargedHadron objects typedef std::vector PFRecoTauChargedHadronCollection; /// presistent reference to a PFRecoTauChargedHadron diff --git a/DataFormats/TauReco/interface/PFTau.h b/DataFormats/TauReco/interface/PFTau.h index 48e8161de8bed..235b24934c66c 100644 --- a/DataFormats/TauReco/interface/PFTau.h +++ b/DataFormats/TauReco/interface/PFTau.h @@ -32,285 +32,288 @@ namespace reco { } // namespace reco namespace reco { - - class PFTau : public BaseTau { - public: - enum hadronicDecayMode { - kNull = -1, - kOneProng0PiZero, - kOneProng1PiZero, - kOneProng2PiZero, - kOneProng3PiZero, - kOneProngNPiZero, - kTwoProng0PiZero, - kTwoProng1PiZero, - kTwoProng2PiZero, - kTwoProng3PiZero, - kTwoProngNPiZero, - kThreeProng0PiZero, - kThreeProng1PiZero, - kThreeProng2PiZero, - kThreeProng3PiZero, - kThreeProngNPiZero, - kRareDecayMode + namespace io_v1 { + + class PFTau : public BaseTau { + public: + enum hadronicDecayMode { + kNull = -1, + kOneProng0PiZero, + kOneProng1PiZero, + kOneProng2PiZero, + kOneProng3PiZero, + kOneProngNPiZero, + kTwoProng0PiZero, + kTwoProng1PiZero, + kTwoProng2PiZero, + kTwoProng3PiZero, + kTwoProngNPiZero, + kThreeProng0PiZero, + kThreeProng1PiZero, + kThreeProng2PiZero, + kThreeProng3PiZero, + kThreeProngNPiZero, + kRareDecayMode + }; + + PFTau(); + PFTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0)); + ~PFTau() override {} + PFTau* clone() const override; + + const JetBaseRef& jetRef() const; + void setjetRef(const JetBaseRef&); + + // functions to access the PFTauTagInfoRef used by HLT + const PFTauTagInfoRef& pfTauTagInfoRef() const; + void setpfTauTagInfoRef(const PFTauTagInfoRef); + + PFRecoTauChargedHadronRef leadTauChargedHadronCandidate() const; + const CandidatePtr& leadChargedHadrCand() const; + const CandidatePtr& leadNeutralCand() const; + //Can be either the charged or the neutral one + const CandidatePtr& leadCand() const; + + void setleadChargedHadrCand(const CandidatePtr&); + void setleadNeutralCand(const CandidatePtr&); + void setleadCand(const CandidatePtr&); + + /// Signed transverse impact parameter significance of the Track + /// associated to the leading charged PFCandidate + float leadPFChargedHadrCandsignedSipt() const; + void setleadPFChargedHadrCandsignedSipt(const float&); + + /// Candidates in signal region + const std::vector& signalCands() const; + void setsignalCands(const std::vector&); + + /// Charged hadrons in signal region + const std::vector& signalChargedHadrCands() const; + void setsignalChargedHadrCands(const std::vector&); + + /// Neutral hadrons in signal region + const std::vector& signalNeutrHadrCands() const; + void setsignalNeutrHadrCands(const std::vector&); + + /// Gamma candidates in signal region + const std::vector& signalGammaCands() const; + void setsignalGammaCands(const std::vector&); + + /// Candidates in isolation region + const std::vector& isolationCands() const; + void setisolationCands(const std::vector&); + + /// Charged candidates in isolation region + const std::vector& isolationChargedHadrCands() const; + void setisolationChargedHadrCands(const std::vector&); + + //// Neutral hadrons in isolation region + const std::vector& isolationNeutrHadrCands() const; + void setisolationNeutrHadrCands(const std::vector&); + + /// Gamma candidates in isolation region + const std::vector& isolationGammaCands() const; + void setisolationGammaCands(const std::vector&); + + /// Getters for different PFCandidates for PFTaus made from PFCandidates + const PFCandidatePtr leadPFChargedHadrCand() const; + const PFCandidatePtr leadPFNeutralCand() const; + const PFCandidatePtr leadPFCand() const; + const std::vector& signalPFCands() const; + const std::vector& signalPFChargedHadrCands() const; + const std::vector& signalPFNeutrHadrCands() const; + const std::vector& signalPFGammaCands() const; + const std::vector& isolationPFCands() const; + const std::vector& isolationPFChargedHadrCands() const; + const std::vector& isolationPFNeutrHadrCands() const; + const std::vector& isolationPFGammaCands() const; + + /// Sum of charged hadron candidate PT in isolation cone; returns NaN + /// if isolation region is undefined. + float isolationPFChargedHadrCandsPtSum() const; + void setisolationPFChargedHadrCandsPtSum(const float&); + + /// Sum of gamma candidate PT in isolation cone; returns NaN + /// if isolation region is undefined. + float isolationPFGammaCandsEtSum() const; + void setisolationPFGammaCandsEtSum(const float&); + + /// Et of the highest Et HCAL PFCluster + float maximumHCALPFClusterEt() const; + void setmaximumHCALPFClusterEt(const float&); + + /// Retrieve the association of signal region gamma candidates into candidate PiZeros + const std::vector& signalPiZeroCandidates() const; + void setsignalPiZeroCandidates(std::vector); + void setSignalPiZeroCandidatesRefs(RecoTauPiZeroRefVector); + + /// Retrieve the association of isolation region gamma candidates into candidate PiZeros + const std::vector& isolationPiZeroCandidates() const; + void setisolationPiZeroCandidates(std::vector); + void setIsolationPiZeroCandidatesRefs(RecoTauPiZeroRefVector); + + /// Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons + const std::vector& signalTauChargedHadronCandidates() const; + void setSignalTauChargedHadronCandidates(std::vector); + void setSignalTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); + + /// Retrieve the association of isolation region PF candidates into candidate PFRecoTauChargedHadron + const std::vector& isolationTauChargedHadronCandidates() const; + void setIsolationTauChargedHadronCandidates(std::vector); + void setIsolationTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); + + /// Retrieve the identified hadronic decay mode according to the number of + /// charged and piZero candidates in the signal cone + hadronicDecayMode decayMode() const; + void setDecayMode(const hadronicDecayMode&); + + /// Effect of eta and phi correction of strip on mass of tau candidate + float bendCorrMass() const { return bendCorrMass_; } + void setBendCorrMass(float bendCorrMass) { bendCorrMass_ = bendCorrMass; } + + /// Size of signal cone + double signalConeSize() const { return signalConeSize_; } + void setSignalConeSize(double signalConeSize) { signalConeSize_ = signalConeSize; } + + //Electron rejection + float emFraction() const; // Ecal/Hcal Cluster Energy + float hcalTotOverPLead() const; // total Hcal Cluster E / leadPFChargedHadron P + float hcalMaxOverPLead() const; // max. Hcal Cluster E / leadPFChargedHadron P + // Hcal Cluster E in R<0.184 around Ecal impact point of leading track / leadPFChargedHadron P + float hcal3x3OverPLead() const; + float ecalStripSumEOverPLead() const; // Simple BremsRecovery Sum E / leadPFChargedHadron P + float bremsRecoveryEOverPLead() const; // BremsRecovery Sum E / leadPFChargedHadron P + reco::TrackRef electronPreIDTrack() const; // Ref to KF track from Electron PreID + float electronPreIDOutput() const; // BDT output from Electron PreID + bool electronPreIDDecision() const; // Decision from Electron PreID + + void setemFraction(const float&); + void sethcalTotOverPLead(const float&); + void sethcalMaxOverPLead(const float&); + void sethcal3x3OverPLead(const float&); + void setecalStripSumEOverPLead(const float&); + void setbremsRecoveryEOverPLead(const float&); + void setelectronPreIDTrack(const reco::TrackRef&); + void setelectronPreIDOutput(const float&); + void setelectronPreIDDecision(const bool&); + + // For Muon Rejection + bool hasMuonReference() const; // check if muon ref exists + float caloComp() const; + float segComp() const; + bool muonDecision() const; + void setCaloComp(const float&); + void setSegComp(const float&); + void setMuonDecision(const bool&); + + /// return the number of source Candidates + /// ( the candidates used to construct this Candidate) + /// in the case of taus, there is only one source candidate, + /// which is the corresponding PFJet + size_type numberOfSourceCandidatePtrs() const override { return 1; } + + /// return a RefToBase to the source Candidates + /// ( the candidates used to construct this Candidate) + CandidatePtr sourceCandidatePtr(size_type i) const override; + + /// prints information on this PFTau + void dump(std::ostream& out = std::cout) const; + + private: + friend class tau::RecoTauConstructor; + friend class tau::PFRecoTauEnergyAlgorithmPlugin; + + //These are used by the friends + std::vector& signalPiZeroCandidatesRestricted(); + std::vector& isolationPiZeroCandidatesRestricted(); + std::vector& signalTauChargedHadronCandidatesRestricted(); + std::vector& isolationTauChargedHadronCandidatesRestricted(); + + // check overlap with another candidate + bool overlap(const Candidate&) const override; + + bool muonDecision_; + bool electronPreIDDecision_; + + // SIP + float leadPFChargedHadrCandsignedSipt_; + // Isolation variables + float isolationPFChargedHadrCandsPtSum_; + float isolationPFGammaCandsEtSum_; + float maximumHCALPFClusterEt_; + + // Electron rejection variables + float emFraction_; + float hcalTotOverPLead_; + float hcalMaxOverPLead_; + float hcal3x3OverPLead_; + float ecalStripSumEOverPLead_; + float bremsRecoveryEOverPLead_; + float electronPreIDOutput_; + + // Muon rejection variables + float caloComp_; + float segComp_; + + hadronicDecayMode decayMode_; + + float bendCorrMass_; + + float signalConeSize_; + + reco::JetBaseRef jetRef_; + PFTauTagInfoRef PFTauTagInfoRef_; + reco::CandidatePtr leadChargedHadrCand_; + reco::CandidatePtr leadNeutralCand_; + reco::CandidatePtr leadCand_; + reco::TrackRef electronPreIDTrack_; + + // Signal candidates + std::vector selectedSignalCands_; + std::vector selectedSignalChargedHadrCands_; + std::vector selectedSignalNeutrHadrCands_; + std::vector selectedSignalGammaCands_; + + // Isolation candidates + std::vector selectedIsolationCands_; + std::vector selectedIsolationChargedHadrCands_; + std::vector selectedIsolationNeutrHadrCands_; + std::vector selectedIsolationGammaCands_; + + // Transient caches for PFCandidate-based accessors + edm::AtomicPtrCache leadPFChargedHadrCand_; + edm::AtomicPtrCache leadPFNeutralCand_; + edm::AtomicPtrCache leadPFCand_; + + edm::AtomicPtrCache> selectedTransientSignalPFCands_; + edm::AtomicPtrCache> selectedTransientSignalPFChargedHadrCands_; + edm::AtomicPtrCache> selectedTransientSignalPFNeutrHadrCands_; + edm::AtomicPtrCache> selectedTransientSignalPFGammaCands_; + + edm::AtomicPtrCache> selectedTransientIsolationPFCands_; + edm::AtomicPtrCache> selectedTransientIsolationPFChargedHadrCands_; + edm::AtomicPtrCache> selectedTransientIsolationPFNeutrHadrCands_; + edm::AtomicPtrCache> selectedTransientIsolationPFGammaCands_; + + RecoTauPiZeroRefVector signalPiZeroCandidatesRefs_; + RecoTauPiZeroRefVector isolationPiZeroCandidatesRefs_; + + PFRecoTauChargedHadronRefVector signalTauChargedHadronCandidatesRefs_; + PFRecoTauChargedHadronRefVector isolationTauChargedHadronCandidatesRefs_; + + // Association of gamma candidates into PiZeros (transient) + edm::AtomicPtrCache> signalPiZeroCandidates_; + edm::AtomicPtrCache> isolationPiZeroCandidates_; + + // Association of PF candidates into PFRecoTauChargedHadrons (transient) + edm::AtomicPtrCache> signalTauChargedHadronCandidates_; + edm::AtomicPtrCache> isolationTauChargedHadronCandidates_; }; - PFTau(); - PFTau(Charge q, const LorentzVector&, const Point& = Point(0, 0, 0)); - ~PFTau() override {} - PFTau* clone() const override; - - const JetBaseRef& jetRef() const; - void setjetRef(const JetBaseRef&); - - // functions to access the PFTauTagInfoRef used by HLT - const PFTauTagInfoRef& pfTauTagInfoRef() const; - void setpfTauTagInfoRef(const PFTauTagInfoRef); - - PFRecoTauChargedHadronRef leadTauChargedHadronCandidate() const; - const CandidatePtr& leadChargedHadrCand() const; - const CandidatePtr& leadNeutralCand() const; - //Can be either the charged or the neutral one - const CandidatePtr& leadCand() const; - - void setleadChargedHadrCand(const CandidatePtr&); - void setleadNeutralCand(const CandidatePtr&); - void setleadCand(const CandidatePtr&); - - /// Signed transverse impact parameter significance of the Track - /// associated to the leading charged PFCandidate - float leadPFChargedHadrCandsignedSipt() const; - void setleadPFChargedHadrCandsignedSipt(const float&); - - /// Candidates in signal region - const std::vector& signalCands() const; - void setsignalCands(const std::vector&); - - /// Charged hadrons in signal region - const std::vector& signalChargedHadrCands() const; - void setsignalChargedHadrCands(const std::vector&); - - /// Neutral hadrons in signal region - const std::vector& signalNeutrHadrCands() const; - void setsignalNeutrHadrCands(const std::vector&); - - /// Gamma candidates in signal region - const std::vector& signalGammaCands() const; - void setsignalGammaCands(const std::vector&); - - /// Candidates in isolation region - const std::vector& isolationCands() const; - void setisolationCands(const std::vector&); - - /// Charged candidates in isolation region - const std::vector& isolationChargedHadrCands() const; - void setisolationChargedHadrCands(const std::vector&); - - //// Neutral hadrons in isolation region - const std::vector& isolationNeutrHadrCands() const; - void setisolationNeutrHadrCands(const std::vector&); - - /// Gamma candidates in isolation region - const std::vector& isolationGammaCands() const; - void setisolationGammaCands(const std::vector&); - - /// Getters for different PFCandidates for PFTaus made from PFCandidates - const PFCandidatePtr leadPFChargedHadrCand() const; - const PFCandidatePtr leadPFNeutralCand() const; - const PFCandidatePtr leadPFCand() const; - const std::vector& signalPFCands() const; - const std::vector& signalPFChargedHadrCands() const; - const std::vector& signalPFNeutrHadrCands() const; - const std::vector& signalPFGammaCands() const; - const std::vector& isolationPFCands() const; - const std::vector& isolationPFChargedHadrCands() const; - const std::vector& isolationPFNeutrHadrCands() const; - const std::vector& isolationPFGammaCands() const; - - /// Sum of charged hadron candidate PT in isolation cone; returns NaN - /// if isolation region is undefined. - float isolationPFChargedHadrCandsPtSum() const; - void setisolationPFChargedHadrCandsPtSum(const float&); - - /// Sum of gamma candidate PT in isolation cone; returns NaN - /// if isolation region is undefined. - float isolationPFGammaCandsEtSum() const; - void setisolationPFGammaCandsEtSum(const float&); - - /// Et of the highest Et HCAL PFCluster - float maximumHCALPFClusterEt() const; - void setmaximumHCALPFClusterEt(const float&); - - /// Retrieve the association of signal region gamma candidates into candidate PiZeros - const std::vector& signalPiZeroCandidates() const; - void setsignalPiZeroCandidates(std::vector); - void setSignalPiZeroCandidatesRefs(RecoTauPiZeroRefVector); - - /// Retrieve the association of isolation region gamma candidates into candidate PiZeros - const std::vector& isolationPiZeroCandidates() const; - void setisolationPiZeroCandidates(std::vector); - void setIsolationPiZeroCandidatesRefs(RecoTauPiZeroRefVector); - - /// Retrieve the association of signal region PF candidates into candidate PFRecoTauChargedHadrons - const std::vector& signalTauChargedHadronCandidates() const; - void setSignalTauChargedHadronCandidates(std::vector); - void setSignalTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); - - /// Retrieve the association of isolation region PF candidates into candidate PFRecoTauChargedHadron - const std::vector& isolationTauChargedHadronCandidates() const; - void setIsolationTauChargedHadronCandidates(std::vector); - void setIsolationTauChargedHadronCandidatesRefs(PFRecoTauChargedHadronRefVector); - - /// Retrieve the identified hadronic decay mode according to the number of - /// charged and piZero candidates in the signal cone - hadronicDecayMode decayMode() const; - void setDecayMode(const hadronicDecayMode&); - - /// Effect of eta and phi correction of strip on mass of tau candidate - float bendCorrMass() const { return bendCorrMass_; } - void setBendCorrMass(float bendCorrMass) { bendCorrMass_ = bendCorrMass; } - - /// Size of signal cone - double signalConeSize() const { return signalConeSize_; } - void setSignalConeSize(double signalConeSize) { signalConeSize_ = signalConeSize; } - - //Electron rejection - float emFraction() const; // Ecal/Hcal Cluster Energy - float hcalTotOverPLead() const; // total Hcal Cluster E / leadPFChargedHadron P - float hcalMaxOverPLead() const; // max. Hcal Cluster E / leadPFChargedHadron P - // Hcal Cluster E in R<0.184 around Ecal impact point of leading track / leadPFChargedHadron P - float hcal3x3OverPLead() const; - float ecalStripSumEOverPLead() const; // Simple BremsRecovery Sum E / leadPFChargedHadron P - float bremsRecoveryEOverPLead() const; // BremsRecovery Sum E / leadPFChargedHadron P - reco::TrackRef electronPreIDTrack() const; // Ref to KF track from Electron PreID - float electronPreIDOutput() const; // BDT output from Electron PreID - bool electronPreIDDecision() const; // Decision from Electron PreID - - void setemFraction(const float&); - void sethcalTotOverPLead(const float&); - void sethcalMaxOverPLead(const float&); - void sethcal3x3OverPLead(const float&); - void setecalStripSumEOverPLead(const float&); - void setbremsRecoveryEOverPLead(const float&); - void setelectronPreIDTrack(const reco::TrackRef&); - void setelectronPreIDOutput(const float&); - void setelectronPreIDDecision(const bool&); - - // For Muon Rejection - bool hasMuonReference() const; // check if muon ref exists - float caloComp() const; - float segComp() const; - bool muonDecision() const; - void setCaloComp(const float&); - void setSegComp(const float&); - void setMuonDecision(const bool&); - - /// return the number of source Candidates - /// ( the candidates used to construct this Candidate) - /// in the case of taus, there is only one source candidate, - /// which is the corresponding PFJet - size_type numberOfSourceCandidatePtrs() const override { return 1; } - - /// return a RefToBase to the source Candidates - /// ( the candidates used to construct this Candidate) - CandidatePtr sourceCandidatePtr(size_type i) const override; - - /// prints information on this PFTau - void dump(std::ostream& out = std::cout) const; - - private: - friend class tau::RecoTauConstructor; - friend class tau::PFRecoTauEnergyAlgorithmPlugin; - - //These are used by the friends - std::vector& signalPiZeroCandidatesRestricted(); - std::vector& isolationPiZeroCandidatesRestricted(); - std::vector& signalTauChargedHadronCandidatesRestricted(); - std::vector& isolationTauChargedHadronCandidatesRestricted(); - - // check overlap with another candidate - bool overlap(const Candidate&) const override; - - bool muonDecision_; - bool electronPreIDDecision_; - - // SIP - float leadPFChargedHadrCandsignedSipt_; - // Isolation variables - float isolationPFChargedHadrCandsPtSum_; - float isolationPFGammaCandsEtSum_; - float maximumHCALPFClusterEt_; - - // Electron rejection variables - float emFraction_; - float hcalTotOverPLead_; - float hcalMaxOverPLead_; - float hcal3x3OverPLead_; - float ecalStripSumEOverPLead_; - float bremsRecoveryEOverPLead_; - float electronPreIDOutput_; - - // Muon rejection variables - float caloComp_; - float segComp_; - - hadronicDecayMode decayMode_; - - float bendCorrMass_; - - float signalConeSize_; - - reco::JetBaseRef jetRef_; - PFTauTagInfoRef PFTauTagInfoRef_; - reco::CandidatePtr leadChargedHadrCand_; - reco::CandidatePtr leadNeutralCand_; - reco::CandidatePtr leadCand_; - reco::TrackRef electronPreIDTrack_; - - // Signal candidates - std::vector selectedSignalCands_; - std::vector selectedSignalChargedHadrCands_; - std::vector selectedSignalNeutrHadrCands_; - std::vector selectedSignalGammaCands_; - - // Isolation candidates - std::vector selectedIsolationCands_; - std::vector selectedIsolationChargedHadrCands_; - std::vector selectedIsolationNeutrHadrCands_; - std::vector selectedIsolationGammaCands_; - - // Transient caches for PFCandidate-based accessors - edm::AtomicPtrCache leadPFChargedHadrCand_; - edm::AtomicPtrCache leadPFNeutralCand_; - edm::AtomicPtrCache leadPFCand_; - - edm::AtomicPtrCache> selectedTransientSignalPFCands_; - edm::AtomicPtrCache> selectedTransientSignalPFChargedHadrCands_; - edm::AtomicPtrCache> selectedTransientSignalPFNeutrHadrCands_; - edm::AtomicPtrCache> selectedTransientSignalPFGammaCands_; - - edm::AtomicPtrCache> selectedTransientIsolationPFCands_; - edm::AtomicPtrCache> selectedTransientIsolationPFChargedHadrCands_; - edm::AtomicPtrCache> selectedTransientIsolationPFNeutrHadrCands_; - edm::AtomicPtrCache> selectedTransientIsolationPFGammaCands_; - - RecoTauPiZeroRefVector signalPiZeroCandidatesRefs_; - RecoTauPiZeroRefVector isolationPiZeroCandidatesRefs_; - - PFRecoTauChargedHadronRefVector signalTauChargedHadronCandidatesRefs_; - PFRecoTauChargedHadronRefVector isolationTauChargedHadronCandidatesRefs_; - - // Association of gamma candidates into PiZeros (transient) - edm::AtomicPtrCache> signalPiZeroCandidates_; - edm::AtomicPtrCache> isolationPiZeroCandidates_; - - // Association of PF candidates into PFRecoTauChargedHadrons (transient) - edm::AtomicPtrCache> signalTauChargedHadronCandidates_; - edm::AtomicPtrCache> isolationTauChargedHadronCandidates_; - }; - - std::ostream& operator<<(std::ostream& out, const PFTau& c); + std::ostream& operator<<(std::ostream& out, const PFTau& c); + } // namespace io_v1 + using PFTau = io_v1::PFTau; } // end namespace reco #endif diff --git a/DataFormats/TauReco/interface/PFTauDiscriminator.h b/DataFormats/TauReco/interface/PFTauDiscriminator.h index 85313b7c2fdbc..5a5b8537952b2 100644 --- a/DataFormats/TauReco/interface/PFTauDiscriminator.h +++ b/DataFormats/TauReco/interface/PFTauDiscriminator.h @@ -9,14 +9,17 @@ namespace reco { typedef edm::AssociationVector > PFTauDiscriminatorBase; - class PFTauDiscriminator : public PFTauDiscriminatorBase { - public: - PFTauDiscriminator() : PFTauDiscriminatorBase() {} + namespace io_v1 { + class PFTauDiscriminator : public PFTauDiscriminatorBase { + public: + PFTauDiscriminator() : PFTauDiscriminatorBase() {} - PFTauDiscriminator(const reco::PFTauRefProd &ref) : PFTauDiscriminatorBase(ref) {} + PFTauDiscriminator(const reco::PFTauRefProd &ref) : PFTauDiscriminatorBase(ref) {} - PFTauDiscriminator(const PFTauDiscriminatorBase &v) : PFTauDiscriminatorBase(v) {} - }; + PFTauDiscriminator(const PFTauDiscriminatorBase &v) : PFTauDiscriminatorBase(v) {} + }; + } // namespace io_v1 + using PFTauDiscriminator = io_v1::PFTauDiscriminator; typedef PFTauDiscriminator::value_type PFTauDiscriminatorVT; typedef edm::Ref PFTauDiscriminatorRef; diff --git a/DataFormats/TauReco/interface/PFTauFwd.h b/DataFormats/TauReco/interface/PFTauFwd.h index 8a03c171bde96..a1133b30127f4 100644 --- a/DataFormats/TauReco/interface/PFTauFwd.h +++ b/DataFormats/TauReco/interface/PFTauFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class PFTau; + namespace io_v1 { + class PFTau; + } + using PFTau = io_v1::PFTau; /// collection of PFTau objects typedef std::vector PFTauCollection; /// presistent reference to a PFTau diff --git a/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h b/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h index e7706a3fb1398..9c30cdcb41fc4 100644 --- a/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h +++ b/DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h @@ -21,64 +21,67 @@ #include "TVector3.h" namespace reco { - class PFTauTransverseImpactParameter { - enum { dimension = 3 }; - enum { covarianceSize = dimension * (dimension + 1) / 2 }; + namespace io_v1 { + class PFTauTransverseImpactParameter { + enum { dimension = 3 }; + enum { covarianceSize = dimension * (dimension + 1) / 2 }; - public: - typedef math::Error::type CovMatrix; - typedef math::XYZPoint Point; - typedef math::XYZVector Vector; + public: + typedef math::Error::type CovMatrix; + typedef math::XYZPoint Point; + typedef math::XYZVector Vector; - PFTauTransverseImpactParameter() {} - /// constructor from values - PFTauTransverseImpactParameter(const Point&, double, double, const Point&, double, double, const VertexRef&); - PFTauTransverseImpactParameter(const Point&, - double, - double, - const Point&, - double, - double, - const VertexRef&, - const Point&, - double, - const VertexRef&); + PFTauTransverseImpactParameter() {} + /// constructor from values + PFTauTransverseImpactParameter(const Point&, double, double, const Point&, double, double, const VertexRef&); + PFTauTransverseImpactParameter(const Point&, + double, + double, + const Point&, + double, + double, + const VertexRef&, + const Point&, + double, + const VertexRef&); - virtual ~PFTauTransverseImpactParameter() {} - PFTauTransverseImpactParameter* clone() const; + virtual ~PFTauTransverseImpactParameter() {} + PFTauTransverseImpactParameter* clone() const; - const Point& dxy_PCA() const { return pca_; } - double dxy() const { return dxy_; } - double dxy_error() const { return dxy_error_; } - double dxy_Sig() const { return (dxy_error_ != 0) ? (dxy_ / dxy_error_) : 0.; } - const Point& ip3d_PCA() const { return pca3d_; } - double ip3d() const { return ip3d_; } - double ip3d_error() const { return ip3d_error_; } - double ip3d_Sig() const { return (ip3d_error_ != 0) ? (ip3d_ / ip3d_error_) : 0.; } - const VertexRef& primaryVertex() const { return PV_; } - Point primaryVertexPos() const; - CovMatrix primaryVertexCov() const; - bool hasSecondaryVertex() const { return hasSV_; } - const Vector& flightLength() const; - double flightLengthSig() const; - CovMatrix flightLengthCov() const; - const VertexRef& secondaryVertex() const { return SV_; } - Point secondaryVertexPos() const; - CovMatrix secondaryVertexCov() const; + const Point& dxy_PCA() const { return pca_; } + double dxy() const { return dxy_; } + double dxy_error() const { return dxy_error_; } + double dxy_Sig() const { return (dxy_error_ != 0) ? (dxy_ / dxy_error_) : 0.; } + const Point& ip3d_PCA() const { return pca3d_; } + double ip3d() const { return ip3d_; } + double ip3d_error() const { return ip3d_error_; } + double ip3d_Sig() const { return (ip3d_error_ != 0) ? (ip3d_ / ip3d_error_) : 0.; } + const VertexRef& primaryVertex() const { return PV_; } + Point primaryVertexPos() const; + CovMatrix primaryVertexCov() const; + bool hasSecondaryVertex() const { return hasSV_; } + const Vector& flightLength() const; + double flightLengthSig() const; + CovMatrix flightLengthCov() const; + const VertexRef& secondaryVertex() const { return SV_; } + Point secondaryVertexPos() const; + CovMatrix secondaryVertexCov() const; - private: - Point pca_; - double dxy_{0}; - double dxy_error_{0}; - Point pca3d_; - double ip3d_{0}; - double ip3d_error_{0}; - VertexRef PV_; - bool hasSV_{false}; - Vector FlightLength_; - double FlightLengthSig_{0}; - VertexRef SV_; - }; + private: + Point pca_; + double dxy_{0}; + double dxy_error_{0}; + Point pca3d_; + double ip3d_{0}; + double ip3d_error_{0}; + VertexRef PV_; + bool hasSV_{false}; + Vector FlightLength_; + double FlightLengthSig_{0}; + VertexRef SV_; + }; + } // namespace io_v1 + using PFTauTransverseImpactParameter = io_v1::PFTauTransverseImpactParameter; } // namespace reco #endif diff --git a/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h b/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h index 9d69c49979136..00cc1e7aafed7 100644 --- a/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h +++ b/DataFormats/TauReco/interface/PFTauTransverseImpactParameterFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class PFTauTransverseImpactParameter; + namespace io_v1 { + class PFTauTransverseImpactParameter; + } + using PFTauTransverseImpactParameter = io_v1::PFTauTransverseImpactParameter; /// collection of PFTauTransverseImpactParameter objects typedef std::vector PFTauTransverseImpactParameterCollection; /// presistent reference to a PFTauTransverseImpactParameter diff --git a/DataFormats/TauReco/interface/RecoTauPiZero.h b/DataFormats/TauReco/interface/RecoTauPiZero.h index 610d147f48cb1..edc9b44b359cc 100644 --- a/DataFormats/TauReco/interface/RecoTauPiZero.h +++ b/DataFormats/TauReco/interface/RecoTauPiZero.h @@ -4,96 +4,99 @@ #include "DataFormats/Candidate/interface/CompositePtrCandidate.h" namespace reco { - class RecoTauPiZero : public CompositePtrCandidate { - public: - enum PiZeroAlgorithm { - // Algorithm where each photon becomes a pi zero - kUndefined = 0, - kTrivial = 1, - kCombinatoric = 2, - kStrips = 3 + namespace io_v1 { + class RecoTauPiZero : public CompositePtrCandidate { + public: + enum PiZeroAlgorithm { + // Algorithm where each photon becomes a pi zero + kUndefined = 0, + kTrivial = 1, + kCombinatoric = 2, + kStrips = 3 + }; + + RecoTauPiZero() : CompositePtrCandidate(), algoName_(kUndefined), bendCorrEta_(0.), bendCorrPhi_(0.) { + this->setPdgId(111); + } + + RecoTauPiZero(PiZeroAlgorithm algoName) + : CompositePtrCandidate(), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { + this->setPdgId(111); + } + + /// constructor from values + RecoTauPiZero(Charge q, + const LorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 111, + int status = 0, + bool integerCharge = true, + PiZeroAlgorithm algoName = kUndefined) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), + algoName_(algoName), + bendCorrEta_(0.), + bendCorrPhi_(0.) {} + + /// constructor from values + RecoTauPiZero(Charge q, + const PolarLorentzVector& p4, + const Point& vtx = Point(0, 0, 0), + int pdgId = 111, + int status = 0, + bool integerCharge = true, + PiZeroAlgorithm algoName = kUndefined) + : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), + algoName_(algoName), + bendCorrEta_(0.), + bendCorrPhi_(0.) {} + + /// constructor from a Candidate + explicit RecoTauPiZero(const Candidate& p, PiZeroAlgorithm algoName = kUndefined) + : CompositePtrCandidate(p), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { + this->setPdgId(111); + } + + /// destructor + ~RecoTauPiZero() override {} + + /// Number of PFGamma constituents + size_t numberOfGammas() const; + + /// Number of electron constituents + size_t numberOfElectrons() const; + + /// Maximum DeltaPhi between a constituent and the four vector + double maxDeltaPhi() const; + + /// Maxmum DeltaEta between a constituent and the four vector + double maxDeltaEta() const; + + /// Algorithm that built this piZero + PiZeroAlgorithm algo() const; + + /// Check whether a given algo produced this pi zero + bool algoIs(PiZeroAlgorithm algo) const; + + /// Size of correction to account for spread of photon energy in eta and phi + /// in case charged pions make nuclear interactions or photons convert within the tracking detector + float bendCorrEta() const { return bendCorrEta_; } + float bendCorrPhi() const { return bendCorrPhi_; } + void setBendCorrEta(float bendCorrEta) { bendCorrEta_ = bendCorrEta; } + void setBendCorrPhi(float bendCorrPhi) { bendCorrPhi_ = bendCorrPhi; } + + void print(std::ostream& out = std::cout) const; + + private: + PiZeroAlgorithm algoName_; + + float bendCorrEta_; + float bendCorrPhi_; }; - RecoTauPiZero() : CompositePtrCandidate(), algoName_(kUndefined), bendCorrEta_(0.), bendCorrPhi_(0.) { - this->setPdgId(111); - } - - RecoTauPiZero(PiZeroAlgorithm algoName) - : CompositePtrCandidate(), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { - this->setPdgId(111); - } - - /// constructor from values - RecoTauPiZero(Charge q, - const LorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 111, - int status = 0, - bool integerCharge = true, - PiZeroAlgorithm algoName = kUndefined) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), - algoName_(algoName), - bendCorrEta_(0.), - bendCorrPhi_(0.) {} - - /// constructor from values - RecoTauPiZero(Charge q, - const PolarLorentzVector& p4, - const Point& vtx = Point(0, 0, 0), - int pdgId = 111, - int status = 0, - bool integerCharge = true, - PiZeroAlgorithm algoName = kUndefined) - : CompositePtrCandidate(q, p4, vtx, pdgId, status, integerCharge), - algoName_(algoName), - bendCorrEta_(0.), - bendCorrPhi_(0.) {} - - /// constructor from a Candidate - explicit RecoTauPiZero(const Candidate& p, PiZeroAlgorithm algoName = kUndefined) - : CompositePtrCandidate(p), algoName_(algoName), bendCorrEta_(0.), bendCorrPhi_(0.) { - this->setPdgId(111); - } - - /// destructor - ~RecoTauPiZero() override {} - - /// Number of PFGamma constituents - size_t numberOfGammas() const; - - /// Number of electron constituents - size_t numberOfElectrons() const; - - /// Maximum DeltaPhi between a constituent and the four vector - double maxDeltaPhi() const; - - /// Maxmum DeltaEta between a constituent and the four vector - double maxDeltaEta() const; - - /// Algorithm that built this piZero - PiZeroAlgorithm algo() const; - - /// Check whether a given algo produced this pi zero - bool algoIs(PiZeroAlgorithm algo) const; - - /// Size of correction to account for spread of photon energy in eta and phi - /// in case charged pions make nuclear interactions or photons convert within the tracking detector - float bendCorrEta() const { return bendCorrEta_; } - float bendCorrPhi() const { return bendCorrPhi_; } - void setBendCorrEta(float bendCorrEta) { bendCorrEta_ = bendCorrEta; } - void setBendCorrPhi(float bendCorrPhi) { bendCorrPhi_ = bendCorrPhi; } - - void print(std::ostream& out = std::cout) const; - - private: - PiZeroAlgorithm algoName_; - - float bendCorrEta_; - float bendCorrPhi_; - }; - - std::ostream& operator<<(std::ostream& out, const RecoTauPiZero& c); + std::ostream& operator<<(std::ostream& out, const RecoTauPiZero& c); + } // namespace io_v1 + using RecoTauPiZero = io_v1::RecoTauPiZero; } // namespace reco #endif diff --git a/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h b/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h index a5430ab5f154e..df98ff288f05c 100644 --- a/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h +++ b/DataFormats/TauReco/interface/RecoTauPiZeroFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class RecoTauPiZero; + namespace io_v1 { + class RecoTauPiZero; + } + using RecoTauPiZero = io_v1::RecoTauPiZero; /// collection of RecoTauPiZero objects typedef std::vector RecoTauPiZeroCollection; /// presistent reference to a RecoTauPiZero diff --git a/DataFormats/TauReco/interface/TauDiscriminatorContainer.h b/DataFormats/TauReco/interface/TauDiscriminatorContainer.h index c9c1dc60b8a08..1d8f70eec53ab 100644 --- a/DataFormats/TauReco/interface/TauDiscriminatorContainer.h +++ b/DataFormats/TauReco/interface/TauDiscriminatorContainer.h @@ -6,13 +6,16 @@ #include namespace reco { - struct SingleTauDiscriminatorContainer { - std::vector rawValues; // stores floating point discriminators, like MVA raw values or pt sums. - std::vector workingPoints; // stores boolean discriminators computed with the raw values. + namespace io_v1 { + struct SingleTauDiscriminatorContainer { + std::vector rawValues; // stores floating point discriminators, like MVA raw values or pt sums. + std::vector workingPoints; // stores boolean discriminators computed with the raw values. - SingleTauDiscriminatorContainer() {} - SingleTauDiscriminatorContainer(float rawInit) { rawValues.push_back(rawInit); } - }; + SingleTauDiscriminatorContainer() {} + SingleTauDiscriminatorContainer(float rawInit) { rawValues.push_back(rawInit); } + }; + } // namespace io_v1 + using SingleTauDiscriminatorContainer = io_v1::SingleTauDiscriminatorContainer; typedef edm::ValueMap TauDiscriminatorContainer; } // namespace reco diff --git a/DataFormats/TauReco/src/BaseTau.cc b/DataFormats/TauReco/src/BaseTau.cc index d56b64d3d682a..bd55abe99f684 100644 --- a/DataFormats/TauReco/src/BaseTau.cc +++ b/DataFormats/TauReco/src/BaseTau.cc @@ -1,6 +1,7 @@ #include "DataFormats/TauReco/interface/BaseTau.h" using namespace reco; +using namespace reco::io_v1; BaseTau::BaseTau() { alternatLorentzVect_.SetPx(NAN); diff --git a/DataFormats/TauReco/src/PFRecoTauChargedHadron.cc b/DataFormats/TauReco/src/PFRecoTauChargedHadron.cc index 6511df47c1406..ee0c512877a85 100644 --- a/DataFormats/TauReco/src/PFRecoTauChargedHadron.cc +++ b/DataFormats/TauReco/src/PFRecoTauChargedHadron.cc @@ -3,115 +3,117 @@ #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" namespace reco { + namespace io_v1 { - PFRecoTauChargedHadron::PFRecoTauChargedHadron() : CompositePtrCandidate(), algo_(kUndefined) {} - - PFRecoTauChargedHadron::PFRecoTauChargedHadron(PFRecoTauChargedHadronAlgorithm algo, Charge q) - : CompositePtrCandidate(), algo_(algo) { - if (q > 0.) - this->setPdgId(+211); - else if (q < 0.) - this->setPdgId(-211); - } - - PFRecoTauChargedHadron::PFRecoTauChargedHadron(Charge q, - const LorentzVector& p4, - const Point& vtx, - int status, - bool integerCharge, - PFRecoTauChargedHadronAlgorithm algo) - : CompositePtrCandidate(q, p4, vtx, 211, status, integerCharge), algo_(algo) { - if (q > 0.) - this->setPdgId(+211); - else if (q < 0.) - this->setPdgId(-211); - } - - PFRecoTauChargedHadron::PFRecoTauChargedHadron(const Candidate& c, PFRecoTauChargedHadronAlgorithm algo) - : CompositePtrCandidate(c), algo_(algo) { - if (c.charge() > 0.) - this->setPdgId(+211); - else if (c.charge() < 0.) - this->setPdgId(-211); - } - - PFRecoTauChargedHadron::~PFRecoTauChargedHadron() {} - - const CandidatePtr& PFRecoTauChargedHadron::getChargedPFCandidate() const { return chargedPFCandidate_; } - - const PFRecoTauChargedHadron::TrackPtr& PFRecoTauChargedHadron::getTrack() const { return track_; } - - const CandidatePtr& PFRecoTauChargedHadron::getLostTrackCandidate() const { return lostTrackCandidate_; } - - const std::vector& PFRecoTauChargedHadron::getNeutralPFCandidates() const { - return neutralPFCandidates_; - } - - const math::XYZPointF& PFRecoTauChargedHadron::positionAtECALEntrance() const { return positionAtECALEntrance_; } - - PFRecoTauChargedHadron::PFRecoTauChargedHadronAlgorithm PFRecoTauChargedHadron::algo() const { return algo_; } - - bool PFRecoTauChargedHadron::algoIs(PFRecoTauChargedHadron::PFRecoTauChargedHadronAlgorithm algo) const { - return (algo_ == algo); - } - - void PFRecoTauChargedHadron::print(std::ostream& stream) const { - stream << " Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() - << " (mass = " << this->mass() << ")" << std::endl; - stream << " charge = " << this->charge() << " (pdgId = " << this->pdgId() << ")" << std::endl; - stream << "charged PFCandidate"; - if (chargedPFCandidate_.isNonnull()) { - stream << " (" << chargedPFCandidate_.id() << ":" << chargedPFCandidate_.key() << "):" - << " Pt = " << chargedPFCandidate_->pt() << ", eta = " << chargedPFCandidate_->eta() - << ", phi = " << chargedPFCandidate_->phi() << " (pdgId = " << chargedPFCandidate_->pdgId() << ")" - << std::endl; - } else { - stream << ": N/A" << std::endl; + PFRecoTauChargedHadron::PFRecoTauChargedHadron() : CompositePtrCandidate(), algo_(kUndefined) {} + + PFRecoTauChargedHadron::PFRecoTauChargedHadron(PFRecoTauChargedHadronAlgorithm algo, Charge q) + : CompositePtrCandidate(), algo_(algo) { + if (q > 0.) + this->setPdgId(+211); + else if (q < 0.) + this->setPdgId(-211); + } + + PFRecoTauChargedHadron::PFRecoTauChargedHadron(Charge q, + const LorentzVector& p4, + const Point& vtx, + int status, + bool integerCharge, + PFRecoTauChargedHadronAlgorithm algo) + : CompositePtrCandidate(q, p4, vtx, 211, status, integerCharge), algo_(algo) { + if (q > 0.) + this->setPdgId(+211); + else if (q < 0.) + this->setPdgId(-211); + } + + PFRecoTauChargedHadron::PFRecoTauChargedHadron(const Candidate& c, PFRecoTauChargedHadronAlgorithm algo) + : CompositePtrCandidate(c), algo_(algo) { + if (c.charge() > 0.) + this->setPdgId(+211); + else if (c.charge() < 0.) + this->setPdgId(-211); } - stream << "reco::Track: "; - if (track_.isNonnull()) { - stream << "Pt = " << track_->pt() << " +/- " << track_->ptError() << ", eta = " << track_->eta() - << ", phi = " << track_->phi() << std::endl; - } else if (lostTrackCandidate_.isNonnull()) { - stream << "(lostTrackCandidate: " << lostTrackCandidate_.id() << ":" << lostTrackCandidate_.key() << "):" - << " Pt = " << lostTrackCandidate_->pt() << ", eta = " << lostTrackCandidate_->eta() - << ", phi = " << lostTrackCandidate_->phi() << std::endl; - } else { - stream << "N/A" << std::endl; + + PFRecoTauChargedHadron::~PFRecoTauChargedHadron() {} + + const CandidatePtr& PFRecoTauChargedHadron::getChargedPFCandidate() const { return chargedPFCandidate_; } + + const PFRecoTauChargedHadron::TrackPtr& PFRecoTauChargedHadron::getTrack() const { return track_; } + + const CandidatePtr& PFRecoTauChargedHadron::getLostTrackCandidate() const { return lostTrackCandidate_; } + + const std::vector& PFRecoTauChargedHadron::getNeutralPFCandidates() const { + return neutralPFCandidates_; } - stream << "neutral PFCandidates:"; - if (!neutralPFCandidates_.empty()) { - stream << std::endl; - int idx = 0; - for (std::vector::const_iterator neutralPFCandidate = neutralPFCandidates_.begin(); - neutralPFCandidate != neutralPFCandidates_.end(); - ++neutralPFCandidate) { - stream << " #" << idx << " (" << neutralPFCandidate->id() << ":" << neutralPFCandidate->key() << "):" - << " Pt = " << (*neutralPFCandidate)->pt() << ", eta = " << (*neutralPFCandidate)->eta() - << ", phi = " << (*neutralPFCandidate)->phi() << " (pdgId = " << (*neutralPFCandidate)->pdgId() << ")" + + const math::XYZPointF& PFRecoTauChargedHadron::positionAtECALEntrance() const { return positionAtECALEntrance_; } + + PFRecoTauChargedHadron::PFRecoTauChargedHadronAlgorithm PFRecoTauChargedHadron::algo() const { return algo_; } + + bool PFRecoTauChargedHadron::algoIs(PFRecoTauChargedHadron::PFRecoTauChargedHadronAlgorithm algo) const { + return (algo_ == algo); + } + + void PFRecoTauChargedHadron::print(std::ostream& stream) const { + stream << " Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() + << " (mass = " << this->mass() << ")" << std::endl; + stream << " charge = " << this->charge() << " (pdgId = " << this->pdgId() << ")" << std::endl; + stream << "charged PFCandidate"; + if (chargedPFCandidate_.isNonnull()) { + stream << " (" << chargedPFCandidate_.id() << ":" << chargedPFCandidate_.key() << "):" + << " Pt = " << chargedPFCandidate_->pt() << ", eta = " << chargedPFCandidate_->eta() + << ", phi = " << chargedPFCandidate_->phi() << " (pdgId = " << chargedPFCandidate_->pdgId() << ")" << std::endl; - ++idx; + } else { + stream << ": N/A" << std::endl; } - } else { - stream << " "; - stream << "N/A" << std::endl; + stream << "reco::Track: "; + if (track_.isNonnull()) { + stream << "Pt = " << track_->pt() << " +/- " << track_->ptError() << ", eta = " << track_->eta() + << ", phi = " << track_->phi() << std::endl; + } else if (lostTrackCandidate_.isNonnull()) { + stream << "(lostTrackCandidate: " << lostTrackCandidate_.id() << ":" << lostTrackCandidate_.key() << "):" + << " Pt = " << lostTrackCandidate_->pt() << ", eta = " << lostTrackCandidate_->eta() + << ", phi = " << lostTrackCandidate_->phi() << std::endl; + } else { + stream << "N/A" << std::endl; + } + stream << "neutral PFCandidates:"; + if (!neutralPFCandidates_.empty()) { + stream << std::endl; + int idx = 0; + for (std::vector::const_iterator neutralPFCandidate = neutralPFCandidates_.begin(); + neutralPFCandidate != neutralPFCandidates_.end(); + ++neutralPFCandidate) { + stream << " #" << idx << " (" << neutralPFCandidate->id() << ":" << neutralPFCandidate->key() << "):" + << " Pt = " << (*neutralPFCandidate)->pt() << ", eta = " << (*neutralPFCandidate)->eta() + << ", phi = " << (*neutralPFCandidate)->phi() << " (pdgId = " << (*neutralPFCandidate)->pdgId() << ")" + << std::endl; + ++idx; + } + } else { + stream << " "; + stream << "N/A" << std::endl; + } + stream << "position@ECAL entrance: x = " << this->positionAtECALEntrance().x() + << ", y = " << this->positionAtECALEntrance().y() << ", z = " << this->positionAtECALEntrance().z() + << " (eta = " << this->positionAtECALEntrance().eta() << ", phi = " << this->positionAtECALEntrance().phi() + << ")" << std::endl; + std::string algo_string = "undefined"; + if (algo_ == kChargedPFCandidate) + algo_string = "chargedPFCandidate"; + else if (algo_ == kTrack) + algo_string = "Track"; + else if (algo_ == kPFNeutralHadron) + algo_string = "PFNeutralHadron"; + stream << "algo = " << algo_string << std::endl; + } + + std::ostream& operator<<(std::ostream& stream, const reco::PFRecoTauChargedHadron& c) { + c.print(stream); + return stream; } - stream << "position@ECAL entrance: x = " << this->positionAtECALEntrance().x() - << ", y = " << this->positionAtECALEntrance().y() << ", z = " << this->positionAtECALEntrance().z() - << " (eta = " << this->positionAtECALEntrance().eta() << ", phi = " << this->positionAtECALEntrance().phi() - << ")" << std::endl; - std::string algo_string = "undefined"; - if (algo_ == kChargedPFCandidate) - algo_string = "chargedPFCandidate"; - else if (algo_ == kTrack) - algo_string = "Track"; - else if (algo_ == kPFNeutralHadron) - algo_string = "PFNeutralHadron"; - stream << "algo = " << algo_string << std::endl; - } - - std::ostream& operator<<(std::ostream& stream, const reco::PFRecoTauChargedHadron& c) { - c.print(stream); - return stream; - } + } // namespace io_v1 } // namespace reco diff --git a/DataFormats/TauReco/src/RecoTauPiZero.cc b/DataFormats/TauReco/src/RecoTauPiZero.cc index 995bc7452ccce..b382a270d79fd 100644 --- a/DataFormats/TauReco/src/RecoTauPiZero.cc +++ b/DataFormats/TauReco/src/RecoTauPiZero.cc @@ -3,91 +3,93 @@ #include "DataFormats/Math/interface/deltaPhi.h" namespace reco { + namespace io_v1 { - size_t RecoTauPiZero::numberOfGammas() const { - size_t nGammas = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - if (daughter(i)->pdgId() == 22) - ++nGammas; + size_t RecoTauPiZero::numberOfGammas() const { + size_t nGammas = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + if (daughter(i)->pdgId() == 22) + ++nGammas; + } + return nGammas; } - return nGammas; - } - size_t RecoTauPiZero::numberOfElectrons() const { - size_t nElectrons = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - if (std::abs(daughter(i)->pdgId()) == 11) - ++nElectrons; + size_t RecoTauPiZero::numberOfElectrons() const { + size_t nElectrons = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + if (std::abs(daughter(i)->pdgId()) == 11) + ++nElectrons; + } + return nElectrons; } - return nElectrons; - } - double RecoTauPiZero::maxDeltaPhi() const { - double maxDPhi = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - double dPhi = std::fabs(deltaPhi(*this, *daughter(i))); - if (dPhi > maxDPhi) - maxDPhi = dPhi; + double RecoTauPiZero::maxDeltaPhi() const { + double maxDPhi = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + double dPhi = std::fabs(deltaPhi(*this, *daughter(i))); + if (dPhi > maxDPhi) + maxDPhi = dPhi; + } + return maxDPhi; } - return maxDPhi; - } - double RecoTauPiZero::maxDeltaEta() const { - double maxDEta = 0; - size_t nDaughters = numberOfDaughters(); - for (size_t i = 0; i < nDaughters; ++i) { - double dEta = std::fabs(eta() - daughter(i)->eta()); - if (dEta > maxDEta) - maxDEta = dEta; + double RecoTauPiZero::maxDeltaEta() const { + double maxDEta = 0; + size_t nDaughters = numberOfDaughters(); + for (size_t i = 0; i < nDaughters; ++i) { + double dEta = std::fabs(eta() - daughter(i)->eta()); + if (dEta > maxDEta) + maxDEta = dEta; + } + return maxDEta; } - return maxDEta; - } - RecoTauPiZero::PiZeroAlgorithm RecoTauPiZero::algo() const { return algoName_; } + RecoTauPiZero::PiZeroAlgorithm RecoTauPiZero::algo() const { return algoName_; } - bool RecoTauPiZero::algoIs(RecoTauPiZero::PiZeroAlgorithm algo) const { return (algoName_ == algo); } + bool RecoTauPiZero::algoIs(RecoTauPiZero::PiZeroAlgorithm algo) const { return (algoName_ == algo); } - namespace { - std::string getPFCandidateType(reco::PFCandidate::ParticleType pfCandidateType) { - if (pfCandidateType == reco::PFCandidate::X) - return "undefined"; - else if (pfCandidateType == reco::PFCandidate::h) - return "PFChargedHadron"; - else if (pfCandidateType == reco::PFCandidate::e) - return "PFElectron"; - else if (pfCandidateType == reco::PFCandidate::mu) - return "PFMuon"; - else if (pfCandidateType == reco::PFCandidate::gamma) - return "PFGamma"; - else if (pfCandidateType == reco::PFCandidate::h0) - return "PFNeutralHadron"; - else if (pfCandidateType == reco::PFCandidate::h_HF) - return "HF_had"; - else if (pfCandidateType == reco::PFCandidate::egamma_HF) - return "HF_em"; - else - assert(0); - } - } // namespace + namespace { + std::string getPFCandidateType(reco::PFCandidate::ParticleType pfCandidateType) { + if (pfCandidateType == reco::PFCandidate::X) + return "undefined"; + else if (pfCandidateType == reco::PFCandidate::h) + return "PFChargedHadron"; + else if (pfCandidateType == reco::PFCandidate::e) + return "PFElectron"; + else if (pfCandidateType == reco::PFCandidate::mu) + return "PFMuon"; + else if (pfCandidateType == reco::PFCandidate::gamma) + return "PFGamma"; + else if (pfCandidateType == reco::PFCandidate::h0) + return "PFNeutralHadron"; + else if (pfCandidateType == reco::PFCandidate::h_HF) + return "HF_had"; + else if (pfCandidateType == reco::PFCandidate::egamma_HF) + return "HF_em"; + else + assert(0); + } + } // namespace - void RecoTauPiZero::print(std::ostream& stream) const { - std::cout << "Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << std::endl; - size_t numDaughters = this->numberOfDaughters(); - for (size_t iDaughter = 0; iDaughter < numDaughters; ++iDaughter) { - const reco::PFCandidate* daughter = dynamic_cast(this->daughterPtr(iDaughter).get()); - std::cout << " daughter #" << iDaughter << " (" << getPFCandidateType(daughter->particleId()) << "):" - << " Pt = " << daughter->pt() << ", eta = " << daughter->eta() << ", phi = " << daughter->phi() - << std::endl; + void RecoTauPiZero::print(std::ostream& stream) const { + std::cout << "Pt = " << this->pt() << ", eta = " << this->eta() << ", phi = " << this->phi() << std::endl; + size_t numDaughters = this->numberOfDaughters(); + for (size_t iDaughter = 0; iDaughter < numDaughters; ++iDaughter) { + const reco::PFCandidate* daughter = dynamic_cast(this->daughterPtr(iDaughter).get()); + std::cout << " daughter #" << iDaughter << " (" << getPFCandidateType(daughter->particleId()) << "):" + << " Pt = " << daughter->pt() << ", eta = " << daughter->eta() << ", phi = " << daughter->phi() + << std::endl; + } } - } - std::ostream& operator<<(std::ostream& out, const reco::RecoTauPiZero& piZero) { - if (!out) + std::ostream& operator<<(std::ostream& out, const reco::RecoTauPiZero& piZero) { + if (!out) + return out; + piZero.print(out); return out; - piZero.print(out); - return out; - } + } + } // namespace io_v1 } // namespace reco diff --git a/DataFormats/TauReco/src/classes_def_1.xml b/DataFormats/TauReco/src/classes_def_1.xml index 2180df8832e45..a0c6f1dbdf749 100644 --- a/DataFormats/TauReco/src/classes_def_1.xml +++ b/DataFormats/TauReco/src/classes_def_1.xml @@ -4,13 +4,13 @@ - - + + - - + + @@ -18,11 +18,8 @@ - - - - - + + @@ -30,94 +27,16 @@ - - - - - - - - - (cand));]]> - - - - (cand));]]> - - - - (cand));]]> - - - - - - - - - - - - - - - - - - - + + - + diff --git a/DataFormats/TauReco/src/classes_def_2.xml b/DataFormats/TauReco/src/classes_def_2.xml index 5373f5634f01c..dbf45b7b52833 100644 --- a/DataFormats/TauReco/src/classes_def_2.xml +++ b/DataFormats/TauReco/src/classes_def_2.xml @@ -1,7 +1,7 @@ - - + + @@ -13,231 +13,35 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + + - - - - + + + + - - & cand : onfile.selectedSignalPFCands_) { - selectedSignalCands_.push_back(edm::Ptr(cand));} - - selectedSignalChargedHadrCands_.clear(); - selectedSignalChargedHadrCands_.reserve(onfile.selectedSignalPFChargedHadrCands_.size()); - for (const auto& cand : onfile.selectedSignalPFChargedHadrCands_) - selectedSignalChargedHadrCands_.push_back(edm::Ptr(cand)); - - selectedSignalNeutrHadrCands_.clear(); - selectedSignalNeutrHadrCands_.reserve(onfile.selectedSignalPFNeutrHadrCands_.size()); - for (const auto& cand : onfile.selectedSignalPFNeutrHadrCands_) - selectedSignalNeutrHadrCands_.push_back(edm::Ptr(cand));; - - selectedSignalGammaCands_.clear(); - selectedSignalGammaCands_.reserve(onfile.selectedSignalPFGammaCands_.size()); - for (const auto& cand : onfile.selectedSignalPFGammaCands_) - selectedSignalGammaCands_.push_back(edm::Ptr(cand)); - - selectedIsolationCands_.clear(); - selectedIsolationCands_.reserve(onfile.selectedIsolationPFCands_.size()); - for (const auto& cand : onfile.selectedIsolationPFCands_) - selectedIsolationCands_.push_back(edm::Ptr(cand)); - - selectedIsolationChargedHadrCands_.clear(); - selectedIsolationChargedHadrCands_.reserve(onfile.selectedIsolationPFChargedHadrCands_.size()); - for (const auto& cand : onfile.selectedIsolationPFChargedHadrCands_) - selectedIsolationChargedHadrCands_.push_back(edm::Ptr(cand)); - - selectedIsolationNeutrHadrCands_.clear(); - selectedIsolationNeutrHadrCands_.reserve(onfile.selectedIsolationPFNeutrHadrCands_.size()); - for (const auto& cand : onfile.selectedIsolationPFNeutrHadrCands_) - selectedIsolationNeutrHadrCands_.push_back(edm::Ptr(cand)); - - selectedIsolationGammaCands_.clear(); - selectedIsolationGammaCands_.reserve(onfile.selectedIsolationPFGammaCands_.size()); - for (const auto& cand : onfile.selectedIsolationPFGammaCands_) - selectedIsolationGammaCands_.push_back(edm::Ptr(cand)); - - if (selectedSignalChargedHadrCands_.size() > 0) { - leadChargedHadrCand_ = selectedSignalChargedHadrCands_[0]; - } else { - leadChargedHadrCand_ = edm::Ptr(); - } - if (selectedSignalGammaCands_.size() > 0) { - leadNeutralCand_ = selectedSignalGammaCands_[0]; - } else { - leadNeutralCand_ = edm::Ptr(); - } - if (selectedSignalCands_.size() > 0) { - leadCand_ = selectedSignalCands_[0]; - } else { - leadCand_ = edm::Ptr(); - } - - leadPFChargedHadrCand_.reset(); - leadPFNeutralCand_.reset(); - leadPFCand_.reset(); - ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - + - + - - - - - - - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + @@ -396,18 +136,8 @@ isolationTauChargedHadronCandidates_.reset(); - - - - (onfile.chargedPFCandidate_);]]> - + - - (cand));]]> - diff --git a/DataFormats/TauReco/src/classes_def_3.xml b/DataFormats/TauReco/src/classes_def_3.xml index 9a0a6657bac37..078b364f5081f 100644 --- a/DataFormats/TauReco/src/classes_def_3.xml +++ b/DataFormats/TauReco/src/classes_def_3.xml @@ -3,9 +3,8 @@ - - - + + @@ -23,31 +22,28 @@ - - - + + - + - - + + - - - + + + - - - - + + @@ -55,20 +51,18 @@ - - + + - - + + - - - - + + @@ -93,19 +87,19 @@ - - + + - - - - - - - - - + + + + + + + + + diff --git a/DataFormats/TauReco/src/classes_def_hlt.xml b/DataFormats/TauReco/src/classes_def_hlt.xml index 9ffc3a3973a82..0c3e1afb1c357 100644 --- a/DataFormats/TauReco/src/classes_def_hlt.xml +++ b/DataFormats/TauReco/src/classes_def_hlt.xml @@ -1,8 +1,8 @@ //Needed only for HLT-Open - - + + @@ -13,13 +13,13 @@ - - - + + + - - - + + + diff --git a/DataFormats/TestObjects/src/classes_def.xml b/DataFormats/TestObjects/src/classes_def.xml index 23c4c86180a24..2a3c5161336bd 100644 --- a/DataFormats/TestObjects/src/classes_def.xml +++ b/DataFormats/TestObjects/src/classes_def.xml @@ -1,61 +1,55 @@ - - + + - - + + - - - + + - - - + + - - + + - - - + + - - + + - - + + - - + + - - - + + - - + + - - - + + - - + + - - - + + @@ -109,17 +103,17 @@ - - + + - - + + - - + + - - + + @@ -135,8 +129,8 @@ - - + + @@ -166,8 +160,8 @@ - - + + @@ -175,12 +169,12 @@ - - + + - - + + @@ -221,42 +215,42 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/DataFormats/TotemReco/interface/TotemT2Digi.h b/DataFormats/TotemReco/interface/TotemT2Digi.h index ff1f7bec7f529..2eec5134a7f10 100644 --- a/DataFormats/TotemReco/interface/TotemT2Digi.h +++ b/DataFormats/TotemReco/interface/TotemT2Digi.h @@ -9,34 +9,36 @@ #ifndef DataFormats_TotemReco_TotemT2Digi_h #define DataFormats_TotemReco_TotemT2Digi_h -class TotemT2Digi { -public: - TotemT2Digi() = default; - TotemT2Digi(unsigned short id, unsigned char marker, unsigned short le, unsigned short te, unsigned char status); +namespace io_v1 { + class TotemT2Digi { + public: + TotemT2Digi() = default; + TotemT2Digi(unsigned short id, unsigned char marker, unsigned short le, unsigned short te, unsigned char status); - void setLeadingEdge(unsigned short le) { lead_edge_ = le; } - unsigned short leadingEdge() const { return lead_edge_; } - void setTrailingEdge(unsigned short te) { trail_edge_ = te; } - unsigned short trailingEdge() const { return trail_edge_; } - unsigned char status() const { return status_ & 0xF; } - bool hasLE() const { return marker_ & 0x1; } - bool hasTE() const { return marker_ & 0x2; } - bool hasManyLE() const { return marker_ & 0x4; } - bool hasManyTE() const { return marker_ & 0x8; } + void setLeadingEdge(unsigned short le) { lead_edge_ = le; } + unsigned short leadingEdge() const { return lead_edge_; } + void setTrailingEdge(unsigned short te) { trail_edge_ = te; } + unsigned short trailingEdge() const { return trail_edge_; } + unsigned char status() const { return status_ & 0xF; } + bool hasLE() const { return marker_ & 0x1; } + bool hasTE() const { return marker_ & 0x2; } + bool hasManyLE() const { return marker_ & 0x4; } + bool hasManyTE() const { return marker_ & 0x8; } -private: - /// New HW ID in ver 2.2 - unsigned short id_{0}; - /// Channel marker - unsigned char marker_{0}; - /// Leading edge time - unsigned short lead_edge_{0}; - /// Trailing edge time - unsigned short trail_edge_{0}; - /// Header status flags - unsigned char status_{0}; -}; - -bool operator<(const TotemT2Digi& lhs, const TotemT2Digi& rhs); + private: + /// New HW ID in ver 2.2 + unsigned short id_{0}; + /// Channel marker + unsigned char marker_{0}; + /// Leading edge time + unsigned short lead_edge_{0}; + /// Trailing edge time + unsigned short trail_edge_{0}; + /// Header status flags + unsigned char status_{0}; + }; + bool operator<(const TotemT2Digi& lhs, const TotemT2Digi& rhs); +} // namespace io_v1 +using TotemT2Digi = io_v1::TotemT2Digi; #endif diff --git a/DataFormats/TotemReco/src/TotemT2Digi.cc b/DataFormats/TotemReco/src/TotemT2Digi.cc index 47ffd2076e42c..4cf1733eb3096 100644 --- a/DataFormats/TotemReco/src/TotemT2Digi.cc +++ b/DataFormats/TotemReco/src/TotemT2Digi.cc @@ -1,17 +1,19 @@ #include "DataFormats/TotemReco/interface/TotemT2Digi.h" -TotemT2Digi::TotemT2Digi( - unsigned short id, unsigned char marker, unsigned short le, unsigned short te, unsigned char status) - : id_(id), marker_(marker), lead_edge_(le), trail_edge_(te), status_(status) {} +namespace io_v1 { + TotemT2Digi::TotemT2Digi( + unsigned short id, unsigned char marker, unsigned short le, unsigned short te, unsigned char status) + : id_(id), marker_(marker), lead_edge_(le), trail_edge_(te), status_(status) {} -bool operator<(const TotemT2Digi& lhs, const TotemT2Digi& rhs) { - if (lhs.leadingEdge() < rhs.leadingEdge()) - return true; - if (lhs.leadingEdge() > rhs.leadingEdge()) + bool operator<(const TotemT2Digi& lhs, const TotemT2Digi& rhs) { + if (lhs.leadingEdge() < rhs.leadingEdge()) + return true; + if (lhs.leadingEdge() > rhs.leadingEdge()) + return false; + if (lhs.trailingEdge() < rhs.trailingEdge()) + return true; + if (lhs.trailingEdge() > rhs.trailingEdge()) + return false; return false; - if (lhs.trailingEdge() < rhs.trailingEdge()) - return true; - if (lhs.trailingEdge() > rhs.trailingEdge()) - return false; - return false; -} + } +} // namespace io_v1 diff --git a/DataFormats/TotemReco/src/classes_def.xml b/DataFormats/TotemReco/src/classes_def.xml index 2f35479c49d5f..58ced04c1c785 100644 --- a/DataFormats/TotemReco/src/classes_def.xml +++ b/DataFormats/TotemReco/src/classes_def.xml @@ -1,14 +1,12 @@ - - - - + + - - - - - + + + + + diff --git a/DataFormats/TrackCandidate/src/classes_def.xml b/DataFormats/TrackCandidate/src/classes_def.xml index f5a5c805add54..ca931ad9c7a67 100644 --- a/DataFormats/TrackCandidate/src/classes_def.xml +++ b/DataFormats/TrackCandidate/src/classes_def.xml @@ -1,9 +1,6 @@ - - - - - + + diff --git a/DataFormats/TrackReco/BuildFile.xml b/DataFormats/TrackReco/BuildFile.xml index 3302383a1c33e..ffb81a6b97b0c 100644 --- a/DataFormats/TrackReco/BuildFile.xml +++ b/DataFormats/TrackReco/BuildFile.xml @@ -1,5 +1,4 @@ - diff --git a/DataFormats/TrackReco/interface/DeDxData.h b/DataFormats/TrackReco/interface/DeDxData.h index 5d52f352a456c..b366af52e0ecf 100644 --- a/DataFormats/TrackReco/interface/DeDxData.h +++ b/DataFormats/TrackReco/interface/DeDxData.h @@ -4,28 +4,32 @@ #include "DataFormats/Common/interface/ValueMap.h" namespace reco { + namespace io_v1 { - class DeDxData { - public: - DeDxData(); - DeDxData(float val, int nsat, unsigned int num); - DeDxData(float val, float er, int sat, unsigned int num); - virtual ~DeDxData(); - float dEdx() const; - float dEdxError() const; - int numberOfSaturatedMeasurements() const; - unsigned int numberOfMeasurements() const; - - private: - float value_; - float error_; - unsigned int numberOfMeasurements_; - int numberOfSatMeasurements_; - }; + class DeDxData { + public: + DeDxData(); + DeDxData(float val, int nsat, unsigned int num); + DeDxData(float val, float er, int sat, unsigned int num); + virtual ~DeDxData(); + float dEdx() const; + float dEdxError() const; + int numberOfSaturatedMeasurements() const; + unsigned int numberOfMeasurements() const; + + private: + float value_; + float error_; + unsigned int numberOfMeasurements_; + int numberOfSatMeasurements_; + }; + + } // namespace io_v1 + using DeDxData = io_v1::DeDxData; //Association Track -> float estimator - typedef std::vector DeDxDataCollection; - typedef edm::ValueMap DeDxDataValueMap; + typedef std::vector DeDxDataCollection; + typedef edm::ValueMap DeDxDataValueMap; // //Association Track -> float estimator //typedef edm::AssociationVector > DeDxDataCollection; diff --git a/DataFormats/TrackReco/interface/DeDxHitInfo.h b/DataFormats/TrackReco/interface/DeDxHitInfo.h index 43781bf587694..399a6f9acd735 100644 --- a/DataFormats/TrackReco/interface/DeDxHitInfo.h +++ b/DataFormats/TrackReco/interface/DeDxHitInfo.h @@ -11,110 +11,114 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class DeDxHitInfo { - public: - class DeDxHitInfoContainer { + namespace io_v1 { + class DeDxHitInfo { public: - DeDxHitInfoContainer() : charge_(0.0f), pathlength_(0.0f) {} - DeDxHitInfoContainer( - const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos, const uint8_t& type) - : charge_(charge), pathlength_(pathlength), detId_(detId), pos_(pos), type_(type) {} + class DeDxHitInfoContainer { + public: + DeDxHitInfoContainer() : charge_(0.0f), pathlength_(0.0f) {} + DeDxHitInfoContainer( + const float charge, const float pathlength, const DetId& detId, const LocalPoint& pos, const uint8_t& type) + : charge_(charge), pathlength_(pathlength), detId_(detId), pos_(pos), type_(type) {} - float charge() const { return charge_; } - float pathlength() const { return pathlength_; } - const DetId& detId() const { return detId_; } - const LocalPoint& pos() const { return pos_; } - const uint8_t& type() const { return type_; } + float charge() const { return charge_; } + float pathlength() const { return pathlength_; } + const DetId& detId() const { return detId_; } + const LocalPoint& pos() const { return pos_; } + const uint8_t& type() const { return type_; } - private: - //! total cluster charge - float charge_; - //! path length inside a module - float pathlength_; - DetId detId_; - //! hit position - LocalPoint pos_; - uint8_t type_; - }; + private: + //! total cluster charge + float charge_; + //! path length inside a module + float pathlength_; + DetId detId_; + //! hit position + LocalPoint pos_; + uint8_t type_; + }; - static constexpr int Complete = 0, Compatible = 1, Calibration = 2; - typedef std::vector DeDxHitInfoContainerCollection; + static constexpr int Complete = 0, Compatible = 1, Calibration = 2; + typedef std::vector DeDxHitInfoContainerCollection; - public: - DeDxHitInfo() {} - size_t size() const { return infos_.size(); } - float charge(size_t i) const { return infos_[i].charge(); } - float pathlength(size_t i) const { return infos_[i].pathlength(); } - DetId detId(size_t i) const { return infos_[i].detId(); } - const LocalPoint pos(size_t i) const { return infos_[i].pos(); } - const uint8_t type(size_t i) const { return infos_[i].type(); } - const SiPixelCluster* pixelCluster(size_t i) const { - size_t P = 0; - bool isPixel = false; - bool isFirst = true; - for (size_t j = 0; j <= i && j < infos_.size(); j++) { - if (detId(j).subdetId() < SiStripDetId::TIB) { - if (isFirst) - isFirst = false; - else - P++; - isPixel = true; - } else { - isPixel = false; + public: + DeDxHitInfo() {} + size_t size() const { return infos_.size(); } + float charge(size_t i) const { return infos_[i].charge(); } + float pathlength(size_t i) const { return infos_[i].pathlength(); } + DetId detId(size_t i) const { return infos_[i].detId(); } + const LocalPoint pos(size_t i) const { return infos_[i].pos(); } + const uint8_t type(size_t i) const { return infos_[i].type(); } + const SiPixelCluster* pixelCluster(size_t i) const { + size_t P = 0; + bool isPixel = false; + bool isFirst = true; + for (size_t j = 0; j <= i && j < infos_.size(); j++) { + if (detId(j).subdetId() < SiStripDetId::TIB) { + if (isFirst) + isFirst = false; + else + P++; + isPixel = true; + } else { + isPixel = false; + } } + if (isPixel && pixelClusters_.size() > P) { + return &(pixelClusters_[P]); + } + return nullptr; } - if (isPixel && pixelClusters_.size() > P) { - return &(pixelClusters_[P]); - } - return nullptr; - } - const SiStripCluster* stripCluster(size_t i) const { - size_t S = 0; - bool isStrip = false; - bool isFirst = true; - for (size_t j = 0; j <= i && j < infos_.size(); j++) { - if (detId(j).subdetId() >= SiStripDetId::TIB) { - if (isFirst) { - isFirst = false; - } else - S++; - isStrip = true; - } else { - isStrip = false; + const SiStripCluster* stripCluster(size_t i) const { + size_t S = 0; + bool isStrip = false; + bool isFirst = true; + for (size_t j = 0; j <= i && j < infos_.size(); j++) { + if (detId(j).subdetId() >= SiStripDetId::TIB) { + if (isFirst) { + isFirst = false; + } else + S++; + isStrip = true; + } else { + isStrip = false; + } } + if (isStrip && stripClusters_.size() > S) { + return &(stripClusters_[S]); + } + return nullptr; + } + const std::vector& stripClusters() const { return stripClusters_; } + const std::vector& pixelClusters() const { return pixelClusters_; } + + void addHit(const float charge, + const float pathlength, + const DetId& detId, + const LocalPoint& pos, + const uint8_t& type, + const SiStripCluster& stripCluster) { + infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); + stripClusters_.push_back(stripCluster); } - if (isStrip && stripClusters_.size() > S) { - return &(stripClusters_[S]); + void addHit(const float charge, + const float pathlength, + const DetId& detId, + const LocalPoint& pos, + const uint8_t& type, + const SiPixelCluster& pixelCluster) { + infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); + pixelClusters_.push_back(pixelCluster); } - return nullptr; - } - const std::vector& stripClusters() const { return stripClusters_; } - const std::vector& pixelClusters() const { return pixelClusters_; } - void addHit(const float charge, - const float pathlength, - const DetId& detId, - const LocalPoint& pos, - const uint8_t& type, - const SiStripCluster& stripCluster) { - infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); - stripClusters_.push_back(stripCluster); - } - void addHit(const float charge, - const float pathlength, - const DetId& detId, - const LocalPoint& pos, - const uint8_t& type, - const SiPixelCluster& pixelCluster) { - infos_.push_back(DeDxHitInfoContainer(charge, pathlength, detId, pos, type)); - pixelClusters_.push_back(pixelCluster); - } + private: + std::vector infos_; + std::vector stripClusters_; + std::vector pixelClusters_; + }; - private: - std::vector infos_; - std::vector stripClusters_; - std::vector pixelClusters_; - }; + } // namespace io_v1 + using DeDxHitInfo = io_v1::DeDxHitInfo; typedef std::vector DeDxHitInfoCollection; typedef edm::Ref DeDxHitInfoRef; diff --git a/DataFormats/TrackReco/interface/Track.h b/DataFormats/TrackReco/interface/Track.h index fb71268480e86..50673f87c1094 100644 --- a/DataFormats/TrackReco/interface/Track.h +++ b/DataFormats/TrackReco/interface/Track.h @@ -24,147 +24,149 @@ namespace reco { - class Track : public TrackBase { - public: - /// default constructor - Track() {} + namespace io_v1 { + class Track : public TrackBase { + public: + /// default constructor + Track() {} - /// virtual destructor - ~Track() override; + /// virtual destructor + ~Track() override; - /// constructor from fit parameters and error matrix - Track(double chi2, - double ndof, - const Point& referencePoint, - const Vector& momentum, - int charge, - const CovarianceMatrix&, - TrackAlgorithm = undefAlgorithm, - TrackQuality quality = undefQuality, - float t0 = 0, - float beta = 0, - float covt0t0 = -1., - float covbetabeta = -1.); + /// constructor from fit parameters and error matrix + Track(double chi2, + double ndof, + const Point& referencePoint, + const Vector& momentum, + int charge, + const CovarianceMatrix&, + TrackAlgorithm = undefAlgorithm, + TrackQuality quality = undefQuality, + float t0 = 0, + float beta = 0, + float covt0t0 = -1., + float covbetabeta = -1.); - /// return true if the outermost hit is valid - bool outerOk() const { return extra_.isNonnull() && extra_.isAvailable() && extra_->outerOk(); } + /// return true if the outermost hit is valid + bool outerOk() const { return extra_.isNonnull() && extra_.isAvailable() && extra_->outerOk(); } - /// return true if the innermost hit is valid - bool innerOk() const { return extra_.isNonnull() && extra_.isAvailable() && extra_->innerOk(); } + /// return true if the innermost hit is valid + bool innerOk() const { return extra_.isNonnull() && extra_.isAvailable() && extra_->innerOk(); } - /// position of the innermost hit - const math::XYZPoint& innerPosition() const { return extra_->innerPosition(); } + /// position of the innermost hit + const math::XYZPoint& innerPosition() const { return extra_->innerPosition(); } - /// momentum vector at the innermost hit position - const math::XYZVector& innerMomentum() const { return extra_->innerMomentum(); } + /// momentum vector at the innermost hit position + const math::XYZVector& innerMomentum() const { return extra_->innerMomentum(); } - /// position of the outermost hit - const math::XYZPoint& outerPosition() const { return extra_->outerPosition(); } + /// position of the outermost hit + const math::XYZPoint& outerPosition() const { return extra_->outerPosition(); } - /// momentum vector at the outermost hit position - const math::XYZVector& outerMomentum() const { return extra_->outerMomentum(); } + /// momentum vector at the outermost hit position + const math::XYZVector& outerMomentum() const { return extra_->outerMomentum(); } - /// outermost trajectory state curvilinear errors - CovarianceMatrix outerStateCovariance() const { return extra_->outerStateCovariance(); } + /// outermost trajectory state curvilinear errors + CovarianceMatrix outerStateCovariance() const { return extra_->outerStateCovariance(); } - /// innermost trajectory state curvilinear errors - CovarianceMatrix innerStateCovariance() const { return extra_->innerStateCovariance(); } + /// innermost trajectory state curvilinear errors + CovarianceMatrix innerStateCovariance() const { return extra_->innerStateCovariance(); } - /// fill outermost trajectory state curvilinear errors - CovarianceMatrix& fillOuter CMS_THREAD_SAFE(CovarianceMatrix& v) const { return extra_->fillOuter(v); } + /// fill outermost trajectory state curvilinear errors + CovarianceMatrix& fillOuter CMS_THREAD_SAFE(CovarianceMatrix& v) const { return extra_->fillOuter(v); } - CovarianceMatrix& fillInner CMS_THREAD_SAFE(CovarianceMatrix& v) const { return extra_->fillInner(v); } + CovarianceMatrix& fillInner CMS_THREAD_SAFE(CovarianceMatrix& v) const { return extra_->fillInner(v); } - /// DetId of the detector on which surface the outermost state is located - unsigned int outerDetId() const { return extra_->outerDetId(); } + /// DetId of the detector on which surface the outermost state is located + unsigned int outerDetId() const { return extra_->outerDetId(); } - /// DetId of the detector on which surface the innermost state is located - unsigned int innerDetId() const { return extra_->innerDetId(); } + /// DetId of the detector on which surface the innermost state is located + unsigned int innerDetId() const { return extra_->innerDetId(); } - /// Access to reconstructed hits on the track. - auto recHits() const { return extra_->recHits(); } + /// Access to reconstructed hits on the track. + auto recHits() const { return extra_->recHits(); } - /// Iterator to first hit on the track. - trackingRecHit_iterator recHitsBegin() const { return extra_->recHitsBegin(); } + /// Iterator to first hit on the track. + trackingRecHit_iterator recHitsBegin() const { return extra_->recHitsBegin(); } - /// Iterator to last hit on the track. - trackingRecHit_iterator recHitsEnd() const { return extra_->recHitsEnd(); } + /// Iterator to last hit on the track. + trackingRecHit_iterator recHitsEnd() const { return extra_->recHitsEnd(); } - /// Get i-th hit on the track. - TrackingRecHitRef recHit(size_t i) const { return extra_->recHit(i); } + /// Get i-th hit on the track. + TrackingRecHitRef recHit(size_t i) const { return extra_->recHit(i); } - /// Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits). - size_t recHitsSize() const { return extra_->recHitsSize(); } + /// Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits). + size_t recHitsSize() const { return extra_->recHitsSize(); } - /// x coordinate of momentum vector at the outermost hit position - double outerPx() const { return extra_->outerPx(); } + /// x coordinate of momentum vector at the outermost hit position + double outerPx() const { return extra_->outerPx(); } - /// y coordinate of momentum vector at the outermost hit position - double outerPy() const { return extra_->outerPy(); } + /// y coordinate of momentum vector at the outermost hit position + double outerPy() const { return extra_->outerPy(); } - /// z coordinate of momentum vector at the outermost hit position - double outerPz() const { return extra_->outerPz(); } + /// z coordinate of momentum vector at the outermost hit position + double outerPz() const { return extra_->outerPz(); } - /// x coordinate of the outermost hit position - double outerX() const { return extra_->outerX(); } + /// x coordinate of the outermost hit position + double outerX() const { return extra_->outerX(); } - /// y coordinate of the outermost hit position - double outerY() const { return extra_->outerY(); } + /// y coordinate of the outermost hit position + double outerY() const { return extra_->outerY(); } - /// z coordinate of the outermost hit position - double outerZ() const { return extra_->outerZ(); } + /// z coordinate of the outermost hit position + double outerZ() const { return extra_->outerZ(); } - /// magnitude of momentum vector at the outermost hit position - double outerP() const { return extra_->outerP(); } + /// magnitude of momentum vector at the outermost hit position + double outerP() const { return extra_->outerP(); } - /// transverse momentum at the outermost hit position - double outerPt() const { return extra_->outerPt(); } + /// transverse momentum at the outermost hit position + double outerPt() const { return extra_->outerPt(); } - /// azimuthal angle of the momentum vector at the outermost hit position - double outerPhi() const { return extra_->outerPhi(); } + /// azimuthal angle of the momentum vector at the outermost hit position + double outerPhi() const { return extra_->outerPhi(); } - /// pseudorapidity of the momentum vector at the outermost hit position - double outerEta() const { return extra_->outerEta(); } + /// pseudorapidity of the momentum vector at the outermost hit position + double outerEta() const { return extra_->outerEta(); } - /// polar angle of the momentum vector at the outermost hit position - double outerTheta() const { return extra_->outerTheta(); } + /// polar angle of the momentum vector at the outermost hit position + double outerTheta() const { return extra_->outerTheta(); } - /// polar radius of the outermost hit position - double outerRadius() const { return extra_->outerRadius(); } + /// polar radius of the outermost hit position + double outerRadius() const { return extra_->outerRadius(); } - /// set reference to "extra" object - void setExtra(const TrackExtraRef& ref) { extra_ = ref; } + /// set reference to "extra" object + void setExtra(const TrackExtraRef& ref) { extra_ = ref; } - /// reference to "extra" object - const TrackExtraRef& extra() const { return extra_; } + /// reference to "extra" object + const TrackExtraRef& extra() const { return extra_; } - /// Number of valid hits on track. - unsigned short found() const { return numberOfValidHits(); } + /// Number of valid hits on track. + unsigned short found() const { return numberOfValidHits(); } - /// Number of lost (=invalid) hits on track. - unsigned short lost() const { return numberOfLostHits(); } + /// Number of lost (=invalid) hits on track. + unsigned short lost() const { return numberOfLostHits(); } - /// direction of how the hits were sorted in the original seed - const PropagationDirection& seedDirection() const { return extra_->seedDirection(); } + /// direction of how the hits were sorted in the original seed + const PropagationDirection& seedDirection() const { return extra_->seedDirection(); } - /** return the edm::reference to the trajectory seed in the original + /** return the edm::reference to the trajectory seed in the original * seeds collection. If the collection has been dropped from the * Event, the reference may be invalid. Its validity should be tested, * before the reference is actually used. */ - const edm::RefToBase& seedRef() const { return extra_->seedRef(); } + const edm::RefToBase& seedRef() const { return extra_->seedRef(); } - /// get the residuals - const TrackResiduals& residuals() const { return extra_->residuals(); } + /// get the residuals + const TrackResiduals& residuals() const { return extra_->residuals(); } - // Check validity of track extra and rechits - bool recHitsOk() const { return extra_.isNonnull() && extra_.isAvailable() && extra_->recHitsOk(); } - - private: - /// Reference to additional information stored only on RECO. - TrackExtraRef extra_; - }; + // Check validity of track extra and rechits + bool recHitsOk() const { return extra_.isNonnull() && extra_.isAvailable() && extra_->recHitsOk(); } + private: + /// Reference to additional information stored only on RECO. + TrackExtraRef extra_; + }; + } // namespace io_v1 + using Track = io_v1::Track; } // namespace reco #endif diff --git a/DataFormats/TrackReco/interface/TrackExtra.h b/DataFormats/TrackReco/interface/TrackExtra.h index a12b19ef3e263..410d57b18394e 100644 --- a/DataFormats/TrackReco/interface/TrackExtra.h +++ b/DataFormats/TrackReco/interface/TrackExtra.h @@ -23,144 +23,147 @@ #include "FWCore/Utilities/interface/thread_safety_macros.h" namespace reco { - class TrackExtra : public TrackExtraBase { - public: - /// tracker parameter dimension - enum { dimension = 5 }; - /// track error matrix size - enum { covarianceSize = dimension * (dimension + 1) / 2 }; - /// point in the space - typedef math::XYZPoint Point; - /// spatial vector - typedef math::XYZVector Vector; - /// 5 parameter covariance matrix - typedef math::Error<5>::type CovarianceMatrix; - /// index type - typedef unsigned int index; + namespace io_v1 { + class TrackExtra : public TrackExtraBase { + public: + /// tracker parameter dimension + enum { dimension = 5 }; + /// track error matrix size + enum { covarianceSize = dimension * (dimension + 1) / 2 }; + /// point in the space + typedef math::XYZPoint Point; + /// spatial vector + typedef math::XYZVector Vector; + /// 5 parameter covariance matrix + typedef math::Error<5>::type CovarianceMatrix; + /// index type + typedef unsigned int index; - /// default constructor - TrackExtra() - : outerMomentum_(), - outerOk_(false), - outerDetId_(0), - innerPosition_(), - innerMomentum_(), - innerOk_(false), - innerDetId_(0), - seedDir_(anyDirection), - seedRef_() { - for (index i = 0; i < covarianceSize; ++i) { - outerCovariance_[i] = 0; - innerCovariance_[i] = 0; + /// default constructor + TrackExtra() + : outerMomentum_(), + outerOk_(false), + outerDetId_(0), + innerPosition_(), + innerMomentum_(), + innerOk_(false), + innerDetId_(0), + seedDir_(anyDirection), + seedRef_() { + for (index i = 0; i < covarianceSize; ++i) { + outerCovariance_[i] = 0; + innerCovariance_[i] = 0; + } } - } - /// constructor from outermost/innermost position and momentum and Seed information - TrackExtra(const Point &outerPosition, - const Vector &outerMomentum, - bool ok, - const Point &innerPosition, - const Vector &innerMomentum, - bool iok, - const CovarianceMatrix &outerState, - unsigned int outerId, - const CovarianceMatrix &innerState, - unsigned int innerId, - PropagationDirection seedDir, - edm::RefToBase seedRef = edm::RefToBase()); + /// constructor from outermost/innermost position and momentum and Seed information + TrackExtra(const Point &outerPosition, + const Vector &outerMomentum, + bool ok, + const Point &innerPosition, + const Vector &innerMomentum, + bool iok, + const CovarianceMatrix &outerState, + unsigned int outerId, + const CovarianceMatrix &innerState, + unsigned int innerId, + PropagationDirection seedDir, + edm::RefToBase seedRef = edm::RefToBase()); - /// outermost hit position - const Point &outerPosition() const { return outerPosition_; } - /// momentum vector at outermost hit position - const Vector &outerMomentum() const { return outerMomentum_; } - /// returns true if the outermost hit is valid - bool outerOk() const { return outerOk_; } - /// innermost hit position - const Point &innerPosition() const { return innerPosition_; } - /// momentum vector at innermost hit position - const Vector &innerMomentum() const { return innerMomentum_; } - /// returns true if the innermost hit is valid - bool innerOk() const { return innerOk_; } - /// x coordinate of momentum vector at the outermost hit position - double outerPx() const { return outerMomentum_.X(); } - /// y coordinate of momentum vector at the outermost hit position - double outerPy() const { return outerMomentum_.Y(); } - /// z coordinate of momentum vector at the outermost hit position - double outerPz() const { return outerMomentum_.Z(); } - /// x coordinate the outermost hit position - double outerX() const { return outerPosition_.X(); } - /// y coordinate the outermost hit position - double outerY() const { return outerPosition_.Y(); } - /// z coordinate the outermost hit position - double outerZ() const { return outerPosition_.Z(); } - /// magnitude of momentum vector at the outermost hit position - double outerP() const { return outerMomentum().R(); } - /// transverse momentum at the outermost hit position - double outerPt() const { return outerMomentum().Rho(); } - /// azimuthal angle of the momentum vector at the outermost hit position - double outerPhi() const { return outerMomentum().Phi(); } - /// pseudorapidity the momentum vector at the outermost hit position - double outerEta() const { return outerMomentum().Eta(); } - /// polar angle of the momentum vector at the outermost hit position - double outerTheta() const { return outerMomentum().Theta(); } - /// polar radius of the outermost hit position - double outerRadius() const { return outerPosition().Rho(); } + /// outermost hit position + const Point &outerPosition() const { return outerPosition_; } + /// momentum vector at outermost hit position + const Vector &outerMomentum() const { return outerMomentum_; } + /// returns true if the outermost hit is valid + bool outerOk() const { return outerOk_; } + /// innermost hit position + const Point &innerPosition() const { return innerPosition_; } + /// momentum vector at innermost hit position + const Vector &innerMomentum() const { return innerMomentum_; } + /// returns true if the innermost hit is valid + bool innerOk() const { return innerOk_; } + /// x coordinate of momentum vector at the outermost hit position + double outerPx() const { return outerMomentum_.X(); } + /// y coordinate of momentum vector at the outermost hit position + double outerPy() const { return outerMomentum_.Y(); } + /// z coordinate of momentum vector at the outermost hit position + double outerPz() const { return outerMomentum_.Z(); } + /// x coordinate the outermost hit position + double outerX() const { return outerPosition_.X(); } + /// y coordinate the outermost hit position + double outerY() const { return outerPosition_.Y(); } + /// z coordinate the outermost hit position + double outerZ() const { return outerPosition_.Z(); } + /// magnitude of momentum vector at the outermost hit position + double outerP() const { return outerMomentum().R(); } + /// transverse momentum at the outermost hit position + double outerPt() const { return outerMomentum().Rho(); } + /// azimuthal angle of the momentum vector at the outermost hit position + double outerPhi() const { return outerMomentum().Phi(); } + /// pseudorapidity the momentum vector at the outermost hit position + double outerEta() const { return outerMomentum().Eta(); } + /// polar angle of the momentum vector at the outermost hit position + double outerTheta() const { return outerMomentum().Theta(); } + /// polar radius of the outermost hit position + double outerRadius() const { return outerPosition().Rho(); } - /// outermost trajectory state curvilinear errors - CovarianceMatrix outerStateCovariance() const; - /// innermost trajectory state curvilinear errors - CovarianceMatrix innerStateCovariance() const; - /// fill outermost trajectory state curvilinear errors - CovarianceMatrix &fillOuter CMS_THREAD_SAFE(CovarianceMatrix &v) const; - /// fill outermost trajectory state curvilinear errors - CovarianceMatrix &fillInner CMS_THREAD_SAFE(CovarianceMatrix &v) const; - /// DetId of the detector on which surface the outermost state is located - unsigned int outerDetId() const { return outerDetId_; } - /// DetId of the detector on which surface the innermost state is located - unsigned int innerDetId() const { return innerDetId_; } - // direction how the hits were sorted in the original seed - const PropagationDirection &seedDirection() const { return seedDir_; } + /// outermost trajectory state curvilinear errors + CovarianceMatrix outerStateCovariance() const; + /// innermost trajectory state curvilinear errors + CovarianceMatrix innerStateCovariance() const; + /// fill outermost trajectory state curvilinear errors + CovarianceMatrix &fillOuter CMS_THREAD_SAFE(CovarianceMatrix &v) const; + /// fill outermost trajectory state curvilinear errors + CovarianceMatrix &fillInner CMS_THREAD_SAFE(CovarianceMatrix &v) const; + /// DetId of the detector on which surface the outermost state is located + unsigned int outerDetId() const { return outerDetId_; } + /// DetId of the detector on which surface the innermost state is located + unsigned int innerDetId() const { return innerDetId_; } + // direction how the hits were sorted in the original seed + const PropagationDirection &seedDirection() const { return seedDir_; } - /** return the edm::reference to the trajectory seed in the original + /** return the edm::reference to the trajectory seed in the original * seeds collection. If the collection has been dropped from the * Event, the reference may be invalid. Its validity should be tested, * before the reference is actually used. */ - const edm::RefToBase &seedRef() const { return seedRef_; } - void setSeedRef(const edm::RefToBase &r) { seedRef_ = r; } - /// set the residuals - void setResiduals(const TrackResiduals &r) { trackResiduals_ = r; } + const edm::RefToBase &seedRef() const { return seedRef_; } + void setSeedRef(const edm::RefToBase &r) { seedRef_ = r; } + /// set the residuals + void setResiduals(const TrackResiduals &r) { trackResiduals_ = r; } - /// get the residuals - const TrackResiduals &residuals() const { return trackResiduals_; } + /// get the residuals + const TrackResiduals &residuals() const { return trackResiduals_; } - private: - /// outermost hit position - Point outerPosition_; - /// momentum vector at outermost hit position - Vector outerMomentum_; - /// outermost hit validity flag - bool outerOk_; - /// outermost trajectory state curvilinear errors - float outerCovariance_[covarianceSize]; - unsigned int outerDetId_; + private: + /// outermost hit position + Point outerPosition_; + /// momentum vector at outermost hit position + Vector outerMomentum_; + /// outermost hit validity flag + bool outerOk_; + /// outermost trajectory state curvilinear errors + float outerCovariance_[covarianceSize]; + unsigned int outerDetId_; - /// innermost hit position - Point innerPosition_; - /// momentum vector at innermost hit position - Vector innerMomentum_; - /// innermost hit validity flag - bool innerOk_; - /// innermost trajectory state - float innerCovariance_[covarianceSize]; - unsigned int innerDetId_; + /// innermost hit position + Point innerPosition_; + /// momentum vector at innermost hit position + Vector innerMomentum_; + /// innermost hit validity flag + bool innerOk_; + /// innermost trajectory state + float innerCovariance_[covarianceSize]; + unsigned int innerDetId_; - PropagationDirection seedDir_; - edm::RefToBase seedRef_; + PropagationDirection seedDir_; + edm::RefToBase seedRef_; - /// unbiased track residuals - TrackResiduals trackResiduals_; - }; + /// unbiased track residuals + TrackResiduals trackResiduals_; + }; + } // namespace io_v1 + using TrackExtra = io_v1::TrackExtra; } // namespace reco diff --git a/DataFormats/TrackReco/interface/TrackExtraBase.h b/DataFormats/TrackReco/interface/TrackExtraBase.h index 198f76675559b..5315cbbd23641 100644 --- a/DataFormats/TrackReco/interface/TrackExtraBase.h +++ b/DataFormats/TrackReco/interface/TrackExtraBase.h @@ -18,75 +18,78 @@ #include "DataFormats/TrajectoryState/interface/LocalTrajectoryParameters.h" namespace reco { + namespace io_v1 { - class TrackExtraBase { - public: - using TrajParams = std::vector; - using Chi2sFive = std::vector; - - /// default constructor - TrackExtraBase() : m_firstHit((unsigned int)-1), m_nHits(0) {} - - void setHits(TrackingRecHitRefProd const& prod, unsigned firstH, unsigned int nH) { - m_hitCollection.pushBackItem(prod.refCore(), true); - m_firstHit = firstH; - m_nHits = nH; - } - - void setTrajParams(TrajParams tmps, Chi2sFive chi2s) { - m_trajParams = std::move(tmps); - m_chi2sX5 = std::move(chi2s); - } - - unsigned int firstRecHit() const { return m_firstHit; } - - /// number of RecHits - unsigned int recHitsSize() const { return m_nHits; } - - /// accessor to RecHits - auto recHits() const { return TrackingRecHitRange(recHitsBegin(), recHitsEnd()); } - - /// first iterator over RecHits - trackingRecHit_iterator recHitsBegin() const { return recHitsProduct().data().begin() + firstRecHit(); } - - /// last iterator over RecHits - trackingRecHit_iterator recHitsEnd() const { return recHitsBegin() + recHitsSize(); } - - /// get a ref to i-th recHit - TrackingRecHitRef recHitRef(unsigned int i) const { - //Another thread might change the RefCore at the same time. - // By using a copy we will be safe. - edm::RefCore hitCollection(m_hitCollection); - if (hitCollection.productPtr()) { - TrackingRecHitRef::finder_type finder; - TrackingRecHitRef::value_type const* item = - finder(*(static_cast(hitCollection.productPtr())), m_firstHit + i); - return TrackingRecHitRef(hitCollection.id(), item, m_firstHit + i); + class TrackExtraBase { + public: + using TrajParams = std::vector; + using Chi2sFive = std::vector; + + /// default constructor + TrackExtraBase() : m_firstHit((unsigned int)-1), m_nHits(0) {} + + void setHits(TrackingRecHitRefProd const& prod, unsigned firstH, unsigned int nH) { + m_hitCollection.pushBackItem(prod.refCore(), true); + m_firstHit = firstH; + m_nHits = nH; + } + + void setTrajParams(TrajParams tmps, Chi2sFive chi2s) { + m_trajParams = std::move(tmps); + m_chi2sX5 = std::move(chi2s); + } + + unsigned int firstRecHit() const { return m_firstHit; } + + /// number of RecHits + unsigned int recHitsSize() const { return m_nHits; } + + /// accessor to RecHits + auto recHits() const { return TrackingRecHitRange(recHitsBegin(), recHitsEnd()); } + + /// first iterator over RecHits + trackingRecHit_iterator recHitsBegin() const { return recHitsProduct().data().begin() + firstRecHit(); } + + /// last iterator over RecHits + trackingRecHit_iterator recHitsEnd() const { return recHitsBegin() + recHitsSize(); } + + /// get a ref to i-th recHit + TrackingRecHitRef recHitRef(unsigned int i) const { + //Another thread might change the RefCore at the same time. + // By using a copy we will be safe. + edm::RefCore hitCollection(m_hitCollection); + if (hitCollection.productPtr()) { + TrackingRecHitRef::finder_type finder; + TrackingRecHitRef::value_type const* item = finder( + *(static_cast(hitCollection.productPtr())), m_firstHit + i); + return TrackingRecHitRef(hitCollection.id(), item, m_firstHit + i); + } + return TrackingRecHitRef(hitCollection, m_firstHit + i); } - return TrackingRecHitRef(hitCollection, m_firstHit + i); - } - /// get i-th recHit - TrackingRecHitRef recHit(unsigned int i) const { return recHitRef(i); } + /// get i-th recHit + TrackingRecHitRef recHit(unsigned int i) const { return recHitRef(i); } - TrackingRecHitCollection const& recHitsProduct() const { - return *edm::getProduct(m_hitCollection); - } + TrackingRecHitCollection const& recHitsProduct() const { + return *edm::getProduct(m_hitCollection); + } - TrajParams const& trajParams() const { return m_trajParams; } - Chi2sFive const& chi2sX5() const { return m_chi2sX5; } + TrajParams const& trajParams() const { return m_trajParams; } + Chi2sFive const& chi2sX5() const { return m_chi2sX5; } - // Check validity of track rechits - bool recHitsOk() const { return m_hitCollection.isNonnull() && m_hitCollection.isAvailable(); } + // Check validity of track rechits + bool recHitsOk() const { return m_hitCollection.isNonnull() && m_hitCollection.isAvailable(); } - private: - edm::RefCore m_hitCollection; - unsigned int m_firstHit; - unsigned int m_nHits; - TrajParams m_trajParams; - Chi2sFive m_chi2sX5; // chi2 * 5 chopped at 255 (max chi2 is 51) - }; + private: + edm::RefCore m_hitCollection; + unsigned int m_firstHit; + unsigned int m_nHits; + TrajParams m_trajParams; + Chi2sFive m_chi2sX5; // chi2 * 5 chopped at 255 (max chi2 is 51) + }; + } // namespace io_v1 + using TrackExtraBase = io_v1::TrackExtraBase; } // namespace reco #endif // DataFormats_TrackReco_TrackExtraBase_h diff --git a/DataFormats/TrackReco/interface/TrackExtraFwd.h b/DataFormats/TrackReco/interface/TrackExtraFwd.h index 89896e4835430..21f82ea023982 100644 --- a/DataFormats/TrackReco/interface/TrackExtraFwd.h +++ b/DataFormats/TrackReco/interface/TrackExtraFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class TrackExtra; + namespace io_v1 { + class TrackExtra; + } + using TrackExtra = io_v1::TrackExtra; /// collection of TrackExtra objects typedef std::vector TrackExtraCollection; diff --git a/DataFormats/TrackReco/interface/TrackFwd.h b/DataFormats/TrackReco/interface/TrackFwd.h index e61f7488cc2db..759efd6ac2ecc 100644 --- a/DataFormats/TrackReco/interface/TrackFwd.h +++ b/DataFormats/TrackReco/interface/TrackFwd.h @@ -10,8 +10,10 @@ #include "DataFormats/Common/interface/Association.h" namespace reco { - - class Track; + namespace io_v1 { + class Track; + } + using Track = io_v1::Track; /// collection of Tracks typedef std::vector TrackCollection; diff --git a/DataFormats/TrackReco/src/classes_def.xml b/DataFormats/TrackReco/src/classes_def.xml index 90217c8ccd2b2..8acc6b54abcff 100644 --- a/DataFormats/TrackReco/src/classes_def.xml +++ b/DataFormats/TrackReco/src/classes_def.xml @@ -1,365 +1,50 @@ - - - - + + - - - + + - - - - - - - - - - - - - - + + - - - - - > 5); - uint8_t secondWordBits = bitEndOffset & (32 - 1); // that is, bitEndOffset % 32 - if (secondWordBits >= HitSize) { - // full block is in this word - uint8_t lowBitsToTrash = secondWordBits - HitSize; - return (hitPattern[secondWord] >> lowBitsToTrash) & ((1 << HitSize) - 1); - } else { - uint8_t firstWordBits = HitSize - secondWordBits; - uint32_t firstWordBlock = hitPattern[secondWord - 1] >> (32 - firstWordBits); - uint32_t secondWordBlock = hitPattern[secondWord] & ((1 << secondWordBits) - 1); - return firstWordBlock + (secondWordBlock << firstWordBits); - } - }; - - auto appendOldHitPattern = [&](const uint32_t pattern) { - // value used for those parameters needed by XXXDetId constructors - // but that we do not care about because they are not stored in the - // HitPattern. - const uint8_t DONT_CARE = 1; - - const static unsigned short HitTypeMask = 0x3; - const static unsigned short HitTypeOffset = 0; - - const static unsigned short SideMask = 0x1; - const static unsigned short SideOffset = 2; - - const static unsigned short LayerMask = 0xF; - const static unsigned short LayerOffset = 3; - - const static unsigned short SubstrMask = 0x7; - const static unsigned short SubstrOffset = 7; - - const static unsigned short SubDetectorMask = 0x1; - const static unsigned short SubDetectorOffset = 10; - - const uint32_t VALID_CONST = (uint32_t) TrackingRecHit::valid; - const uint32_t MISSING_CONST = (uint32_t) TrackingRecHit::missing; - const uint32_t INACTIVE_CONST = (uint32_t) TrackingRecHit::inactive; - const uint32_t BAD_CONST = (uint32_t) TrackingRecHit::bad; - - uint32_t rawHitType = (pattern >> HitTypeOffset) & HitTypeMask; - uint32_t layer = (pattern >> LayerOffset) & LayerMask; - uint32_t subdet = (pattern >> SubstrOffset) & SubstrMask; - uint32_t detector = (pattern >> SubDetectorOffset) & SubDetectorMask; - uint32_t stereo = (pattern >> SideOffset) & SideMask; - - // DetId::Tracker = 1 and DetId::Muon = 2 but - // in HitPattern Tracker = 1 and Muon = 0 so a conversion is needed: - if (detector == 0) { - detector = DetId::Muon; - } - - TrackingRecHit::Type hitType = TrackingRecHit::valid; - switch (rawHitType) { - case VALID_CONST: - hitType = TrackingRecHit::valid; - break; - case MISSING_CONST: - hitType = TrackingRecHit::missing; - break; - case INACTIVE_CONST: - hitType = TrackingRecHit::inactive; - break; - case BAD_CONST: - hitType = TrackingRecHit::bad; - break; - } - - DetId detId; - if (detector == DetId::Tracker) { - return newObj->appendTrackerHit(subdet, layer, stereo, hitType); - } else if (detector == DetId::Muon) { - switch (subdet) { - case MuonSubdetId::DT: { - uint32_t station = 1 + ((layer >> 2) & 0x3); - uint32_t superLayer = (layer & 0x3); - detId = DTLayerId(DONT_CARE, station, DONT_CARE, superLayer, DONT_CARE); - } - break; - case MuonSubdetId::CSC: { - uint32_t station = 1 + ((layer >> 2) & 0x3); - uint32_t ring = 1 + (layer & 0x3); - detId = CSCDetId(DONT_CARE, station, ring, DONT_CARE, DONT_CARE); - } - break; - case MuonSubdetId::RPC: { - uint32_t station = 1 + ((layer >> 2) & 0x3); - uint32_t region = layer & 0x1; - uint32_t layer_muon = 1 + ((station <= 2) ? ((layer >> 1) & 0x1) : 0); - detId = RPCDetId(region, DONT_CARE, station, DONT_CARE, layer_muon, DONT_CARE, DONT_CARE); - } - break; - } - return newObj->appendMuonHit(detId, hitType); - } - return false; - }; - - auto fillNewHitPatternWithOldHitPattern = [&](const uint32_t oldHitPattern[]) { - newObj->clear(); - for (int i = 0; i < MaxHits; i++) { - uint32_t pattern = getHitFromOldHitPattern(oldHitPattern, i); - if (pattern == 0) { - break; - } - if(!appendOldHitPattern(pattern)) { - return false; - } - } - return true; - }; - - fillNewHitPatternWithOldHitPattern(onfile.hitPattern_); - ]]> - - - - - > HitTypeOffset) & HitTypeMask; - uint16_t layer = (pattern >> LayerOffset) & LayerMask; - uint16_t subdet = (pattern >> SubstrOffset) & SubstrMask; - uint16_t detector = ((pattern >> SubDetectorOffset) & SubDetectorMask); - uint16_t stereo = (pattern >> SideOffset) & SideMask; - - // DetId::Tracker = 1 and DetId::Muon = 2 but - // in HitPattern Tracker = 1 and Muon = 0 so a conversion is needed: - if (detector == 0) { - detector = DetId::Muon; - } - - TrackingRecHit::Type hitType = TrackingRecHit::valid; - switch (rawHitType) { - case VALID_CONST: - hitType = TrackingRecHit::valid; - break; - case MISSING_CONST: - hitType = TrackingRecHit::missing; - break; - case INACTIVE_CONST: - hitType = TrackingRecHit::inactive; - break; - case BAD_CONST: - hitType = TrackingRecHit::bad; - break; - } - - if (category == HitPattern::MISSING_INNER_HITS) { - hitType = TrackingRecHit::missing_inner; - } else if (category == HitPattern::MISSING_OUTER_HITS) { - hitType = TrackingRecHit::missing_outer; - } - - DetId detId; - if (detector == DetId::Tracker) { - return newObj->appendTrackerHitPattern(subdet, layer, stereo, hitType); - } else if (detector == DetId::Muon) { - switch (subdet) { - case MuonSubdetId::DT: { - uint16_t station = 1 + (layer >> 2); - uint16_t superLayer = (layer & 0x3); - detId = DTLayerId(DONT_CARE, station, DONT_CARE, superLayer, DONT_CARE); - } - break; - case MuonSubdetId::CSC: { - uint16_t station = 1 + (layer >> 2); - uint16_t ring = 1 + (layer & 0x3); - detId = CSCDetId(DONT_CARE, station, ring, DONT_CARE, DONT_CARE); - } - break; - case MuonSubdetId::RPC: { - uint16_t station = 1 + ((layer >> 2) & 0x3); - uint16_t region = layer & 0x1; - uint16_t layer_muon = 1 + ((station <= 2) ? ((layer >> 1) & 0x1) : 0); - detId = RPCDetId(region, DONT_CARE, station, DONT_CARE, layer_muon, DONT_CARE, DONT_CARE); - } - break; - } - return newObj->appendMuonHitPattern(detId, hitType); - } - return false; - }; - - auto fillNewHitPatternFromNewHitPattern = [&](const HitPattern hitPattern, const HitPattern::HitCategory category) { - uint8_t hitCount = hitPattern.numberOfAllHits(HitPattern::TRACK_HITS); - for (int i = 0; i < hitCount; i++) { - uint16_t pattern = hitPattern.getHitPattern(HitPattern::TRACK_HITS, i); - if(!appendNewHitPattern(pattern, category)) { - return false; - } - } - return true; - }; - - auto mergeNewHitPatternsIntoOneNewHitPattern = [&](void) { - newObj->resetHitPattern(); - fillNewHitPatternFromNewHitPattern(onfile.hitPattern_, HitPattern::TRACK_HITS); - fillNewHitPatternFromNewHitPattern(onfile.trackerExpectedHitsInner_, HitPattern::MISSING_INNER_HITS); - fillNewHitPatternFromNewHitPattern(onfile.trackerExpectedHitsOuter_, HitPattern::MISSING_OUTER_HITS); - }; - - mergeNewHitPatternsIntoOneNewHitPattern(); - ]]> - - - - - - + + + - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -368,45 +53,43 @@ - - - - - - + + + + + + - + - + - + - + - + - + - + - - + + - - - - + + @@ -414,26 +97,25 @@ - + - + - + - + - + - + - - - + + @@ -444,78 +126,76 @@ - - - - + + + + - - + + - + - - + + - + - - + + - + - - + + - - + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + - - + + - - - + + - + - - - + + - + diff --git a/DataFormats/TrackerCommon/interface/ClusterSummary.h b/DataFormats/TrackerCommon/interface/ClusterSummary.h index 6808ebba395c3..1c80b14f953eb 100644 --- a/DataFormats/TrackerCommon/interface/ClusterSummary.h +++ b/DataFormats/TrackerCommon/interface/ClusterSummary.h @@ -57,102 +57,104 @@ The number of variables for each module is stored within iterator_ ********************************************************************************************/ -class ClusterSummary { -public: - ClusterSummary(); - //nSelections is the number of selections that you want to have - //It should be highest enum + 1 - ClusterSummary(const int nSelections); - ~ClusterSummary() {} - // copy ctor - ClusterSummary(const ClusterSummary& src); - // copy assingment operator - ClusterSummary& operator=(const ClusterSummary& rhs); +namespace io_v1 { + class ClusterSummary { + public: + ClusterSummary(); + //nSelections is the number of selections that you want to have + //It should be highest enum + 1 + ClusterSummary(const int nSelections); + ~ClusterSummary() {} + // copy ctor + ClusterSummary(const ClusterSummary& src); + // copy assingment operator + ClusterSummary& operator=(const ClusterSummary& rhs); #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__) - ClusterSummary(ClusterSummary&& other); + ClusterSummary(ClusterSummary&& other); #endif - // Enum for each partition within Tracker - enum CMSTracker { - STRIP = 0, - TIB = 1, - TOB = 2, - TID = 3, - TEC = 4, - PIXEL = 5, - FPIX = 6, - BPIX = 7, - NVALIDENUMS = 8, - NTRACKERENUMS = 100 + // Enum for each partition within Tracker + enum CMSTracker { + STRIP = 0, + TIB = 1, + TOB = 2, + TID = 3, + TEC = 4, + PIXEL = 5, + FPIX = 6, + BPIX = 7, + NVALIDENUMS = 8, + NTRACKERENUMS = 100 + }; + static const std::vector subDetNames; + static const std::vector > subDetSelections; + + // Enum which describes the ordering of the summary variables inside vector variables_ + enum VariablePlacement { NCLUSTERS, CLUSTERSIZE, CLUSTERCHARGE, NVARIABLES }; + static const std::vector variableNames; + + //===================+++++++++++++======================== + // + // Main methods to fill + // Variables + // + //===================+++++++++++++======================== + + //These functions are broken into two categories. The standard versions take the enums as input and find the locations in the vector. + //The ones labeled "byIndex" take the vector location as input + public: + int getNClusByIndex(const int mod) const { return nClus.at(mod); } + int getClusSizeByIndex(const int mod) const { return clusSize.at(mod); } + float getClusChargeByIndex(const int mod) const { return clusCharge.at(mod); } + + int getNClus(const CMSTracker mod, bool warn = true) const { + int pos = getModuleLocation(mod, warn); + return pos < 0 ? 0. : nClus[pos]; + } + int getClusSize(const CMSTracker mod, bool warn = true) const { + int pos = getModuleLocation(mod, warn); + return pos < 0 ? 0. : clusSize[pos]; + } + float getClusCharge(const CMSTracker mod, bool warn = true) const { + int pos = getModuleLocation(mod, warn); + return pos < 0 ? 0. : clusCharge[pos]; + } + + const std::vector& getNClusVector() const { return nClus; } + const std::vector& getClusSizeVector() const { return clusSize; } + const std::vector& getClusChargeVector() const { return clusCharge; } + + void addNClusByIndex(const int mod, const int val) { nClus.at(mod) += val; } + void addClusSizeByIndex(const int mod, const int val) { clusSize.at(mod) += val; } + void addClusChargeByIndex(const int mod, const float val) { clusCharge.at(mod) += val; } + + void addNClus(const CMSTracker mod, const int val, bool warn = true) { + nClus.at(getModuleLocation(mod, warn)) += val; + } + void addClusSize(const CMSTracker mod, const int val, bool warn = true) { + clusSize.at(getModuleLocation(mod, warn)) += val; + } + void addClusCharge(const CMSTracker mod, const float val, bool warn = true) { + clusCharge.at(getModuleLocation(mod, warn)) += val; + } + + const std::vector& getModules() const { return modules; } + // Return the location of desired module within modules_. If warn is set to true, a warnign will be outputed in case no module was found + int getModuleLocation(int mod, bool warn = true) const; + unsigned int getNumberOfModules() const { return modules.size(); } + int getModule(const int index) const { return modules[index]; } + + //copies over only non-zero entries into the current one + void copyNonEmpty(const ClusterSummary& src); + //Set values to 0 + void reset(); + + private: + std::vector modules; // + std::vector nClus; + std::vector clusSize; + std::vector clusCharge; }; - static const std::vector subDetNames; - static const std::vector > subDetSelections; - - // Enum which describes the ordering of the summary variables inside vector variables_ - enum VariablePlacement { NCLUSTERS, CLUSTERSIZE, CLUSTERCHARGE, NVARIABLES }; - static const std::vector variableNames; - - //===================+++++++++++++======================== - // - // Main methods to fill - // Variables - // - //===================+++++++++++++======================== - - //These functions are broken into two categories. The standard versions take the enums as input and find the locations in the vector. - //The ones labeled "byIndex" take the vector location as input -public: - int getNClusByIndex(const int mod) const { return nClus.at(mod); } - int getClusSizeByIndex(const int mod) const { return clusSize.at(mod); } - float getClusChargeByIndex(const int mod) const { return clusCharge.at(mod); } - - int getNClus(const CMSTracker mod, bool warn = true) const { - int pos = getModuleLocation(mod, warn); - return pos < 0 ? 0. : nClus[pos]; - } - int getClusSize(const CMSTracker mod, bool warn = true) const { - int pos = getModuleLocation(mod, warn); - return pos < 0 ? 0. : clusSize[pos]; - } - float getClusCharge(const CMSTracker mod, bool warn = true) const { - int pos = getModuleLocation(mod, warn); - return pos < 0 ? 0. : clusCharge[pos]; - } - - const std::vector& getNClusVector() const { return nClus; } - const std::vector& getClusSizeVector() const { return clusSize; } - const std::vector& getClusChargeVector() const { return clusCharge; } - - void addNClusByIndex(const int mod, const int val) { nClus.at(mod) += val; } - void addClusSizeByIndex(const int mod, const int val) { clusSize.at(mod) += val; } - void addClusChargeByIndex(const int mod, const float val) { clusCharge.at(mod) += val; } - - void addNClus(const CMSTracker mod, const int val, bool warn = true) { - nClus.at(getModuleLocation(mod, warn)) += val; - } - void addClusSize(const CMSTracker mod, const int val, bool warn = true) { - clusSize.at(getModuleLocation(mod, warn)) += val; - } - void addClusCharge(const CMSTracker mod, const float val, bool warn = true) { - clusCharge.at(getModuleLocation(mod, warn)) += val; - } - - const std::vector& getModules() const { return modules; } - // Return the location of desired module within modules_. If warn is set to true, a warnign will be outputed in case no module was found - int getModuleLocation(int mod, bool warn = true) const; - unsigned int getNumberOfModules() const { return modules.size(); } - int getModule(const int index) const { return modules[index]; } - - //copies over only non-zero entries into the current one - void copyNonEmpty(const ClusterSummary& src); - //Set values to 0 - void reset(); - -private: - std::vector modules; // - std::vector nClus; - std::vector clusSize; - std::vector clusCharge; -}; - +} // namespace io_v1 +using ClusterSummary = io_v1::ClusterSummary; #endif diff --git a/DataFormats/TrackerCommon/src/classes_def.xml b/DataFormats/TrackerCommon/src/classes_def.xml index 1c1a87a093428..a0dde0f90aa7d 100644 --- a/DataFormats/TrackerCommon/src/classes_def.xml +++ b/DataFormats/TrackerCommon/src/classes_def.xml @@ -1,6 +1,7 @@ - + + - + diff --git a/DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h b/DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h index 3b55cce07b2ea..fb8f117b7096b 100644 --- a/DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h +++ b/DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h @@ -10,153 +10,156 @@ //#define DO_INTERNAL_CHECKS_BTR //#define VI_DEBUG -class OmniClusterRef; - -class BaseTrackerRecHit : public TrackingRecHit { -public: - BaseTrackerRecHit() : qualWord_(0) {} - - // fake TTRH interface - BaseTrackerRecHit const* hit() const final { return this; } - - ~BaseTrackerRecHit() override {} - - // no position (as in persistent) - BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt) : TrackingRecHit(id, (unsigned int)(rt)), qualWord_(0) {} - BaseTrackerRecHit(const GeomDet& idet, trackerHitRTTI::RTTI rt) - : TrackingRecHit(idet, (unsigned int)(rt)), qualWord_(0) {} - - BaseTrackerRecHit(const LocalPoint& p, const LocalError& e, GeomDet const& idet, trackerHitRTTI::RTTI rt) - : TrackingRecHit(idet, (unsigned int)(rt)), pos_(p), err_(e), qualWord_(0) { - auto trackerDet = static_cast(det()); - LocalError lape = trackerDet->localAlignmentError(); - if (lape.valid()) - err_ = LocalError(err_.xx() + lape.xx(), err_.xy() + lape.xy(), err_.yy() + lape.yy()); - } - - trackerHitRTTI::RTTI rtti() const { return trackerHitRTTI::rtti(*this); } - bool isSingle() const { return trackerHitRTTI::isSingle(*this); } - bool isMatched() const { return trackerHitRTTI::isMatched(*this); } - bool isProjected() const { return trackerHitRTTI::isProjected(*this); } - bool isProjMono() const { return trackerHitRTTI::isProjMono(*this); } - bool isProjStereo() const { return trackerHitRTTI::isProjStereo(*this); } - bool isMulti() const { return trackerHitRTTI::isMulti(*this); } - - virtual bool isPixel() const { return false; } - virtual bool isPhase2() const { return false; } - - // used by trackMerger (to be improved) - virtual OmniClusterRef const& firstClusterRef() const = 0; - - // verify that hits can share clusters... - inline bool sameDetModule(TrackingRecHit const& hit) const; - - bool hasPositionAndError() const override; - - LocalPoint localPosition() const override { - check(); - return pos_; - } - - LocalError localPositionError() const override { - check(); - return err_; - } - const LocalPoint& localPositionFast() const { - check(); - return pos_; - } - const LocalError& localPositionErrorFast() const { - check(); - return err_; - } - - // to be specialized for 1D and 2D - void getKfComponents(KfComponentsHolder& holder) const override = 0; - int dimension() const override = 0; - - void getKfComponents1D(KfComponentsHolder& holder) const; - void getKfComponents2D(KfComponentsHolder& holder) const; - - // global coordinates - // Extension of the TrackingRecHit interface - const Surface* surface() const final { return &(det()->surface()); } - - GlobalPoint globalPosition() const final { return surface()->toGlobal(localPosition()); } - - GlobalError globalPositionError() const final { - return ErrorFrameTransformer().transform(localPositionError(), *surface()); - } - float errorGlobalR() const final { return std::sqrt(globalPositionError().rerr(globalPosition())); } - float errorGlobalZ() const final { return std::sqrt(globalPositionError().czz()); } - float errorGlobalRPhi() const final { - return globalPosition().perp() * sqrt(globalPositionError().phierr(globalPosition())); - } - - // once cache removed will obsolete the above - TrackingRecHitGlobalState globalState() const { - GlobalError globalError = ErrorFrameTransformer::transform(localPositionError(), *surface()); - GlobalPoint gp = globalPosition(); - float r = gp.perp(); - float errorRPhi = r * std::sqrt(float(globalError.phierr(gp))); - float errorR = std::sqrt(float(globalError.rerr(gp))); - float errorZ = std::sqrt(float(globalError.czz())); - return (TrackingRecHitGlobalState){gp.basicVector(), r, gp.barePhi(), errorR, errorZ, errorRPhi}; - } - - /// cluster probability, overloaded by pixel rechits. - virtual float clusterProbability() const { return 1.f; } - -public: - // obsolete (for what tracker is concerned...) interface - AlgebraicVector parameters() const override; - AlgebraicSymMatrix parametersError() const override; - AlgebraicMatrix projectionMatrix() const override; - -private: +#include "DataFormats/TrackerRecHit2D/interface/OmniClusterRefFwd.h" + +namespace io_v1 { + class BaseTrackerRecHit : public TrackingRecHit { + public: + BaseTrackerRecHit() : qualWord_(0) {} + + // fake TTRH interface + BaseTrackerRecHit const* hit() const final { return this; } + + ~BaseTrackerRecHit() override {} + + // no position (as in persistent) + BaseTrackerRecHit(DetId id, trackerHitRTTI::RTTI rt) : TrackingRecHit(id, (unsigned int)(rt)), qualWord_(0) {} + BaseTrackerRecHit(const GeomDet& idet, trackerHitRTTI::RTTI rt) + : TrackingRecHit(idet, (unsigned int)(rt)), qualWord_(0) {} + + BaseTrackerRecHit(const LocalPoint& p, const LocalError& e, GeomDet const& idet, trackerHitRTTI::RTTI rt) + : TrackingRecHit(idet, (unsigned int)(rt)), pos_(p), err_(e), qualWord_(0) { + auto trackerDet = static_cast(det()); + LocalError lape = trackerDet->localAlignmentError(); + if (lape.valid()) + err_ = LocalError(err_.xx() + lape.xx(), err_.xy() + lape.xy(), err_.yy() + lape.yy()); + } + + trackerHitRTTI::RTTI rtti() const { return trackerHitRTTI::rtti(*this); } + bool isSingle() const { return trackerHitRTTI::isSingle(*this); } + bool isMatched() const { return trackerHitRTTI::isMatched(*this); } + bool isProjected() const { return trackerHitRTTI::isProjected(*this); } + bool isProjMono() const { return trackerHitRTTI::isProjMono(*this); } + bool isProjStereo() const { return trackerHitRTTI::isProjStereo(*this); } + bool isMulti() const { return trackerHitRTTI::isMulti(*this); } + + virtual bool isPixel() const { return false; } + virtual bool isPhase2() const { return false; } + + // used by trackMerger (to be improved) + virtual OmniClusterRef const& firstClusterRef() const = 0; + + // verify that hits can share clusters... + inline bool sameDetModule(TrackingRecHit const& hit) const; + + bool hasPositionAndError() const override; + + LocalPoint localPosition() const override { + check(); + return pos_; + } + + LocalError localPositionError() const override { + check(); + return err_; + } + const LocalPoint& localPositionFast() const { + check(); + return pos_; + } + const LocalError& localPositionErrorFast() const { + check(); + return err_; + } + + // to be specialized for 1D and 2D + void getKfComponents(KfComponentsHolder& holder) const override = 0; + int dimension() const override = 0; + + void getKfComponents1D(KfComponentsHolder& holder) const; + void getKfComponents2D(KfComponentsHolder& holder) const; + + // global coordinates + // Extension of the TrackingRecHit interface + const Surface* surface() const final { return &(det()->surface()); } + + GlobalPoint globalPosition() const final { return surface()->toGlobal(localPosition()); } + + GlobalError globalPositionError() const final { + return ErrorFrameTransformer().transform(localPositionError(), *surface()); + } + float errorGlobalR() const final { return std::sqrt(globalPositionError().rerr(globalPosition())); } + float errorGlobalZ() const final { return std::sqrt(globalPositionError().czz()); } + float errorGlobalRPhi() const final { + return globalPosition().perp() * sqrt(globalPositionError().phierr(globalPosition())); + } + + // once cache removed will obsolete the above + TrackingRecHitGlobalState globalState() const { + GlobalError globalError = ErrorFrameTransformer::transform(localPositionError(), *surface()); + GlobalPoint gp = globalPosition(); + float r = gp.perp(); + float errorRPhi = r * std::sqrt(float(globalError.phierr(gp))); + float errorR = std::sqrt(float(globalError.rerr(gp))); + float errorZ = std::sqrt(float(globalError.czz())); + return (TrackingRecHitGlobalState){gp.basicVector(), r, gp.barePhi(), errorR, errorZ, errorRPhi}; + } + + /// cluster probability, overloaded by pixel rechits. + virtual float clusterProbability() const { return 1.f; } + + public: + // obsolete (for what tracker is concerned...) interface + AlgebraicVector parameters() const override; + AlgebraicSymMatrix parametersError() const override; + AlgebraicMatrix projectionMatrix() const override; + + private: #ifdef VI_DEBUG - void check() const { assert(det()); } + void check() const { assert(det()); } #elif defined(DO_INTERNAL_CHECKS_BTR) - void check() const; + void check() const; #else - static void check() {} + static void check() {} #endif -protected: - LocalPoint pos_; - LocalError err_; + protected: + LocalPoint pos_; + LocalError err_; -protected: - //this comes for free (padding) - unsigned int qualWord_; -}; + protected: + //this comes for free (padding) + unsigned int qualWord_; + }; -bool BaseTrackerRecHit::sameDetModule(TrackingRecHit const& hit) const { - unsigned int myid = geographicalId().rawId(); - unsigned int mysubd = myid >> (DetId::kSubdetOffset); + bool BaseTrackerRecHit::sameDetModule(TrackingRecHit const& hit) const { + unsigned int myid = geographicalId().rawId(); + unsigned int mysubd = myid >> (DetId::kSubdetOffset); - unsigned int id = hit.geographicalId().rawId(); - unsigned int subd = id >> (DetId::kSubdetOffset); + unsigned int id = hit.geographicalId().rawId(); + unsigned int subd = id >> (DetId::kSubdetOffset); - if (mysubd != subd) - return false; + if (mysubd != subd) + return false; - //Protection against invalid hits - if (!hit.isValid()) - return false; + //Protection against invalid hits + if (!hit.isValid()) + return false; - const unsigned int limdet = 10; // TIB=11 + const unsigned int limdet = 10; // TIB=11 - if (mysubd > limdet) { // strip - // mask glue and stereo - myid |= 3; - id |= 3; + if (mysubd > limdet) { // strip + // mask glue and stereo + myid |= 3; + id |= 3; + } + return id == myid; } - return id == myid; -} -// Comparison operators -inline bool operator<(const BaseTrackerRecHit& one, const BaseTrackerRecHit& other) { - return (one.geographicalId() < other.geographicalId()); -} + // Comparison operators + inline bool operator<(const BaseTrackerRecHit& one, const BaseTrackerRecHit& other) { + return (one.geographicalId() < other.geographicalId()); + } +} // namespace io_v1 +using BaseTrackerRecHit = io_v1::BaseTrackerRecHit; #endif // BaseTrackerRecHit_H diff --git a/DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h b/DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h index bf6566148a219..1034b5eadace6 100644 --- a/DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h +++ b/DataFormats/TrackerRecHit2D/interface/MTDTrackingRecHit.h @@ -7,27 +7,29 @@ #include "DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h" #include "DataFormats/FTLRecHit/interface/FTLRecHitCollections.h" -class MTDTrackingRecHit : public TrackerSingleRecHit { -public: - MTDTrackingRecHit() : TrackerSingleRecHit() {} +namespace io_v1 { + class MTDTrackingRecHit : public TrackerSingleRecHit { + public: + MTDTrackingRecHit() : TrackerSingleRecHit() {} - MTDTrackingRecHit(const LocalPoint& p, const LocalError& e, const GeomDet& idet, const FTLClusterRef& objref) - : TrackerSingleRecHit(p, e, idet, trackerHitRTTI::mipTiming, objref) {} + MTDTrackingRecHit(const LocalPoint& p, const LocalError& e, const GeomDet& idet, const FTLClusterRef& objref) + : TrackerSingleRecHit(p, e, idet, trackerHitRTTI::mipTiming, objref) {} - MTDTrackingRecHit* clone() const override { return new MTDTrackingRecHit(*this); } + MTDTrackingRecHit* clone() const override { return new MTDTrackingRecHit(*this); } - // things to specialize from BaseTrackerRecHit - bool isPhase2() const final { return true; } - void getKfComponents(KfComponentsHolder& holder) const final; + // things to specialize from BaseTrackerRecHit + bool isPhase2() const final { return true; } + void getKfComponents(KfComponentsHolder& holder) const final; - int dimension() const final { return 2; } - - //specific timing stuff - float energy() const { return omniCluster().mtdCluster().energy(); } - float time() const { return omniCluster().mtdCluster().time(); } - float timeError() const { return omniCluster().mtdCluster().timeError(); } -}; + int dimension() const final { return 2; } + //specific timing stuff + float energy() const { return omniCluster().mtdCluster().energy(); } + float time() const { return omniCluster().mtdCluster().time(); } + float timeError() const { return omniCluster().mtdCluster().timeError(); } + }; +} // namespace io_v1 +using MTDTrackingRecHit = io_v1::MTDTrackingRecHit; // Instantiations and specializations for FTLRecHitRef and reco::CaloClusterPtr #include "DataFormats/Common/interface/DetSetVector.h" typedef edmNew::DetSetVector MTDTrackingDetSetVector; diff --git a/DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h b/DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h index c6d9c0c87dd92..6a8a235ed1725 100644 --- a/DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h +++ b/DataFormats/TrackerRecHit2D/interface/OmniClusterRef.h @@ -9,102 +9,108 @@ #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/FTLRecHit/interface/FTLClusterCollections.h" -class OmniClusterRef { - static const unsigned int kInvalid = 0x80000000; // bit 31 on - static const unsigned int kIsStrip = 0x20000000; // bit 29 on - // FIXME:: need to check when introducing phase2 pixel - static const unsigned int kIsPhase2 = 0x40000000; // bit 30 on - static const unsigned int kIsTiming = 0x10000000; // bit 28 on - static const unsigned int kIsRegional = 0x60000000; // bit 30 and 29 on (will become fastsim???) - - static const unsigned int indexMask = 0xFFFFFF; - static const unsigned int subClusMask = 0xF000000; - static const unsigned int subClusShift = 24; - -public: - typedef edm::Ref, SiPixelCluster> ClusterPixelRef; - typedef edm::Ref, SiStripCluster> ClusterStripRef; - typedef edm::Ref, Phase2TrackerCluster1D> Phase2Cluster1DRef; - typedef edm::Ref ClusterMTDRef; - - OmniClusterRef() : me(edm::RefCore(), kInvalid) {} - OmniClusterRef(edm::ProductID const& id, SiStripCluster const* clu, unsigned int key) : me(id, clu, key | kIsStrip) {} - explicit OmniClusterRef(ClusterPixelRef const& ref, unsigned int subClus = 0) - : me(ref.refCore(), (ref.isNonnull() ? ref.key() | (subClus << subClusShift) : kInvalid)) {} - explicit OmniClusterRef(ClusterStripRef const& ref, unsigned int subClus = 0) - : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsStrip) | (subClus << subClusShift) : kInvalid)) {} - explicit OmniClusterRef(Phase2Cluster1DRef const& ref, unsigned int subClus = 0) - : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsPhase2) | (subClus << subClusShift) : kInvalid)) {} - explicit OmniClusterRef(ClusterMTDRef const& ref) - : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsTiming) : kInvalid)) {} - - ClusterPixelRef cluster_pixel() const { - return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(), index()) : ClusterPixelRef(); - } - - ClusterStripRef cluster_strip() const { - return isStrip() ? ClusterStripRef(me.toRefCore(), index()) : ClusterStripRef(); - } - - Phase2Cluster1DRef cluster_phase2OT() const { - return isPhase2() ? Phase2Cluster1DRef(me.toRefCore(), index()) : Phase2Cluster1DRef(); - } - - ClusterMTDRef cluster_mtd() const { return isTiming() ? ClusterMTDRef(me.toRefCore(), index()) : ClusterMTDRef(); } - - SiPixelCluster const& pixelCluster() const { return *ClusterPixelRef(me.toRefCore(), index()); } - SiStripCluster const& stripCluster() const { return *ClusterStripRef(me.toRefCore(), index()); } - Phase2TrackerCluster1D const& phase2OTCluster() const { return *Phase2Cluster1DRef(me.toRefCore(), index()); } - FTLCluster const& mtdCluster() const { return *ClusterMTDRef(me.toRefCore(), index()); } - - bool operator==(OmniClusterRef const& lh) const { - return rawIndex() == lh.rawIndex(); // in principle this is enough! - } - - bool operator<(OmniClusterRef const& lh) const { - return rawIndex() < lh.rawIndex(); // in principle this is enough! - } - - bool const stripOverlap(OmniClusterRef const& lh, bool includeEdges = true) const { - if (!isStrip()) - return false; - const auto& tc = stripCluster(); - const uint16_t tf = tc.firstStrip(); - const uint16_t tl = tf + tc.amplitudes().size() - 1; - const auto& oc = lh.stripCluster(); - const uint16_t of = oc.firstStrip(); - const uint16_t ol = of + oc.amplitudes().size() - 1; - // By default, include edge overlaps - // For single-strip clusters with non-matching edges, edge overlaps are excluded - if (((tl - tf) <= 1 || (ol - of) <= 1) && (tf != of || tl != ol)) - includeEdges = false; - const auto e = includeEdges ? 1 : 0; - // Check that last strip of "other" cluster is within first and last strip of "this", or viceversa - // Edge strips are considered for determining overlap (e=1) if includeEdges = true (default) - return (((ol + e) > tf && ol < (tl + e)) || ((tl + e) > of && tl < (ol + e))); - } - -public: - // edm Ref interface - /* auto */ edm::ProductID id() const { return me.id(); } - unsigned int key() const { return index(); } - - unsigned int rawIndex() const { return me.index(); } - - unsigned int index() const { return rawIndex() & indexMask; } - - unsigned int subCluster() const { return (rawIndex() & subClusMask) >> subClusShift; } - - bool isValid() const { return !(rawIndex() & kInvalid); } - bool isPixel() const { return !isStrip() && !isPhase2(); } //NOTE: non-valid will also show up as a pixel - bool isStrip() const { return rawIndex() & kIsStrip; } - bool isPhase2() const { return rawIndex() & kIsPhase2; } - bool isTiming() const { return rawIndex() & kIsTiming; } - // bool isRegional() const { return (rawIndex() & kIsRegional)==kIsRegional; } - // bool isNonRegionalStrip() const {return (rawIndex() & kIsRegional)==kIsStrip;} - -private: - edm::RefCoreWithIndex me; -}; +namespace io_v1 { + + class OmniClusterRef { + static const unsigned int kInvalid = 0x80000000; // bit 31 on + static const unsigned int kIsStrip = 0x20000000; // bit 29 on + // FIXME:: need to check when introducing phase2 pixel + static const unsigned int kIsPhase2 = 0x40000000; // bit 30 on + static const unsigned int kIsTiming = 0x10000000; // bit 28 on + static const unsigned int kIsRegional = 0x60000000; // bit 30 and 29 on (will become fastsim???) + + static const unsigned int indexMask = 0xFFFFFF; + static const unsigned int subClusMask = 0xF000000; + static const unsigned int subClusShift = 24; + + public: + typedef edm::Ref, SiPixelCluster> ClusterPixelRef; + typedef edm::Ref, SiStripCluster> ClusterStripRef; + typedef edm::Ref, Phase2TrackerCluster1D> Phase2Cluster1DRef; + typedef edm::Ref ClusterMTDRef; + + OmniClusterRef() : me(edm::RefCore(), kInvalid) {} + OmniClusterRef(edm::ProductID const& id, SiStripCluster const* clu, unsigned int key) + : me(id, clu, key | kIsStrip) {} + explicit OmniClusterRef(ClusterPixelRef const& ref, unsigned int subClus = 0) + : me(ref.refCore(), (ref.isNonnull() ? ref.key() | (subClus << subClusShift) : kInvalid)) {} + explicit OmniClusterRef(ClusterStripRef const& ref, unsigned int subClus = 0) + : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsStrip) | (subClus << subClusShift) : kInvalid)) {} + explicit OmniClusterRef(Phase2Cluster1DRef const& ref, unsigned int subClus = 0) + : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsPhase2) | (subClus << subClusShift) : kInvalid)) {} + explicit OmniClusterRef(ClusterMTDRef const& ref) + : me(ref.refCore(), (ref.isNonnull() ? (ref.key() | kIsTiming) : kInvalid)) {} + + ClusterPixelRef cluster_pixel() const { + return (isPixel() && isValid()) ? ClusterPixelRef(me.toRefCore(), index()) : ClusterPixelRef(); + } + + ClusterStripRef cluster_strip() const { + return isStrip() ? ClusterStripRef(me.toRefCore(), index()) : ClusterStripRef(); + } + + Phase2Cluster1DRef cluster_phase2OT() const { + return isPhase2() ? Phase2Cluster1DRef(me.toRefCore(), index()) : Phase2Cluster1DRef(); + } + + ClusterMTDRef cluster_mtd() const { return isTiming() ? ClusterMTDRef(me.toRefCore(), index()) : ClusterMTDRef(); } + + SiPixelCluster const& pixelCluster() const { return *ClusterPixelRef(me.toRefCore(), index()); } + SiStripCluster const& stripCluster() const { return *ClusterStripRef(me.toRefCore(), index()); } + Phase2TrackerCluster1D const& phase2OTCluster() const { return *Phase2Cluster1DRef(me.toRefCore(), index()); } + FTLCluster const& mtdCluster() const { return *ClusterMTDRef(me.toRefCore(), index()); } + + bool operator==(OmniClusterRef const& lh) const { + return rawIndex() == lh.rawIndex(); // in principle this is enough! + } + + bool operator<(OmniClusterRef const& lh) const { + return rawIndex() < lh.rawIndex(); // in principle this is enough! + } + + bool const stripOverlap(OmniClusterRef const& lh, bool includeEdges = true) const { + if (!isStrip()) + return false; + const auto& tc = stripCluster(); + const uint16_t tf = tc.firstStrip(); + const uint16_t tl = tf + tc.amplitudes().size() - 1; + const auto& oc = lh.stripCluster(); + const uint16_t of = oc.firstStrip(); + const uint16_t ol = of + oc.amplitudes().size() - 1; + // By default, include edge overlaps + // For single-strip clusters with non-matching edges, edge overlaps are excluded + if (((tl - tf) <= 1 || (ol - of) <= 1) && (tf != of || tl != ol)) + includeEdges = false; + const auto e = includeEdges ? 1 : 0; + // Check that last strip of "other" cluster is within first and last strip of "this", or viceversa + // Edge strips are considered for determining overlap (e=1) if includeEdges = true (default) + return (((ol + e) > tf && ol < (tl + e)) || ((tl + e) > of && tl < (ol + e))); + } + + public: + // edm Ref interface + /* auto */ edm::ProductID id() const { return me.id(); } + unsigned int key() const { return index(); } + + unsigned int rawIndex() const { return me.index(); } + + unsigned int index() const { return rawIndex() & indexMask; } + + unsigned int subCluster() const { return (rawIndex() & subClusMask) >> subClusShift; } + + bool isValid() const { return !(rawIndex() & kInvalid); } + bool isPixel() const { return !isStrip() && !isPhase2(); } //NOTE: non-valid will also show up as a pixel + bool isStrip() const { return rawIndex() & kIsStrip; } + bool isPhase2() const { return rawIndex() & kIsPhase2; } + bool isTiming() const { return rawIndex() & kIsTiming; } + // bool isRegional() const { return (rawIndex() & kIsRegional)==kIsRegional; } + // bool isNonRegionalStrip() const {return (rawIndex() & kIsRegional)==kIsStrip;} + + private: + edm::RefCoreWithIndex me; + }; + +} // namespace io_v1 +using OmniClusterRef = io_v1::OmniClusterRef; #endif // TrackerRecHit2D_OmniClusterRef_H diff --git a/DataFormats/TrackerRecHit2D/interface/OmniClusterRefFwd.h b/DataFormats/TrackerRecHit2D/interface/OmniClusterRefFwd.h new file mode 100644 index 0000000000000..878997da44af2 --- /dev/null +++ b/DataFormats/TrackerRecHit2D/interface/OmniClusterRefFwd.h @@ -0,0 +1,9 @@ +#ifndef TrackerRecHit2D_OmniClusterRefFwd_H +#define TrackerRecHit2D_OmniClusterRefFwd_H + +namespace io_v1 { + class OmniClusterRef; +} +using OmniClusterRef = io_v1::OmniClusterRef; + +#endif // TrackerRecHit2D_OmniClusterRefFwd_H diff --git a/DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h b/DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h index 6274f2f4419a6..43fe5c2b6a37d 100644 --- a/DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h +++ b/DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h @@ -8,81 +8,83 @@ /* a Hit composed by a "single" measurement * it has a reference to a cluster and a local position&error */ -class TrackerSingleRecHit : public BaseTrackerRecHit { -public: - typedef BaseTrackerRecHit Base; +namespace io_v1 { + class TrackerSingleRecHit : public BaseTrackerRecHit { + public: + typedef BaseTrackerRecHit Base; - TrackerSingleRecHit() {} + TrackerSingleRecHit() {} - typedef OmniClusterRef::ClusterPixelRef ClusterPixelRef; - typedef OmniClusterRef::ClusterStripRef ClusterStripRef; - typedef OmniClusterRef::Phase2Cluster1DRef ClusterPhase2Ref; - typedef OmniClusterRef::ClusterMTDRef ClusterMTDRef; + typedef OmniClusterRef::ClusterPixelRef ClusterPixelRef; + typedef OmniClusterRef::ClusterStripRef ClusterStripRef; + typedef OmniClusterRef::Phase2Cluster1DRef ClusterPhase2Ref; + typedef OmniClusterRef::ClusterMTDRef ClusterMTDRef; - // no position (as in persistent) - TrackerSingleRecHit(DetId id, OmniClusterRef const& clus) : Base(id, trackerHitRTTI::single), cluster_(clus) {} + // no position (as in persistent) + TrackerSingleRecHit(DetId id, OmniClusterRef const& clus) : Base(id, trackerHitRTTI::single), cluster_(clus) {} - template - TrackerSingleRecHit(const LocalPoint& p, const LocalError& e, GeomDet const& idet, CluRef const& clus) - : Base(p, e, idet, trackerHitRTTI::single), cluster_(clus) {} + template + TrackerSingleRecHit(const LocalPoint& p, const LocalError& e, GeomDet const& idet, CluRef const& clus) + : Base(p, e, idet, trackerHitRTTI::single), cluster_(clus) {} - // for projected or timing... - template - TrackerSingleRecHit( - const LocalPoint& p, const LocalError& e, GeomDet const& idet, trackerHitRTTI::RTTI rt, CluRef const& clus) - : Base(p, e, idet, rt), cluster_(clus) {} + // for projected or timing... + template + TrackerSingleRecHit( + const LocalPoint& p, const LocalError& e, GeomDet const& idet, trackerHitRTTI::RTTI rt, CluRef const& clus) + : Base(p, e, idet, rt), cluster_(clus) {} - // a single hit is on a detunit - const GeomDetUnit* detUnit() const override { return det(); } + // a single hit is on a detunit + const GeomDetUnit* detUnit() const override { return det(); } - // used by trackMerger (to be improved) - OmniClusterRef const& firstClusterRef() const final { return cluster_; } + // used by trackMerger (to be improved) + OmniClusterRef const& firstClusterRef() const final { return cluster_; } - OmniClusterRef const& omniClusterRef() const { return cluster_; } - OmniClusterRef const& omniCluster() const { return cluster_; } - // for rekeying... - OmniClusterRef& omniClusterRef() { return cluster_; } - OmniClusterRef& omniCluster() { return cluster_; } + OmniClusterRef const& omniClusterRef() const { return cluster_; } + OmniClusterRef const& omniCluster() const { return cluster_; } + // for rekeying... + OmniClusterRef& omniClusterRef() { return cluster_; } + OmniClusterRef& omniCluster() { return cluster_; } - ClusterPixelRef cluster_pixel() const { return cluster_.cluster_pixel(); } + ClusterPixelRef cluster_pixel() const { return cluster_.cluster_pixel(); } - ClusterStripRef cluster_strip() const { return cluster_.cluster_strip(); } + ClusterStripRef cluster_strip() const { return cluster_.cluster_strip(); } - ClusterPhase2Ref cluster_phase2OT() const { return cluster_.cluster_phase2OT(); } + ClusterPhase2Ref cluster_phase2OT() const { return cluster_.cluster_phase2OT(); } - ClusterMTDRef cluster_mtd() const { return cluster_.cluster_mtd(); } + ClusterMTDRef cluster_mtd() const { return cluster_.cluster_mtd(); } - SiStripCluster const& stripCluster() const { return cluster_.stripCluster(); } + SiStripCluster const& stripCluster() const { return cluster_.stripCluster(); } - SiPixelCluster const& pixelCluster() const { return cluster_.pixelCluster(); } + SiPixelCluster const& pixelCluster() const { return cluster_.pixelCluster(); } - Phase2TrackerCluster1D const& phase2OTCluster() const { return cluster_.phase2OTCluster(); } + Phase2TrackerCluster1D const& phase2OTCluster() const { return cluster_.phase2OTCluster(); } - FTLCluster const& mtdCluster() const { return cluster_.mtdCluster(); } + FTLCluster const& mtdCluster() const { return cluster_.mtdCluster(); } - // void setClusterRef(const & OmniClusterRef ref) { cluster_ =ref;} - void setClusterPixelRef(ClusterPixelRef const& ref) { cluster_ = OmniClusterRef(ref); } - void setClusterStripRef(ClusterStripRef const& ref) { cluster_ = OmniClusterRef(ref); } - void setClusterPhase2Ref(ClusterPhase2Ref const& ref) { cluster_ = OmniClusterRef(ref); } - void setClusterMTDRef(ClusterMTDRef const& ref) { cluster_ = OmniClusterRef(ref); } + // void setClusterRef(const & OmniClusterRef ref) { cluster_ =ref;} + void setClusterPixelRef(ClusterPixelRef const& ref) { cluster_ = OmniClusterRef(ref); } + void setClusterStripRef(ClusterStripRef const& ref) { cluster_ = OmniClusterRef(ref); } + void setClusterPhase2Ref(ClusterPhase2Ref const& ref) { cluster_ = OmniClusterRef(ref); } + void setClusterMTDRef(ClusterMTDRef const& ref) { cluster_ = OmniClusterRef(ref); } - bool sharesInput(const TrackingRecHit* other, SharedInputType what) const final; + bool sharesInput(const TrackingRecHit* other, SharedInputType what) const final; - bool sharesInput(TrackerSingleRecHit const& other) const { - if (cluster_.id() == other.cluster_.id()) - return (cluster_ == other.cluster_); - else { - const bool sameDetId = (geographicalId() == other.geographicalId()); - return (sameDetId) ? other.cluster_.stripOverlap(cluster_) : false; + bool sharesInput(TrackerSingleRecHit const& other) const { + if (cluster_.id() == other.cluster_.id()) + return (cluster_ == other.cluster_); + else { + const bool sameDetId = (geographicalId() == other.geographicalId()); + return (sameDetId) ? other.cluster_.stripOverlap(cluster_) : false; + } } - } - std::vector recHits() const override; - std::vector recHits() override; - -private: - // new game - OmniClusterRef cluster_; -}; + std::vector recHits() const override; + std::vector recHits() override; + private: + // new game + OmniClusterRef cluster_; + }; +} // namespace io_v1 +using TrackerSingleRecHit = io_v1::TrackerSingleRecHit; #endif diff --git a/DataFormats/TrackerRecHit2D/src/classes_def.xml b/DataFormats/TrackerRecHit2D/src/classes_def.xml index 8b5e76f74839d..c0e82d3360e38 100644 --- a/DataFormats/TrackerRecHit2D/src/classes_def.xml +++ b/DataFormats/TrackerRecHit2D/src/classes_def.xml @@ -1,67 +1,46 @@ - - - - + + - - - + + - - + + - - + + - - - - - + + - - - - - - - - + + - - - - + + - - - - - + + - - - - - - + + - - + + @@ -83,9 +62,8 @@ - - - + + @@ -93,21 +71,17 @@ // fastsim containers - - - + + - - - + + - - - + + - - - + + @@ -131,7 +105,7 @@ // phase2 containers - + @@ -142,15 +116,15 @@ - - + + - + - + diff --git a/DataFormats/TrackingRecHit/interface/TrackingRecHit.h b/DataFormats/TrackingRecHit/interface/TrackingRecHit.h index 084a786b27110..d4a91aabea46e 100644 --- a/DataFormats/TrackingRecHit/interface/TrackingRecHit.h +++ b/DataFormats/TrackingRecHit/interface/TrackingRecHit.h @@ -17,181 +17,185 @@ class TkCloner; class TrajectoryStateOnSurface; class KfComponentsHolder; +class MuonTransientTrackingRecHit; -class TrackingRecHit { -public: +namespace io_v1 { + class TrackingRecHit { + public: #ifndef __GCCXML__ - using RecHitPointer = std::shared_ptr; // requires to much editing - using ConstRecHitPointer = std::shared_ptr; + using RecHitPointer = std::shared_ptr; // requires to much editing + using ConstRecHitPointer = std::shared_ptr; #else - typedef TrackingRecHit const* RecHitPointer; - typedef TrackingRecHit const* ConstRecHitPointer; + typedef TrackingRecHit const* RecHitPointer; + typedef TrackingRecHit const* ConstRecHitPointer; #endif - typedef std::vector RecHitContainer; - typedef std::vector ConstRecHitContainer; + typedef std::vector RecHitContainer; + typedef std::vector ConstRecHitContainer; - friend class MuonTransientTrackingRecHit; + friend class ::MuonTransientTrackingRecHit; - typedef unsigned int id_type; + typedef unsigned int id_type; - /** Type of hits: + /** Type of hits: * valid = valid hit * mwissing = detector is good, but no rec hit found * inactive = detector is off, so there was no hope * bad = there were many bad strips within the ellipse (in Tracker) * = hit is compatible with the trajectory, but chi2 is too large (in Muon System) */ - enum Type { - valid = 0, - missing = 1, - inactive = 2, - bad = 3, - missing_inner = 4, - missing_outer = 5, - inactive_inner = 6, - inactive_outer = 7 - }; - static const int typeMask = 0xf; // mask for the above - static const int rttiShift = 24; // shift amount to get the rtti - - /// definition of equality via shared input - enum SharedInputType { all, some }; - - explicit TrackingRecHit(DetId id, Type type = valid) : m_id(id), m_status(type), m_det(nullptr) {} - explicit TrackingRecHit(id_type id = 0, Type type = valid) : m_id(id), m_status(type), m_det(nullptr) {} - TrackingRecHit(DetId id, unsigned int rt, Type type = valid) - : m_id(id), m_status((rt << rttiShift) | int(type)), m_det(nullptr) {} - - explicit TrackingRecHit(const GeomDet& idet, Type type = valid) - : m_id(idet.geographicalId()), m_status(type), m_det(&idet) {} - TrackingRecHit(const GeomDet& idet, unsigned int rt, Type type = valid) - : m_id(idet.geographicalId()), m_status((rt << rttiShift) | int(type)), m_det(&idet) {} - TrackingRecHit(const GeomDet& idet, TrackingRecHit const& rh) : m_id(rh.m_id), m_status(rh.m_status), m_det(&idet) {} - - virtual ~TrackingRecHit() {} - - // fake TTRH interface - virtual TrackingRecHit const* hit() const { return this; } - virtual TrackingRecHit* cloneHit() const { return clone(); } - - virtual TrackingRecHit* clone() const = 0; + enum Type { + valid = 0, + missing = 1, + inactive = 2, + bad = 3, + missing_inner = 4, + missing_outer = 5, + inactive_inner = 6, + inactive_outer = 7 + }; + static const int typeMask = 0xf; // mask for the above + static const int rttiShift = 24; // shift amount to get the rtti + + /// definition of equality via shared input + enum SharedInputType { all, some }; + + explicit TrackingRecHit(DetId id, Type type = valid) : m_id(id), m_status(type), m_det(nullptr) {} + explicit TrackingRecHit(id_type id = 0, Type type = valid) : m_id(id), m_status(type), m_det(nullptr) {} + TrackingRecHit(DetId id, unsigned int rt, Type type = valid) + : m_id(id), m_status((rt << rttiShift) | int(type)), m_det(nullptr) {} + + explicit TrackingRecHit(const GeomDet& idet, Type type = valid) + : m_id(idet.geographicalId()), m_status(type), m_det(&idet) {} + TrackingRecHit(const GeomDet& idet, unsigned int rt, Type type = valid) + : m_id(idet.geographicalId()), m_status((rt << rttiShift) | int(type)), m_det(&idet) {} + TrackingRecHit(const GeomDet& idet, TrackingRecHit const& rh) + : m_id(rh.m_id), m_status(rh.m_status), m_det(&idet) {} + + virtual ~TrackingRecHit() {} + + // fake TTRH interface + virtual TrackingRecHit const* hit() const { return this; } + virtual TrackingRecHit* cloneHit() const { return clone(); } + + virtual TrackingRecHit* clone() const = 0; #ifndef __GCCXML__ - virtual RecHitPointer cloneSH() const { return RecHitPointer(clone()); } - // clone and add the geom (ready for refit) - RecHitPointer cloneForFit(const GeomDet& idet) const { - auto cl = cloneSH(); - const_cast(*cl).setDet(idet); // const_cast (can be fixed editing some 100 files) - return cl; - } + virtual RecHitPointer cloneSH() const { return RecHitPointer(clone()); } + // clone and add the geom (ready for refit) + RecHitPointer cloneForFit(const GeomDet& idet) const { + auto cl = cloneSH(); + const_cast(*cl).setDet(idet); // const_cast (can be fixed editing some 100 files) + return cl; + } #endif - virtual void setDet(const GeomDet& idet) { m_det = &idet; } + virtual void setDet(const GeomDet& idet) { m_det = &idet; } - virtual AlgebraicVector parameters() const = 0; + virtual AlgebraicVector parameters() const = 0; - virtual AlgebraicSymMatrix parametersError() const = 0; + virtual AlgebraicSymMatrix parametersError() const = 0; - virtual AlgebraicMatrix projectionMatrix() const = 0; + virtual AlgebraicMatrix projectionMatrix() const = 0; - virtual void getKfComponents(KfComponentsHolder& holder) const; + virtual void getKfComponents(KfComponentsHolder& holder) const; - virtual int dimension() const = 0; + virtual int dimension() const = 0; - /// Access to component RecHits (if any) - virtual std::vector recHits() const = 0; - virtual void recHitsV(std::vector&) const; + /// Access to component RecHits (if any) + virtual std::vector recHits() const = 0; + virtual void recHitsV(std::vector&) const; - /// Non-const access to component RecHits (if any) - virtual std::vector recHits() = 0; - virtual void recHitsV(std::vector&); + /// Non-const access to component RecHits (if any) + virtual std::vector recHits() = 0; + virtual void recHitsV(std::vector&); #ifndef __GCCXML__ - virtual ConstRecHitContainer transientHits() const { - ConstRecHitContainer result; - std::vector hits; - recHitsV(hits); - for (auto h : hits) - result.push_back(h->cloneSH()); - return result; - } + virtual ConstRecHitContainer transientHits() const { + ConstRecHitContainer result; + std::vector hits; + recHitsV(hits); + for (auto h : hits) + result.push_back(h->cloneSH()); + return result; + } #endif - id_type rawId() const { return m_id; } - DetId geographicalId() const { return m_id; } + id_type rawId() const { return m_id; } + DetId geographicalId() const { return m_id; } - const GeomDet* det() const { return m_det; } - virtual const Surface* surface() const { return &(det()->surface()); } + const GeomDet* det() const { return m_det; } + virtual const Surface* surface() const { return &(det()->surface()); } - /// CAUTION: the GeomDetUnit* is zero for composite hits - /// (matched hits in the tracker, segments in the muon). - /// Always check this pointer before using it! - virtual const GeomDetUnit* detUnit() const; + /// CAUTION: the GeomDetUnit* is zero for composite hits + /// (matched hits in the tracker, segments in the muon). + /// Always check this pointer before using it! + virtual const GeomDetUnit* detUnit() const; - virtual LocalPoint localPosition() const = 0; + virtual LocalPoint localPosition() const = 0; - virtual LocalError localPositionError() const = 0; + virtual LocalError localPositionError() const = 0; - /// to be redefined by daughter class - virtual bool hasPositionAndError() const { return true; }; + /// to be redefined by daughter class + virtual bool hasPositionAndError() const { return true; }; - virtual float weight() const { return 1.; } + virtual float weight() const { return 1.; } - Type type() const { return Type(typeMask & m_status); } - Type getType() const { return Type(typeMask & m_status); } - bool isValid() const { return getType() == valid; } + Type type() const { return Type(typeMask & m_status); } + Type getType() const { return Type(typeMask & m_status); } + bool isValid() const { return getType() == valid; } - unsigned int getRTTI() const { return m_status >> rttiShift; } + unsigned int getRTTI() const { return m_status >> rttiShift; } - /** Returns true if the two TrackingRecHits are using the same input information + /** Returns true if the two TrackingRecHits are using the same input information * (like Digis, Clusters, etc), false otherwise. The second argument specifies * how much sharing is needed in order to return true: the value "all" * means that all inputs of the two hits must be identical; the value "some" means * that at least one of the inputs is in common. */ - virtual bool sharesInput(const TrackingRecHit* other, SharedInputType what) const; - - // global coordinates - - virtual GlobalPoint globalPosition() const; - virtual GlobalError globalPositionError() const; - - virtual float errorGlobalR() const; - virtual float errorGlobalZ() const; - virtual float errorGlobalRPhi() const; - - /// Returns true if the clone( const TrajectoryStateOnSurface&) method returns an - /// improved hit, false if it returns an identical copy. - /// In order to avoid redundent copies one should call canImproveWithTrack() before - /// calling clone( const TrajectoryStateOnSurface&). - ///this will be done inside the TkCloner itself - virtual bool canImproveWithTrack() const { return false; } - -private: - friend class TkCloner; - // double dispatch - virtual TrackingRecHit* clone_(TkCloner const&, TrajectoryStateOnSurface const&) const { - assert("clone" == nullptr); - return clone(); // default - } + virtual bool sharesInput(const TrackingRecHit* other, SharedInputType what) const; + + // global coordinates + + virtual GlobalPoint globalPosition() const; + virtual GlobalError globalPositionError() const; + + virtual float errorGlobalR() const; + virtual float errorGlobalZ() const; + virtual float errorGlobalRPhi() const; + + /// Returns true if the clone( const TrajectoryStateOnSurface&) method returns an + /// improved hit, false if it returns an identical copy. + /// In order to avoid redundent copies one should call canImproveWithTrack() before + /// calling clone( const TrajectoryStateOnSurface&). + ///this will be done inside the TkCloner itself + virtual bool canImproveWithTrack() const { return false; } + + private: + friend class ::TkCloner; + // double dispatch + virtual TrackingRecHit* clone_(TkCloner const&, TrajectoryStateOnSurface const&) const { + assert("clone" == nullptr); + return clone(); // default + } #ifndef __GCCXML__ - virtual RecHitPointer cloneSH_(TkCloner const&, TrajectoryStateOnSurface const&) const { - assert("cloneSH" == nullptr); - return cloneSH(); // default - } + virtual RecHitPointer cloneSH_(TkCloner const&, TrajectoryStateOnSurface const&) const { + assert("cloneSH" == nullptr); + return cloneSH(); // default + } #endif -protected: - // used by muon... - void setId(id_type iid) { m_id = iid; } - void setType(Type ttype) { m_status = ttype; } + protected: + // used by muon... + void setId(id_type iid) { m_id = iid; } + void setType(Type ttype) { m_status = ttype; } - void setRTTI(unsigned int rt) { m_status &= (rt << rttiShift); } // can be done only once... + void setRTTI(unsigned int rt) { m_status &= (rt << rttiShift); } // can be done only once... -private: - id_type m_id; + private: + id_type m_id; - unsigned int m_status; // bit assigned (type 0-8) (rtti 24-31) - - const GeomDet* m_det; -}; + unsigned int m_status; // bit assigned (type 0-8) (rtti 24-31) + const GeomDet* m_det; + }; +} // namespace io_v1 +using TrackingRecHit = io_v1::TrackingRecHit; #endif diff --git a/DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h b/DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h index b671814089b52..4f67a26d574ac 100644 --- a/DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h +++ b/DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h @@ -7,7 +7,10 @@ #include "DataFormats/Common/interface/OwnVector.h" #include "FWCore/Utilities/interface/Range.h" -class TrackingRecHit; +namespace io_v1 { + class TrackingRecHit; +} +using TrackingRecHit = io_v1::TrackingRecHit; /// collection of TrackingRecHits typedef edm::OwnVector TrackingRecHitCollection; /// persistent reference to a TrackingRecHit diff --git a/DataFormats/TrackingRecHit/src/classes_def.xml b/DataFormats/TrackingRecHit/src/classes_def.xml index 971d1af21d506..54ca948ff4e6c 100644 --- a/DataFormats/TrackingRecHit/src/classes_def.xml +++ b/DataFormats/TrackingRecHit/src/classes_def.xml @@ -1,45 +1,39 @@ - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - - + + + + + - - - - + + + + - + diff --git a/DataFormats/TrajectorySeed/interface/TrajectorySeed.h b/DataFormats/TrajectorySeed/interface/TrajectorySeed.h index ca7c76d5a6f6a..160ba8219f89a 100644 --- a/DataFormats/TrajectorySeed/interface/TrajectorySeed.h +++ b/DataFormats/TrajectorySeed/interface/TrajectorySeed.h @@ -15,54 +15,57 @@ - a vector of RecHits (with Own_vector to store polimorphic) - a propagation direction **/ -class TrajectorySeed { -public: - typedef edm::OwnVector RecHitContainer; - typedef edm::Range RecHitRange; +namespace io_v1 { + class TrajectorySeed { + public: + typedef edm::OwnVector RecHitContainer; + typedef edm::Range RecHitRange; - TrajectorySeed() {} - virtual ~TrajectorySeed() {} + TrajectorySeed() {} + virtual ~TrajectorySeed() {} - TrajectorySeed(PTrajectoryStateOnDet const& ptsos, RecHitContainer const& rh, PropagationDirection dir) - : hits_(rh), tsos_(ptsos), dir_(dir) {} + TrajectorySeed(PTrajectoryStateOnDet const& ptsos, RecHitContainer const& rh, PropagationDirection dir) + : hits_(rh), tsos_(ptsos), dir_(dir) {} - TrajectorySeed(PTrajectoryStateOnDet const& ptsos, RecHitContainer&& rh, PropagationDirection dir) noexcept - : hits_(std::move(rh)), tsos_(ptsos), dir_(dir) {} + TrajectorySeed(PTrajectoryStateOnDet const& ptsos, RecHitContainer&& rh, PropagationDirection dir) noexcept + : hits_(std::move(rh)), tsos_(ptsos), dir_(dir) {} - void swap(PTrajectoryStateOnDet& ptsos, RecHitContainer& rh, PropagationDirection& dir) noexcept { - hits_.swap(rh); - std::swap(tsos_, ptsos); - std::swap(dir_, dir); - } + void swap(PTrajectoryStateOnDet& ptsos, RecHitContainer& rh, PropagationDirection& dir) noexcept { + hits_.swap(rh); + std::swap(tsos_, ptsos); + std::swap(dir_, dir); + } - void swap(TrajectorySeed& rh) noexcept { - hits_.swap(rh.hits_); - std::swap(tsos_, rh.tsos_); - std::swap(dir_, rh.dir_); - } + void swap(TrajectorySeed& rh) noexcept { + hits_.swap(rh.hits_); + std::swap(tsos_, rh.tsos_); + std::swap(dir_, rh.dir_); + } - TrajectorySeed(TrajectorySeed const& o) = default; + TrajectorySeed(TrajectorySeed const& o) = default; - TrajectorySeed& operator=(TrajectorySeed const& o) = default; + TrajectorySeed& operator=(TrajectorySeed const& o) = default; - TrajectorySeed(TrajectorySeed&& o) noexcept = default; + TrajectorySeed(TrajectorySeed&& o) noexcept = default; - TrajectorySeed& operator=(TrajectorySeed&& o) noexcept = default; + TrajectorySeed& operator=(TrajectorySeed&& o) noexcept = default; - RecHitRange recHits() const { return {hits_.begin(), hits_.end()}; } - unsigned int nHits() const { return hits_.size(); } - PropagationDirection direction() const { return dir_; } - PTrajectoryStateOnDet const& startingState() const { return tsos_; } + RecHitRange recHits() const { return {hits_.begin(), hits_.end()}; } + unsigned int nHits() const { return hits_.size(); } + PropagationDirection direction() const { return dir_; } + PTrajectoryStateOnDet const& startingState() const { return tsos_; } - virtual TrajectorySeed* clone() const { return new TrajectorySeed(*this); } + virtual TrajectorySeed* clone() const { return new TrajectorySeed(*this); } -private: - RecHitContainer hits_; - PTrajectoryStateOnDet tsos_; - PropagationDirection dir_ = invalidDirection; -}; + private: + RecHitContainer hits_; + PTrajectoryStateOnDet tsos_; + PropagationDirection dir_ = invalidDirection; + }; -inline void swap(TrajectorySeed& rh, TrajectorySeed& lh) noexcept { rh.swap(lh); } + inline void swap(TrajectorySeed& rh, TrajectorySeed& lh) noexcept { rh.swap(lh); } +} // namespace io_v1 +using TrajectorySeed = io_v1::TrajectorySeed; typedef TrajectorySeed BasicTrajectorySeed; diff --git a/DataFormats/TrajectorySeed/interface/TrajectorySeedFwd.h b/DataFormats/TrajectorySeed/interface/TrajectorySeedFwd.h index 593a99fe32bcc..1013175c3b926 100644 --- a/DataFormats/TrajectorySeed/interface/TrajectorySeedFwd.h +++ b/DataFormats/TrajectorySeed/interface/TrajectorySeedFwd.h @@ -1,6 +1,8 @@ #ifndef DataFormats_TrajectorySeed_TrajectorySeedFwd_h #define DataFormats_TrajectorySeed_TrajectorySeedFwd_h -class TrajectorySeed; - +namespace io_v1 { + class TrajectorySeed; +} +using TrajectorySeed = io_v1::TrajectorySeed; #endif diff --git a/DataFormats/TrajectorySeed/src/classes_def.xml b/DataFormats/TrajectorySeed/src/classes_def.xml index 2b9db6a7d6096..1eb3e296721dc 100644 --- a/DataFormats/TrajectorySeed/src/classes_def.xml +++ b/DataFormats/TrajectorySeed/src/classes_def.xml @@ -1,24 +1,24 @@ - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - - + + + + diff --git a/DataFormats/TrajectoryState/src/classes_def.xml b/DataFormats/TrajectoryState/src/classes_def.xml index 156ed3d314c8e..3a90e1a1c0a06 100644 --- a/DataFormats/TrajectoryState/src/classes_def.xml +++ b/DataFormats/TrajectoryState/src/classes_def.xml @@ -1,13 +1,9 @@ - - - - + + - - - - + + diff --git a/DataFormats/V0Candidate/src/classes_def.xml b/DataFormats/V0Candidate/src/classes_def.xml index c43299c0a237e..2f9574ef344fe 100755 --- a/DataFormats/V0Candidate/src/classes_def.xml +++ b/DataFormats/V0Candidate/src/classes_def.xml @@ -1,9 +1,7 @@ - - - - + + diff --git a/DataFormats/VertexReco/interface/Vertex.h b/DataFormats/VertexReco/interface/Vertex.h index cec37f5b52205..c06d8557452e6 100644 --- a/DataFormats/VertexReco/interface/Vertex.h +++ b/DataFormats/VertexReco/interface/Vertex.h @@ -29,213 +29,214 @@ #include "DataFormats/Math/interface/LorentzVector.h" namespace reco { + namespace io_v1 { - class Track; - - class Vertex { - public: - /// The iteratator for the vector - typedef std::vector::const_iterator trackRef_iterator; - /// point in the space - typedef math::XYZPoint Point; - /// error matrix dimension - constexpr static int dimension = 3; - constexpr static int dimension4D = 4; - /// covariance error matrix (3x3) - typedef math::Error::type Error; - /// covariance error matrix (3x3) - typedef math::Error::type CovarianceMatrix; - /// covariance error matrix (4x4) - typedef math::Error::type Error4D; - /// covariance error matrix (4x4) - typedef math::Error::type CovarianceMatrix4D; - /// matix size - constexpr static int size = dimension * (dimension + 1) / 2, size4D = (dimension4D) * (dimension4D + 1) / 2; - /// index type - typedef unsigned int index; - /// default constructor - The vertex will not be valid. Position, error, - /// chi2, ndof will have random entries, and the vectors of tracks will be empty - /// Use the isValid method to check that your vertex is valid. - Vertex() : chi2_(0.0), ndof_(0), position_(0., 0., 0.), time_(0.) { - validity_ = false; - for (int i = 0; i < size4D; ++i) - covariance_[i] = 0.; - } - /// Constructor for a fake vertex. - Vertex(const Point &, const Error &); - /// Constructor for a fake vertex. 4D - Vertex(const Point &, const Error4D &, double); - /// constructor for a valid vertex, with all data - Vertex(const Point &, const Error &, double chi2, double ndof, size_t size); - /// constructor for a valid vertex, with all data 4D - Vertex(const Point &, const Error4D &, double time, double chi2, double ndof, size_t size); - /// Tells whether the vertex is valid. - bool isValid() const { return validity_; } - /// Tells whether a Vertex is fake, i.e. not a vertex made out of a proper - /// fit with tracks. - /// For a primary vertex, it could simply be the beam line. - bool isFake() const { return (chi2_ == 0 && ndof_ == 0 && tracks_.empty()); } - /// reserve space for the tracks - void reserve(int size, bool refitAsWell = false) { - tracks_.reserve(size); - if (refitAsWell) - refittedTracks_.reserve(size); - weights_.reserve(size); - } - /// add a reference to a Track - template - void add(Ref const &r, float w = 1.0) { - tracks_.emplace_back(r); - weights_.emplace_back(w * 255.f); - } - /// add the original a Track(reference) and the smoothed Track - void add(const TrackBaseRef &r, const Track &refTrack, float w = 1.0); - void removeTracks(); - - ///returns the weight with which a Track has contributed to the vertex-fit. - template - float trackWeight(const TREF &r) const { - int i = 0; - for (auto const &t : tracks_) { - if ((r.id() == t.id()) && (t.key() == r.key())) - return weights_[i] / 255.f; - ++i; + class Vertex { + public: + /// The iteratator for the vector + typedef std::vector::const_iterator trackRef_iterator; + /// point in the space + typedef math::XYZPoint Point; + /// error matrix dimension + constexpr static int dimension = 3; + constexpr static int dimension4D = 4; + /// covariance error matrix (3x3) + typedef math::Error::type Error; + /// covariance error matrix (3x3) + typedef math::Error::type CovarianceMatrix; + /// covariance error matrix (4x4) + typedef math::Error::type Error4D; + /// covariance error matrix (4x4) + typedef math::Error::type CovarianceMatrix4D; + /// matix size + constexpr static int size = dimension * (dimension + 1) / 2, size4D = (dimension4D) * (dimension4D + 1) / 2; + /// index type + typedef unsigned int index; + /// default constructor - The vertex will not be valid. Position, error, + /// chi2, ndof will have random entries, and the vectors of tracks will be empty + /// Use the isValid method to check that your vertex is valid. + Vertex() : chi2_(0.0), ndof_(0), position_(0., 0., 0.), time_(0.) { + validity_ = false; + for (int i = 0; i < size4D; ++i) + covariance_[i] = 0.; + } + /// Constructor for a fake vertex. + Vertex(const Point &, const Error &); + /// Constructor for a fake vertex. 4D + Vertex(const Point &, const Error4D &, double); + /// constructor for a valid vertex, with all data + Vertex(const Point &, const Error &, double chi2, double ndof, size_t size); + /// constructor for a valid vertex, with all data 4D + Vertex(const Point &, const Error4D &, double time, double chi2, double ndof, size_t size); + /// Tells whether the vertex is valid. + bool isValid() const { return validity_; } + /// Tells whether a Vertex is fake, i.e. not a vertex made out of a proper + /// fit with tracks. + /// For a primary vertex, it could simply be the beam line. + bool isFake() const { return (chi2_ == 0 && ndof_ == 0 && tracks_.empty()); } + /// reserve space for the tracks + void reserve(int size, bool refitAsWell = false) { + tracks_.reserve(size); + if (refitAsWell) + refittedTracks_.reserve(size); + weights_.reserve(size); + } + /// add a reference to a Track + template + void add(Ref const &r, float w = 1.0) { + tracks_.emplace_back(r); + weights_.emplace_back(w * 255.f); } - return 0; - } - // track collections - auto const &tracks() const { return tracks_; } - /// first iterator over tracks - trackRef_iterator tracks_begin() const { return tracks_.begin(); } - /// last iterator over tracks - trackRef_iterator tracks_end() const { return tracks_.end(); } - /// number of tracks - size_t tracksSize() const { return tracks_.size(); } - /// python friendly track getting - const TrackBaseRef &trackRefAt(size_t idx) const { return tracks_[idx]; } - /// chi-squares - double chi2() const { return chi2_; } - /** Number of degrees of freedom + /// add the original a Track(reference) and the smoothed Track + void add(const TrackBaseRef &r, const Track &refTrack, float w = 1.0); + void removeTracks(); + + ///returns the weight with which a Track has contributed to the vertex-fit. + template + float trackWeight(const TREF &r) const { + int i = 0; + for (auto const &t : tracks_) { + if ((r.id() == t.id()) && (t.key() == r.key())) + return weights_[i] / 255.f; + ++i; + } + return 0; + } + // track collections + auto const &tracks() const { return tracks_; } + /// first iterator over tracks + trackRef_iterator tracks_begin() const { return tracks_.begin(); } + /// last iterator over tracks + trackRef_iterator tracks_end() const { return tracks_.end(); } + /// number of tracks + size_t tracksSize() const { return tracks_.size(); } + /// python friendly track getting + const TrackBaseRef &trackRefAt(size_t idx) const { return tracks_[idx]; } + /// chi-squares + double chi2() const { return chi2_; } + /** Number of degrees of freedom * Meant to be Double32_t for soft-assignment fitters: * tracks may contribute to the vertex with fractional weights. * The ndof is then = to the sum of the track weights. * see e.g. CMS NOTE-2006/032, CMS NOTE-2004/002 */ - double ndof() const { return ndof_; } - /// chi-squared divided by n.d.o.f. - double normalizedChi2() const { return ndof_ != 0 ? chi2_ / ndof_ : chi2_ * 1e6; } - /// position - const Point &position() const { return position_; } - /// x coordinate - double x() const { return position_.X(); } - /// y coordinate - double y() const { return position_.Y(); } - /// z coordinate - double z() const { return position_.Z(); } - /// t coordinate - double t() const { return time_; } - /// error on x - double xError() const { return sqrt(covariance(0, 0)); } - /// error on y - double yError() const { return sqrt(covariance(1, 1)); } - /// error on z - double zError() const { return sqrt(covariance(2, 2)); } - /// error on t - double tError() const { return sqrt(covariance(3, 3)); } - /// (i, j)-th element of error matrix, i, j = 0, ... 2 - // Note that: - // double error( int i, int j ) const - // is OBSOLETE, use covariance(i, j) - double covariance(int i, int j) const { return covariance_[idx(i, j)]; } - /// return SMatrix - CovarianceMatrix covariance() const { - Error m; - fill(m); - return m; - } - /// return SMatrix 4D - CovarianceMatrix4D covariance4D() const { - Error4D m; - fill(m); - return m; - } - - /// return SMatrix - Error error() const { - Error m; - fill(m); - return m; - } - /// return SMatrix - Error4D error4D() const { - Error4D m; - fill(m); - return m; - } - - /// fill SMatrix - void fill(CovarianceMatrix &v) const; - /// 4D version - void fill(CovarianceMatrix4D &v) const; - - /// Checks whether refitted tracks are stored. - bool hasRefittedTracks() const { return !refittedTracks_.empty(); } - - /// Returns the original track which corresponds to a particular refitted Track - /// Throws an exception if now refitted tracks are stored ot the track is not found in the list - TrackBaseRef originalTrack(const Track &refTrack) const; - - /// Returns the refitted track which corresponds to a particular original Track - /// Throws an exception if now refitted tracks are stored ot the track is not found in the list - Track refittedTrack(const TrackBaseRef &track) const; - - /// Returns the refitted track which corresponds to a particular original Track - /// Throws an exception if now refitted tracks are stored ot the track is not found in the list - Track refittedTrack(const TrackRef &track) const; - - /// Returns the container of refitted tracks - const std::vector &refittedTracks() const { return refittedTracks_; } - - /// Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products - math::XYZTLorentzVectorD p4(float mass = 0.13957018, float minWeight = 0.5) const; - - /// Returns the number of tracks in the vertex with weight above minWeight - unsigned int nTracks(float minWeight = 0.5) const; - - class TrackEqual { - public: - TrackEqual(const Track &t) : track_(t) {} - bool operator()(const Track &t) const { return t.pt() == track_.pt(); } + double ndof() const { return ndof_; } + /// chi-squared divided by n.d.o.f. + double normalizedChi2() const { return ndof_ != 0 ? chi2_ / ndof_ : chi2_ * 1e6; } + /// position + const Point &position() const { return position_; } + /// x coordinate + double x() const { return position_.X(); } + /// y coordinate + double y() const { return position_.Y(); } + /// z coordinate + double z() const { return position_.Z(); } + /// t coordinate + double t() const { return time_; } + /// error on x + double xError() const { return sqrt(covariance(0, 0)); } + /// error on y + double yError() const { return sqrt(covariance(1, 1)); } + /// error on z + double zError() const { return sqrt(covariance(2, 2)); } + /// error on t + double tError() const { return sqrt(covariance(3, 3)); } + /// (i, j)-th element of error matrix, i, j = 0, ... 2 + // Note that: + // double error( int i, int j ) const + // is OBSOLETE, use covariance(i, j) + double covariance(int i, int j) const { return covariance_[idx(i, j)]; } + /// return SMatrix + CovarianceMatrix covariance() const { + Error m; + fill(m); + return m; + } + /// return SMatrix 4D + CovarianceMatrix4D covariance4D() const { + Error4D m; + fill(m); + return m; + } + + /// return SMatrix + Error error() const { + Error m; + fill(m); + return m; + } + /// return SMatrix + Error4D error4D() const { + Error4D m; + fill(m); + return m; + } + + /// fill SMatrix + void fill(CovarianceMatrix &v) const; + /// 4D version + void fill(CovarianceMatrix4D &v) const; + + /// Checks whether refitted tracks are stored. + bool hasRefittedTracks() const { return !refittedTracks_.empty(); } + + /// Returns the original track which corresponds to a particular refitted Track + /// Throws an exception if now refitted tracks are stored ot the track is not found in the list + TrackBaseRef originalTrack(const Track &refTrack) const; + + /// Returns the refitted track which corresponds to a particular original Track + /// Throws an exception if now refitted tracks are stored ot the track is not found in the list + Track refittedTrack(const TrackBaseRef &track) const; + + /// Returns the refitted track which corresponds to a particular original Track + /// Throws an exception if now refitted tracks are stored ot the track is not found in the list + Track refittedTrack(const TrackRef &track) const; + + /// Returns the container of refitted tracks + const std::vector &refittedTracks() const { return refittedTracks_; } + + /// Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products + math::XYZTLorentzVectorD p4(float mass = 0.13957018, float minWeight = 0.5) const; + + /// Returns the number of tracks in the vertex with weight above minWeight + unsigned int nTracks(float minWeight = 0.5) const; + + class TrackEqual { + public: + TrackEqual(const Track &t) : track_(t) {} + bool operator()(const Track &t) const { return t.pt() == track_.pt(); } + + private: + const Track &track_; + }; private: - const Track &track_; + /// chi-sqared + float chi2_; + /// number of degrees of freedom + float ndof_; + /// position + Point position_; + /// covariance matrix (4x4) as vector + float covariance_[size4D]; + /// reference to tracks + std::vector tracks_; + /// The vector of refitted tracks + std::vector refittedTracks_; + std::vector weights_; + /// tells wether the vertex is really valid. + bool validity_; + double time_; + + /// position index + index idx(index i, index j) const { + int a = (i <= j ? i : j), b = (i <= j ? j : i); + return b * (b + 1) / 2 + a; + } }; - private: - /// chi-sqared - float chi2_; - /// number of degrees of freedom - float ndof_; - /// position - Point position_; - /// covariance matrix (4x4) as vector - float covariance_[size4D]; - /// reference to tracks - std::vector tracks_; - /// The vector of refitted tracks - std::vector refittedTracks_; - std::vector weights_; - /// tells wether the vertex is really valid. - bool validity_; - double time_; - - /// position index - index idx(index i, index j) const { - int a = (i <= j ? i : j), b = (i <= j ? j : i); - return b * (b + 1) / 2 + a; - } - }; - + } // namespace io_v1 + using Vertex = io_v1::Vertex; } // namespace reco #endif diff --git a/DataFormats/VertexReco/interface/VertexFwd.h b/DataFormats/VertexReco/interface/VertexFwd.h index 54788a52259d7..cccbb860a3741 100644 --- a/DataFormats/VertexReco/interface/VertexFwd.h +++ b/DataFormats/VertexReco/interface/VertexFwd.h @@ -6,7 +6,10 @@ #include "DataFormats/Common/interface/RefVector.h" namespace reco { - class Vertex; + namespace io_v1 { + class Vertex; + } + using Vertex = io_v1::Vertex; /// collection of Vertex objects typedef std::vector VertexCollection; /// persistent reference to a Vertex diff --git a/DataFormats/VertexReco/src/classes_def.xml b/DataFormats/VertexReco/src/classes_def.xml index 7ccac375ae147..ff0e6d55ce901 100755 --- a/DataFormats/VertexReco/src/classes_def.xml +++ b/DataFormats/VertexReco/src/classes_def.xml @@ -1,17 +1,15 @@ - - - + + - - - - - - - - - + + + + + + + + @@ -19,35 +17,35 @@ - - - - + + + + - - - - + + + + - + - - - - + + + + - + - - - - + + + + diff --git a/FWCore/Utilities/src/FriendlyName.cc b/FWCore/Utilities/src/FriendlyName.cc index 918dc9030f64d..fcb80807d07b3 100644 --- a/FWCore/Utilities/src/FriendlyName.cc +++ b/FWCore/Utilities/src/FriendlyName.cc @@ -84,7 +84,7 @@ namespace edm { "edm::AssociationMap >"); static std::regex const reToVector("edm::AssociationVector<(.*), *(.*), *edm::Ref.*,.*>"); //NOTE: if the item within a clone policy is a template, this substitution will probably fail - static std::regex const reToRangeMap("edm::RangeMap< *(.*), *(.*), *edm::ClonePolicy<([^>]*)> >"); + static std::regex const reToRangeMap("edm::RangeMap< *(.*), *(.*), *edm::(Clone|Copy)Policy<([^>]*)> >"); //NOTE: If container is a template with one argument which is its 'type' then can simplify name static std::regex const reToRefs1( "edm::RefVector< *(.*)< *(.*) *>, *\\2 *, *edm::refhelper::FindUsingAdvance< *\\1< *\\2 *> *, *\\2 *> *>"); diff --git a/FWCore/Utilities/test/test_catch2_friendlyname.cc b/FWCore/Utilities/test/test_catch2_friendlyname.cc index 5b00aa0b9b385..ab56946d77528 100644 --- a/FWCore/Utilities/test/test_catch2_friendlyname.cc +++ b/FWCore/Utilities/test/test_catch2_friendlyname.cc @@ -168,6 +168,10 @@ TEST_CASE("friendlyName produces expected results", "[friendlyName]") { Values("std::vector " ">,edm::ClonePolicy > >", "DetIdSiPixelRecHitsOwnedRangeMaps")); + classToFriendly.insert( + Values("edm::RangeMap" + ",edm::CopyPolicy >", + "CSCDetIdCSCSegmentsRangeMap")); classToFriendly.insert( Values("edm::RefVector< edm::OwnVector >,reco::Candidate, " "edm::refhelper::FindUsingAdvance >, " diff --git a/FastSimDataFormats/External/src/classes_def.xml b/FastSimDataFormats/External/src/classes_def.xml index 612475634411f..26f70f399f7e4 100644 --- a/FastSimDataFormats/External/src/classes_def.xml +++ b/FastSimDataFormats/External/src/classes_def.xml @@ -1,15 +1,13 @@ - - - + + - - - + + diff --git a/FastSimDataFormats/NuclearInteractions/src/classes_def.xml b/FastSimDataFormats/NuclearInteractions/src/classes_def.xml index fa4da1b3245de..6374f422c86b4 100644 --- a/FastSimDataFormats/NuclearInteractions/src/classes_def.xml +++ b/FastSimDataFormats/NuclearInteractions/src/classes_def.xml @@ -1,28 +1,26 @@ - - + + - - + + - - + + - - - + + - - - + + diff --git a/FastSimDataFormats/PileUpEvents/src/classes_def.xml b/FastSimDataFormats/PileUpEvents/src/classes_def.xml index 075b72934d188..abb26e0f6acae 100644 --- a/FastSimDataFormats/PileUpEvents/src/classes_def.xml +++ b/FastSimDataFormats/PileUpEvents/src/classes_def.xml @@ -1,14 +1,14 @@ - - + + - - + + - - + + diff --git a/Fireworks/Calo/interface/FWTauProxyBuilderBase.h b/Fireworks/Calo/interface/FWTauProxyBuilderBase.h index 7a8c51dca743c..364d245c89ffc 100644 --- a/Fireworks/Calo/interface/FWTauProxyBuilderBase.h +++ b/Fireworks/Calo/interface/FWTauProxyBuilderBase.h @@ -28,9 +28,7 @@ class TEveScalableStraightLineSet; class FWViewContext; -namespace reco { - class BaseTau; -} // namespace reco +#include "DataFormats/TauReco/interface/BaseTauFwd.h" namespace fireworks { class Context; diff --git a/Fireworks/Tracks/interface/TrackUtils.h b/Fireworks/Tracks/interface/TrackUtils.h index 9d96d3aebd59d..834d6c603fc86 100644 --- a/Fireworks/Tracks/interface/TrackUtils.h +++ b/Fireworks/Tracks/interface/TrackUtils.h @@ -9,6 +9,7 @@ // system include files #include "TEveVSDStructs.h" #include +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/DetId/interface/DetIdFwd.h" #include "DataFormats/SiPixelCluster/interface/SiPixelClusterFwd.h" diff --git a/Fireworks/Tracks/interface/estimate_field.h b/Fireworks/Tracks/interface/estimate_field.h index 06e21d3f4a130..2f2d4be2652b3 100644 --- a/Fireworks/Tracks/interface/estimate_field.h +++ b/Fireworks/Tracks/interface/estimate_field.h @@ -5,9 +5,7 @@ // Package: Tracks // Class : estimate_field // -namespace reco { - class Track; -} +#include "DataFormats/TrackReco/interface/TrackFwd.h" namespace fw { double estimate_field(const reco::Track& track, bool highQuality = false); diff --git a/Fireworks/Tracks/plugins/FWTrackHitsDetailView.h b/Fireworks/Tracks/plugins/FWTrackHitsDetailView.h index 0d3b35ef086ba..4add72d238a74 100644 --- a/Fireworks/Tracks/plugins/FWTrackHitsDetailView.h +++ b/Fireworks/Tracks/plugins/FWTrackHitsDetailView.h @@ -7,13 +7,11 @@ #include "TVector3.h" #include "Fireworks/Core/interface/FWDetailViewGL.h" #include "Fireworks/Core/interface/CSGActionSupervisor.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" class TGLEmbeddedViewer; class FWIntValueListener; class TGSlider; -namespace reco { - class Track; -} class FWTrackHitsDetailView : public FWDetailViewGL, public CSGActionSupervisor { public: diff --git a/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h b/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h index 64326867265d9..60fc50fa52bfd 100644 --- a/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h +++ b/Fireworks/Tracks/plugins/FWTrackResidualDetailView.h @@ -36,16 +36,13 @@ #include #include "Rtypes.h" #include "Fireworks/Core/interface/FWDetailViewCanvas.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" class FWGeometry; class FWModelId; class TEveWindowSlot; class TEveWindow; -namespace reco { - class Track; -} - class FWTrackResidualDetailView : public FWDetailViewCanvas { public: FWTrackResidualDetailView(); diff --git a/HLTrigger/btau/plugins/HLTmmkFilter.h b/HLTrigger/btau/plugins/HLTmmkFilter.h index 383a4b2a0f718..23f0427dc94fa 100644 --- a/HLTrigger/btau/plugins/HLTmmkFilter.h +++ b/HLTrigger/btau/plugins/HLTmmkFilter.h @@ -24,6 +24,7 @@ #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" #include "DataFormats/Candidate/interface/CandidateOnlyFwd.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "TrackingTools/Records/interface/TransientTrackRecord.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" diff --git a/JetMETCorrections/Type1MET/interface/CaloJetMETcorrInputProducerT.h b/JetMETCorrections/Type1MET/interface/CaloJetMETcorrInputProducerT.h index 748185b16f70a..9aee8e66ad1f2 100644 --- a/JetMETCorrections/Type1MET/interface/CaloJetMETcorrInputProducerT.h +++ b/JetMETCorrections/Type1MET/interface/CaloJetMETcorrInputProducerT.h @@ -38,7 +38,7 @@ namespace CaloJetMETcorrInputProducer_namespace { class InputTypeCheckerT { public: void operator()(const T&) const {} // no type-checking needed for reco::CaloJet input - bool isPatJet(const T&) const { return std::is_base_of::value; } + bool isPatJet(const T&) const { return std::is_base_of::value; } }; template diff --git a/JetMETCorrections/Type1MET/interface/JetCleanerForType1METT.h b/JetMETCorrections/Type1MET/interface/JetCleanerForType1METT.h index 97dda8c2ddeb9..264773076a0af 100644 --- a/JetMETCorrections/Type1MET/interface/JetCleanerForType1METT.h +++ b/JetMETCorrections/Type1MET/interface/JetCleanerForType1METT.h @@ -46,7 +46,7 @@ namespace JetCleanerForType1MET_namespace { class InputTypeCheckerT { public: void operator()(const T&) const {} // no type-checking needed for reco::PFJet input - bool isPatJet(const T&) const { return std::is_base_of::value; } + bool isPatJet(const T&) const { return std::is_base_of::value; } }; template diff --git a/JetMETCorrections/Type1MET/interface/PFJetMETcorrInputProducerT.h b/JetMETCorrections/Type1MET/interface/PFJetMETcorrInputProducerT.h index 0757e519d09c7..5b531cf061e5c 100644 --- a/JetMETCorrections/Type1MET/interface/PFJetMETcorrInputProducerT.h +++ b/JetMETCorrections/Type1MET/interface/PFJetMETcorrInputProducerT.h @@ -48,7 +48,7 @@ namespace PFJetMETcorrInputProducer_namespace { class InputTypeCheckerT { public: void operator()(const T&) const {} // no type-checking needed for reco::PFJet input - bool isPatJet(const T&) const { return std::is_base_of::value; } + bool isPatJet(const T&) const { return std::is_base_of::value; } }; template diff --git a/L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h b/L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h index 4fc306871fbf0..dcca9bfecdfee 100644 --- a/L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h +++ b/L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h @@ -35,6 +35,7 @@ #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCountsFwd.h" #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHFBitCountsFwd.h" #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctHFRingEtSumsFwd.h" +#include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCandFwd.h" #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecordFwd.h" #include "DataFormats/Common/interface/Handle.h" @@ -49,7 +50,6 @@ #include // forward declarations -class L1GctCand; // class declaration class L1GlobalTriggerPSB { diff --git a/L1Trigger/GlobalTrigger/interface/L1GtCaloCondition.h b/L1Trigger/GlobalTrigger/interface/L1GtCaloCondition.h index 2329f0685e0bd..4fc48896b1aac 100644 --- a/L1Trigger/GlobalTrigger/interface/L1GtCaloCondition.h +++ b/L1Trigger/GlobalTrigger/interface/L1GtCaloCondition.h @@ -24,11 +24,10 @@ #include "L1Trigger/GlobalTrigger/interface/L1GtConditionEvaluation.h" // forward declarations +#include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCandFwd.h" class L1GtCondition; class L1GtCaloTemplate; -class L1GctCand; - class L1GlobalTriggerPSB; // class declaration diff --git a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h index dffe2d9d7ed28..d7f422acbdfe2 100644 --- a/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h +++ b/L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h @@ -49,6 +49,7 @@ #include "FWCore/Utilities/interface/InputTag.h" #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h" +#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecordFwd.h" #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtilsHelper.h" @@ -58,7 +59,6 @@ class L1GtPrescaleFactors; class L1GtTriggerMask; class L1GtTriggerMenu; -class L1GlobalTriggerReadoutRecord; class L1GlobalTriggerRecord; // class declaration diff --git a/L1Trigger/L1THGCalUtilities/src/classes_def.xml b/L1Trigger/L1THGCalUtilities/src/classes_def.xml index 640166291ef6f..04f0d5b0d486e 100644 --- a/L1Trigger/L1THGCalUtilities/src/classes_def.xml +++ b/L1Trigger/L1THGCalUtilities/src/classes_def.xml @@ -1,8 +1,8 @@ - - - + + + - + diff --git a/L1Trigger/L1TMuonBarrel/interface/L1MuBMMuonSorter.h b/L1Trigger/L1TMuonBarrel/interface/L1MuBMMuonSorter.h index 6f5c66c9e4e5b..2b4bff0ccf6a6 100644 --- a/L1Trigger/L1TMuonBarrel/interface/L1MuBMMuonSorter.h +++ b/L1Trigger/L1TMuonBarrel/interface/L1MuBMMuonSorter.h @@ -31,9 +31,9 @@ //------------------------------------ // Collaborating Class Declarations -- //------------------------------------ +#include "DataFormats/L1TMuon/interface/L1MuBMTrackFwd.h" class L1MuBMTrackFinder; -class L1MuBMTrack; class L1MuBMSecProcId; // --------------------- diff --git a/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h b/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h index c4b794f4d176b..528d79debfc56 100644 --- a/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h +++ b/L1Trigger/Phase2L1ParticleFlow/interface/corrector.h @@ -3,15 +3,12 @@ #include #include #include +#include "DataFormats/L1TParticleFlow/interface/PFClusterFwd.h" #ifdef CMSSW_GIT_HASH #define L1PF_USE_ROOT #endif -namespace l1t { - class PFCluster; -} - // Define this macro to enable ROOT-dependent interfaces #ifdef L1PF_USE_ROOT #include diff --git a/PhysicsTools/NanoAOD/plugins/dtMDSshowerTableProducer.cc b/PhysicsTools/NanoAOD/plugins/dtMDSshowerTableProducer.cc index 28a3a0a1d6eeb..1d03a5af2b87f 100644 --- a/PhysicsTools/NanoAOD/plugins/dtMDSshowerTableProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/dtMDSshowerTableProducer.cc @@ -18,6 +18,8 @@ #include "DataFormats/DTRecHit/interface/DTRecHitCollection.h" #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h" #include "DataFormats/Math/interface/deltaPhi.h" +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/RefVector.h" #include "Geometry/DTGeometry/interface/DTGeometry.h" #include "Geometry/RPCGeometry/interface/RPCGeometry.h" diff --git a/PhysicsTools/SelectorUtils/src/classes_def.xml b/PhysicsTools/SelectorUtils/src/classes_def.xml index 4e09d1b58d9cf..90e617ad891c6 100644 --- a/PhysicsTools/SelectorUtils/src/classes_def.xml +++ b/PhysicsTools/SelectorUtils/src/classes_def.xml @@ -9,9 +9,9 @@ - + - - + + diff --git a/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h b/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h index a2b9236b19913..36599f9a69e3d 100644 --- a/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h +++ b/RecoEgamma/EgammaElectronProducers/interface/LowPtGsfElectronFeatures.h @@ -8,13 +8,10 @@ #include "DataFormats/Common/interface/View.h" #include "DataFormats/EgammaCandidates/interface/GsfElectron.h" #include "DataFormats/ParticleFlowReco/interface/PreId.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" #include -namespace reco { - class Track; -} - namespace lowptgsfeleseed { std::vector features(const reco::PreId& ecal, diff --git a/RecoHGCal/TICL/interface/TracksterInferenceByCNN.h b/RecoHGCal/TICL/interface/TracksterInferenceByCNN.h index c9d21219f698e..c4b46d58d8aa1 100644 --- a/RecoHGCal/TICL/interface/TracksterInferenceByCNN.h +++ b/RecoHGCal/TICL/interface/TracksterInferenceByCNN.h @@ -1,16 +1,13 @@ #ifndef RecoHGCal_TICL_interface_TracksterInferenceByCNN_h #define RecoHGCal_TICL_interface_TracksterInferenceByCNN_h +#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h" #include "RecoHGCal/TICL/interface/TICLONNXGlobalCache.h" #include "RecoHGCal/TICL/interface/TracksterInferenceAlgoBase.h" #include #include -namespace reco { - class CaloCluster; -} - namespace hgcal { class RecHitTools; } diff --git a/RecoLocalMuon/GEMCSCSegment/test/GEMCSCCoincidenceRateAnalyzer.cc b/RecoLocalMuon/GEMCSCSegment/test/GEMCSCCoincidenceRateAnalyzer.cc index 554302cb9bdb8..bf42acd25d99c 100644 --- a/RecoLocalMuon/GEMCSCSegment/test/GEMCSCCoincidenceRateAnalyzer.cc +++ b/RecoLocalMuon/GEMCSCSegment/test/GEMCSCCoincidenceRateAnalyzer.cc @@ -170,10 +170,7 @@ void GEMCSCCoincidenceRateAnalyzer::analyze(const edm::Event& event, const edm:: ///////////////////////////////////////////////////////////////////////////// const std::vector muon_segment_vec = findMuonSegments(muon_collection); - for (edm::OwnVector::const_iterator iter = gem_csc_segment_collection->begin(); - iter != gem_csc_segment_collection->end(); - iter++) { - const GEMCSCSegment& gem_csc_segment = *iter; + for (auto const& gem_csc_segment : *gem_csc_segment_collection) { if (not checkCSCChamberType(gem_csc_segment.cscDetId())) { continue; } diff --git a/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc b/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc index aa14febec4449..11b3849f0d03c 100644 --- a/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc +++ b/RecoLocalMuon/RPCRecHit/plugins/DTSegtoRPC.cc @@ -56,7 +56,7 @@ std::unique_ptr DTSegtoRPC::thePoints(const DTRecSegment4DC bool debug, double eyr) { auto _ThePoints = std::make_unique(); - edm::OwnVector RPCPointVector; + std::vector RPCPointVector; std::vector extrapolatedRolls; if (all4DSegments->size() > 8) { diff --git a/RecoMuon/MuonIdentification/plugins/GlobalMuonToMuonProducer.h b/RecoMuon/MuonIdentification/plugins/GlobalMuonToMuonProducer.h index eb50c28377a25..8100823fccc09 100644 --- a/RecoMuon/MuonIdentification/plugins/GlobalMuonToMuonProducer.h +++ b/RecoMuon/MuonIdentification/plugins/GlobalMuonToMuonProducer.h @@ -11,9 +11,7 @@ //#include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Utilities/interface/InputTag.h" -namespace reco { - class Track; -} +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Utilities/interface/ESGetToken.h" #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" diff --git a/RecoMuon/MuonIdentification/plugins/MuonProducer.h b/RecoMuon/MuonIdentification/plugins/MuonProducer.h index 6c720fadfda1a..4db77749f5e5f 100644 --- a/RecoMuon/MuonIdentification/plugins/MuonProducer.h +++ b/RecoMuon/MuonIdentification/plugins/MuonProducer.h @@ -17,9 +17,7 @@ #include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/MuonReco/interface/MuonTimeExtra.h" -namespace reco { - class Track; -} +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "FWCore/Framework/interface/ESHandle.h" #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" diff --git a/RecoMuon/MuonIsolation/interface/MuIsoByTrackPt.h b/RecoMuon/MuonIsolation/interface/MuIsoByTrackPt.h index 61b20736cc794..2063700cd79d2 100644 --- a/RecoMuon/MuonIsolation/interface/MuIsoByTrackPt.h +++ b/RecoMuon/MuonIsolation/interface/MuIsoByTrackPt.h @@ -3,6 +3,7 @@ #include "RecoMuon/MuonIsolation/interface/MuIsoBaseAlgorithm.h" #include "RecoMuon/MuonIsolation/interface/CutsConeSizeFunction.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" namespace reco { namespace isodeposit { @@ -12,9 +13,6 @@ namespace reco { namespace muonisolation { class IsolatorByDeposit; } -namespace reco { - class Track; -} namespace edm { class Event; } diff --git a/RecoMuon/TrackerSeedGenerator/interface/L1MuonPixelTrackFitter.h b/RecoMuon/TrackerSeedGenerator/interface/L1MuonPixelTrackFitter.h index 44f157525a332..ba9948efeacf9 100644 --- a/RecoMuon/TrackerSeedGenerator/interface/L1MuonPixelTrackFitter.h +++ b/RecoMuon/TrackerSeedGenerator/interface/L1MuonPixelTrackFitter.h @@ -8,15 +8,12 @@ #include "DataFormats/GeometryVector/interface/Point3DBase.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHitFwd.h" #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTCandFwd.h" #include -namespace reco { - class Track; -} - class TrackingRegion; class PixelRecoLineRZ; class SeedingHitSet; diff --git a/RecoTauTag/RecoTau/interface/PFRecoTauChargedHadronPlugins.h b/RecoTauTag/RecoTau/interface/PFRecoTauChargedHadronPlugins.h index 88337a577d1c9..ebd80d952ed2b 100644 --- a/RecoTauTag/RecoTau/interface/PFRecoTauChargedHadronPlugins.h +++ b/RecoTauTag/RecoTau/interface/PFRecoTauChargedHadronPlugins.h @@ -24,10 +24,9 @@ #include -namespace reco { +#include "DataFormats/TauReco/interface/PFRecoTauChargedHadronFwd.h" - // Forward declarations - class PFRecoTauChargedHadron; +namespace reco { namespace tau { diff --git a/RecoTracker/FinalTrackSelectors/plugins/DuplicateListMerger.cc b/RecoTracker/FinalTrackSelectors/plugins/DuplicateListMerger.cc index 0bef14300d582..8753ff63d43a0 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/DuplicateListMerger.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/DuplicateListMerger.cc @@ -33,9 +33,21 @@ // #include "TMVA/Reader.h" -using namespace reco; +#include "TrackingTools/PatternTools/interface/Trajectory.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" +#include "TrackingTools/PatternTools/interface/ClusterRemovalRefSetter.h" + +#include "FWCore/Framework/interface/Event.h" +#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" + +#include +#include +#include "CommonTools/Utils/interface/DynArray.h" namespace { + using namespace reco; + class DuplicateListMerger final : public edm::global::EDProducer<> { public: /// constructor @@ -73,21 +85,6 @@ namespace { int diffHitsCut_; }; -} // namespace - -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" -#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" -#include "TrackingTools/PatternTools/interface/ClusterRemovalRefSetter.h" - -#include "FWCore/Framework/interface/Event.h" -#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" - -#include -#include -#include "CommonTools/Utils/interface/DynArray.h" - -namespace { void DuplicateListMerger::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("mergedSource", edm::InputTag()); diff --git a/RecoTracker/FinalTrackSelectors/plugins/DuplicateTrackMerger.cc b/RecoTracker/FinalTrackSelectors/plugins/DuplicateTrackMerger.cc index 28e63f4f3f898..4083e45976271 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/DuplicateTrackMerger.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/DuplicateTrackMerger.cc @@ -34,7 +34,6 @@ #include "CondFormats/DataRecord/interface/GBRWrapperRcd.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" -using namespace reco; namespace { class DuplicateTrackMerger final : public edm::stream::EDProducer<> { public: diff --git a/RecoTracker/FinalTrackSelectors/plugins/TrackCollectionFilterCloner.cc b/RecoTracker/FinalTrackSelectors/plugins/TrackCollectionFilterCloner.cc index 215d4763f883e..7cde9b6f93d71 100644 --- a/RecoTracker/FinalTrackSelectors/plugins/TrackCollectionFilterCloner.cc +++ b/RecoTracker/FinalTrackSelectors/plugins/TrackCollectionFilterCloner.cc @@ -18,9 +18,21 @@ #include #include -using namespace reco; +#include "TrackingTools/PatternTools/interface/Trajectory.h" +#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" +#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" +#include "TrackingTools/PatternTools/interface/ClusterRemovalRefSetter.h" + +#include "FWCore/Framework/interface/Event.h" +#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" + +#include +#include +#include "CommonTools/Utils/interface/DynArray.h" namespace { + using namespace reco; + class TrackCollectionFilterCloner final : public edm::global::EDProducer<> { public: /// constructor @@ -51,21 +63,7 @@ namespace { const reco::TrackBase::TrackQuality minQuality_; }; -} // namespace -#include "TrackingTools/PatternTools/interface/Trajectory.h" -#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" -#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" -#include "TrackingTools/PatternTools/interface/ClusterRemovalRefSetter.h" - -#include "FWCore/Framework/interface/Event.h" -#include "CommonTools/Statistics/interface/ChiSquaredProbability.h" - -#include -#include -#include "CommonTools/Utils/interface/DynArray.h" - -namespace { void TrackCollectionFilterCloner::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("originalSource", edm::InputTag()); diff --git a/RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h b/RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h index 9bad1e43e9aaa..a83d16135a345 100644 --- a/RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h +++ b/RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h @@ -3,13 +3,11 @@ #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h" #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" #include "RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h" #include "FWCore/Utilities/interface/ESGetToken.h" -namespace reco { - class Track; -} namespace edm { class EventSetup; class ConsumesCollector; diff --git a/RecoTracker/TrackProducer/interface/DAFTrackProducerAlgorithm.h b/RecoTracker/TrackProducer/interface/DAFTrackProducerAlgorithm.h index da630420580c0..845be7cf42ade 100644 --- a/RecoTracker/TrackProducer/interface/DAFTrackProducerAlgorithm.h +++ b/RecoTracker/TrackProducer/interface/DAFTrackProducerAlgorithm.h @@ -13,6 +13,7 @@ #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h" #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -29,9 +30,6 @@ class TrajectoryStateOnSurface; class TransientTrackingRecHitBuilder; class MultiRecHitCollector; class SiTrackerMultiRecHitUpdator; -namespace reco { - class Track; -} class DAFTrackProducerAlgorithm : public AlgoProductTraits { public: diff --git a/SimDataFormats/Associations/interface/MtdRecoClusterToSimLayerClusterAssociationMap.h b/SimDataFormats/Associations/interface/MtdRecoClusterToSimLayerClusterAssociationMap.h index c0f0625efffe3..952879b29c6a5 100644 --- a/SimDataFormats/Associations/interface/MtdRecoClusterToSimLayerClusterAssociationMap.h +++ b/SimDataFormats/Associations/interface/MtdRecoClusterToSimLayerClusterAssociationMap.h @@ -10,48 +10,51 @@ #include #include -/** +namespace io_v1 { + /** * Maps FTLCluserRef to SimLayerClusterRef * */ -class MtdRecoClusterToSimLayerClusterAssociationMap { -public: - using key_type = FTLClusterRef; - using mapped_type = MtdSimLayerClusterRef; - using value_type = std::pair>; - using map_type = std::vector; - using const_iterator = typename map_type::const_iterator; - using range = std::pair; - - /// Constructor - MtdRecoClusterToSimLayerClusterAssociationMap(); - /// Destructor - ~MtdRecoClusterToSimLayerClusterAssociationMap(); - - void emplace_back(const FTLClusterRef& recoClus, std::vector& simClusVect) { - map_.emplace_back(recoClus, simClusVect); - } - - void post_insert() { std::sort(map_.begin(), map_.end(), compare); } - - bool empty() const { return map_.empty(); } - size_t size() const { return map_.size(); } - - const_iterator begin() const { return map_.begin(); } - const_iterator cbegin() const { return map_.cbegin(); } - const_iterator end() const { return map_.end(); } - const_iterator cend() const { return map_.cend(); } - - range equal_range(const FTLClusterRef& key) const { - return std::equal_range(map_.begin(), map_.end(), value_type(key, std::vector()), compare); - } - - const map_type& map() const { return map_; } - -private: - static bool compare(const value_type& i, const value_type& j) { return (i.first < j.first); } - - map_type map_; -}; + class MtdRecoClusterToSimLayerClusterAssociationMap { + public: + using key_type = FTLClusterRef; + using mapped_type = MtdSimLayerClusterRef; + using value_type = std::pair>; + using map_type = std::vector; + using const_iterator = typename map_type::const_iterator; + using range = std::pair; + + /// Constructor + MtdRecoClusterToSimLayerClusterAssociationMap(); + /// Destructor + ~MtdRecoClusterToSimLayerClusterAssociationMap(); + + void emplace_back(const FTLClusterRef& recoClus, std::vector& simClusVect) { + map_.emplace_back(recoClus, simClusVect); + } + + void post_insert() { std::sort(map_.begin(), map_.end(), compare); } + + bool empty() const { return map_.empty(); } + size_t size() const { return map_.size(); } + + const_iterator begin() const { return map_.begin(); } + const_iterator cbegin() const { return map_.cbegin(); } + const_iterator end() const { return map_.end(); } + const_iterator cend() const { return map_.cend(); } + + range equal_range(const FTLClusterRef& key) const { + return std::equal_range(map_.begin(), map_.end(), value_type(key, std::vector()), compare); + } + + const map_type& map() const { return map_; } + + private: + static bool compare(const value_type& i, const value_type& j) { return (i.first < j.first); } + + map_type map_; + }; +} // namespace io_v1 +using MtdRecoClusterToSimLayerClusterAssociationMap = io_v1::MtdRecoClusterToSimLayerClusterAssociationMap; #endif diff --git a/SimDataFormats/Associations/interface/MtdSimLayerClusterToRecoClusterAssociationMap.h b/SimDataFormats/Associations/interface/MtdSimLayerClusterToRecoClusterAssociationMap.h index af3bff1bcaab0..1171bf43337d9 100644 --- a/SimDataFormats/Associations/interface/MtdSimLayerClusterToRecoClusterAssociationMap.h +++ b/SimDataFormats/Associations/interface/MtdSimLayerClusterToRecoClusterAssociationMap.h @@ -10,61 +10,64 @@ #include #include -/** +namespace io_v1 { + /** * Maps MtdSimLayerCluserRef to FTLClusterRef * */ -class MtdSimLayerClusterToRecoClusterAssociationMap { -public: - using key_type = MtdSimLayerClusterRef; - using mapped_type = FTLClusterRef; - using value_type = std::pair>; - using map_type = std::vector; - using const_iterator = typename map_type::const_iterator; - using range = std::pair; - - /// Constructor - MtdSimLayerClusterToRecoClusterAssociationMap(); - /// Destructor - ~MtdSimLayerClusterToRecoClusterAssociationMap(); - - void emplace_back(const MtdSimLayerClusterRef& simClus, std::vector& recoClusVect) { - map_.emplace_back(simClus, recoClusVect); - } - - void post_insert() { std::sort(map_.begin(), map_.end(), compare); } - - bool empty() const { return map_.empty(); } - size_t size() const { return map_.size(); } - - const_iterator begin() const { return map_.begin(); } - const_iterator cbegin() const { return map_.cbegin(); } - const_iterator end() const { return map_.end(); } - const_iterator cend() const { return map_.cend(); } - - range equal_range(const MtdSimLayerClusterRef& key) const { - return std::equal_range(map_.begin(), map_.end(), value_type(key, std::vector()), compare); - } - - const map_type& map() const { return map_; } - -private: - static bool compare(const value_type& i, const value_type& j) { - const auto& i_hAndE = (i.first)->hits_and_energies(); - const auto& j_hAndE = (j.first)->hits_and_energies(); - - auto imin = std::min_element(i_hAndE.begin(), - i_hAndE.end(), - [](std::pair a, std::pair b) { return a < b; }); - - auto jmin = std::min_element(j_hAndE.begin(), - j_hAndE.end(), - [](std::pair a, std::pair b) { return a < b; }); - - return (*imin < *jmin); - } - - map_type map_; -}; + class MtdSimLayerClusterToRecoClusterAssociationMap { + public: + using key_type = MtdSimLayerClusterRef; + using mapped_type = FTLClusterRef; + using value_type = std::pair>; + using map_type = std::vector; + using const_iterator = typename map_type::const_iterator; + using range = std::pair; + + /// Constructor + MtdSimLayerClusterToRecoClusterAssociationMap(); + /// Destructor + ~MtdSimLayerClusterToRecoClusterAssociationMap(); + + void emplace_back(const MtdSimLayerClusterRef& simClus, std::vector& recoClusVect) { + map_.emplace_back(simClus, recoClusVect); + } + + void post_insert() { std::sort(map_.begin(), map_.end(), compare); } + + bool empty() const { return map_.empty(); } + size_t size() const { return map_.size(); } + + const_iterator begin() const { return map_.begin(); } + const_iterator cbegin() const { return map_.cbegin(); } + const_iterator end() const { return map_.end(); } + const_iterator cend() const { return map_.cend(); } + + range equal_range(const MtdSimLayerClusterRef& key) const { + return std::equal_range(map_.begin(), map_.end(), value_type(key, std::vector()), compare); + } + + const map_type& map() const { return map_; } + + private: + static bool compare(const value_type& i, const value_type& j) { + const auto& i_hAndE = (i.first)->hits_and_energies(); + const auto& j_hAndE = (j.first)->hits_and_energies(); + + auto imin = std::min_element(i_hAndE.begin(), + i_hAndE.end(), + [](std::pair a, std::pair b) { return a < b; }); + + auto jmin = std::min_element(j_hAndE.begin(), + j_hAndE.end(), + [](std::pair a, std::pair b) { return a < b; }); + + return (*imin < *jmin); + } + + map_type map_; + }; +} // namespace io_v1 +using MtdSimLayerClusterToRecoClusterAssociationMap = io_v1::MtdSimLayerClusterToRecoClusterAssociationMap; #endif diff --git a/SimDataFormats/Associations/src/MtdRecoClusterToSimLayerClusterAssociationMap.cc b/SimDataFormats/Associations/src/MtdRecoClusterToSimLayerClusterAssociationMap.cc index 8e57265f4a553..a0a4121d44b84 100644 --- a/SimDataFormats/Associations/src/MtdRecoClusterToSimLayerClusterAssociationMap.cc +++ b/SimDataFormats/Associations/src/MtdRecoClusterToSimLayerClusterAssociationMap.cc @@ -1,5 +1,7 @@ #include "SimDataFormats/Associations/interface/MtdRecoClusterToSimLayerClusterAssociationMap.h" -MtdRecoClusterToSimLayerClusterAssociationMap::MtdRecoClusterToSimLayerClusterAssociationMap() {} +namespace io_v1 { + MtdRecoClusterToSimLayerClusterAssociationMap::MtdRecoClusterToSimLayerClusterAssociationMap() {} -MtdRecoClusterToSimLayerClusterAssociationMap::~MtdRecoClusterToSimLayerClusterAssociationMap() {} + MtdRecoClusterToSimLayerClusterAssociationMap::~MtdRecoClusterToSimLayerClusterAssociationMap() {} +} // namespace io_v1 diff --git a/SimDataFormats/Associations/src/MtdSimLayerClusterToRecoClusterAssociationMap.cc b/SimDataFormats/Associations/src/MtdSimLayerClusterToRecoClusterAssociationMap.cc index 4e91d1c776772..837deb5bb1c67 100644 --- a/SimDataFormats/Associations/src/MtdSimLayerClusterToRecoClusterAssociationMap.cc +++ b/SimDataFormats/Associations/src/MtdSimLayerClusterToRecoClusterAssociationMap.cc @@ -1,5 +1,7 @@ #include "SimDataFormats/Associations/interface/MtdSimLayerClusterToRecoClusterAssociationMap.h" -MtdSimLayerClusterToRecoClusterAssociationMap::MtdSimLayerClusterToRecoClusterAssociationMap() {} +namespace io_v1 { + MtdSimLayerClusterToRecoClusterAssociationMap::MtdSimLayerClusterToRecoClusterAssociationMap() {} -MtdSimLayerClusterToRecoClusterAssociationMap::~MtdSimLayerClusterToRecoClusterAssociationMap() {} + MtdSimLayerClusterToRecoClusterAssociationMap::~MtdSimLayerClusterToRecoClusterAssociationMap() {} +} // namespace io_v1 diff --git a/SimDataFormats/Associations/src/classes_def.xml b/SimDataFormats/Associations/src/classes_def.xml index f61f51cbd2a2b..757b7f7091c34 100644 --- a/SimDataFormats/Associations/src/classes_def.xml +++ b/SimDataFormats/Associations/src/classes_def.xml @@ -58,11 +58,11 @@ - + - - + + @@ -71,14 +71,14 @@ - - + + - - + + @@ -89,8 +89,8 @@ - - + + @@ -119,8 +119,8 @@ - - + + @@ -142,8 +142,8 @@ - - + + @@ -155,8 +155,8 @@ - - + + @@ -168,46 +168,45 @@ - - - - - + + + + - - + + @@ -222,8 +221,8 @@ - - + + @@ -247,8 +246,8 @@ - - + + @@ -261,15 +260,15 @@ - - + + - + - - - + + + @@ -289,8 +288,8 @@ - - + + @@ -307,17 +306,17 @@ - + - + - + - + - + - + @@ -325,20 +324,20 @@ - + - + - + - + - - + + - + - + diff --git a/SimDataFormats/CaloAnalysis/interface/CaloParticle.h b/SimDataFormats/CaloAnalysis/interface/CaloParticle.h index a942249325ea2..e27d5cbc13c35 100644 --- a/SimDataFormats/CaloAnalysis/interface/CaloParticle.h +++ b/SimDataFormats/CaloAnalysis/interface/CaloParticle.h @@ -11,212 +11,215 @@ #include "SimDataFormats/Track/interface/SimTrack.h" #include -class CaloParticle { - friend std::ostream &operator<<(std::ostream &s, CaloParticle const &tp); +namespace io_v1 { + class CaloParticle { + friend std::ostream &operator<<(std::ostream &s, CaloParticle const &tp); -public: - typedef int Charge; ///< electric charge type - typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector - typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; ///< Lorentz vector - typedef math::XYZPointD Point; ///< point in the space - typedef math::XYZVectorD Vector; ///< point in the space + public: + typedef int Charge; ///< electric charge type + typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector + typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; ///< Lorentz vector + typedef math::XYZPointD Point; ///< point in the space + typedef math::XYZVectorD Vector; ///< point in the space - /// reference to reco::GenParticle - typedef reco::GenParticleRefVector::iterator genp_iterator; - typedef std::vector::const_iterator g4t_iterator; - typedef SimClusterRefVector::iterator sc_iterator; + /// reference to reco::GenParticle + typedef reco::GenParticleRefVector::iterator genp_iterator; + typedef std::vector::const_iterator g4t_iterator; + typedef SimClusterRefVector::iterator sc_iterator; - CaloParticle(); + CaloParticle(); - CaloParticle(const SimTrack &simtrk); - CaloParticle(EncodedEventId eventID, uint32_t particleID); // for PU + CaloParticle(const SimTrack &simtrk); + CaloParticle(EncodedEventId eventID, uint32_t particleID); // for PU - // destructor - ~CaloParticle(); + // destructor + ~CaloParticle(); - /** @brief PDG ID. + /** @brief PDG ID. * * Returns the PDG ID of the first associated gen particle. If there are no * gen particles associated then it returns type() from the first SimTrack. */ - int pdgId() const { - if (genParticles_.empty()) - return g4Tracks_[0].type(); - else - return (*genParticles_.begin())->pdgId(); - } - - /** @brief Signal source, crossing number. + int pdgId() const { + if (genParticles_.empty()) + return g4Tracks_[0].type(); + else + return (*genParticles_.begin())->pdgId(); + } + + /** @brief Signal source, crossing number. * * Note this is taken from the first SimTrack only, but there shouldn't be any * SimTracks from different crossings in the CaloParticle. */ - EncodedEventId eventId() const { return event_; } + EncodedEventId eventId() const { return event_; } - uint64_t particleId() const { return particleId_; } + uint64_t particleId() const { return particleId_; } - // Setters for G4 and reco::GenParticle - void addGenParticle(const reco::GenParticleRef &ref) { genParticles_.push_back(ref); } - void addSimCluster(const SimClusterRef &ref) { simClusters_.push_back(ref); } - void addG4Track(const SimTrack &t) { g4Tracks_.push_back(t); } - /// iterators - genp_iterator genParticle_begin() const { return genParticles_.begin(); } - genp_iterator genParticle_end() const { return genParticles_.end(); } - g4t_iterator g4Track_begin() const { return g4Tracks_.begin(); } - g4t_iterator g4Track_end() const { return g4Tracks_.end(); } - sc_iterator simCluster_begin() const { return simClusters_.begin(); } - sc_iterator simCluster_end() const { return simClusters_.end(); } + // Setters for G4 and reco::GenParticle + void addGenParticle(const reco::GenParticleRef &ref) { genParticles_.push_back(ref); } + void addSimCluster(const SimClusterRef &ref) { simClusters_.push_back(ref); } + void addG4Track(const SimTrack &t) { g4Tracks_.push_back(t); } + /// iterators + genp_iterator genParticle_begin() const { return genParticles_.begin(); } + genp_iterator genParticle_end() const { return genParticles_.end(); } + g4t_iterator g4Track_begin() const { return g4Tracks_.begin(); } + g4t_iterator g4Track_end() const { return g4Tracks_.end(); } + sc_iterator simCluster_begin() const { return simClusters_.begin(); } + sc_iterator simCluster_end() const { return simClusters_.end(); } - // Getters for Embd and Sim Tracks - const reco::GenParticleRefVector &genParticles() const { return genParticles_; } - const SimClusterRefVector &simClusters() const { return simClusters_; } - // Only for clusters from the signal vertex - const std::vector &g4Tracks() const { return g4Tracks_; } + // Getters for Embd and Sim Tracks + const reco::GenParticleRefVector &genParticles() const { return genParticles_; } + const SimClusterRefVector &simClusters() const { return simClusters_; } + // Only for clusters from the signal vertex + const std::vector &g4Tracks() const { return g4Tracks_; } - void clearSimClusters() { simClusters_.clear(); } + void clearSimClusters() { simClusters_.clear(); } - /// @brief Electric charge. Note this is taken from the first SimTrack only. - float charge() const { return g4Tracks_[0].charge(); } - /// Gives charge in unit of quark charge (should be 3 times "charge()") - int threeCharge() const { return lrintf(3.f * charge()); } + /// @brief Electric charge. Note this is taken from the first SimTrack only. + float charge() const { return g4Tracks_[0].charge(); } + /// Gives charge in unit of quark charge (should be 3 times "charge()") + int threeCharge() const { return lrintf(3.f * charge()); } - /// @brief Four-momentum Lorentz vector. Note this is taken from the first - /// SimTrack only. - const math::XYZTLorentzVectorF &p4() const { return theMomentum_; } + /// @brief Four-momentum Lorentz vector. Note this is taken from the first + /// SimTrack only. + const math::XYZTLorentzVectorF &p4() const { return theMomentum_; } - /// @brief spatial momentum vector - math::XYZVectorF momentum() const { return p4().Vect(); } + /// @brief spatial momentum vector + math::XYZVectorF momentum() const { return p4().Vect(); } - /// @brief Vector to boost to the particle centre of mass frame. - math::XYZVectorF boostToCM() const { return p4().BoostToCM(); } + /// @brief Vector to boost to the particle centre of mass frame. + math::XYZVectorF boostToCM() const { return p4().BoostToCM(); } - /// @brief Magnitude of momentum vector. Note this is taken from the first - /// SimTrack only. - float p() const { return p4().P(); } + /// @brief Magnitude of momentum vector. Note this is taken from the first + /// SimTrack only. + float p() const { return p4().P(); } - /// @brief Energy. Note this is taken from the first SimTrack only. - float energy() const { return p4().E(); } + /// @brief Energy. Note this is taken from the first SimTrack only. + float energy() const { return p4().E(); } - /// @brief Transverse energy. Note this is taken from the first SimTrack only. - float et() const { return p4().Et(); } + /// @brief Transverse energy. Note this is taken from the first SimTrack only. + float et() const { return p4().Et(); } - /// @brief Mass. Note this is taken from the first SimTrack only. - float mass() const { return p4().M(); } + /// @brief Mass. Note this is taken from the first SimTrack only. + float mass() const { return p4().M(); } - /// @brief Mass squared. Note this is taken from the first SimTrack only. - float massSqr() const { return pow(mass(), 2); } + /// @brief Mass squared. Note this is taken from the first SimTrack only. + float massSqr() const { return pow(mass(), 2); } - /// @brief Transverse mass. Note this is taken from the first SimTrack only. - float mt() const { return p4().Mt(); } + /// @brief Transverse mass. Note this is taken from the first SimTrack only. + float mt() const { return p4().Mt(); } - /// @brief Transverse mass squared. Note this is taken from the first SimTrack - /// only. - float mtSqr() const { return p4().Mt2(); } + /// @brief Transverse mass squared. Note this is taken from the first SimTrack + /// only. + float mtSqr() const { return p4().Mt2(); } - /// @brief x coordinate of momentum vector. Note this is taken from the first - /// SimTrack only. - float px() const { return p4().Px(); } + /// @brief x coordinate of momentum vector. Note this is taken from the first + /// SimTrack only. + float px() const { return p4().Px(); } - /// @brief y coordinate of momentum vector. Note this is taken from the first - /// SimTrack only. - float py() const { return p4().Py(); } + /// @brief y coordinate of momentum vector. Note this is taken from the first + /// SimTrack only. + float py() const { return p4().Py(); } - /// @brief z coordinate of momentum vector. Note this is taken from the first - /// SimTrack only. - float pz() const { return p4().Pz(); } + /// @brief z coordinate of momentum vector. Note this is taken from the first + /// SimTrack only. + float pz() const { return p4().Pz(); } - /// @brief Transverse momentum. Note this is taken from the first SimTrack - /// only. - float pt() const { return p4().Pt(); } + /// @brief Transverse momentum. Note this is taken from the first SimTrack + /// only. + float pt() const { return p4().Pt(); } - /// @brief Momentum azimuthal angle. Note this is taken from the first - /// SimTrack only. - float phi() const { return p4().Phi(); } + /// @brief Momentum azimuthal angle. Note this is taken from the first + /// SimTrack only. + float phi() const { return p4().Phi(); } - /// @brief Momentum polar angle. Note this is taken from the first SimTrack - /// only. - float theta() const { return p4().Theta(); } + /// @brief Momentum polar angle. Note this is taken from the first SimTrack + /// only. + float theta() const { return p4().Theta(); } - /// @brief Momentum pseudorapidity. Note this is taken from the simtrack - /// before the calorimeter - float eta() const { return p4().Eta(); } + /// @brief Momentum pseudorapidity. Note this is taken from the simtrack + /// before the calorimeter + float eta() const { return p4().Eta(); } - /// @brief Rapidity. Note this is taken from the simtrack before the - /// calorimeter - float rapidity() const { return p4().Rapidity(); } + /// @brief Rapidity. Note this is taken from the simtrack before the + /// calorimeter + float rapidity() const { return p4().Rapidity(); } - /// @brief Same as rapidity(). - float y() const { return rapidity(); } + /// @brief Same as rapidity(). + float y() const { return rapidity(); } - /** @brief Status word. + /** @brief Status word. * * Returns status() from the first gen particle, or -99 if there are no gen * particles attached. */ - int status() const { return genParticles_.empty() ? -99 : (*genParticles_[0]).status(); } + int status() const { return genParticles_.empty() ? -99 : (*genParticles_[0]).status(); } - static const unsigned int longLivedTag; ///< long lived flag + static const unsigned int longLivedTag; ///< long lived flag - /// is long lived? - bool longLived() const { return status() & longLivedTag; } + /// is long lived? + bool longLived() const { return status() & longLivedTag; } - /** @brief Gives the total number of SimHits, in the cluster */ - int numberOfSimHits() const { return nsimhits_; } + /** @brief Gives the total number of SimHits, in the cluster */ + int numberOfSimHits() const { return nsimhits_; } - /** @brief Gives the total number of SimHits, in the cluster */ - int numberOfRecHits() const { return hits_.size(); } + /** @brief Gives the total number of SimHits, in the cluster */ + int numberOfRecHits() const { return hits_.size(); } - /** @brief returns the time in ns of the caloparticle */ - float simTime() const { return time_; } + /** @brief returns the time in ns of the caloparticle */ + float simTime() const { return time_; } - /** @brief add rechit with fraction */ - void addRecHitAndFraction(uint32_t hit, float fraction) { - hits_.emplace_back(hit); - fractions_.emplace_back(fraction); - } + /** @brief add rechit with fraction */ + void addRecHitAndFraction(uint32_t hit, float fraction) { + hits_.emplace_back(hit); + fractions_.emplace_back(fraction); + } - /** @brief Returns list of rechit IDs and fractions for this CaloParticle */ - std::vector> hits_and_fractions() const { - std::vector> result; - result.reserve(hits_.size()); - for (size_t i = 0; i < hits_.size(); ++i) { - result.emplace_back(hits_[i], fractions_[i]); + /** @brief Returns list of rechit IDs and fractions for this CaloParticle */ + std::vector> hits_and_fractions() const { + std::vector> result; + result.reserve(hits_.size()); + for (size_t i = 0; i < hits_.size(); ++i) { + result.emplace_back(hits_[i], fractions_[i]); + } + return result; } - return result; - } - /** @brief clear the hits and fractions list */ - void clearHitsAndFractions() { - hits_.clear(); - fractions_.clear(); - } + /** @brief clear the hits and fractions list */ + void clearHitsAndFractions() { + hits_.clear(); + fractions_.clear(); + } - /** @brief returns the accumulated sim energy in the cluster */ - float simEnergy() const { return simhit_energy_; } + /** @brief returns the accumulated sim energy in the cluster */ + float simEnergy() const { return simhit_energy_; } - /** @brief add simhit's energy to cluster */ - void addSimHit(const PCaloHit &hit) { - simhit_energy_ += hit.energy(); - ++nsimhits_; - } + /** @brief add simhit's energy to cluster */ + void addSimHit(const PCaloHit &hit) { + simhit_energy_ += hit.energy(); + ++nsimhits_; + } - /** @brief add vertex time to the caloparticle */ - void setSimTime(const float time) { time_ = time; } + /** @brief add vertex time to the caloparticle */ + void setSimTime(const float time) { time_ = time; } -protected: - uint64_t nsimhits_{0}; - EncodedEventId event_; + protected: + uint64_t nsimhits_{0}; + EncodedEventId event_; - uint32_t particleId_{0}; - float simhit_energy_{0.f}; - float time_{std::numeric_limits::lowest()}; - std::vector hits_; - std::vector fractions_; + uint32_t particleId_{0}; + float simhit_energy_{0.f}; + float time_{std::numeric_limits::lowest()}; + std::vector hits_; + std::vector fractions_; - math::XYZTLorentzVectorF theMomentum_; + math::XYZTLorentzVectorF theMomentum_; - /// references to G4 and reco::GenParticle tracks - std::vector g4Tracks_; - reco::GenParticleRefVector genParticles_; + /// references to G4 and reco::GenParticle tracks + std::vector g4Tracks_; + reco::GenParticleRefVector genParticles_; - SimClusterRefVector simClusters_; -}; + SimClusterRefVector simClusters_; + }; +} // namespace io_v1 +using CaloParticle = io_v1::CaloParticle; #endif // SimDataFormats_CaloParticle_H diff --git a/SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h b/SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h index 3f9451e9bec7c..2125bbce582f0 100644 --- a/SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h +++ b/SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h @@ -5,8 +5,11 @@ #include "DataFormats/Common/interface/RefVector.h" #include -class CaloParticle; -std::ostream &operator<<(std::ostream &s, CaloParticle const &tp); +namespace io_v1 { + class CaloParticle; + std::ostream &operator<<(std::ostream &s, CaloParticle const &tp); +} // namespace io_v1 +using CaloParticle = io_v1::CaloParticle; typedef std::vector CaloParticleCollection; typedef edm::Ref CaloParticleRef; diff --git a/SimDataFormats/CaloAnalysis/interface/MtdCaloParticle.h b/SimDataFormats/CaloAnalysis/interface/MtdCaloParticle.h index 25db3280c2647..227cf8e07973d 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdCaloParticle.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdCaloParticle.h @@ -9,37 +9,40 @@ #include -class MtdCaloParticle : public CaloParticle { - friend std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp); +namespace io_v1 { + class MtdCaloParticle : public CaloParticle { + friend std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp); -public: - typedef MtdSimClusterRefVector::iterator mtdsc_iterator; + public: + typedef MtdSimClusterRefVector::iterator mtdsc_iterator; - MtdCaloParticle(); + MtdCaloParticle(); - MtdCaloParticle(const SimTrack &simtrk); - MtdCaloParticle(EncodedEventId eventID, uint32_t particleID); // for PU + MtdCaloParticle(const SimTrack &simtrk); + MtdCaloParticle(EncodedEventId eventID, uint32_t particleID); // for PU - // destructor - ~MtdCaloParticle(); + // destructor + ~MtdCaloParticle(); - void addSimCluster(const MtdSimClusterRef &ref) { mtdsimClusters_.push_back(ref); } + void addSimCluster(const MtdSimClusterRef &ref) { mtdsimClusters_.push_back(ref); } - /// iterators - mtdsc_iterator simCluster_begin() const { return mtdsimClusters_.begin(); } - mtdsc_iterator simCluster_end() const { return mtdsimClusters_.end(); } + /// iterators + mtdsc_iterator simCluster_begin() const { return mtdsimClusters_.begin(); } + mtdsc_iterator simCluster_end() const { return mtdsimClusters_.end(); } - const MtdSimClusterRefVector &simClusters() const { return mtdsimClusters_; } - void clearSimClusters() { mtdsimClusters_.clear(); } + const MtdSimClusterRefVector &simClusters() const { return mtdsimClusters_; } + void clearSimClusters() { mtdsimClusters_.clear(); } - /** @brief add simhit's energy to cluster */ - void addSimHit(PSimHit &hit) { - simhit_energy_ += hit.energyLoss(); - ++nsimhits_; - } + /** @brief add simhit's energy to cluster */ + void addSimHit(PSimHit &hit) { + simhit_energy_ += hit.energyLoss(); + ++nsimhits_; + } -private: - MtdSimClusterRefVector mtdsimClusters_; -}; + private: + MtdSimClusterRefVector mtdsimClusters_; + }; +} // namespace io_v1 +using MtdCaloParticle = io_v1::MtdCaloParticle; #endif // SimDataFormats_MtdCaloParticle_H diff --git a/SimDataFormats/CaloAnalysis/interface/MtdCaloParticleFwd.h b/SimDataFormats/CaloAnalysis/interface/MtdCaloParticleFwd.h index 57d60d03b96e4..93305e94492f1 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdCaloParticleFwd.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdCaloParticleFwd.h @@ -5,8 +5,11 @@ #include "DataFormats/Common/interface/RefVector.h" #include -class MtdCaloParticle; -std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp); +namespace io_v1 { + class MtdCaloParticle; + std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp); +} // namespace io_v1 +using MtdCaloParticle = io_v1::MtdCaloParticle; typedef std::vector MtdCaloParticleCollection; typedef edm::Ref MtdCaloParticleRef; diff --git a/SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h b/SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h index a7502a65d6d90..00b5e1d05c833 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h @@ -9,122 +9,125 @@ #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include -class MtdSimCluster : public SimCluster { - friend std::ostream &operator<<(std::ostream &s, MtdSimCluster const &tp); - -public: - MtdSimCluster(); - MtdSimCluster(const SimTrack &simtrk); - MtdSimCluster(EncodedEventId eventID, uint32_t particleID); // for PU - - // destructor - ~MtdSimCluster(); - - /** @brief add hit time */ - void addHitTime(float time) { - times_.emplace_back(time); - ++nsimhits_; - } - - /** @brief add hit with fraction */ - void addHitAndFraction(uint64_t hit, float fraction) { - mtdHits_.emplace_back(hit); - fractions_.emplace_back(fraction); - } - - /** @brief add hit position*/ - void addHitPosition(LocalPoint pos) { positions_.emplace_back(pos); } - - /** @brief Returns list of hit IDs and fractions for this SimCluster */ - std::vector> hits_and_fractions() const { - assert(mtdHits_.size() == fractions_.size()); - std::vector> result; - result.reserve(mtdHits_.size()); - for (size_t i = 0; i < mtdHits_.size(); ++i) { - result.emplace_back(mtdHits_[i], fractions_[i]); +namespace io_v1 { + class MtdSimCluster : public SimCluster { + friend std::ostream &operator<<(std::ostream &s, MtdSimCluster const &tp); + + public: + MtdSimCluster(); + MtdSimCluster(const SimTrack &simtrk); + MtdSimCluster(EncodedEventId eventID, uint32_t particleID); // for PU + + // destructor + ~MtdSimCluster(); + + /** @brief add hit time */ + void addHitTime(float time) { + times_.emplace_back(time); + ++nsimhits_; } - return result; - } - - /** @brief Returns list of hit IDs and energies for this SimCluster */ - std::vector> hits_and_energies() const { - assert(mtdHits_.size() == energies_.size()); - std::vector> result; - result.reserve(mtdHits_.size()); - for (size_t i = 0; i < mtdHits_.size(); ++i) { - result.emplace_back(mtdHits_[i], energies_[i]); + + /** @brief add hit with fraction */ + void addHitAndFraction(uint64_t hit, float fraction) { + mtdHits_.emplace_back(hit); + fractions_.emplace_back(fraction); + } + + /** @brief add hit position*/ + void addHitPosition(LocalPoint pos) { positions_.emplace_back(pos); } + + /** @brief Returns list of hit IDs and fractions for this SimCluster */ + std::vector> hits_and_fractions() const { + assert(mtdHits_.size() == fractions_.size()); + std::vector> result; + result.reserve(mtdHits_.size()); + for (size_t i = 0; i < mtdHits_.size(); ++i) { + result.emplace_back(mtdHits_[i], fractions_[i]); + } + return result; + } + + /** @brief Returns list of hit IDs and energies for this SimCluster */ + std::vector> hits_and_energies() const { + assert(mtdHits_.size() == energies_.size()); + std::vector> result; + result.reserve(mtdHits_.size()); + for (size_t i = 0; i < mtdHits_.size(); ++i) { + result.emplace_back(mtdHits_[i], energies_[i]); + } + return result; } - return result; - } - - /** @brief clear the hits and fractions list */ - void clearHitsAndFractions() { - std::vector().swap(mtdHits_); - std::vector().swap(fractions_); - } - - /** @brief Returns list of hit IDs and times for this SimCluster */ - std::vector> hits_and_times() const { - assert(mtdHits_.size() == times_.size()); - std::vector> result; - result.reserve(mtdHits_.size()); - for (size_t i = 0; i < mtdHits_.size(); ++i) { - result.emplace_back(mtdHits_[i], times_[i]); + + /** @brief clear the hits and fractions list */ + void clearHitsAndFractions() { + std::vector().swap(mtdHits_); + std::vector().swap(fractions_); } - return result; - } - - /** @brief Returns list of hit IDs and times for this SimCluster */ - std::vector> hits_and_positions() const { - assert(mtdHits_.size() == times_.size()); - std::vector> result; - result.reserve(mtdHits_.size()); - for (size_t i = 0; i < mtdHits_.size(); ++i) { - result.emplace_back(mtdHits_[i], positions_[i]); + + /** @brief Returns list of hit IDs and times for this SimCluster */ + std::vector> hits_and_times() const { + assert(mtdHits_.size() == times_.size()); + std::vector> result; + result.reserve(mtdHits_.size()); + for (size_t i = 0; i < mtdHits_.size(); ++i) { + result.emplace_back(mtdHits_[i], times_[i]); + } + return result; } - return result; - } - - /** @brief Returns list of detIds, rows and columns for this SimCluster */ - std::vector>> detIds_and_rows() const { - std::vector>> result; - result.reserve(mtdHits_.size()); - for (size_t i = 0; i < mtdHits_.size(); ++i) { - result.emplace_back( - mtdHits_[i] >> 32, - std::pair(static_cast(mtdHits_[i] >> 16), static_cast(mtdHits_[i]))); + + /** @brief Returns list of hit IDs and times for this SimCluster */ + std::vector> hits_and_positions() const { + assert(mtdHits_.size() == times_.size()); + std::vector> result; + result.reserve(mtdHits_.size()); + for (size_t i = 0; i < mtdHits_.size(); ++i) { + result.emplace_back(mtdHits_[i], positions_[i]); + } + return result; + } + + /** @brief Returns list of detIds, rows and columns for this SimCluster */ + std::vector>> detIds_and_rows() const { + std::vector>> result; + result.reserve(mtdHits_.size()); + for (size_t i = 0; i < mtdHits_.size(); ++i) { + result.emplace_back( + mtdHits_[i] >> 32, + std::pair(static_cast(mtdHits_[i] >> 16), static_cast(mtdHits_[i]))); + } + return result; } - return result; - } - - /** @brief clear the times list */ - void clearHitsTime() { std::vector().swap(times_); } - - /** @brief clear the positions list */ - void clearHitsPosition() { std::vector().swap(positions_); } - - void clear() { - clearHitsAndFractions(); - clearHitsEnergy(); - clearHitsTime(); - clearHitsPosition(); - } - - /** @brief add simhit's energy to cluster */ - void addSimHit(const PSimHit &hit) { - simhit_energy_ += hit.energyLoss(); - ++nsimhits_; - } - - void setHitProdType(unsigned int offset) { idOffset_ = offset; } - - unsigned int hitProdType() const { return idOffset_; } - -protected: - std::vector mtdHits_; - std::vector times_; - std::vector positions_; - unsigned int idOffset_{0}; -}; + + /** @brief clear the times list */ + void clearHitsTime() { std::vector().swap(times_); } + + /** @brief clear the positions list */ + void clearHitsPosition() { std::vector().swap(positions_); } + + void clear() { + clearHitsAndFractions(); + clearHitsEnergy(); + clearHitsTime(); + clearHitsPosition(); + } + + /** @brief add simhit's energy to cluster */ + void addSimHit(const PSimHit &hit) { + simhit_energy_ += hit.energyLoss(); + ++nsimhits_; + } + + void setHitProdType(unsigned int offset) { idOffset_ = offset; } + + unsigned int hitProdType() const { return idOffset_; } + + protected: + std::vector mtdHits_; + std::vector times_; + std::vector positions_; + unsigned int idOffset_{0}; + }; +} // namespace io_v1 +using MtdSimCluster = io_v1::MtdSimCluster; #endif diff --git a/SimDataFormats/CaloAnalysis/interface/MtdSimClusterFwd.h b/SimDataFormats/CaloAnalysis/interface/MtdSimClusterFwd.h index f2dee356e6060..49d9e74c8a4b5 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdSimClusterFwd.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdSimClusterFwd.h @@ -5,8 +5,11 @@ #include "DataFormats/Common/interface/RefVector.h" #include -class MtdSimCluster; -std::ostream &operator<<(std::ostream &s, MtdSimCluster const &tp); +namespace io_v1 { + class MtdSimCluster; + std::ostream &operator<<(std::ostream &s, MtdSimCluster const &tp); +} // namespace io_v1 +using MtdSimCluster = io_v1::MtdSimCluster; typedef std::vector MtdSimClusterCollection; typedef edm::Ref MtdSimClusterRef; diff --git a/SimDataFormats/CaloAnalysis/interface/MtdSimLayerCluster.h b/SimDataFormats/CaloAnalysis/interface/MtdSimLayerCluster.h index 22775d03081e6..a6d7af70ebf4e 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdSimLayerCluster.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdSimLayerCluster.h @@ -8,57 +8,60 @@ #include "SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h" #include -class MtdSimLayerCluster : public MtdSimCluster { - friend std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp); - -public: - MtdSimLayerCluster(); - MtdSimLayerCluster(const SimTrack &simtrk); - MtdSimLayerCluster(EncodedEventId eventID, uint32_t particleID); // for PU - - // destructor - ~MtdSimLayerCluster(); - - /** @brief computes the time of the cluster */ - float computeClusterTime() { - simLC_time_ = 0.; - float tot_en = 0.; - for (uint32_t i = 0; i < times_.size(); i++) { - simLC_time_ += times_[i] * energies_[i]; - tot_en += energies_[i]; +namespace io_v1 { + class MtdSimLayerCluster : public MtdSimCluster { + friend std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp); + + public: + MtdSimLayerCluster(); + MtdSimLayerCluster(const SimTrack &simtrk); + MtdSimLayerCluster(EncodedEventId eventID, uint32_t particleID); // for PU + + // destructor + ~MtdSimLayerCluster(); + + /** @brief computes the time of the cluster */ + float computeClusterTime() { + simLC_time_ = 0.; + float tot_en = 0.; + for (uint32_t i = 0; i < times_.size(); i++) { + simLC_time_ += times_[i] * energies_[i]; + tot_en += energies_[i]; + } + if (tot_en != 0.) + simLC_time_ = simLC_time_ / tot_en; + return simLC_time_; } - if (tot_en != 0.) - simLC_time_ = simLC_time_ / tot_en; - return simLC_time_; - } - /** @brief computes the energy of the cluster */ - void addCluEnergy(float energy) { simLC_energy_ = energy; } + /** @brief computes the energy of the cluster */ + void addCluEnergy(float energy) { simLC_energy_ = energy; } - /** @brief computes the position of the cluster */ - void addCluLocalPos(LocalPoint pos) { simLC_pos_ = pos; } + /** @brief computes the position of the cluster */ + void addCluLocalPos(LocalPoint pos) { simLC_pos_ = pos; } - /** @brief add the index of the simcluster */ - void addCluIndex(const uint32_t index) { seedId_ = index; } + /** @brief add the index of the simcluster */ + void addCluIndex(const uint32_t index) { seedId_ = index; } - /** @brief returns the time of the cluster */ - float simLCTime() const { return simLC_time_; } + /** @brief returns the time of the cluster */ + float simLCTime() const { return simLC_time_; } - /** @brief returns the local position of the cluster */ - LocalPoint simLCPos() const { return simLC_pos_; } + /** @brief returns the local position of the cluster */ + LocalPoint simLCPos() const { return simLC_pos_; } - /** @brief returns the accumulated sim energy in the cluster */ - float simLCEnergy() const { return simLC_energy_; } + /** @brief returns the accumulated sim energy in the cluster */ + float simLCEnergy() const { return simLC_energy_; } - uint32_t seedId() const { return seedId_; } + uint32_t seedId() const { return seedId_; } -private: - // id of the simCluster it comes from - uint32_t seedId_; + private: + // id of the simCluster it comes from + uint32_t seedId_; - float simLC_time_{0.f}; - float simLC_energy_{0.f}; - LocalPoint simLC_pos_; -}; + float simLC_time_{0.f}; + float simLC_energy_{0.f}; + LocalPoint simLC_pos_; + }; +} // namespace io_v1 +using MtdSimLayerCluster = io_v1::MtdSimLayerCluster; #endif diff --git a/SimDataFormats/CaloAnalysis/interface/MtdSimLayerClusterFwd.h b/SimDataFormats/CaloAnalysis/interface/MtdSimLayerClusterFwd.h index 48383297435a5..87a5cbb87dc91 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdSimLayerClusterFwd.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdSimLayerClusterFwd.h @@ -13,6 +13,8 @@ typedef edm::RefVector MtdSimLayerClusterRefVector typedef edm::RefProd MtdSimLayerClusterRefProd; typedef edm::RefVector MtdSimLayerClusterContainer; -std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp); +namespace io_v1 { + std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp); +} // namespace io_v1 #endif diff --git a/SimDataFormats/CaloAnalysis/interface/MtdSimTrackster.h b/SimDataFormats/CaloAnalysis/interface/MtdSimTrackster.h index d4d223cc7abea..2d3c6c4f2f1e4 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdSimTrackster.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdSimTrackster.h @@ -8,39 +8,42 @@ #include "SimDataFormats/CaloAnalysis/interface/MtdSimCluster.h" #include -class MtdSimTrackster : public MtdSimCluster { - friend std::ostream &operator<<(std::ostream &s, MtdSimTrackster const &tp); +namespace io_v1 { + class MtdSimTrackster : public MtdSimCluster { + friend std::ostream &operator<<(std::ostream &s, MtdSimTrackster const &tp); -public: - MtdSimTrackster(); + public: + MtdSimTrackster(); - MtdSimTrackster(const SimCluster &sc); - MtdSimTrackster(EncodedEventId eventID, uint32_t particleID); // for PU - MtdSimTrackster(const SimCluster &sc, const std::vector SCs, const float time, const GlobalPoint pos); + MtdSimTrackster(const SimCluster &sc); + MtdSimTrackster(EncodedEventId eventID, uint32_t particleID); // for PU + MtdSimTrackster(const SimCluster &sc, const std::vector SCs, const float time, const GlobalPoint pos); - // destructor - ~MtdSimTrackster(); + // destructor + ~MtdSimTrackster(); - /** @brief returns the position of the cluster */ - GlobalPoint position() const { return posAtEntrance_; } + /** @brief returns the position of the cluster */ + GlobalPoint position() const { return posAtEntrance_; } - /** @brief returns the time of the cluster */ - float time() const { return timeAtEntrance_; } + /** @brief returns the time of the cluster */ + float time() const { return timeAtEntrance_; } - /** @brief returns the layer clusters indexes in the sim trackster*/ - std::vector clusters() const { return clusters_; } + /** @brief returns the layer clusters indexes in the sim trackster*/ + std::vector clusters() const { return clusters_; } - /** @brief add simhit's energy to cluster */ - void addCluster(const uint32_t sc) { clusters_.push_back(sc); } + /** @brief add simhit's energy to cluster */ + void addCluster(const uint32_t sc) { clusters_.push_back(sc); } - /** @brief Gives the total number of SimHits, in the cluster */ - int numberOfClusters() const { return clusters_.size(); } + /** @brief Gives the total number of SimHits, in the cluster */ + int numberOfClusters() const { return clusters_.size(); } -private: - float timeAtEntrance_{0.f}; - GlobalPoint posAtEntrance_; - // indices of the MtdSimLayerClusters contained in the simTrackster - std::vector clusters_; -}; + private: + float timeAtEntrance_{0.f}; + GlobalPoint posAtEntrance_; + // indices of the MtdSimLayerClusters contained in the simTrackster + std::vector clusters_; + }; +} // namespace io_v1 +using MtdSimTrackster = io_v1::MtdSimTrackster; #endif // SimDataFormats_MtdSimTrackster_H diff --git a/SimDataFormats/CaloAnalysis/interface/MtdSimTracksterFwd.h b/SimDataFormats/CaloAnalysis/interface/MtdSimTracksterFwd.h index b6658c881fa52..c17d609204c31 100644 --- a/SimDataFormats/CaloAnalysis/interface/MtdSimTracksterFwd.h +++ b/SimDataFormats/CaloAnalysis/interface/MtdSimTracksterFwd.h @@ -5,8 +5,11 @@ #include "DataFormats/Common/interface/RefVector.h" #include -class MtdSimTrackster; -std::ostream &operator<<(std::ostream &s, MtdSimTrackster const &tp); +namespace io_v1 { + class MtdSimTrackster; + std::ostream &operator<<(std::ostream &s, MtdSimTrackster const &tp); +} // namespace io_v1 +using MtdSimTrackster = io_v1::MtdSimTrackster; typedef std::vector MtdSimTracksterCollection; typedef edm::Ref MtdSimTracksterRef; diff --git a/SimDataFormats/CaloAnalysis/interface/SimCluster.h b/SimDataFormats/CaloAnalysis/interface/SimCluster.h index feeef822aec4a..e0c0d0869baf7 100644 --- a/SimDataFormats/CaloAnalysis/interface/SimCluster.h +++ b/SimDataFormats/CaloAnalysis/interface/SimCluster.h @@ -1,6 +1,7 @@ #ifndef SimDataFormats_SimCluster_h #define SimDataFormats_SimCluster_h +#include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/Math/interface/LorentzVector.h" #include "DataFormats/Math/interface/Point3D.h" @@ -15,7 +16,8 @@ #include #include -/** @brief Monte Carlo truth information used for calorimeter reco validation +namespace io_v1 { + /** @brief Monte Carlo truth information used for calorimeter reco validation * * Object with copies to the original SimTrack, and eventual reference to GenParticle * Simulated calorimeter hits are saved as a list of pairs (DetId, fraction of reco hit energy contributed by the SimTrack) @@ -26,260 +28,262 @@ * (mark.grimes@bristol.ac.uk). * @date original date unknown, re-engineering Jan-May 2013 */ -class SimCluster { - friend std::ostream &operator<<(std::ostream &s, SimCluster const &tp); - -public: - typedef int Charge; ///< electric charge type - typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector - typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; ///< Lorentz vector - typedef math::XYZPointD Point; ///< point in the space - typedef math::XYZVectorD Vector; ///< point in the space - - /// reference to reco::GenParticle - typedef reco::GenParticleRefVector::iterator genp_iterator; - typedef std::vector::const_iterator g4t_iterator; - - SimCluster() = default; - - SimCluster(const SimTrack &simtrk); - SimCluster(EncodedEventId eventID, uint32_t particleID); // for PU - /** Build a SimCluster from a collection of SimCluster. Hits&fractions are merged, SimTracks are all added in g4Tracks_ */ - template - requires std::ranges::input_range && std::same_as, SimCluster> - static SimCluster mergeHitsFromCollection(R const &); - - /** @brief PDG ID. + class SimCluster { + friend std::ostream &operator<<(std::ostream &s, SimCluster const &tp); + + public: + typedef int Charge; ///< electric charge type + typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector + typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; ///< Lorentz vector + typedef math::XYZPointD Point; ///< point in the space + typedef math::XYZVectorD Vector; ///< point in the space + + /// reference to reco::GenParticle + typedef reco::GenParticleRefVector::iterator genp_iterator; + typedef std::vector::const_iterator g4t_iterator; + + SimCluster() = default; + + SimCluster(const SimTrack &simtrk); + SimCluster(EncodedEventId eventID, uint32_t particleID); // for PU + /** Build a SimCluster from a collection of SimCluster. Hits&fractions are merged, SimTracks are all added in g4Tracks_ */ + template + requires std::ranges::input_range && std::same_as, SimCluster> + static SimCluster mergeHitsFromCollection(R const &); + + /** @brief PDG ID. * * Returns the PDG ID of the first associated gen particle. If there are no * gen particles associated then it returns type() from the first SimTrack. */ - int pdgId() const { - if (genParticles_.empty()) - return g4Tracks_[0].type(); - else - return (*genParticles_.begin())->pdgId(); - } + int pdgId() const { + if (genParticles_.empty()) + return g4Tracks_[0].type(); + else + return (*genParticles_.begin())->pdgId(); + } - /** @brief Signal source, crossing number. + /** @brief Signal source, crossing number. * * Note this is taken from the first SimTrack only, but there shouldn't be any * SimTracks from different crossings in the SimCluster. */ - EncodedEventId eventId() const { return event_; } + EncodedEventId eventId() const { return event_; } - uint64_t particleId() const { return particleId_; } + uint64_t particleId() const { return particleId_; } - // Setters for G4 and reco::GenParticle - void addGenParticle(const reco::GenParticleRef &ref) { genParticles_.push_back(ref); } - void addG4Track(const SimTrack &t) { g4Tracks_.push_back(t); } - /// iterators - genp_iterator genParticle_begin() const { return genParticles_.begin(); } - genp_iterator genParticle_end() const { return genParticles_.end(); } - g4t_iterator g4Track_begin() const { return g4Tracks_.begin(); } - g4t_iterator g4Track_end() const { return g4Tracks_.end(); } + // Setters for G4 and reco::GenParticle + void addGenParticle(const reco::GenParticleRef &ref) { genParticles_.push_back(ref); } + void addG4Track(const SimTrack &t) { g4Tracks_.push_back(t); } + /// iterators + genp_iterator genParticle_begin() const { return genParticles_.begin(); } + genp_iterator genParticle_end() const { return genParticles_.end(); } + g4t_iterator g4Track_begin() const { return g4Tracks_.begin(); } + g4t_iterator g4Track_end() const { return g4Tracks_.end(); } - // Getters for Embd and Sim Tracks - const reco::GenParticleRefVector &genParticles() const { return genParticles_; } - // Only for clusters from the signal vertex - const std::vector &g4Tracks() const { return g4Tracks_; } + // Getters for Embd and Sim Tracks + const reco::GenParticleRefVector &genParticles() const { return genParticles_; } + // Only for clusters from the signal vertex + const std::vector &g4Tracks() const { return g4Tracks_; } - /// @brief Electric charge. Note this is taken from the first SimTrack only. - float charge() const { return g4Tracks_[0].charge(); } - /// Gives charge in unit of quark charge (should be 3 times "charge()") - int threeCharge() const { return lrintf(3.f * charge()); } + /// @brief Electric charge. Note this is taken from the first SimTrack only. + float charge() const { return g4Tracks_[0].charge(); } + /// Gives charge in unit of quark charge (should be 3 times "charge()") + int threeCharge() const { return lrintf(3.f * charge()); } - /// @brief Four-momentum Lorentz vector. Note this is taken from the first - /// SimTrack only. - const math::XYZTLorentzVectorF &p4() const { return theMomentum_; } + /// @brief Four-momentum Lorentz vector. Note this is taken from the first + /// SimTrack only. + const math::XYZTLorentzVectorF &p4() const { return theMomentum_; } - /// @brief spatial momentum vector - math::XYZVectorF momentum() const { return p4().Vect(); } + /// @brief spatial momentum vector + math::XYZVectorF momentum() const { return p4().Vect(); } - /// @brief Vector to boost to the particle centre of mass frame. - math::XYZVectorF boostToCM() const { return p4().BoostToCM(); } + /// @brief Vector to boost to the particle centre of mass frame. + math::XYZVectorF boostToCM() const { return p4().BoostToCM(); } - /// @brief Magnitude of momentum vector. Note this is taken from the first - /// SimTrack only. - float p() const { return p4().P(); } + /// @brief Magnitude of momentum vector. Note this is taken from the first + /// SimTrack only. + float p() const { return p4().P(); } - /// @brief Energy. Note this is taken from the first SimTrack only. - float energy() const { return p4().E(); } + /// @brief Energy. Note this is taken from the first SimTrack only. + float energy() const { return p4().E(); } - /// @brief Transverse energy. Note this is taken from the first SimTrack only. - float et() const { return p4().Et(); } + /// @brief Transverse energy. Note this is taken from the first SimTrack only. + float et() const { return p4().Et(); } - /// @brief Mass. Note this is taken from the first SimTrack only. - float mass() const { return p4().M(); } + /// @brief Mass. Note this is taken from the first SimTrack only. + float mass() const { return p4().M(); } - /// @brief Mass squared. Note this is taken from the first SimTrack only. - float massSqr() const { return pow(mass(), 2); } + /// @brief Mass squared. Note this is taken from the first SimTrack only. + float massSqr() const { return pow(mass(), 2); } - /// @brief Transverse mass. Note this is taken from the first SimTrack only. - float mt() const { return p4().Mt(); } + /// @brief Transverse mass. Note this is taken from the first SimTrack only. + float mt() const { return p4().Mt(); } - /// @brief Transverse mass squared. Note this is taken from the first SimTrack - /// only. - float mtSqr() const { return p4().Mt2(); } + /// @brief Transverse mass squared. Note this is taken from the first SimTrack + /// only. + float mtSqr() const { return p4().Mt2(); } - /// @brief x coordinate of momentum vector. Note this is taken from the first - /// SimTrack only. - float px() const { return p4().Px(); } + /// @brief x coordinate of momentum vector. Note this is taken from the first + /// SimTrack only. + float px() const { return p4().Px(); } - /// @brief y coordinate of momentum vector. Note this is taken from the first - /// SimTrack only. - float py() const { return p4().Py(); } + /// @brief y coordinate of momentum vector. Note this is taken from the first + /// SimTrack only. + float py() const { return p4().Py(); } - /// @brief z coordinate of momentum vector. Note this is taken from the first - /// SimTrack only. - float pz() const { return p4().Pz(); } + /// @brief z coordinate of momentum vector. Note this is taken from the first + /// SimTrack only. + float pz() const { return p4().Pz(); } - /// @brief Transverse momentum. Note this is taken from the first SimTrack - /// only. - float pt() const { return p4().Pt(); } + /// @brief Transverse momentum. Note this is taken from the first SimTrack + /// only. + float pt() const { return p4().Pt(); } - /// @brief Momentum azimuthal angle. Note this is taken from the first - /// SimTrack only. - float phi() const { return p4().Phi(); } + /// @brief Momentum azimuthal angle. Note this is taken from the first + /// SimTrack only. + float phi() const { return p4().Phi(); } - /// @brief Momentum polar angle. Note this is taken from the first SimTrack - /// only. - float theta() const { return p4().Theta(); } + /// @brief Momentum polar angle. Note this is taken from the first SimTrack + /// only. + float theta() const { return p4().Theta(); } - /// @brief Momentum pseudorapidity. Note this is taken from the simtrack - /// before the calorimeter - float eta() const { return p4().Eta(); } + /// @brief Momentum pseudorapidity. Note this is taken from the simtrack + /// before the calorimeter + float eta() const { return p4().Eta(); } - /// @brief Rapidity. Note this is taken from the simtrack before the - /// calorimeter - float rapidity() const { return p4().Rapidity(); } + /// @brief Rapidity. Note this is taken from the simtrack before the + /// calorimeter + float rapidity() const { return p4().Rapidity(); } - /// @brief Same as rapidity(). - float y() const { return rapidity(); } + /// @brief Same as rapidity(). + float y() const { return rapidity(); } - /** @brief Status word. + /** @brief Status word. * * Returns status() from the first gen particle, or -99 if there are no gen * particles attached. */ - int status() const { return genParticles_.empty() ? -99 : (*genParticles_[0]).status(); } + int status() const { return genParticles_.empty() ? -99 : (*genParticles_[0]).status(); } - static const unsigned int longLivedTag; ///< long lived flag + static const unsigned int longLivedTag; ///< long lived flag - /// is long lived? - bool longLived() const { return status() & longLivedTag; } + /// is long lived? + bool longLived() const { return status() & longLivedTag; } - /** @brief Gives the total number of SimHits, in the cluster */ - int numberOfSimHits() const { return nsimhits_; } + /** @brief Gives the total number of SimHits, in the cluster */ + int numberOfSimHits() const { return nsimhits_; } - /** @brief Gives the total number of SimHits, in the cluster */ - int numberOfRecHits() const { return hits_.size(); } + /** @brief Gives the total number of SimHits, in the cluster */ + int numberOfRecHits() const { return hits_.size(); } - /** @brief add rechit with fraction */ - void addRecHitAndFraction(uint32_t hit, float fraction) { - hits_.emplace_back(hit); - fractions_.emplace_back(fraction); - } + /** @brief add rechit with fraction */ + void addRecHitAndFraction(uint32_t hit, float fraction) { + hits_.emplace_back(hit); + fractions_.emplace_back(fraction); + } - /** @brief add rechit energy */ - void addHitEnergy(float energy) { energies_.emplace_back(energy); } + /** @brief add rechit energy */ + void addHitEnergy(float energy) { energies_.emplace_back(energy); } - /** @brief Returns list of rechit IDs and fractions for this SimCluster */ - std::vector> hits_and_fractions() const { - std::vector> result; - result.reserve(hits_.size()); - for (size_t i = 0; i < hits_.size(); ++i) { - result.emplace_back(hits_[i], fractions_[i]); + /** @brief Returns list of rechit IDs and fractions for this SimCluster */ + std::vector> hits_and_fractions() const { + std::vector> result; + result.reserve(hits_.size()); + for (size_t i = 0; i < hits_.size(); ++i) { + result.emplace_back(hits_[i], fractions_[i]); + } + return result; } - return result; - } - /** @brief Returns filtered list of rechit IDs and fractions for this SimCluster based on a predicate */ - std::vector> filtered_hits_and_fractions( - const std::function &predicate) const { - std::vector> result; - for (size_t i = 0; i < hits_.size(); ++i) { - DetId detid(hits_[i]); - if (predicate(detid)) { - result.emplace_back(hits_[i], fractions_[i]); + /** @brief Returns filtered list of rechit IDs and fractions for this SimCluster based on a predicate */ + std::vector> filtered_hits_and_fractions( + const std::function &predicate) const { + std::vector> result; + for (size_t i = 0; i < hits_.size(); ++i) { + DetId detid(hits_[i]); + if (predicate(detid)) { + result.emplace_back(hits_[i], fractions_[i]); + } } + return result; } - return result; - } - /** @brief Returns list of rechit IDs and energies for this SimCluster */ - std::vector> hits_and_energies() const { - assert(hits_.size() == energies_.size()); - std::vector> result; - result.reserve(hits_.size()); - for (size_t i = 0; i < hits_.size(); ++i) { - result.emplace_back(hits_[i], energies_[i]); + /** @brief Returns list of rechit IDs and energies for this SimCluster */ + std::vector> hits_and_energies() const { + assert(hits_.size() == energies_.size()); + std::vector> result; + result.reserve(hits_.size()); + for (size_t i = 0; i < hits_.size(); ++i) { + result.emplace_back(hits_[i], energies_[i]); + } + return result; } - return result; - } - /** @brief clear the hits and fractions list */ - void clearHitsAndFractions() { - std::vector().swap(hits_); - std::vector().swap(fractions_); - } + /** @brief clear the hits and fractions list */ + void clearHitsAndFractions() { + std::vector().swap(hits_); + std::vector().swap(fractions_); + } - /** @brief clear the energies list */ - void clearHitsEnergy() { std::vector().swap(energies_); } + /** @brief clear the energies list */ + void clearHitsEnergy() { std::vector().swap(energies_); } - /** @brief returns the accumulated sim energy in the cluster */ - float simEnergy() const { return simhit_energy_; } + /** @brief returns the accumulated sim energy in the cluster */ + float simEnergy() const { return simhit_energy_; } - /** @brief add simhit's energy to cluster */ - void addSimHit(const PCaloHit &hit) { - simhit_energy_ += hit.energy(); - ++nsimhits_; - } + /** @brief add simhit's energy to cluster */ + void addSimHit(const PCaloHit &hit) { + simhit_energy_ += hit.energy(); + ++nsimhits_; + } + + protected: + uint64_t nsimhits_{0}; + EncodedEventId event_; + + uint32_t particleId_{0}; + float simhit_energy_{0.f}; + std::vector hits_; + std::vector fractions_; + std::vector energies_; + + math::XYZTLorentzVectorF theMomentum_; -protected: - uint64_t nsimhits_{0}; - EncodedEventId event_; - - uint32_t particleId_{0}; - float simhit_energy_{0.f}; - std::vector hits_; - std::vector fractions_; - std::vector energies_; - - math::XYZTLorentzVectorF theMomentum_; - - std::vector g4Tracks_; ///< Copies of SimTrack used to build SimCluster (usually there is only one) - /// Ref to GenParticle (in case the SimCluster is created from the entire GenParticle). Usually either empty or length 1 - reco::GenParticleRefVector genParticles_; -}; - -template - requires std::ranges::input_range && std::same_as, SimCluster> -SimCluster SimCluster::mergeHitsFromCollection(R const &inputs) { - assert(!std::ranges::empty(inputs)); - SimCluster ret; - ret.event_ = inputs[0].event_; - ret.particleId_ = inputs[0].particleId_; - - ret.g4Tracks_.reserve(inputs.size()); - std::unordered_map acc_fractions; ///< Map DetId->(fraction) - for (SimCluster const &other : inputs) { - ret.simhit_energy_ += other.simhit_energy_; - - assert(other.hits_.size() == other.fractions_.size()); - for (std::size_t i = 0; i < other.hits_.size(); i++) { - acc_fractions[other.hits_[i]] += other.fractions_[i]; + std::vector g4Tracks_; ///< Copies of SimTrack used to build SimCluster (usually there is only one) + /// Ref to GenParticle (in case the SimCluster is created from the entire GenParticle). Usually either empty or length 1 + reco::GenParticleRefVector genParticles_; + }; + + template + requires std::ranges::input_range && std::same_as, SimCluster> + SimCluster SimCluster::mergeHitsFromCollection(R const &inputs) { + assert(!std::ranges::empty(inputs)); + SimCluster ret; + ret.event_ = inputs[0].event_; + ret.particleId_ = inputs[0].particleId_; + + ret.g4Tracks_.reserve(inputs.size()); + std::unordered_map acc_fractions; ///< Map DetId->(fraction) + for (SimCluster const &other : inputs) { + ret.simhit_energy_ += other.simhit_energy_; + + assert(other.hits_.size() == other.fractions_.size()); + for (std::size_t i = 0; i < other.hits_.size(); i++) { + acc_fractions[other.hits_[i]] += other.fractions_[i]; + } + + ret.g4Tracks_.insert(ret.g4Tracks_.end(), other.g4Tracks_.begin(), other.g4Tracks_.end()); } - ret.g4Tracks_.insert(ret.g4Tracks_.end(), other.g4Tracks_.begin(), other.g4Tracks_.end()); - } + ret.hits_.reserve(acc_fractions.size()); + ret.fractions_.reserve(acc_fractions.size()); + for (const auto &hit_and_fraction : acc_fractions) { + ret.hits_.push_back(hit_and_fraction.first); + ret.fractions_.push_back(hit_and_fraction.second); + } + ret.nsimhits_ = ret.hits_.size(); - ret.hits_.reserve(acc_fractions.size()); - ret.fractions_.reserve(acc_fractions.size()); - for (const auto &hit_and_fraction : acc_fractions) { - ret.hits_.push_back(hit_and_fraction.first); - ret.fractions_.push_back(hit_and_fraction.second); + return ret; } - ret.nsimhits_ = ret.hits_.size(); - - return ret; -} +} // namespace io_v1 +using SimCluster = io_v1::SimCluster; #endif // SimDataFormats_SimCluster_H diff --git a/SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h b/SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h index 4f11d4bcc86ed..dc914ba963464 100644 --- a/SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h +++ b/SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h @@ -5,8 +5,11 @@ #include "DataFormats/Common/interface/RefVector.h" #include -class SimCluster; -std::ostream &operator<<(std::ostream &s, SimCluster const &tp); +namespace io_v1 { + class SimCluster; + std::ostream &operator<<(std::ostream &s, SimCluster const &tp); +} // namespace io_v1 +using SimCluster = io_v1::SimCluster; typedef std::vector SimClusterCollection; typedef edm::Ref SimClusterRef; diff --git a/SimDataFormats/CaloAnalysis/interface/SimTauCPLink.h b/SimDataFormats/CaloAnalysis/interface/SimTauCPLink.h index a04d519a98e1d..575e4b5d4ea32 100644 --- a/SimDataFormats/CaloAnalysis/interface/SimTauCPLink.h +++ b/SimDataFormats/CaloAnalysis/interface/SimTauCPLink.h @@ -7,158 +7,161 @@ #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -class SimTauCPLink { -public: - SimTauCPLink() {} - ~SimTauCPLink() {} - struct DecayNav { - int pdgId_; - int resonance_idx_; - int calo_particle_idx_; - int gen_particle_idx_; - int pdgId() const { return pdgId_; } - int resonance_idx() const { return resonance_idx_; } - int calo_particle_idx() const { return calo_particle_idx_; } - int gen_particle_idx() const { return gen_particle_idx_; } +namespace io_v1 { + class SimTauCPLink { + public: + SimTauCPLink() {} + ~SimTauCPLink() {} + struct DecayNav { + int pdgId_; + int resonance_idx_; + int calo_particle_idx_; + int gen_particle_idx_; + int pdgId() const { return pdgId_; } + int resonance_idx() const { return resonance_idx_; } + int calo_particle_idx() const { return calo_particle_idx_; } + int gen_particle_idx() const { return gen_particle_idx_; } - private: - }; + private: + }; - std::vector> resonances; - std::vector leaves; - CaloParticleRefVector calo_particle_leaves; - int decayMode; + std::vector> resonances; + std::vector leaves; + CaloParticleRefVector calo_particle_leaves; + int decayMode; - enum decayModes { - kNull = -1, - kOneProng0PiZero, // 0 - kOneProng1PiZero, // 1 - kOneProng2PiZero, // 2 - kOneProng3PiZero, // 3 - kOneProngNPiZero, // 4 - kTwoProng0PiZero, // 5 - kTwoProng1PiZero, // 6 - kTwoProng2PiZero, // 7 - kTwoProng3PiZero, // 8 - kTwoProngNPiZero, // 9 - kThreeProng0PiZero, // 10 - kThreeProng1PiZero, // 11 - kThreeProng2PiZero, // 12 - kThreeProng3PiZero, // 13 - kThreeProngNPiZero, // 14 - kRareDecayMode, // 15 - kElectron, // 16 - kMuon // 17 - }; + enum decayModes { + kNull = -1, + kOneProng0PiZero, // 0 + kOneProng1PiZero, // 1 + kOneProng2PiZero, // 2 + kOneProng3PiZero, // 3 + kOneProngNPiZero, // 4 + kTwoProng0PiZero, // 5 + kTwoProng1PiZero, // 6 + kTwoProng2PiZero, // 7 + kTwoProng3PiZero, // 8 + kTwoProngNPiZero, // 9 + kThreeProng0PiZero, // 10 + kThreeProng1PiZero, // 11 + kThreeProng2PiZero, // 12 + kThreeProng3PiZero, // 13 + kThreeProngNPiZero, // 14 + kRareDecayMode, // 15 + kElectron, // 16 + kMuon // 17 + }; - void dump(void) const { - LogDebug("SimTauProducer") - .format("Decay mode: {} ", buildDecayModes()) - .format("Leaves: {} ", leaves.size()) - .format("Resonances: {}", resonances.size()); - for (auto const &l : leaves) { + void dump(void) const { LogDebug("SimTauProducer") - .format("L {} {} CP: {} GenP idx: {}", - l.pdgId(), - l.resonance_idx(), - (int)((l.calo_particle_idx() == -1) ? -1 : calo_particle_leaves[l.calo_particle_idx()].key()), - l.gen_particle_idx()); - } - for (auto const &r : resonances) { - LogDebug("SimTauProducer").format("R {} {}", r.first, r.second); - } - } - - void dumpDecay(const std::pair &entry) const { - if (entry.second == -1) { // No intermediate mother. - LogDebug("SimTauProducer").format("{} {}", entry.first, entry.second); - } else { - LogDebug("SimTauProducer").format("{} {} coming from: ", entry.first, entry.second); - auto const &mother = resonances[entry.second]; - dumpDecay(mother); + .format("Decay mode: {} ", buildDecayModes()) + .format("Leaves: {} ", leaves.size()) + .format("Resonances: {}", resonances.size()); + for (auto const &l : leaves) { + LogDebug("SimTauProducer") + .format("L {} {} CP: {} GenP idx: {}", + l.pdgId(), + l.resonance_idx(), + (int)((l.calo_particle_idx() == -1) ? -1 : calo_particle_leaves[l.calo_particle_idx()].key()), + l.gen_particle_idx()); + } + for (auto const &r : resonances) { + LogDebug("SimTauProducer").format("R {} {}", r.first, r.second); + } } - } - void dumpFullDecay(void) const { - for (auto const &leaf : leaves) { - dumpDecay({leaf.pdgId(), leaf.resonance_idx()}); + void dumpDecay(const std::pair &entry) const { + if (entry.second == -1) { // No intermediate mother. + LogDebug("SimTauProducer").format("{} {}", entry.first, entry.second); + } else { + LogDebug("SimTauProducer").format("{} {} coming from: ", entry.first, entry.second); + auto const &mother = resonances[entry.second]; + dumpDecay(mother); + } } - } - int buildDecayModes() const { - int numElectrons = 0; - int numMuons = 0; - int numHadrons = 0; - int numPhotons = 0; - for (auto leaf : leaves) { - int pdg_id = abs(leaf.pdgId()); - switch (pdg_id) { - case 22: - numPhotons++; - break; - case 11: - numElectrons++; - break; - case 13: - numMuons++; - break; - case 16: - break; - default: - numHadrons++; + void dumpFullDecay(void) const { + for (auto const &leaf : leaves) { + dumpDecay({leaf.pdgId(), leaf.resonance_idx()}); } } - if (numElectrons == 1) - return kElectron; - else if (numMuons == 1) - return kMuon; - switch (numHadrons) { - case 1: - switch (numPhotons) { - case 0: - return kOneProng0PiZero; - case 2: - return kOneProng1PiZero; - case 4: - return kOneProng2PiZero; - case 6: - return kOneProng3PiZero; + int buildDecayModes() const { + int numElectrons = 0; + int numMuons = 0; + int numHadrons = 0; + int numPhotons = 0; + for (auto leaf : leaves) { + int pdg_id = abs(leaf.pdgId()); + switch (pdg_id) { + case 22: + numPhotons++; + break; + case 11: + numElectrons++; + break; + case 13: + numMuons++; + break; + case 16: + break; default: - return kOneProngNPiZero; + numHadrons++; } - case 2: - switch (numPhotons) { - case 0: - return kTwoProng0PiZero; - case 2: - return kTwoProng1PiZero; - case 4: - return kTwoProng2PiZero; - case 6: - return kTwoProng3PiZero; - default: - return kTwoProngNPiZero; - } - case 3: - switch (numPhotons) { - case 0: - return kThreeProng0PiZero; - case 2: - return kThreeProng1PiZero; - case 4: - return kThreeProng2PiZero; - case 6: - return kThreeProng3PiZero; - default: - return kThreeProngNPiZero; - } - default: - return kRareDecayMode; + } + + if (numElectrons == 1) + return kElectron; + else if (numMuons == 1) + return kMuon; + switch (numHadrons) { + case 1: + switch (numPhotons) { + case 0: + return kOneProng0PiZero; + case 2: + return kOneProng1PiZero; + case 4: + return kOneProng2PiZero; + case 6: + return kOneProng3PiZero; + default: + return kOneProngNPiZero; + } + case 2: + switch (numPhotons) { + case 0: + return kTwoProng0PiZero; + case 2: + return kTwoProng1PiZero; + case 4: + return kTwoProng2PiZero; + case 6: + return kTwoProng3PiZero; + default: + return kTwoProngNPiZero; + } + case 3: + switch (numPhotons) { + case 0: + return kThreeProng0PiZero; + case 2: + return kThreeProng1PiZero; + case 4: + return kThreeProng2PiZero; + case 6: + return kThreeProng3PiZero; + default: + return kThreeProngNPiZero; + } + default: + return kRareDecayMode; + } } - } -private: -}; + private: + }; +} // namespace io_v1 +using SimTauCPLink = io_v1::SimTauCPLink; #endif //SimTauCPLink diff --git a/SimDataFormats/CaloAnalysis/src/CaloParticle.cc b/SimDataFormats/CaloAnalysis/src/CaloParticle.cc index ac05f22e7d02d..da5a304fbf480 100644 --- a/SimDataFormats/CaloAnalysis/src/CaloParticle.cc +++ b/SimDataFormats/CaloAnalysis/src/CaloParticle.cc @@ -6,47 +6,49 @@ #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -const unsigned int CaloParticle::longLivedTag = 65536; - -CaloParticle::CaloParticle() { - // No operation -} - -CaloParticle::CaloParticle(const SimTrack &simtrk) { - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); -} - -CaloParticle::CaloParticle(EncodedEventId eventID, uint32_t particleID) { - event_ = eventID; - particleId_ = particleID; -} - -CaloParticle::~CaloParticle() {} - -std::ostream &operator<<(std::ostream &s, CaloParticle const &tp) { - s << "Calo Particle:" << std::endl; - s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - - for (CaloParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; +namespace io_v1 { + const unsigned int CaloParticle::longLivedTag = 65536; + + CaloParticle::CaloParticle() { + // No operation } - for (CaloParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t CaloParticle and Geant types" << std::endl; - } + CaloParticle::CaloParticle(const SimTrack &simtrk) { + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + } + + CaloParticle::CaloParticle(EncodedEventId eventID, uint32_t particleID) { + event_ = eventID; + particleId_ = particleID; } - s << "SimClusters in this CaloParticle: " << std::endl; - for (auto itr = tp.simClusters_.begin(); itr != tp.simClusters_.end(); ++itr) { - s << **itr; + + CaloParticle::~CaloParticle() {} + + std::ostream &operator<<(std::ostream &s, CaloParticle const &tp) { + s << "Calo Particle:" << std::endl; + s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + + for (CaloParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } + + for (CaloParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t CaloParticle and Geant types" << std::endl; + } + } + s << "SimClusters in this CaloParticle: " << std::endl; + for (auto itr = tp.simClusters_.begin(); itr != tp.simClusters_.end(); ++itr) { + s << **itr; + } + s << std::endl; + return s; } - s << std::endl; - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/CaloAnalysis/src/MtdCaloParticle.cc b/SimDataFormats/CaloAnalysis/src/MtdCaloParticle.cc index 2dfe1b708bce7..a3e00bfbb2362 100644 --- a/SimDataFormats/CaloAnalysis/src/MtdCaloParticle.cc +++ b/SimDataFormats/CaloAnalysis/src/MtdCaloParticle.cc @@ -6,45 +6,47 @@ #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -MtdCaloParticle::MtdCaloParticle() { - // No operation -} - -MtdCaloParticle::MtdCaloParticle(const SimTrack &simtrk) { - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); -} - -MtdCaloParticle::MtdCaloParticle(EncodedEventId eventID, uint32_t particleID) { - event_ = eventID; - particleId_ = particleID; -} - -MtdCaloParticle::~MtdCaloParticle() {} - -std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp) { - s << "Calo Particle:" << std::endl; - s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - - for (MtdCaloParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; +namespace io_v1 { + MtdCaloParticle::MtdCaloParticle() { + // No operation } - for (MtdCaloParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t MtdCaloParticle and Geant types" << std::endl; - } + MtdCaloParticle::MtdCaloParticle(const SimTrack &simtrk) { + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + } + + MtdCaloParticle::MtdCaloParticle(EncodedEventId eventID, uint32_t particleID) { + event_ = eventID; + particleId_ = particleID; } - s << "SimClusters in this MtdCaloParticle: " << std::endl; - for (auto itr = tp.simClusters_.begin(); itr != tp.simClusters_.end(); ++itr) { - s << **itr; + + MtdCaloParticle::~MtdCaloParticle() {} + + std::ostream &operator<<(std::ostream &s, MtdCaloParticle const &tp) { + s << "Calo Particle:" << std::endl; + s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + + for (MtdCaloParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } + + for (MtdCaloParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t MtdCaloParticle and Geant types" << std::endl; + } + } + s << "SimClusters in this MtdCaloParticle: " << std::endl; + for (auto itr = tp.simClusters_.begin(); itr != tp.simClusters_.end(); ++itr) { + s << **itr; + } + s << std::endl; + return s; } - s << std::endl; - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/CaloAnalysis/src/MtdSimCluster.cc b/SimDataFormats/CaloAnalysis/src/MtdSimCluster.cc index 6f19a9e0cf15d..453100d3db289 100644 --- a/SimDataFormats/CaloAnalysis/src/MtdSimCluster.cc +++ b/SimDataFormats/CaloAnalysis/src/MtdSimCluster.cc @@ -4,42 +4,44 @@ #include -MtdSimCluster::MtdSimCluster() { - // No operation -} +namespace io_v1 { + MtdSimCluster::MtdSimCluster() { + // No operation + } -MtdSimCluster::MtdSimCluster(const SimTrack &simtrk) { - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); + MtdSimCluster::MtdSimCluster(const SimTrack &simtrk) { + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); -} + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + } -MtdSimCluster::MtdSimCluster(EncodedEventId eventID, uint32_t particleID) { - event_ = eventID; - particleId_ = particleID; -} + MtdSimCluster::MtdSimCluster(EncodedEventId eventID, uint32_t particleID) { + event_ = eventID; + particleId_ = particleID; + } -MtdSimCluster::~MtdSimCluster() {} + MtdSimCluster::~MtdSimCluster() {} -std::ostream &operator<<(std::ostream &s, MtdSimCluster const &tp) { - s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + std::ostream &operator<<(std::ostream &s, MtdSimCluster const &tp) { + s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - for (MtdSimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; - } + for (MtdSimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } - for (MtdSimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t MtdSimCluster and Geant types" << std::endl; + for (MtdSimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t MtdSimCluster and Geant types" << std::endl; + } } + s << " # of cells = " << tp.hits_.size() + << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl; + return s; } - s << " # of cells = " << tp.hits_.size() - << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/CaloAnalysis/src/MtdSimLayerCluster.cc b/SimDataFormats/CaloAnalysis/src/MtdSimLayerCluster.cc index 957711f1e822d..6e7268d7b2778 100644 --- a/SimDataFormats/CaloAnalysis/src/MtdSimLayerCluster.cc +++ b/SimDataFormats/CaloAnalysis/src/MtdSimLayerCluster.cc @@ -4,44 +4,46 @@ #include -MtdSimLayerCluster::MtdSimLayerCluster() { - // No operation -} - -MtdSimLayerCluster::MtdSimLayerCluster(const SimTrack &simtrk) { - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); - - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); -} - -MtdSimLayerCluster::MtdSimLayerCluster(EncodedEventId eventID, uint32_t particleID) { - event_ = eventID; - particleId_ = particleID; -} - -MtdSimLayerCluster::~MtdSimLayerCluster() {} - -std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp) { - s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - s << " Offset " << tp.hitProdType() << " " - << " LC time " << tp.simLCTime() << " LC energy " << tp.simLCEnergy() << std::endl; - - for (MtdSimLayerCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; +namespace io_v1 { + MtdSimLayerCluster::MtdSimLayerCluster() { + // No operation } - for (MtdSimLayerCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t MtdSimLayerCluster and Geant types" << std::endl; + MtdSimLayerCluster::MtdSimLayerCluster(const SimTrack &simtrk) { + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); + + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + } + + MtdSimLayerCluster::MtdSimLayerCluster(EncodedEventId eventID, uint32_t particleID) { + event_ = eventID; + particleId_ = particleID; + } + + MtdSimLayerCluster::~MtdSimLayerCluster() {} + + std::ostream &operator<<(std::ostream &s, MtdSimLayerCluster const &tp) { + s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + s << " Offset " << tp.hitProdType() << " " + << " LC time " << tp.simLCTime() << " LC energy " << tp.simLCEnergy() << std::endl; + + for (MtdSimLayerCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } + + for (MtdSimLayerCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t MtdSimLayerCluster and Geant types" << std::endl; + } } + s << " # of cells = " << tp.mtdHits_.size() + << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl; + return s; } - s << " # of cells = " << tp.mtdHits_.size() - << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/CaloAnalysis/src/MtdSimTrackster.cc b/SimDataFormats/CaloAnalysis/src/MtdSimTrackster.cc index 1b50c65fbc986..579fb07bb3ec5 100644 --- a/SimDataFormats/CaloAnalysis/src/MtdSimTrackster.cc +++ b/SimDataFormats/CaloAnalysis/src/MtdSimTrackster.cc @@ -2,59 +2,61 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -MtdSimTrackster::MtdSimTrackster() { - // No operation -} - -MtdSimTrackster::MtdSimTrackster(const SimCluster &sc) { - auto simtrk = sc.g4Tracks()[0]; - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); - - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); -} - -MtdSimTrackster::MtdSimTrackster(EncodedEventId eventID, uint32_t particleID) { - event_ = eventID; - particleId_ = particleID; -} - -MtdSimTrackster::MtdSimTrackster(const SimCluster &sc, - const std::vector SCs, - const float time, - const GlobalPoint pos) { - auto simtrk = sc.g4Tracks()[0]; - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); - - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); - - clusters_ = SCs; - timeAtEntrance_ = time; - posAtEntrance_ = pos; -} - -MtdSimTrackster::~MtdSimTrackster() {} - -std::ostream &operator<<(std::ostream &s, MtdSimTrackster const &tp) { - s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - - for (MtdSimTrackster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; +namespace io_v1 { + MtdSimTrackster::MtdSimTrackster() { + // No operation } - for (MtdSimTrackster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t MtdSimTrackster and Geant types" << std::endl; + MtdSimTrackster::MtdSimTrackster(const SimCluster &sc) { + auto simtrk = sc.g4Tracks()[0]; + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); + + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + } + + MtdSimTrackster::MtdSimTrackster(EncodedEventId eventID, uint32_t particleID) { + event_ = eventID; + particleId_ = particleID; + } + + MtdSimTrackster::MtdSimTrackster(const SimCluster &sc, + const std::vector SCs, + const float time, + const GlobalPoint pos) { + auto simtrk = sc.g4Tracks()[0]; + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); + + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + + clusters_ = SCs; + timeAtEntrance_ = time; + posAtEntrance_ = pos; + } + + MtdSimTrackster::~MtdSimTrackster() {} + + std::ostream &operator<<(std::ostream &s, MtdSimTrackster const &tp) { + s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + + for (MtdSimTrackster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } + + for (MtdSimTrackster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t MtdSimTrackster and Geant types" << std::endl; + } } + s << " # of clusters = " << tp.clusters_.size() << std::endl; + return s; } - s << " # of clusters = " << tp.clusters_.size() << std::endl; - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/CaloAnalysis/src/SimCluster.cc b/SimDataFormats/CaloAnalysis/src/SimCluster.cc index 799ba102700f7..93b1573a4dcc1 100644 --- a/SimDataFormats/CaloAnalysis/src/SimCluster.cc +++ b/SimDataFormats/CaloAnalysis/src/SimCluster.cc @@ -5,38 +5,40 @@ #include #include -const unsigned int SimCluster::longLivedTag = 65536; +namespace io_v1 { + const unsigned int SimCluster::longLivedTag = 65536; -SimCluster::SimCluster(const SimTrack &simtrk) { - addG4Track(simtrk); - event_ = simtrk.eventId(); - particleId_ = simtrk.trackId(); + SimCluster::SimCluster(const SimTrack &simtrk) { + addG4Track(simtrk); + event_ = simtrk.eventId(); + particleId_ = simtrk.trackId(); - theMomentum_.SetPxPyPzE( - simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); -} + theMomentum_.SetPxPyPzE( + simtrk.momentum().px(), simtrk.momentum().py(), simtrk.momentum().pz(), simtrk.momentum().E()); + } -SimCluster::SimCluster(EncodedEventId eventID, uint32_t particleID) { - event_ = eventID; - particleId_ = particleID; -} + SimCluster::SimCluster(EncodedEventId eventID, uint32_t particleID) { + event_ = eventID; + particleId_ = particleID; + } -std::ostream &operator<<(std::ostream &s, SimCluster const &tp) { - s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + std::ostream &operator<<(std::ostream &s, SimCluster const &tp) { + s << "CP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - for (SimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; - } + for (SimCluster::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } - for (SimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t SimCluster and Geant types" << std::endl; + for (SimCluster::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t SimCluster and Geant types" << std::endl; + } } + s << " # of cells = " << tp.hits_.size() + << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl; + return s; } - s << " # of cells = " << tp.hits_.size() - << ", effective cells = " << std::accumulate(tp.fractions_.begin(), tp.fractions_.end(), 0.f) << std::endl; - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/CaloAnalysis/src/classes_def.xml b/SimDataFormats/CaloAnalysis/src/classes_def.xml index 5e5bcc21cecc3..5ca14dbc056a3 100644 --- a/SimDataFormats/CaloAnalysis/src/classes_def.xml +++ b/SimDataFormats/CaloAnalysis/src/classes_def.xml @@ -1,7 +1,6 @@ - - - + + @@ -11,8 +10,8 @@ - - + + @@ -21,12 +20,8 @@ - - - - - - + + @@ -36,13 +31,10 @@ - + - - - - - + + @@ -53,7 +45,7 @@ - + @@ -63,7 +55,7 @@ - + @@ -72,11 +64,11 @@ - - + + - - + + diff --git a/SimDataFormats/CaloHit/interface/PCaloHit.h b/SimDataFormats/CaloHit/interface/PCaloHit.h index a5b21bbc557f1..d6f0da5d1dd9d 100644 --- a/SimDataFormats/CaloHit/interface/PCaloHit.h +++ b/SimDataFormats/CaloHit/interface/PCaloHit.h @@ -7,73 +7,76 @@ // Persistent Calorimeter hit -class PCaloHit { -public: - PCaloHit(float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0) - : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), myDepth(d) {} +namespace io_v1 { + class PCaloHit { + public: + PCaloHit(float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0) + : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), myDepth(d) {} - PCaloHit(unsigned int id, float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0) - : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), detId(id), myDepth(d) {} - PCaloHit(float eEM, float eHad, float t, int i = 0, uint16_t d = 0); - PCaloHit(unsigned int id, float eEM, float eHad, float t, int i = 0, uint16_t d = 0); + PCaloHit(unsigned int id, float e = 0., float t = 0., int i = 0, float emFraction = 1., uint16_t d = 0) + : myEnergy(e), myEMFraction(emFraction), myTime(t), myItra(i), detId(id), myDepth(d) {} + PCaloHit(float eEM, float eHad, float t, int i = 0, uint16_t d = 0); + PCaloHit(unsigned int id, float eEM, float eHad, float t, int i = 0, uint16_t d = 0); - //Names - static const char *name() { return "Hit"; } + //Names + static const char *name() { return "Hit"; } - const char *getName() const { return name(); } + const char *getName() const { return name(); } - //Energy deposit of the Hit - double energy() const { return myEnergy; } - double energyEM() const { return myEMFraction * myEnergy; } - double energyHad() const { return (1. - myEMFraction) * myEnergy; } - void setEnergy(double e) { myEnergy = e; } + //Energy deposit of the Hit + double energy() const { return myEnergy; } + double energyEM() const { return myEMFraction * myEnergy; } + double energyHad() const { return (1. - myEMFraction) * myEnergy; } + void setEnergy(double e) { myEnergy = e; } - //Time of the deposit - double time() const { return myTime; } + //Time of the deposit + double time() const { return myTime; } - //Geant track number - int geantTrackId() const { return myItra; } + //Geant track number + int geantTrackId() const { return myItra; } - //DetId where the Hit is recorded - void setID(unsigned int id) { detId = id; } - unsigned int id() const { return detId; } + //DetId where the Hit is recorded + void setID(unsigned int id) { detId = id; } + unsigned int id() const { return detId; } - //Encoded depth in the detector - //for ECAL: # radiation length, 30 == APD - //for HCAL: - void setDepth(uint16_t depth) { myDepth = depth; } - uint16_t depth() const { return myDepth; } + //Encoded depth in the detector + //for ECAL: # radiation length, 30 == APD + //for HCAL: + void setDepth(uint16_t depth) { myDepth = depth; } + uint16_t depth() const { return myDepth; } - //Event Id (for signal/pileup discrimination) + //Event Id (for signal/pileup discrimination) - void setEventId(EncodedEventId e) { theEventId = e; } - EncodedEventId eventId() const { return theEventId; } + void setEventId(EncodedEventId e) { theEventId = e; } + EncodedEventId eventId() const { return theEventId; } - // new method used by the new transient CF - void setTime(float t) { myTime = t; } + // new method used by the new transient CF + void setTime(float t) { myTime = t; } - //Comparisons + //Comparisons - bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; } + bool operator<(const PCaloHit &d) const { return myEnergy < d.myEnergy; } - //Same Hit (by value) - bool operator==(const PCaloHit &d) const { return (myEnergy == d.myEnergy && detId == d.detId); } + //Same Hit (by value) + bool operator==(const PCaloHit &d) const { return (myEnergy == d.myEnergy && detId == d.detId); } - static const int kEcalDepthIdMask = 0x3; - static const int kEcalDepthMask = 0x1FFF; - static const int kEcalDepthOffset = 3; - static const int kEcalDepthRefz = 0X4; + static const int kEcalDepthIdMask = 0x3; + static const int kEcalDepthMask = 0x1FFF; + static const int kEcalDepthOffset = 3; + static const int kEcalDepthRefz = 0X4; -protected: - float myEnergy; - float myEMFraction; - float myTime; - int myItra; - unsigned int detId; - uint16_t myDepth; - EncodedEventId theEventId; -}; + protected: + float myEnergy; + float myEMFraction; + float myTime; + int myItra; + unsigned int detId; + uint16_t myDepth; + EncodedEventId theEventId; + }; -std::ostream &operator<<(std::ostream &, const PCaloHit &); + std::ostream &operator<<(std::ostream &, const PCaloHit &); +} // namespace io_v1 +using PCaloHit = io_v1::PCaloHit; #endif // _SimDataFormats_SimCaloHit_PCaloHit_h_ diff --git a/SimDataFormats/CaloHit/interface/PCaloHitFwd.h b/SimDataFormats/CaloHit/interface/PCaloHitFwd.h index 070b007c13d10..5b62ad6104c31 100644 --- a/SimDataFormats/CaloHit/interface/PCaloHitFwd.h +++ b/SimDataFormats/CaloHit/interface/PCaloHitFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_CaloHit_PCaloHitFwd_h #define SimDataFormats_CaloHit_PCaloHitFwd_h -class PCaloHit; +namespace io_v1 { + class PCaloHit; +} // namespace io_v1 +using PCaloHit = io_v1::PCaloHit; #endif diff --git a/SimDataFormats/CaloHit/src/PCaloHit.cc b/SimDataFormats/CaloHit/src/PCaloHit.cc index 02dd8506b7b31..41975ba83638a 100644 --- a/SimDataFormats/CaloHit/src/PCaloHit.cc +++ b/SimDataFormats/CaloHit/src/PCaloHit.cc @@ -1,22 +1,24 @@ #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include -PCaloHit::PCaloHit(float eEM, float eHad, float t, int i, uint16_t d) : myTime(t), myItra(i), myDepth(d) { - myEnergy = eEM + eHad; - myEMFraction = (myEnergy <= 0.f ? 1.f : eEM / myEnergy); -} +namespace io_v1 { + PCaloHit::PCaloHit(float eEM, float eHad, float t, int i, uint16_t d) : myTime(t), myItra(i), myDepth(d) { + myEnergy = eEM + eHad; + myEMFraction = (myEnergy <= 0.f ? 1.f : eEM / myEnergy); + } -PCaloHit::PCaloHit(unsigned int id, float eEM, float eHad, float t, int i, uint16_t d) - : myTime(t), myItra(i), detId(id), myDepth(d) { - myEnergy = eEM + eHad; - myEMFraction = (myEnergy <= 0.f ? 1.f : eEM / myEnergy); -} + PCaloHit::PCaloHit(unsigned int id, float eEM, float eHad, float t, int i, uint16_t d) + : myTime(t), myItra(i), detId(id), myDepth(d) { + myEnergy = eEM + eHad; + myEMFraction = (myEnergy <= 0.f ? 1.f : eEM / myEnergy); + } -std::ostream& operator<<(std::ostream& o, const PCaloHit& hit) { - o << "0x" << std::hex << hit.id() << std::dec << ": Energy (EM) " << hit.energyEM() << " GeV " - << ": Energy (Had) " << hit.energyHad() << " GeV " - << " Tof " << hit.time() << " ns " - << " Geant track #" << hit.geantTrackId() << " Encoded depth " << hit.depth(); + std::ostream& operator<<(std::ostream& o, const PCaloHit& hit) { + o << "0x" << std::hex << hit.id() << std::dec << ": Energy (EM) " << hit.energyEM() << " GeV " + << ": Energy (Had) " << hit.energyHad() << " GeV " + << " Tof " << hit.time() << " ns " + << " Geant track #" << hit.geantTrackId() << " Encoded depth " << hit.depth(); - return o; -} + return o; + } +} // namespace io_v1 diff --git a/SimDataFormats/CaloHit/src/classes_def.xml b/SimDataFormats/CaloHit/src/classes_def.xml index 07f1ddb950ce4..1c84b0e8cbfa0 100644 --- a/SimDataFormats/CaloHit/src/classes_def.xml +++ b/SimDataFormats/CaloHit/src/classes_def.xml @@ -1,12 +1,12 @@ - - + + - - - - - + + + + + @@ -21,25 +21,21 @@ - - + + - - - - - - + + - - + + diff --git a/SimDataFormats/CaloTest/src/classes_def.xml b/SimDataFormats/CaloTest/src/classes_def.xml index 2b0d0359a609d..73318409b3ede 100644 --- a/SimDataFormats/CaloTest/src/classes_def.xml +++ b/SimDataFormats/CaloTest/src/classes_def.xml @@ -1,23 +1,23 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h b/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h index 5f62954b158f4..3d607d2d7bc4b 100644 --- a/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h +++ b/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h @@ -19,43 +19,49 @@ #include #include -class CrossingFramePlaybackInfoNew { -public: - // con- and destructors - - CrossingFramePlaybackInfoNew() {} - CrossingFramePlaybackInfoNew(int minBunch, int maxBunch, unsigned int maxNbSources); - - ~CrossingFramePlaybackInfoNew() {} - - typedef std::vector::iterator iterator; - typedef std::pair range; - - // setter - void setInfo(std::vector& eventInfo, std::vector& sizes) { - sizes_.swap(sizes); - eventInfo_.swap(eventInfo); - } - - // getters - std::vector::const_iterator getEventId(size_t offset) const { - std::vector::const_iterator iter = eventInfo_.begin(); - std::advance(iter, offset); - return iter; - } - - size_t getNumberOfEvents(int bunchIdx, size_t sourceNumber) const { - return sizes_[((bunchIdx - minBunch_) * maxNbSources_) + sourceNumber]; - } - - //private: - - // we need the same info for each bunchcrossing - unsigned int maxNbSources_; - int nBcrossings_; - std::vector sizes_; - std::vector eventInfo_; - int minBunch_; -}; +namespace io_v1 { + + class CrossingFramePlaybackInfoNew { + public: + // con- and destructors + + CrossingFramePlaybackInfoNew() {} + CrossingFramePlaybackInfoNew(int minBunch, int maxBunch, unsigned int maxNbSources); + + ~CrossingFramePlaybackInfoNew() {} + + typedef std::vector::iterator iterator; + typedef std::pair range; + + // setter + void setInfo(std::vector& eventInfo, std::vector& sizes) { + sizes_.swap(sizes); + eventInfo_.swap(eventInfo); + } + + // getters + std::vector::const_iterator getEventId(size_t offset) const { + std::vector::const_iterator iter = eventInfo_.begin(); + std::advance(iter, offset); + return iter; + } + + size_t getNumberOfEvents(int bunchIdx, size_t sourceNumber) const { + return sizes_[((bunchIdx - minBunch_) * maxNbSources_) + sourceNumber]; + } + + //private: + + // we need the same info for each bunchcrossing + unsigned int maxNbSources_; + int nBcrossings_; + std::vector sizes_; + std::vector eventInfo_; + int minBunch_; + }; + +} // namespace io_v1 + +using CrossingFramePlaybackInfoNew = io_v1::CrossingFramePlaybackInfoNew; #endif diff --git a/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNewFwd.h b/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNewFwd.h index c3d80729c7bb0..27739bbc092df 100644 --- a/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNewFwd.h +++ b/SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNewFwd.h @@ -1,6 +1,10 @@ #ifndef SimDataFormats_CrossingFrame_CrossingFramePlaybackInfoNewFwd_h #define SimDataFormats_CrossingFrame_CrossingFramePlaybackInfoNewFwd_h -class CrossingFramePlaybackInfoNew; +namespace io_v1 { + class CrossingFramePlaybackInfoNew; +} // namespace io_v1 + +using CrossingFramePlaybackInfoNew = io_v1::CrossingFramePlaybackInfoNew; #endif diff --git a/SimDataFormats/CrossingFrame/src/CrossingFramePlaybackInfoNew.cc b/SimDataFormats/CrossingFrame/src/CrossingFramePlaybackInfoNew.cc index 81b446d0d260c..395d3d83b2da3 100644 --- a/SimDataFormats/CrossingFrame/src/CrossingFramePlaybackInfoNew.cc +++ b/SimDataFormats/CrossingFrame/src/CrossingFramePlaybackInfoNew.cc @@ -1,9 +1,13 @@ #include "SimDataFormats/CrossingFrame/interface/CrossingFramePlaybackInfoNew.h" #include -CrossingFramePlaybackInfoNew::CrossingFramePlaybackInfoNew(int minBunch, int maxBunch, unsigned int maxNbSources) - : maxNbSources_(maxNbSources), - nBcrossings_(maxBunch - minBunch + 1), - sizes_(maxNbSources_ * nBcrossings_, 0U), - eventInfo_(), - minBunch_(minBunch) {} +namespace io_v1 { + + CrossingFramePlaybackInfoNew::CrossingFramePlaybackInfoNew(int minBunch, int maxBunch, unsigned int maxNbSources) + : maxNbSources_(maxNbSources), + nBcrossings_(maxBunch - minBunch + 1), + sizes_(maxNbSources_ * nBcrossings_, 0U), + eventInfo_(), + minBunch_(minBunch) {} + +} // namespace io_v1 diff --git a/SimDataFormats/CrossingFrame/src/classes_def.xml b/SimDataFormats/CrossingFrame/src/classes_def.xml index ebd5d7f7cc394..f2f30712472ef 100755 --- a/SimDataFormats/CrossingFrame/src/classes_def.xml +++ b/SimDataFormats/CrossingFrame/src/classes_def.xml @@ -1,11 +1,11 @@ - - + + - - + + @@ -21,7 +21,7 @@ - + diff --git a/SimDataFormats/DigiSimLinks/interface/DTDigiSimLink.h b/SimDataFormats/DigiSimLinks/interface/DTDigiSimLink.h index 81e8fb461f250..fb90f186839b4 100644 --- a/SimDataFormats/DigiSimLinks/interface/DTDigiSimLink.h +++ b/SimDataFormats/DigiSimLinks/interface/DTDigiSimLink.h @@ -6,67 +6,70 @@ #include #include -class DTDigiSimLink { -public: - typedef uint32_t ChannelType; - - // Construct from the wire number and the digi number (this identifies - // uniquely multiple digis on the same wire), the TDC counts, the SimTrack Id and the EncodedEvent Id. - // Base is related to the tdc unit (32 = Phase 1; 30 = Phase 2) - explicit DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base = 32); - - // Construct from the wire number and the digi number (this identifies - // uniquely multiple digis on the same wire), the time (ns), the SimTrack Id and the EncodedEvent Id. - // time is converted in TDC counts (1 TDC = 25./32. ns) - explicit DTDigiSimLink( - int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base = 32); - - // Default constructor. - DTDigiSimLink(); - - // The channel identifier and the digi number packed together - ChannelType channel() const; - - // Return wire number - int wire() const; - - // Identifies different digis within the same cell - int number() const; - - // Get raw TDC count - uint32_t countsTDC() const; - - // Get time in ns - double time() const; - - // Return the SimTrack Id - unsigned int SimTrackId() const; - - // Return the Encoded Event Id - EncodedEventId eventId() const; - - // Used to repack the channel number to an int - struct ChannelPacking { - uint16_t wi; - uint16_t num; +namespace io_v1 { + class DTDigiSimLink { + public: + typedef uint32_t ChannelType; + + // Construct from the wire number and the digi number (this identifies + // uniquely multiple digis on the same wire), the TDC counts, the SimTrack Id and the EncodedEvent Id. + // Base is related to the tdc unit (32 = Phase 1; 30 = Phase 2) + explicit DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base = 32); + + // Construct from the wire number and the digi number (this identifies + // uniquely multiple digis on the same wire), the time (ns), the SimTrack Id and the EncodedEvent Id. + // time is converted in TDC counts (1 TDC = 25./32. ns) + explicit DTDigiSimLink( + int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base = 32); + + // Default constructor. + DTDigiSimLink(); + + // The channel identifier and the digi number packed together + ChannelType channel() const; + + // Return wire number + int wire() const; + + // Identifies different digis within the same cell + int number() const; + + // Get raw TDC count + uint32_t countsTDC() const; + + // Get time in ns + double time() const; + + // Return the SimTrack Id + unsigned int SimTrackId() const; + + // Return the Encoded Event Id + EncodedEventId eventId() const; + + // Used to repack the channel number to an int + struct ChannelPacking { + uint16_t wi; + uint16_t num; + }; + + private: + // The value of one TDC count in ns + static const double reso; + + private: + uint16_t theWire; // wire number + uint8_t theDigiNumber; // counter for digis in the same cell + uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2) + int32_t theCounts; // TDC count, in units given by 1/theTDCBase + uint32_t theSimTrackId; // identifier of the SimTrack that produced the digi + EncodedEventId theEventId; }; -private: - // The value of one TDC count in ns - static const double reso; - -private: - uint16_t theWire; // wire number - uint8_t theDigiNumber; // counter for digis in the same cell - uint8_t theTDCBase; // TDC base (counts per BX; 32 in Ph1 or 30 in Ph2) - int32_t theCounts; // TDC count, in units given by 1/theTDCBase - uint32_t theSimTrackId; // identifier of the SimTrack that produced the digi - EncodedEventId theEventId; -}; - -inline std::ostream& operator<<(std::ostream& o, const DTDigiSimLink& digisimlink) { - return o << "wire:" << digisimlink.wire() << " digi:" << digisimlink.number() << " time:" << digisimlink.time() - << " SimTrack:" << digisimlink.SimTrackId() << " eventId:" << digisimlink.eventId().rawId(); -} + inline std::ostream& operator<<(std::ostream& o, const DTDigiSimLink& digisimlink) { + return o << "wire:" << digisimlink.wire() << " digi:" << digisimlink.number() << " time:" << digisimlink.time() + << " SimTrack:" << digisimlink.SimTrackId() << " eventId:" << digisimlink.eventId().rawId(); + } +} // namespace io_v1 +using DTDigiSimLink = io_v1::DTDigiSimLink; #endif diff --git a/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc b/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc index ef0ae98ac6556..da8c385c337a9 100644 --- a/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc +++ b/SimDataFormats/DigiSimLinks/src/DTDigiSimLink.cc @@ -2,44 +2,47 @@ using namespace std; -DTDigiSimLink::DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base) - : theWire(wireNr), - theDigiNumber(digiNr), - theTDCBase(base), - theCounts(nTDC), - theSimTrackId(trackId), - theEventId(evId) {} - -DTDigiSimLink::DTDigiSimLink(int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base) - : theWire(wireNr), - theDigiNumber(digiNr), - theTDCBase(base), - theCounts(static_cast(tdrift * base / 25.)), - theSimTrackId(trackId), - theEventId(evId) {} - -DTDigiSimLink::DTDigiSimLink() - : theWire(0), theDigiNumber(0), theTDCBase(32), theCounts(0), theSimTrackId(0), theEventId(0) {} - -DTDigiSimLink::ChannelType DTDigiSimLink::channel() const { +namespace io_v1 { + DTDigiSimLink::DTDigiSimLink(int wireNr, int digiNr, int nTDC, unsigned int trackId, EncodedEventId evId, int base) + : theWire(wireNr), + theDigiNumber(digiNr), + theTDCBase(base), + theCounts(nTDC), + theSimTrackId(trackId), + theEventId(evId) {} + + DTDigiSimLink::DTDigiSimLink( + int wireNr, int digiNr, double tdrift, unsigned int trackId, EncodedEventId evId, int base) + : theWire(wireNr), + theDigiNumber(digiNr), + theTDCBase(base), + theCounts(static_cast(tdrift * base / 25.)), + theSimTrackId(trackId), + theEventId(evId) {} + + DTDigiSimLink::DTDigiSimLink() + : theWire(0), theDigiNumber(0), theTDCBase(32), theCounts(0), theSimTrackId(0), theEventId(0) {} + + DTDigiSimLink::ChannelType DTDigiSimLink::channel() const { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" - ChannelPacking result; - result.wi = theWire; - result.num = theDigiNumber; - DTDigiSimLink::ChannelType* p_result = reinterpret_cast(&result); - return *p_result; + ChannelPacking result; + result.wi = theWire; + result.num = theDigiNumber; + DTDigiSimLink::ChannelType* p_result = reinterpret_cast(&result); + return *p_result; #pragma GCC diagnostic pop -} + } -int DTDigiSimLink::wire() const { return theWire; } + int DTDigiSimLink::wire() const { return theWire; } -int DTDigiSimLink::number() const { return theDigiNumber; } + int DTDigiSimLink::number() const { return theDigiNumber; } -uint32_t DTDigiSimLink::countsTDC() const { return theCounts; } + uint32_t DTDigiSimLink::countsTDC() const { return theCounts; } -double DTDigiSimLink::time() const { return theCounts * 25. / theTDCBase; } + double DTDigiSimLink::time() const { return theCounts * 25. / theTDCBase; } -unsigned int DTDigiSimLink::SimTrackId() const { return theSimTrackId; } + unsigned int DTDigiSimLink::SimTrackId() const { return theSimTrackId; } -EncodedEventId DTDigiSimLink::eventId() const { return theEventId; } + EncodedEventId DTDigiSimLink::eventId() const { return theEventId; } +} // namespace io_v1 diff --git a/SimDataFormats/DigiSimLinks/src/classes_def.xml b/SimDataFormats/DigiSimLinks/src/classes_def.xml index 7190f047e6ded..c29859d025e5a 100644 --- a/SimDataFormats/DigiSimLinks/src/classes_def.xml +++ b/SimDataFormats/DigiSimLinks/src/classes_def.xml @@ -1,10 +1,9 @@ - - - + + - - - - + + + + diff --git a/SimDataFormats/EcalTestBeam/src/classes_def.xml b/SimDataFormats/EcalTestBeam/src/classes_def.xml index f5926c92b2e11..4c992d4143666 100644 --- a/SimDataFormats/EcalTestBeam/src/classes_def.xml +++ b/SimDataFormats/EcalTestBeam/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + diff --git a/SimDataFormats/EncodedEventId/src/classes_def.xml b/SimDataFormats/EncodedEventId/src/classes_def.xml index 3b4fd39633971..a00c80592eff6 100644 --- a/SimDataFormats/EncodedEventId/src/classes_def.xml +++ b/SimDataFormats/EncodedEventId/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + diff --git a/SimDataFormats/Forward/src/classes_def.xml b/SimDataFormats/Forward/src/classes_def.xml index 8dd96a80a6517..26d17f60f4ca7 100644 --- a/SimDataFormats/Forward/src/classes_def.xml +++ b/SimDataFormats/Forward/src/classes_def.xml @@ -1,15 +1,15 @@ - - + + - - + + - - + + diff --git a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h index 22852206a116a..c50fe95dbf96c 100644 --- a/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h +++ b/SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h @@ -6,32 +6,35 @@ #include "DataFormats/GeometryVector/interface/LocalVector.h" #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" -class GEMDigiSimLink { -public: - GEMDigiSimLink(uint16_t strip, int8_t bx, int16_t particleType, uint32_t trackId, EncodedEventId eventId) { - strip_ = strip; - bx_ = bx; - particleType_ = particleType; - trackId_ = trackId; - eventId_ = eventId; - } +namespace io_v1 { + class GEMDigiSimLink { + public: + GEMDigiSimLink(uint16_t strip, int8_t bx, int16_t particleType, uint32_t trackId, EncodedEventId eventId) { + strip_ = strip; + bx_ = bx; + particleType_ = particleType; + trackId_ = trackId; + eventId_ = eventId; + } - GEMDigiSimLink() {} - ~GEMDigiSimLink() {} + GEMDigiSimLink() {} + ~GEMDigiSimLink() {} - unsigned int getStrip() const { return strip_; } - int getBx() const { return bx_; } - int getParticleType() const { return particleType_; } - unsigned int getTrackId() const { return trackId_; } - EncodedEventId getEventId() const { return eventId_; } + unsigned int getStrip() const { return strip_; } + int getBx() const { return bx_; } + int getParticleType() const { return particleType_; } + unsigned int getTrackId() const { return trackId_; } + EncodedEventId getEventId() const { return eventId_; } - inline bool operator<(const GEMDigiSimLink& other) const { return getStrip() < other.getStrip(); } + inline bool operator<(const GEMDigiSimLink& other) const { return getStrip() < other.getStrip(); } -private: - uint16_t strip_; - int8_t bx_; - int16_t particleType_; - uint32_t trackId_; - EncodedEventId eventId_; -}; + private: + uint16_t strip_; + int8_t bx_; + int16_t particleType_; + uint32_t trackId_; + EncodedEventId eventId_; + }; +} // namespace io_v1 +using GEMDigiSimLink = io_v1::GEMDigiSimLink; #endif diff --git a/SimDataFormats/GEMDigiSimLink/interface/ME0DigiSimLink.h b/SimDataFormats/GEMDigiSimLink/interface/ME0DigiSimLink.h index e8e4919cf5739..5b92097978f90 100644 --- a/SimDataFormats/GEMDigiSimLink/interface/ME0DigiSimLink.h +++ b/SimDataFormats/GEMDigiSimLink/interface/ME0DigiSimLink.h @@ -3,6 +3,9 @@ #include "SimDataFormats/GEMDigiSimLink/interface/GEMDigiSimLink.h" -typedef GEMDigiSimLink ME0DigiSimLink; +namespace io_v1 { + using ME0DigiSimLink = GEMDigiSimLink; +} // namespace io_v1 +using ME0DigiSimLink = io_v1::ME0DigiSimLink; #endif diff --git a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml index d792d5861f028..8e630e2f62d69 100644 --- a/SimDataFormats/GEMDigiSimLink/src/classes_def.xml +++ b/SimDataFormats/GEMDigiSimLink/src/classes_def.xml @@ -1,26 +1,24 @@ - - - + + - - - - - - - + + + + + + + - - - + + - - - - - - - + + + + + + + diff --git a/SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h b/SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h index 680af315176b1..0a6554fb1456a 100644 --- a/SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h @@ -14,90 +14,98 @@ namespace HepMC { * */ -class GenEventInfoProduct { -public: - GenEventInfoProduct(); - GenEventInfoProduct(const HepMC::GenEvent *evt); - GenEventInfoProduct(const GenEventInfoProduct &other); - GenEventInfoProduct(GenEventInfoProduct &&other); - virtual ~GenEventInfoProduct(); +namespace io_v1 { - GenEventInfoProduct &operator=(const GenEventInfoProduct &other); - GenEventInfoProduct &operator=(GenEventInfoProduct &&other); + class GenEventInfoProduct { + public: + GenEventInfoProduct(); + GenEventInfoProduct(const HepMC::GenEvent *evt); + GenEventInfoProduct(const GenEventInfoProduct &other); + GenEventInfoProduct(GenEventInfoProduct &&other); + virtual ~GenEventInfoProduct(); - typedef gen::PdfInfo PDF; + GenEventInfoProduct &operator=(const GenEventInfoProduct &other); + GenEventInfoProduct &operator=(GenEventInfoProduct &&other); - // getters + typedef gen::PdfInfo PDF; - std::vector &weights() { return weights_; } - const std::vector &weights() const { return weights_; } + // getters - double weight() const { return weights_.empty() ? 1.0 : weights_[0]; } + std::vector &weights() { return weights_; } + const std::vector &weights() const { return weights_; } - double weightProduct() const; + double weight() const { return weights_.empty() ? 1.0 : weights_[0]; } - unsigned int signalProcessID() const { return signalProcessID_; } + double weightProduct() const; - double qScale() const { return qScale_; } - double alphaQCD() const { return alphaQCD_; } - double alphaQED() const { return alphaQED_; } + unsigned int signalProcessID() const { return signalProcessID_; } - const PDF *pdf() const { return pdf_.get(); } - bool hasPDF() const { return pdf() != nullptr; } + double qScale() const { return qScale_; } + double alphaQCD() const { return alphaQCD_; } + double alphaQED() const { return alphaQED_; } - const std::vector &binningValues() const { return binningValues_; } - bool hasBinningValues() const { return !binningValues_.empty(); } + const PDF *pdf() const { return pdf_.get(); } + bool hasPDF() const { return pdf() != nullptr; } - const std::vector &DJRValues() const { return DJRValues_; } - bool hasDJRValues() const { return !DJRValues_.empty(); } + const std::vector &binningValues() const { return binningValues_; } + bool hasBinningValues() const { return !binningValues_.empty(); } - int nMEPartons() const { return nMEPartons_; } + const std::vector &DJRValues() const { return DJRValues_; } + bool hasDJRValues() const { return !DJRValues_.empty(); } - int nMEPartonsFiltered() const { return nMEPartonsFiltered_; } + int nMEPartons() const { return nMEPartons_; } - // setters + int nMEPartonsFiltered() const { return nMEPartonsFiltered_; } - void setWeights(const std::vector &weights) { weights_ = weights; } + // setters - void setSignalProcessID(unsigned int procID) { signalProcessID_ = procID; } + void setWeights(const std::vector &weights) { weights_ = weights; } - void setScales(double q = -1., double qcd = -1., double qed = -1.) { qScale_ = q, alphaQCD_ = qcd, alphaQED_ = qed; } + void setSignalProcessID(unsigned int procID) { signalProcessID_ = procID; } - void setPDF(const PDF *pdf) { pdf_.reset(pdf ? new PDF(*pdf) : nullptr); } + void setScales(double q = -1., double qcd = -1., double qed = -1.) { + qScale_ = q, alphaQCD_ = qcd, alphaQED_ = qed; + } - void setBinningValues(const std::vector &values) { binningValues_ = values; } + void setPDF(const PDF *pdf) { pdf_.reset(pdf ? new PDF(*pdf) : nullptr); } - void setDJR(const std::vector &values) { DJRValues_ = values; } + void setBinningValues(const std::vector &values) { binningValues_ = values; } - void setNMEPartons(int n) { nMEPartons_ = n; } + void setDJR(const std::vector &values) { DJRValues_ = values; } - void setNMEPartonsFiltered(int n) { nMEPartonsFiltered_ = n; } + void setNMEPartons(int n) { nMEPartons_ = n; } -private: - // HepMC::GenEvent provides a list of weights - std::vector weights_; + void setNMEPartonsFiltered(int n) { nMEPartonsFiltered_ = n; } - // generator-dependent process ID - unsigned int signalProcessID_; + private: + // HepMC::GenEvent provides a list of weights + std::vector weights_; - // information about scales - double qScale_; - double alphaQCD_, alphaQED_; + // generator-dependent process ID + unsigned int signalProcessID_; - // optional PDF info - std::unique_ptr pdf_; + // information about scales + double qScale_; + double alphaQCD_, alphaQED_; - // If event was produced in bis, this contains - // the values that were used to define which - // bin the event belongs in - // This replaces the genEventScale, which only - // corresponds to Pythia pthat. The RunInfo - // will contain the information what physical - // quantity these values actually belong to - std::vector binningValues_; - std::vector DJRValues_; - int nMEPartons_; - int nMEPartonsFiltered_; -}; + // optional PDF info + std::unique_ptr pdf_; + + // If event was produced in bis, this contains + // the values that were used to define which + // bin the event belongs in + // This replaces the genEventScale, which only + // corresponds to Pythia pthat. The RunInfo + // will contain the information what physical + // quantity these values actually belong to + std::vector binningValues_; + std::vector DJRValues_; + int nMEPartons_; + int nMEPartonsFiltered_; + }; + +} // namespace io_v1 + +using GenEventInfoProduct = io_v1::GenEventInfoProduct; #endif // SimDataFormats_GeneratorProducts_GenEventInfoProduct_h diff --git a/SimDataFormats/GeneratorProducts/interface/GenFilterInfo.h b/SimDataFormats/GeneratorProducts/interface/GenFilterInfo.h index 660a4b51824d4..8f9210d384a90 100644 --- a/SimDataFormats/GeneratorProducts/interface/GenFilterInfo.h +++ b/SimDataFormats/GeneratorProducts/interface/GenFilterInfo.h @@ -8,50 +8,56 @@ #include #include -class GenFilterInfo { -public: - // constructors, destructors - GenFilterInfo(); - GenFilterInfo(unsigned int, unsigned int); // obsolete, should be avoided for new classes - GenFilterInfo(unsigned int, unsigned int, unsigned int, unsigned int, double, double, double, double); - virtual ~GenFilterInfo(); - - // getters - unsigned int numEventsTried() const { return (numTotalPositiveEvents_ + numTotalNegativeEvents_); } - unsigned int numEventsPassed() const { return fmax(0, (numPassPositiveEvents_ - numPassNegativeEvents_)); } - unsigned int numEventsTotal() const { return fmax(0, (numTotalPositiveEvents_ - numTotalNegativeEvents_)); } - - unsigned int numPassPositiveEvents() const { return numPassPositiveEvents_; } - unsigned int numTotalPositiveEvents() const { return numTotalPositiveEvents_; } - - unsigned int numPassNegativeEvents() const { return numPassNegativeEvents_; } - unsigned int numTotalNegativeEvents() const { return numTotalNegativeEvents_; } - - double sumPassWeights() const { return sumPassWeights_; } - double sumPassWeights2() const { return sumPassWeights2_; } - - double sumFailWeights() const { return sumTotalWeights_ - sumPassWeights_; } - double sumFailWeights2() const { return sumTotalWeights2_ - sumPassWeights2_; } - - double sumWeights() const { return sumTotalWeights_; } - double sumWeights2() const { return sumTotalWeights2_; } - - double filterEfficiency(int idwtup = +3) const; - double filterEfficiencyError(int idwtup = +3) const; - // merge method. It will be used when merging different jobs populating the same lumi section - bool mergeProduct(GenFilterInfo const& other); - void swap(GenFilterInfo& other); - -private: - unsigned int numPassPositiveEvents_; - unsigned int numPassNegativeEvents_; - unsigned int numTotalPositiveEvents_; - unsigned int numTotalNegativeEvents_; - - double sumPassWeights_; - double sumPassWeights2_; - double sumTotalWeights_; - double sumTotalWeights2_; -}; +namespace io_v1 { + + class GenFilterInfo { + public: + // constructors, destructors + GenFilterInfo(); + GenFilterInfo(unsigned int, unsigned int); // obsolete, should be avoided for new classes + GenFilterInfo(unsigned int, unsigned int, unsigned int, unsigned int, double, double, double, double); + virtual ~GenFilterInfo(); + + // getters + unsigned int numEventsTried() const { return (numTotalPositiveEvents_ + numTotalNegativeEvents_); } + unsigned int numEventsPassed() const { return fmax(0, (numPassPositiveEvents_ - numPassNegativeEvents_)); } + unsigned int numEventsTotal() const { return fmax(0, (numTotalPositiveEvents_ - numTotalNegativeEvents_)); } + + unsigned int numPassPositiveEvents() const { return numPassPositiveEvents_; } + unsigned int numTotalPositiveEvents() const { return numTotalPositiveEvents_; } + + unsigned int numPassNegativeEvents() const { return numPassNegativeEvents_; } + unsigned int numTotalNegativeEvents() const { return numTotalNegativeEvents_; } + + double sumPassWeights() const { return sumPassWeights_; } + double sumPassWeights2() const { return sumPassWeights2_; } + + double sumFailWeights() const { return sumTotalWeights_ - sumPassWeights_; } + double sumFailWeights2() const { return sumTotalWeights2_ - sumPassWeights2_; } + + double sumWeights() const { return sumTotalWeights_; } + double sumWeights2() const { return sumTotalWeights2_; } + + double filterEfficiency(int idwtup = +3) const; + double filterEfficiencyError(int idwtup = +3) const; + // merge method. It will be used when merging different jobs populating the same lumi section + bool mergeProduct(GenFilterInfo const& other); + void swap(GenFilterInfo& other); + + private: + unsigned int numPassPositiveEvents_; + unsigned int numPassNegativeEvents_; + unsigned int numTotalPositiveEvents_; + unsigned int numTotalNegativeEvents_; + + double sumPassWeights_; + double sumPassWeights2_; + double sumTotalWeights_; + double sumTotalWeights2_; + }; + +} // namespace io_v1 + +using GenFilterInfo = io_v1::GenFilterInfo; #endif // SimDataFormats_GeneratorProducts_GenFilterInfo_h diff --git a/SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h b/SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h index 8a997bfd368ce..aacb7315f5c19 100644 --- a/SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h +++ b/SimDataFormats/GeneratorProducts/interface/GenLumiInfoHeader.h @@ -9,27 +9,33 @@ * */ -class GenLumiInfoHeader { -public: - GenLumiInfoHeader() : randomConfigIndex_(-1) {} +namespace io_v1 { - int randomConfigIndex() const { return randomConfigIndex_; } - void setRandomConfigIndex(int idx) { randomConfigIndex_ = idx; } + class GenLumiInfoHeader { + public: + GenLumiInfoHeader() : randomConfigIndex_(-1) {} - const std::string &configDescription() const { return configDescription_; } - void setConfigDescription(const std::string &str) { configDescription_ = str; } + int randomConfigIndex() const { return randomConfigIndex_; } + void setRandomConfigIndex(int idx) { randomConfigIndex_ = idx; } - const std::vector > &lheHeaders() const { return lheHeaders_; } - std::vector > &lheHeaders() { return lheHeaders_; } + const std::string &configDescription() const { return configDescription_; } + void setConfigDescription(const std::string &str) { configDescription_ = str; } - const std::vector &weightNames() const { return weightNames_; } - std::vector &weightNames() { return weightNames_; } + const std::vector > &lheHeaders() const { return lheHeaders_; } + std::vector > &lheHeaders() { return lheHeaders_; } -private: - int randomConfigIndex_; - std::string configDescription_; - std::vector > lheHeaders_; //header name, header content - std::vector weightNames_; -}; + const std::vector &weightNames() const { return weightNames_; } + std::vector &weightNames() { return weightNames_; } + + private: + int randomConfigIndex_; + std::string configDescription_; + std::vector > lheHeaders_; //header name, header content + std::vector weightNames_; + }; + +} // namespace io_v1 + +using GenLumiInfoHeader = io_v1::GenLumiInfoHeader; #endif // SimDataFormats_GeneratorProducts_GenLumiInfoHeader_h diff --git a/SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h b/SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h index f5ea7343a1e9c..129ad8ca41663 100644 --- a/SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/GenLumiInfoProduct.h @@ -8,161 +8,167 @@ * */ -class GenLumiInfoProduct { -public: - // a few forward declarations - struct XSec; - struct ProcessInfo; +namespace io_v1 { - // constructors, destructors - GenLumiInfoProduct(); - GenLumiInfoProduct(const int id); - virtual ~GenLumiInfoProduct(); - - // getters - - const int getHEPIDWTUP() const { return hepidwtup_; } - const std::vector &getProcessInfos() const { return internalProcesses_; } - - // setters - - void setHEPIDWTUP(const int id) { hepidwtup_ = id; } - void setProcessInfo(const std::vector &processes) { internalProcesses_ = processes; } - - // Struct- definitions - struct XSec { + class GenLumiInfoProduct { public: - XSec() : value_(-1.), error_(-1.) {} - XSec(double v, double e = -1.) : value_(v), error_(e) {} + // a few forward declarations + struct XSec; + struct ProcessInfo; - double value() const { return value_; } - double error() const { return error_; } + // constructors, destructors + GenLumiInfoProduct(); + GenLumiInfoProduct(const int id); + virtual ~GenLumiInfoProduct(); - bool isSet() const { return value_ >= 0.; } - bool hasError() const { return error_ >= 0.; } + // getters - operator double() const { return value_; } - operator bool() const { return isSet(); } + const int getHEPIDWTUP() const { return hepidwtup_; } + const std::vector &getProcessInfos() const { return internalProcesses_; } - bool operator==(const XSec &other) const { return value_ == other.value_ && error_ == other.error_; } - bool operator!=(const XSec &other) const { return !(*this == other); } + // setters - private: - double value_, error_; - }; + void setHEPIDWTUP(const int id) { hepidwtup_ = id; } + void setProcessInfo(const std::vector &processes) { internalProcesses_ = processes; } - struct FinalStat { - public: - FinalStat() : n_(0), sum_(0.0), sum2_(0.0) {} - FinalStat(unsigned int n1, double sum1, double sum21) : n_(n1), sum_(sum1), sum2_(sum21) {} - - unsigned int n() const { return n_; } - double sum() const { return sum_; } - double sum2() const { return sum2_; } - - void add(const FinalStat &other) { - //Hadronizers treat 0, -1., -1. to mean the value is not present - if (other.n() != 0 and other.sum_ != -1. and other.sum2() != -1.) { - n_ += other.n(); - sum_ += other.sum(); - sum2_ += other.sum2(); - } - } + // Struct- definitions + struct XSec { + public: + XSec() : value_(-1.), error_(-1.) {} + XSec(double v, double e = -1.) : value_(v), error_(e) {} - bool operator==(const FinalStat &other) const { - return n_ == other.n_ && sum_ == other.sum_ && sum2_ == other.sum2_; - } - bool operator!=(const FinalStat &other) const { return !(*this == other); } + double value() const { return value_; } + double error() const { return error_; } - private: - unsigned int n_; - double sum_; - double sum2_; - }; + bool isSet() const { return value_ >= 0.; } + bool hasError() const { return error_ >= 0.; } - struct ProcessInfo { - public: - ProcessInfo() : process_(-1), nPassPos_(0), nPassNeg_(0), nTotalPos_(0), nTotalNeg_(0) {} - ProcessInfo(int id) : process_(id), nPassPos_(0), nPassNeg_(0), nTotalPos_(0), nTotalNeg_(0) {} + operator double() const { return value_; } + operator bool() const { return isSet(); } - // accessors - int process() const { return process_; } - XSec const &lheXSec() const { return lheXSec_; } + bool operator==(const XSec &other) const { return value_ == other.value_ && error_ == other.error_; } + bool operator!=(const XSec &other) const { return !(*this == other); } - unsigned int nPassPos() const { return nPassPos_; } - unsigned int nPassNeg() const { return nPassNeg_; } - unsigned int nTotalPos() const { return nTotalPos_; } - unsigned int nTotalNeg() const { return nTotalNeg_; } + private: + double value_, error_; + }; - FinalStat const &tried() const { return tried_; } - FinalStat const &selected() const { return selected_; } - FinalStat const &killed() const { return killed_; } - FinalStat const &accepted() const { return accepted_; } - FinalStat const &acceptedBr() const { return acceptedBr_; } + struct FinalStat { + public: + FinalStat() : n_(0), sum_(0.0), sum2_(0.0) {} + FinalStat(unsigned int n1, double sum1, double sum21) : n_(n1), sum_(sum1), sum2_(sum21) {} - // setters - void addOthers(const ProcessInfo &other) { - mergeXSec(other.lheXSec(), other.selected().sum()); - nPassPos_ += other.nPassPos(); - nPassNeg_ += other.nPassNeg(); - nTotalPos_ += other.nTotalPos(); - nTotalNeg_ += other.nTotalNeg(); - tried_.add(other.tried()); - selected_.add(other.selected()); - killed_.add(other.killed()); - accepted_.add(other.accepted()); - acceptedBr_.add(other.acceptedBr()); - } - void setProcess(int id) { process_ = id; } - void setLheXSec(double value, double err) { lheXSec_ = XSec(value, err); } - void setNPassPos(unsigned int n) { nPassPos_ = n; } - void setNPassNeg(unsigned int n) { nPassNeg_ = n; } - void setNTotalPos(unsigned int n) { nTotalPos_ = n; } - void setNTotalNeg(unsigned int n) { nTotalNeg_ = n; } - void setTried(unsigned int n, double sum, double sum2) { tried_ = FinalStat(n, sum, sum2); } - void setSelected(unsigned int n, double sum, double sum2) { selected_ = FinalStat(n, sum, sum2); } - void setKilled(unsigned int n, double sum, double sum2) { killed_ = FinalStat(n, sum, sum2); } - void setAccepted(unsigned int n, double sum, double sum2) { accepted_ = FinalStat(n, sum, sum2); } - void setAcceptedBr(unsigned int n, double sum, double sum2) { acceptedBr_ = FinalStat(n, sum, sum2); } + unsigned int n() const { return n_; } + double sum() const { return sum_; } + double sum2() const { return sum2_; } - private: - void mergeXSec(XSec const &iXSec, double iWeight) { - if (iWeight <= 0.) { - return; + void add(const FinalStat &other) { + //Hadronizers treat 0, -1., -1. to mean the value is not present + if (other.n() != 0 and other.sum_ != -1. and other.sum2() != -1.) { + n_ += other.n(); + sum_ += other.sum(); + sum2_ += other.sum2(); + } } - if (lheXSec_.value() <= 0.) { - lheXSec_ = iXSec; - } else { - bool useWeights = (lheXSec_.error() <= 0. || iXSec.error() <= 0.); - double wgt1 = useWeights ? selected().sum() : 1. / (lheXSec_.error() * lheXSec_.error()); - double wgt2 = useWeights ? iWeight : 1. / (iXSec.error() * iXSec.error()); - double xsec = (wgt1 * lheXSec_.value() + wgt2 * iXSec.value()) / (wgt1 + wgt2); - double err = useWeights ? 0. : 1.0 / std::sqrt(wgt1 + wgt2); - lheXSec_ = XSec(xsec, err); + + bool operator==(const FinalStat &other) const { + return n_ == other.n_ && sum_ == other.sum_ && sum2_ == other.sum2_; + } + bool operator!=(const FinalStat &other) const { return !(*this == other); } + + private: + unsigned int n_; + double sum_; + double sum2_; + }; + + struct ProcessInfo { + public: + ProcessInfo() : process_(-1), nPassPos_(0), nPassNeg_(0), nTotalPos_(0), nTotalNeg_(0) {} + ProcessInfo(int id) : process_(id), nPassPos_(0), nPassNeg_(0), nTotalPos_(0), nTotalNeg_(0) {} + + // accessors + int process() const { return process_; } + XSec const &lheXSec() const { return lheXSec_; } + + unsigned int nPassPos() const { return nPassPos_; } + unsigned int nPassNeg() const { return nPassNeg_; } + unsigned int nTotalPos() const { return nTotalPos_; } + unsigned int nTotalNeg() const { return nTotalNeg_; } + + FinalStat const &tried() const { return tried_; } + FinalStat const &selected() const { return selected_; } + FinalStat const &killed() const { return killed_; } + FinalStat const &accepted() const { return accepted_; } + FinalStat const &acceptedBr() const { return acceptedBr_; } + + // setters + void addOthers(const ProcessInfo &other) { + mergeXSec(other.lheXSec(), other.selected().sum()); + nPassPos_ += other.nPassPos(); + nPassNeg_ += other.nPassNeg(); + nTotalPos_ += other.nTotalPos(); + nTotalNeg_ += other.nTotalNeg(); + tried_.add(other.tried()); + selected_.add(other.selected()); + killed_.add(other.killed()); + accepted_.add(other.accepted()); + acceptedBr_.add(other.acceptedBr()); + } + void setProcess(int id) { process_ = id; } + void setLheXSec(double value, double err) { lheXSec_ = XSec(value, err); } + void setNPassPos(unsigned int n) { nPassPos_ = n; } + void setNPassNeg(unsigned int n) { nPassNeg_ = n; } + void setNTotalPos(unsigned int n) { nTotalPos_ = n; } + void setNTotalNeg(unsigned int n) { nTotalNeg_ = n; } + void setTried(unsigned int n, double sum, double sum2) { tried_ = FinalStat(n, sum, sum2); } + void setSelected(unsigned int n, double sum, double sum2) { selected_ = FinalStat(n, sum, sum2); } + void setKilled(unsigned int n, double sum, double sum2) { killed_ = FinalStat(n, sum, sum2); } + void setAccepted(unsigned int n, double sum, double sum2) { accepted_ = FinalStat(n, sum, sum2); } + void setAcceptedBr(unsigned int n, double sum, double sum2) { acceptedBr_ = FinalStat(n, sum, sum2); } + + private: + void mergeXSec(XSec const &iXSec, double iWeight) { + if (iWeight <= 0.) { + return; + } + if (lheXSec_.value() <= 0.) { + lheXSec_ = iXSec; + } else { + bool useWeights = (lheXSec_.error() <= 0. || iXSec.error() <= 0.); + double wgt1 = useWeights ? selected().sum() : 1. / (lheXSec_.error() * lheXSec_.error()); + double wgt2 = useWeights ? iWeight : 1. / (iXSec.error() * iXSec.error()); + double xsec = (wgt1 * lheXSec_.value() + wgt2 * iXSec.value()) / (wgt1 + wgt2); + double err = useWeights ? 0. : 1.0 / std::sqrt(wgt1 + wgt2); + lheXSec_ = XSec(xsec, err); + } } - } - int process_; - XSec lheXSec_; - unsigned int nPassPos_; - unsigned int nPassNeg_; - unsigned int nTotalPos_; - unsigned int nTotalNeg_; - FinalStat tried_; - FinalStat selected_; - FinalStat killed_; - FinalStat accepted_; - FinalStat acceptedBr_; + int process_; + XSec lheXSec_; + unsigned int nPassPos_; + unsigned int nPassNeg_; + unsigned int nTotalPos_; + unsigned int nTotalNeg_; + FinalStat tried_; + FinalStat selected_; + FinalStat killed_; + FinalStat accepted_; + FinalStat acceptedBr_; + }; + + // methods used by EDM + virtual bool mergeProduct(const GenLumiInfoProduct &other); + void swap(GenLumiInfoProduct &other); + virtual bool isProductEqual(const GenLumiInfoProduct &other) const; + + private: + // cross sections + int hepidwtup_; + std::vector internalProcesses_; }; - // methods used by EDM - virtual bool mergeProduct(const GenLumiInfoProduct &other); - void swap(GenLumiInfoProduct &other); - virtual bool isProductEqual(const GenLumiInfoProduct &other) const; +} // namespace io_v1 -private: - // cross sections - int hepidwtup_; - std::vector internalProcesses_; -}; +using GenLumiInfoProduct = io_v1::GenLumiInfoProduct; #endif // SimDataFormats_GeneratorProducts_GenLumiInfoProduct_h diff --git a/SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h b/SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h index 9bb7eeb2e4632..95383849b5650 100644 --- a/SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/GenRunInfoProduct.h @@ -5,61 +5,67 @@ * */ -class GenRunInfoProduct { -public: - // a few forward declarations - struct XSec; +namespace io_v1 { - // constructors, destructors - GenRunInfoProduct(); + class GenRunInfoProduct { + public: + // a few forward declarations + struct XSec; - // getters + // constructors, destructors + GenRunInfoProduct(); - const XSec &internalXSec() const { return internalXSec_; } - const XSec &externalXSecLO() const { return externalXSecLO_; } - const XSec &externalXSecNLO() const { return externalXSecNLO_; } - double filterEfficiency() const { return externalFilterEfficiency_; } + // getters - // setters + const XSec &internalXSec() const { return internalXSec_; } + const XSec &externalXSecLO() const { return externalXSecLO_; } + const XSec &externalXSecNLO() const { return externalXSecNLO_; } + double filterEfficiency() const { return externalFilterEfficiency_; } - void setInternalXSec(const XSec &xsec) { internalXSec_ = xsec; } - void setExternalXSecLO(const XSec &xsec) { externalXSecLO_ = xsec; } - void setExternalXSecNLO(const XSec &xsec) { externalXSecNLO_ = xsec; } - void setFilterEfficiency(double effic) { externalFilterEfficiency_ = effic; } + // setters - // struct definitions - struct XSec { - public: - XSec() : value_(-1.), error_(-1.) {} - XSec(double value, double error = -1.) : value_(value), error_(error) {} + void setInternalXSec(const XSec &xsec) { internalXSec_ = xsec; } + void setExternalXSecLO(const XSec &xsec) { externalXSecLO_ = xsec; } + void setExternalXSecNLO(const XSec &xsec) { externalXSecNLO_ = xsec; } + void setFilterEfficiency(double effic) { externalFilterEfficiency_ = effic; } + + // struct definitions + struct XSec { + public: + XSec() : value_(-1.), error_(-1.) {} + XSec(double value, double error = -1.) : value_(value), error_(error) {} + + double value() const { return value_; } + double error() const { return error_; } - double value() const { return value_; } - double error() const { return error_; } + bool isSet() const { return value_ >= 0.; } + bool hasError() const { return error_ >= 0.; } - bool isSet() const { return value_ >= 0.; } - bool hasError() const { return error_ >= 0.; } + operator double() const { return value_; } + operator bool() const { return isSet(); } - operator double() const { return value_; } - operator bool() const { return isSet(); } + bool operator==(const XSec &other) const { return value_ == other.value_ && error_ == other.error_; } + bool operator!=(const XSec &other) const { return !(*this == other); } - bool operator==(const XSec &other) const { return value_ == other.value_ && error_ == other.error_; } - bool operator!=(const XSec &other) const { return !(*this == other); } + private: + double value_, error_; + }; + + // convenience (return the value, prefer externally specified over internal one) + double crossSection() const { return externalXSecLO_ ? externalXSecLO_.value() : internalXSec_.value(); } + + // methods used by EDM + bool isProductEqual(const GenRunInfoProduct &other) const; private: - double value_, error_; + // cross sections + XSec internalXSec_; // the one computed during cmsRun + XSec externalXSecLO_, externalXSecNLO_; // from config file + double externalFilterEfficiency_; // from config file }; - // convenience (return the value, prefer externally specified over internal one) - double crossSection() const { return externalXSecLO_ ? externalXSecLO_.value() : internalXSec_.value(); } - - // methods used by EDM - bool isProductEqual(const GenRunInfoProduct &other) const; +} // namespace io_v1 -private: - // cross sections - XSec internalXSec_; // the one computed during cmsRun - XSec externalXSecLO_, externalXSecNLO_; // from config file - double externalFilterEfficiency_; // from config file -}; +using GenRunInfoProduct = io_v1::GenRunInfoProduct; #endif // SimDataFormats_GeneratorProducts_GenRunInfoProduct_h diff --git a/SimDataFormats/GeneratorProducts/interface/HepMCProduct.h b/SimDataFormats/GeneratorProducts/interface/HepMCProduct.h index e77afc2d45d1b..77f344b85d455 100644 --- a/SimDataFormats/GeneratorProducts/interface/HepMCProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/HepMCProduct.h @@ -18,41 +18,44 @@ namespace HepMC { } // namespace HepMC namespace edm { - class HepMCProduct { - public: - HepMCProduct() : evt_(nullptr), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {} + namespace io_v1 { + class HepMCProduct { + public: + HepMCProduct() : evt_(nullptr), isVtxGenApplied_(false), isVtxBoostApplied_(false), isPBoostApplied_(false) {} - explicit HepMCProduct(HepMC::GenEvent *evt); - virtual ~HepMCProduct(); + explicit HepMCProduct(HepMC::GenEvent *evt); + virtual ~HepMCProduct(); - void addHepMCData(HepMC::GenEvent *evt); + void addHepMCData(HepMC::GenEvent *evt); - void applyVtxGen(HepMC::FourVector const *vtxShift) { applyVtxGen(*vtxShift); } - void applyVtxGen(HepMC::FourVector const &vtxShift); + void applyVtxGen(HepMC::FourVector const *vtxShift) { applyVtxGen(*vtxShift); } + void applyVtxGen(HepMC::FourVector const &vtxShift); - void boostToLab(TMatrixD const *lorentz, std::string const &type); + void boostToLab(TMatrixD const *lorentz, std::string const &type); - const HepMC::GenEvent &getHepMCData() const; + const HepMC::GenEvent &getHepMCData() const; - const HepMC::GenEvent *GetEvent() const { return evt_; } + const HepMC::GenEvent *GetEvent() const { return evt_; } - bool isVtxGenApplied() const { return isVtxGenApplied_; } - bool isVtxBoostApplied() const { return isVtxBoostApplied_; } - bool isPBoostApplied() const { return isPBoostApplied_; } + bool isVtxGenApplied() const { return isVtxGenApplied_; } + bool isVtxBoostApplied() const { return isVtxBoostApplied_; } + bool isPBoostApplied() const { return isPBoostApplied_; } - HepMCProduct(HepMCProduct const &orig); - HepMCProduct &operator=(HepMCProduct const &other); - HepMCProduct(HepMCProduct &&orig); - HepMCProduct &operator=(HepMCProduct &&other); - void swap(HepMCProduct &other); + HepMCProduct(HepMCProduct const &orig); + HepMCProduct &operator=(HepMCProduct const &other); + HepMCProduct(HepMCProduct &&orig); + HepMCProduct &operator=(HepMCProduct &&other); + void swap(HepMCProduct &other); - private: - HepMC::GenEvent *evt_; + private: + HepMC::GenEvent *evt_; - bool isVtxGenApplied_; - bool isVtxBoostApplied_; - bool isPBoostApplied_; - }; + bool isVtxGenApplied_; + bool isVtxBoostApplied_; + bool isPBoostApplied_; + }; + } // namespace io_v1 + using HepMCProduct = io_v1::HepMCProduct; // This allows edm::Refs to work with HepMCProduct namespace refhelper { diff --git a/SimDataFormats/GeneratorProducts/interface/HepMCProductFwd.h b/SimDataFormats/GeneratorProducts/interface/HepMCProductFwd.h index d8ed0a246f1ce..f5232d8b828a7 100644 --- a/SimDataFormats/GeneratorProducts/interface/HepMCProductFwd.h +++ b/SimDataFormats/GeneratorProducts/interface/HepMCProductFwd.h @@ -2,7 +2,10 @@ #define SimDataFormats_GeneratorProducts_HepMCProductFwd_h namespace edm { - class HepMCProduct; -} + namespace io_v1 { + class HepMCProduct; + } + using HepMCProduct = io_v1::HepMCProduct; +} // namespace edm #endif diff --git a/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h b/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h index ebffbd2de47c6..b09d3a6f4daf8 100644 --- a/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h @@ -9,108 +9,114 @@ #include "SimDataFormats/GeneratorProducts/interface/PdfInfo.h" #include "SimDataFormats/GeneratorProducts/interface/WeightsInfo.h" -class LHEEventProduct { -public: - typedef gen::PdfInfo PDF; - typedef gen::WeightsInfo WGT; +namespace io_v1 { - typedef std::vector::const_iterator comments_const_iterator; - typedef std::vector::size_type size_type; + class LHEEventProduct { + public: + typedef gen::PdfInfo PDF; + typedef gen::WeightsInfo WGT; - LHEEventProduct() {} - LHEEventProduct(const lhef::HEPEUP &hepeup) : hepeup_(hepeup), originalXWGTUP_(0) {} - LHEEventProduct(const lhef::HEPEUP &hepeup, const double originalXWGTUP) - : hepeup_(hepeup), originalXWGTUP_(originalXWGTUP) {} - LHEEventProduct(LHEEventProduct &&other) = default; + typedef std::vector::const_iterator comments_const_iterator; + typedef std::vector::size_type size_type; - LHEEventProduct &operator=(LHEEventProduct &&other) = default; + LHEEventProduct() {} + LHEEventProduct(const lhef::HEPEUP &hepeup) : hepeup_(hepeup), originalXWGTUP_(0) {} + LHEEventProduct(const lhef::HEPEUP &hepeup, const double originalXWGTUP) + : hepeup_(hepeup), originalXWGTUP_(originalXWGTUP) {} + LHEEventProduct(LHEEventProduct &&other) = default; - ~LHEEventProduct() = default; + LHEEventProduct &operator=(LHEEventProduct &&other) = default; - void setPDF(const PDF &pdf) { pdf_ = std::make_unique(pdf); } - void addWeight(const WGT &wgt) { weights_.push_back(wgt); } - void addComment(const std::string &line) { comments_.push_back(line); } + ~LHEEventProduct() = default; - double originalXWGTUP() const { return originalXWGTUP_; } - const std::vector &weights() const { return weights_; } + void setPDF(const PDF &pdf) { pdf_ = std::make_unique(pdf); } + void addWeight(const WGT &wgt) { weights_.push_back(wgt); } + void addComment(const std::string &line) { comments_.push_back(line); } - const std::vector &scales() const { return scales_; } - void setScales(const std::vector &scales) { scales_ = scales; } + double originalXWGTUP() const { return originalXWGTUP_; } + const std::vector &weights() const { return weights_; } - int npLO() const { return npLO_; } - int npNLO() const { return npNLO_; } - int evtnum() const { return evtnum_; } + const std::vector &scales() const { return scales_; } + void setScales(const std::vector &scales) { scales_ = scales; } - void setNpLO(int n) { npLO_ = n; } - void setNpNLO(int n) { npNLO_ = n; } - void setEvtNum(int n) { evtnum_ = n; } + int npLO() const { return npLO_; } + int npNLO() const { return npNLO_; } + int evtnum() const { return evtnum_; } - const lhef::HEPEUP &hepeup() const { return hepeup_; } - const PDF *pdf() const { return pdf_.get(); } + void setNpLO(int n) { npLO_ = n; } + void setNpNLO(int n) { npNLO_ = n; } + void setEvtNum(int n) { evtnum_ = n; } - size_type comments_size() const { return comments_.size(); } - comments_const_iterator comments_begin() const { return comments_.begin(); } - comments_const_iterator comments_end() const { return comments_.end(); } + const lhef::HEPEUP &hepeup() const { return hepeup_; } + const PDF *pdf() const { return pdf_.get(); } - const char *getComment(unsigned i) const { - if (comments_.empty() || i >= comments_.size()) - return ""; - else - return (const char *)comments_[i].c_str(); - } + size_type comments_size() const { return comments_.size(); } + comments_const_iterator comments_begin() const { return comments_.begin(); } + comments_const_iterator comments_end() const { return comments_.end(); } - class const_iterator { - public: - typedef std::forward_iterator_tag iterator_category; - typedef std::string value_type; - typedef std::ptrdiff_t difference_type; - typedef std::string *pointer; - typedef std::string &reference; + const char *getComment(unsigned i) const { + if (comments_.empty() || i >= comments_.size()) + return ""; + else + return (const char *)comments_[i].c_str(); + } - const_iterator() : line(npos) {} - ~const_iterator() {} + class const_iterator { + public: + typedef std::forward_iterator_tag iterator_category; + typedef std::string value_type; + typedef std::ptrdiff_t difference_type; + typedef std::string *pointer; + typedef std::string &reference; - inline bool operator==(const const_iterator &other) const { return line == other.line; } - inline bool operator!=(const const_iterator &other) const { return !operator==(other); } + const_iterator() : line(npos) {} + ~const_iterator() {} - inline const_iterator &operator++() { - next(); - return *this; - } - inline const_iterator operator++(int dummy) { - const_iterator orig = *this; - next(); - return orig; - } + inline bool operator==(const const_iterator &other) const { return line == other.line; } + inline bool operator!=(const const_iterator &other) const { return !operator==(other); } - const std::string &operator*() const { return tmp; } - const std::string *operator->() const { return &tmp; } + inline const_iterator &operator++() { + next(); + return *this; + } + inline const_iterator operator++(int dummy) { + const_iterator orig = *this; + next(); + return orig; + } - private: - friend class LHEEventProduct; + const std::string &operator*() const { return tmp; } + const std::string *operator->() const { return &tmp; } - void next(); + private: + friend class LHEEventProduct; - const LHEEventProduct *event; - unsigned int line; - std::string tmp; + void next(); - static const unsigned int npos = 99999; + const LHEEventProduct *event; + unsigned int line; + std::string tmp; + + static const unsigned int npos = 99999; + }; + + const_iterator begin() const; + inline const_iterator end() const { return const_iterator(); } + + private: + lhef::HEPEUP hepeup_; + std::vector comments_; + std::unique_ptr pdf_; + std::vector weights_; + double originalXWGTUP_; + std::vector scales_; //scale value used to exclude EWK-produced partons from matching + int npLO_; //number of partons for LO process (used to steer matching/merging) + int npNLO_; //number of partons for NLO process (used to steer matching/merging) + int evtnum_; //The number of the event (needed to ensure the correct LHE events are saved for MG +Herwig) }; - const_iterator begin() const; - inline const_iterator end() const { return const_iterator(); } - -private: - lhef::HEPEUP hepeup_; - std::vector comments_; - std::unique_ptr pdf_; - std::vector weights_; - double originalXWGTUP_; - std::vector scales_; //scale value used to exclude EWK-produced partons from matching - int npLO_; //number of partons for LO process (used to steer matching/merging) - int npNLO_; //number of partons for NLO process (used to steer matching/merging) - int evtnum_; //The number of the event (needed to ensure the correct LHE events are saved for MG +Herwig) -}; +} // namespace io_v1 + +using LHEEventProduct = io_v1::LHEEventProduct; #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h diff --git a/SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h b/SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h index 82b4a163302aa..2c098dc957baf 100644 --- a/SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h @@ -10,120 +10,126 @@ #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" -class LHERunInfoProduct { -public: - typedef std::vector > weights_defs; - class Header { +namespace io_v1 { + + class LHERunInfoProduct { public: - typedef std::vector::const_iterator const_iterator; - typedef std::vector::size_type size_type; + typedef std::vector > weights_defs; + class Header { + public: + typedef std::vector::const_iterator const_iterator; + typedef std::vector::size_type size_type; - Header() {} - Header(const std::string &tag) : tag_(tag) {} - ~Header() {} + Header() {} + Header(const std::string &tag) : tag_(tag) {} + ~Header() {} - void addLine(const std::string &line) { lines_.push_back(line); } + void addLine(const std::string &line) { lines_.push_back(line); } - const std::string &tag() const { return tag_; } - const std::vector &lines() const { return lines_; } + const std::string &tag() const { return tag_; } + const std::vector &lines() const { return lines_; } - size_type size() const { return lines_.size(); } - const_iterator begin() const { return lines_.begin(); } - const_iterator end() const { return lines_.end(); } + size_type size() const { return lines_.size(); } + const_iterator begin() const { return lines_.begin(); } + const_iterator end() const { return lines_.end(); } - bool operator==(const Header &other) const { return tag_ == other.tag_ && lines_ == other.lines_; } - inline bool operator!=(const Header &other) const { return !(*this == other); } + bool operator==(const Header &other) const { return tag_ == other.tag_ && lines_ == other.lines_; } + inline bool operator!=(const Header &other) const { return !(*this == other); } - private: - std::string tag_; - std::vector lines_; - }; + private: + std::string tag_; + std::vector lines_; + }; - typedef std::vector

::size_type size_type; - typedef std::vector
::const_iterator headers_const_iterator; - typedef std::vector::const_iterator comments_const_iterator; + typedef std::vector
::size_type size_type; + typedef std::vector
::const_iterator headers_const_iterator; + typedef std::vector::const_iterator comments_const_iterator; - LHERunInfoProduct() {} - LHERunInfoProduct(const lhef::HEPRUP &heprup) : heprup_(heprup) {} - ~LHERunInfoProduct() {} + LHERunInfoProduct() {} + LHERunInfoProduct(const lhef::HEPRUP &heprup) : heprup_(heprup) {} + ~LHERunInfoProduct() {} - bool find_if_checklist(const std::string x, std::vector checklist); + bool find_if_checklist(const std::string x, std::vector checklist); - void addHeader(const Header &header) { headers_.push_back(header); } - void addComment(const std::string &line) { comments_.push_back(line); } + void addHeader(const Header &header) { headers_.push_back(header); } + void addComment(const std::string &line) { comments_.push_back(line); } - const lhef::HEPRUP &heprup() const { return heprup_; } + const lhef::HEPRUP &heprup() const { return heprup_; } - size_type headers_size() const { return headers_.size(); } - headers_const_iterator headers_begin() const { return headers_.begin(); } - headers_const_iterator headers_end() const { return headers_.end(); } + size_type headers_size() const { return headers_.size(); } + headers_const_iterator headers_begin() const { return headers_.begin(); } + headers_const_iterator headers_end() const { return headers_.end(); } - size_type comments_size() const { return comments_.size(); } - comments_const_iterator comments_begin() const { return comments_.begin(); } - comments_const_iterator comments_end() const { return comments_.end(); } + size_type comments_size() const { return comments_.size(); } + comments_const_iterator comments_begin() const { return comments_.begin(); } + comments_const_iterator comments_end() const { return comments_.end(); } - class const_iterator { - public: - typedef std::forward_iterator_tag iterator_category; - typedef std::string value_type; - typedef std::ptrdiff_t difference_type; - typedef std::string *pointer; - typedef std::string &reference; + class const_iterator { + public: + typedef std::forward_iterator_tag iterator_category; + typedef std::string value_type; + typedef std::ptrdiff_t difference_type; + typedef std::string *pointer; + typedef std::string &reference; - const_iterator() : mode(kDone) {} - ~const_iterator() {} + const_iterator() : mode(kDone) {} + ~const_iterator() {} - bool operator==(const const_iterator &other) const; - inline bool operator!=(const const_iterator &other) const { return !operator==(other); } + bool operator==(const const_iterator &other) const; + inline bool operator!=(const const_iterator &other) const { return !operator==(other); } - inline const_iterator &operator++() { - next(); - return *this; - } - inline const_iterator operator++(int dummy) { - const_iterator orig = *this; - next(); - return orig; - } + inline const_iterator &operator++() { + next(); + return *this; + } + inline const_iterator operator++(int dummy) { + const_iterator orig = *this; + next(); + return orig; + } - const std::string &operator*() const { return tmp; } - const std::string *operator->() const { return &tmp; } + const std::string &operator*() const { return tmp; } + const std::string *operator->() const { return &tmp; } - private: - friend class LHERunInfoProduct; + private: + friend class LHERunInfoProduct; - void next(); + void next(); - enum Mode { kHeader, kBody, kInit, kDone, kFooter }; + enum Mode { kHeader, kBody, kInit, kDone, kFooter }; - const LHERunInfoProduct *runInfo; - headers_const_iterator header; - Header::const_iterator iter; - Mode mode; - unsigned int line; - std::string tmp; - }; + const LHERunInfoProduct *runInfo; + headers_const_iterator header; + Header::const_iterator iter; + Mode mode; + unsigned int line; + std::string tmp; + }; + + const_iterator begin() const; + const_iterator init() const; + inline const_iterator end() const { return const_iterator(); } + + static const std::string &endOfFile(); - const_iterator begin() const; - const_iterator init() const; - inline const_iterator end() const { return const_iterator(); } + bool operator==(const LHERunInfoProduct &other) const { + return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_; + } + inline bool operator!=(const LHERunInfoProduct &other) const { return !(*this == other); } - static const std::string &endOfFile(); + bool mergeProduct(const LHERunInfoProduct &other); + void swap(LHERunInfoProduct &other); + bool isProductEqual(const LHERunInfoProduct &other) const { return *this == other; } + static bool isTagComparedInMerge(const std::string &tag); - bool operator==(const LHERunInfoProduct &other) const { - return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_; - } - inline bool operator!=(const LHERunInfoProduct &other) const { return !(*this == other); } + private: + lhef::HEPRUP heprup_; + std::vector
headers_; + std::vector comments_; + }; - bool mergeProduct(const LHERunInfoProduct &other); - void swap(LHERunInfoProduct &other); - bool isProductEqual(const LHERunInfoProduct &other) const { return *this == other; } - static bool isTagComparedInMerge(const std::string &tag); +} // namespace io_v1 -private: - lhef::HEPRUP heprup_; - std::vector
headers_; - std::vector comments_; -}; +using LHERunInfoProduct = io_v1::LHERunInfoProduct; #endif // GeneratorRunInfo_LHEInterface_LHERunInfoProduct_h diff --git a/SimDataFormats/GeneratorProducts/interface/LHEXMLStringProduct.h b/SimDataFormats/GeneratorProducts/interface/LHEXMLStringProduct.h index e48e760085927..32d6c32359fea 100644 --- a/SimDataFormats/GeneratorProducts/interface/LHEXMLStringProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/LHEXMLStringProduct.h @@ -9,28 +9,34 @@ #include #include -class LHEXMLStringProduct { -public: - // constructors, destructors - LHEXMLStringProduct(); - LHEXMLStringProduct(const std::string& content); - virtual ~LHEXMLStringProduct(); +namespace io_v1 { - // getters - const std::vector& getStrings() const { return content_; } + class LHEXMLStringProduct { + public: + // constructors, destructors + LHEXMLStringProduct(); + LHEXMLStringProduct(const std::string& content); + virtual ~LHEXMLStringProduct(); - const std::vector >& getCompressed() const { return compressedContent_; } + // getters + const std::vector& getStrings() const { return content_; } - void fillCompressedContent(std::istream& input, unsigned int initialSize = 4 * 1024 * 1024); - void writeCompressedContent(std::ostream& output, unsigned int i) const; + const std::vector >& getCompressed() const { return compressedContent_; } - // merge method. It will be used when merging different jobs populating the same lumi section - bool mergeProduct(LHEXMLStringProduct const& other); - void swap(LHEXMLStringProduct& other); + void fillCompressedContent(std::istream& input, unsigned int initialSize = 4 * 1024 * 1024); + void writeCompressedContent(std::ostream& output, unsigned int i) const; -private: - std::vector content_; - std::vector > compressedContent_; -}; + // merge method. It will be used when merging different jobs populating the same lumi section + bool mergeProduct(LHEXMLStringProduct const& other); + void swap(LHEXMLStringProduct& other); + + private: + std::vector content_; + std::vector > compressedContent_; + }; + +} // namespace io_v1 + +using LHEXMLStringProduct = io_v1::LHEXMLStringProduct; #endif // SimDataFormats_GeneratorProducts_LHEXMLStringProduct_h diff --git a/SimDataFormats/GeneratorProducts/src/GenEventInfoProduct.cc b/SimDataFormats/GeneratorProducts/src/GenEventInfoProduct.cc index ee253a0a7b88d..d9bd3977d7952 100644 --- a/SimDataFormats/GeneratorProducts/src/GenEventInfoProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/GenEventInfoProduct.cc @@ -13,88 +13,92 @@ using std::ptrdiff_t; using namespace edm; using namespace std; -GenEventInfoProduct::GenEventInfoProduct() - : signalProcessID_(0), qScale_(-1.), alphaQCD_(-1.), alphaQED_(-1.), nMEPartons_(-1), nMEPartonsFiltered_(-1) {} - -GenEventInfoProduct::GenEventInfoProduct(const HepMC::GenEvent *evt) - : weights_(evt->weights().begin(), evt->weights().end()), - signalProcessID_(evt->signal_process_id()), - qScale_(evt->event_scale()), - alphaQCD_(evt->alphaQCD()), - alphaQED_(evt->alphaQED()), - nMEPartons_(-1), - nMEPartonsFiltered_(-1) { - const HepMC::PdfInfo *hepPDF = evt->pdf_info(); - if (hepPDF) { - PDF pdf; - - pdf.id = std::make_pair(hepPDF->id1(), hepPDF->id2()); - pdf.x = std::make_pair(hepPDF->x1(), hepPDF->x2()); - pdf.xPDF = std::make_pair(hepPDF->pdf1(), hepPDF->pdf2()); - pdf.scalePDF = hepPDF->scalePDF(); - - setPDF(&pdf); +namespace io_v1 { + + GenEventInfoProduct::GenEventInfoProduct() + : signalProcessID_(0), qScale_(-1.), alphaQCD_(-1.), alphaQED_(-1.), nMEPartons_(-1), nMEPartonsFiltered_(-1) {} + + GenEventInfoProduct::GenEventInfoProduct(const HepMC::GenEvent *evt) + : weights_(evt->weights().begin(), evt->weights().end()), + signalProcessID_(evt->signal_process_id()), + qScale_(evt->event_scale()), + alphaQCD_(evt->alphaQCD()), + alphaQED_(evt->alphaQED()), + nMEPartons_(-1), + nMEPartonsFiltered_(-1) { + const HepMC::PdfInfo *hepPDF = evt->pdf_info(); + if (hepPDF) { + PDF pdf; + + pdf.id = std::make_pair(hepPDF->id1(), hepPDF->id2()); + pdf.x = std::make_pair(hepPDF->x1(), hepPDF->x2()); + pdf.xPDF = std::make_pair(hepPDF->pdf1(), hepPDF->pdf2()); + pdf.scalePDF = hepPDF->scalePDF(); + + setPDF(&pdf); + } } -} - -GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct const &other) - : weights_(other.weights_), - signalProcessID_(other.signalProcessID_), - qScale_(other.qScale_), - alphaQCD_(other.alphaQCD_), - alphaQED_(other.alphaQED_), - binningValues_(other.binningValues_), - DJRValues_(other.DJRValues_), - nMEPartons_(other.nMEPartons_), - nMEPartonsFiltered_(other.nMEPartons_) { - setPDF(other.pdf()); -} - -GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct &&other) - : weights_(std::move(other.weights_)), - signalProcessID_(other.signalProcessID_), - qScale_(other.qScale_), - alphaQCD_(other.alphaQCD_), - alphaQED_(other.alphaQED_), - pdf_(other.pdf_.release()), - binningValues_(std::move(other.binningValues_)), - DJRValues_(std::move(other.DJRValues_)), - nMEPartons_(other.nMEPartons_), - nMEPartonsFiltered_(other.nMEPartons_) {} - -GenEventInfoProduct::~GenEventInfoProduct() {} - -GenEventInfoProduct &GenEventInfoProduct::operator=(GenEventInfoProduct const &other) { - weights_ = other.weights_; - signalProcessID_ = other.signalProcessID_; - qScale_ = other.qScale_; - alphaQCD_ = other.alphaQCD_; - alphaQED_ = other.alphaQED_; - binningValues_ = other.binningValues_; - DJRValues_ = other.DJRValues_; - nMEPartons_ = other.nMEPartons_; - nMEPartonsFiltered_ = other.nMEPartonsFiltered_; - - setPDF(other.pdf()); - - return *this; -} - -GenEventInfoProduct &GenEventInfoProduct::operator=(GenEventInfoProduct &&other) { - weights_ = std::move(other.weights_); - signalProcessID_ = other.signalProcessID_; - qScale_ = other.qScale_; - alphaQCD_ = other.alphaQCD_; - alphaQED_ = other.alphaQED_; - binningValues_ = std::move(other.binningValues_); - DJRValues_ = std::move(other.DJRValues_); - nMEPartons_ = other.nMEPartons_; - nMEPartonsFiltered_ = other.nMEPartonsFiltered_; - pdf_ = std::move(other.pdf_); - - return *this; -} - -double GenEventInfoProduct::weightProduct() const { - return std::accumulate(weights_.begin(), weights_.end(), 1., std::multiplies()); -} + + GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct const &other) + : weights_(other.weights_), + signalProcessID_(other.signalProcessID_), + qScale_(other.qScale_), + alphaQCD_(other.alphaQCD_), + alphaQED_(other.alphaQED_), + binningValues_(other.binningValues_), + DJRValues_(other.DJRValues_), + nMEPartons_(other.nMEPartons_), + nMEPartonsFiltered_(other.nMEPartons_) { + setPDF(other.pdf()); + } + + GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct &&other) + : weights_(std::move(other.weights_)), + signalProcessID_(other.signalProcessID_), + qScale_(other.qScale_), + alphaQCD_(other.alphaQCD_), + alphaQED_(other.alphaQED_), + pdf_(other.pdf_.release()), + binningValues_(std::move(other.binningValues_)), + DJRValues_(std::move(other.DJRValues_)), + nMEPartons_(other.nMEPartons_), + nMEPartonsFiltered_(other.nMEPartons_) {} + + GenEventInfoProduct::~GenEventInfoProduct() {} + + GenEventInfoProduct &GenEventInfoProduct::operator=(GenEventInfoProduct const &other) { + weights_ = other.weights_; + signalProcessID_ = other.signalProcessID_; + qScale_ = other.qScale_; + alphaQCD_ = other.alphaQCD_; + alphaQED_ = other.alphaQED_; + binningValues_ = other.binningValues_; + DJRValues_ = other.DJRValues_; + nMEPartons_ = other.nMEPartons_; + nMEPartonsFiltered_ = other.nMEPartonsFiltered_; + + setPDF(other.pdf()); + + return *this; + } + + GenEventInfoProduct &GenEventInfoProduct::operator=(GenEventInfoProduct &&other) { + weights_ = std::move(other.weights_); + signalProcessID_ = other.signalProcessID_; + qScale_ = other.qScale_; + alphaQCD_ = other.alphaQCD_; + alphaQED_ = other.alphaQED_; + binningValues_ = std::move(other.binningValues_); + DJRValues_ = std::move(other.DJRValues_); + nMEPartons_ = other.nMEPartons_; + nMEPartonsFiltered_ = other.nMEPartonsFiltered_; + pdf_ = std::move(other.pdf_); + + return *this; + } + + double GenEventInfoProduct::weightProduct() const { + return std::accumulate(weights_.begin(), weights_.end(), 1., std::multiplies()); + } + +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/GenFilterInfo.cc b/SimDataFormats/GeneratorProducts/src/GenFilterInfo.cc index 1b2f3e30a6419..ed262e62ed01e 100644 --- a/SimDataFormats/GeneratorProducts/src/GenFilterInfo.cc +++ b/SimDataFormats/GeneratorProducts/src/GenFilterInfo.cc @@ -9,115 +9,119 @@ using namespace edm; using namespace std; -GenFilterInfo::GenFilterInfo() - : numPassPositiveEvents_(0), - numPassNegativeEvents_(0), - numTotalPositiveEvents_(0), - numTotalNegativeEvents_(0), - sumPassWeights_(0.), - sumPassWeights2_(0.), - sumTotalWeights_(0.), - sumTotalWeights2_(0.) {} - -GenFilterInfo::GenFilterInfo(unsigned int tried, unsigned int pass) - : numPassPositiveEvents_(pass), - numPassNegativeEvents_(0), - numTotalPositiveEvents_(tried), - numTotalNegativeEvents_(0), - sumPassWeights_(pass), - sumPassWeights2_(pass), - sumTotalWeights_(tried), - sumTotalWeights2_(tried) {} - -GenFilterInfo::GenFilterInfo(unsigned int passp, - unsigned int passn, - unsigned int totalp, - unsigned int totaln, - double passw, - double passw2, - double totalw, - double totalw2) - : numPassPositiveEvents_(passp), - numPassNegativeEvents_(passn), - numTotalPositiveEvents_(totalp), - numTotalNegativeEvents_(totaln), - sumPassWeights_(passw), - sumPassWeights2_(passw2), - sumTotalWeights_(totalw), - sumTotalWeights2_(totalw2) {} - -GenFilterInfo::~GenFilterInfo() {} - -bool GenFilterInfo::mergeProduct(GenFilterInfo const& other) { - // merging two GenFilterInfos means that the numerator and - // denominator from the original product need to besummed with - // those in the product we are going to merge - - numPassPositiveEvents_ += other.numPassPositiveEvents_; - numPassNegativeEvents_ += other.numPassNegativeEvents_; - numTotalPositiveEvents_ += other.numTotalPositiveEvents_; - numTotalNegativeEvents_ += other.numTotalNegativeEvents_; - sumPassWeights_ += other.sumPassWeights_; - sumPassWeights2_ += other.sumPassWeights2_; - sumTotalWeights_ += other.sumTotalWeights_; - sumTotalWeights2_ += other.sumTotalWeights2_; - - return true; -} - -void GenFilterInfo::swap(GenFilterInfo& other) { - std::swap(numPassPositiveEvents_, other.numPassPositiveEvents_); - std::swap(numPassNegativeEvents_, other.numPassNegativeEvents_); - std::swap(numTotalPositiveEvents_, other.numTotalPositiveEvents_); - std::swap(numTotalNegativeEvents_, other.numTotalNegativeEvents_); - std::swap(sumPassWeights_, other.sumPassWeights_); - std::swap(sumPassWeights2_, other.sumPassWeights2_); - std::swap(sumTotalWeights_, other.sumTotalWeights_); - std::swap(sumTotalWeights2_, other.sumTotalWeights2_); -} - -double GenFilterInfo::filterEfficiency(int idwtup) const { - double eff = -1; - switch (idwtup) { - case 3: - case -3: - eff = numEventsTotal() > 0 ? (double)numEventsPassed() / (double)numEventsTotal() : -1; - break; - default: - eff = sumWeights() > 0 ? sumPassWeights() / sumWeights() : -1; - break; +namespace io_v1 { + + GenFilterInfo::GenFilterInfo() + : numPassPositiveEvents_(0), + numPassNegativeEvents_(0), + numTotalPositiveEvents_(0), + numTotalNegativeEvents_(0), + sumPassWeights_(0.), + sumPassWeights2_(0.), + sumTotalWeights_(0.), + sumTotalWeights2_(0.) {} + + GenFilterInfo::GenFilterInfo(unsigned int tried, unsigned int pass) + : numPassPositiveEvents_(pass), + numPassNegativeEvents_(0), + numTotalPositiveEvents_(tried), + numTotalNegativeEvents_(0), + sumPassWeights_(pass), + sumPassWeights2_(pass), + sumTotalWeights_(tried), + sumTotalWeights2_(tried) {} + + GenFilterInfo::GenFilterInfo(unsigned int passp, + unsigned int passn, + unsigned int totalp, + unsigned int totaln, + double passw, + double passw2, + double totalw, + double totalw2) + : numPassPositiveEvents_(passp), + numPassNegativeEvents_(passn), + numTotalPositiveEvents_(totalp), + numTotalNegativeEvents_(totaln), + sumPassWeights_(passw), + sumPassWeights2_(passw2), + sumTotalWeights_(totalw), + sumTotalWeights2_(totalw2) {} + + GenFilterInfo::~GenFilterInfo() {} + + bool GenFilterInfo::mergeProduct(GenFilterInfo const& other) { + // merging two GenFilterInfos means that the numerator and + // denominator from the original product need to besummed with + // those in the product we are going to merge + + numPassPositiveEvents_ += other.numPassPositiveEvents_; + numPassNegativeEvents_ += other.numPassNegativeEvents_; + numTotalPositiveEvents_ += other.numTotalPositiveEvents_; + numTotalNegativeEvents_ += other.numTotalNegativeEvents_; + sumPassWeights_ += other.sumPassWeights_; + sumPassWeights2_ += other.sumPassWeights2_; + sumTotalWeights_ += other.sumTotalWeights_; + sumTotalWeights2_ += other.sumTotalWeights2_; + + return true; } - return eff; -} - -double GenFilterInfo::filterEfficiencyError(int idwtup) const { - double efferr = -1; - switch (idwtup) { - case 3: - case -3: { - double effp = - numTotalPositiveEvents() > 0 ? (double)numPassPositiveEvents() / (double)numTotalPositiveEvents() : 0; - double effp_err2 = numTotalPositiveEvents() > 0 ? (1 - effp) * effp / (double)numTotalPositiveEvents() : 0; - - double effn = - numTotalNegativeEvents() > 0 ? (double)numPassNegativeEvents() / (double)numTotalNegativeEvents() : 0; - double effn_err2 = numTotalNegativeEvents() > 0 ? (1 - effn) * effn / (double)numTotalNegativeEvents() : 0; - - efferr = numEventsTotal() > 0 - ? sqrt(((double)numTotalPositiveEvents() * (double)numTotalPositiveEvents() * effp_err2 + - (double)numTotalNegativeEvents() * (double)numTotalNegativeEvents() * effn_err2) / - (double)numEventsTotal() / (double)numEventsTotal()) - : -1; - break; + + void GenFilterInfo::swap(GenFilterInfo& other) { + std::swap(numPassPositiveEvents_, other.numPassPositiveEvents_); + std::swap(numPassNegativeEvents_, other.numPassNegativeEvents_); + std::swap(numTotalPositiveEvents_, other.numTotalPositiveEvents_); + std::swap(numTotalNegativeEvents_, other.numTotalNegativeEvents_); + std::swap(sumPassWeights_, other.sumPassWeights_); + std::swap(sumPassWeights2_, other.sumPassWeights2_); + std::swap(sumTotalWeights_, other.sumTotalWeights_); + std::swap(sumTotalWeights2_, other.sumTotalWeights2_); + } + + double GenFilterInfo::filterEfficiency(int idwtup) const { + double eff = -1; + switch (idwtup) { + case 3: + case -3: + eff = numEventsTotal() > 0 ? (double)numEventsPassed() / (double)numEventsTotal() : -1; + break; + default: + eff = sumWeights() > 0 ? sumPassWeights() / sumWeights() : -1; + break; } - default: { - double denominator = sumWeights() * sumWeights() * sumWeights() * sumWeights(); - double numerator = sumPassWeights2() * sumFailWeights() * sumFailWeights() + - sumFailWeights2() * sumPassWeights() * sumPassWeights(); - efferr = denominator > 0 ? sqrt(numerator / denominator) : -1; - break; + return eff; + } + + double GenFilterInfo::filterEfficiencyError(int idwtup) const { + double efferr = -1; + switch (idwtup) { + case 3: + case -3: { + double effp = + numTotalPositiveEvents() > 0 ? (double)numPassPositiveEvents() / (double)numTotalPositiveEvents() : 0; + double effp_err2 = numTotalPositiveEvents() > 0 ? (1 - effp) * effp / (double)numTotalPositiveEvents() : 0; + + double effn = + numTotalNegativeEvents() > 0 ? (double)numPassNegativeEvents() / (double)numTotalNegativeEvents() : 0; + double effn_err2 = numTotalNegativeEvents() > 0 ? (1 - effn) * effn / (double)numTotalNegativeEvents() : 0; + + efferr = numEventsTotal() > 0 + ? sqrt(((double)numTotalPositiveEvents() * (double)numTotalPositiveEvents() * effp_err2 + + (double)numTotalNegativeEvents() * (double)numTotalNegativeEvents() * effn_err2) / + (double)numEventsTotal() / (double)numEventsTotal()) + : -1; + break; + } + default: { + double denominator = sumWeights() * sumWeights() * sumWeights() * sumWeights(); + double numerator = sumPassWeights2() * sumFailWeights() * sumFailWeights() + + sumFailWeights2() * sumPassWeights() * sumPassWeights(); + efferr = denominator > 0 ? sqrt(numerator / denominator) : -1; + break; + } } + + return efferr; } - return efferr; -} +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/GenLumiInfoProduct.cc b/SimDataFormats/GeneratorProducts/src/GenLumiInfoProduct.cc index 69b9700aecf92..24a8a68afba79 100644 --- a/SimDataFormats/GeneratorProducts/src/GenLumiInfoProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/GenLumiInfoProduct.cc @@ -10,99 +10,103 @@ using namespace edm; using namespace std; -const bool operator<(const GenLumiInfoProduct::ProcessInfo& lhs, const GenLumiInfoProduct::ProcessInfo& rhs) { - return (lhs.process() < rhs.process()); -} - -const bool operator!=(const GenLumiInfoProduct::ProcessInfo& lhs, const GenLumiInfoProduct::ProcessInfo& rhs) { - bool condition = (lhs.process() != rhs.process()) || (lhs.lheXSec() != rhs.lheXSec()); - return condition; -} - -const bool operator==(const GenLumiInfoProduct::ProcessInfo& lhs, const GenLumiInfoProduct::ProcessInfo& rhs) { - bool condition = - (lhs.process() == rhs.process() && lhs.lheXSec() == rhs.lheXSec() && lhs.nPassPos() == rhs.nPassPos() && - lhs.nPassNeg() == rhs.nPassNeg() && lhs.nTotalPos() == rhs.nTotalPos() && lhs.nTotalNeg() == rhs.nTotalNeg() && - lhs.tried() == rhs.tried() && lhs.selected() == rhs.selected() && lhs.killed() == rhs.killed() && - lhs.accepted() == rhs.accepted() && lhs.acceptedBr() == rhs.acceptedBr()); - return condition; -} - -const bool operator!=(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs) { - std::vector lhsVector = lhs.getProcessInfos(); - std::vector rhsVector = rhs.getProcessInfos(); - std::sort(lhsVector.begin(), lhsVector.end()); - std::sort(rhsVector.begin(), rhsVector.end()); - unsigned int lhssize = lhsVector.size(); - unsigned int rhssize = rhsVector.size(); - bool condition = (lhs.getHEPIDWTUP() != rhs.getHEPIDWTUP()) || (lhssize != rhssize); - bool fail = false; - if (!condition) { - for (unsigned int i = 0; i < lhssize; i++) { - if (lhsVector[i] != rhsVector[i]) { - fail = true; - break; +namespace io_v1 { + + const bool operator<(const GenLumiInfoProduct::ProcessInfo& lhs, const GenLumiInfoProduct::ProcessInfo& rhs) { + return (lhs.process() < rhs.process()); + } + + const bool operator!=(const GenLumiInfoProduct::ProcessInfo& lhs, const GenLumiInfoProduct::ProcessInfo& rhs) { + bool condition = (lhs.process() != rhs.process()) || (lhs.lheXSec() != rhs.lheXSec()); + return condition; + } + + const bool operator==(const GenLumiInfoProduct::ProcessInfo& lhs, const GenLumiInfoProduct::ProcessInfo& rhs) { + bool condition = + (lhs.process() == rhs.process() && lhs.lheXSec() == rhs.lheXSec() && lhs.nPassPos() == rhs.nPassPos() && + lhs.nPassNeg() == rhs.nPassNeg() && lhs.nTotalPos() == rhs.nTotalPos() && lhs.nTotalNeg() == rhs.nTotalNeg() && + lhs.tried() == rhs.tried() && lhs.selected() == rhs.selected() && lhs.killed() == rhs.killed() && + lhs.accepted() == rhs.accepted() && lhs.acceptedBr() == rhs.acceptedBr()); + return condition; + } + + const bool operator!=(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs) { + std::vector lhsVector = lhs.getProcessInfos(); + std::vector rhsVector = rhs.getProcessInfos(); + std::sort(lhsVector.begin(), lhsVector.end()); + std::sort(rhsVector.begin(), rhsVector.end()); + unsigned int lhssize = lhsVector.size(); + unsigned int rhssize = rhsVector.size(); + bool condition = (lhs.getHEPIDWTUP() != rhs.getHEPIDWTUP()) || (lhssize != rhssize); + bool fail = false; + if (!condition) { + for (unsigned int i = 0; i < lhssize; i++) { + if (lhsVector[i] != rhsVector[i]) { + fail = true; + break; + } } } + return (condition || fail); } - return (condition || fail); -} - -const bool operator==(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs) { - std::vector lhsVector = lhs.getProcessInfos(); - std::vector rhsVector = rhs.getProcessInfos(); - std::sort(lhsVector.begin(), lhsVector.end()); - std::sort(rhsVector.begin(), rhsVector.end()); - unsigned int lhssize = lhsVector.size(); - unsigned int rhssize = rhsVector.size(); - - bool condition = (lhs.getHEPIDWTUP() == rhs.getHEPIDWTUP()) && (lhssize == rhssize); - unsigned int passCounts = 0; - if (condition) { - for (unsigned int i = 0; i < lhssize; i++) { - if (lhsVector[i] == rhsVector[i]) - passCounts++; + + const bool operator==(const GenLumiInfoProduct& lhs, const GenLumiInfoProduct& rhs) { + std::vector lhsVector = lhs.getProcessInfos(); + std::vector rhsVector = rhs.getProcessInfos(); + std::sort(lhsVector.begin(), lhsVector.end()); + std::sort(rhsVector.begin(), rhsVector.end()); + unsigned int lhssize = lhsVector.size(); + unsigned int rhssize = rhsVector.size(); + + bool condition = (lhs.getHEPIDWTUP() == rhs.getHEPIDWTUP()) && (lhssize == rhssize); + unsigned int passCounts = 0; + if (condition) { + for (unsigned int i = 0; i < lhssize; i++) { + if (lhsVector[i] == rhsVector[i]) + passCounts++; + } } + return (condition && (passCounts == lhssize)); } - return (condition && (passCounts == lhssize)); -} -GenLumiInfoProduct::GenLumiInfoProduct() : hepidwtup_(-1) { internalProcesses_.clear(); } + GenLumiInfoProduct::GenLumiInfoProduct() : hepidwtup_(-1) { internalProcesses_.clear(); } -GenLumiInfoProduct::GenLumiInfoProduct(const int id) : hepidwtup_(id) { internalProcesses_.clear(); } + GenLumiInfoProduct::GenLumiInfoProduct(const int id) : hepidwtup_(id) { internalProcesses_.clear(); } -GenLumiInfoProduct::~GenLumiInfoProduct() {} + GenLumiInfoProduct::~GenLumiInfoProduct() {} -bool GenLumiInfoProduct::mergeProduct(GenLumiInfoProduct const& other) { - std::map processes; + bool GenLumiInfoProduct::mergeProduct(GenLumiInfoProduct const& other) { + std::map processes; - for (unsigned int i = 0; i < getProcessInfos().size(); i++) { - int id = getProcessInfos()[i].process(); - ProcessInfo& x = processes[id]; - x = getProcessInfos()[i]; - } + for (unsigned int i = 0; i < getProcessInfos().size(); i++) { + int id = getProcessInfos()[i].process(); + ProcessInfo& x = processes[id]; + x = getProcessInfos()[i]; + } - // the two GenLuminInfoProducts may not have the same number - // of processes - for (unsigned int i = 0; i < other.getProcessInfos().size(); i++) { - int id = other.getProcessInfos()[i].process(); - ProcessInfo& x = processes[id]; - if (x.lheXSec().value() > 0) - x.addOthers(other.getProcessInfos()[i]); - else - x = other.getProcessInfos()[i]; + // the two GenLuminInfoProducts may not have the same number + // of processes + for (unsigned int i = 0; i < other.getProcessInfos().size(); i++) { + int id = other.getProcessInfos()[i].process(); + ProcessInfo& x = processes[id]; + if (x.lheXSec().value() > 0) + x.addOthers(other.getProcessInfos()[i]); + else + x = other.getProcessInfos()[i]; + } + + internalProcesses_.resize(processes.size()); + unsigned int i = 0; + for (std::map::const_iterator iter = processes.begin(); iter != processes.end(); ++iter, i++) + internalProcesses_[i] = iter->second; + return true; } - internalProcesses_.resize(processes.size()); - unsigned int i = 0; - for (std::map::const_iterator iter = processes.begin(); iter != processes.end(); ++iter, i++) - internalProcesses_[i] = iter->second; - return true; -} + void GenLumiInfoProduct::swap(GenLumiInfoProduct& other) { + std::swap(hepidwtup_, other.hepidwtup_); + internalProcesses_.swap(other.internalProcesses_); + } -void GenLumiInfoProduct::swap(GenLumiInfoProduct& other) { - std::swap(hepidwtup_, other.hepidwtup_); - internalProcesses_.swap(other.internalProcesses_); -} + bool GenLumiInfoProduct::isProductEqual(GenLumiInfoProduct const& other) const { return ((*this) == other); } -bool GenLumiInfoProduct::isProductEqual(GenLumiInfoProduct const& other) const { return ((*this) == other); } +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/GenRunInfoProduct.cc b/SimDataFormats/GeneratorProducts/src/GenRunInfoProduct.cc index bfc45ca649cf2..31ae6432f184b 100644 --- a/SimDataFormats/GeneratorProducts/src/GenRunInfoProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/GenRunInfoProduct.cc @@ -8,18 +8,22 @@ using namespace edm; using namespace std; -GenRunInfoProduct::GenRunInfoProduct() : externalFilterEfficiency_(-1.) {} - -bool GenRunInfoProduct::isProductEqual(GenRunInfoProduct const &other) const { - bool result = externalXSecLO_ == other.externalXSecLO_ && externalXSecNLO_ == other.externalXSecNLO_ && - externalFilterEfficiency_ == other.externalFilterEfficiency_; - if (not result) { - edm::LogWarning("GenRunInfoProduct|ProductsNotMergeable") - << "You are merging runs with different cross-sections and/or " - "filter efficiencies (from GenRunInfoProduct)\n" - "The resulting cross-section will not be consistent." - << std::endl; +namespace io_v1 { + + GenRunInfoProduct::GenRunInfoProduct() : externalFilterEfficiency_(-1.) {} + + bool GenRunInfoProduct::isProductEqual(GenRunInfoProduct const &other) const { + bool result = externalXSecLO_ == other.externalXSecLO_ && externalXSecNLO_ == other.externalXSecNLO_ && + externalFilterEfficiency_ == other.externalFilterEfficiency_; + if (not result) { + edm::LogWarning("GenRunInfoProduct|ProductsNotMergeable") + << "You are merging runs with different cross-sections and/or " + "filter efficiencies (from GenRunInfoProduct)\n" + "The resulting cross-section will not be consistent." + << std::endl; + } + + return result; } - return result; -} +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/LHEEventProduct.cc b/SimDataFormats/GeneratorProducts/src/LHEEventProduct.cc index 9edde4af6ea96..f4f35fa37afd0 100644 --- a/SimDataFormats/GeneratorProducts/src/LHEEventProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/LHEEventProduct.cc @@ -6,65 +6,69 @@ #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" #include "SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h" -void LHEEventProduct::const_iterator::next() { - const lhef::HEPEUP &hepeup = event->hepeup(); - int line = this->line++; +namespace io_v1 { - if (!line) { - std::ostringstream ss; - ss << std::setprecision(7) << std::scientific << std::uppercase << " " << hepeup.NUP << " " << hepeup.IDPRUP - << " " << event->originalXWGTUP() << " " << hepeup.SCALUP << " " << hepeup.AQEDUP << " " << hepeup.AQCDUP - << std::endl; - tmp = ss.str(); - return; - } - line--; - - if (line < hepeup.NUP) { - std::ostringstream ss; - ss << std::setprecision(10) << std::scientific << std::uppercase << "\t" << hepeup.IDUP[line] << "\t" - << hepeup.ISTUP[line] << "\t" << hepeup.MOTHUP[line].first << "\t" << hepeup.MOTHUP[line].second << "\t" - << hepeup.ICOLUP[line].first << "\t" << hepeup.ICOLUP[line].second << "\t" << hepeup.PUP[line][0] << "\t" - << hepeup.PUP[line][1] << "\t" << hepeup.PUP[line][2] << "\t" << hepeup.PUP[line][3] << "\t" - << hepeup.PUP[line][4] << std::setprecision(3) << "\t" << hepeup.VTIMUP[line] << std::setprecision(1) - << std::fixed << "\t" << hepeup.SPINUP[line] << std::endl; - tmp = ss.str(); - return; - } - line -= hepeup.NUP; + void LHEEventProduct::const_iterator::next() { + const lhef::HEPEUP &hepeup = event->hepeup(); + int line = this->line++; - if (event->pdf()) { if (!line) { - const PDF &pdf = *event->pdf(); std::ostringstream ss; - ss << std::setprecision(7) << std::scientific << std::uppercase << "#pdf " << pdf.id.first << " " - << pdf.id.second << " " << pdf.x.first << " " << pdf.x.second << " " << pdf.scalePDF << " " - << pdf.xPDF.first << " " << pdf.xPDF.second << std::endl; + ss << std::setprecision(7) << std::scientific << std::uppercase << " " << hepeup.NUP << " " << hepeup.IDPRUP + << " " << event->originalXWGTUP() << " " << hepeup.SCALUP << " " << hepeup.AQEDUP << " " << hepeup.AQCDUP + << std::endl; tmp = ss.str(); return; } line--; - } - if (line < (int)event->comments_size()) { - tmp = *(event->comments_begin() + line); - return; - } - line -= event->comments_size(); + if (line < hepeup.NUP) { + std::ostringstream ss; + ss << std::setprecision(10) << std::scientific << std::uppercase << "\t" << hepeup.IDUP[line] << "\t" + << hepeup.ISTUP[line] << "\t" << hepeup.MOTHUP[line].first << "\t" << hepeup.MOTHUP[line].second << "\t" + << hepeup.ICOLUP[line].first << "\t" << hepeup.ICOLUP[line].second << "\t" << hepeup.PUP[line][0] << "\t" + << hepeup.PUP[line][1] << "\t" << hepeup.PUP[line][2] << "\t" << hepeup.PUP[line][3] << "\t" + << hepeup.PUP[line][4] << std::setprecision(3) << "\t" << hepeup.VTIMUP[line] << std::setprecision(1) + << std::fixed << "\t" << hepeup.SPINUP[line] << std::endl; + tmp = ss.str(); + return; + } + line -= hepeup.NUP; - if (!line) { - tmp = "\n"; - return; + if (event->pdf()) { + if (!line) { + const PDF &pdf = *event->pdf(); + std::ostringstream ss; + ss << std::setprecision(7) << std::scientific << std::uppercase << "#pdf " << pdf.id.first << " " + << pdf.id.second << " " << pdf.x.first << " " << pdf.x.second << " " << pdf.scalePDF << " " + << pdf.xPDF.first << " " << pdf.xPDF.second << std::endl; + tmp = ss.str(); + return; + } + line--; + } + + if (line < (int)event->comments_size()) { + tmp = *(event->comments_begin() + line); + return; + } + line -= event->comments_size(); + + if (!line) { + tmp = "\n"; + return; + } + + tmp.clear(); + this->line = npos; } - tmp.clear(); - this->line = npos; -} + LHEEventProduct::const_iterator LHEEventProduct::begin() const { + const_iterator result; + result.event = this; + result.line = 0; + result.tmp = "\n"; + return result; + } -LHEEventProduct::const_iterator LHEEventProduct::begin() const { - const_iterator result; - result.event = this; - result.line = 0; - result.tmp = "\n"; - return result; -} +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc b/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc index b1644e669c47f..9dddca96552cf 100644 --- a/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/LHERunInfoProduct.cc @@ -13,270 +13,275 @@ #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" #include "SimDataFormats/GeneratorProducts/interface/LHERunInfoProduct.h" -bool LHERunInfoProduct::const_iterator::operator==(const const_iterator &other) const { - if (mode != other.mode) - return false; +namespace io_v1 { - switch (mode) { - case kFooter: - case kDone: - return true; + bool LHERunInfoProduct::const_iterator::operator==(const const_iterator &other) const { + if (mode != other.mode) + return false; - case kHeader: - return header == other.header; + switch (mode) { + case kFooter: + case kDone: + return true; - case kBody: - return header == other.header && iter == other.iter; + case kHeader: + return header == other.header; - case kInit: - return line == other.line; - } + case kBody: + return header == other.header && iter == other.iter; - return false; -} + case kInit: + return line == other.line; + } -void LHERunInfoProduct::const_iterator::next() { - tmp.clear(); + return false; + } - do { - switch (mode) { - case kHeader: - if (header == runInfo->headers_end()) { - if (line++ == 1) - tmp = "
\n"; - else { - mode = kInit; - tmp = "\n"; - line = 0; + void LHERunInfoProduct::const_iterator::next() { + tmp.clear(); + + do { + switch (mode) { + case kHeader: + if (header == runInfo->headers_end()) { + if (line++ == 1) + tmp = "
\n"; + else { + mode = kInit; + tmp = "\n"; + line = 0; + } + break; + } else if (!line) { + line++; + tmp = "
\n"; + break; + } else { + mode = kBody; + const std::string &tag = header->tag(); + tmp = tag.empty() ? "" : (tag == "<>") ? "" : (""); + tmp += "\n"; + header++; + } else { + tmp += *iter++; + if (iter == header->end() && + (tmp.empty() || (tmp[tmp.length() - 1] != '\r' && tmp[tmp.length() - 1] != '\n'))) + continue; } break; - } else if (!line) { - line++; - tmp = "
\n"; - break; - } else { - mode = kBody; - const std::string &tag = header->tag(); - tmp = tag.empty() ? "" : (tag == "<>") ? "" : (""); - tmp += "\n"; - header++; - } else { - tmp += *iter++; - if (iter == header->end() && - (tmp.empty() || (tmp[tmp.length() - 1] != '\r' && tmp[tmp.length() - 1] != '\n'))) - continue; - } - break; + case kInit: { + const lhef::HEPRUP &heprup = runInfo->heprup(); + if (!line++) { + std::ostringstream ss; + ss << std::setprecision(7) << std::scientific << std::uppercase << " " << heprup.IDBMUP.first << " " + << heprup.IDBMUP.second << " " << heprup.EBMUP.first << " " << heprup.EBMUP.second << " " + << heprup.PDFGUP.first << " " << heprup.PDFGUP.second << " " << heprup.PDFSUP.first << " " + << heprup.PDFSUP.second << " " << heprup.IDWTUP << " " << heprup.NPRUP << std::endl; + tmp = ss.str(); + break; + } + if (line >= (unsigned int)heprup.NPRUP + runInfo->comments_size() + 2) { + tmp = "\n"; + mode = kFooter; + break; + } else if (line >= (unsigned int)heprup.NPRUP + 2) { + tmp = *(runInfo->comments_begin() + (line - (unsigned int)heprup.NPRUP - 2)); + break; + } - case kInit: { - const lhef::HEPRUP &heprup = runInfo->heprup(); - if (!line++) { std::ostringstream ss; - ss << std::setprecision(7) << std::scientific << std::uppercase << " " << heprup.IDBMUP.first << " " - << heprup.IDBMUP.second << " " << heprup.EBMUP.first << " " << heprup.EBMUP.second << " " - << heprup.PDFGUP.first << " " << heprup.PDFGUP.second << " " << heprup.PDFSUP.first << " " - << heprup.PDFSUP.second << " " << heprup.IDWTUP << " " << heprup.NPRUP << std::endl; + ss << std::setprecision(7) << std::scientific << std::uppercase << "\t" << heprup.XSECUP[line - 2] << "\t" + << heprup.XERRUP[line - 2] << "\t" << heprup.XMAXUP[line - 2] << "\t" << heprup.LPRUP[line - 2] + << std::endl; tmp = ss.str(); - break; - } - if (line >= (unsigned int)heprup.NPRUP + runInfo->comments_size() + 2) { - tmp = "\n"; - mode = kFooter; - break; - } else if (line >= (unsigned int)heprup.NPRUP + 2) { - tmp = *(runInfo->comments_begin() + (line - (unsigned int)heprup.NPRUP - 2)); - break; - } + } break; - std::ostringstream ss; - ss << std::setprecision(7) << std::scientific << std::uppercase << "\t" << heprup.XSECUP[line - 2] << "\t" - << heprup.XERRUP[line - 2] << "\t" << heprup.XMAXUP[line - 2] << "\t" << heprup.LPRUP[line - 2] << std::endl; - tmp = ss.str(); - } break; + case kFooter: + mode = kDone; - case kFooter: - mode = kDone; - - default: - /* ... */; - } - } while (false); -} + default: + /* ... */; + } + } while (false); + } -LHERunInfoProduct::const_iterator LHERunInfoProduct::begin() const { - const_iterator result; + LHERunInfoProduct::const_iterator LHERunInfoProduct::begin() const { + const_iterator result; - result.runInfo = this; - result.header = headers_begin(); - result.mode = const_iterator::kHeader; - result.line = 0; - result.tmp = "\n"; + result.runInfo = this; + result.header = headers_begin(); + result.mode = const_iterator::kHeader; + result.line = 0; + result.tmp = "\n"; - return result; -} + return result; + } -LHERunInfoProduct::const_iterator LHERunInfoProduct::init() const { - const_iterator result; + LHERunInfoProduct::const_iterator LHERunInfoProduct::init() const { + const_iterator result; - result.runInfo = this; - result.mode = const_iterator::kInit; - result.line = 0; - result.tmp = "\n"; + result.runInfo = this; + result.mode = const_iterator::kInit; + result.line = 0; + result.tmp = "\n"; - return result; -} + return result; + } -const std::string &LHERunInfoProduct::endOfFile() { - static const std::string theEnd("\n"); + const std::string &LHERunInfoProduct::endOfFile() { + static const std::string theEnd("\n"); - return theEnd; -} + return theEnd; + } -namespace { - struct XSec { - inline XSec() : xsec(0.0), err(0.0), max(0.0) {} + namespace { + struct XSec { + inline XSec() : xsec(0.0), err(0.0), max(0.0) {} - double xsec; - double err; - double max; - }; + double xsec; + double err; + double max; + }; - struct HeaderLess { - bool operator()(const LHERunInfoProduct::Header &a, const LHERunInfoProduct::Header &b) const; - }; -} // namespace + struct HeaderLess { + bool operator()(const LHERunInfoProduct::Header &a, const LHERunInfoProduct::Header &b) const; + }; + } // namespace -bool HeaderLess::operator()(const LHERunInfoProduct::Header &a, const LHERunInfoProduct::Header &b) const { - if (a == b) - return false; - if (a.tag() < b.tag()) - return true; - if (a.tag() > b.tag()) - return false; - - LHERunInfoProduct::Header::const_iterator iter1 = a.begin(); - LHERunInfoProduct::Header::const_iterator iter2 = b.begin(); - - for (; iter1 != a.end() && iter2 != b.end(); ++iter1, ++iter2) { - if (*iter1 < *iter2) + bool HeaderLess::operator()(const LHERunInfoProduct::Header &a, const LHERunInfoProduct::Header &b) const { + if (a == b) + return false; + if (a.tag() < b.tag()) return true; - else if (*iter1 != *iter2) + if (a.tag() > b.tag()) return false; - } - return iter2 != b.end(); -} + LHERunInfoProduct::Header::const_iterator iter1 = a.begin(); + LHERunInfoProduct::Header::const_iterator iter2 = b.begin(); -static std::vector checklist{"iseed", "Random", ".log", ".dat", ".lhe"}; -static std::vector tag_comparison_checklist{"", "MGRunCard", "mgruncard"}; + for (; iter1 != a.end() && iter2 != b.end(); ++iter1, ++iter2) { + if (*iter1 < *iter2) + return true; + else if (*iter1 != *iter2) + return false; + } -bool LHERunInfoProduct::find_if_checklist(const std::string x, std::vector checklist) { - return checklist.end() != std::find_if(checklist.begin(), checklist.end(), [&](const std::string &y) { - return x.find(y) != std::string::npos; - }); -} + return iter2 != b.end(); + } -bool LHERunInfoProduct::isTagComparedInMerge(const std::string &tag) { - return !(tag.empty() || tag.find("Alpgen") == 0 || tag == "MGGridCard" || tag == "MGRunCard" || tag == "mgruncard" || - tag == "MadSpin" || tag == "madspin"); -} + static std::vector checklist{"iseed", "Random", ".log", ".dat", ".lhe"}; + static std::vector tag_comparison_checklist{"", "MGRunCard", "mgruncard"}; -bool LHERunInfoProduct::mergeProduct(const LHERunInfoProduct &other) { - if (heprup_.IDBMUP != other.heprup_.IDBMUP || heprup_.EBMUP != other.heprup_.EBMUP || - heprup_.PDFGUP != other.heprup_.PDFGUP || heprup_.PDFSUP != other.heprup_.PDFSUP || - heprup_.IDWTUP != other.heprup_.IDWTUP) { - return false; + bool LHERunInfoProduct::find_if_checklist(const std::string x, std::vector checklist) { + return checklist.end() != std::find_if(checklist.begin(), checklist.end(), [&](const std::string &y) { + return x.find(y) != std::string::npos; + }); } - bool compatibleHeaders = (headers_ == other.headers_); - - // try to merge not equal but compatible headers (i.e. different iseed) - while (!compatibleHeaders) { - // okay, something is not the same. - // Let's try to merge, but don't duplicate identical headers - // and test the rest against a whitelist - - std::set headers; - std::copy(headers_begin(), headers_end(), std::inserter(headers, headers.begin())); - - // make a list of headers contained in the second file - std::vector > runcard_v2; - std::vector runcard_v2_header; - for (const auto &header2 : headers_) { - // fill a vector with the relevant header tags that can be not equal but sill compatible - if (find_if_checklist(header2.tag(), tag_comparison_checklist)) { - runcard_v2.push_back(header2.lines()); - runcard_v2_header.push_back(header2.tag()); - } + bool LHERunInfoProduct::isTagComparedInMerge(const std::string &tag) { + return !(tag.empty() || tag.find("Alpgen") == 0 || tag == "MGGridCard" || tag == "MGRunCard" || + tag == "mgruncard" || tag == "MadSpin" || tag == "madspin"); + } + + bool LHERunInfoProduct::mergeProduct(const LHERunInfoProduct &other) { + if (heprup_.IDBMUP != other.heprup_.IDBMUP || heprup_.EBMUP != other.heprup_.EBMUP || + heprup_.PDFGUP != other.heprup_.PDFGUP || heprup_.PDFSUP != other.heprup_.PDFSUP || + heprup_.IDWTUP != other.heprup_.IDWTUP) { + return false; } - // loop over the headers of the original file - bool failed = false; - for (std::vector::const_iterator header = other.headers_begin(); - header != other.headers_end(); - ++header) { - if (headers.count(*header)) { - continue; + bool compatibleHeaders = (headers_ == other.headers_); + + // try to merge not equal but compatible headers (i.e. different iseed) + while (!compatibleHeaders) { + // okay, something is not the same. + // Let's try to merge, but don't duplicate identical headers + // and test the rest against a whitelist + + std::set headers; + std::copy(headers_begin(), headers_end(), std::inserter(headers, headers.begin())); + + // make a list of headers contained in the second file + std::vector > runcard_v2; + std::vector runcard_v2_header; + for (const auto &header2 : headers_) { + // fill a vector with the relevant header tags that can be not equal but sill compatible + if (find_if_checklist(header2.tag(), tag_comparison_checklist)) { + runcard_v2.push_back(header2.lines()); + runcard_v2_header.push_back(header2.tag()); + } } - if (find_if_checklist(header->tag(), tag_comparison_checklist)) { - bool header_compatible = false; - for (unsigned int iter_runcard = 0; iter_runcard < runcard_v2.size(); iter_runcard++) { - std::vector runcard_v1 = header->lines(); - runcard_v1.erase(std::remove_if(runcard_v1.begin(), - runcard_v1.end(), - [&](const std::string &x) { return find_if_checklist(x, checklist); }), - runcard_v1.end()); - runcard_v2[iter_runcard].erase( - std::remove_if(runcard_v2[iter_runcard].begin(), - runcard_v2[iter_runcard].end(), - [&](const std::string &x) { return find_if_checklist(x, checklist); }), - runcard_v2[iter_runcard].end()); - - if (std::equal(runcard_v1.begin(), runcard_v1.end(), runcard_v2[iter_runcard].begin())) { - header_compatible = true; - break; + // loop over the headers of the original file + bool failed = false; + for (std::vector::const_iterator header = other.headers_begin(); + header != other.headers_end(); + ++header) { + if (headers.count(*header)) { + continue; + } + + if (find_if_checklist(header->tag(), tag_comparison_checklist)) { + bool header_compatible = false; + for (unsigned int iter_runcard = 0; iter_runcard < runcard_v2.size(); iter_runcard++) { + std::vector runcard_v1 = header->lines(); + runcard_v1.erase(std::remove_if(runcard_v1.begin(), + runcard_v1.end(), + [&](const std::string &x) { return find_if_checklist(x, checklist); }), + runcard_v1.end()); + runcard_v2[iter_runcard].erase( + std::remove_if(runcard_v2[iter_runcard].begin(), + runcard_v2[iter_runcard].end(), + [&](const std::string &x) { return find_if_checklist(x, checklist); }), + runcard_v2[iter_runcard].end()); + + if (std::equal(runcard_v1.begin(), runcard_v1.end(), runcard_v2[iter_runcard].begin())) { + header_compatible = true; + break; + } } + if (header_compatible) + continue; + } + + if (isTagComparedInMerge(header->tag())) { + failed = true; + } else { + addHeader(*header); + headers.insert(*header); } - if (header_compatible) - continue; } - if (isTagComparedInMerge(header->tag())) { - failed = true; - } else { - addHeader(*header); - headers.insert(*header); + if (failed) { + break; } + + compatibleHeaders = true; } - if (failed) { - break; + // still not compatible after fixups + if (!compatibleHeaders) { + return false; } - compatibleHeaders = true; + // it is exactly the same, so merge + return true; } - // still not compatible after fixups - if (!compatibleHeaders) { - return false; + void LHERunInfoProduct::swap(LHERunInfoProduct &other) { + heprup_.swap(other.heprup_); + headers_.swap(other.headers_); + comments_.swap(other.comments_); } - // it is exactly the same, so merge - return true; -} - -void LHERunInfoProduct::swap(LHERunInfoProduct &other) { - heprup_.swap(other.heprup_); - headers_.swap(other.headers_); - comments_.swap(other.comments_); -} +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/LHEXMLStringProduct.cc b/SimDataFormats/GeneratorProducts/src/LHEXMLStringProduct.cc index a4d65830176c0..04894cf9fa8a8 100644 --- a/SimDataFormats/GeneratorProducts/src/LHEXMLStringProduct.cc +++ b/SimDataFormats/GeneratorProducts/src/LHEXMLStringProduct.cc @@ -9,123 +9,129 @@ using namespace edm; using namespace std; -LHEXMLStringProduct::LHEXMLStringProduct() {} +namespace io_v1 { -LHEXMLStringProduct::LHEXMLStringProduct(const string &onelheoutput) : content_() { content_.push_back(onelheoutput); } + LHEXMLStringProduct::LHEXMLStringProduct() {} -LHEXMLStringProduct::~LHEXMLStringProduct() {} - -void LHEXMLStringProduct::fillCompressedContent(std::istream &input, unsigned int initialSize) { - //create blob with desired size - compressedContent_.emplace_back(initialSize); - std::vector &output = compressedContent_.back(); + LHEXMLStringProduct::LHEXMLStringProduct(const string &onelheoutput) : content_() { + content_.push_back(onelheoutput); + } - //read buffer - constexpr unsigned int bufsize = 4096; - char inbuf[bufsize]; + LHEXMLStringProduct::~LHEXMLStringProduct() {} - const unsigned int threshsize = 32 * 1024 * 1024; + void LHEXMLStringProduct::fillCompressedContent(std::istream &input, unsigned int initialSize) { + //create blob with desired size + compressedContent_.emplace_back(initialSize); + std::vector &output = compressedContent_.back(); - //initialize lzma - uint32_t preset = 9; - lzma_stream strm = LZMA_STREAM_INIT; - lzma_ret ret = lzma_easy_encoder(&strm, preset, LZMA_CHECK_CRC64); + //read buffer + constexpr unsigned int bufsize = 4096; + char inbuf[bufsize]; - lzma_action action = LZMA_RUN; + const unsigned int threshsize = 32 * 1024 * 1024; - strm.next_in = reinterpret_cast(&inbuf[0]); - strm.avail_in = 0; - strm.next_out = output.data(); - strm.avail_out = output.size(); + //initialize lzma + uint32_t preset = 9; + lzma_stream strm = LZMA_STREAM_INIT; + lzma_ret ret = lzma_easy_encoder(&strm, preset, LZMA_CHECK_CRC64); - unsigned int compressedSize = 0; + lzma_action action = LZMA_RUN; - while (ret == LZMA_OK) { - //read input to buffer if necessary - if (strm.avail_in == 0 && !input.eof()) { - input.read(inbuf, bufsize); - strm.next_in = reinterpret_cast(&inbuf[0]); - strm.avail_in = input.gcount(); - if (input.eof()) { - //signal to lzma that there is no more input - action = LZMA_FINISH; - } - } + strm.next_in = reinterpret_cast(&inbuf[0]); + strm.avail_in = 0; + strm.next_out = output.data(); + strm.avail_out = output.size(); - //actual compression - ret = lzma_code(&strm, action); + unsigned int compressedSize = 0; - //update compressed size - compressedSize = output.size() - strm.avail_out; + while (ret == LZMA_OK) { + //read input to buffer if necessary + if (strm.avail_in == 0 && !input.eof()) { + input.read(inbuf, bufsize); + strm.next_in = reinterpret_cast(&inbuf[0]); + strm.avail_in = input.gcount(); + if (input.eof()) { + //signal to lzma that there is no more input + action = LZMA_FINISH; + } + } - //if output blob is full and compression is still going, allocate more memory - if (strm.avail_out == 0 && ret == LZMA_OK) { - unsigned int oldsize = output.size(); - if (oldsize < threshsize) { - output.resize(2 * oldsize); - } else { - output.resize(oldsize + threshsize); + //actual compression + ret = lzma_code(&strm, action); + + //update compressed size + compressedSize = output.size() - strm.avail_out; + + //if output blob is full and compression is still going, allocate more memory + if (strm.avail_out == 0 && ret == LZMA_OK) { + unsigned int oldsize = output.size(); + if (oldsize < threshsize) { + output.resize(2 * oldsize); + } else { + output.resize(oldsize + threshsize); + } + strm.next_out = &output[oldsize]; + strm.avail_out = output.size() - oldsize; } - strm.next_out = &output[oldsize]; - strm.avail_out = output.size() - oldsize; } - } - lzma_end(&strm); + lzma_end(&strm); - if (ret != LZMA_STREAM_END) { - throw cms::Exception("CompressionError") << "There was a failure in LZMA compression in LHEXMLStringProduct."; + if (ret != LZMA_STREAM_END) { + throw cms::Exception("CompressionError") << "There was a failure in LZMA compression in LHEXMLStringProduct."; + } + + //trim output blob + output.resize(compressedSize); } - //trim output blob - output.resize(compressedSize); -} + void LHEXMLStringProduct::writeCompressedContent(std::ostream &output, unsigned int i) const { + //initialize lzma + lzma_stream strm = LZMA_STREAM_INIT; + lzma_ret ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED); + //all output available from the start, so start "close out" immediately + lzma_action action = LZMA_FINISH; + + //write buffer + constexpr unsigned int bufsize = 4096; + char outbuf[bufsize]; -void LHEXMLStringProduct::writeCompressedContent(std::ostream &output, unsigned int i) const { - //initialize lzma - lzma_stream strm = LZMA_STREAM_INIT; - lzma_ret ret = lzma_stream_decoder(&strm, UINT64_MAX, LZMA_CONCATENATED); - //all output available from the start, so start "close out" immediately - lzma_action action = LZMA_FINISH; + const std::vector &input = compressedContent_[i]; - //write buffer - constexpr unsigned int bufsize = 4096; - char outbuf[bufsize]; + strm.next_in = input.data(); + strm.avail_in = input.size(); + strm.next_out = reinterpret_cast(&outbuf[0]); + strm.avail_out = bufsize; - const std::vector &input = compressedContent_[i]; + while (ret == LZMA_OK) { + ret = lzma_code(&strm, action); - strm.next_in = input.data(); - strm.avail_in = input.size(); - strm.next_out = reinterpret_cast(&outbuf[0]); - strm.avail_out = bufsize; + //write to stream + output.write(outbuf, bufsize - strm.avail_out); - while (ret == LZMA_OK) { - ret = lzma_code(&strm, action); + //output buffer full, recycle + if (strm.avail_out == 0 && ret == LZMA_OK) { + strm.next_out = reinterpret_cast(&outbuf[0]); + strm.avail_out = bufsize; + } + } - //write to stream - output.write(outbuf, bufsize - strm.avail_out); + lzma_end(&strm); - //output buffer full, recycle - if (strm.avail_out == 0 && ret == LZMA_OK) { - strm.next_out = reinterpret_cast(&outbuf[0]); - strm.avail_out = bufsize; + if (ret != LZMA_STREAM_END) { + throw cms::Exception("DecompressionError") << "There was a failure in LZMA decompression in LHEXMLStringProduct."; } } - lzma_end(&strm); + bool LHEXMLStringProduct::mergeProduct(LHEXMLStringProduct const &other) { + content_.insert(content_.end(), other.getStrings().begin(), other.getStrings().end()); + compressedContent_.insert(compressedContent_.end(), other.getCompressed().begin(), other.getCompressed().end()); + return true; + } - if (ret != LZMA_STREAM_END) { - throw cms::Exception("DecompressionError") << "There was a failure in LZMA decompression in LHEXMLStringProduct."; + void LHEXMLStringProduct::swap(LHEXMLStringProduct &other) { + content_.swap(other.content_); + compressedContent_.swap(other.compressedContent_); } -} - -bool LHEXMLStringProduct::mergeProduct(LHEXMLStringProduct const &other) { - content_.insert(content_.end(), other.getStrings().begin(), other.getStrings().end()); - compressedContent_.insert(compressedContent_.end(), other.getCompressed().begin(), other.getCompressed().end()); - return true; -} - -void LHEXMLStringProduct::swap(LHEXMLStringProduct &other) { - content_.swap(other.content_); - compressedContent_.swap(other.compressedContent_); -} + +} // namespace io_v1 diff --git a/SimDataFormats/GeneratorProducts/src/classes_def.xml b/SimDataFormats/GeneratorProducts/src/classes_def.xml index 80dce92c1be88..b2c783190f7f2 100644 --- a/SimDataFormats/GeneratorProducts/src/classes_def.xml +++ b/SimDataFormats/GeneratorProducts/src/classes_def.xml @@ -1,13 +1,11 @@ - - - + + - - - + + @@ -28,33 +26,27 @@ ]]> - - + + - - - - - - + + - - + + - - - + + - - + + - - + + - - - + + @@ -80,15 +72,15 @@ - - - + + + - - - - - + + + + + @@ -118,92 +110,54 @@ - - + + - - - - + + - - + + - + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - - + + - - - - - - - - - - + @@ -212,67 +166,42 @@ - - + + - - + + + + + - - + + - - + + - - - - - - - - + + + + - - - - - - - + + - - - - - - - - - - - + + - - - - - - - - - - + + - + - + diff --git a/SimDataFormats/HcalTestBeam/src/classes_def.xml b/SimDataFormats/HcalTestBeam/src/classes_def.xml index 31bb4a25deaaa..ba80905dc4f0e 100644 --- a/SimDataFormats/HcalTestBeam/src/classes_def.xml +++ b/SimDataFormats/HcalTestBeam/src/classes_def.xml @@ -1,20 +1,20 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/SimDataFormats/HiGenData/src/classes_def.xml b/SimDataFormats/HiGenData/src/classes_def.xml index beef47a3a7fd6..c56f4cd631f7e 100644 --- a/SimDataFormats/HiGenData/src/classes_def.xml +++ b/SimDataFormats/HiGenData/src/classes_def.xml @@ -1,6 +1,6 @@ - - + + diff --git a/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h b/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h index a96cbebdd018a..a8ebd326e7a13 100644 --- a/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h +++ b/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h @@ -19,80 +19,86 @@ Usage: purely descriptive #include #include -class PileupSummaryInfo { -public: - PileupSummaryInfo() {} - - PileupSummaryInfo(const int num_PU_vertices, - const std::vector& zpositions, - const std::vector& times, // may be empty - const std::vector& sumpT_lowpT, - const std::vector& sumpT_highpT, - const std::vector& ntrks_lowpT, - const std::vector& ntrks_highpT); - - PileupSummaryInfo(const int num_PU_vertices, - const std::vector& zpositions, - const std::vector& times, // may be empty - const std::vector& sumpT_lowpT, - const std::vector& sumpT_highpT, - const std::vector& ntrks_lowpT, - const std::vector& ntrks_highpT, - int bunchCrossing); - - PileupSummaryInfo(const int num_PU_vertices, - const std::vector& zpositions, - const std::vector& times, // may be empty - const std::vector& sumpT_lowpT, - const std::vector& sumpT_highpT, - const std::vector& ntrks_lowpT, - const std::vector& ntrks_highpT, - const std::vector& eventInfo, - const std::vector& pT_hats, - int bunchCrossing, - float TrueNumInteractions, - int bunchSpacing); - - PileupSummaryInfo(const int num_PU_vertices, - const std::vector& instLumi, - const std::vector& eventInfo); - - ~PileupSummaryInfo(); - - const int getPU_NumInteractions() const { return num_PU_vertices_; } - const std::vector& getPU_zpositions() const { return zpositions_; } - bool has_times() const { return !times_.empty(); } - const std::vector& getPU_times() const { return times_; } - const std::vector& getPU_sumpT_lowpT() const { return sumpT_lowpT_; } - const std::vector& getPU_sumpT_highpT() const { return sumpT_highpT_; } - const std::vector& getPU_ntrks_lowpT() const { return ntrks_lowpT_; } - const std::vector& getPU_ntrks_highpT() const { return ntrks_highpT_; } - const std::vector& getPU_instLumi() const { return instLumi_; } - const std::vector& getPU_EventID() const { return eventInfo_; } - const std::vector& getPU_pT_hats() const { return pT_hats_; } - const int getBunchCrossing() const { return bunchCrossing_; } - const int getBunchSpacing() const { return bunchSpacing_; } - const float getTrueNumInteractions() const { return TrueNumInteractions_; } - -private: - // for "standard" pileup: we have MC Truth information for these - - int num_PU_vertices_; - std::vector zpositions_; - std::vector times_; - std::vector sumpT_lowpT_; - std::vector sumpT_highpT_; - std::vector ntrks_lowpT_; - std::vector ntrks_highpT_; - std::vector eventInfo_; - std::vector pT_hats_; - int bunchCrossing_; - int bunchSpacing_; - float TrueNumInteractions_; - - // for DataMixer pileup, we only have raw information: - - std::vector instLumi_; -}; +namespace io_v1 { + + class PileupSummaryInfo { + public: + PileupSummaryInfo() {} + + PileupSummaryInfo(const int num_PU_vertices, + const std::vector& zpositions, + const std::vector& times, // may be empty + const std::vector& sumpT_lowpT, + const std::vector& sumpT_highpT, + const std::vector& ntrks_lowpT, + const std::vector& ntrks_highpT); + + PileupSummaryInfo(const int num_PU_vertices, + const std::vector& zpositions, + const std::vector& times, // may be empty + const std::vector& sumpT_lowpT, + const std::vector& sumpT_highpT, + const std::vector& ntrks_lowpT, + const std::vector& ntrks_highpT, + int bunchCrossing); + + PileupSummaryInfo(const int num_PU_vertices, + const std::vector& zpositions, + const std::vector& times, // may be empty + const std::vector& sumpT_lowpT, + const std::vector& sumpT_highpT, + const std::vector& ntrks_lowpT, + const std::vector& ntrks_highpT, + const std::vector& eventInfo, + const std::vector& pT_hats, + int bunchCrossing, + float TrueNumInteractions, + int bunchSpacing); + + PileupSummaryInfo(const int num_PU_vertices, + const std::vector& instLumi, + const std::vector& eventInfo); + + ~PileupSummaryInfo(); + + const int getPU_NumInteractions() const { return num_PU_vertices_; } + const std::vector& getPU_zpositions() const { return zpositions_; } + bool has_times() const { return !times_.empty(); } + const std::vector& getPU_times() const { return times_; } + const std::vector& getPU_sumpT_lowpT() const { return sumpT_lowpT_; } + const std::vector& getPU_sumpT_highpT() const { return sumpT_highpT_; } + const std::vector& getPU_ntrks_lowpT() const { return ntrks_lowpT_; } + const std::vector& getPU_ntrks_highpT() const { return ntrks_highpT_; } + const std::vector& getPU_instLumi() const { return instLumi_; } + const std::vector& getPU_EventID() const { return eventInfo_; } + const std::vector& getPU_pT_hats() const { return pT_hats_; } + const int getBunchCrossing() const { return bunchCrossing_; } + const int getBunchSpacing() const { return bunchSpacing_; } + const float getTrueNumInteractions() const { return TrueNumInteractions_; } + + private: + // for "standard" pileup: we have MC Truth information for these + + int num_PU_vertices_; + std::vector zpositions_; + std::vector times_; + std::vector sumpT_lowpT_; + std::vector sumpT_highpT_; + std::vector ntrks_lowpT_; + std::vector ntrks_highpT_; + std::vector eventInfo_; + std::vector pT_hats_; + int bunchCrossing_; + int bunchSpacing_; + float TrueNumInteractions_; + + // for DataMixer pileup, we only have raw information: + + std::vector instLumi_; + }; + +} // namespace io_v1 + +using PileupSummaryInfo = io_v1::PileupSummaryInfo; #endif diff --git a/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfoFwd.h b/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfoFwd.h index 002eb05dccc50..f90b457e8a3bf 100644 --- a/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfoFwd.h +++ b/SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfoFwd.h @@ -1,6 +1,10 @@ #ifndef SimDataFormats_PileupSummaryInfo_PileupSummaryInfoFwd_h #define SimDataFormats_PileupSummaryInfo_PileupSummaryInfoFwd_h -class PileupSummaryInfo; +namespace io_v1 { + class PileupSummaryInfo; +} // namespace io_v1 + +using PileupSummaryInfo = io_v1::PileupSummaryInfo; #endif diff --git a/SimDataFormats/PileupSummaryInfo/src/PileupSummaryInfo.cc b/SimDataFormats/PileupSummaryInfo/src/PileupSummaryInfo.cc index 4e9c6b8cd234d..138a6056b127e 100644 --- a/SimDataFormats/PileupSummaryInfo/src/PileupSummaryInfo.cc +++ b/SimDataFormats/PileupSummaryInfo/src/PileupSummaryInfo.cc @@ -12,66 +12,70 @@ #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" -PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, - const std::vector& zpositions, - const std::vector& times, - const std::vector& sumpT_lowpT, - const std::vector& sumpT_highpT, - const std::vector& ntrks_lowpT, - const std::vector& ntrks_highpT) - : num_PU_vertices_(num_PU_vertices), - zpositions_(zpositions), - times_(times), - sumpT_lowpT_(sumpT_lowpT), - sumpT_highpT_(sumpT_highpT), - ntrks_lowpT_(ntrks_lowpT), - ntrks_highpT_(ntrks_highpT) {} +namespace io_v1 { -PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, - const std::vector& zpositions, - const std::vector& times, - const std::vector& sumpT_lowpT, - const std::vector& sumpT_highpT, - const std::vector& ntrks_lowpT, - const std::vector& ntrks_highpT, - int bunchCrossing) - : num_PU_vertices_(num_PU_vertices), - zpositions_(zpositions), - times_(times), - sumpT_lowpT_(sumpT_lowpT), - sumpT_highpT_(sumpT_highpT), - ntrks_lowpT_(ntrks_lowpT), - ntrks_highpT_(ntrks_highpT), - bunchCrossing_(bunchCrossing) {} + PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, + const std::vector& zpositions, + const std::vector& times, + const std::vector& sumpT_lowpT, + const std::vector& sumpT_highpT, + const std::vector& ntrks_lowpT, + const std::vector& ntrks_highpT) + : num_PU_vertices_(num_PU_vertices), + zpositions_(zpositions), + times_(times), + sumpT_lowpT_(sumpT_lowpT), + sumpT_highpT_(sumpT_highpT), + ntrks_lowpT_(ntrks_lowpT), + ntrks_highpT_(ntrks_highpT) {} -PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, - const std::vector& zpositions, - const std::vector& times, - const std::vector& sumpT_lowpT, - const std::vector& sumpT_highpT, - const std::vector& ntrks_lowpT, - const std::vector& ntrks_highpT, - const std::vector& eventInfo, - const std::vector& pThats, - int bunchCrossing, - float TrueNumInteractions, - int bunchSpacing) - : num_PU_vertices_(num_PU_vertices), - zpositions_(zpositions), - times_(times), - sumpT_lowpT_(sumpT_lowpT), - sumpT_highpT_(sumpT_highpT), - ntrks_lowpT_(ntrks_lowpT), - ntrks_highpT_(ntrks_highpT), - eventInfo_(eventInfo), - pT_hats_(pThats), - bunchCrossing_(bunchCrossing), - bunchSpacing_(bunchSpacing), - TrueNumInteractions_(TrueNumInteractions) {} + PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, + const std::vector& zpositions, + const std::vector& times, + const std::vector& sumpT_lowpT, + const std::vector& sumpT_highpT, + const std::vector& ntrks_lowpT, + const std::vector& ntrks_highpT, + int bunchCrossing) + : num_PU_vertices_(num_PU_vertices), + zpositions_(zpositions), + times_(times), + sumpT_lowpT_(sumpT_lowpT), + sumpT_highpT_(sumpT_highpT), + ntrks_lowpT_(ntrks_lowpT), + ntrks_highpT_(ntrks_highpT), + bunchCrossing_(bunchCrossing) {} -PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, - const std::vector& instLumi, - const std::vector& eventInfo) - : num_PU_vertices_(num_PU_vertices), eventInfo_(eventInfo), instLumi_(instLumi) {} + PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, + const std::vector& zpositions, + const std::vector& times, + const std::vector& sumpT_lowpT, + const std::vector& sumpT_highpT, + const std::vector& ntrks_lowpT, + const std::vector& ntrks_highpT, + const std::vector& eventInfo, + const std::vector& pThats, + int bunchCrossing, + float TrueNumInteractions, + int bunchSpacing) + : num_PU_vertices_(num_PU_vertices), + zpositions_(zpositions), + times_(times), + sumpT_lowpT_(sumpT_lowpT), + sumpT_highpT_(sumpT_highpT), + ntrks_lowpT_(ntrks_lowpT), + ntrks_highpT_(ntrks_highpT), + eventInfo_(eventInfo), + pT_hats_(pThats), + bunchCrossing_(bunchCrossing), + bunchSpacing_(bunchSpacing), + TrueNumInteractions_(TrueNumInteractions) {} -PileupSummaryInfo::~PileupSummaryInfo() {} + PileupSummaryInfo::PileupSummaryInfo(const int num_PU_vertices, + const std::vector& instLumi, + const std::vector& eventInfo) + : num_PU_vertices_(num_PU_vertices), eventInfo_(eventInfo), instLumi_(instLumi) {} + + PileupSummaryInfo::~PileupSummaryInfo() {} + +} // namespace io_v1 diff --git a/SimDataFormats/PileupSummaryInfo/src/classes_def.xml b/SimDataFormats/PileupSummaryInfo/src/classes_def.xml index e56eb081875ea..dafac4f6f16d1 100644 --- a/SimDataFormats/PileupSummaryInfo/src/classes_def.xml +++ b/SimDataFormats/PileupSummaryInfo/src/classes_def.xml @@ -1,22 +1,18 @@ - - - - + + - - - - - - + + + + + - - - + + diff --git a/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h b/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h index a1f40f720736b..3863bff6192e0 100644 --- a/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h +++ b/SimDataFormats/RPCDigiSimLink/interface/RPCDigiSimLink.h @@ -6,59 +6,62 @@ #include "DataFormats/GeometryVector/interface/LocalVector.h" #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" -class RPCDigiSimLink { -public: - RPCDigiSimLink(std::pair digi, - Local3DPoint entryPoint, - LocalVector momentumAtEntry, - float timeOfFlight, - float energyLoss, - int particleType, - unsigned int detUnitId, - unsigned int trackId, - EncodedEventId eventId, - unsigned short processType) { - _entryPoint = entryPoint; - _momentumAtEntry = momentumAtEntry; - _timeOfFlight = timeOfFlight; - _energyLoss = energyLoss; - _particleType = particleType; - _detUnitId = detUnitId; - _trackId = trackId; - _eventId = eventId; - _processType = processType; - _digi = digi; - } +namespace io_v1 { + class RPCDigiSimLink { + public: + RPCDigiSimLink(std::pair digi, + Local3DPoint entryPoint, + LocalVector momentumAtEntry, + float timeOfFlight, + float energyLoss, + int particleType, + unsigned int detUnitId, + unsigned int trackId, + EncodedEventId eventId, + unsigned short processType) { + _entryPoint = entryPoint; + _momentumAtEntry = momentumAtEntry; + _timeOfFlight = timeOfFlight; + _energyLoss = energyLoss; + _particleType = particleType; + _detUnitId = detUnitId; + _trackId = trackId; + _eventId = eventId; + _processType = processType; + _digi = digi; + } - RPCDigiSimLink() { ; } + RPCDigiSimLink() { ; } - ~RPCDigiSimLink() { ; } + ~RPCDigiSimLink() { ; } - unsigned int getStrip() const { return _digi.first; } - unsigned int getBx() const { return _digi.second; } - Local3DPoint getEntryPoint() const { return _entryPoint; } - LocalVector getMomentumAtEntry() const { return _momentumAtEntry; } - float getTimeOfFlight() const { return _timeOfFlight; } - float getEnergyLoss() const { return _energyLoss; } - int getParticleType() const { return _particleType; } - unsigned int getDetUnitId() const { return _detUnitId; } - unsigned int getTrackId() const { return _trackId; } - EncodedEventId getEventId() const { return _eventId; } - unsigned short getProcessType() const { return _processType; } + unsigned int getStrip() const { return _digi.first; } + unsigned int getBx() const { return _digi.second; } + Local3DPoint getEntryPoint() const { return _entryPoint; } + LocalVector getMomentumAtEntry() const { return _momentumAtEntry; } + float getTimeOfFlight() const { return _timeOfFlight; } + float getEnergyLoss() const { return _energyLoss; } + int getParticleType() const { return _particleType; } + unsigned int getDetUnitId() const { return _detUnitId; } + unsigned int getTrackId() const { return _trackId; } + EncodedEventId getEventId() const { return _eventId; } + unsigned short getProcessType() const { return _processType; } - inline bool operator<(const RPCDigiSimLink& other) const { return getStrip() < other.getStrip(); } + inline bool operator<(const RPCDigiSimLink& other) const { return getStrip() < other.getStrip(); } -private: - std::pair _digi; + private: + std::pair _digi; - Local3DPoint _entryPoint; - LocalVector _momentumAtEntry; - float _timeOfFlight; - float _energyLoss; - int _particleType; - unsigned int _detUnitId; - unsigned int _trackId; - EncodedEventId _eventId; - unsigned short _processType; -}; + Local3DPoint _entryPoint; + LocalVector _momentumAtEntry; + float _timeOfFlight; + float _energyLoss; + int _particleType; + unsigned int _detUnitId; + unsigned int _trackId; + EncodedEventId _eventId; + unsigned short _processType; + }; +} // namespace io_v1 +using RPCDigiSimLink = io_v1::RPCDigiSimLink; #endif diff --git a/SimDataFormats/RPCDigiSimLink/src/classes_def.xml b/SimDataFormats/RPCDigiSimLink/src/classes_def.xml index d11b3f66a1229..f8bc89d951850 100644 --- a/SimDataFormats/RPCDigiSimLink/src/classes_def.xml +++ b/SimDataFormats/RPCDigiSimLink/src/classes_def.xml @@ -1,13 +1,13 @@ - - + + - - - - - - - + + + + + + + diff --git a/SimDataFormats/RandomEngine/src/classes_def.xml b/SimDataFormats/RandomEngine/src/classes_def.xml index 66e57a51f8e3b..7dae49d5ea9e9 100644 --- a/SimDataFormats/RandomEngine/src/classes_def.xml +++ b/SimDataFormats/RandomEngine/src/classes_def.xml @@ -2,10 +2,10 @@ - - + + - - + + diff --git a/SimDataFormats/Track/interface/SimTrack.h b/SimDataFormats/Track/interface/SimTrack.h index 196edf96a965e..f244be8627db9 100644 --- a/SimDataFormats/Track/interface/SimTrack.h +++ b/SimDataFormats/Track/interface/SimTrack.h @@ -8,88 +8,91 @@ #include -class SimTrack : public CoreSimTrack { -public: - typedef CoreSimTrack Core; - - /// constructor - SimTrack(); - SimTrack(int ipart, const math::XYZTLorentzVectorD& p); - - /// full constructor (pdg type, momentum, time, - /// index of parent vertex in final vector - /// index of corresponding gen part in final vector) - SimTrack(int ipart, const math::XYZTLorentzVectorD& p, int iv, int ig); - - SimTrack(int ipart, - const math::XYZTLorentzVectorD& p, - int iv, - int ig, - const math::XYZVectorD& tkp, - const math::XYZTLorentzVectorD& tkm); - - /// constructor from transient - SimTrack(const CoreSimTrack& t, int iv, int ig); - - /// index of the vertex in the Event container (-1 if no vertex) - int vertIndex() const { return ivert; } - bool noVertex() const { return ivert == -1; } - - /// index of the corresponding Generator particle in the Event container (-1 if no Genpart) - bool isPrimary() const { return (trackInfo_ >> 1) & 1; } - int genpartIndex() const { return isPrimary() ? igenpart : -1; } - bool noGenpart() const { return isPrimary() ? igenpart == -1 : true; } - - const math::XYZVectorD& trackerSurfacePosition() const { return tkposition; } - - const math::XYZTLorentzVectorD& trackerSurfaceMomentum() const { return tkmomentum; } - - inline void setTkPosition(const math::XYZVectorD& pos) { tkposition = pos; } - - inline void setTkMomentum(const math::XYZTLorentzVectorD& mom) { tkmomentum = mom; } - - inline void setVertexIndex(const int v) { ivert = v; } - - void setCrossedBoundaryVars(bool crossedBoundary, - int idAtBoundary, - math::XYZTLorentzVectorF positionAtBoundary, - math::XYZTLorentzVectorF momentumAtBoundary) { - if (crossedBoundary) - trackInfo_ |= (1 << 2); - idAtBoundary_ = idAtBoundary; - positionAtBoundary_ = positionAtBoundary; - momentumAtBoundary_ = momentumAtBoundary; - } - bool crossedBoundary() const { return (trackInfo_ >> 2) & 1; } - const math::XYZTLorentzVectorF& getPositionAtBoundary() const { return positionAtBoundary_; } - const math::XYZTLorentzVectorF& getMomentumAtBoundary() const { return momentumAtBoundary_; } - int getIDAtBoundary() const { return idAtBoundary_; } - - bool isFromBackScattering() const { return trackInfo_ & 1; } - void setFromBackScattering() { trackInfo_ |= 1; } - - void setIsPrimary() { trackInfo_ |= (1 << 1); } - void setGenParticleID(const int idx) { igenpart = idx; } - int getPrimaryOrLastStoredID() const { return igenpart; } - uint8_t getTrackInfo() const { return trackInfo_; } - -private: - int ivert; - int igenpart; - - math::XYZVectorD tkposition; - math::XYZTLorentzVectorD tkmomentum; - - int idAtBoundary_{-1}; - math::XYZTLorentzVectorF positionAtBoundary_; - math::XYZTLorentzVectorF momentumAtBoundary_; - uint8_t trackInfo_; - // explanation of trackInfo bits: - // 00000001 = simTrack is from backscattering - // 00000010 = simTrack is of a primary particle - // 00000100 = simTrack crossed the boundary -}; - -std::ostream& operator<<(std::ostream& o, const SimTrack& t); +namespace io_v1 { + class SimTrack : public CoreSimTrack { + public: + typedef CoreSimTrack Core; + + /// constructor + SimTrack(); + SimTrack(int ipart, const math::XYZTLorentzVectorD& p); + + /// full constructor (pdg type, momentum, time, + /// index of parent vertex in final vector + /// index of corresponding gen part in final vector) + SimTrack(int ipart, const math::XYZTLorentzVectorD& p, int iv, int ig); + + SimTrack(int ipart, + const math::XYZTLorentzVectorD& p, + int iv, + int ig, + const math::XYZVectorD& tkp, + const math::XYZTLorentzVectorD& tkm); + + /// constructor from transient + SimTrack(const CoreSimTrack& t, int iv, int ig); + + /// index of the vertex in the Event container (-1 if no vertex) + int vertIndex() const { return ivert; } + bool noVertex() const { return ivert == -1; } + + /// index of the corresponding Generator particle in the Event container (-1 if no Genpart) + bool isPrimary() const { return (trackInfo_ >> 1) & 1; } + int genpartIndex() const { return isPrimary() ? igenpart : -1; } + bool noGenpart() const { return isPrimary() ? igenpart == -1 : true; } + + const math::XYZVectorD& trackerSurfacePosition() const { return tkposition; } + + const math::XYZTLorentzVectorD& trackerSurfaceMomentum() const { return tkmomentum; } + + inline void setTkPosition(const math::XYZVectorD& pos) { tkposition = pos; } + + inline void setTkMomentum(const math::XYZTLorentzVectorD& mom) { tkmomentum = mom; } + + inline void setVertexIndex(const int v) { ivert = v; } + + void setCrossedBoundaryVars(bool crossedBoundary, + int idAtBoundary, + math::XYZTLorentzVectorF positionAtBoundary, + math::XYZTLorentzVectorF momentumAtBoundary) { + if (crossedBoundary) + trackInfo_ |= (1 << 2); + idAtBoundary_ = idAtBoundary; + positionAtBoundary_ = positionAtBoundary; + momentumAtBoundary_ = momentumAtBoundary; + } + bool crossedBoundary() const { return (trackInfo_ >> 2) & 1; } + const math::XYZTLorentzVectorF& getPositionAtBoundary() const { return positionAtBoundary_; } + const math::XYZTLorentzVectorF& getMomentumAtBoundary() const { return momentumAtBoundary_; } + int getIDAtBoundary() const { return idAtBoundary_; } + + bool isFromBackScattering() const { return trackInfo_ & 1; } + void setFromBackScattering() { trackInfo_ |= 1; } + + void setIsPrimary() { trackInfo_ |= (1 << 1); } + void setGenParticleID(const int idx) { igenpart = idx; } + int getPrimaryOrLastStoredID() const { return igenpart; } + uint8_t getTrackInfo() const { return trackInfo_; } + + private: + int ivert; + int igenpart; + + math::XYZVectorD tkposition; + math::XYZTLorentzVectorD tkmomentum; + + int idAtBoundary_{-1}; + math::XYZTLorentzVectorF positionAtBoundary_; + math::XYZTLorentzVectorF momentumAtBoundary_; + uint8_t trackInfo_; + // explanation of trackInfo bits: + // 00000001 = simTrack is from backscattering + // 00000010 = simTrack is of a primary particle + // 00000100 = simTrack crossed the boundary + }; + + std::ostream& operator<<(std::ostream& o, const SimTrack& t); +} // namespace io_v1 +using SimTrack = io_v1::SimTrack; #endif diff --git a/SimDataFormats/Track/interface/SimTrackFwd.h b/SimDataFormats/Track/interface/SimTrackFwd.h index fff74696de657..fc9bec3ee0ff8 100644 --- a/SimDataFormats/Track/interface/SimTrackFwd.h +++ b/SimDataFormats/Track/interface/SimTrackFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_Track_SimTrackFwd_h #define SimDataFormats_Track_SimTrackFwd_h -class SimTrack; +namespace io_v1 { + class SimTrack; +} // namespace io_v1 +using SimTrack = io_v1::SimTrack; #endif diff --git a/SimDataFormats/Track/src/SimTrack.cc b/SimDataFormats/Track/src/SimTrack.cc index 6126d4d6fc6b0..9ea3ecfe1ea25 100644 --- a/SimDataFormats/Track/src/SimTrack.cc +++ b/SimDataFormats/Track/src/SimTrack.cc @@ -1,23 +1,25 @@ #include "SimDataFormats/Track/interface/SimTrack.h" -SimTrack::SimTrack() : ivert(-1), igenpart(-1), trackInfo_(0) {} +namespace io_v1 { + SimTrack::SimTrack() : ivert(-1), igenpart(-1), trackInfo_(0) {} -SimTrack::SimTrack(int ipart, const math::XYZTLorentzVectorD& p) - : Core(ipart, p), ivert(-1), igenpart(-1), trackInfo_(0) {} + SimTrack::SimTrack(int ipart, const math::XYZTLorentzVectorD& p) + : Core(ipart, p), ivert(-1), igenpart(-1), trackInfo_(0) {} -SimTrack::SimTrack(int ipart, const math::XYZTLorentzVectorD& p, int iv, int ig) - : Core(ipart, p), ivert(iv), igenpart(ig), trackInfo_(0) {} + SimTrack::SimTrack(int ipart, const math::XYZTLorentzVectorD& p, int iv, int ig) + : Core(ipart, p), ivert(iv), igenpart(ig), trackInfo_(0) {} -SimTrack::SimTrack(int ipart, - const math::XYZTLorentzVectorD& p, - int iv, - int ig, - const math::XYZVectorD& tkp, - const math::XYZTLorentzVectorD& tkm) - : Core(ipart, p), ivert(iv), igenpart(ig), tkposition(tkp), tkmomentum(tkm), trackInfo_(0) {} + SimTrack::SimTrack(int ipart, + const math::XYZTLorentzVectorD& p, + int iv, + int ig, + const math::XYZVectorD& tkp, + const math::XYZTLorentzVectorD& tkm) + : Core(ipart, p), ivert(iv), igenpart(ig), tkposition(tkp), tkmomentum(tkm), trackInfo_(0) {} -SimTrack::SimTrack(const CoreSimTrack& t, int iv, int ig) : Core(t), ivert(iv), igenpart(ig), trackInfo_(0) {} + SimTrack::SimTrack(const CoreSimTrack& t, int iv, int ig) : Core(t), ivert(iv), igenpart(ig), trackInfo_(0) {} -std::ostream& operator<<(std::ostream& o, const SimTrack& t) { - return o << (SimTrack::Core)(t) << ", " << t.vertIndex() << ", " << t.genpartIndex(); -} + std::ostream& operator<<(std::ostream& o, const SimTrack& t) { + return o << (SimTrack::Core)(t) << ", " << t.vertIndex() << ", " << t.genpartIndex(); + } +} // namespace io_v1 diff --git a/SimDataFormats/Track/src/classes_def.xml b/SimDataFormats/Track/src/classes_def.xml index ef89f520c5484..6cd284c021b14 100644 --- a/SimDataFormats/Track/src/classes_def.xml +++ b/SimDataFormats/Track/src/classes_def.xml @@ -1,35 +1,14 @@ - - - - + + + + - - - - - - - setCrossedBoundaryVars(onfile.crossedBoundary_, onfile.idAtBoundary_, onfile.positionAtBoundary_, onfile.momentumAtBoundary_); - // set isPrimary info of trackInfo_ - if (onfile.igenpart != -1) - newObj->setIsPrimary(); - // it's not possible to set the isFromBackScattering info for old simTracks - ]]> - - - setIsPrimary(); - // it's not possible to set the isFromBackScattering and crossedBoundary info for old simTracks - ]]> - + + - - - - + + + + diff --git a/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h b/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h index 41335b321d303..99f41a2b91f9d 100644 --- a/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h +++ b/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h @@ -4,48 +4,51 @@ #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" #include -//typedef std::pair PixelDigiSimLink; -class PixelDigiSimLink { -public: - enum { LowTof, HighTof }; +namespace io_v1 { + //typedef std::pair PixelDigiSimLink; + class PixelDigiSimLink { + public: + enum { LowTof, HighTof }; - PixelDigiSimLink( - unsigned int ch, unsigned int tkId, unsigned int counter, unsigned int tofBin, EncodedEventId e, float a) { - chan = ch; - simTkId = tkId; - CFpos = tofBin == LowTof ? counter & 0x7FFFFFFF : (counter & 0x7FFFFFFF) | 0x80000000; - fract = a; - eId = e; - }; - PixelDigiSimLink(unsigned int ch, unsigned int tkId, EncodedEventId e, float a) { - chan = ch; - simTkId = tkId; - CFpos = 0; - fract = a; - eId = e; - }; - PixelDigiSimLink() : eId(0) { - chan = 0; - simTkId = 0; - CFpos = 0; - fract = 0; - }; - ~PixelDigiSimLink() {} - unsigned int channel() const { return chan; }; - unsigned int SimTrackId() const { return simTkId; }; - unsigned int CFposition() const { return CFpos & 0x7FFFFFFF; } - unsigned int TofBin() const { return (CFpos & 0x80000000) == 0 ? LowTof : HighTof; } - EncodedEventId eventId() const { return eId; } - float fraction() const { return fract; }; + PixelDigiSimLink( + unsigned int ch, unsigned int tkId, unsigned int counter, unsigned int tofBin, EncodedEventId e, float a) { + chan = ch; + simTkId = tkId; + CFpos = tofBin == LowTof ? counter & 0x7FFFFFFF : (counter & 0x7FFFFFFF) | 0x80000000; + fract = a; + eId = e; + }; + PixelDigiSimLink(unsigned int ch, unsigned int tkId, EncodedEventId e, float a) { + chan = ch; + simTkId = tkId; + CFpos = 0; + fract = a; + eId = e; + }; + PixelDigiSimLink() : eId(0) { + chan = 0; + simTkId = 0; + CFpos = 0; + fract = 0; + }; + ~PixelDigiSimLink() {} + unsigned int channel() const { return chan; }; + unsigned int SimTrackId() const { return simTkId; }; + unsigned int CFposition() const { return CFpos & 0x7FFFFFFF; } + unsigned int TofBin() const { return (CFpos & 0x80000000) == 0 ? LowTof : HighTof; } + EncodedEventId eventId() const { return eId; } + float fraction() const { return fract; }; - inline bool operator<(const PixelDigiSimLink& other) const { return fraction() < other.fraction(); } + inline bool operator<(const PixelDigiSimLink& other) const { return fraction() < other.fraction(); } -private: - unsigned int chan; - unsigned int simTkId; - uint32_t CFpos; // position of the PSimHit in the CrossingFrame vector - // for the subdetector collection; bit 31 set if from the HighTof collection - EncodedEventId eId; - float fract; -}; + private: + unsigned int chan; + unsigned int simTkId; + uint32_t CFpos; // position of the PSimHit in the CrossingFrame vector + // for the subdetector collection; bit 31 set if from the HighTof collection + EncodedEventId eId; + float fract; + }; +} // namespace io_v1 +using PixelDigiSimLink = io_v1::PixelDigiSimLink; #endif diff --git a/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkFwd.h b/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkFwd.h index 14c2955ebedf3..8efa65bc8321f 100644 --- a/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkFwd.h +++ b/SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLinkFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_TrackerDigiSimLink_PixelDigiSimLinkFwd_h #define SimDataFormats_TrackerDigiSimLink_PixelDigiSimLinkFwd_h -class PixelDigiSimLink; +namespace io_v1 { + class PixelDigiSimLink; +} +using PixelDigiSimLink = io_v1::PixelDigiSimLink; #endif diff --git a/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h b/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h index 89de09cdb9318..0e8196f9df849 100644 --- a/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h +++ b/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h @@ -4,49 +4,52 @@ #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" #include -class StripDigiSimLink { -public: - enum { LowTof, HighTof }; - - StripDigiSimLink( - unsigned int ch, unsigned int tkId, unsigned int counter, unsigned int tofBin, EncodedEventId e, float a) - : chan(ch), - simTkId(tkId), - CFpos(tofBin == LowTof ? counter & 0x7FFFFFFF : (counter & 0x7FFFFFFF) | 0x80000000), - eId(e), - fract(a) { - ; - } - - StripDigiSimLink(unsigned int ch, unsigned int tkId, unsigned int counter, EncodedEventId e, float a) - : chan(ch), simTkId(tkId), CFpos(counter & 0x7FFFFFFF), eId(e), fract(a) { - ; - } - - StripDigiSimLink(unsigned int ch, unsigned int tkId, EncodedEventId e, float a) - : chan(ch), simTkId(tkId), CFpos(0), eId(e), fract(a) { - ; - } - - StripDigiSimLink() : chan(0), simTkId(0), CFpos(0), eId(0), fract(0) { ; } - - ~StripDigiSimLink() { ; } - - unsigned int channel() const { return chan; } - unsigned int SimTrackId() const { return simTkId; } - unsigned int CFposition() const { return CFpos & 0x7FFFFFFF; } - unsigned int TofBin() const { return (CFpos & 0x80000000) == 0 ? LowTof : HighTof; } - EncodedEventId eventId() const { return eId; } - float fraction() const { return fract; } - - inline bool operator<(const StripDigiSimLink& other) const { return channel() < other.channel(); } - -private: - unsigned int chan; - unsigned int simTkId; - uint32_t CFpos; // position of the PSimHit in the CrossingFrame vector - // for the subdetector collection; bit 31 set if from the HighTof collection - EncodedEventId eId; - float fract; -}; +namespace io_v1 { + class StripDigiSimLink { + public: + enum { LowTof, HighTof }; + + StripDigiSimLink( + unsigned int ch, unsigned int tkId, unsigned int counter, unsigned int tofBin, EncodedEventId e, float a) + : chan(ch), + simTkId(tkId), + CFpos(tofBin == LowTof ? counter & 0x7FFFFFFF : (counter & 0x7FFFFFFF) | 0x80000000), + eId(e), + fract(a) { + ; + } + + StripDigiSimLink(unsigned int ch, unsigned int tkId, unsigned int counter, EncodedEventId e, float a) + : chan(ch), simTkId(tkId), CFpos(counter & 0x7FFFFFFF), eId(e), fract(a) { + ; + } + + StripDigiSimLink(unsigned int ch, unsigned int tkId, EncodedEventId e, float a) + : chan(ch), simTkId(tkId), CFpos(0), eId(e), fract(a) { + ; + } + + StripDigiSimLink() : chan(0), simTkId(0), CFpos(0), eId(0), fract(0) { ; } + + ~StripDigiSimLink() { ; } + + unsigned int channel() const { return chan; } + unsigned int SimTrackId() const { return simTkId; } + unsigned int CFposition() const { return CFpos & 0x7FFFFFFF; } + unsigned int TofBin() const { return (CFpos & 0x80000000) == 0 ? LowTof : HighTof; } + EncodedEventId eventId() const { return eId; } + float fraction() const { return fract; } + + inline bool operator<(const StripDigiSimLink& other) const { return channel() < other.channel(); } + + private: + unsigned int chan; + unsigned int simTkId; + uint32_t CFpos; // position of the PSimHit in the CrossingFrame vector + // for the subdetector collection; bit 31 set if from the HighTof collection + EncodedEventId eId; + float fract; + }; +} // namespace io_v1 +using StripDigiSimLink = io_v1::StripDigiSimLink; #endif diff --git a/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkFwd.h b/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkFwd.h index 831b211e01e44..0a9747b60f30d 100644 --- a/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkFwd.h +++ b/SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLinkFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_TrackerDigiSimLink_StripDigiSimLinkFwd_h #define SimDataFormats_TrackerDigiSimLink_StripDigiSimLinkFwd_h -class StripDigiSimLink; +namespace io_v1 { + class StripDigiSimLink; +} +using StripDigiSimLink = io_v1::StripDigiSimLink; #endif diff --git a/SimDataFormats/TrackerDigiSimLink/src/classes_def.xml b/SimDataFormats/TrackerDigiSimLink/src/classes_def.xml index a828c2065380a..7171fc3ad01a4 100644 --- a/SimDataFormats/TrackerDigiSimLink/src/classes_def.xml +++ b/SimDataFormats/TrackerDigiSimLink/src/classes_def.xml @@ -1,28 +1,26 @@ - - - + + - - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + diff --git a/SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h b/SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h index 663db38564213..b698505b7a63f 100644 --- a/SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h +++ b/SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h @@ -2,11 +2,11 @@ #define SimDataFormats_TrackingParticle_h #include -#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h" #include "DataFormats/Math/interface/Point3D.h" #include "DataFormats/Math/interface/Vector3D.h" #include "DataFormats/Math/interface/LorentzVector.h" #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h" #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexFwd.h" #include "SimDataFormats/Track/interface/SimTrackFwd.h" @@ -22,226 +22,229 @@ * some tweaking and documentation by Mark Grimes (mark.grimes@bristol.ac.uk). * @date original date unknown, re-engineering Jan-May 2013 */ -class TrackingParticle { - friend std::ostream& operator<<(std::ostream& s, TrackingParticle const& tp); - -public: - typedef int Charge; ///< electric charge type - typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector - typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; ///< Lorentz vector - typedef math::XYZPointD Point; ///< point in the space - typedef math::XYZVectorD Vector; ///< point in the space - - /// reference to reco::GenParticle - typedef reco::GenParticleRefVector::iterator genp_iterator; - typedef std::vector::const_iterator g4t_iterator; - - /** @brief Default constructor. Note that the object will be useless until it is provided +namespace io_v1 { + class TrackingParticle { + friend std::ostream& operator<<(std::ostream& s, TrackingParticle const& tp); + + public: + typedef int Charge; ///< electric charge type + typedef math::XYZTLorentzVectorD LorentzVector; ///< Lorentz vector + typedef math::PtEtaPhiMLorentzVector PolarLorentzVector; ///< Lorentz vector + typedef math::XYZPointD Point; ///< point in the space + typedef math::XYZVectorD Vector; ///< point in the space + + /// reference to reco::GenParticle + typedef reco::GenParticleRefVector::iterator genp_iterator; + typedef std::vector::const_iterator g4t_iterator; + + /** @brief Default constructor. Note that the object will be useless until it is provided * with a SimTrack and parent TrackingVertex. * * Most of the methods assume there is a SimTrack and parent TrackingVertex set, so will either * crash or give undefined results if this isn't true. This constructor should only be used to * create a placeholder until setParentVertex() and addG4Track() can be called. */ - TrackingParticle(); + TrackingParticle(); - TrackingParticle(const SimTrack& simtrk, const TrackingVertexRef& parentVertex); + TrackingParticle(const SimTrack& simtrk, const TrackingVertexRef& parentVertex); - // destructor - ~TrackingParticle(); + // destructor + ~TrackingParticle(); - /** @brief PDG ID. + /** @brief PDG ID. * * Returns the PDG ID of the first associated gen particle. If there are no gen particles associated * then it returns type() from the first SimTrack. */ - int pdgId() const { - if (genParticles_.empty()) - return g4Tracks_[0].type(); - else - return (*genParticles_.begin())->pdgId(); - } - - /** @brief Signal source, crossing number. + int pdgId() const { + if (genParticles_.empty()) + return g4Tracks_[0].type(); + else + return (*genParticles_.begin())->pdgId(); + } + + /** @brief Signal source, crossing number. * * Note this is taken from the first SimTrack only, but there shouldn't be any SimTracks from different * crossings in the TrackingParticle. */ - EncodedEventId eventId() const { return g4Tracks_[0].eventId(); } + EncodedEventId eventId() const { return g4Tracks_[0].eventId(); } - // Setters for G4 and reco::GenParticle - void addGenParticle(const reco::GenParticleRef& ref); - void addG4Track(const SimTrack& t); - /// iterators - genp_iterator genParticle_begin() const; - genp_iterator genParticle_end() const; - g4t_iterator g4Track_begin() const; - g4t_iterator g4Track_end() const; - void setParentVertex(const TrackingVertexRef& ref); - void addDecayVertex(const TrackingVertexRef& ref); - void clearParentVertex(); - void clearDecayVertices(); + // Setters for G4 and reco::GenParticle + void addGenParticle(const reco::GenParticleRef& ref); + void addG4Track(const SimTrack& t); + /// iterators + genp_iterator genParticle_begin() const; + genp_iterator genParticle_end() const; + g4t_iterator g4Track_begin() const; + g4t_iterator g4Track_end() const; + void setParentVertex(const TrackingVertexRef& ref); + void addDecayVertex(const TrackingVertexRef& ref); + void clearParentVertex(); + void clearDecayVertices(); - // Getters for Embd and Sim Tracks - const reco::GenParticleRefVector& genParticles() const { return genParticles_; } - const std::vector& g4Tracks() const { return g4Tracks_; } - const TrackingVertexRef& parentVertex() const { return parentVertex_; } + // Getters for Embd and Sim Tracks + const reco::GenParticleRefVector& genParticles() const { return genParticles_; } + const std::vector& g4Tracks() const { return g4Tracks_; } + const TrackingVertexRef& parentVertex() const { return parentVertex_; } - // Accessors for vector of decay vertices - const TrackingVertexRefVector& decayVertices() const { return decayVertices_; } - tv_iterator decayVertices_begin() const { return decayVertices_.begin(); } - tv_iterator decayVertices_end() const { return decayVertices_.end(); } + // Accessors for vector of decay vertices + const TrackingVertexRefVector& decayVertices() const { return decayVertices_; } + tv_iterator decayVertices_begin() const { return decayVertices_.begin(); } + tv_iterator decayVertices_end() const { return decayVertices_.end(); } - /// @brief Electric charge. Note this is taken from the first SimTrack only. - float charge() const { return g4Tracks_[0].charge(); } - /// Gives charge in unit of quark charge (should be 3 times "charge()") - int threeCharge() const { return lrintf(3.f * charge()); } + /// @brief Electric charge. Note this is taken from the first SimTrack only. + float charge() const { return g4Tracks_[0].charge(); } + /// Gives charge in unit of quark charge (should be 3 times "charge()") + int threeCharge() const { return lrintf(3.f * charge()); } - /// @brief Four-momentum Lorentz vector. Note this is taken from the first SimTrack only. - const LorentzVector& p4() const { return g4Tracks_[0].momentum(); } + /// @brief Four-momentum Lorentz vector. Note this is taken from the first SimTrack only. + const LorentzVector& p4() const { return g4Tracks_[0].momentum(); } - /// @brief spatial momentum vector - Vector momentum() const { return p4().Vect(); } + /// @brief spatial momentum vector + Vector momentum() const { return p4().Vect(); } - /// @brief Vector to boost to the particle centre of mass frame. - Vector boostToCM() const { return p4().BoostToCM(); } + /// @brief Vector to boost to the particle centre of mass frame. + Vector boostToCM() const { return p4().BoostToCM(); } - /// @brief Magnitude of momentum vector. Note this is taken from the first SimTrack only. - double p() const { return p4().P(); } + /// @brief Magnitude of momentum vector. Note this is taken from the first SimTrack only. + double p() const { return p4().P(); } - /// @brief Quotient of the electric charge over the magnitude of the momentum vector. Note this is taken from the first SimTrack only. - double qoverp() const { return charge() / p(); } + /// @brief Quotient of the electric charge over the magnitude of the momentum vector. Note this is taken from the first SimTrack only. + double qoverp() const { return charge() / p(); } - /// @brief Energy. Note this is taken from the first SimTrack only. - double energy() const { return p4().E(); } + /// @brief Energy. Note this is taken from the first SimTrack only. + double energy() const { return p4().E(); } - /// @brief Transverse energy. Note this is taken from the first SimTrack only. - double et() const { return p4().Et(); } + /// @brief Transverse energy. Note this is taken from the first SimTrack only. + double et() const { return p4().Et(); } - /// @brief Mass. Note this is taken from the first SimTrack only. - double mass() const { return p4().M(); } + /// @brief Mass. Note this is taken from the first SimTrack only. + double mass() const { return p4().M(); } - /// @brief Mass squared. Note this is taken from the first SimTrack only. - double massSqr() const { return pow(mass(), 2); } + /// @brief Mass squared. Note this is taken from the first SimTrack only. + double massSqr() const { return pow(mass(), 2); } - /// @brief Transverse mass. Note this is taken from the first SimTrack only. - double mt() const { return p4().Mt(); } + /// @brief Transverse mass. Note this is taken from the first SimTrack only. + double mt() const { return p4().Mt(); } - /// @brief Transverse mass squared. Note this is taken from the first SimTrack only. - double mtSqr() const { return p4().Mt2(); } + /// @brief Transverse mass squared. Note this is taken from the first SimTrack only. + double mtSqr() const { return p4().Mt2(); } - /// @brief x coordinate of momentum vector. Note this is taken from the first SimTrack only. - double px() const { return p4().Px(); } + /// @brief x coordinate of momentum vector. Note this is taken from the first SimTrack only. + double px() const { return p4().Px(); } - /// @brief y coordinate of momentum vector. Note this is taken from the first SimTrack only. - double py() const { return p4().Py(); } + /// @brief y coordinate of momentum vector. Note this is taken from the first SimTrack only. + double py() const { return p4().Py(); } - /// @brief z coordinate of momentum vector. Note this is taken from the first SimTrack only. - double pz() const { return p4().Pz(); } + /// @brief z coordinate of momentum vector. Note this is taken from the first SimTrack only. + double pz() const { return p4().Pz(); } - /// @brief Transverse momentum. Note this is taken from the first SimTrack only. - double pt() const { return p4().Pt(); } + /// @brief Transverse momentum. Note this is taken from the first SimTrack only. + double pt() const { return p4().Pt(); } - /// @brief Momentum azimuthal angle. Note this is taken from the first SimTrack only. - double phi() const { return p4().Phi(); } + /// @brief Momentum azimuthal angle. Note this is taken from the first SimTrack only. + double phi() const { return p4().Phi(); } - /// @brief Momentum polar angle. Note this is taken from the first SimTrack only. - double theta() const { return p4().Theta(); } + /// @brief Momentum polar angle. Note this is taken from the first SimTrack only. + double theta() const { return p4().Theta(); } - /// @brief Momentum pseudorapidity. Note this is taken from the first SimTrack only. - double eta() const { return p4().Eta(); } + /// @brief Momentum pseudorapidity. Note this is taken from the first SimTrack only. + double eta() const { return p4().Eta(); } - /// @brief Lambda angle. Note this is taken from the first SimTrack only. - double lambda() const { return M_PI_2 - theta(); } + /// @brief Lambda angle. Note this is taken from the first SimTrack only. + double lambda() const { return M_PI_2 - theta(); } - /// @brief tangent of the lambda angle. Note this is taken from the first SimTrack only. - double tanl() const { return tan(lambda()); } + /// @brief tangent of the lambda angle. Note this is taken from the first SimTrack only. + double tanl() const { return tan(lambda()); } - /// @brief Rapidity. Note this is taken from the first SimTrack only. - double rapidity() const { return p4().Rapidity(); } + /// @brief Rapidity. Note this is taken from the first SimTrack only. + double rapidity() const { return p4().Rapidity(); } - /// @brief Same as rapidity(). - double y() const { return rapidity(); } + /// @brief Same as rapidity(). + double y() const { return rapidity(); } - /// @brief Parent vertex position - Point vertex() const { - const TrackingVertex::LorentzVector& p = (*parentVertex_).position(); - return Point(p.x(), p.y(), p.z()); - } + /// @brief Parent vertex position + Point vertex() const { + const TrackingVertex::LorentzVector& p = (*parentVertex_).position(); + return Point(p.x(), p.y(), p.z()); + } - /// @brief x coordinate of parent vertex position - double vx() const { - const TrackingVertex& r = (*parentVertex_); - return r.position().X(); - } + /// @brief x coordinate of parent vertex position + double vx() const { + const TrackingVertex& r = (*parentVertex_); + return r.position().X(); + } - /// @brief y coordinate of parent vertex position - double vy() const { - const TrackingVertex& r = (*parentVertex_); - return r.position().Y(); - } + /// @brief y coordinate of parent vertex position + double vy() const { + const TrackingVertex& r = (*parentVertex_); + return r.position().Y(); + } - /// @brief z coordinate of parent vertex position - double vz() const { - const TrackingVertex& r = (*parentVertex_); - return r.position().Z(); - } + /// @brief z coordinate of parent vertex position + double vz() const { + const TrackingVertex& r = (*parentVertex_); + return r.position().Z(); + } - /// @brief dxy parameter. - double dxy() const { return (-vx() * py() + vy() * px()) / pt(); } + /// @brief dxy parameter. + double dxy() const { return (-vx() * py() + vy() * px()) / pt(); } - /// @brief dxy parameter in perigee convention (d0 = -dxy) - double d0() const { return -dxy(); } + /// @brief dxy parameter in perigee convention (d0 = -dxy) + double d0() const { return -dxy(); } - /// @brief dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to (0,0,0). - double dz() const { return vz() - (vx() * px() + vy() * py()) * pz() / p4().Perp2(); } + /// @brief dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to (0,0,0). + double dz() const { return vz() - (vx() * px() + vy() * py()) * pz() / p4().Perp2(); } - /// @brief z0 parameter - double z0() const { return dz(); } + /// @brief z0 parameter + double z0() const { return dz(); } - /** @brief Status word. + /** @brief Status word. * * Returns status() from the first gen particle, or -99 if there are no gen particles attached. */ - int status() const { return genParticles_.empty() ? -99 : (*genParticles_[0]).status(); } + int status() const { return genParticles_.empty() ? -99 : (*genParticles_[0]).status(); } - static const unsigned int longLivedTag; ///< long lived flag + static const unsigned int longLivedTag; ///< long lived flag - /// is long lived? - bool longLived() const { return status() & longLivedTag; } + /// is long lived? + bool longLived() const { return status() & longLivedTag; } - /** @brief Gives the total number of hits, including muon hits. Hits on overlaps in the same layer count separately. + /** @brief Gives the total number of hits, including muon hits. Hits on overlaps in the same layer count separately. * * Equivalent to trackPSimHit().size() in the old TrackingParticle implementation. */ - int numberOfHits() const { return numberOfHits_; } + int numberOfHits() const { return numberOfHits_; } - /** @brief The number of hits in the tracker. Hits on overlaps in the same layer count separately. + /** @brief The number of hits in the tracker. Hits on overlaps in the same layer count separately. * * Equivalent to trackPSimHit(DetId::Tracker).size() in the old TrackingParticle implementation. */ - int numberOfTrackerHits() const { return numberOfTrackerHits_; } + int numberOfTrackerHits() const { return numberOfTrackerHits_; } - /** @deprecated The number of hits in the tracker but taking account of overlaps. + /** @deprecated The number of hits in the tracker but taking account of overlaps. * Deprecated in favour of the more aptly named numberOfTrackerLayers(). */ - int matchedHit() const; + int matchedHit() const; - /** @brief The number of tracker layers with a hit. + /** @brief The number of tracker layers with a hit. * * Different from numberOfTrackerHits because this method counts multiple hits on overlaps in the layer as one hit. */ - int numberOfTrackerLayers() const { return numberOfTrackerLayers_; } - - void setNumberOfHits(int numberOfHits); - void setNumberOfTrackerHits(int numberOfTrackerHits); - void setNumberOfTrackerLayers(const int numberOfTrackerLayers); - -private: - int numberOfHits_; ///< @brief The total number of hits - int numberOfTrackerHits_; ///< @brief The number of tracker only hits - int numberOfTrackerLayers_; ///< @brief The number of tracker layers with hits. Equivalent to the old matchedHit. - - /// references to G4 and reco::GenParticle tracks - std::vector g4Tracks_; - reco::GenParticleRefVector genParticles_; - - // Source and decay vertices - TrackingVertexRef parentVertex_; - TrackingVertexRefVector decayVertices_; -}; + int numberOfTrackerLayers() const { return numberOfTrackerLayers_; } + + void setNumberOfHits(int numberOfHits); + void setNumberOfTrackerHits(int numberOfTrackerHits); + void setNumberOfTrackerLayers(const int numberOfTrackerLayers); + + private: + int numberOfHits_; ///< @brief The total number of hits + int numberOfTrackerHits_; ///< @brief The number of tracker only hits + int numberOfTrackerLayers_; ///< @brief The number of tracker layers with hits. Equivalent to the old matchedHit. + + /// references to G4 and reco::GenParticle tracks + std::vector g4Tracks_; + reco::GenParticleRefVector genParticles_; + + // Source and decay vertices + TrackingVertexRef parentVertex_; + TrackingVertexRefVector decayVertices_; + }; +} // namespace io_v1 +using TrackingParticle = io_v1::TrackingParticle; #endif // SimDataFormats_TrackingParticle_H diff --git a/SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h b/SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h index bc07ab731e5b6..08ae7f967eb6a 100644 --- a/SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h +++ b/SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h @@ -6,8 +6,11 @@ #include "DataFormats/Common/interface/RefVector.h" #include "DataFormats/Common/interface/RefProd.h" -class TrackingParticle; -std::ostream& operator<<(std::ostream& s, TrackingParticle const& tp); +namespace io_v1 { + class TrackingParticle; + std::ostream& operator<<(std::ostream& s, TrackingParticle const& tp); +} // namespace io_v1 +using TrackingParticle = io_v1::TrackingParticle; typedef std::vector TrackingParticleCollection; typedef edm::Ptr TrackingParticlePtr; diff --git a/SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h b/SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h index b36b665ee68cd..2490ad5ba5e51 100644 --- a/SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h +++ b/SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h @@ -19,70 +19,73 @@ #include "SimDataFormats/Track/interface/SimTrackContainer.h" #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" -class TrackingVertex { - friend std::ostream& operator<<(std::ostream& s, const TrackingVertex& tv); - -public: - typedef edm::RefVector GenVertexRefVector; - typedef edm::Ref GenVertexRef; - typedef math::XYZTLorentzVectorD LorentzVector; - typedef GenVertexRefVector::iterator genv_iterator; - typedef std::vector::const_iterator g4v_iterator; - typedef TrackingParticleRefVector::iterator tp_iterator; - - // Default constructor and constructor from values - TrackingVertex(); - TrackingVertex(const LorentzVector& position, const bool inVolume, const EncodedEventId e = EncodedEventId(0)); - - // Setters - void setEventId(EncodedEventId e) { eId_ = e; }; - - // Track and vertex iterators - genv_iterator genVertices_begin() const; // Ref's to HepMC and Geant4 - genv_iterator genVertices_end() const; // vertices associated with - g4v_iterator g4Vertices_begin() const; // this vertex, respectively - g4v_iterator g4Vertices_end() const; // .... - - tp_iterator daughterTracks_begin() const; // Ref's to daughter and source - tp_iterator daughterTracks_end() const; // tracks associated with - tp_iterator sourceTracks_begin() const; // this vertex, respectively - tp_iterator sourceTracks_end() const; // .... - - unsigned int nG4Vertices() const { return g4Vertices_.size(); }; - unsigned int nGenVertices() const { return genVertices_.size(); }; - unsigned int nDaughterTracks() const { return daughterTracks_.size(); }; - unsigned int nSourceTracks() const { return sourceTracks_.size(); }; - - // Add references to TrackingParticles, Geant4, and HepMC vertices to containers - void addG4Vertex(const SimVertex&); - void addGenVertex(const GenVertexRef&); - void addDaughterTrack(const TrackingParticleRef&); - void addParentTrack(const TrackingParticleRef&); - void clearDaughterTracks(); - void clearParentTracks(); - - // Getters for RefVectors - const std::vector& g4Vertices() const; - const GenVertexRefVector& genVertices() const; - const TrackingParticleRefVector& sourceTracks() const; - const TrackingParticleRefVector& daughterTracks() const; - - // Getters for other info - const LorentzVector& position() const { return position_; }; - const EncodedEventId& eventId() const { return eId_; }; - const bool inVolume() const { return inVolume_; }; - -private: - LorentzVector position_; // Vertex position and time - bool inVolume_; // Is it inside tracker volume? - EncodedEventId eId_; - - // References to G4 and generator vertices and TrackingParticles - - std::vector g4Vertices_; - GenVertexRefVector genVertices_; - TrackingParticleRefVector daughterTracks_; - TrackingParticleRefVector sourceTracks_; -}; +namespace io_v1 { + class TrackingVertex { + friend std::ostream& operator<<(std::ostream& s, const TrackingVertex& tv); + + public: + typedef edm::RefVector GenVertexRefVector; + typedef edm::Ref GenVertexRef; + typedef math::XYZTLorentzVectorD LorentzVector; + typedef GenVertexRefVector::iterator genv_iterator; + typedef std::vector::const_iterator g4v_iterator; + typedef TrackingParticleRefVector::iterator tp_iterator; + + // Default constructor and constructor from values + TrackingVertex(); + TrackingVertex(const LorentzVector& position, const bool inVolume, const EncodedEventId e = EncodedEventId(0)); + + // Setters + void setEventId(EncodedEventId e) { eId_ = e; }; + + // Track and vertex iterators + genv_iterator genVertices_begin() const; // Ref's to HepMC and Geant4 + genv_iterator genVertices_end() const; // vertices associated with + g4v_iterator g4Vertices_begin() const; // this vertex, respectively + g4v_iterator g4Vertices_end() const; // .... + + tp_iterator daughterTracks_begin() const; // Ref's to daughter and source + tp_iterator daughterTracks_end() const; // tracks associated with + tp_iterator sourceTracks_begin() const; // this vertex, respectively + tp_iterator sourceTracks_end() const; // .... + + unsigned int nG4Vertices() const { return g4Vertices_.size(); }; + unsigned int nGenVertices() const { return genVertices_.size(); }; + unsigned int nDaughterTracks() const { return daughterTracks_.size(); }; + unsigned int nSourceTracks() const { return sourceTracks_.size(); }; + + // Add references to TrackingParticles, Geant4, and HepMC vertices to containers + void addG4Vertex(const SimVertex&); + void addGenVertex(const GenVertexRef&); + void addDaughterTrack(const TrackingParticleRef&); + void addParentTrack(const TrackingParticleRef&); + void clearDaughterTracks(); + void clearParentTracks(); + + // Getters for RefVectors + const std::vector& g4Vertices() const; + const GenVertexRefVector& genVertices() const; + const TrackingParticleRefVector& sourceTracks() const; + const TrackingParticleRefVector& daughterTracks() const; + + // Getters for other info + const LorentzVector& position() const { return position_; }; + const EncodedEventId& eventId() const { return eId_; }; + const bool inVolume() const { return inVolume_; }; + + private: + LorentzVector position_; // Vertex position and time + bool inVolume_; // Is it inside tracker volume? + EncodedEventId eId_; + + // References to G4 and generator vertices and TrackingParticles + + std::vector g4Vertices_; + GenVertexRefVector genVertices_; + TrackingParticleRefVector daughterTracks_; + TrackingParticleRefVector sourceTracks_; + }; +} // namespace io_v1 +using TrackingVertex = io_v1::TrackingVertex; #endif diff --git a/SimDataFormats/TrackingAnalysis/interface/TrackingVertexFwd.h b/SimDataFormats/TrackingAnalysis/interface/TrackingVertexFwd.h index b8c7c4fb84f89..659a32e5f63e4 100644 --- a/SimDataFormats/TrackingAnalysis/interface/TrackingVertexFwd.h +++ b/SimDataFormats/TrackingAnalysis/interface/TrackingVertexFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_TrackingAnalysis_TrackingVertexFwd_h #define SimDataFormats_TrackingAnalysis_TrackingVertexFwd_h -class TrackingVertex; +namespace io_v1 { + class TrackingVertex; +} // namespace io_v1 +using TrackingVertex = io_v1::TrackingVertex; #endif diff --git a/SimDataFormats/TrackingAnalysis/interface/UniqueSimTrackId.h b/SimDataFormats/TrackingAnalysis/interface/UniqueSimTrackId.h index 63b080e751d41..101fb3c6c50d7 100644 --- a/SimDataFormats/TrackingAnalysis/interface/UniqueSimTrackId.h +++ b/SimDataFormats/TrackingAnalysis/interface/UniqueSimTrackId.h @@ -14,8 +14,11 @@ struct UniqueSimTrackIdHash { } }; -struct SimTrackToTPMap { - std::unordered_map mapping; -}; +namespace io_v1 { + struct SimTrackToTPMap { + std::unordered_map mapping; + }; +} // namespace io_v1 +using SimTrackToTPMap = io_v1::SimTrackToTPMap; #endif diff --git a/SimDataFormats/TrackingAnalysis/src/TrackingParticle.cc b/SimDataFormats/TrackingAnalysis/src/TrackingParticle.cc index a6ef4b726fb50..d45b3da5f6634 100644 --- a/SimDataFormats/TrackingAnalysis/src/TrackingParticle.cc +++ b/SimDataFormats/TrackingAnalysis/src/TrackingParticle.cc @@ -5,75 +5,77 @@ #include -const unsigned int TrackingParticle::longLivedTag = 65536; +namespace io_v1 { + const unsigned int TrackingParticle::longLivedTag = 65536; -TrackingParticle::TrackingParticle() { - // No operation -} + TrackingParticle::TrackingParticle() { + // No operation + } -TrackingParticle::TrackingParticle(const SimTrack& simtrk, const TrackingVertexRef& parentVertex) { - addG4Track(simtrk); - setParentVertex(parentVertex); -} + TrackingParticle::TrackingParticle(const SimTrack& simtrk, const TrackingVertexRef& parentVertex) { + addG4Track(simtrk); + setParentVertex(parentVertex); + } -TrackingParticle::~TrackingParticle() {} + TrackingParticle::~TrackingParticle() {} -void TrackingParticle::addGenParticle(const reco::GenParticleRef& ref) { genParticles_.push_back(ref); } + void TrackingParticle::addGenParticle(const reco::GenParticleRef& ref) { genParticles_.push_back(ref); } -void TrackingParticle::addG4Track(const SimTrack& t) { g4Tracks_.push_back(t); } + void TrackingParticle::addG4Track(const SimTrack& t) { g4Tracks_.push_back(t); } -TrackingParticle::genp_iterator TrackingParticle::genParticle_begin() const { return genParticles_.begin(); } + TrackingParticle::genp_iterator TrackingParticle::genParticle_begin() const { return genParticles_.begin(); } -TrackingParticle::genp_iterator TrackingParticle::genParticle_end() const { return genParticles_.end(); } + TrackingParticle::genp_iterator TrackingParticle::genParticle_end() const { return genParticles_.end(); } -TrackingParticle::g4t_iterator TrackingParticle::g4Track_begin() const { return g4Tracks_.begin(); } + TrackingParticle::g4t_iterator TrackingParticle::g4Track_begin() const { return g4Tracks_.begin(); } -TrackingParticle::g4t_iterator TrackingParticle::g4Track_end() const { return g4Tracks_.end(); } + TrackingParticle::g4t_iterator TrackingParticle::g4Track_end() const { return g4Tracks_.end(); } -void TrackingParticle::setParentVertex(const TrackingVertexRef& ref) { parentVertex_ = ref; } + void TrackingParticle::setParentVertex(const TrackingVertexRef& ref) { parentVertex_ = ref; } -void TrackingParticle::addDecayVertex(const TrackingVertexRef& ref) { decayVertices_.push_back(ref); } + void TrackingParticle::addDecayVertex(const TrackingVertexRef& ref) { decayVertices_.push_back(ref); } -void TrackingParticle::clearParentVertex() { parentVertex_ = TrackingVertexRef(); } + void TrackingParticle::clearParentVertex() { parentVertex_ = TrackingVertexRef(); } -void TrackingParticle::clearDecayVertices() { decayVertices_.clear(); } + void TrackingParticle::clearDecayVertices() { decayVertices_.clear(); } -int TrackingParticle::matchedHit() const { - edm::LogWarning("TrackingParticle") - << "The method matchedHit() has been deprecated. Use numberOfTrackerLayers() instead."; - return numberOfTrackerLayers_; -} + int TrackingParticle::matchedHit() const { + edm::LogWarning("TrackingParticle") + << "The method matchedHit() has been deprecated. Use numberOfTrackerLayers() instead."; + return numberOfTrackerLayers_; + } -void TrackingParticle::setNumberOfHits(int numberOfHits) { numberOfHits_ = numberOfHits; } + void TrackingParticle::setNumberOfHits(int numberOfHits) { numberOfHits_ = numberOfHits; } -void TrackingParticle::setNumberOfTrackerHits(int numberOfTrackerHits) { numberOfTrackerHits_ = numberOfTrackerHits; } + void TrackingParticle::setNumberOfTrackerHits(int numberOfTrackerHits) { numberOfTrackerHits_ = numberOfTrackerHits; } -void TrackingParticle::setNumberOfTrackerLayers(const int numberOfTrackerLayers) { - numberOfTrackerLayers_ = numberOfTrackerLayers; -} + void TrackingParticle::setNumberOfTrackerLayers(const int numberOfTrackerLayers) { + numberOfTrackerLayers_ = numberOfTrackerLayers; + } -std::ostream& operator<<(std::ostream& s, TrackingParticle const& tp) { - s << "TP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " - << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; + std::ostream& operator<<(std::ostream& s, TrackingParticle const& tp) { + s << "TP momentum, q, ID, & Event #: " << tp.p4() << " " << tp.charge() << " " << tp.pdgId() << " " + << tp.eventId().bunchCrossing() << "." << tp.eventId().event() << std::endl; - for (TrackingParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { - s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; - } + for (TrackingParticle::genp_iterator hepT = tp.genParticle_begin(); hepT != tp.genParticle_end(); ++hepT) { + s << " HepMC Track Momentum " << (*hepT)->momentum().rho() << std::endl; + } - for (TrackingParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { - s << " Geant Track Momentum " << g4T->momentum() << std::endl; - s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; - if (g4T->type() != tp.pdgId()) { - s << " Mismatch b/t TrackingParticle and Geant types" << std::endl; + for (TrackingParticle::g4t_iterator g4T = tp.g4Track_begin(); g4T != tp.g4Track_end(); ++g4T) { + s << " Geant Track Momentum " << g4T->momentum() << std::endl; + s << " Geant Track ID & type " << g4T->trackId() << " " << g4T->type() << std::endl; + if (g4T->type() != tp.pdgId()) { + s << " Mismatch b/t TrackingParticle and Geant types" << std::endl; + } + } + // Loop over decay vertices + s << " TP Vertex " << tp.vertex() << std::endl; + s << " Source vertex: " << tp.parentVertex()->position() << std::endl; + s << " " << tp.decayVertices().size() << " Decay vertices" << std::endl; + for (tv_iterator iTV = tp.decayVertices_begin(); iTV != tp.decayVertices_end(); ++iTV) { + s << " Decay vertices: " << (**iTV).position() << std::endl; } - } - // Loop over decay vertices - s << " TP Vertex " << tp.vertex() << std::endl; - s << " Source vertex: " << tp.parentVertex()->position() << std::endl; - s << " " << tp.decayVertices().size() << " Decay vertices" << std::endl; - for (tv_iterator iTV = tp.decayVertices_begin(); iTV != tp.decayVertices_end(); ++iTV) { - s << " Decay vertices: " << (**iTV).position() << std::endl; - } - return s; -} + return s; + } +} // namespace io_v1 diff --git a/SimDataFormats/TrackingAnalysis/src/TrackingVertex.cc b/SimDataFormats/TrackingAnalysis/src/TrackingVertex.cc index d293a0b404714..cde4cbf37fff6 100644 --- a/SimDataFormats/TrackingAnalysis/src/TrackingVertex.cc +++ b/SimDataFormats/TrackingAnalysis/src/TrackingVertex.cc @@ -5,88 +5,90 @@ typedef edm::RefVector GenVertexRefVector; typedef edm::Ref GenVertexRef; -// Constructors +namespace io_v1 { + // Constructors -TrackingVertex::TrackingVertex() : position_(LorentzVector(0, 0, 0, 0)), eId_(0) { - // daughterTracks_.clear(); -} + TrackingVertex::TrackingVertex() : position_(LorentzVector(0, 0, 0, 0)), eId_(0) { + // daughterTracks_.clear(); + } -TrackingVertex::TrackingVertex(const LorentzVector& p, const bool inVolume, const EncodedEventId eId) - : position_(p), inVolume_(inVolume), eId_(eId) { - // daughterTracks_.clear(); -} + TrackingVertex::TrackingVertex(const LorentzVector& p, const bool inVolume, const EncodedEventId eId) + : position_(p), inVolume_(inVolume), eId_(eId) { + // daughterTracks_.clear(); + } -// Add a reference to vertex vectors + // Add a reference to vertex vectors -void TrackingVertex::addG4Vertex(const SimVertex& v) { g4Vertices_.push_back(v); } + void TrackingVertex::addG4Vertex(const SimVertex& v) { g4Vertices_.push_back(v); } -void TrackingVertex::addGenVertex(const GenVertexRef& ref) { genVertices_.push_back(ref); } + void TrackingVertex::addGenVertex(const GenVertexRef& ref) { genVertices_.push_back(ref); } -// Add a reference to track vectors + // Add a reference to track vectors -void TrackingVertex::addDaughterTrack(const TrackingParticleRef& ref) { daughterTracks_.push_back(ref); } + void TrackingVertex::addDaughterTrack(const TrackingParticleRef& ref) { daughterTracks_.push_back(ref); } -void TrackingVertex::addParentTrack(const TrackingParticleRef& ref) { sourceTracks_.push_back(ref); } + void TrackingVertex::addParentTrack(const TrackingParticleRef& ref) { sourceTracks_.push_back(ref); } -void TrackingVertex::clearDaughterTracks() { daughterTracks_.clear(); } + void TrackingVertex::clearDaughterTracks() { daughterTracks_.clear(); } -void TrackingVertex::clearParentTracks() { sourceTracks_.clear(); } + void TrackingVertex::clearParentTracks() { sourceTracks_.clear(); } -// Iterators over vertices and tracks + // Iterators over vertices and tracks -TrackingVertex::genv_iterator TrackingVertex::genVertices_begin() const { return genVertices_.begin(); } -TrackingVertex::genv_iterator TrackingVertex::genVertices_end() const { return genVertices_.end(); } -TrackingVertex::g4v_iterator TrackingVertex::g4Vertices_begin() const { return g4Vertices_.begin(); } -TrackingVertex::g4v_iterator TrackingVertex::g4Vertices_end() const { return g4Vertices_.end(); } + TrackingVertex::genv_iterator TrackingVertex::genVertices_begin() const { return genVertices_.begin(); } + TrackingVertex::genv_iterator TrackingVertex::genVertices_end() const { return genVertices_.end(); } + TrackingVertex::g4v_iterator TrackingVertex::g4Vertices_begin() const { return g4Vertices_.begin(); } + TrackingVertex::g4v_iterator TrackingVertex::g4Vertices_end() const { return g4Vertices_.end(); } -TrackingVertex::tp_iterator TrackingVertex::daughterTracks_begin() const { return daughterTracks_.begin(); } -TrackingVertex::tp_iterator TrackingVertex::daughterTracks_end() const { return daughterTracks_.end(); } -TrackingVertex::tp_iterator TrackingVertex::sourceTracks_begin() const { return sourceTracks_.begin(); } -TrackingVertex::tp_iterator TrackingVertex::sourceTracks_end() const { return sourceTracks_.end(); } + TrackingVertex::tp_iterator TrackingVertex::daughterTracks_begin() const { return daughterTracks_.begin(); } + TrackingVertex::tp_iterator TrackingVertex::daughterTracks_end() const { return daughterTracks_.end(); } + TrackingVertex::tp_iterator TrackingVertex::sourceTracks_begin() const { return sourceTracks_.begin(); } + TrackingVertex::tp_iterator TrackingVertex::sourceTracks_end() const { return sourceTracks_.end(); } -// Accessors for whole vectors + // Accessors for whole vectors -const std::vector& TrackingVertex::g4Vertices() const { return g4Vertices_; } -const GenVertexRefVector& TrackingVertex::genVertices() const { return genVertices_; } -const TrackingParticleRefVector& TrackingVertex::sourceTracks() const { return sourceTracks_; } -const TrackingParticleRefVector& TrackingVertex::daughterTracks() const { return daughterTracks_; } + const std::vector& TrackingVertex::g4Vertices() const { return g4Vertices_; } + const GenVertexRefVector& TrackingVertex::genVertices() const { return genVertices_; } + const TrackingParticleRefVector& TrackingVertex::sourceTracks() const { return sourceTracks_; } + const TrackingParticleRefVector& TrackingVertex::daughterTracks() const { return daughterTracks_; } -std::ostream& operator<<(std::ostream& s, const TrackingVertex& v) { - using std::endl; - typedef GenVertexRefVector::iterator genv_iterator; - typedef std::vector::const_iterator g4v_iterator; - typedef TrackingParticleRefVector::iterator tp_iterator; - typedef std::vector::const_iterator g4t_iterator; + std::ostream& operator<<(std::ostream& s, const TrackingVertex& v) { + using std::endl; + typedef GenVertexRefVector::iterator genv_iterator; + typedef std::vector::const_iterator g4v_iterator; + typedef TrackingParticleRefVector::iterator tp_iterator; + typedef std::vector::const_iterator g4t_iterator; - s << "Vertex Position & Event #" << v.position() << " " << v.eventId().bunchCrossing() << "." << v.eventId().event() - << endl; - s << " Associated with " << v.daughterTracks().size() << " tracks" << endl; - for (genv_iterator genV = v.genVertices_begin(); genV != v.genVertices_end(); ++genV) { - s << " HepMC vertex position " << (*(*genV)).position().x() << "," << (*(*genV)).position().y() - << (*(*genV)).position().z() << endl; - } + s << "Vertex Position & Event #" << v.position() << " " << v.eventId().bunchCrossing() << "." << v.eventId().event() + << endl; + s << " Associated with " << v.daughterTracks().size() << " tracks" << endl; + for (genv_iterator genV = v.genVertices_begin(); genV != v.genVertices_end(); ++genV) { + s << " HepMC vertex position " << (*(*genV)).position().x() << "," << (*(*genV)).position().y() + << (*(*genV)).position().z() << endl; + } - for (g4v_iterator g4V = v.g4Vertices_begin(); g4V != v.g4Vertices_end(); ++g4V) { - s << " Geant vertex position " << (*g4V).position() << endl; - // Probably empty all the time, currently - } + for (g4v_iterator g4V = v.g4Vertices_begin(); g4V != v.g4Vertices_end(); ++g4V) { + s << " Geant vertex position " << (*g4V).position() << endl; + // Probably empty all the time, currently + } - // Loop over daughter track(s) - for (tp_iterator iTP = v.daughterTracks_begin(); iTP != v.daughterTracks_end(); ++iTP) { - s << " Daughter starts: " << (*(*iTP)).vertex(); - for (g4t_iterator g4T = (*(*iTP)).g4Track_begin(); g4T != (*(*iTP)).g4Track_end(); ++g4T) { - s << " p " << g4T->momentum(); + // Loop over daughter track(s) + for (tp_iterator iTP = v.daughterTracks_begin(); iTP != v.daughterTracks_end(); ++iTP) { + s << " Daughter starts: " << (*(*iTP)).vertex(); + for (g4t_iterator g4T = (*(*iTP)).g4Track_begin(); g4T != (*(*iTP)).g4Track_end(); ++g4T) { + s << " p " << g4T->momentum(); + } + s << endl; } - s << endl; - } - // Loop over source track(s) (can be multiple since vertices are collapsed) - for (tp_iterator iTP = v.sourceTracks_begin(); iTP != v.sourceTracks_end(); ++iTP) { - s << " Source starts: " << (*(*iTP)).vertex(); - for (g4t_iterator g4T = (*iTP)->g4Track_begin(); g4T != (*iTP)->g4Track_end(); ++g4T) { - s << ", p " << g4T->momentum(); + // Loop over source track(s) (can be multiple since vertices are collapsed) + for (tp_iterator iTP = v.sourceTracks_begin(); iTP != v.sourceTracks_end(); ++iTP) { + s << " Source starts: " << (*(*iTP)).vertex(); + for (g4t_iterator g4T = (*iTP)->g4Track_begin(); g4T != (*iTP)->g4Track_end(); ++g4T) { + s << ", p " << g4T->momentum(); + } + s << endl; } - s << endl; + return s; } - return s; -} +} // namespace io_v1 diff --git a/SimDataFormats/TrackingAnalysis/src/classes_def.xml b/SimDataFormats/TrackingAnalysis/src/classes_def.xml index 2cd84cbfbcf60..df47b67aa8796 100644 --- a/SimDataFormats/TrackingAnalysis/src/classes_def.xml +++ b/SimDataFormats/TrackingAnalysis/src/classes_def.xml @@ -1,48 +1,47 @@ - - + + - - - - + + + + - + - - - + + - - - + + + - - + + - - - - + + + + - - + + - - + + - + - - + + - + diff --git a/SimDataFormats/TrackingHit/interface/PSimHit.h b/SimDataFormats/TrackingHit/interface/PSimHit.h index d92aa15ad5994..8994a5f9dbb59 100644 --- a/SimDataFormats/TrackingHit/interface/PSimHit.h +++ b/SimDataFormats/TrackingHit/interface/PSimHit.h @@ -12,73 +12,74 @@ class TrackingSlaveSD; // for friend declaration only * Suitable for tracking detectors. */ -class PSimHit { -public: - PSimHit() : theDetUnitId(0) {} - - PSimHit(const Local3DPoint& entry, - const Local3DPoint& exit, - float pabs, - float tof, - float eloss, - int particleType, - unsigned int detId, - unsigned int trackId, - float theta, - float phi, - unsigned short processType = 0) - : theEntryPoint(entry), - theSegment(exit - entry), - thePabs(pabs), - theEnergyLoss(eloss), - theThetaAtEntry(theta), - thePhiAtEntry(phi), - theTof(tof), - theParticleType(particleType), - theProcessType(processType), - theDetUnitId(detId), - theTrackId(trackId) {} - - /// Entry point in the local Det frame - Local3DPoint entryPoint() const { return theEntryPoint; } - - /// Exit point in the local Det frame - Local3DPoint exitPoint() const { return theEntryPoint + theSegment; } - - /** Local position in the Det frame. +namespace io_v1 { + class PSimHit { + public: + PSimHit() : theDetUnitId(0) {} + + PSimHit(const Local3DPoint& entry, + const Local3DPoint& exit, + float pabs, + float tof, + float eloss, + int particleType, + unsigned int detId, + unsigned int trackId, + float theta, + float phi, + unsigned short processType = 0) + : theEntryPoint(entry), + theSegment(exit - entry), + thePabs(pabs), + theEnergyLoss(eloss), + theThetaAtEntry(theta), + thePhiAtEntry(phi), + theTof(tof), + theParticleType(particleType), + theProcessType(processType), + theDetUnitId(detId), + theTrackId(trackId) {} + + /// Entry point in the local Det frame + Local3DPoint entryPoint() const { return theEntryPoint; } + + /// Exit point in the local Det frame + Local3DPoint exitPoint() const { return theEntryPoint + theSegment; } + + /** Local position in the Det frame. * Normally it is on the detection surface, but this is not * checked. It is computed as the middle point between entry and exit. */ - Local3DPoint localPosition() const { return theEntryPoint + 0.5 * theSegment; } + Local3DPoint localPosition() const { return theEntryPoint + 0.5 * theSegment; } - /// The momentum of the track that produced the hit, at entry point. - LocalVector momentumAtEntry() const { return LocalVector(thetaAtEntry(), phiAtEntry(), pabs()); } + /// The momentum of the track that produced the hit, at entry point. + LocalVector momentumAtEntry() const { return LocalVector(thetaAtEntry(), phiAtEntry(), pabs()); } - /// Obsolete. Same as momentumAtEntry().unit(), for backward compatibility. - LocalVector localDirection() const { return LocalVector(thetaAtEntry(), phiAtEntry(), 1.f); } + /// Obsolete. Same as momentumAtEntry().unit(), for backward compatibility. + LocalVector localDirection() const { return LocalVector(thetaAtEntry(), phiAtEntry(), 1.f); } - /// fast and more accurate access to momentumAtEntry().theta() - Geom::Theta thetaAtEntry() const { return Geom::Theta(theThetaAtEntry); } + /// fast and more accurate access to momentumAtEntry().theta() + Geom::Theta thetaAtEntry() const { return Geom::Theta(theThetaAtEntry); } - /// fast and more accurate access to momentumAtEntry().phi() - Geom::Phi phiAtEntry() const { return Geom::Phi(thePhiAtEntry); } + /// fast and more accurate access to momentumAtEntry().phi() + Geom::Phi phiAtEntry() const { return Geom::Phi(thePhiAtEntry); } - /// fast and more accurate access to momentumAtEntry().mag() - float pabs() const { return thePabs; } + /// fast and more accurate access to momentumAtEntry().mag() + float pabs() const { return thePabs; } - /** Time of flight in nanoseconds from the primary interaction + /** Time of flight in nanoseconds from the primary interaction * to the entry point. Always positive in a PSimHit, * but may become negative in a SimHit due to bunch assignment. */ - float timeOfFlight() const { return tof(); } + float timeOfFlight() const { return tof(); } - /// deprecated name for timeOfFlight() - float tof() const { return theTof; } + /// deprecated name for timeOfFlight() + float tof() const { return theTof; } - /// The energy deposit in the PSimHit, in ???. - float energyLoss() const { return theEnergyLoss; } + /// The energy deposit in the PSimHit, in ???. + float energyLoss() const { return theEnergyLoss; } - /** The particle type of the track that produced this hit, + /** The particle type of the track that produced this hit, * in standard PDG code. * NB: This differs from ORCA5 and earlier, where the code was Geant3. * The particle type of the hit may differ from the particle type of @@ -86,30 +87,30 @@ class PSimHit { * by a secondary track (e.g. a delta ray) originating from the * trackId() and not existing as a separate SimTrack. */ - int particleType() const { return theParticleType; } + int particleType() const { return theParticleType; } - /** The DetUnit identifier, to be interpreted in the context of the + /** The DetUnit identifier, to be interpreted in the context of the * detector system that produced the hit. E.g. in the Tracker * this is index used with DetUnitNumbering. * Currently the context is not deducible from the PSimHit and * must be known when the PSimHit is created/accessed. */ - unsigned int detUnitId() const { return theDetUnitId; } + unsigned int detUnitId() const { return theDetUnitId; } - /** The SimTrack ID of the "mother" track. This may be the actual + /** The SimTrack ID of the "mother" track. This may be the actual * charged track that produced the hit, or a "mother" of this * track, in case the track that produced the hit was not * saved as a SimTrack. * This ID must be interpreted in the context of the SimEvent * to which the PSimHit belongs. */ - unsigned int trackId() const { return theTrackId; } + unsigned int trackId() const { return theTrackId; } - EncodedEventId eventId() const { return theEventId; } + EncodedEventId eventId() const { return theEventId; } - void setEventId(EncodedEventId e) { theEventId = e; } + void setEventId(EncodedEventId e) { theEventId = e; } - /** The ID of the physics process that created the track that produced + /** The ID of the physics process that created the track that produced * the hit. This is useful for identifying hits from secondary interactions, * especially in the case when the track that produced the hit was not saved * as a SimTrack. @@ -118,41 +119,43 @@ class PSimHit { * not be the ID of any process. */ - // use 9 bits (up to 511) for process id, reserve the rest for hit production mechanism id - // 7 bits field available in PSimHit processType, i.e. up 127, to store processes - unsigned short processType() const { return theProcessType & kProcidMask; } + // use 9 bits (up to 511) for process id, reserve the rest for hit production mechanism id + // 7 bits field available in PSimHit processType, i.e. up 127, to store processes + unsigned short processType() const { return theProcessType & kProcidMask; } - unsigned short hitProdType() const { return (theProcessType >> kHitidShift) & kHitidMask; } - void setHitProdType(unsigned int hitId) { theProcessType |= hitId << kHitidShift; } + unsigned short hitProdType() const { return (theProcessType >> kHitidShift) & kHitidMask; } + void setHitProdType(unsigned int hitId) { theProcessType |= hitId << kHitidShift; } - void setTof(float tof) { theTof = tof; } + void setTof(float tof) { theTof = tof; } - static constexpr unsigned int kProcidMask = 0x1FF; - static constexpr unsigned int kHitidMask = 0x7F; - static constexpr unsigned int kHitidShift = 9; + static constexpr unsigned int kProcidMask = 0x1FF; + static constexpr unsigned int kHitidMask = 0x7F; + static constexpr unsigned int kHitidShift = 9; -protected: - // properties - Local3DPoint theEntryPoint; // position at entry - Local3DVector theSegment; // exitPos - entryPos - float thePabs; // momentum - float theEnergyLoss; // Energy loss - float theThetaAtEntry; - float thePhiAtEntry; + protected: + // properties + Local3DPoint theEntryPoint; // position at entry + Local3DVector theSegment; // exitPos - entryPos + float thePabs; // momentum + float theEnergyLoss; // Energy loss + float theThetaAtEntry; + float thePhiAtEntry; - float theTof; // Time Of Flight - int theParticleType; - unsigned short theProcessType; // ID of the process which created the track - // which created the PSimHit + float theTof; // Time Of Flight + int theParticleType; + unsigned short theProcessType; // ID of the process which created the track + // which created the PSimHit - // association - unsigned int theDetUnitId; - unsigned int theTrackId; - EncodedEventId theEventId; + // association + unsigned int theDetUnitId; + unsigned int theTrackId; + EncodedEventId theEventId; - friend class TrackingSlaveSD; -}; + friend class ::TrackingSlaveSD; + }; -std::ostream& operator<<(std::ostream& o, const PSimHit& hit); + std::ostream& operator<<(std::ostream& o, const PSimHit& hit); +} // namespace io_v1 +using PSimHit = io_v1::PSimHit; #endif // PSimHit_H diff --git a/SimDataFormats/TrackingHit/interface/PSimHitFwd.h b/SimDataFormats/TrackingHit/interface/PSimHitFwd.h index 5169552f70288..949e2c252f0ec 100644 --- a/SimDataFormats/TrackingHit/interface/PSimHitFwd.h +++ b/SimDataFormats/TrackingHit/interface/PSimHitFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_TrackingHit_PSimHitFwd_h #define SimDataFormats_TrackingHit_PSimHitFwd_h -class PSimHit; +namespace io_v1 { + class PSimHit; +} // namespace io_v1 +using PSimHit = io_v1::PSimHit; #endif diff --git a/SimDataFormats/TrackingHit/src/PSimHit.cc b/SimDataFormats/TrackingHit/src/PSimHit.cc index 24315d8ab30bb..30ae7533a03dc 100644 --- a/SimDataFormats/TrackingHit/src/PSimHit.cc +++ b/SimDataFormats/TrackingHit/src/PSimHit.cc @@ -1,6 +1,8 @@ #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include -std::ostream& operator<<(std::ostream& o, const PSimHit& hit) { - return o << hit.detUnitId() << " " << hit.entryPoint() << " " << hit.tof(); -} +namespace io_v1 { + std::ostream& operator<<(std::ostream& o, const PSimHit& hit) { + return o << hit.detUnitId() << " " << hit.entryPoint() << " " << hit.tof(); + } +} // namespace io_v1 diff --git a/SimDataFormats/TrackingHit/src/classes_def.xml b/SimDataFormats/TrackingHit/src/classes_def.xml index 9e96e858a4971..b30240226bae1 100644 --- a/SimDataFormats/TrackingHit/src/classes_def.xml +++ b/SimDataFormats/TrackingHit/src/classes_def.xml @@ -1,15 +1,14 @@ - - - + + - - - - - + + + + + - - + + diff --git a/SimDataFormats/ValidationFormats/src/classes_def.xml b/SimDataFormats/ValidationFormats/src/classes_def.xml index ddcc070f1f542..5e9756051545c 100644 --- a/SimDataFormats/ValidationFormats/src/classes_def.xml +++ b/SimDataFormats/ValidationFormats/src/classes_def.xml @@ -1,21 +1,21 @@ - - + + - - + + - - + + - - + + - - + + - - + + @@ -24,32 +24,32 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -61,29 +61,29 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -94,41 +94,41 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -137,17 +137,17 @@ - - + + - - + + - - + + - - + + @@ -156,27 +156,27 @@ - - + + - - + + - - + + - - + + diff --git a/SimDataFormats/Vertex/interface/SimVertex.h b/SimDataFormats/Vertex/interface/SimVertex.h index 02267652f73be..fe4c30ff5b45f 100644 --- a/SimDataFormats/Vertex/interface/SimVertex.h +++ b/SimDataFormats/Vertex/interface/SimVertex.h @@ -4,45 +4,48 @@ #include "SimDataFormats/Vertex/interface/CoreSimVertex.h" #include -class SimVertex : public CoreSimVertex { -public: - typedef CoreSimVertex Core; - /// constructor - SimVertex(); +namespace io_v1 { + class SimVertex : public CoreSimVertex { + public: + typedef CoreSimVertex Core; + /// constructor + SimVertex(); - /// constructor from transient - SimVertex(const CoreSimVertex& t, int it); + /// constructor from transient + SimVertex(const CoreSimVertex& t, int it); - SimVertex(const math::XYZVectorD& v, float tof); + SimVertex(const math::XYZVectorD& v, float tof); - /// full constructor (position, time, index of parent in final vector) - SimVertex(const math::XYZVectorD& v, float tof, int it); + /// full constructor (position, time, index of parent in final vector) + SimVertex(const math::XYZVectorD& v, float tof, int it); - /// constructor from transient - SimVertex(const CoreSimVertex& t, int it, unsigned int vId); + /// constructor from transient + SimVertex(const CoreSimVertex& t, int it, unsigned int vId); - SimVertex(const math::XYZVectorD& v, float tof, unsigned int vId); + SimVertex(const math::XYZVectorD& v, float tof, unsigned int vId); - /// full constructor (position, time, index of parent in final vector) - SimVertex(const math::XYZVectorD& v, float tof, int it, unsigned int vId); + /// full constructor (position, time, index of parent in final vector) + SimVertex(const math::XYZVectorD& v, float tof, int it, unsigned int vId); - /// G4 TrackId of the parent in the Event SimTrack container (-1 if no parent) - /// BE CAREFUL this is not a vector index - int parentIndex() const { return itrack; } - bool noParent() const { return itrack == -1; } + /// G4 TrackId of the parent in the Event SimTrack container (-1 if no parent) + /// BE CAREFUL this is not a vector index + int parentIndex() const { return itrack; } + bool noParent() const { return itrack == -1; } - void setVertexId(unsigned int n) { vtxId = n; } - unsigned int vertexId() const { return vtxId; } + void setVertexId(unsigned int n) { vtxId = n; } + unsigned int vertexId() const { return vtxId; } - void setProcessType(unsigned int ty) { procType = ty; } - unsigned int processType() const { return procType; } + void setProcessType(unsigned int ty) { procType = ty; } + unsigned int processType() const { return procType; } -private: - int itrack; - unsigned int vtxId; - unsigned int procType; -}; + private: + int itrack; + unsigned int vtxId; + unsigned int procType; + }; -std::ostream& operator<<(std::ostream& o, const SimVertex& v); + std::ostream& operator<<(std::ostream& o, const SimVertex& v); +} // namespace io_v1 +using SimVertex = io_v1::SimVertex; #endif diff --git a/SimDataFormats/Vertex/interface/SimVertexFwd.h b/SimDataFormats/Vertex/interface/SimVertexFwd.h index 5b4277f5ac411..e9eb2b42878b3 100644 --- a/SimDataFormats/Vertex/interface/SimVertexFwd.h +++ b/SimDataFormats/Vertex/interface/SimVertexFwd.h @@ -1,6 +1,9 @@ #ifndef SimDataFormats_Vertex_SimVertexFwd_h #define SimDataFormats_Vertex_SimVertexFwd_h -class SimVertex; +namespace io_v1 { + class SimVertex; +} // namespace io_v1 +using SimVertex = io_v1::SimVertex; #endif diff --git a/SimDataFormats/Vertex/src/SimVertex.cc b/SimDataFormats/Vertex/src/SimVertex.cc index 0814cb297b60a..c999196f6d5e1 100644 --- a/SimDataFormats/Vertex/src/SimVertex.cc +++ b/SimDataFormats/Vertex/src/SimVertex.cc @@ -1,21 +1,25 @@ #include "SimDataFormats/Vertex/interface/SimVertex.h" -SimVertex::SimVertex() : itrack(-1), vtxId(0), procType(0) {} +namespace io_v1 { + SimVertex::SimVertex() : itrack(-1), vtxId(0), procType(0) {} -SimVertex::SimVertex(const math::XYZVectorD& v, float tof) : Core(v, tof), itrack(-1), vtxId(0), procType(0) {} + SimVertex::SimVertex(const math::XYZVectorD& v, float tof) : Core(v, tof), itrack(-1), vtxId(0), procType(0) {} -SimVertex::SimVertex(const math::XYZVectorD& v, float tof, int it) : Core(v, tof), itrack(it), vtxId(0), procType(0) {} + SimVertex::SimVertex(const math::XYZVectorD& v, float tof, int it) + : Core(v, tof), itrack(it), vtxId(0), procType(0) {} -SimVertex::SimVertex(const CoreSimVertex& v, int it) : Core(v), itrack(it), vtxId(0), procType(0) {} + SimVertex::SimVertex(const CoreSimVertex& v, int it) : Core(v), itrack(it), vtxId(0), procType(0) {} -SimVertex::SimVertex(const math::XYZVectorD& v, float tof, unsigned int vId) - : Core(v, tof), itrack(-1), vtxId(vId), procType(0) {} + SimVertex::SimVertex(const math::XYZVectorD& v, float tof, unsigned int vId) + : Core(v, tof), itrack(-1), vtxId(vId), procType(0) {} -SimVertex::SimVertex(const math::XYZVectorD& v, float tof, int it, unsigned int vId) - : Core(v, tof), itrack(it), vtxId(vId), procType(0) {} + SimVertex::SimVertex(const math::XYZVectorD& v, float tof, int it, unsigned int vId) + : Core(v, tof), itrack(it), vtxId(vId), procType(0) {} -SimVertex::SimVertex(const CoreSimVertex& v, int it, unsigned int vId) : Core(v), itrack(it), vtxId(vId), procType(0) {} + SimVertex::SimVertex(const CoreSimVertex& v, int it, unsigned int vId) + : Core(v), itrack(it), vtxId(vId), procType(0) {} -std::ostream& operator<<(std::ostream& o, const SimVertex& v) { - return o << (SimVertex::Core)(v) << ", " << v.parentIndex() << ", " << v.vertexId(); -} + std::ostream& operator<<(std::ostream& o, const SimVertex& v) { + return o << (SimVertex::Core)(v) << ", " << v.parentIndex() << ", " << v.vertexId(); + } +} // namespace io_v1 diff --git a/SimDataFormats/Vertex/src/classes_def.xml b/SimDataFormats/Vertex/src/classes_def.xml index 95319925c20ae..a4e8e83cc9829 100644 --- a/SimDataFormats/Vertex/src/classes_def.xml +++ b/SimDataFormats/Vertex/src/classes_def.xml @@ -1,15 +1,14 @@ - - - + + + - - - + + - + - - + + diff --git a/TBDataFormats/EcalTBObjects/src/classes_def.xml b/TBDataFormats/EcalTBObjects/src/classes_def.xml index 8484fc6a42475..96d30b462425a 100644 --- a/TBDataFormats/EcalTBObjects/src/classes_def.xml +++ b/TBDataFormats/EcalTBObjects/src/classes_def.xml @@ -1,33 +1,33 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/TBDataFormats/HcalTBObjects/src/classes_def.xml b/TBDataFormats/HcalTBObjects/src/classes_def.xml index 6b3ff8e30d8a7..3da612d2d185b 100644 --- a/TBDataFormats/HcalTBObjects/src/classes_def.xml +++ b/TBDataFormats/HcalTBObjects/src/classes_def.xml @@ -1,21 +1,21 @@ - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h b/TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h index d4b85da1fdff1..e4736e780e4a6 100644 --- a/TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h +++ b/TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h @@ -22,8 +22,7 @@ #include "DataFormats/CSCDigi/interface/CSCStripDigiCollection.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/Common/interface/OwnVector.h" -#include "DataFormats/Common/interface/RangeMap.h" +#include "DataFormats/Common/interface/IdToHitRange.h" #include "DataFormats/DTDigi/interface/DTDigiCollection.h" #include "DataFormats/PatCandidates/interface/Muon.h" @@ -45,7 +44,7 @@ class MuonDetCleaner : public edm::stream::EDProducer { ~MuonDetCleaner() override; private: - typedef edm::RangeMap> RecHitCollection; + using RecHitCollection = typename edm::IdToHitRange; void beginRun(const edm::Run &, const edm::EventSetup &) override; void produce(edm::Event &, const edm::EventSetup &) override; diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc index 28c43668eb8ab..4fc81bc85787a 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc @@ -39,8 +39,7 @@ #include "DataFormats/Candidate/interface/VertexCompositeCandidate.h" #include "DataFormats/VertexReco/interface/Vertex.h" -#include "DataFormats/Common/interface/OwnVector.h" -#include "DataFormats/Common/interface/RangeMap.h" +#include "DataFormats/Common/interface/IdToHitRange.h" typedef CollectionMerger, SiPixelCluster> PixelColMerger; typedef CollectionMerger, SiStripCluster> StripColMerger; @@ -53,9 +52,9 @@ typedef CollectionMerger, HFRecHit> HFRecHitColM typedef CollectionMerger, HORecHit> HORecHitColMerger; typedef CollectionMerger, ZDCRecHit> ZDCRecHitColMerger; -typedef CollectionMerger>, DTRecHit1DPair> DTRecHitColMerger; -typedef CollectionMerger>, CSCRecHit2D> CSCRecHitColMerger; -typedef CollectionMerger>, RPCRecHit> RPCRecHitColMerger; +typedef CollectionMerger, DTRecHit1DPair> DTRecHitColMerger; +typedef CollectionMerger, CSCRecHit2D> CSCRecHitColMerger; +typedef CollectionMerger, RPCRecHit> RPCRecHitColMerger; template CollectionMerger::CollectionMerger(const edm::ParameterSet &iConfig) { @@ -343,7 +342,7 @@ void CollectionMerger, ZDCRecHit>::fill_output_ } template <> -void CollectionMerger>, DTRecHit1DPair>::fill_output_obj( +void CollectionMerger, DTRecHit1DPair>::fill_output_obj( edm::Event &iEvent, std::unique_ptr &output, std::vector> &inputCollections) { @@ -351,7 +350,7 @@ void CollectionMerger>, } template <> -void CollectionMerger>, CSCRecHit2D>::fill_output_obj( +void CollectionMerger, CSCRecHit2D>::fill_output_obj( edm::Event &iEvent, std::unique_ptr &output, std::vector> &inputCollections) { @@ -359,7 +358,7 @@ void CollectionMerger>, CSCR } template <> -void CollectionMerger>, RPCRecHit>::fill_output_obj( +void CollectionMerger, RPCRecHit>::fill_output_obj( edm::Event &iEvent, std::unique_ptr &output, std::vector> &inputCollections) { diff --git a/TrackingTools/GsfTracking/src/classes_def.xml b/TrackingTools/GsfTracking/src/classes_def.xml index fa5c499cf8c50..de01742f03c5e 100644 --- a/TrackingTools/GsfTracking/src/classes_def.xml +++ b/TrackingTools/GsfTracking/src/classes_def.xml @@ -1,5 +1,5 @@ - + @@ -13,14 +13,14 @@ - + - - - + + + - + diff --git a/Validation/RecoMuon/src/GlobalMuonMatchAnalyzer.h b/Validation/RecoMuon/src/GlobalMuonMatchAnalyzer.h index 58df7c3f7db76..ceb818b1d004e 100644 --- a/Validation/RecoMuon/src/GlobalMuonMatchAnalyzer.h +++ b/Validation/RecoMuon/src/GlobalMuonMatchAnalyzer.h @@ -15,8 +15,6 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" - -# #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h" @@ -24,10 +22,6 @@ #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" -namespace reco { - class Track; -} - class InputTag; class TrackAssociatorBase; diff --git a/Validation/RecoMuon/src/MuonSeedTrack.h b/Validation/RecoMuon/src/MuonSeedTrack.h index a17272408d875..0cd5bf7d1b542 100644 --- a/Validation/RecoMuon/src/MuonSeedTrack.h +++ b/Validation/RecoMuon/src/MuonSeedTrack.h @@ -26,6 +26,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedFwd.h" #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" @@ -33,10 +34,6 @@ #include -namespace reco { - class Track; -} - class MuonServiceProxy; class MuonUpdatorAtVertex; // From b4d5481f30f8ac1829b1325bebc8fad10594e076 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 21 May 2026 21:28:18 +0200 Subject: [PATCH 2/2] Move sources of CaloCluster and CaloTower inside io_v1 namespace (to be squashed) --- DataFormats/L1TCalorimeter/src/CaloCluster.cc | 88 ++++++++++--------- DataFormats/L1TCalorimeter/src/CaloTower.cc | 56 ++++++------ 2 files changed, 74 insertions(+), 70 deletions(-) diff --git a/DataFormats/L1TCalorimeter/src/CaloCluster.cc b/DataFormats/L1TCalorimeter/src/CaloCluster.cc index 482553f07096c..c597a77130085 100644 --- a/DataFormats/L1TCalorimeter/src/CaloCluster.cc +++ b/DataFormats/L1TCalorimeter/src/CaloCluster.cc @@ -1,67 +1,69 @@ #include "DataFormats/L1TCalorimeter/interface/CaloCluster.h" -l1t::CaloCluster::CaloCluster(const LorentzVector p4, int pt, int eta, int phi) - : L1Candidate(p4, pt, eta, phi), - m_clusterFlags(0x7FF) // first 11 flags at 1 -{} - -l1t::CaloCluster::~CaloCluster() {} - -void l1t::CaloCluster::setClusterFlag(ClusterFlag flag, bool val) { - if (val) { - m_clusterFlags |= (0x1 << flag); - } else { - m_clusterFlags &= ~(0x1 << flag); - } -}; +namespace io_v1 { + CaloCluster::CaloCluster(const LorentzVector p4, int pt, int eta, int phi) + : L1Candidate(p4, pt, eta, phi), + m_clusterFlags(0x7FF) // first 11 flags at 1 + {} + + CaloCluster::~CaloCluster() {} + + void CaloCluster::setClusterFlag(ClusterFlag flag, bool val) { + if (val) { + m_clusterFlags |= (0x1 << flag); + } else { + m_clusterFlags &= ~(0x1 << flag); + } + }; -void l1t::CaloCluster::setHwPtEm(int pt) { m_hwPtEm = pt; } + void CaloCluster::setHwPtEm(int pt) { m_hwPtEm = pt; } -void l1t::CaloCluster::setHwPtHad(int pt) { m_hwPtHad = pt; } + void CaloCluster::setHwPtHad(int pt) { m_hwPtHad = pt; } -void l1t::CaloCluster::setHwSeedPt(int pt) { m_hwSeedPt = pt; } + void CaloCluster::setHwSeedPt(int pt) { m_hwSeedPt = pt; } -void l1t::CaloCluster::setFgEta(int fgEta) { m_fgEta = fgEta; } + void CaloCluster::setFgEta(int fgEta) { m_fgEta = fgEta; } -void l1t::CaloCluster::setFgPhi(int fgPhi) { m_fgPhi = fgPhi; } + void CaloCluster::setFgPhi(int fgPhi) { m_fgPhi = fgPhi; } -void l1t::CaloCluster::setHOverE(int hOverE) { m_hOverE = hOverE; } + void CaloCluster::setHOverE(int hOverE) { m_hOverE = hOverE; } -void l1t::CaloCluster::setFgECAL(int fgECAL) { m_fgECAL = fgECAL; } + void CaloCluster::setFgECAL(int fgECAL) { m_fgECAL = fgECAL; } -bool l1t::CaloCluster::checkClusterFlag(ClusterFlag flag) const { return (m_clusterFlags & (0x1 << flag)); }; + bool CaloCluster::checkClusterFlag(ClusterFlag flag) const { return (m_clusterFlags & (0x1 << flag)); }; -bool l1t::CaloCluster::isValid() const { return (checkClusterFlag(INCLUDE_SEED)); } + bool CaloCluster::isValid() const { return (checkClusterFlag(INCLUDE_SEED)); } -int l1t::CaloCluster::hwPtEm() const { return m_hwPtEm; } + int CaloCluster::hwPtEm() const { return m_hwPtEm; } -int l1t::CaloCluster::hwPtHad() const { return m_hwPtHad; } + int CaloCluster::hwPtHad() const { return m_hwPtHad; } -int l1t::CaloCluster::hwSeedPt() const { return m_hwSeedPt; } + int CaloCluster::hwSeedPt() const { return m_hwSeedPt; } -int l1t::CaloCluster::fgEta() const { return m_fgEta; } + int CaloCluster::fgEta() const { return m_fgEta; } -int l1t::CaloCluster::fgPhi() const { return m_fgPhi; } + int CaloCluster::fgPhi() const { return m_fgPhi; } -int l1t::CaloCluster::hOverE() const { return m_hOverE; } + int CaloCluster::hOverE() const { return m_hOverE; } -int l1t::CaloCluster::fgECAL() const { return m_fgECAL; } + int CaloCluster::fgECAL() const { return m_fgECAL; } -bool l1t::CaloCluster::operator<(const CaloCluster& cl) const { - bool res = false; - // Favour high pT - if (hwPt() < cl.hwPt()) - res = true; - else if (hwPt() == cl.hwPt()) { - // Favour central clusters - if (abs(hwEta()) > abs(cl.hwEta())) + bool CaloCluster::operator<(const CaloCluster& cl) const { + bool res = false; + // Favour high pT + if (hwPt() < cl.hwPt()) res = true; - else if (abs(hwEta()) == abs(cl.hwEta())) { - // Favour small phi (arbitrary) - if (hwPhi() > cl.hwPhi()) + else if (hwPt() == cl.hwPt()) { + // Favour central clusters + if (abs(hwEta()) > abs(cl.hwEta())) res = true; + else if (abs(hwEta()) == abs(cl.hwEta())) { + // Favour small phi (arbitrary) + if (hwPhi() > cl.hwPhi()) + res = true; + } } + return res; } - return res; -} +} // namespace io_v1 diff --git a/DataFormats/L1TCalorimeter/src/CaloTower.cc b/DataFormats/L1TCalorimeter/src/CaloTower.cc index a35c0d904e819..0d5f72eb34254 100644 --- a/DataFormats/L1TCalorimeter/src/CaloTower.cc +++ b/DataFormats/L1TCalorimeter/src/CaloTower.cc @@ -1,41 +1,43 @@ #include "DataFormats/L1TCalorimeter/interface/CaloTower.h" -l1t::CaloTower::CaloTower(const LorentzVector& p4, - double etEm, - double etHad, - int pt, - int eta, - int phi, - int qual, - int hwEtEm, - int hwEtHad, - int hwEtRatio) - : L1Candidate(p4, pt, eta, phi, qual), - etEm_(etEm), - etHad_(etHad), - hwEtEm_(hwEtEm), - hwEtHad_(hwEtHad), - hwEtRatio_(hwEtRatio) {} +namespace io_v1 { + CaloTower::CaloTower(const LorentzVector& p4, + double etEm, + double etHad, + int pt, + int eta, + int phi, + int qual, + int hwEtEm, + int hwEtHad, + int hwEtRatio) + : L1Candidate(p4, pt, eta, phi, qual), + etEm_(etEm), + etHad_(etHad), + hwEtEm_(hwEtEm), + hwEtHad_(hwEtHad), + hwEtRatio_(hwEtRatio) {} -l1t::CaloTower::~CaloTower() {} + CaloTower::~CaloTower() {} -void l1t::CaloTower::setEtEm(double et) { etEm_ = et; } + void CaloTower::setEtEm(double et) { etEm_ = et; } -void l1t::CaloTower::setEtHad(double et) { etHad_ = et; } + void CaloTower::setEtHad(double et) { etHad_ = et; } -void l1t::CaloTower::setHwEtEm(int et) { hwEtEm_ = et; } + void CaloTower::setHwEtEm(int et) { hwEtEm_ = et; } -void l1t::CaloTower::setHwEtHad(int et) { hwEtHad_ = et; } + void CaloTower::setHwEtHad(int et) { hwEtHad_ = et; } -void l1t::CaloTower::setHwEtRatio(int ratio) { hwEtRatio_ = ratio; } + void CaloTower::setHwEtRatio(int ratio) { hwEtRatio_ = ratio; } -double l1t::CaloTower::etEm() const { return etEm_; } + double CaloTower::etEm() const { return etEm_; } -double l1t::CaloTower::etHad() const { return etHad_; } + double CaloTower::etHad() const { return etHad_; } -int l1t::CaloTower::hwEtEm() const { return hwEtEm_; } + int CaloTower::hwEtEm() const { return hwEtEm_; } -int l1t::CaloTower::hwEtHad() const { return hwEtHad_; } + int CaloTower::hwEtHad() const { return hwEtHad_; } -int l1t::CaloTower::hwEtRatio() const { return hwEtRatio_; } + int CaloTower::hwEtRatio() const { return hwEtRatio_; } +} // namespace io_v1