From b633533ec0ca9e2bdb8db5ee9de3789f14a23e71 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Tue, 13 Apr 2021 10:52:37 -0500 Subject: [PATCH 1/4] Change nodigis to hasdigis --- .../CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index d07cd0eae7c42..c369dc1f66ea7 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -247,9 +247,9 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* } // Get wire digis in this chamber from wire digi collection. - bool noDigis = getDigis(wiredc); + bool hasDigis = getDigis(wiredc); - if (!noDigis) { + if (hasDigis) { // First get wire times from the wire digis. std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; readWireDigis(wire); @@ -369,7 +369,7 @@ void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAY bool CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc) { // Routine for getting digis and filling digiV vector. - bool noDigis = true; + bool hasDigis = false; // Loop over layers and save wire digis on each one into digiV[layer]. for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { @@ -385,7 +385,7 @@ bool CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc) { } if (!digiV[i_layer].empty()) { - noDigis = false; + hasDigis = true; if (infoV > 1) { LogTrace("CSCAnodeLCTProcessor") << "found " << digiV[i_layer].size() << " wire digi(s) in layer " << i_layer << " of " << theCSCName_ << " (trig. sector " << theSector << " subsector " @@ -397,7 +397,7 @@ bool CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc) { } } - return noDigis; + return hasDigis; } void CSCAnodeLCTProcessor::getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id) { From 122a4091cd244fe15f3f1dc5de666af1849838b4 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Tue, 13 Apr 2021 10:53:00 -0500 Subject: [PATCH 2/4] Hit counter for shower trigger --- .../interface/CSCAnodeLCTProcessor.h | 21 +++++- .../interface/CSCBaseboard.h | 3 + .../interface/CSCCathodeLCTProcessor.h | 15 ++++ .../interface/CSCMotherboard.h | 11 ++- .../interface/CSCTriggerPrimitivesBuilder.h | 3 + .../plugins/CSCTriggerPrimitivesProducer.cc | 15 ++++ .../plugins/CSCTriggerPrimitivesProducer.h | 3 + .../python/cscTriggerPrimitiveDigis_cfi.py | 5 +- .../python/params/showerParams.py | 73 +++++++++++++++++++ .../src/CSCAnodeLCTProcessor.cc | 55 ++++++++++++++ .../CSCTriggerPrimitives/src/CSCBaseboard.cc | 2 + .../src/CSCCathodeLCTProcessor.cc | 49 +++++++++++++ .../src/CSCGEMMotherboard.cc | 3 - .../src/CSCGEMMotherboardME11.cc | 3 +- .../src/CSCGEMMotherboardME21.cc | 3 +- .../src/CSCMotherboard.cc | 58 ++++++++++----- .../src/CSCMotherboardME11.cc | 3 +- .../src/CSCTriggerPrimitivesBuilder.cc | 32 ++++++++ .../src/CSCUpgradeMotherboard.cc | 3 +- 19 files changed, 324 insertions(+), 36 deletions(-) create mode 100644 L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h index d127de26c22e4..cc99185d1b817 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h @@ -37,6 +37,7 @@ #include "DataFormats/CSCDigi/interface/CSCWireDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTDigi.h" #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigi.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h" #include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h" @@ -88,8 +89,12 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { CSCALCTDigi getBestALCT(int bx) const; CSCALCTDigi getSecondALCT(int bx) const; - /* encode special bits for high multiplicity triggers */ - unsigned getHighMultiplictyBits() const { return highMultiplicityBits_; } + /* get special bits for high multiplicity triggers */ + unsigned getInTimeHMT() const { return inTimeHMT_; } + unsigned getOutTimeHMT() const { return outTimeHMT_; } + + /** Returns shower bits */ + CSCShowerDigi readoutShower() const; protected: /** Best LCTs in this chamber, as found by the processor. @@ -105,6 +110,8 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { /** LCTs in this chamber, as found by the processor. */ std::vector > ALCTContainer_; + CSCShowerDigi shower_; + /** Access routines to wire digis. */ bool getDigis(const CSCWireDigiCollection* wiredc); void getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id); @@ -123,8 +130,14 @@ class CSCAnodeLCTProcessor : public CSCBaseboard { std::vector thePreTriggerDigis; /* data members for high multiplicity triggers */ - void encodeHighMultiplicityBits(); - unsigned int highMultiplicityBits_; + void encodeHighMultiplicityBits(const std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]); + unsigned inTimeHMT_; + unsigned outTimeHMT_; + std::vector thresholds_; + unsigned showerMinInTBin_; + unsigned showerMaxInTBin_; + unsigned showerMinOutTBin_; + unsigned showerMaxOutTBin_; /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig, drift_delay; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h index 678ca2eada614..ba03f1cdc9e3e 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h @@ -77,6 +77,9 @@ class CSCBaseboard { // CLCT Processor parameters: edm::ParameterSet clctParams_; + // Shower Trigger parameters: + edm::ParameterSet showerParams_; + // chamber name, e.g. ME+1/1/9 std::string theCSCName_; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h index 4479bfd8bec4a..12e0acce33f98 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h @@ -91,6 +91,10 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { std::vector preTriggerDigisME1a() const; std::vector preTriggerDigisME1b() const; + /* get special bits for high multiplicity triggers */ + unsigned getInTimeHMT() const { return inTimeHMT_; } + unsigned getOutTimeHMT() const { return outTimeHMT_; } + protected: /** Best LCT in this chamber, as found by the processor. */ CSCCLCTDigi bestCLCT[CSCConstants::MAX_CLCT_TBINS]; @@ -202,6 +206,17 @@ class CSCCathodeLCTProcessor : public CSCBaseboard { std::vector thePreTriggerBXs; std::vector thePreTriggerDigis; + /* data members for high multiplicity triggers */ + void encodeHighMultiplicityBits( + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]); + unsigned inTimeHMT_; + unsigned outTimeHMT_; + std::vector thresholds_; + unsigned showerMinInTBin_; + unsigned showerMaxInTBin_; + unsigned showerMinOutTBin_; + unsigned showerMaxOutTBin_; + /** Configuration parameters. */ unsigned int fifo_tbins, fifo_pretrig; // only for test beam mode. unsigned int hit_persist, drift_delay; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h index 4da69d2886dcd..04733cbf229a2 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h @@ -37,6 +37,7 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigi.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigi.h" class CSCMotherboard : public CSCBaseboard { public: @@ -64,6 +65,9 @@ class CSCMotherboard : public CSCBaseboard { /** Returns vector of all found correlated LCTs, if any. */ std::vector getLCTs() const; + /** Returns shower bits */ + CSCShowerDigi readoutShower() const; + /** Clears correlated LCT and passes clear signal on to cathode and anode LCT processors. */ void clear(); @@ -89,6 +93,8 @@ class CSCMotherboard : public CSCBaseboard { /** Container for second correlated LCT. */ CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]; + CSCShowerDigi shower_; + // helper function to return ALCT/CLCT with correct central BX CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi&) const; CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi&) const; @@ -115,8 +121,7 @@ class CSCMotherboard : public CSCBaseboard { bool clct_to_alct; // encode special bits for high-multiplicity triggers - unsigned int highMultiplicityBits_; - bool useHighMultiplicityBits_; + unsigned showerSource_; /** Default values of configuration parameters. */ static const unsigned int def_mpc_block_me1a; @@ -178,6 +183,6 @@ class CSCMotherboard : public CSCBaseboard { void dumpConfigParams() const; /* encode high multiplicity bits for Run-3 exotic triggers */ - void encodeHighMultiplicityBits(unsigned alctBits); + void encodeHighMultiplicityBits(); }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h index 85592467f31d0..7c238ae0e1ed7 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCTriggerPrimitivesBuilder.h @@ -27,6 +27,7 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerCollection.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -76,6 +77,8 @@ class CSCTriggerPrimitivesBuilder { CSCCLCTPreTriggerCollection& oc_pretrig, CSCCorrelatedLCTDigiCollection& oc_lct, CSCCorrelatedLCTDigiCollection& oc_sorted_lct, + CSCShowerDigiCollection& oc_shower, + CSCShowerDigiCollection& oc_shower_anode, GEMCoPadDigiCollection& oc_gemcopad); /** Max values of trigger labels for all CSCs; used to construct TMB diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc index 1426a686047e2..475d4a0b81ec4 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.cc @@ -23,6 +23,8 @@ #include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCALCTPreTriggerDigiCollection.h" #include "DataFormats/CSCDigi/interface/CSCCLCTPreTriggerDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCCorrelatedLCTDigiCollection.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigiCollection.h" // Configuration via EventSetup @@ -44,6 +46,7 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS writeOutAllCLCTs_ = conf.getParameter("writeOutAllCLCTs"); writeOutAllALCTs_ = conf.getParameter("writeOutAllALCTs"); savePreTriggers_ = conf.getParameter("savePreTriggers"); + writeOutShowers_ = conf.getParameter("writeOutShowers"); // check whether you need to run the integrated local triggers const edm::ParameterSet commonParam(conf.getParameter("commonParam")); @@ -75,6 +78,10 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS } produces(); produces("MPCSORTED"); + if (writeOutShowers_) { + produces(); + produces("Anode"); + } if (runME11ILT_ or runME21ILT_) produces(); @@ -139,6 +146,8 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup std::unique_ptr oc_pretrig(new CSCCLCTPreTriggerCollection); std::unique_ptr oc_lct(new CSCCorrelatedLCTDigiCollection); std::unique_ptr oc_sorted_lct(new CSCCorrelatedLCTDigiCollection); + std::unique_ptr oc_shower(new CSCShowerDigiCollection); + std::unique_ptr oc_shower_anode(new CSCShowerDigiCollection); std::unique_ptr oc_gemcopad(new GEMCoPadDigiCollection); if (!wireDigis.isValid()) { @@ -169,6 +178,8 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup *oc_pretrig, *oc_lct, *oc_sorted_lct, + *oc_shower, + *oc_shower_anode, *oc_gemcopad); if (!checkBadChambers_) delete temp; @@ -190,6 +201,10 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup ev.put(std::move(oc_pretrig)); ev.put(std::move(oc_lct)); ev.put(std::move(oc_sorted_lct), "MPCSORTED"); + if (writeOutShowers_) { + ev.put(std::move(oc_shower)); + ev.put(std::move(oc_shower_anode), "Anode"); + } // only put GEM copad collections in the event when the // integrated local triggers are running if (runME11ILT_ or runME21ILT_) diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h index e2c8e7b9478c1..688ee515bec24 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h +++ b/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesProducer.h @@ -89,6 +89,9 @@ class CSCTriggerPrimitivesProducer : public edm::one::EDProducer<> { // Write out pre-triggers bool savePreTriggers_; + // write out showrs + bool writeOutShowers_; + // switch to enable the integrated local triggers in ME11 and ME21 bool runME11ILT_; bool runME21ILT_; diff --git a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py index e17e64d1fcc10..23387362c1219 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py +++ b/L1Trigger/CSCTriggerPrimitives/python/cscTriggerPrimitiveDigis_cfi.py @@ -10,6 +10,7 @@ from L1Trigger.CSCTriggerPrimitives.params.tmbParams import tmbPSets from L1Trigger.CSCTriggerPrimitives.params.auxiliaryParams import auxPSets from L1Trigger.CSCTriggerPrimitives.params.cclutParams import cclutParams +from L1Trigger.CSCTriggerPrimitives.params.showerParams import showerPSet cscTriggerPrimitiveDigis = cms.EDProducer( "CSCTriggerPrimitivesProducer", @@ -39,9 +40,11 @@ writeOutAllCLCTs = cms.bool(False), writeOutAllALCTs = cms.bool(False), savePreTriggers = cms.bool(False), + writeOutShowers = cms.bool(False), commonParam = auxPSets.commonParam.clone(), - mpcParam = auxPSets.mpcParamRun1.clone() + mpcParam = auxPSets.mpcParamRun1.clone(), + showerParam = showerPSet.clone() ) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py new file mode 100644 index 0000000000000..8903fbf5c5deb --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py @@ -0,0 +1,73 @@ +import FWCore.ParameterSet.Config as cms + +#Parameterset for the hadronic shower trigger for Run-3 +showerPSet = cms.PSet( + ## what kind of shower triggers the logic? + ## 0: cathode-only (TMB/OTMB) + ## 1: anode-only (from ALCT board) + ## 2: cathode or anode showers + ## loose -> 'loose anode or loose cathode' + ## nominal -> 'nominal anode or nominal cathode' + ## tight -> 'tight anode or tight cathode' + source = cms.uint32(0), + + ## settings for cathode showers (counting CSCComparatorDigi) + cathodeShower = cms.PSet( + ## {loose, nominal, tight} thresholds for hit counters + ## loose ~ 0.75 kHz + ## nominal ~ 0.5 kHz + ## tight ~ 0.25 kHz + showerThresholds = cms.vuint32( + # ME1/1 + 100, 100, 100, + # ME1/2 + 54, 55, 61, + # ME1/3 + 20, 20, 30, + # ME2/1 + 35, 35, 35, + # ME2/2 + 29, 29, 35, + # ME3/1 + 35, 35, 40, + # ME3/2 + 24, 25, 30, + # ME4/1 + 36, 40, 40, + # ME4/2 + 26, 30, 30 + ), + showerMinInTBin = cms.uint32(6), + showerMaxInTBin = cms.uint32(8), + showerMinOutTBin = cms.uint32(2), + showerMaxOutTBin = cms.uint32(5), + ), + ## settings for anode showers (counting CSCWireDigi) + anodeShower = cms.PSet( + ## {loose, nominal, tight} thresholds for hit counters + showerThresholds = cms.vuint32( + # ME1/1 + 104, 105, 107, + # ME1/2 + 92, 100, 102, + # ME1/3 + 32, 33, 48, + # ME2/1 + 133, 134, 136, + # ME2/2 + 83, 84, 86, + # ME3/1 + 130, 131, 133, + # ME3/2 + 74, 80, 87, + # ME4/1 + 127, 128, 130, + # ME4/2 + 88, 89, 94 + ), + showerMinInTBin = cms.uint32(8), + showerMaxInTBin = cms.uint32(10), + showerMinOutTBin = cms.uint32(4), + showerMaxOutTBin = cms.uint32(7), + ) +) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index c369dc1f66ea7..4d85354059521 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -81,6 +81,13 @@ CSCAnodeLCTProcessor::CSCAnodeLCTProcessor(unsigned endcap, // quality control of stubs qualityControl_ = std::make_unique(endcap, station, sector, subsector, chamber, conf); + + const auto& shower = showerParams_.getParameterSet("anodeShower"); + thresholds_ = shower.getParameter>("showerThresholds"); + showerMinInTBin_ = shower.getParameter("showerMinInTBin"); + showerMaxInTBin_ = shower.getParameter("showerMaxInTBin"); + showerMinOutTBin_ = shower.getParameter("showerMinOutTBin"); + showerMaxOutTBin_ = shower.getParameter("showerMaxOutTBin"); } CSCAnodeLCTProcessor::CSCAnodeLCTProcessor() : CSCBaseboard() { @@ -195,6 +202,8 @@ void CSCAnodeLCTProcessor::clear() { secondALCT[bx].clear(); } lct_list.clear(); + inTimeHMT_ = 0; + outTimeHMT_ = 0; } void CSCAnodeLCTProcessor::clear(const int wire, const int pattern) { @@ -273,6 +282,9 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* } if (layersHit >= min_layers) run(wire); + + // Get the high multiplicity bits in this chamber + encodeHighMultiplicityBits(wire); } // Return vector of all found ALCTs. @@ -1326,6 +1338,9 @@ CSCALCTDigi CSCAnodeLCTProcessor::getBestALCT(int bx) const { return bestALCT[bx CSCALCTDigi CSCAnodeLCTProcessor::getSecondALCT(int bx) const { return secondALCT[bx]; } +/** Returns shower bits */ +CSCShowerDigi CSCAnodeLCTProcessor::readoutShower() const { return shower_; } + //////////////////////////////////////////////////////////////////////// ////////////////////////////Test Routines/////////////////////////////// @@ -1383,3 +1398,43 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire // set the hit container alct.setHits(wireHits); } + +void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( + const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { + inTimeHMT_ = 0; + outTimeHMT_ = 0; + + auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; + auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; + + unsigned hitsInTime = 0; + unsigned hitsOutTime = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { + auto times = wires[i_layer][i_hstrip]; + // count the wires in-time and out-time + hitsInTime += std::count_if(times.begin(), times.end(), inTime); + hitsOutTime += std::count_if(times.begin(), times.end(), outTime); + } + } + + // convert station and ring number to index + // index runs from 2 to 10, subtract 2 + unsigned csc_idx = CSCDetId::iChamberType(theStation, theRing) - 2; + + // loose, nominal and tight + std::vector station_thresholds = { + thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; + + for (unsigned i = 0; i < station_thresholds.size(); i++) { + if (hitsInTime >= station_thresholds[i]) { + inTimeHMT_ = i + 1; + } + if (hitsOutTime >= station_thresholds[i]) { + outTimeHMT_ = i + 1; + } + } + + // create a new object + shower_ = CSCShowerDigi(inTimeHMT_, outTimeHMT_, theTrigChamber); +} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc index 48e95ceb414be..bea2dc5550f38 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCBaseboard.cc @@ -21,6 +21,8 @@ CSCBaseboard::CSCBaseboard(unsigned endcap, commonParams_ = conf.getParameter("commonParam"); + showerParams_ = conf.getParameterSet("showerParam"); + theCSCName_ = CSCDetId::chamberName(theEndcap, theStation, theRing, theChamber); runPhase2_ = commonParams_.getParameter("runPhase2"); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index 6808406df853e..e77689ba2bd1b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -98,6 +98,13 @@ CSCCathodeLCTProcessor::CSCCathodeLCTProcessor(unsigned endcap, } } + const auto& shower = showerParams_.getParameterSet("cathodeShower"); + thresholds_ = shower.getParameter>("showerThresholds"); + showerMinInTBin_ = shower.getParameter("showerMinInTBin"); + showerMaxInTBin_ = shower.getParameter("showerMaxInTBin"); + showerMinOutTBin_ = shower.getParameter("showerMinOutTBin"); + showerMaxOutTBin_ = shower.getParameter("showerMaxOutTBin"); + thePreTriggerDigis.clear(); // quality control of stubs @@ -206,6 +213,8 @@ void CSCCathodeLCTProcessor::clear() { bestCLCT[bx].clear(); secondCLCT[bx].clear(); } + inTimeHMT_ = 0; + outTimeHMT_ = 0; } std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiCollection* compdc) { @@ -324,6 +333,9 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // strip read-out conditions in DigiToRaw.) if (layersHit >= nplanes_hit_pretrig) run(halfstrip); + + // Get the high multiplicity bits in this chamber + encodeHighMultiplicityBits(halfstrip); } // Return vector of CLCTs. @@ -1458,3 +1470,40 @@ unsigned CSCCathodeLCTProcessor::convertSlopeToRun2Pattern(const unsigned slope) 10, 10, 10, 9, 9, 9, 7, 7, 7, 7, 5, 5, 3, 3, 3, 3}; return slopeList[slope]; } + +void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( + const std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]) { + inTimeHMT_ = 0; + outTimeHMT_ = 0; + + auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; + auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; + + unsigned hitsInTime = 0; + unsigned hitsOutTime = 0; + for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { + for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { + auto times = halfstrip[i_layer][i_hstrip]; + // count the half-strips in-time and out-time + hitsInTime += std::count_if(times.begin(), times.end(), inTime); + hitsOutTime += std::count_if(times.begin(), times.end(), outTime); + } + } + + // convert station and ring number to index + // index runs from 2 to 10, subtract 2 + unsigned csc_idx = CSCDetId::iChamberType(theStation, theRing) - 2; + + // loose, nominal and tight + std::vector station_thresholds = { + thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; + + for (unsigned i = 0; i < station_thresholds.size(); i++) { + if (hitsInTime >= station_thresholds[i]) { + inTimeHMT_ = i + 1; + } + if (hitsOutTime >= station_thresholds[i]) { + outTimeHMT_ = i + 1; + } + } +} diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 520f63fff0556..3c86aa1bd24cb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -273,9 +273,6 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct // Not used in Run-2. Will not be assigned in Run-3 thisLCT.setSyncErr(0); thisLCT.setCSCID(theTrigChamber); - // in Run-3 we plan to denote the presence of exotic signatures in the chamber - if (useHighMultiplicityBits_) - thisLCT.setHMT(highMultiplicityBits_); // future work: add a section that produces LCTs according // to the new LCT dataformat (not yet defined) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc index 7d5275100c7df..c8c36ab6c43cf 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc @@ -60,8 +60,7 @@ void CSCGEMMotherboardME11::run(const CSCWireDigiCollection* wiredc, CSCGEMMotherboard::clear(); // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); if (gem_g != nullptr) { if (infoV >= 0) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc index 8d2e6d114a38f..bc7b661a68e1d 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME21.cc @@ -43,8 +43,7 @@ void CSCGEMMotherboardME21::run(const CSCWireDigiCollection* wiredc, CSCGEMMotherboard::clear(); // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); if (gem_g != nullptr) { if (infoV >= 0) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 063a369562206..7e7df46a0199e 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -38,10 +38,6 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, clct_to_alct = tmbParams_.getParameter("clctToAlct"); - // special tmb bits - useHighMultiplicityBits_ = tmbParams_.getParameter("useHighMultiplicityBits"); - highMultiplicityBits_ = 0; - // whether to readout only the earliest two LCTs in readout window readout_earliest_2 = tmbParams_.getParameter("tmbReadoutEarliest2"); @@ -59,6 +55,9 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, // quality control of stubs qualityControl_ = std::make_unique(endcap, station, sector, subsector, chamber, conf); + + // shower-trigger source + showerSource_ = showerParams_.getParameter("source"); } CSCMotherboard::CSCMotherboard() : CSCBaseboard() { @@ -102,6 +101,9 @@ void CSCMotherboard::clear() { firstLCT[bx].clear(); secondLCT[bx].clear(); } + + // reset the shower trigger + shower_.clear(); } // Set configuration parameters obtained via EventSetup mechanism. @@ -150,8 +152,7 @@ void CSCMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCComparato return; // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); // CLCT-centric matching if (clct_to_alct) { @@ -428,6 +429,8 @@ std::vector CSCMotherboard::getLCTs() const { return tmpV; } +CSCShowerDigi CSCMotherboard::readoutShower() const { return shower_; } + void CSCMotherboard::correlateLCTs( const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, const CSCCLCTDigi& sCLCT, int type) { CSCALCTDigi bestALCT = bALCT; @@ -528,10 +531,6 @@ CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs(const CSCALCTDigi& aLCT, thisLCT.setRun3Pattern(cLCT.getRun3Pattern()); } - // in Run-3 we plan to denote the presence of exotic signatures in the chamber - if (useHighMultiplicityBits_) - thisLCT.setHMT(highMultiplicityBits_); - // make sure to shift the ALCT BX from 8 to 3 and the CLCT BX from 8 to 7! thisLCT.setALCT(getBXShiftedALCT(aLCT)); thisLCT.setCLCT(getBXShiftedCLCT(cLCT)); @@ -708,11 +707,36 @@ CSCCLCTDigi CSCMotherboard::getBXShiftedCLCT(const CSCCLCTDigi& cLCT) const { return cLCT_shifted; } -void CSCMotherboard::encodeHighMultiplicityBits(unsigned alctBits) { - // encode the high multiplicity bits in the (O)TMB based on - // the high multiplicity bits from the ALCT processor - // draft version: simply rellay the ALCT bits. - // future versions may involve also bits from the CLCT processor - // this depends on memory constraints in the TMB FPGA - highMultiplicityBits_ = alctBits; +void CSCMotherboard::encodeHighMultiplicityBits() { + // get the hmt bits + unsigned cathodeInTime = clctProc->getInTimeHMT(); + unsigned cathodeOutTime = clctProc->getOutTimeHMT(); + unsigned anodeInTime = alctProc->getInTimeHMT(); + unsigned anodeOutTime = alctProc->getOutTimeHMT(); + + unsigned inTimeHMT_; + unsigned outTimeHMT_; + + // set the value according to source + switch (showerSource_) { + case 0: + inTimeHMT_ = cathodeInTime; + outTimeHMT_ = cathodeOutTime; + break; + case 1: + inTimeHMT_ = anodeInTime; + outTimeHMT_ = anodeOutTime; + break; + case 2: + inTimeHMT_ = (anodeInTime & CSCShowerDigi::kInTimeMask) | (cathodeInTime & CSCShowerDigi::kInTimeMask); + outTimeHMT_ = (anodeOutTime & CSCShowerDigi::kOutTimeMask) | (cathodeOutTime & CSCShowerDigi::kOutTimeMask); + break; + default: + inTimeHMT_ = cathodeInTime; + outTimeHMT_ = cathodeOutTime; + break; + }; + + // create a new object + shower_ = CSCShowerDigi(inTimeHMT_, outTimeHMT_, theTrigChamber); } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc index 63e180b301f1b..53c8c126b0d3b 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc @@ -72,8 +72,7 @@ void CSCMotherboardME11::run(const CSCWireDigiCollection* wiredc, const CSCCompa return; // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); int used_alct_mask[20]; int used_clct_mask[20]; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc index d0b6cab1c7417..8eb395d935b35 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCTriggerPrimitivesBuilder.cc @@ -119,6 +119,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, CSCCLCTPreTriggerCollection& oc_pretrig, CSCCorrelatedLCTDigiCollection& oc_lct, CSCCorrelatedLCTDigiCollection& oc_sorted_lct, + CSCShowerDigiCollection& oc_shower, + CSCShowerDigiCollection& oc_shower_anode, GEMCoPadDigiCollection& oc_gemcopad) { // CSC geometry. for (int endc = min_endcap; endc <= max_endcap; endc++) { @@ -178,6 +180,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& clctV1a = tmb11->clctProc->readoutCLCTsME1a(); const std::vector& pretriggerV1a = tmb11->clctProc->preTriggerDigisME1a(); const std::vector& alctpretriggerV = tmb11->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb11->readoutShower(); + const CSCShowerDigi& anodeShower = tmb11->alctProc->readoutShower(); if (infoV > 1) LogTrace("CSCTriggerPrimitivesBuilder") @@ -198,6 +202,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, " ME1b CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " ME1b CLCT pre-trigger BX"); put(alctpretriggerV, oc_alctpretrigger, detid, " ME1b ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); // ME1/a @@ -246,6 +254,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& pretriggerV1a = tmb11GEM->clctProc->preTriggerDigisME1a(); const std::vector& copads = tmb11GEM->coPadProcessor->readoutCoPads(); const std::vector& alctpretriggerV = tmb11GEM->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb11GEM->readoutShower(); + const CSCShowerDigi& anodeShower = tmb11GEM->alctProc->readoutShower(); // ME1/b if (!(lctV.empty() && alctV.empty() && clctV.empty()) and infoV > 1) { @@ -262,6 +272,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(preTriggerBXs, oc_pretrig, detid, " ME1b CLCT pre-trigger BX"); put(copads, oc_gemcopad, gemId, " GEM coincidence pad"); put(alctpretriggerV, oc_alctpretrigger, detid, " ME1b ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); // ME1/a if (disableME1a_) @@ -303,6 +317,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& pretriggerV = tmb21GEM->clctProc->preTriggerDigis(); const std::vector& copads = tmb21GEM->coPadProcessor->readoutCoPads(); const std::vector& alctpretriggerV = tmb21GEM->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb21GEM->readoutShower(); + const CSCShowerDigi& anodeShower = tmb21GEM->alctProc->readoutShower(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -318,6 +334,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(preTriggerBXs, oc_pretrig, detid, " ME21 CLCT pre-trigger BX"); put(copads, oc_gemcopad, gemId, " GEM coincidence pad"); put(alctpretriggerV, oc_alctpretrigger, detid, " ME21 ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); } // running upgraded ME2/1-ME3/1-ME4/1 TMBs (without GEMs or RPCs) else if (runPhase2_ and ring == 1 and @@ -339,6 +359,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& preTriggerBXs = utmb->clctProc->preTriggerBXs(); const std::vector& pretriggerV = utmb->clctProc->preTriggerDigis(); const std::vector& alctpretriggerV = utmb->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = utmb->readoutShower(); + const CSCShowerDigi& anodeShower = utmb->alctProc->readoutShower(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -353,6 +375,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, " CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, " CLCT pre-trigger BX"); put(alctpretriggerV, oc_alctpretrigger, detid, " ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); } // running non-upgraded TMB @@ -371,6 +397,8 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, const std::vector& preTriggerBXs = tmb->clctProc->preTriggerBXs(); const std::vector& pretriggerV = tmb->clctProc->preTriggerDigis(); const std::vector& alctpretriggerV = tmb->alctProc->preTriggerDigis(); + const CSCShowerDigi& shower = tmb->readoutShower(); + const CSCShowerDigi& anodeShower = tmb->alctProc->readoutShower(); if (!(alctV.empty() && clctV.empty() && lctV.empty()) and infoV > 1) { LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder got results in " << detid; @@ -385,6 +413,10 @@ void CSCTriggerPrimitivesBuilder::build(const CSCBadChambers* badChambers, put(pretriggerV, oc_pretrigger, detid, tmb->getCSCName() + " CLCT pre-trigger digi"); put(preTriggerBXs, oc_pretrig, detid, tmb->getCSCName() + " CLCT pre-trigger BX"); put(alctpretriggerV, oc_alctpretrigger, detid, tmb->getCSCName() + " ALCT pre-trigger digi"); + if (shower.isValid()) + oc_shower.insertDigi(detid, shower); + if (anodeShower.isValid()) + oc_shower_anode.insertDigi(detid, anodeShower); } // non-upgraded TMB } } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc index b050da3aadfcb..ef0ef7a6cc0cd 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc @@ -85,8 +85,7 @@ void CSCUpgradeMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCCo return; // encode high multiplicity bits - unsigned alctBits = alctProc->getHighMultiplictyBits(); - encodeHighMultiplicityBits(alctBits); + encodeHighMultiplicityBits(); int used_clct_mask[20]; for (int c = 0; c < 20; ++c) From 03ce272ad4a302c0abaf8564284d154847c0556f Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 14 Apr 2021 20:40:13 -0500 Subject: [PATCH 3/4] Fix the memory error --- .../src/CSCAnodeLCTProcessor.cc | 25 ++++++++++--------- .../src/CSCCathodeLCTProcessor.cc | 18 ++++++++----- .../src/CSCMotherboard.cc | 4 ++- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 4d85354059521..56b6df4b71a73 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -259,9 +259,9 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* bool hasDigis = getDigis(wiredc); if (hasDigis) { - // First get wire times from the wire digis. - std::vector wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; - readWireDigis(wire); + // First get wiregroup times from the wire digis. + std::vector wireGroupTimes[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]; + readWireDigis(wireGroupTimes); // Pass an array of wire times on to another run() doing the LCT search. // If the number of layers containing digis is smaller than that @@ -274,17 +274,16 @@ std::vector CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* unsigned int layersHit = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_wire = 0; i_wire < numWireGroups; i_wire++) { - if (!wire[i_layer][i_wire].empty()) { + if (!wireGroupTimes[i_layer][i_wire].empty()) { layersHit++; break; } } } if (layersHit >= min_layers) - run(wire); - + run(wireGroupTimes); // Get the high multiplicity bits in this chamber - encodeHighMultiplicityBits(wire); + encodeHighMultiplicityBits(wireGroupTimes); } // Return vector of all found ALCTs. @@ -298,7 +297,7 @@ void CSCAnodeLCTProcessor::run(const std::vector wire[CSCConstants::NUM_LAY bool chamber_empty = pulseExtension(wire); // define a new pattern map - // for each key half wire, and for each pattern, store the 2D collection of fired wire digis + // for each key wiregroup, and for each pattern, store the 2D collection of fired wiregroup digis std::map> hits_in_patterns; hits_in_patterns.clear(); @@ -1400,19 +1399,20 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire } void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( - const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { + const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { inTimeHMT_ = 0; outTimeHMT_ = 0; + // functions for in-time and out-of-time auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; + // count the wires in-time and out-time unsigned hitsInTime = 0; unsigned hitsOutTime = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { - for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { - auto times = wires[i_layer][i_hstrip]; - // count the wires in-time and out-time + for (int i_wire = 0; i_wire < CSCConstants::MAX_NUM_WIRES; i_wire++) { + auto times = wires[i_layer][i_wire]; hitsInTime += std::count_if(times.begin(), times.end(), inTime); hitsOutTime += std::count_if(times.begin(), times.end(), outTime); } @@ -1426,6 +1426,7 @@ void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( std::vector station_thresholds = { thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; + // assign the bits for (unsigned i = 0; i < station_thresholds.size(); i++) { if (hitsInTime >= station_thresholds[i]) { inTimeHMT_ = i + 1; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc index e77689ba2bd1b..55f48941735ee 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCCathodeLCTProcessor.cc @@ -310,8 +310,8 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl if (hasDigis) { // Get halfstrip times from comparator digis. - std::vector halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; - readComparatorDigis(halfstrip); + std::vector halfStripTimes[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]; + readComparatorDigis(halfStripTimes); // Pass arrays of halfstrips on to another run() doing the // LCT search. @@ -322,7 +322,7 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl unsigned int layersHit = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { - if (!halfstrip[i_layer][i_hstrip].empty()) { + if (!halfStripTimes[i_layer][i_hstrip].empty()) { layersHit++; break; } @@ -332,10 +332,10 @@ std::vector CSCCathodeLCTProcessor::run(const CSCComparatorDigiColl // to fire is not null. (Pre-trigger decisions are used for the // strip read-out conditions in DigiToRaw.) if (layersHit >= nplanes_hit_pretrig) - run(halfstrip); + run(halfStripTimes); // Get the high multiplicity bits in this chamber - encodeHighMultiplicityBits(halfstrip); + encodeHighMultiplicityBits(halfStripTimes); } // Return vector of CLCTs. @@ -1476,15 +1476,16 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( inTimeHMT_ = 0; outTimeHMT_ = 0; + // functions for in-time and out-of-time auto inTime = [=](unsigned time) { return time >= showerMinInTBin_ and time <= showerMaxInTBin_; }; auto outTime = [=](unsigned time) { return time >= showerMinOutTBin_ and time <= showerMaxOutTBin_; }; + // count the half-strips in-time and out-time unsigned hitsInTime = 0; unsigned hitsOutTime = 0; for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) { for (int i_hstrip = 0; i_hstrip < CSCConstants::NUM_HALF_STRIPS_7CFEBS; i_hstrip++) { auto times = halfstrip[i_layer][i_hstrip]; - // count the half-strips in-time and out-time hitsInTime += std::count_if(times.begin(), times.end(), inTime); hitsOutTime += std::count_if(times.begin(), times.end(), outTime); } @@ -1498,6 +1499,7 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( std::vector station_thresholds = { thresholds_[csc_idx * 3], thresholds_[csc_idx * 3 + 1], thresholds_[csc_idx * 3 + 2]}; + // assign the bits for (unsigned i = 0; i < station_thresholds.size(); i++) { if (hitsInTime >= station_thresholds[i]) { inTimeHMT_ = i + 1; @@ -1506,4 +1508,8 @@ void CSCCathodeLCTProcessor::encodeHighMultiplicityBits( outTimeHMT_ = i + 1; } } + + // no shower object is created here. that is done at a later stage + // in the motherboar, where potentially the trigger decisions from + // anode hit counters and cathode hit counters are combined } diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index 7e7df46a0199e..df6aa5c8de1a3 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -708,12 +708,14 @@ CSCCLCTDigi CSCMotherboard::getBXShiftedCLCT(const CSCCLCTDigi& cLCT) const { } void CSCMotherboard::encodeHighMultiplicityBits() { - // get the hmt bits + // get the high multiplicity + // for anode this reflects what is already in the anode CSCShowerDigi object unsigned cathodeInTime = clctProc->getInTimeHMT(); unsigned cathodeOutTime = clctProc->getOutTimeHMT(); unsigned anodeInTime = alctProc->getInTimeHMT(); unsigned anodeOutTime = alctProc->getOutTimeHMT(); + // assign the bits unsigned inTimeHMT_; unsigned outTimeHMT_; From a8098cedd14c26a8ab5857aa01e7d3111c52c174 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 14 Apr 2021 20:49:13 -0500 Subject: [PATCH 4/4] Code format --- L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 56b6df4b71a73..73e46756421b9 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -1399,7 +1399,7 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire } void CSCAnodeLCTProcessor::encodeHighMultiplicityBits( - const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { + const std::vector wires[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) { inTimeHMT_ = 0; outTimeHMT_ = 0;