diff --git a/.gitignore b/.gitignore
index 82c501e..a1e61cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ __init__.py
.#*
#*#
*~
+*/NanoNizer
\ No newline at end of file
diff --git a/NtupleProducer/plugins/BuildFile.xml b/NtupleProducer/plugins/BuildFile.xml
index 5164718..928d085 100644
--- a/NtupleProducer/plugins/BuildFile.xml
+++ b/NtupleProducer/plugins/BuildFile.xml
@@ -1,22 +1,24 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NtupleProducer/plugins/L1DecTkTruthTableProducer.cc b/NtupleProducer/plugins/L1DecTkTruthTableProducer.cc
new file mode 100644
index 0000000..260d967
--- /dev/null
+++ b/NtupleProducer/plugins/L1DecTkTruthTableProducer.cc
@@ -0,0 +1,102 @@
+// user include files
+#include "FWCore/Framework/interface/Frameworkfwd.h"
+#include "FWCore/Framework/interface/global/EDProducer.h"
+#include "FWCore/Framework/interface/Event.h"
+
+#include "DataFormats/Common/interface/Handle.h"
+#include "DataFormats/Common/interface/View.h"
+#include "DataFormats/Common/interface/RefToPtr.h"
+
+#include "DataFormats/L1TParticleFlow/interface/PFTrack.h"
+#include "DataFormats/Math/interface/deltaR.h"
+
+#include "FWCore/ParameterSet/interface/ParameterSet.h"
+#include "FWCore/Utilities/interface/InputTag.h"
+
+#include "DataFormats/NanoAOD/interface/FlatTable.h"
+
+#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
+#include "CommonTools/Utils/interface/StringObjectFunction.h"
+
+#include "L1Trigger/Phase2L1ParticleFlow/interface/L1TPFUtils.h"
+
+#include "SimTracker/TrackTriggerAssociation/interface/TTTrackAssociationMap.h"
+
+#include
+
+class L1DecTkTruthTableProducer : public edm::global::EDProducer<> {
+public:
+ explicit L1DecTkTruthTableProducer(const edm::ParameterSet&);
+ ~L1DecTkTruthTableProducer();
+
+private:
+ virtual void produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
+ //std::vector
+
+ std::string name_;
+ edm::EDGetTokenT> decTks_;
+ edm::EDGetTokenT> ttTrackMCTruthToken_;
+};
+
+L1DecTkTruthTableProducer::L1DecTkTruthTableProducer(const edm::ParameterSet& iConfig)
+ : name_(iConfig.getParameter("name")),
+ decTks_(consumes>(iConfig.getParameter("src"))),
+ ttTrackMCTruthToken_(consumes>(
+ iConfig.getParameter("MCTruthTrackInputTag")))
+{
+ produces();
+}
+
+L1DecTkTruthTableProducer::~L1DecTkTruthTableProducer() {}
+
+// ------------ method called for each event ------------
+void L1DecTkTruthTableProducer::produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
+ edm::Handle> decTks;
+ edm::Handle> MCTruthTTTrackHandle;
+ iEvent.getByToken(decTks_, decTks);
+ iEvent.getByToken(ttTrackMCTruthToken_, MCTruthTTTrackHandle);
+
+ // create the table
+ unsigned int ncands = decTks->size();
+ auto out = std::make_unique(ncands, name_, false, true);
+
+ std::vector isGenuine(ncands), isLooselyGenuine(ncands), isUnknown(ncands), isCombinatoric(ncands), isReal(ncands);
+ std::vector tpmatch(ncands);
+
+ for (unsigned int i = 0; i < ncands; ++i) {
+ const auto tkPtr = edm::refToPtr((*decTks)[i].track());
+ isGenuine[i] = MCTruthTTTrackHandle->isGenuine(tkPtr);
+ isLooselyGenuine[i] = MCTruthTTTrackHandle->isLooselyGenuine(tkPtr);
+ isUnknown[i] = MCTruthTTTrackHandle->isUnknown(tkPtr);
+ isCombinatoric[i] = MCTruthTTTrackHandle->isCombinatoric(tkPtr);
+ tpmatch[i] = (isCombinatoric[i]) + (isUnknown[i] << 1) + (isLooselyGenuine[i] << 2) + (isGenuine[i] << 3);
+
+ edm::Ptr my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(tkPtr);
+ int tmp_isReal;
+ if (my_tp.isNull()) {
+ tmp_isReal = 0;
+ } else {
+ int tmp = (my_tp->eventId().event());
+ if (tmp > 0) {
+ tmp_isReal = 2;
+ } else {
+ tmp_isReal = 1;
+ }
+ }
+ isReal[i] = tmp_isReal;
+ }
+
+ out->addColumn("isGenuine", isGenuine, "");
+ out->addColumn("isLooselyGenuine", isLooselyGenuine, "");
+ out->addColumn("isUnknown", isUnknown, "");
+ out->addColumn("isCombinatoric", isCombinatoric, "");
+ out->addColumn("isReal", isReal, "");
+ out->addColumn("tpmatch", tpmatch, "");
+
+ // save to the event branches
+ iEvent.put(std::move(out));
+}
+
+//define this as a plug-in
+#include "FWCore/Framework/interface/MakerMacros.h"
+DEFINE_FWK_MODULE(L1DecTkTruthTableProducer);
diff --git a/NtupleProducer/plugins/L1PFClusterDigiParser.cc b/NtupleProducer/plugins/L1PFClusterDigiParser.cc
new file mode 100644
index 0000000..1197564
--- /dev/null
+++ b/NtupleProducer/plugins/L1PFClusterDigiParser.cc
@@ -0,0 +1,113 @@
+// user include files
+#include "FWCore/Framework/interface/Frameworkfwd.h"
+#include "FWCore/Framework/interface/global/EDProducer.h"
+#include "FWCore/Framework/interface/Event.h"
+
+#include "DataFormats/Common/interface/Handle.h"
+#include "DataFormats/Common/interface/View.h"
+#include "DataFormats/Common/interface/RefToPtr.h"
+
+#include "DataFormats/L1TParticleFlow/interface/PFCluster.h"
+#include "DataFormats/Math/interface/deltaR.h"
+
+#include "FWCore/ParameterSet/interface/ParameterSet.h"
+#include "FWCore/Utilities/interface/InputTag.h"
+
+#include "DataFormats/NanoAOD/interface/FlatTable.h"
+
+#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
+#include "CommonTools/Utils/interface/StringObjectFunction.h"
+
+#include "L1Trigger/Phase2L1ParticleFlow/interface/L1TPFUtils.h"
+
+
+#include
+
+
+// iso flag: two bits, least significant bit is the standalone WP (true or false), second bit is the looseTk WP (true or false)
+// e.g. 0b01 : standalone iso flag passed, loose Tk iso flag did not pass
+uint isoFlags(uint64_t digiWord) { return ((digiWord >> 38) & 0x3); } // (two 1's) 0b11 = 0x3
+bool passes_iso(uint64_t digiWord) { return (isoFlags(digiWord) & 0x1); } // standalone iso WP
+bool passes_looseTkiso(uint64_t digiWord) { return (isoFlags(digiWord) & 0x2); } // loose Tk iso WP
+
+// shower shape shape flag: two bits, least significant bit is the standalone WP, second bit is the looseTk WP
+// e.g. 0b01 : standalone shower shape flag passed, loose Tk shower shape flag did not pass
+uint shapeFlags(uint64_t digiWord) { return ((digiWord >> 51) & 0x3); }
+
+bool passes_ss(uint64_t digiWord) { return (shapeFlags(digiWord) & 0x1); } // standalone shower shape WP
+bool passes_looseTkss(uint64_t digiWord) { return (shapeFlags(digiWord) & 0x2); } // loose Tk shower shape WP
+
+// brems: not saved in the current emulator
+uint get_brems(uint64_t digiWord) { return ((digiWord >> 53) & 0x3); }
+
+bool passes_standaloneWP(uint64_t digiWord) { return (passes_iso(digiWord) && passes_ss(digiWord)); }
+bool passes_looseL1TkMatchWP(uint64_t digiWord) { return (passes_looseTkiso(digiWord) && passes_looseTkss(digiWord)); }
+
+class L1PFClusterDigiParser : public edm::global::EDProducer<> {
+public:
+ explicit L1PFClusterDigiParser(const edm::ParameterSet&);
+ ~L1PFClusterDigiParser();
+
+private:
+ virtual void produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
+
+ std::string name_;
+ edm::EDGetTokenT> pfClusters_;
+
+};
+
+L1PFClusterDigiParser::L1PFClusterDigiParser(const edm::ParameterSet& iConfig)
+ : name_(iConfig.getParameter("name")),
+ pfClusters_(consumes>(iConfig.getParameter("src"))){
+ produces();
+}
+
+L1PFClusterDigiParser::~L1PFClusterDigiParser() {}
+
+// ------------ method called for each event ------------
+void L1PFClusterDigiParser::produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
+ edm::Handle> pfClusters;
+ iEvent.getByToken(pfClusters_, pfClusters);
+
+
+ // create the table
+ unsigned int ncands = pfClusters->size();
+ auto out = std::make_unique(ncands, name_, false, true);
+
+ std::vector is_ss(ncands), is_iso(ncands), is_looseTkiso(ncands), is_looseTkss(ncands),brems(ncands), standaloneWP(ncands), looseL1TkMatchWP(ncands);
+
+
+ for (unsigned int i = 0; i < ncands; ++i) {
+ const auto pfCluster = (*pfClusters)[i];
+ uint64_t digiWord = pfCluster.digiWord();
+ is_iso[i] = passes_iso(digiWord);
+ is_ss[i] = passes_ss(digiWord);
+ is_looseTkiso[i] = passes_looseTkiso(digiWord);
+ is_looseTkss[i] = passes_looseTkss(digiWord);
+ brems[i] = get_brems(digiWord);
+ standaloneWP[i] = passes_standaloneWP(digiWord);
+ looseL1TkMatchWP[i] = passes_looseL1TkMatchWP(digiWord);
+
+
+
+ }
+
+ out->addColumn("isIso", is_iso, "");
+ out->addColumn("isSS", is_ss, "");
+ out->addColumn("isLooseTkIso", is_looseTkiso, "");
+ out->addColumn("isLooseTkSS", is_looseTkss, "");
+ out->addColumn("brems", brems, "");
+ out->addColumn("standaloneWP", standaloneWP, "");
+ out->addColumn("looseL1TkMatchWP", looseL1TkMatchWP, "");
+
+
+
+
+
+ // save to the event branches
+ iEvent.put(std::move(out));
+}
+
+//define this as a plug-in
+#include "FWCore/Framework/interface/MakerMacros.h"
+DEFINE_FWK_MODULE(L1PFClusterDigiParser);
diff --git a/NtupleProducer/python/runInputs131X_TrackTruth.py b/NtupleProducer/python/runInputs131X_TrackTruth.py
new file mode 100644
index 0000000..de977d2
--- /dev/null
+++ b/NtupleProducer/python/runInputs131X_TrackTruth.py
@@ -0,0 +1,164 @@
+import FWCore.ParameterSet.Config as cms
+from Configuration.StandardSequences.Eras import eras
+
+process = cms.Process("IN", eras.Phase2C17I13M9)
+process.load('Configuration.StandardSequences.Services_cff')
+process.load('Configuration.Geometry.GeometryExtended2026D95Reco_cff')
+process.load('Configuration.Geometry.GeometryExtended2026D95_cff')
+process.load('Configuration.StandardSequences.MagneticField_cff')
+process.load('SimGeneral.MixingModule.mixNoPU_cfi')
+process.load('Configuration.StandardSequences.EndOfProcess_cff')
+process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
+from Configuration.AlCa.GlobalTag import GlobalTag
+process.GlobalTag = GlobalTag(process.GlobalTag, '131X_mcRun4_realistic_v9', '')
+
+process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff')
+process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi')
+process.load('Configuration.StandardSequences.SimL1Emulator_cff')
+process.load('L1Trigger.TrackTrigger.TrackTrigger_cff')
+process.load("L1Trigger.TrackFindingTracklet.L1HybridEmulationTracks_cff")
+process.load("L1Trigger.TrackTrigger.ProducerSetup_cff")
+process.load("L1Trigger.TrackerDTC.ProducerED_cff")
+process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
+process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff')
+
+process.source = cms.Source("PoolSource",
+ fileNames = cms.untracked.vstring(
+ # 'file:/data/cerminar/Phase2Spring23DIGIRECOMiniAOD/DoubleElectron_FlatPt-1To100-gun/GEN-SIM-DIGI-RAW-MINIAOD/PU200_Trk1GeV_131X_mcRun4_realistic_v5-v1/c699a773-9875-40c9-83b7-5a3c27f90bfd.root',
+ 'file:///data/pviscone/4a846108-9fe9-424c-aa21-51a967cd3e9f.root'
+),
+
+ inputCommands = cms.untracked.vstring(
+ 'keep *',
+ 'drop l1tPFJets_*_*_*',
+ 'drop l1tPFTaus_*_*_*',
+ 'drop l1tTrackerMuons_*_*_*',
+ 'drop *_hlt*_*_HLT',
+ 'drop triggerTriggerFilterObjectWithRefs_*_*_HLT'
+ ),
+)
+process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(3))
+process.options = cms.untracked.PSet(
+ wantSummary = cms.untracked.bool(True),
+ #numberOfThreads = cms.untracked.uint32(4),
+ #numberOfStreams = cms.untracked.uint32(4),
+)
+
+process.PFInputsTask = cms.Task(
+ process.L1TLayer1TaskInputsTask,
+ process.L1THGCalTriggerPrimitivesTask,
+ #process.TTClustersFromPhase2TrackerDigis,
+ #process.TTStubsFromPhase2TrackerDigis,
+ #process.TrackerDTCProducer,
+ #process.offlineBeamSpot,
+ #process.l1tTTTracksFromTrackletEmulation,
+ #process.l1tTTTracksFromExtendedTrackletEmulation,
+ #process.TTTrackAssociatorFromPixelDigis,
+ #process.TTTrackAssociatorFromPixelDigisExtended,
+ #process.SimL1EmulatorTask
+ #process.l1tTkStubsGmt,
+)
+process.p = cms.Path(
+ process.l1tLayer1 +
+ process.l1tLayer2Deregionizer +
+ process.l1tLayer2EG
+)
+process.p.associate(process.PFInputsTask)
+process.p.associate(process.SimL1EmulatorTask)
+
+process.out = cms.OutputModule("PoolOutputModule",
+ fileName = cms.untracked.string("inputs131X.root"),
+ outputCommands = cms.untracked.vstring("drop *",
+ # --- GEN
+ "keep *_genParticles_*_*",
+ "keep *_ak4GenJetsNoNu_*_*",
+ "keep *_genMetTrue_*_*",
+ # --- Track TPs
+ "keep *_l1tTTTracksFromTrackletEmulation_*_*",
+ "keep *_l1tTTTracksFromExtendedTrackletEmulation_*_*",
+ "keep *_TTTrackAssociatorFromPixelDigis_*_*",
+ "keep *_TTTrackAssociatorFromPixelDigisExtended_*_*",
+ # --- Calo TPs
+ "keep *_simEcalEBTriggerPrimitiveDigis_*_*",
+ "keep *_simHcalTriggerPrimitiveDigis_*_*",
+ "keep *_simCaloStage2Layer1Digis_*_*",
+ "keep *_simCaloStage2Digis_*_*",
+ # --- Muon TPs
+ "keep *_simMuonRPCDigis_*_*",
+ "keep *_simMuonGEMPadDigis_*_*",
+ "keep *_simMuonGEMPadDigiClusters_*_*",
+ "keep *_simDtTriggerPrimitiveDigis_*_*",
+ "keep *_simCscTriggerPrimitiveDigis_*_*",
+ "keep *_simTwinMuxDigis_*_*",
+ "keep *_simBmtfDigis_*_*",
+ "keep *_simKBmtfStubs_*_*",
+ "keep *_simKBmtfDigis_*_*",
+ "keep *_simEmtfDigis_*_*",
+ "keep *_simOmtfDigis_*_*",
+ "keep *_simGmtCaloSumDigis_*_*",
+ "keep *_simGmtStage2Digis_*_*",
+ "keep *_simEmtfShowers_*_*",
+ "keep *_simGmtShowerDigis_*_*",
+ "keep *_simCscTriggerPrimitiveDigisRun3_*_*",
+ "keep *_simMuonME0PadDigis_*_*",
+ "keep *_me0TriggerDigis_*_*",
+ "keep *_simMuonME0PseudoReDigisCoarse_*_*",
+ "keep *_me0RecHitsCoarse_*_*",
+ "keep *_me0TriggerPseudoDigis_*_*",
+ "keep *_me0RecHits_*_*",
+ "keep *_me0Segments_*_*",
+ "keep *_me0TriggerConvertedPseudoDigis_*_*",
+ "keep *_simCscTriggerPrimitiveDigisPhase2_*_*",
+ "keep *_simGtExtFakeStage2Digis_*_*",
+ "keep *_simGtStage2Digis_*_*",
+ "keep *_CalibratedDigis_*_*",
+ "keep *_dtTriggerPhase2PrimitiveDigis_*_*",
+ # --- HGCal TPs
+ "keep l1tHGCalTriggerCellBXVector_l1tHGCalVFEProducer_*_*",
+ #"keep l1tHGCalTriggerCellBXVector_l1tHGCalConcentratorProducer_*_*",
+ "keep l1tHGCalMulticlusterBXVector_l1tHGCalBackEndLayer2Producer_*_*",
+ "keep l1tHGCalTowerBXVector_l1tHGCalTowerProducer_*_*",
+ # --- GCT reconstruction
+ "keep *_l1tEGammaClusterEmuProducer_*_*",
+ "keep *_l1tTowerCalibration_*_*",
+ "keep *_l1tCaloJet_*_*",
+ "keep *_l1tCaloJetHTT_*_*",
+ # "keep *_l1tPhase2L1CaloEGammaEmulator_*_*",
+ # "keep *_l1tPhase2CaloPFClusterEmulator_*_*",
+ # --- GTT reconstruction
+ "keep *_l1tVertexFinder_*_*",
+ "keep *_l1tVertexFinderEmulator_*_*",
+ "keep *_l1tTrackJets_*_*",
+ "keep *_l1tTrackJetsExtended_*_*",
+ "keep *_l1tTrackFastJets_*_*",
+ "keep *_l1tTrackerEtMiss_*_*",
+ "keep *_l1tTrackerHTMiss_*_*",
+ "keep *_l1tTrackJetsEmulation_*_*",
+ "keep *_l1tTrackJetsExtendedEmulation_*_*",
+ "keep *_l1tTrackerEmuEtMiss_*_*",
+ "keep *_l1tTrackerEmuHTMiss_*_*",
+ "keep *_l1tTrackerEmuHTMissExtended_*_*",
+ # --- GMT reconstruction
+ "keep *_l1tStubsGmt_*_*",
+ "keep *_l1tKMTFMuonsGmt_*_*",
+ "keep *_l1tFwdMuonsGmt_*_*",
+ "keep *_l1tSAMuonsGmt_*_*",
+ # --- Tk Truth
+ "keep *_*AssociatorFromPixelDigis*_*_*",
+ "keep *_*l1tTTTracks*_*_*",
+ "keep *_TT*FromPhase2TrackerDigis_*_*",
+ "keep *_mix_*_*"
+ ),
+ compressionAlgorithm = cms.untracked.string('LZMA'),
+ compressionLevel = cms.untracked.int32(4),
+ dropMetaData = cms.untracked.string('ALL'),
+ fastCloning = cms.untracked.bool(False),
+ overrideInputFileSplitLevels = cms.untracked.bool(True),
+ eventAutoFlushCompressedSize = cms.untracked.int32(15728640),
+ SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring("p")),
+)
+process.e = cms.EndPath(process.out)
+
+process.schedule = cms.Schedule([process.p,process.e])
+
+process.out.outputCommands += [ "drop *_l1tHGCalVFEProducer_*_*", ]
diff --git a/NtupleProducer/python/runPerformanceNTuple.py b/NtupleProducer/python/runPerformanceNTuple.py
index 8cb67ac..1ff9e14 100644
--- a/NtupleProducer/python/runPerformanceNTuple.py
+++ b/NtupleProducer/python/runPerformanceNTuple.py
@@ -1,6 +1,8 @@
+import warnings
+
import FWCore.ParameterSet.Config as cms
from Configuration.StandardSequences.Eras import eras
-from PhysicsTools.NanoAOD.common_cff import Var, ExtVar
+from PhysicsTools.NanoAOD.common_cff import Var, ExtVar
process = cms.Process("RESP", eras.Phase2C17I13M9)
@@ -12,12 +14,15 @@
process.MessageLogger.cerr.FwkReport.reportEvery = 1
process.source = cms.Source("PoolSource",
- fileNames = cms.untracked.vstring('file:inputs125X.root'),
- inputCommands = cms.untracked.vstring("keep *",
+ fileNames = cms.untracked.vstring('file:inputs131X.root'),
+ inputCommands = cms.untracked.vstring("keep *",
"drop l1tPFClusters_*_*_*",
"drop l1tPFTracks_*_*_*",
"drop l1tPFCandidates_*_*_*",
- "drop l1tTkPrimaryVertexs_*_*_*")
+ "drop l1tTkPrimaryVertexs_*_*_*",
+ "drop l1tTrackerMuons_*_*_*",
+ "drop *_hlt*_*_HLT",
+ "drop triggerTriggerFilterObjectWithRefs_*_*_HLT",)
)
process.load('Configuration.Geometry.GeometryExtended2026D95Reco_cff')
@@ -106,7 +111,7 @@ def _add(name, what):
for O in ["", "Charged", "Neutral", "Electron", "Muon", "ChargedHadron", "NeutralHadron", "Photon"]:
for X in ("tot","max"):
process.ntuple.copyUInts.append( "%s:%sN%s%s" % (D,X,P,O))
- process.ntuple.copyVecUInts.append( "%s:vecN%s%s" % (D,P,O))
+ process.ntuple.copyVecUInts.append( "%s:vecN%s%s" % (D,P,O))
process.ntuple = cms.EDAnalyzer("ResponseNTuplizer",
genJets = cms.InputTag("ak4GenJetsNoNu"),
@@ -141,7 +146,7 @@ def _add(name, what):
)
process.l1pfmetTable = cms.EDProducer("L1PFMetTableProducer",
- genMet = cms.InputTag("genMetTrue"),
+ genMet = cms.InputTag("genMetTrue"),
flavour = cms.string(""),
mets = cms.PSet(
),
@@ -157,7 +162,7 @@ def _add(name, what):
#process.content = cms.EDAnalyzer("EventContentAnalyzer")
process.p = cms.Path(
process.ntuple + #process.content +
- process.l1pfjetTable +
+ process.l1pfjetTable +
process.l1pfmetTable + process.l1pfmetCentralTable
)
process.p.associate(process.extraPFStuff)
@@ -229,8 +234,8 @@ def addCalib():
process.l1tPFClustersFromHGC3DClustersRaw = process.l1tPFClustersFromHGC3DClusters.clone(corrector = "")
process.l1tPFClustersFromHGC3DClustersEMRaw = process.l1tPFClustersFromHGC3DClustersEM.clone(corrector = "")
process.extraPFStuff.add(
- process.l1tPFClustersFromL1EGClustersRaw,
- process.l1tPFClustersFromHGC3DClustersRaw,
+ process.l1tPFClustersFromL1EGClustersRaw,
+ process.l1tPFClustersFromHGC3DClustersRaw,
process.l1tPFClustersFromHGC3DClustersEM,
process.l1tPFClustersFromHGC3DClustersEMRaw)
process.ntuple.objects.L1RawBarrelEcal = cms.VInputTag('l1tPFClustersFromL1EGClustersRaw' )
@@ -304,7 +309,7 @@ def addTkPtCut(ptCut):
process.l1tLayer1HGCalTkPt3 = process.l1tLayer1HGCal.clone(trkPtCut = ptCut)
process.l1tLayer1TkPt3 = cms.EDProducer("L1TPFCandMultiMerger",
pfProducers = cms.VInputTag(
- cms.InputTag("l1tLayer1BarrelTkPt3"),
+ cms.InputTag("l1tLayer1BarrelTkPt3"),
cms.InputTag("l1tLayer1HGCalTkPt3"),
cms.InputTag("l1tLayer1HGCalNoTK"),
cms.InputTag("l1tLayer1HF")
@@ -501,7 +506,7 @@ def addPFLep(pdgs=[11,13,22],opts=["PF","Puppi"], postfix=""):
setattr(process, w+"Ph"+postfix+"Table", phTable)
process.extraPFStuff.add(phTable)
-def addStaEG(postfix=""):
+def addStaEG(postfix=""):
def getStaEgTables(slice, postfix, inputtag):
staEgTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
name = cms.string("EGSta"+slice+postfix),
@@ -528,7 +533,7 @@ def getStaEgTables(slice, postfix, inputtag):
process.extraPFStuff.add(staEgEEEmuTable)
-def addTkEG(doL1=False, doL2=True, postfix=""):
+def addTkEG(doL1=False, doL2=True, postfix=""):
def getTkEgTables(slice, postfix, tkem_inputtag, tkele_inputtag):
tkEmTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
name = cms.string("TkEm"+slice+postfix),
@@ -562,22 +567,22 @@ def getTkEgTables(slice, postfix, tkem_inputtag, tkele_inputtag):
tkEleTable.variables.caloEta = Var("egCaloPtr.eta", float,precision=8)
tkEleTable.variables.caloPhi = Var("egCaloPtr.phi", float,precision=8)
return tkEmTable, tkEleTable
-
- if doL1:
+
+ if doL1:
for w in "EB","EE":
tkEmTable, tkEleTable = getTkEgTables(w, postfix, f"l1tLayer1EG{postfix}:L1TkEm{w}", f'l1tLayer1EG{postfix}:L1TkEle{w}')
setattr(process, "TkEm%s%sTable" % (w,postfix), tkEmTable)
setattr(process, "TkEle%s%sTable" % (w,postfix), tkEleTable)
process.extraPFStuff.add(tkEmTable,tkEleTable)
- if doL2:
+ if doL2:
tkEmTable, tkEleTable = getTkEgTables('L2', postfix, f"l1tLayer2EG:L1CtTkEm", f'l1tLayer2EG:L1CtTkElectron')
setattr(process, "TkEmL2%sTable" % (postfix), tkEmTable)
setattr(process, "TkEleL2%sTable" % (postfix), tkEleTable)
process.extraPFStuff.add(tkEmTable,tkEleTable)
-def addDecodedTk(regs=['HGCal','Barrel']):
+def addDecodedTk(regs=['HGCal','Barrel'], truth=False):
for reg in regs:
decTkTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
name = cms.string("DecTk"+reg),
@@ -604,6 +609,22 @@ def addDecodedTk(regs=['HGCal','Barrel']):
setattr(process, f"decTk{reg}Table", decTkTable)
process.extraPFStuff.add(decTkTable)
+ if truth:
+ warnings.warn(
+ "To make it work you have to change the digiSimLinks input tag of TTClusterAssociatorFromPixelDigis in SimTracker/TrackTriggerAssociation/python/TTClusterAssociation_cfi.py. \nIt must be ('simSiPixelDigis','Tracker'), not ('mix','Tracker')"
+ )
+ warnings.warn('Truth track must be runned on RAW dataset')
+ decTkTableExt = cms.EDProducer(
+ 'L1DecTkTruthTableProducer',
+ name=cms.string('DecTk' + reg),
+ src=cms.InputTag('l1tLayer1' + reg, 'DecodedTK'),
+ MCTruthTrackInputTag=cms.InputTag(
+ 'TTTrackAssociatorFromPixelDigis', 'Level1TTTracks'
+ ),
+ )
+ setattr(process, f'decTk{reg}ExtTable', decTkTableExt)
+ process.extraPFStuff.add(decTkTableExt)
+
def addEGCrystalClusters() -> None:
@@ -620,24 +641,24 @@ def getCrystalClustersTable(nameSrcDict : dict[str, str]) -> cms.EDProducer:
pt = Var("pt", float,precision=8),
eta = Var("eta", float,precision=8),
phi = Var("phi", float,precision=8),
- calibratedPt = Var("calibratedPt", float,precision=8),
- hovere = Var("hovere", float,precision=8),
- puCorrPt = Var("puCorrPt", float,precision=8),
- bremStrength = Var("bremStrength", float,precision=8),
- e2x2 = Var("e2x2", float,precision=8),
e2x5 = Var("e2x5", float,precision=8),
- e3x5 = Var("e3x5", float,precision=8),
e5x5 = Var("e5x5", float,precision=8),
- standaloneWP = Var("standaloneWP", int,precision=8),
- electronWP98 = Var("electronWP98", int,precision=8),
- photonWP80 = Var("photonWP80", int,precision=8),
- electronWP90 = Var("electronWP90", int,precision=8),
- looseL1TkMatchWP = Var("looseL1TkMatchWP", int,precision=8),
- stage2effMatch= Var("stage2effMatch", int,precision=8),
+ #calibratedPt = Var("calibratedPt", float,precision=8),
+ #hovere = Var("hovere", float,precision=8),
+ #puCorrPt = Var("puCorrPt", float,precision=8),
+ #bremStrength = Var("bremStrength", float,precision=8),
+ #e2x2 = Var("e2x2", float,precision=8),
+ #e3x5 = Var("e3x5", float,precision=8),
+ #standaloneWP = Var("standaloneWP", int,precision=8),
+ #electronWP98 = Var("electronWP98", int,precision=8),
+ #photonWP80 = Var("photonWP80", int,precision=8),
+ #electronWP90 = Var("electronWP90", int,precision=8),
+ #looseL1TkMatchWP = Var("looseL1TkMatchWP", int,precision=8),
+ #stage2effMatch= Var("stage2effMatch", int,precision=8),
)
)
return CrystalClustersTable
-
+
nameSrcDictList=[
{"name":"CaloEGammaCrystalClustersRCT", "src":"l1tPhase2L1CaloEGammaEmulator:RCTClusters"},
{"name":"CaloEGammaCrystalClustersGCT", "src":"l1tPhase2L1CaloEGammaEmulator:GCTClusters"},
@@ -647,6 +668,21 @@ def getCrystalClustersTable(nameSrcDict : dict[str, str]) -> cms.EDProducer:
setattr(process, f"{nameSrcDict['name']}Table", flatTable)
process.extraPFStuff.add(flatTable)
+ if nameSrcDict["name"]=="CaloEGammaCrystalClustersGCT":
+ PFClusterExt=cms.EDProducer(
+ "L1PFClusterDigiParser",
+ name=cms.string("CaloEGammaCrystalClustersGCT"),
+ src=cms.InputTag("l1tPFClustersFromL1EGClusters:all"),
+ cut = cms.string(""),
+ doc = cms.string(""),
+ singleton = cms.bool(False), # the number of entries is variable
+ extension = cms.bool(True),
+ ),
+
+ setattr(process, 'PFClusterExtTable', PFClusterExt[0])
+ process.extraPFStuff.add(PFClusterExt[0])
+
+
def addAllLeps():
addGenLep()
@@ -658,7 +694,7 @@ def addAllLeps():
def goGun(calib=1):
process.ntuple.isParticleGun = True
respOnly()
- if calib:
+ if calib:
addCalib()
def goMT(nthreads=2):
process.options.numberOfThreads = cms.untracked.uint32(nthreads)
@@ -701,7 +737,7 @@ def addEDMOutput():
if False:
#process.source.fileNames = [ '/store/cmst3/group/l1tr/gpetrucc/11_1_0/NewInputs110X/110121.done/TTbar_PU200/inputs110X_%d.root' % i for i in (1,)] #3,7,8,9) ]
- process.source.fileNames = [ '/store/cmst3/group/l1tr/gpetrucc/12_3_X/NewInputs110X/220322/TTbar_PU200/inputs110X_%d.root' % i for i in (1,)]
+ process.source.fileNames = [ '/store/cmst3/group/l1tr/gpetrucc/12_3_X/NewInputs110X/220322/TTbar_PU200/inputs110X_%d.root' % i for i in (1,)]
#process.source.fileNames = [ '/store/cmst3/group/l1tr/gpetrucc/11_1_0/NewInputs110X/110121.done/DYToLL_PU200/inputs110X_%d.root' % i for i in (1,)] #3,7,8,9) ]
#goMT(4)
#oldInputs_11_1_6()
@@ -745,4 +781,4 @@ def saveGenCands():
charge = cms.string("charge")
),
)
- process.p += process.gencandTable
+ process.p += process.gencandTable
\ No newline at end of file