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.
Merge pull request #33 from kdlong/pepr_CMSSW_12_6_0_pre2
Pepr cmssw 12 6 0 pre2
- Loading branch information
Showing
31 changed files
with
702 additions
and
484 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
File renamed without changes.
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
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
#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; | ||
|
||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
|
||
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); | ||
|
File renamed without changes.
File renamed without changes.
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
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) |
Oops, something went wrong.