Skip to content

Commit

Permalink
HGC sim hits from common producer
Browse files Browse the repository at this point in the history
  • Loading branch information
kdlong committed Sep 29, 2022
1 parent c335117 commit 7ee2868
Show file tree
Hide file tree
Showing 17 changed files with 193 additions and 407 deletions.
7 changes: 7 additions & 0 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions DPGAnalysis/CommonNanoAOD/BuildFile.xml

This file was deleted.

19 changes: 0 additions & 19 deletions DPGAnalysis/CommonNanoAOD/plugins/BuildFile.xml

This file was deleted.

159 changes: 0 additions & 159 deletions DPGAnalysis/CommonNanoAOD/plugins/HitPositionTableProducer.cc

This file was deleted.

1 change: 1 addition & 0 deletions DPGAnalysis/HGCalNanoAOD/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<use name="IOPool/Provenance"/>
<use name="CondFormats/RunInfo"/>
<use name="CondFormats/DataRecord"/>
<use name="RecoLocalCalo/HGCalRecAlgos"/>
<library file="*.cc" name="DPGAnalysisHGCalNanoAODPlugins">
<flags EDM_PLUGIN="1"/>
</library>
60 changes: 60 additions & 0 deletions DPGAnalysis/HGCalNanoAOD/plugins/HGCALHitPositionTableProducer.cc
Original file line number Diff line number Diff line change
@@ -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 <typename T>
class HGCalHitPositionTableProducer : public HitPositionTableProducer<edm::View<T>> {
//class HGCalHitPositionTableProducer : public HitPositionTableProducer<edm::View<CaloRecHit>> {
public:
HGCalHitPositionTableProducer(edm::ParameterSet const& params)
: HitPositionTableProducer<edm::View<T>>(params),
caloGeoToken_(edm::stream::EDProducer<>::esConsumes<edm::Transition::BeginRun>()) {}

~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<CaloGeometry, CaloGeometryRecord> caloGeoToken_;
hgcal::RecHitTools rhtools_;
};

#include "FWCore/Framework/interface/MakerMacros.h"
//typedef HGCalHitPositionTableProducer HGCalRecHitPositionTableProducer;
typedef HGCalHitPositionTableProducer<CaloRecHit> HGCalRecHitPositionTableProducer;
typedef HGCalHitPositionTableProducer<PCaloHit> HGCalSimHitPositionTableProducer;
DEFINE_FWK_MODULE(HGCalRecHitPositionTableProducer);
DEFINE_FWK_MODULE(HGCalSimHitPositionTableProducer);
Original file line number Diff line number Diff line change
@@ -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<std::vector<reco::CaloCluster>, SimClusterCollection, float>
LayerClusterToSimClusterIndexTableProducer;
typedef ObjectIndexFromOneToManyQualAssociationTableProducer<HGCRecHitCollection, SimClusterCollection, float>
CaloRecHitToSimClusterIndexTableProducer;
typedef ObjectIndexFromOneToManyQualAssociationTableProducer<std::vector<reco::CaloCluster>, CaloParticleCollection, float>
LayerClusterToCaloParticleIndexTableProducer;
typedef ObjectIndexFromOneToManyQualAssociationTableProducer<HGCRecHitCollection, std::vector<reco::CaloCluster>, float>
HGCRecHitToLayerClusterIndexTableProducer;
typedef ObjectIndexFromOneToManyQualAssociationTableProducer<SimClusterCollection, SimClusterCollection, float>
SimClusterToSimClustersIndexTableProducer;
typedef ObjectIndexFromOneToManyQualAssociationTableProducer<HGCRecHitCollection, SimClusterCollection, float>
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);
42 changes: 0 additions & 42 deletions DPGAnalysis/HGCalNanoAOD/python/caloParticles_cff.py

This file was deleted.

2 changes: 1 addition & 1 deletion DPGAnalysis/HGCalNanoAOD/python/hgcRecHits_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
)

hgcRecHitsPositionTable = cms.EDProducer("HGCALRecHitPositionTableProducer",
hgcRecHitsPositionTable = cms.EDProducer("HGCalRecHitPositionTableProducer",
src = hgcRecHitsTable.src,
cut = hgcRecHitsTable.cut,
name = hgcRecHitsTable.name,
Expand Down
2 changes: 1 addition & 1 deletion DPGAnalysis/HGCalNanoAOD/python/hgcSimHits_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 7ee2868

Please sign in to comment.