Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute/store unprefirable event information by default in MINIAOD #39253

Merged
merged 1 commit into from Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 37 additions & 38 deletions L1Trigger/L1TGlobal/plugins/L1TExtCondProducer.cc
Expand Up @@ -94,9 +94,9 @@ L1TExtCondProducer::L1TExtCondProducer(const ParameterSet& iConfig)

m_triggerRulePrefireVetoBit = GlobalExtBlk::maxExternalConditions - 1;

tcdsRecordToken_ = consumes<TCDSRecord>(tcdsInputTag_);
// Note that the tcdsRecord input tag should be used as InputTag("unpackTcds","tcdsRecord") only for data
if (!(tcdsInputTag_ == edm::InputTag(""))) {
tcdsRecordToken_ = consumes<TCDSRecord>(tcdsInputTag_);
makeTriggerRulePrefireVetoBit_ = true;
}

Expand Down Expand Up @@ -134,12 +134,14 @@ void L1TExtCondProducer::produce(Event& iEvent, const EventSetup& iSetup) {
m_extBitMap = extBitMap;
}

edm::Handle<TCDSRecord> tcdsRecordH;
iEvent.getByToken(tcdsRecordToken_, tcdsRecordH);
makeTriggerRulePrefireVetoBit_ = makeTriggerRulePrefireVetoBit_ && tcdsRecordH.isValid();

bool TriggerRulePrefireVetoBit(false);
// The following list of checks on the tcdsRecord is relevant only for data;
// code taken from Nick Smith's EventFilter/L1TRawToDigi/plugins/TriggerRulePrefireVetoFilter.cc
if (iEvent.isRealData() && makeTriggerRulePrefireVetoBit_) {
edm::Handle<TCDSRecord> tcdsRecordH;
iEvent.getByToken(tcdsRecordToken_, tcdsRecordH);
const auto& tcdsRecord = *tcdsRecordH.product();

uint64_t thisEvent = (tcdsRecord.getBXID() - 1) + tcdsRecord.getOrbitNr() * 3564ull;
Expand All @@ -150,43 +152,40 @@ void L1TExtCondProducer::produce(Event& iEvent, const EventSetup& iSetup) {
}

// It should be 16 according to TCDSRecord.h, we only care about the last 4
if (eventHistory.size() < 4) {
throw cms::Exception("L1TExtCondProducer")
<< "Unexpectedly small L1A history from TCDSRecord: (size = " << eventHistory.size() << " < 4)";
}

// No more than 1 L1A in 3 BX
if (eventHistory[0] < 3ull) {
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (1 in 3)";
}

if (eventHistory[0] == 3ull)
TriggerRulePrefireVetoBit = true;

// No more than 2 L1As in 25 BX
if (eventHistory[0] < 25ull and eventHistory[1] < 25ull) {
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (2 in 25)";
if (eventHistory.size() >= 4) {
// No more than 1 L1A in 3 BX
if (eventHistory[0] < 3ull) {
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (1 in 3)";
}

if (eventHistory[0] == 3ull)
TriggerRulePrefireVetoBit = true;

// No more than 2 L1As in 25 BX
if (eventHistory[0] < 25ull and eventHistory[1] < 25ull) {
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (2 in 25)";
}
if (eventHistory[0] < 25ull and eventHistory[1] == 25ull)
TriggerRulePrefireVetoBit = true;

// No more than 3 L1As in 100 BX
if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] <= 100ull) {
if (eventHistory[2] == 100ull)
TriggerRulePrefireVetoBit = true;
else
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (3 in 100)";
}

// No more than 4 L1As in 240 BX
if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
eventHistory[3] <= 240ull) {
if (eventHistory[3] == 240ull)
TriggerRulePrefireVetoBit = true;
else
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (4 in 240)";
}
}
if (eventHistory[0] < 25ull and eventHistory[1] == 25ull)
TriggerRulePrefireVetoBit = true;

// No more than 3 L1As in 100 BX
if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] < 100ull) {
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (3 in 100)";
}
if (eventHistory[0] < 100ull and eventHistory[1] < 100ull and eventHistory[2] == 100ull)
TriggerRulePrefireVetoBit = true;

// No more than 4 L1As in 240 BX
if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
eventHistory[3] < 240ull) {
edm::LogError("L1TExtCondProducer") << "Found an L1A in an impossible location?! (4 in 240)";
}
if (eventHistory[0] < 240ull and eventHistory[1] < 240ull and eventHistory[2] < 240ull and
eventHistory[3] == 240ull)
TriggerRulePrefireVetoBit = true;
}

// Setup vectors
GlobalExtBlk extCond_bx;

Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Expand Up @@ -617,6 +617,7 @@ def miniAOD_customizeData(process):
process.load("Geometry.VeryForwardGeometry.geometryRPFromDB_cfi")
process.load('L1Trigger.L1TGlobal.simGtExtFakeProd_cfi')
task = getPatAlgosToolsTask(process)
task.add(process.simGtExtUnprefireable)
from Configuration.Eras.Modifier_ctpps_cff import ctpps
ctpps.toModify(task, func=lambda t: t.add(process.ctppsLocalTrackLiteProducer))
ctpps.toModify(task, func=lambda t: t.add(process.ctppsProtons))
Expand Down