forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start trying to make consistent with PFNano
- Loading branch information
Showing
17 changed files
with
579 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<use name="DataFormats/Common"/> | ||
<use name="DataFormats/NanoAOD"/> | ||
<use name="boost"/> | ||
<export> | ||
<lib name="1"/> | ||
</export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="FWCore/ServiceRegistry"/> | ||
<use name="FWCore/Utilities"/> | ||
<use name="DataFormats/Candidate"/> | ||
<use name="DataFormats/PatCandidates"/> | ||
<use name="Geometry/HGCalGeometry"/> | ||
<use name="Geometry/CaloGeometry"/> | ||
<use name="Geometry/CSCGeometry"/> | ||
<use name="Geometry/TrackerGeometryBuilder"/> | ||
<use name="PhysicsTools/PatAlgos"/> | ||
<use name="DataFormats/NanoAOD"/> | ||
<use name="IOPool/Provenance"/> | ||
<use name="CondFormats/RunInfo"/> | ||
<use name="CondFormats/DataRecord"/> | ||
<library file="*.cc" name="DPGAnalysisCaloNanoAODPlugins"> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
27 changes: 27 additions & 0 deletions
27
DPGAnalysis/CaloNanoAOD/plugins/CaloIndexFromAssociationTableProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<edm::SimTrackContainer, SimClusterCollection> | ||
SimTrackToSimClusterIndexTableProducer; | ||
typedef ObjectIndexFromAssociationTableProducer<edm::PCaloHitContainer, SimClusterCollection> | ||
CaloHitToSimClusterIndexTableProducer; | ||
typedef ObjectIndexFromAssociationTableProducer<SimClusterCollection, CaloParticleCollection> | ||
SimClusterToCaloParticleIndexTableProducer; | ||
typedef ObjectIndexFromAssociationTableProducer<SimClusterCollection, SimClusterCollection> | ||
SimClusterToSimClusterIndexTableProducer; | ||
|
||
DEFINE_FWK_MODULE(SimTrackToSimClusterIndexTableProducer); | ||
DEFINE_FWK_MODULE(CaloHitToSimClusterIndexTableProducer); | ||
DEFINE_FWK_MODULE(SimClusterToCaloParticleIndexTableProducer); | ||
DEFINE_FWK_MODULE(SimClusterToSimClusterIndexTableProducer); |
54 changes: 54 additions & 0 deletions
54
DPGAnalysis/CaloNanoAOD/plugins/HCALHitPositionTableProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<edm::View<CaloRecHit>> { | ||
public: | ||
HCALHitPositionTableProducer(edm::ParameterSet const& params) | ||
: HitPositionTableProducer(params) {} | ||
//caloGeomToken_(esConsumes<CaloGeometry, CaloGeometryRecord>()) { | ||
|
||
~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<CaloGeometryRecord>().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<CaloGeometry, CaloGeometryRecord> caloGeomToken_; | ||
edm::ESHandle<CaloGeometry> caloGeom_; | ||
}; | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
typedef HCALHitPositionTableProducer HCALRecHitPositionTableProducer; | ||
DEFINE_FWK_MODULE(HCALRecHitPositionTableProducer); | ||
|
7 changes: 7 additions & 0 deletions
7
DPGAnalysis/CaloNanoAOD/plugins/SimClusterRecEnergyTableProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SimClusterCollection, float> SimClusterRecEnergyTableProducer; | ||
DEFINE_FWK_MODULE(SimClusterRecEnergyTableProducer); |
18 changes: 18 additions & 0 deletions
18
DPGAnalysis/CaloNanoAOD/plugins/SimpleCaloObjectFlatTableProducer.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "PhysicsTools/NanoAOD/interface/SimpleFlatTableProducer.h" | ||
|
||
#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" | ||
typedef SimpleFlatTableProducer<SimCluster> SimpleSimClusterFlatTableProducer; | ||
|
||
#include "SimDataFormats/CaloHit/interface/PCaloHit.h" | ||
typedef SimpleFlatTableProducer<PCaloHit> SimplePCaloHitFlatTableProducer; | ||
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" | ||
typedef SimpleFlatTableProducer<CaloRecHit> SimpleCaloRecHitFlatTableProducer; | ||
|
||
#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" | ||
typedef SimpleFlatTableProducer<CaloParticle> SimpleCaloParticleFlatTableProducer; | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE(SimplePCaloHitFlatTableProducer); | ||
DEFINE_FWK_MODULE(SimpleCaloRecHitFlatTableProducer); | ||
DEFINE_FWK_MODULE(SimpleSimClusterFlatTableProducer); | ||
DEFINE_FWK_MODULE(SimpleCaloParticleFlatTableProducer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.