From c33511740b5ccb999a7a32c45f5abe4d80373793 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Wed, 28 Sep 2022 19:56:42 +0200 Subject: [PATCH 1/3] Start trying to make consistent with PFNano --- DPGAnalysis/CaloNanoAOD/BuildFile.xml | 6 ++ DPGAnalysis/CaloNanoAOD/plugins/BuildFile.xml | 18 +++++ .../CaloIndexFromAssociationTableProducer.cc | 27 +++++++ .../plugins/HCALHitPositionTableProducer.cc | 54 +++++++++++++ .../SimClusterRecEnergyTableProducer.cc | 7 ++ .../SimpleCaloObjectFlatTableProducer.cc | 18 +++++ .../CaloNanoAOD/python/caloParticles_cff.py | 26 +++++++ .../CaloNanoAOD/python/hcalRecHits_cff.py | 54 +++++++++++++ .../CaloNanoAOD/python/simClusters_cff.py | 41 ++++++++++ .../python/hgcRecHitSimAssociations_cff.py | 51 +----------- .../HGCalNanoAOD/python/hgcRecHits_cff.py | 57 +------------- .../HGCalNanoAOD/python/ticlCandidates_cff.py | 36 +++++++++ .../PFNanoAOD/python/pfAssociations_cff.py | 78 +++++++++++++++++++ .../PFNanoAOD/python/pfClusters_cff.py | 37 +++++++++ DPGAnalysis/PFNanoAOD/python/pfNano_cff.py | 74 ++++++++++++++++++ DPGAnalysis/PFNanoAOD/python/pfTracks_cff.py | 30 +++++++ .../interface/HitPositionTableProducer.h | 65 ++++++++++++++++ 17 files changed, 579 insertions(+), 100 deletions(-) create mode 100644 DPGAnalysis/CaloNanoAOD/BuildFile.xml create mode 100644 DPGAnalysis/CaloNanoAOD/plugins/BuildFile.xml create mode 100644 DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc create mode 100644 DPGAnalysis/CaloNanoAOD/plugins/HCALHitPositionTableProducer.cc create mode 100644 DPGAnalysis/CaloNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc create mode 100644 DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc create mode 100644 DPGAnalysis/CaloNanoAOD/python/caloParticles_cff.py create mode 100644 DPGAnalysis/CaloNanoAOD/python/hcalRecHits_cff.py create mode 100644 DPGAnalysis/CaloNanoAOD/python/simClusters_cff.py create mode 100644 DPGAnalysis/HGCalNanoAOD/python/ticlCandidates_cff.py create mode 100644 DPGAnalysis/PFNanoAOD/python/pfAssociations_cff.py create mode 100644 DPGAnalysis/PFNanoAOD/python/pfClusters_cff.py create mode 100644 DPGAnalysis/PFNanoAOD/python/pfNano_cff.py create mode 100644 DPGAnalysis/PFNanoAOD/python/pfTracks_cff.py create mode 100644 PhysicsTools/NanoAOD/interface/HitPositionTableProducer.h diff --git a/DPGAnalysis/CaloNanoAOD/BuildFile.xml b/DPGAnalysis/CaloNanoAOD/BuildFile.xml new file mode 100644 index 0000000000000..6cc75a882ba98 --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/BuildFile.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/DPGAnalysis/CaloNanoAOD/plugins/BuildFile.xml b/DPGAnalysis/CaloNanoAOD/plugins/BuildFile.xml new file mode 100644 index 0000000000000..a14b56c6f8086 --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/plugins/BuildFile.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc b/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc new file mode 100644 index 0000000000000..b56a5aa8c5a46 --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc @@ -0,0 +1,27 @@ +#include "PhysicsTools/NanoAOD/interface/ObjectIndexFromAssociationProducer.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" +#include "SimDataFormats/PFAnalysis/interface/PFTruthParticle.h" +#include "SimDataFormats/PFAnalysis/interface/PFTruthParticleFwd.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include "SimDataFormats/Track/interface/SimTrackContainer.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" +#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +typedef ObjectIndexFromAssociationTableProducer + SimTrackToSimClusterIndexTableProducer; +typedef ObjectIndexFromAssociationTableProducer + CaloHitToSimClusterIndexTableProducer; +typedef ObjectIndexFromAssociationTableProducer + SimClusterToCaloParticleIndexTableProducer; +typedef ObjectIndexFromAssociationTableProducer + SimClusterToSimClusterIndexTableProducer; + +DEFINE_FWK_MODULE(SimTrackToSimClusterIndexTableProducer); +DEFINE_FWK_MODULE(CaloHitToSimClusterIndexTableProducer); +DEFINE_FWK_MODULE(SimClusterToCaloParticleIndexTableProducer); +DEFINE_FWK_MODULE(SimClusterToSimClusterIndexTableProducer); diff --git a/DPGAnalysis/CaloNanoAOD/plugins/HCALHitPositionTableProducer.cc b/DPGAnalysis/CaloNanoAOD/plugins/HCALHitPositionTableProducer.cc new file mode 100644 index 0000000000000..e5301e76e05f5 --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/plugins/HCALHitPositionTableProducer.cc @@ -0,0 +1,54 @@ +#include "PhysicsTools/NanoAOD/interface/HitPositionTableProducer.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" + +#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" + +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/Records/interface/HcalRecNumberingRecord.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" + + +class HCALHitPositionTableProducer : public HitPositionTableProducer> { +public: + HCALHitPositionTableProducer(edm::ParameterSet const& params) + : HitPositionTableProducer(params) {} + //caloGeomToken_(esConsumes()) { + + ~HCALHitPositionTableProducer() override {} + + GlobalPoint positionFromHit(const CaloRecHit& hit) { return positionFromDetId(hit.detid()); } + + void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override { + // TODO: check that the geometry exists + iSetup.get().get(caloGeom_); + } + + GlobalPoint positionFromDetId(DetId detid) { + DetId::Detector det = detid.det(); + if (det == DetId::Hcal) { + GlobalPoint position; + HcalSubdetector esd = (HcalSubdetector)detid.subdetId(); + const CaloSubdetectorGeometry* gTmp = caloGeom_->getSubdetectorGeometry(DetId::Hcal, esd); + auto thisCell = gTmp->getGeometry(detid); + return thisCell->getPosition(); + } else { + throw cms::Exception("HCALHitPositionTableProducer") << "Unsupported DetId type"; + } + } + +protected: + //edm::ESGetToken caloGeomToken_; + edm::ESHandle caloGeom_; +}; + +#include "FWCore/Framework/interface/MakerMacros.h" +typedef HCALHitPositionTableProducer HCALRecHitPositionTableProducer; +DEFINE_FWK_MODULE(HCALRecHitPositionTableProducer); + diff --git a/DPGAnalysis/CaloNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc b/DPGAnalysis/CaloNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc new file mode 100644 index 0000000000000..295f71418841d --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc @@ -0,0 +1,7 @@ +#include "PhysicsTools/NanoAOD/interface/ObjectPropertyFromIndexMapTableProducer.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +typedef ObjectPropertyFromIndexMapTableProducer SimClusterRecEnergyTableProducer; +DEFINE_FWK_MODULE(SimClusterRecEnergyTableProducer); diff --git a/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc b/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc new file mode 100644 index 0000000000000..cd1e3b044668e --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc @@ -0,0 +1,18 @@ +#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" + +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" +typedef SimpleFlatTableProducer SimpleSimClusterFlatTableProducer; + +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +typedef SimpleFlatTableProducer SimplePCaloHitFlatTableProducer; +#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" +typedef SimpleFlatTableProducer SimpleCaloRecHitFlatTableProducer; + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +typedef SimpleFlatTableProducer SimpleCaloParticleFlatTableProducer; + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(SimplePCaloHitFlatTableProducer); +DEFINE_FWK_MODULE(SimpleCaloRecHitFlatTableProducer); +DEFINE_FWK_MODULE(SimpleSimClusterFlatTableProducer); +DEFINE_FWK_MODULE(SimpleCaloParticleFlatTableProducer); diff --git a/DPGAnalysis/CaloNanoAOD/python/caloParticles_cff.py b/DPGAnalysis/CaloNanoAOD/python/caloParticles_cff.py new file mode 100644 index 0000000000000..881d604615a9a --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/python/caloParticles_cff.py @@ -0,0 +1,26 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import CandVars,Var + +caloParticleTable = cms.EDProducer("SimpleCaloParticleFlatTableProducer", + src = cms.InputTag("mix:MergedCaloTruth"), + cut = cms.string(""), + name = cms.string("CaloPart"), + doc = cms.string("CaloPart"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the muons + variables = cms.PSet(CandVars, + eventId = Var('eventId().event()', 'int', precision=-1, doc='Event ID (can be used to identify pileup'), + bunchCrossing = Var('eventId().bunchCrossing()', 'int', precision=-1, doc='bunch crossing (can be used to identify pileup'), + rawEventId = Var('eventId().rawId()', 'int', precision=-1, doc='Raw event ID (can be used to identify pileup'), + simEnergy = Var('simEnergy', 'float', precision=-1, doc='Sum of the simHit energy'), + energy = Var('energy', 'float', precision=-1, doc='energy of the four vector'), + nGenPart = Var('genParticles().size()', 'int', precision=-1, doc='Number of associated gen particles'), + GenPartIdx = Var('? genParticles.size() ? genParticles().at(0).key() : -1', 'int', precision=-1, doc='Number of associated gen particles'), + nSimHit = Var('numberOfSimHits', 'int', precision=-1, doc='Number of simhits'), + trackId = Var('g4Tracks().at(0).trackId', 'int', precision=-1, doc='Geant4 track ID of first track'), + nSimTrack = Var('g4Tracks().size', 'int', precision=-1, doc='Number of associated simtracks'), + crossedBoundary = Var('g4Tracks().at(0).crossedBoundary()', 'bool', doc='Crossed the HGCAL boundary') + ) +) + +caloParticleTables = cms.Sequence(caloParticleTable) diff --git a/DPGAnalysis/CaloNanoAOD/python/hcalRecHits_cff.py b/DPGAnalysis/CaloNanoAOD/python/hcalRecHits_cff.py new file mode 100644 index 0000000000000..34955166c7611 --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/python/hcalRecHits_cff.py @@ -0,0 +1,54 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import Var,P3Vars + +hbheRecHitTable = cms.EDProducer("SimpleCaloRecHitFlatTableProducer", + src = cms.InputTag("hbhereco"), + cut = cms.string(""), + name = cms.string("RecHitHBHE"), + doc = cms.string("HCAL barrel and endcap rec hits"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the muons + variables = cms.PSet( + detId = Var('detid().rawId()', 'int', precision=-1, doc='detId'), + energy = Var('energy', 'float', precision=14, doc='energy'), + time = Var('time', 'float', precision=14, doc='hit time'), + ) +) + +hbheRecHitPositionTable = cms.EDProducer("HCALRecHitPositionTableProducer", + src = hbheRecHitTable.src, + cut = hbheRecHitTable.cut, + name = hbheRecHitTable.name, + doc = hbheRecHitTable.doc, +) + +hfRecHitsTable = hbheRecHitTable.clone() +hfRecHitsTable.src = "hfreco" +hfRecHitsTable.name = "RecHitHF" +hfRecHitsTable.doc = "HCAL forward (HF) rechits" + +hfRecHitPositionTable = hbheRecHitPositionTable.clone() +hfRecHitPositionTable.src = hfRecHitsTable.src +hfRecHitPositionTable.cut = hfRecHitsTable.cut +hfRecHitPositionTable.name = hfRecHitsTable.name +hfRecHitPositionTable.doc = hfRecHitsTable.doc + +hoRecHitsTable = hbheRecHitTable.clone() +hoRecHitsTable.src = "horeco" +hoRecHitsTable.name = "RecHitHO" +hoRecHitsTable.doc = "HCAL outer (HO) rechits" + +hoRecHitPositionTable = hbheRecHitPositionTable.clone() +hoRecHitPositionTable.src = hoRecHitsTable.src +hoRecHitPositionTable.cut = hoRecHitsTable.cut +hoRecHitPositionTable.name = hoRecHitsTable.name +hoRecHitPositionTable.doc = hoRecHitsTable.doc + +hcalRecHitTables = cms.Sequence( + hbheRecHitTable + +hbheRecHitPositionTable + +hfRecHitsTable + +hfRecHitPositionTable + +hoRecHitsTable + +hoRecHitPositionTable +) diff --git a/DPGAnalysis/CaloNanoAOD/python/simClusters_cff.py b/DPGAnalysis/CaloNanoAOD/python/simClusters_cff.py new file mode 100644 index 0000000000000..d35fbcddfce8e --- /dev/null +++ b/DPGAnalysis/CaloNanoAOD/python/simClusters_cff.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import CandVars,Var + +simClusterTable = cms.EDProducer("SimpleSimClusterFlatTableProducer", + src = cms.InputTag("mix:MergedCaloTruth"), + cut = cms.string(""), + name = cms.string("SimCluster"), + doc = cms.string("SimCluster information"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the muons + variables = cms.PSet(CandVars, + eventId = Var('eventId().event()', 'int', precision=-1, doc='Event ID (can be used to identify pileup'), + bunchCrossing = Var('eventId().bunchCrossing()', 'int', precision=-1, doc='bunch crossing (can be used to identify pileup'), + rawEventId = Var('eventId().rawId()', 'int', precision=-1, doc='Raw event ID (can be used to identify pileup'), + lastPos_x = Var('g4Tracks.at(0).trackerSurfacePosition().x()', 'float', precision=14, doc='track x final position'), + lastPos_y = Var('g4Tracks.at(0).trackerSurfacePosition().y()', 'float', precision=14, doc='track y final position'), + lastPos_z = Var('g4Tracks.at(0).trackerSurfacePosition().z()', 'float', precision=14, doc='track z final position'), + # For reasons lost on me, the nsimhits_ variable is uninitialized, and hits_ (which are really simhits) + # are often referred to as rechits in the SimCluster class + nHits = Var('numberOfRecHits', 'int', precision=-1, doc='number of simhits'), + sumHitEnergy = Var('energy', 'float', precision=14, doc='total energy of simhits'), + trackId = Var('g4Tracks().at(0).trackId()', 'int', precision=-1, doc='Geant track id'), + crossedBoundary = Var('g4Tracks().at(0).crossedBoundary()', 'bool', doc='Crossed the HGCAL boundary') + ) +) + +simClusterToCaloPart = cms.EDProducer("SimClusterToCaloParticleAssociationProducer", + caloParticles = cms.InputTag("mix:MergedCaloTruth"), + simClusters = cms.InputTag("mix:MergedCaloTruth"), +) + +simClusterToCaloPartTable = cms.EDProducer("SimClusterToCaloParticleIndexTableProducer", + cut = simClusterTable.cut, + src = simClusterTable.src, + objName = simClusterTable.name, + branchName = cms.string("CaloPart"), + objMap = cms.InputTag("simClusterToCaloPart"), + docString = cms.string("Index of CaloPart containing SimCluster") +) + +simClusterTables = cms.Sequence(simClusterTable+simClusterToCaloPart+simClusterToCaloPartTable) diff --git a/DPGAnalysis/HGCalNanoAOD/python/hgcRecHitSimAssociations_cff.py b/DPGAnalysis/HGCalNanoAOD/python/hgcRecHitSimAssociations_cff.py index 8f8dc79c97acd..5b96d72d6fae6 100644 --- a/DPGAnalysis/HGCalNanoAOD/python/hgcRecHitSimAssociations_cff.py +++ b/DPGAnalysis/HGCalNanoAOD/python/hgcRecHitSimAssociations_cff.py @@ -7,17 +7,7 @@ simClusters = cms.InputTag("mix:MergedCaloTruth"), ) -hgcRecHitsToMergedSimClusters = cms.EDProducer("SimClusterRecHitAssociationProducer", - caloRecHits = cms.VInputTag("hgcRecHits"), - simClusters = cms.InputTag("hgcSimTruth"), -) - -hgcRecHitsToMergedDRSimClusters = cms.EDProducer("SimClusterRecHitAssociationProducer", - caloRecHits = cms.VInputTag("hgcRecHits"), - simClusters = cms.InputTag("hgcSimTruthDR"), -) - -hgcRecHitsToSimClusterTable = cms.EDProducer("CaloRecHitToSimClusterIndexTableProducer", +hgcRecHitsToSimClusterTable = cms.EDProducer("HGCRecHitToSimClusterIndexTableProducer", cut = hgcRecHitsTable.cut, src = hgcRecHitsTable.src, objName = hgcRecHitsTable.name, @@ -27,25 +17,6 @@ docString = cms.string("All SimCluster responsible for sim energy in RecHit DetId (ordered by fraction of energy)") ) -hgcRecHitsToMergedSimClusterTable = cms.EDProducer("CaloRecHitToSimClusterIndexTableProducer", - cut = hgcRecHitsTable.cut, - src = hgcRecHitsTable.src, - objName = hgcRecHitsTable.name, - branchName = cms.string("MergedSimCluster"), - objMap = cms.InputTag("hgcRecHitsToMergedSimClusters:hgcRecHitsToSimClus"), - bestMatchTable = cms.untracked.bool(True), - docString = cms.string("MergedSimClusters ordered by most sim energy in RecHit DetId") -) - -hgcRecHitsToMergedDRSimClusterTable = cms.EDProducer("CaloRecHitToSimClusterIndexTableProducer", - cut = hgcRecHitsTable.cut, - src = hgcRecHitsTable.src, - objName = hgcRecHitsTable.name, - branchName = cms.string("MergedByDRSimCluster"), - objMap = cms.InputTag("hgcRecHitsToMergedDRSimClusters:hgcRecHitsToSimClus"), - docString = cms.string("MergedSimCluster responsible for most sim energy in RecHit DetId") -) - simClusterRecEnergyTable = cms.EDProducer("SimClusterRecEnergyTableProducer", src = cms.InputTag("mix:MergedCaloTruth"), cut = cms.string(""), @@ -55,21 +26,7 @@ docString = cms.string("SimCluster deposited reconstructed energy associated to SimCluster") ) -mergedSimClusterRecEnergyTable = cms.EDProducer("SimClusterRecEnergyTableProducer", - src = cms.InputTag("hgcSimTruth"), - cut = cms.string(""), - objName = cms.string("MergedSimCluster"), - branchName = cms.string("recEnergy"), - valueMap = cms.InputTag("hgcRecHitsToMergedSimClusters"), - docString = cms.string("SimCluster deposited reconstructed energy associated to SimCluster") -) - -hgcRecHitSimAssociationSequence = cms.Sequence(hgcRecHitsToSimClusters - +hgcRecHitsToMergedSimClusters - +hgcRecHitsToMergedDRSimClusters - +simClusterRecEnergyTable - +mergedSimClusterRecEnergyTable - +hgcRecHitsToSimClusterTable - +hgcRecHitsToMergedSimClusterTable - +hgcRecHitsToMergedDRSimClusterTable +hgcRecHitSimAssociationTask = cms.Task(hgcRecHitsToSimClusters, + simClusterRecEnergyTable, + hgcRecHitsToSimClusterTable ) diff --git a/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py b/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py index 12a0c8fdd7fd6..a71f056f11265 100644 --- a/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py +++ b/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py @@ -21,63 +21,14 @@ ) ) -hgcRecHitsToPFCands = cms.EDProducer("RecHitToPFCandAssociationProducer", - caloRecHits = cms.VInputTag("hgcRecHits"), - pfCands = cms.InputTag("particleFlow"), -) - -hgcRecHitsToPFCandTable = cms.EDProducer("CaloRecHitToPFCandIndexTableProducer", - cut = hgcRecHitsTable.cut, - src = hgcRecHitsTable.src, - objName = hgcRecHitsTable.name, - branchName = cms.string("PFCand"), - objMap = cms.InputTag("hgcRecHitsToPFCands:hgcRecHitsToPFCand"), - docString = cms.string("PFCand with most associated energy in RecHit DetId") -) - -hgcRecHitsToPFTICLCands = cms.EDProducer("RecHitToPFCandAssociationProducer", - caloRecHits = cms.VInputTag("hgcRecHits"), - pfCands = cms.InputTag("pfTICL"), -) - -hgcRecHitsToPFTICLCandTable = cms.EDProducer("CaloRecHitToPFCandIndexTableProducer", - cut = hgcRecHitsTable.cut, - src = hgcRecHitsTable.src, - objName = hgcRecHitsTable.name, - branchName = cms.string("PFTICLCand"), - objMap = cms.InputTag("hgcRecHitsToPFTICLCands:hgcRecHitsToPFCand"), - docString = cms.string("PFTICLCand with most associated energy in RecHit DetId") -) - -hgcRecHitsToLayerClusters = cms.EDProducer("RecHitToLayerClusterAssociationProducer", - caloRecHits = cms.VInputTag("hgcRecHits"), - layerClusters = cms.InputTag("hgcalLayerClusters"), -) - -hgcRecHitsToLayerClusterTable = cms.EDProducer("HGCRecHitToLayerClusterIndexTableProducer", - cut = hgcRecHitsTable.cut, - src = hgcRecHitsTable.src, - objName = hgcRecHitsTable.name, - branchName = cms.string("LayerCluster"), - objMap = cms.InputTag("hgcRecHitsToLayerClusters:hgcRecHitsToLayerCluster"), - docString = cms.string("LayerCluster assigned largest RecHit fraction"), - bestMatchTable = cms.untracked.bool(True) -) - -hgcRecHitsPositionTable = cms.EDProducer("HGCRecHitPositionTableProducer", +hgcRecHitsPositionTable = cms.EDProducer("HGCALRecHitPositionTableProducer", src = hgcRecHitsTable.src, cut = hgcRecHitsTable.cut, name = hgcRecHitsTable.name, doc = hgcRecHitsTable.doc, ) -hgcRecHitsSequence = cms.Sequence( - hgcRecHitsTable - +hgcRecHitsToPFCands - +hgcRecHitsToPFCandTable - +hgcRecHitsToPFTICLCands - +hgcRecHitsToPFTICLCandTable - +hgcRecHitsToLayerClusters - +hgcRecHitsToLayerClusterTable - +hgcRecHitsPositionTable +hgcRecHitsTask = cms.Task(hgcRecHits, + hgcRecHitsTable, + hgcRecHitsPositionTable ) diff --git a/DPGAnalysis/HGCalNanoAOD/python/ticlCandidates_cff.py b/DPGAnalysis/HGCalNanoAOD/python/ticlCandidates_cff.py new file mode 100644 index 0000000000000..f638984c04cde --- /dev/null +++ b/DPGAnalysis/HGCalNanoAOD/python/ticlCandidates_cff.py @@ -0,0 +1,36 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import CandVars,Var +from DPGAnalysis.HGCalNanoAOD.hgcRecHits_cff import hgcRecHitsTable + +ticlTable = cms.EDProducer("SimpleCandidateFlatTableProducer", + src = cms.InputTag("ticlTrackstersMerge"), + cut = cms.string(""), + name = cms.string("TICLCand"), + doc = cms.string("TICL Candidates"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the muons + variables = cms.PSet(CandVars, + Vtx_x = Var('vertex().x()', 'float', precision=14, doc='vertex x pos'), + Vtx_y = Var('vertex().y()', 'float', precision=14, doc='vertex y pos'), + Vtx_z = Var('vertex().z()', 'float', precision=14, doc='vertex z pos'), + ) +) + +hgcRecHitsToTiclCands = cms.EDProducer("RecHitToTICLCandidateAssociationProducer", + caloRecHits = hgcRecHitsTable.src, + layerClusters = cms.InputTag("hgcalLayerClusters"), + ticlCandidates = ticlTable.src, +) + +hgcRecHitToTiclTable = cms.EDProducer("RecHitToTICLCandidateIndexTableProducer", + cut = hgcRecHitsTable.cut, + src = hgcRecHitsTable.src, + objName = hgcRecHitsTable.name, + branchName = ticlTable.name, + objMap = cms.InputTag("hgcRecHitsToTiclCands"), + docString = cms.string("Index of TICLCand containing RecHit") +) + + +ticlTables = cms.Task(ticlTable, hgcRecHitsToTiclCands, hgcRecHitToTiclTable) + diff --git a/DPGAnalysis/PFNanoAOD/python/pfAssociations_cff.py b/DPGAnalysis/PFNanoAOD/python/pfAssociations_cff.py new file mode 100644 index 0000000000000..e056f6969b5a5 --- /dev/null +++ b/DPGAnalysis/PFNanoAOD/python/pfAssociations_cff.py @@ -0,0 +1,78 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import CandVars,Var,P3Vars +from DPGAnalysis.PFNanoAOD.pfClusters_cff import * +from DPGAnalysis.PFNanoAOD.pfCands_cff import * +from DPGAnalysis.TrackNanoAOD.tracks_cff import * +from DPGAnalysis.CaloNanoAOD.hcalRecHits_cff import * + +hitsAndElementsToPFCands = cms.EDProducer("PFCandAssociationsProducer", + caloRecHits = cms.VInputTag("hbhereco", "hfreco", "horeco"), + pfClusters = cms.VInputTag("particleFlowClusterECAL", "particleFlowClusterHCAL", "particleFlowClusterHF"), + tracks = cms.VInputTag("generalTracks"), + pfCands = cms.InputTag("particleFlow"), +) + +trackToCandTable = cms.EDProducer("TrackToPFCandIndexTableProducer", + cut = generalTrackTable.cut, + src = generalTrackTable.src, + objName = generalTrackTable.name, + branchName = pfCandTable.name, + objMap = cms.InputTag(f"hitsAndElementsToPFCands:{generalTrackTable.src.value()}ToPFCand"), + docString = cms.string("Index of PFCand containing track") +) + +pfClusterECALToCandTable = cms.EDProducer("PFClusterToPFCandIndexTableProducer", + cut = ecalPFClusTable.cut, + src = ecalPFClusTable.src, + objName = ecalPFClusTable.name, + branchName = pfCandTable.name, + objMap = cms.InputTag(f"hitsAndElementsToPFCands:{ecalPFClusTable.src.value()}ToPFCand"), + docString = cms.string("Index of PFCand containing PFCluster") +) + +pfClusterHCALToCandTable = cms.EDProducer("PFClusterToPFCandIndexTableProducer", + cut = hcalPFClusTable.cut, + src = hcalPFClusTable.src, + objName = hcalPFClusTable.name, + branchName = pfCandTable.name, + objMap = cms.InputTag(f"hitsAndElementsToPFCands:{hcalPFClusTable.src.value()}ToPFCand"), + docString = cms.string("Index of PFCand containing PFCluster") +) + +pfClusterHFToCandTable = cms.EDProducer("PFClusterToPFCandIndexTableProducer", + cut = hfPFClusTable.cut, + src = hfPFClusTable.src, + objName = hfPFClusTable.name, + branchName = pfCandTable.name, + objMap = cms.InputTag(f"hitsAndElementsToPFCands:{hfPFClusTable.src.value()}ToPFCand"), + docString = cms.string("Index of PFCand containing PFCluster") +) + +hbheRecHitsToPFCandTable = cms.EDProducer("CaloRecHitToPFCandIndexTableProducer", + cut = hbheRecHitTable.cut, + src = hbheRecHitTable.src, + objName = hbheRecHitTable.name, + branchName = pfCandTable.name, + objMap = cms.InputTag(f"hitsAndElementsToPFCands:{hbheRecHitTable.src.value()}ToPFCand"), + docString = cms.string("Association to PFCandidate containing RecHit, and its energy fraction") +) + +hbheRecHitsToPFClusterTable = cms.EDProducer("CaloRecHitToPFClusterIndexTableProducer", + cut = hbheRecHitTable.cut, + src = hbheRecHitTable.src, + objName = hbheRecHitTable.name, + branchName = hcalPFClusTable.name, + objMap = cms.InputTag(f"hitsAndElementsToPFCands:{hbheRecHitTable.src.value()}To{hcalPFClusTable.src.value()}"), + docString = cms.string("Association to PFCluster containing RecHit, and its energy fraction") +) + +pfAssociationTables = cms.Sequence( + hitsAndElementsToPFCands + +trackToCandTable + +pfClusterECALToCandTable + +pfClusterHCALToCandTable + +pfClusterHFToCandTable + +hbheRecHitsToPFCandTable + +hbheRecHitsToPFClusterTable +) + diff --git a/DPGAnalysis/PFNanoAOD/python/pfClusters_cff.py b/DPGAnalysis/PFNanoAOD/python/pfClusters_cff.py new file mode 100644 index 0000000000000..2f35e37af1735 --- /dev/null +++ b/DPGAnalysis/PFNanoAOD/python/pfClusters_cff.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import CandVars,Var,P3Vars + +ecalPFClusTable = cms.EDProducer("SimplePFClusterFlatTableProducer", + src = cms.InputTag("particleFlowClusterECAL"), + cut = cms.string(""), + name = cms.string("PFClusterECAL"), + doc = cms.string("Particle flow cluters in ECAL"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), + variables = cms.PSet(P3Vars, + depth = Var('depth', 'float', precision=14, doc='Cluster depth'), + energy = Var('energy', 'float', precision=14, doc='vertex y pos'), + correctedEnergy = Var('correctedEnergy', 'float', precision=14, doc='vertex z pos'), + algo = Var('algo', 'int', precision=10, doc="Algo ID"), + x = Var('x', 'float', precision=14, doc='x position'), + y = Var('y', 'float', precision=14, doc='y position'), + z = Var('z', 'float', precision=14, doc='z position'), + time = Var('time', 'float', precision=14, doc='time'), + ) +) + +hcalPFClusTable = ecalPFClusTable.clone() +hcalPFClusTable.src = "particleFlowClusterHCAL" +hcalPFClusTable.name = "PFClusterHCAL" +hcalPFClusTable.doc = "Particle flow cluster in HGCAL" + +hfPFClusTable = ecalPFClusTable.clone() +hfPFClusTable.src = "particleFlowClusterHF" +hfPFClusTable.name = "PFClusterHF" +hfPFClusTable.doc = "Particle flow cluster in HGCAL" + +pfClusterTables = cms.Sequence( + ecalPFClusTable + +hcalPFClusTable + +hfPFClusTable +) diff --git a/DPGAnalysis/PFNanoAOD/python/pfNano_cff.py b/DPGAnalysis/PFNanoAOD/python/pfNano_cff.py new file mode 100644 index 0000000000000..4b8159fd8dd36 --- /dev/null +++ b/DPGAnalysis/PFNanoAOD/python/pfNano_cff.py @@ -0,0 +1,74 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import * +from PhysicsTools.NanoAOD.genparticles_cff import genParticleTable +from PhysicsTools.NanoAOD.genVertex_cff import * +from DPGAnalysis.TrackNanoAOD.trackingParticles_cff import * +from DPGAnalysis.TrackNanoAOD.tracks_cff import * +from DPGAnalysis.PFNanoAOD.pfCands_cff import * +from DPGAnalysis.PFNanoAOD.pfClusters_cff import * +from DPGAnalysis.PFNanoAOD.pfTracks_cff import * +from DPGAnalysis.PFNanoAOD.pfAssociations_cff import * +#from DPGAnalysis.PFNanoAOD.pfTruth_cff import * +from DPGAnalysis.CaloNanoAOD.hcalRecHits_cff import * +from DPGAnalysis.CaloNanoAOD.caloParticles_cff import * +from DPGAnalysis.CaloNanoAOD.simClusters_cff import * +from DPGAnalysis.HGCalNanoAOD.hgcRecHits_cff import * +from DPGAnalysis.HGCalNanoAOD.hgcRecHitSimAssociations_cff import * +from DPGAnalysis.HGCalNanoAOD.layerClusters_cff import * +from DPGAnalysis.HGCalNanoAOD.ticlCandidates_cff import * +from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal + +nanoMetadata = cms.EDProducer("UniqueStringProducer", + strings = cms.PSet( + tag = cms.string("untagged"), + ) +) + +genParticleTable.src = "genParticles" +genParticleTable.variables = cms.PSet(genParticleTable.variables, + charge = CandVars.charge) + +# TODO: Get this working again +#pfNanoSimSeq = cms.Sequence( +# simClusterTables +# +trackingParticleTables +# +caloParticleTables +# #+pfTruth +#) +# +#hgcalTask = cms.Task() +#phase2_hgcal.toReplaceWith(hgcalTask, +# cms.Task(hgcRecHitsTask, +# hgcRecHitSimAssociationTask, +# layerClusterTables, +# ticlTables +# ) +#) +# +#pfNanoSequence = cms.Sequence(nanoMetadata +# +pfNanoSimSeq +# +genVertexTable+genVertexT0Table+genParticleTable +# +pfCandTables +# +pfAssociationTables +# +pfClusterTables +# #+pfTrackTables +# +cms.Sequence(trackTables) +# +hcalRecHitTables +# +cms.Sequence(hgcalTask) +#) + +def customizeOutputForPF(process): + import re + output = [x for x in dir(process) if re.match(".*output$", x)] + if not output: + raise RuntimeError("No output module found in process. This shouldn't be possible") + outputMod = getattr(process, output[0]) + outputMod.outputCommands.extend([ + "keep *_*_MergedCaloTruth_*", + "keep *_*_MergedTrackTruth_*", + 'keep recoPFRecTracks_*_*_*', + 'keep recoPFRecHits_*_*_*', + "keep *_simSiStripDigis_*_*", + "keep *_simSiPixelDigis_*_*", + ]) + return process diff --git a/DPGAnalysis/PFNanoAOD/python/pfTracks_cff.py b/DPGAnalysis/PFNanoAOD/python/pfTracks_cff.py new file mode 100644 index 0000000000000..d4bf6eef3987d --- /dev/null +++ b/DPGAnalysis/PFNanoAOD/python/pfTracks_cff.py @@ -0,0 +1,30 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import CandVars,Var,P3Vars + +# I realize hardcoding this is awful but not sure if there's a way around it, +# seems the following breaks things +#import ROOT +#ECALShowerMax = ROOT.reco.PFTrajectoryPoint.ECALShowerMax +ECALShowerMax = 5 +HCALEntrance = 6 +pfTrackTable = cms.EDProducer("SimplePFRecTrackFlatTableProducer", + src = cms.InputTag("pfTrack"), + cut = cms.string(""), + name = cms.string("PFTrack"), + doc = cms.string("Particle flow-specific track info"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), + variables = cms.PSet( + TrackIdx = Var("? trackRef().isNonnull() ? trackRef().key() : -1", "int", precision=10, doc="Matching track index"), + positionAtECAL_x = Var(f"? extrapolatedPoint({ECALShowerMax}).isValid() ? extrapolatedPoint({ECALShowerMax}).position().x() : -999", "float", precision=14, doc="x position at shower max in ECAL"), + positionAtECAL_y = Var(f"? extrapolatedPoint({ECALShowerMax}).isValid() ? extrapolatedPoint({ECALShowerMax}).position().y() : -999", "float", precision=14, doc="y position at shower max in ECAL"), + positionAtECAL_z = Var(f"? extrapolatedPoint({ECALShowerMax}).isValid() ? extrapolatedPoint({ECALShowerMax}).position().z() : -999", "float", precision=14, doc="z position at shower max in ECAL"), + positionAtHCAL_x = Var(f"? extrapolatedPoint({HCALEntrance}).isValid() ? extrapolatedPoint({HCALEntrance}).position().x() : -999", "float", precision=14, doc="x position at HCAL entrance"), + positionAtHCAL_y = Var(f"? extrapolatedPoint({HCALEntrance}).isValid() ? extrapolatedPoint({HCALEntrance}).position().y() : -999", "float", precision=14, doc="y position at HCAL entrance"), + positionAtHCAL_z = Var(f"? extrapolatedPoint({HCALEntrance}).isValid() ? extrapolatedPoint({HCALEntrance}).position().z() : -999", "float", precision=14, doc="z position at HCAL entrance"), + ) +) + +pfTrackTables = cms.Sequence( + pfTrackTable +) diff --git a/PhysicsTools/NanoAOD/interface/HitPositionTableProducer.h b/PhysicsTools/NanoAOD/interface/HitPositionTableProducer.h new file mode 100644 index 0000000000000..28325d5e50909 --- /dev/null +++ b/PhysicsTools/NanoAOD/interface/HitPositionTableProducer.h @@ -0,0 +1,65 @@ +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "DataFormats/NanoAOD/interface/FlatTable.h" +#include "DataFormats/Common/interface/View.h" +#include "CommonTools/Utils/interface/StringCutObjectSelector.h" +#include "DataFormats/GeometryVector/interface/GlobalPoint.h" + +#include +#include + +template +class HitPositionTableProducer : public edm::stream::EDProducer<> { +public: + HitPositionTableProducer(edm::ParameterSet const& params) + : name_(params.getParameter("name")), + doc_(params.getParameter("doc")), + src_(consumes(params.getParameter("src"))), + cut_(params.getParameter("cut"), true) { + produces(); + } + + ~HitPositionTableProducer() override {} + + GlobalPoint virtual positionFromHit(const typename T::value_type& hit) { + throw cms::Exception("HitPositionTableProducer") << "Virtual function positionFromHist is not implemented!"; + } + + void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override { + edm::Handle objs; + iEvent.getByToken(src_, objs); + + std::vector xvals; + std::vector yvals; + std::vector zvals; + std::vector hitrvals; + for (const auto& obj : *objs) { + if (cut_(obj)) { + auto position = positionFromHit(obj); + xvals.emplace_back(position.x()); + yvals.emplace_back(position.y()); + zvals.emplace_back(position.z()); + //hitrvals.emplace_back(radiusFromHit(obj)); + } + } + + auto tab = std::make_unique(xvals.size(), name_, false, true); + tab->addColumn("x", xvals, "x position"); + tab->addColumn("y", yvals, "y position"); + tab->addColumn("z", zvals, "z position"); + //addExtraColumns(tab); + //tab->addColumn("hitr", hitrvals, "radius"); + + iEvent.put(std::move(tab)); + } + +protected: + const std::string name_, doc_; + const edm::EDGetTokenT src_; + const StringCutObjectSelector cut_; +}; + + From 7ee286867f3f90ec662474948a561a3738ee0f2b Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Thu, 29 Sep 2022 21:37:38 +0200 Subject: [PATCH 2/3] HGC sim hits from common producer --- .../Applications/python/ConfigBuilder.py | 7 + DPGAnalysis/CommonNanoAOD/BuildFile.xml | 6 - .../CommonNanoAOD/plugins/BuildFile.xml | 19 --- .../plugins/HitPositionTableProducer.cc | 159 ------------------ .../HGCalNanoAOD/plugins/BuildFile.xml | 1 + .../plugins/HGCALHitPositionTableProducer.cc | 60 +++++++ ...dexFromOneToManyQualAssociationProducer.cc | 12 +- .../HGCalNanoAOD/python/caloParticles_cff.py | 42 ----- .../HGCalNanoAOD/python/hgcRecHits_cff.py | 2 +- .../HGCalNanoAOD/python/hgcSimHits_cff.py | 2 +- .../HGCalNanoAOD/python/layerClusters_cff.py | 48 +++++- .../HGCalNanoAOD/python/nanoHGCML_cff.py | 26 +-- .../HGCalNanoAOD/python/simClusters_cff.py | 112 ------------ DPGAnalysis/PFNanoAOD/python/pfTruth_cff.py | 2 +- .../python/trackingParticles_cff.py | 21 ++- DPGAnalysis/TrackNanoAOD/python/tracks_cff.py | 73 ++++---- .../interface/HGCalTrackPropagator.h | 8 +- 17 files changed, 193 insertions(+), 407 deletions(-) delete mode 100644 DPGAnalysis/CommonNanoAOD/BuildFile.xml delete mode 100644 DPGAnalysis/CommonNanoAOD/plugins/BuildFile.xml delete mode 100644 DPGAnalysis/CommonNanoAOD/plugins/HitPositionTableProducer.cc create mode 100644 DPGAnalysis/HGCalNanoAOD/plugins/HGCALHitPositionTableProducer.cc delete mode 100644 DPGAnalysis/HGCalNanoAOD/python/caloParticles_cff.py delete mode 100644 DPGAnalysis/HGCalNanoAOD/python/simClusters_cff.py diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index 5397ed1505ee1..0f8790e708b72 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -969,6 +969,7 @@ def define_Configs(self): self.PATDefaultCFF="Configuration/StandardSequences/PAT_cff" self.NANODefaultCFF="PhysicsTools/NanoAOD/nano_cff" self.NANOGENDefaultCFF="PhysicsTools/NanoAOD/nanogen_cff" + self.PFNANODefaultCFF="DPGAnalysis/PFNanoAOD/pfNano_cff" self.SKIMDefaultCFF="Configuration/StandardSequences/Skims_cff" self.POSTRECODefaultCFF="Configuration/StandardSequences/PostRecoGenerator_cff" self.VALIDATIONDefaultCFF="Configuration/StandardSequences/Validation_cff" @@ -1018,6 +1019,7 @@ def define_Configs(self): self.PATGENDefaultSeq='miniGEN' #TODO: Check based of file input self.NANOGENDefaultSeq='nanogenSequence' + self.PFNANODefaultSeq='pfNanoSequence' self.NANODefaultSeq='nanoSequence' self.EVTCONTDefaultCFF="Configuration/EventContent/EventContent_cff" @@ -1741,6 +1743,11 @@ def prepare_NANOGEN(self, sequence = "nanoAOD"): else: self._options.customisation_file.insert(0, '.'.join([self.NANOGENDefaultCFF, custom])) + def prepare_PFNANO(self, sequence = "pfNano"): + ''' Enrich the schedule with PFNANO''' + self.loadDefaultOrSpecifiedCFF(sequence,self.PFNANODefaultCFF) + self.scheduleSequence(sequence.split('.')[-1],'nanoAOD_step') + def prepare_SKIM(self, sequence = "all"): ''' Enrich the schedule with skimming fragments''' skimConfig = self.loadDefaultOrSpecifiedCFF(sequence,self.SKIMDefaultCFF) diff --git a/DPGAnalysis/CommonNanoAOD/BuildFile.xml b/DPGAnalysis/CommonNanoAOD/BuildFile.xml deleted file mode 100644 index 6cc75a882ba98..0000000000000 --- a/DPGAnalysis/CommonNanoAOD/BuildFile.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/DPGAnalysis/CommonNanoAOD/plugins/BuildFile.xml b/DPGAnalysis/CommonNanoAOD/plugins/BuildFile.xml deleted file mode 100644 index dc57b6da53c8e..0000000000000 --- a/DPGAnalysis/CommonNanoAOD/plugins/BuildFile.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/DPGAnalysis/CommonNanoAOD/plugins/HitPositionTableProducer.cc b/DPGAnalysis/CommonNanoAOD/plugins/HitPositionTableProducer.cc deleted file mode 100644 index fd101d3783260..0000000000000 --- a/DPGAnalysis/CommonNanoAOD/plugins/HitPositionTableProducer.cc +++ /dev/null @@ -1,159 +0,0 @@ -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "DataFormats/NanoAOD/interface/FlatTable.h" -#include "DataFormats/Common/interface/View.h" -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "SimDataFormats/TrackingHit/interface/PSimHit.h" -#include "CommonTools/Utils/interface/StringCutObjectSelector.h" - -#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" - -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/CSCGeometry/interface/CSCGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" -#include "SimDataFormats/TrackingHit/interface/PSimHit.h" -#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" -#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" -#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" - -#include -#include - -template -class HitPositionTableProducer : public edm::stream::EDProducer<> { -public: - HitPositionTableProducer(edm::ParameterSet const& params) - : name_(params.getParameter("name")), - doc_(params.getParameter("doc")), - src_(consumes(params.getParameter("src"))), - cut_(params.getParameter("cut"), true) { - produces(); - } - - ~HitPositionTableProducer() override {} - - void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override { - // TODO: check that the geometry exists - iSetup.get().get(caloGeom_); - rhtools_.setGeometry(*caloGeom_); - iSetup.get().get("idealForDigi", trackGeom_); - // Believe this is ideal, but we're not so precise here... - iSetup.get().get(globalGeom_); - } - - GlobalPoint positionFromHit(const PCaloHit& hit) { - DetId id = hit.id(); - return positionFromDetId(id); - } - - GlobalPoint positionFromHit(const CaloRecHit& hit) { return positionFromDetId(hit.detid()); } - - // Should really only be used for HGCAL - GlobalPoint positionFromDetId(DetId id) { - DetId::Detector det = id.det(); - if (det == DetId::Hcal || det == DetId::HGCalEE || det == DetId::HGCalHSi || det == DetId::HGCalHSc) { - return rhtools_.getPosition(id); - } else { - throw cms::Exception("HitPositionTableProducer") << "Unsupported DetId type"; - } - } - - GlobalPoint positionFromHit(const PSimHit& hit) { - auto detId = DetId(hit.detUnitId()); - auto surface = detId.det() == DetId::Muon ? globalGeom_->idToDet(hit.detUnitId())->surface() - : trackGeom_->idToDet(hit.detUnitId())->surface(); - GlobalPoint position = surface.toGlobal(hit.localPosition()); - return position; - } - - float radiusFromHit(const PCaloHit& hit) { - DetId id = hit.id(); - return radiusFromDetId(id); - } - - float radiusFromHit(const CaloRecHit& hit) { - return radiusFromDetId(hit.detid()); - } - - // Should really only be used for HGCAL, cartesian - float radiusFromDetId(DetId id) { - DetId::Detector det = id.det(); - if (det == DetId::Hcal || det == DetId::HGCalEE || det == DetId::HGCalHSi || det == DetId::HGCalHSc) { - if(rhtools_.isSilicon(id)){ - return rhtools_.getRadiusToSide(id); - } - else if(rhtools_.isScintillator(id)){ - auto detadphi = rhtools_.getScintDEtaDPhi(id); - float dphi = detadphi.second;//same in both - auto pos = rhtools_.getPosition(id); - float r = pos.transverse(); - return r * sin(dphi)/2.;//this is anyway approximate - } - else{ - return 0.; - } - - } else { - return 0; //no except here - } - } - - float radiusFromHit(const PSimHit& hit) { - auto detId = DetId(hit.detUnitId()); - return radiusFromDetId(detId); - } - - void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override { - edm::Handle objs; - iEvent.getByToken(src_, objs); - - std::vector xvals; - std::vector yvals; - std::vector zvals; - std::vector hitrvals; - for (const auto& obj : *objs) { - if (cut_(obj)) { - auto position = positionFromHit(obj); - xvals.emplace_back(position.x()); - yvals.emplace_back(position.y()); - zvals.emplace_back(position.z()); - hitrvals.emplace_back(radiusFromHit(obj)); - } - } - - auto tab = std::make_unique(xvals.size(), name_, false, true); - tab->addColumn("x", xvals, "x position"); - tab->addColumn("y", yvals, "y position"); - tab->addColumn("z", zvals, "z position"); - tab->addColumn("hitr", hitrvals, "radius"); - - iEvent.put(std::move(tab)); - } - -protected: - const std::string name_, doc_; - const edm::EDGetTokenT src_; - const StringCutObjectSelector cut_; - edm::ESHandle caloGeom_; - edm::ESHandle trackGeom_; - edm::ESHandle globalGeom_; - hgcal::RecHitTools rhtools_; -}; - -#include "FWCore/Framework/interface/MakerMacros.h" -typedef HitPositionTableProducer> PCaloHitPositionTableProducer; -typedef HitPositionTableProducer> PSimHitPositionTableProducer; -typedef HitPositionTableProducer HGCRecHitPositionTableProducer; -DEFINE_FWK_MODULE(HGCRecHitPositionTableProducer); -DEFINE_FWK_MODULE(PCaloHitPositionTableProducer); -DEFINE_FWK_MODULE(PSimHitPositionTableProducer); diff --git a/DPGAnalysis/HGCalNanoAOD/plugins/BuildFile.xml b/DPGAnalysis/HGCalNanoAOD/plugins/BuildFile.xml index f5ae82be55fc7..bb24462d736d8 100644 --- a/DPGAnalysis/HGCalNanoAOD/plugins/BuildFile.xml +++ b/DPGAnalysis/HGCalNanoAOD/plugins/BuildFile.xml @@ -13,6 +13,7 @@ + diff --git a/DPGAnalysis/HGCalNanoAOD/plugins/HGCALHitPositionTableProducer.cc b/DPGAnalysis/HGCalNanoAOD/plugins/HGCALHitPositionTableProducer.cc new file mode 100644 index 0000000000000..a78d2289cda86 --- /dev/null +++ b/DPGAnalysis/HGCalNanoAOD/plugins/HGCALHitPositionTableProducer.cc @@ -0,0 +1,60 @@ +#include "PhysicsTools/NanoAOD/interface/HitPositionTableProducer.h" +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" +#include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" + +#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" + +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" + +template +class HGCalHitPositionTableProducer : public HitPositionTableProducer> { +//class HGCalHitPositionTableProducer : public HitPositionTableProducer> { +public: + HGCalHitPositionTableProducer(edm::ParameterSet const& params) + : HitPositionTableProducer>(params), + caloGeoToken_(edm::stream::EDProducer<>::esConsumes()) {} + + ~HGCalHitPositionTableProducer() override {} + + GlobalPoint positionFromHit(const CaloRecHit& hit) { + DetId detId = hit.detid(); + return positionFromDetId(detId); + } + + GlobalPoint positionFromHit(const PCaloHit& hit) { + DetId detId = hit.id(); + return positionFromDetId(detId); + } + + void beginRun(const edm::Run&, const edm::EventSetup& iSetup) override { + auto& geom = iSetup.getData(caloGeoToken_); + rhtools_.setGeometry(geom); + } + + GlobalPoint positionFromDetId(DetId id) { + DetId::Detector det = id.det(); + if (det == DetId::HGCalEE || det == DetId::HGCalHSi || det == DetId::HGCalHSc) { + return rhtools_.getPosition(id); + } else { + throw cms::Exception("HGCalHitPositionTableProducer") << "Unsupported DetId type"; + } + } + +protected: + edm::ESGetToken caloGeoToken_; + hgcal::RecHitTools rhtools_; +}; + +#include "FWCore/Framework/interface/MakerMacros.h" +//typedef HGCalHitPositionTableProducer HGCalRecHitPositionTableProducer; +typedef HGCalHitPositionTableProducer HGCalRecHitPositionTableProducer; +typedef HGCalHitPositionTableProducer HGCalSimHitPositionTableProducer; +DEFINE_FWK_MODULE(HGCalRecHitPositionTableProducer); +DEFINE_FWK_MODULE(HGCalSimHitPositionTableProducer); diff --git a/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromOneToManyQualAssociationProducer.cc b/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromOneToManyQualAssociationProducer.cc index 3f5991138c28b..12e5562a37077 100644 --- a/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromOneToManyQualAssociationProducer.cc +++ b/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromOneToManyQualAssociationProducer.cc @@ -1,21 +1,25 @@ #include "PhysicsTools/NanoAOD/interface/ObjectIndexFromOneToManyQualAssociationProducer.h" -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/CaloRecHit/interface/CaloCluster.h" #include "FWCore/Framework/interface/MakerMacros.h" typedef ObjectIndexFromOneToManyQualAssociationTableProducer, SimClusterCollection, float> LayerClusterToSimClusterIndexTableProducer; -typedef ObjectIndexFromOneToManyQualAssociationTableProducer - CaloRecHitToSimClusterIndexTableProducer; +typedef ObjectIndexFromOneToManyQualAssociationTableProducer, CaloParticleCollection, float> + LayerClusterToCaloParticleIndexTableProducer; typedef ObjectIndexFromOneToManyQualAssociationTableProducer, float> HGCRecHitToLayerClusterIndexTableProducer; typedef ObjectIndexFromOneToManyQualAssociationTableProducer SimClusterToSimClustersIndexTableProducer; +typedef ObjectIndexFromOneToManyQualAssociationTableProducer + HGCRecHitToSimClusterIndexTableProducer; DEFINE_FWK_MODULE(LayerClusterToSimClusterIndexTableProducer); +DEFINE_FWK_MODULE(LayerClusterToCaloParticleIndexTableProducer); DEFINE_FWK_MODULE(HGCRecHitToLayerClusterIndexTableProducer); -DEFINE_FWK_MODULE(CaloRecHitToSimClusterIndexTableProducer); +DEFINE_FWK_MODULE(HGCRecHitToSimClusterIndexTableProducer); DEFINE_FWK_MODULE(SimClusterToSimClustersIndexTableProducer); diff --git a/DPGAnalysis/HGCalNanoAOD/python/caloParticles_cff.py b/DPGAnalysis/HGCalNanoAOD/python/caloParticles_cff.py deleted file mode 100644 index 30b85d1252f41..0000000000000 --- a/DPGAnalysis/HGCalNanoAOD/python/caloParticles_cff.py +++ /dev/null @@ -1,42 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from PhysicsTools.NanoAOD.common_cff import CandVars,Var -from DPGAnalysis.HGCalNanoAOD.simClusters_cff import mergedSimClusterTable - -caloParticleTable = cms.EDProducer("SimpleCaloParticleFlatTableProducer", - src = cms.InputTag("mix:MergedCaloTruth"), - cut = cms.string(""), - name = cms.string("CaloPart"), - doc = cms.string("CaloPart"), - singleton = cms.bool(False), # the number of entries is variable - extension = cms.bool(False), # this is the main table for the muons - variables = cms.PSet(CandVars, - eventId = Var('eventId().event()', 'int', precision=-1, doc='Event ID (can be used to identify pileup'), - bunchCrossing = Var('eventId().bunchCrossing()', 'int', precision=-1, doc='bunch crossing (can be used to identify pileup'), - rawEventId = Var('eventId().rawId()', 'int', precision=-1, doc='Raw event ID (can be used to identify pileup'), - simEnergy = Var('simEnergy', 'float', precision=-1, doc='Sum of the simHit energy'), - energy = Var('energy', 'float', precision=-1, doc='energy of the four vector'), - nGenPart = Var('genParticles().size()', 'int', precision=-1, doc='Number of associated gen particles'), - GenPartIdx = Var('? genParticles.size() ? genParticles().at(0).key() : -1', 'int', precision=-1, doc='Number of associated gen particles'), - nSimHit = Var('numberOfSimHits', 'int', precision=-1, doc='Number of simhits'), - trackId = Var('g4Tracks().at(0).trackId', 'int', precision=-1, doc='Geant4 track ID of first track'), - nSimTrack = Var('g4Tracks().size', 'int', precision=-1, doc='Number of associated simtracks'), - ) -) - -mergedSCCaloParts = cms.EDProducer("CaloParticleToMergedSimClustersProducer", - caloParticles = cms.InputTag("mix:MergedCaloTruth"), - mergedSimClusters = cms.InputTag("hgcSimTruth"), - unmergedToMergedSimClusters = cms.InputTag("hgcSimTruth"), -) - -mergedSCToCaloPartTable = cms.EDProducer("SimClusterToCaloParticleIndexTableProducer", - cut = mergedSimClusterTable.cut, - src = mergedSimClusterTable.src, - objName = mergedSimClusterTable.name, - branchName = caloParticleTable.name, - objMap = cms.InputTag("mergedSCCaloParts"), - docString = cms.string("Index of CaloParticle containing MergedSimCluster") -) - -caloParticleTables = cms.Sequence(caloParticleTable) -caloParticleMergedTables = cms.Sequence(mergedSCCaloParts+mergedSCToCaloPartTable) diff --git a/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py b/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py index a71f056f11265..2962c1ea870ad 100644 --- a/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py +++ b/DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py @@ -21,7 +21,7 @@ ) ) -hgcRecHitsPositionTable = cms.EDProducer("HGCALRecHitPositionTableProducer", +hgcRecHitsPositionTable = cms.EDProducer("HGCalRecHitPositionTableProducer", src = hgcRecHitsTable.src, cut = hgcRecHitsTable.cut, name = hgcRecHitsTable.name, diff --git a/DPGAnalysis/HGCalNanoAOD/python/hgcSimHits_cff.py b/DPGAnalysis/HGCalNanoAOD/python/hgcSimHits_cff.py index 108c873b32d1e..47cae600f0026 100644 --- a/DPGAnalysis/HGCalNanoAOD/python/hgcSimHits_cff.py +++ b/DPGAnalysis/HGCalNanoAOD/python/hgcSimHits_cff.py @@ -42,7 +42,7 @@ hgcHEbackHitsToSimClusterTable.objName = hgcHEbackSimHitsTable.name hgcHEbackHitsToSimClusterTable.objMap = "mix:simHitHGCHEbackToSimCluster" -hgcEESimHitsPositionTable = cms.EDProducer("PCaloHitPositionTableProducer", +hgcEESimHitsPositionTable = cms.EDProducer("HGCalSimHitPositionTableProducer", src = hgcEESimHitsTable.src, cut = hgcEESimHitsTable.cut, name = hgcEESimHitsTable.name, diff --git a/DPGAnalysis/HGCalNanoAOD/python/layerClusters_cff.py b/DPGAnalysis/HGCalNanoAOD/python/layerClusters_cff.py index 5ce81c457863b..2245466d42691 100644 --- a/DPGAnalysis/HGCalNanoAOD/python/layerClusters_cff.py +++ b/DPGAnalysis/HGCalNanoAOD/python/layerClusters_cff.py @@ -1,5 +1,13 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import P3Vars,Var +from DPGAnalysis.HGCalNanoAOD.hgcRecHits_cff import hgcRecHitsTable +from DPGAnalysis.CaloNanoAOD.simClusters_cff import simClusterTable +from DPGAnalysis.CaloNanoAOD.caloParticles_cff import caloParticleTable +# TODO: Use this producer in other places +from RecoLocalCalo.HGCalRecProducers.hgcalRecHitMapProducer_cfi import hgcalRecHitMapProducer +from SimCalorimetry.HGCalSimProducers.hgcHitAssociation_cfi import lcAssocByEnergyScoreProducer, scAssocByEnergyScoreProducer +from SimCalorimetry.HGCalAssociatorProducers.LCToCPAssociation_cfi import layerClusterCaloParticleAssociation +from SimCalorimetry.HGCalAssociatorProducers.LCToSCAssociation_cfi import layerClusterSimClusterAssociation layerClusterTable = cms.EDProducer("SimpleCaloClusterFlatTableProducer", src = cms.InputTag("hgcalLayerClusters"), @@ -24,11 +32,41 @@ cut = layerClusterTable.cut, src = layerClusterTable.src, objName = layerClusterTable.name, - branchName = cms.string("SimCluster"), - objMap = cms.InputTag("layerClusterCaloParticleAssociationProducer"), - docString = cms.string("Index of SimCluster matched to LayerCluster"), - bestMatchTable = cms.untracked.bool(True) + branchName = simClusterTable.name, + objMap = cms.InputTag("layerClusterSimClusterAssociation"), + docString = cms.string("Index of SimCluster matched to LayerCluster") ) -layerClusterTables = cms.Sequence(layerClusterTable+layerClusterToSimClusterTable) +layerClusterToCaloParticleTable = cms.EDProducer("LayerClusterToCaloParticleIndexTableProducer", + cut = layerClusterTable.cut, + src = layerClusterTable.src, + objName = layerClusterTable.name, + branchName = caloParticleTable.name, + objMap = cms.InputTag("layerClusterCaloParticleAssociation"), + docString = cms.string("Index of CaloParticle matched to LayerCluster") +) + +hgcRecHitsToLayerClusters = cms.EDProducer("RecHitToLayerClusterAssociationProducer", + caloRecHits = cms.VInputTag("hgcRecHits"), + layerClusters = cms.InputTag("hgcalLayerClusters"), +) + +hgcRecHitsToLayerClusterTable = cms.EDProducer("HGCRecHitToLayerClusterIndexTableProducer", + cut = hgcRecHitsTable.cut, + src = hgcRecHitsTable.src, + objName = hgcRecHitsTable.name, + branchName = cms.string("LayerCluster"), + objMap = cms.InputTag("hgcRecHitsToLayerClusters:hgcRecHitsToLayerCluster"), + docString = cms.string("LayerCluster assigned largest RecHit fraction") +) +layerClusterTables = cms.Task(layerClusterTable, + hgcalRecHitMapProducer, + lcAssocByEnergyScoreProducer, + scAssocByEnergyScoreProducer, + layerClusterCaloParticleAssociation, + layerClusterSimClusterAssociation, + layerClusterToSimClusterTable, + layerClusterToCaloParticleTable, + hgcRecHitsToLayerClusters, + hgcRecHitsToLayerClusterTable) diff --git a/DPGAnalysis/HGCalNanoAOD/python/nanoHGCML_cff.py b/DPGAnalysis/HGCalNanoAOD/python/nanoHGCML_cff.py index 3805a6c4e7eee..ecfeeaa24094b 100644 --- a/DPGAnalysis/HGCalNanoAOD/python/nanoHGCML_cff.py +++ b/DPGAnalysis/HGCalNanoAOD/python/nanoHGCML_cff.py @@ -7,9 +7,9 @@ from DPGAnalysis.HGCalNanoAOD.hgcSimTracks_cff import * from DPGAnalysis.HGCalNanoAOD.hgcRecHits_cff import * from DPGAnalysis.HGCalNanoAOD.hgcRecHitSimAssociations_cff import * -from DPGAnalysis.HGCalNanoAOD.simClusters_cff import * +from DPGAnalysis.CaloNanoAOD.simClusters_cff import * +from DPGAnalysis.CaloNanoAOD.caloParticles_cff import * from DPGAnalysis.HGCalNanoAOD.layerClusters_cff import * -from DPGAnalysis.HGCalNanoAOD.caloParticles_cff import * from DPGAnalysis.TrackNanoAOD.trackSimHits_cff import * from DPGAnalysis.TrackNanoAOD.trackingParticles_cff import * from DPGAnalysis.TrackNanoAOD.tracks_cff import * @@ -29,24 +29,28 @@ nanoHGCMLSequence = cms.Sequence(nanoMetadata+ hgcRecHits+ #so that modules can use them genVertexTable+genVertexT0Table+genParticleTable+ - layerClusterTables+ + cms.Sequence(layerClusterTables)+ simTrackTables+ hgcSimHitsSequence+ - trackerSimHitTables+ + # TODO: Fix producer and allow adding via configuration + #trackerSimHitTables+ simClusterTables+ trackingParticleTables+ caloParticleTables ) -nanoHGCMLRecoSequence = cms.Sequence(hgcRecHitsSequence+ - hgcRecHitSimAssociationSequence+ - pfCandTable+pfTruth+ - pfTICLCandTable+ - trackTables+ - trackSCAssocTable) +nanoHGCMLRecoSequence = cms.Sequence( + nanoHGCMLSequence+ + cms.Sequence(hgcRecHitsTask)+ + cms.Sequence(hgcRecHitSimAssociationTask)+ + cms.Sequence(trackTables)+ + trackingParticleTables+ + pfCandTable+pfTruth+ + pfTICLCandTable +) def customizeReco(process): - process.nanoHGCMLSequence.insert(-1, nanoHGCMLRecoSequence) + process.nanoHGCMLSequence = nanoHGCMLRecoSequence return process def customizeNoMergedCaloTruth(process): diff --git a/DPGAnalysis/HGCalNanoAOD/python/simClusters_cff.py b/DPGAnalysis/HGCalNanoAOD/python/simClusters_cff.py deleted file mode 100644 index 3fe7a95547abd..0000000000000 --- a/DPGAnalysis/HGCalNanoAOD/python/simClusters_cff.py +++ /dev/null @@ -1,112 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from PhysicsTools.NanoAOD.common_cff import CandVars,Var - -simClusterTable = cms.EDProducer("SimpleSimClusterFlatTableProducer", - src = cms.InputTag("mix:MergedCaloTruth"), - cut = cms.string(""), - name = cms.string("SimCluster"), - doc = cms.string("SimCluster information"), - singleton = cms.bool(False), # the number of entries is variable - extension = cms.bool(False), # this is the main table for the muons - variables = cms.PSet(CandVars, - eventId = Var('eventId().event()', 'int', precision=-1, doc='Event ID (can be used to identify pileup'), - bunchCrossing = Var('eventId().bunchCrossing()', 'int', precision=-1, doc='bunch crossing (can be used to identify pileup'), - rawEventId = Var('eventId().rawId()', 'int', precision=-1, doc='Raw event ID (can be used to identify pileup'), - lastPos_x = Var('g4Tracks.at(0).trackerSurfacePosition().x()', 'float', precision=14, doc='track x final position'), - lastPos_y = Var('g4Tracks.at(0).trackerSurfacePosition().y()', 'float', precision=14, doc='track y final position'), - lastPos_z = Var('g4Tracks.at(0).trackerSurfacePosition().z()', 'float', precision=14, doc='track z final position'), - # NOTE: This is the cms-pepr approach, which is needed for merged simclusters - impactPoint_x = Var('impactPoint().x()', 'float', precision=14, doc='x position'), - impactPoint_y = Var('impactPoint().y()', 'float', precision=14, doc='y position'), - impactPoint_z = Var('impactPoint().z()', 'float', precision=14, doc='z position'), - impactPoint_t = Var('impactPoint().t()', 'float', precision=14, doc='Impact time'), - impactPoint_eta = Var('impactPoint().eta()', 'float', precision=14, doc='eta at boundary'), - impactPoint_phi = Var('impactPoint().phi()', 'float', precision=14, doc='phi at boundary'), - # For stupid reasons lost on me, the nsimhits_ variable is uninitialized, and hits_ (which are really simhits) - # are often referred to as rechits in the SimCluster class - nHits = Var('numberOfRecHits', 'int', precision=-1, doc='number of simhits'), - sumHitEnergy = Var('energy', 'float', precision=14, doc='total energy of simhits'), - boundaryPmag = Var('impactMomentum.P()', 'float', precision=14, doc='magnitude of the boundary 3-momentum vector'), - boundaryP4 = Var('impactMomentum.mag()', 'float', precision=14, doc='magnitude of four vector'), - boundaryEnergy = Var('impactMomentum.energy()', 'float', precision=14, doc='magnitude of four vector'), - boundaryEnergyNoMu = Var('impactMomentumNoMu.energy()', 'float', precision=14, doc='magnitude of four vector'), - boundaryPt = Var('impactMomentum.pt()', 'float', precision=14, doc='magnitude of four vector'), - trackId = Var('g4Tracks().at(0).trackId()', 'int', precision=-1, doc='Geant track id'), - trackIdAtBoundary = Var('g4Tracks().at(0).getIDAtBoundary()', 'int', precision=-1, doc='Track ID at boundary'), - hasHGCALHit = Var('hasHGCALHit', 'bool', doc='Has at least 1 simHit in HGCAL'), - allHitsHGCAL = Var('allHitsHGCAL', 'bool', doc='all simHits are in HGCAL'), - onHGCFrontFace = Var('abs(impactPoint().z()) - 322 < 1', 'bool', doc='SimCluster position is consistent with the front of the HGCAL'), - isTrainable = Var('numberOfRecHits > 5 && allHitsHGCAL', 'bool', doc='Should be used for training'), - ) -) - - -simClusterToCaloPart = cms.EDProducer("SimClusterToCaloParticleAssociationProducer", - caloParticles = cms.InputTag("mix:MergedCaloTruth"), - simClusters = cms.InputTag("mix:MergedCaloTruth"), -) - -simClusterToCaloPartTable = cms.EDProducer("SimClusterToCaloParticleIndexTableProducer", - cut = simClusterTable.cut, - src = simClusterTable.src, - objName = simClusterTable.name, - branchName = cms.string("CaloPart"), - objMap = cms.InputTag("simClusterToCaloPart"), - docString = cms.string("Index of CaloPart containing SimCluster") -) - - -hgcSimTruth = cms.EDProducer("SimClusterMerger",#"simmerger","SimClusterMerger" - - useNLayers = cms.int32(2), - searchRadiusScale = cms.double(2.), - clusterRadiusScale = cms.double(1.), - - mergeRadiusScale = cms.double(7.),#13 is about 10 layers in CE - energyContainment = cms.double(1.1), - - smear = cms.double(-0.0), - highEfracThreshold = cms.double(0.85), - connectThreshold = cms.double(.3), - - relOverlapDistance = cms.double(.9),# dist/(merged radius + sensor radius) - - simClusters= cms.InputTag("mix:MergedCaloTruth"), - simVertices= cms.InputTag("g4SimHits"), - simTracks= cms.InputTag("g4SimHits"), - caloRecHits = cms.InputTag("hgcRecHits") - - #caloSimHits = cms.InputTag("g4SimHits") -) - -hgcSimTruthDR = cms.EDProducer("HGCTruthProducer") - -simClusterToMergedSCTable = cms.EDProducer("SimClusterToSimClusterIndexTableProducer", - cut = simClusterTable.cut, - src = simClusterTable.src, - objName = simClusterTable.name, - branchName = cms.string("MergedSimCluster"), - objMap = cms.InputTag("hgcSimTruth"), - docString = cms.string("Index of Merged SimCluster containing SimCluster") -) - -mergedSimClusterTable = simClusterTable.clone() -mergedSimClusterTable.src = "hgcSimTruth" -mergedSimClusterTable.name = "MergedSimCluster" - -mergedSimClusterDRTable = simClusterTable.clone() -mergedSimClusterDRTable.src = "hgcSimTruthDR" -mergedSimClusterDRTable.name = "MergedByDRSimCluster" - -mergedToUnmergedSCTable = cms.EDProducer("SimClusterToSimClustersIndexTableProducer", - cut = mergedSimClusterTable.cut, - src = mergedSimClusterTable.src, - objName = mergedSimClusterTable.name, - branchName = cms.string("SimCluster"), - objMap = cms.InputTag("hgcSimTruth"), - docString = cms.string("Index of Merged SimCluster containing SimCluster") -) - -simClusterTables = cms.Sequence(simClusterTable+simClusterToCaloPart+simClusterToCaloPartTable) - -mergedSimClusterTables = cms.Sequence(hgcSimTruth+mergedSimClusterTable+hgcSimTruthDR+mergedSimClusterDRTable+mergedToUnmergedSCTable+simClusterToMergedSCTable) diff --git a/DPGAnalysis/PFNanoAOD/python/pfTruth_cff.py b/DPGAnalysis/PFNanoAOD/python/pfTruth_cff.py index 766e3dc009bd2..c98347c44ca77 100644 --- a/DPGAnalysis/PFNanoAOD/python/pfTruth_cff.py +++ b/DPGAnalysis/PFNanoAOD/python/pfTruth_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import CandVars,Var -from DPGAnalysis.HGCalNanoAOD.simClusters_cff import simClusterTable +from DPGAnalysis.CaloNanoAOD.simClusters_cff import simClusterTable from DPGAnalysis.HGCalNanoAOD.hgcRecHits_cff import hgcRecHitsTable from DPGAnalysis.TrackNanoAOD.trackingParticles_cff import trackingParticleTable from DPGAnalysis.TrackNanoAOD.tracks_cff import generalTrackTable diff --git a/DPGAnalysis/TrackNanoAOD/python/trackingParticles_cff.py b/DPGAnalysis/TrackNanoAOD/python/trackingParticles_cff.py index 6826c80117ea9..47ad148c3a950 100644 --- a/DPGAnalysis/TrackNanoAOD/python/trackingParticles_cff.py +++ b/DPGAnalysis/TrackNanoAOD/python/trackingParticles_cff.py @@ -1,5 +1,9 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import CandVars,Var +from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import * +from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import quickTrackAssociatorByHits +from SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi import trackingParticleRecoTrackAsssociation +from DPGAnalysis.TrackNanoAOD.tracks_cff import * trackingParticleTable = cms.EDProducer("SimpleTrackingParticleFlatTableProducer", src = cms.InputTag("mix:MergedTrackTruth"), @@ -37,4 +41,19 @@ docString = cms.string("Index of the matching reco::Tracks") ) -trackingParticleTables = cms.Sequence(trackingParticleTable+trackingParticleToSCTable) +trackToTrackingParticleTable = cms.EDProducer("TrackToTrackingParticleIndexTableProducer", + cut = generalTrackTable.cut, + src = generalTrackTable.src, + objName = generalTrackTable.name, + branchName = cms.string("TrackingPart"), + objMap = cms.InputTag("trackingParticleRecoTrackAsssociation"), + docString = cms.string("Index of the matching TrackingParticles") +) + +trackingParticleTables = cms.Sequence(trackingParticleTable + +tpClusterProducer + +quickTrackAssociatorByHits + +trackingParticleRecoTrackAsssociation + +trackToTrackingParticleTable + +trackingParticleToSCTable +) diff --git a/DPGAnalysis/TrackNanoAOD/python/tracks_cff.py b/DPGAnalysis/TrackNanoAOD/python/tracks_cff.py index 0ed2d21afd249..551956752d073 100644 --- a/DPGAnalysis/TrackNanoAOD/python/tracks_cff.py +++ b/DPGAnalysis/TrackNanoAOD/python/tracks_cff.py @@ -9,11 +9,10 @@ singleton = cms.bool(False), # the number of entries is variable extension = cms.bool(False), # this is the main table for the muons variables = cms.PSet(P3Vars, - p = Var("p", float, precision=14, doc="momentum"), charge = Var("charge", int, doc="electric charge"), normChiSq = Var("normalizedChi2", float, precision=14, doc="Chi^2/ndof"), - #numberOfValidHits = Var('numberOfValidHits()', 'int', precision=-1, doc='Number of valid hits in track'), - #numberOfLostHits = Var('numberOfLostHits()', 'int', precision=-1, doc='Number of lost hits in track'), + numberOfValidHits = Var('numberOfValidHits()', 'int', precision=-1, doc='Number of valid hits in track'), + numberOfLostHits = Var('numberOfLostHits()', 'int', precision=-1, doc='Number of lost hits in track'), Vtx_x = Var('vx()', 'float', precision=14, doc='parent vertex x pos'), Vtx_y = Var('vy()', 'float', precision=14, doc='parent vertex y pos'), Vtx_z = Var('vz()', 'float', precision=14, doc='parent vertex z pos'), @@ -26,37 +25,27 @@ ) ) -generalTrackHGCPositionTable = cms.EDProducer("TrackPositionAtHGCALTableProducer", - src = generalTrackTable.src, - name = generalTrackTable.name, - cut = generalTrackTable.cut, -) - -# conversions - trackConversionsTable = generalTrackTable.clone() trackConversionsTable.src = "conversionStepTracks" trackConversionsTable.name = "TrackConv" -trackConversionsHGCPositionTable = generalTrackHGCPositionTable.clone() -trackConversionsHGCPositionTable.src = trackConversionsTable.src -trackConversionsHGCPositionTable.name = trackConversionsTable.name -trackConversionsHGCPositionTable.cut = trackConversionsTable.cut - -# displaced - -#trackDisplacedTable = generalTrackTable.clone() -#trackDisplacedTable.src = "displacedTracks" -#trackDisplacedTable.name = "TrackDisp" -# -#trackDisplacedHGCPositionTable = generalTrackHGCPositionTable.clone() -#trackDisplacedHGCPositionTable.src = trackDisplacedTable.src -#trackDisplacedHGCPositionTable.name = trackDisplacedTable.name -#trackDisplacedHGCPositionTable.cut = trackDisplacedTable.cut - - - +trackDisplacedTable = cms.EDProducer("SimpleTrackFlatTableProducer", + src = cms.InputTag("displacedTracks"), + cut = cms.string(""), + name = cms.string("TrackDisp"), + doc = cms.string("reco::Track"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the muons + variables = cms.PSet(P3Vars, + charge = Var("charge", int, doc="electric charge"), + Vtx_x = Var('vx()', 'float', precision=14, doc='parent vertex x pos'), + Vtx_y = Var('vy()', 'float', precision=14, doc='parent vertex y pos'), + Vtx_z = Var('vz()', 'float', precision=14, doc='parent vertex z pos'), + Vtx_t = Var('t0', 'float', precision=14, doc='parent vertex time'), + ) +) +# These two aren't scheduled at the moment trackSimClusterMatch = cms.EDProducer("RecoTrackToSimClusterAssociation", tracks = cms.InputTag("generalTracks"), simclusters = cms.InputTag("hgcSimTruth"), @@ -70,22 +59,24 @@ bestMatchTable = cms.untracked.bool(True), branchName = cms.string("MergedSimCluster"), objMap = cms.InputTag("trackSimClusterMatch"), - docString = cms.string("Index of the best matching SimClusters (by pMag cluster/pMag track) within a dR cone of 0.4. Quality defined as pratio < 1 ? pratio : 2 - pratio") + docString = cms.string("Index of the best matching SimClusters (by pMag cluster/pMag track) within a dR cone of 0.4. Quality defined as pratio < 1 ? pratio : 2 - pratio") ) -trackToTrackingParticleTable = cms.EDProducer("TrackToTrackingParticleIndexTableProducer", - cut = generalTrackTable.cut, +generalTrackHGCPositionTable = cms.EDProducer("TrackPositionAtHGCALTableProducer", src = generalTrackTable.src, - objName = generalTrackTable.name, - branchName = cms.string("TrackingPart"), - objMap = cms.InputTag("trackingParticleRecoTrackAsssociation"), - docString = cms.string("Index of the matching TrackingParticles") + name = generalTrackTable.name, + cut = generalTrackTable.cut, ) +trackTables = cms.Task(generalTrackTable, + trackConversionsTable, + trackDisplacedTable +) -trackTables = cms.Sequence(generalTrackTable+generalTrackHGCPositionTable - +trackConversionsTable + trackConversionsHGCPositionTable - # +trackDisplacedTable + trackDisplacedHGCPositionTable - +trackToTrackingParticleTable) +from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal +from TrackingTools.MaterialEffects.MaterialPropagator_cfi import * -trackSCAssocTable = cms.Sequence(trackSimClusterMatch+trackSimClusterAssocTable) +phase2_hgcal.toReplaceWith( + trackTables, cms.Task(generalTrackTable, + trackConversionsTable, trackDisplacedTable, MaterialPropagator, generalTrackHGCPositionTable) +) diff --git a/RecoHGCal/GraphReco/interface/HGCalTrackPropagator.h b/RecoHGCal/GraphReco/interface/HGCalTrackPropagator.h index c47f2d1646000..d8d2cc99f27ff 100644 --- a/RecoHGCal/GraphReco/interface/HGCalTrackPropagator.h +++ b/RecoHGCal/GraphReco/interface/HGCalTrackPropagator.h @@ -48,9 +48,9 @@ class HGCalObjectPropagator{ enum zpos{ negZ=0, posZ=1}; HGCalObjectPropagator() {} HGCalObjectPropagator(edm::ConsumesCollector&& cc) : - bFieldToken_(cc.esConsumes()), - hgcEEToken_(cc.esConsumes(edm::ESInputTag{"", "HGCalEESensitive"})), - propagatorToken_(cc.esConsumes(edm::ESInputTag("", "PropagatorWithMaterial"))) {} + bFieldToken_(cc.esConsumes()), + hgcEEToken_(cc.esConsumes(edm::ESInputTag{"", "HGCalEESensitive"})), + propagatorToken_(cc.esConsumes(edm::ESInputTag("", "PropagatorWithMaterial"))) {} void setupRun(const edm::EventSetup& iSetup); @@ -58,7 +58,7 @@ class HGCalObjectPropagator{ private: edm::ESGetToken bFieldToken_; - edm::ESGetToken hgcEEToken_; + edm::ESGetToken hgcEEToken_; edm::ESGetToken propagatorToken_; bool setup_; const MagneticField* bField_; From 63b8bf13b825319fd8c1e5c01137a4f4cbfc1b44 Mon Sep 17 00:00:00 2001 From: Kenneth Long Date: Fri, 30 Sep 2022 00:35:07 +0200 Subject: [PATCH 3/3] A bit of reorganizing between Calo and HGCal nano folders --- .../CaloIndexFromAssociationTableProducer.cc | 2 ++ .../SimpleCaloObjectFlatTableProducer.cc | 4 ++++ .../ObjectIndexFromAssociationProducer.cc | 24 ------------------- .../SimClusterRecEnergyTableProducer.cc | 7 ------ .../SimpleHGCFlatTableProducerPlugins.cc | 22 ----------------- 5 files changed, 6 insertions(+), 53 deletions(-) delete mode 100644 DPGAnalysis/HGCalNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc delete mode 100644 DPGAnalysis/HGCalNanoAOD/plugins/SimpleHGCFlatTableProducerPlugins.cc diff --git a/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc b/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc index b56a5aa8c5a46..e88698824a872 100644 --- a/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc +++ b/DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc @@ -21,6 +21,8 @@ typedef ObjectIndexFromAssociationTableProducer SimClusterToSimClusterIndexTableProducer; +#include "FWCore/Framework/interface/MakerMacros.h" + DEFINE_FWK_MODULE(SimTrackToSimClusterIndexTableProducer); DEFINE_FWK_MODULE(CaloHitToSimClusterIndexTableProducer); DEFINE_FWK_MODULE(SimClusterToCaloParticleIndexTableProducer); diff --git a/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc b/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc index cd1e3b044668e..206dc856b374a 100644 --- a/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc +++ b/DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc @@ -11,8 +11,12 @@ typedef SimpleFlatTableProducer SimpleCaloRecHitFlatTableProducer; #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" typedef SimpleFlatTableProducer SimpleCaloParticleFlatTableProducer; +#include "DataFormats/CaloRecHit/interface/CaloCluster.h" +typedef SimpleFlatTableProducer SimpleCaloClusterFlatTableProducer; + #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(SimplePCaloHitFlatTableProducer); DEFINE_FWK_MODULE(SimpleCaloRecHitFlatTableProducer); DEFINE_FWK_MODULE(SimpleSimClusterFlatTableProducer); DEFINE_FWK_MODULE(SimpleCaloParticleFlatTableProducer); +DEFINE_FWK_MODULE(SimpleCaloClusterFlatTableProducer); diff --git a/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromAssociationProducer.cc b/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromAssociationProducer.cc index 636dc103d127a..2f1fae5868674 100644 --- a/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromAssociationProducer.cc +++ b/DPGAnalysis/HGCalNanoAOD/plugins/ObjectIndexFromAssociationProducer.cc @@ -1,39 +1,15 @@ #include "PhysicsTools/NanoAOD/interface/ObjectIndexFromAssociationProducer.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticleFwd.h" #include "SimDataFormats/PFAnalysis/interface/PFTruthParticle.h" #include "SimDataFormats/PFAnalysis/interface/PFTruthParticleFwd.h" -#include "SimDataFormats/Track/interface/SimTrack.h" -#include "SimDataFormats/Track/interface/SimTrackContainer.h" -#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "DataFormats/CaloRecHit/interface/CaloRecHit.h" -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" -#include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" #include "FWCore/Framework/interface/MakerMacros.h" -typedef ObjectIndexFromAssociationTableProducer - SimTrackToSimClusterIndexTableProducer; -typedef ObjectIndexFromAssociationTableProducer - CaloHitToSimClusterIndexTableProducer; typedef ObjectIndexFromAssociationTableProducer, reco::PFCandidateCollection> CaloRecHitToPFCandIndexTableProducer; -typedef ObjectIndexFromAssociationTableProducer, SimClusterCollection> - CaloRecHitToBestSimClusterIndexTableProducer; -typedef ObjectIndexFromAssociationTableProducer - SimClusterToCaloParticleIndexTableProducer; -typedef ObjectIndexFromAssociationTableProducer - SimClusterToSimClusterIndexTableProducer; typedef ObjectIndexFromAssociationTableProducer, PFTruthParticleCollection> CaloRecHitToPFTruthParticleIndexTableProducer; -DEFINE_FWK_MODULE(SimTrackToSimClusterIndexTableProducer); -DEFINE_FWK_MODULE(CaloHitToSimClusterIndexTableProducer); -DEFINE_FWK_MODULE(SimClusterToCaloParticleIndexTableProducer); -DEFINE_FWK_MODULE(SimClusterToSimClusterIndexTableProducer); DEFINE_FWK_MODULE(CaloRecHitToPFCandIndexTableProducer); -DEFINE_FWK_MODULE(CaloRecHitToBestSimClusterIndexTableProducer); DEFINE_FWK_MODULE(CaloRecHitToPFTruthParticleIndexTableProducer); diff --git a/DPGAnalysis/HGCalNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc b/DPGAnalysis/HGCalNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc deleted file mode 100644 index 295f71418841d..0000000000000 --- a/DPGAnalysis/HGCalNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "PhysicsTools/NanoAOD/interface/ObjectPropertyFromIndexMapTableProducer.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -#include "SimDataFormats/CaloAnalysis/interface/SimClusterFwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -typedef ObjectPropertyFromIndexMapTableProducer SimClusterRecEnergyTableProducer; -DEFINE_FWK_MODULE(SimClusterRecEnergyTableProducer); diff --git a/DPGAnalysis/HGCalNanoAOD/plugins/SimpleHGCFlatTableProducerPlugins.cc b/DPGAnalysis/HGCalNanoAOD/plugins/SimpleHGCFlatTableProducerPlugins.cc deleted file mode 100644 index 206dc856b374a..0000000000000 --- a/DPGAnalysis/HGCalNanoAOD/plugins/SimpleHGCFlatTableProducerPlugins.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" - -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -typedef SimpleFlatTableProducer SimpleSimClusterFlatTableProducer; - -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" -typedef SimpleFlatTableProducer SimplePCaloHitFlatTableProducer; -#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" -typedef SimpleFlatTableProducer SimpleCaloRecHitFlatTableProducer; - -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -typedef SimpleFlatTableProducer SimpleCaloParticleFlatTableProducer; - -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" -typedef SimpleFlatTableProducer SimpleCaloClusterFlatTableProducer; - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(SimplePCaloHitFlatTableProducer); -DEFINE_FWK_MODULE(SimpleCaloRecHitFlatTableProducer); -DEFINE_FWK_MODULE(SimpleSimClusterFlatTableProducer); -DEFINE_FWK_MODULE(SimpleCaloParticleFlatTableProducer); -DEFINE_FWK_MODULE(SimpleCaloClusterFlatTableProducer);