Skip to content

Commit

Permalink
Hit counter for shower trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Dildick committed Apr 13, 2021
1 parent b633533 commit 122a409
Show file tree
Hide file tree
Showing 19 changed files with 324 additions and 36 deletions.
21 changes: 17 additions & 4 deletions L1Trigger/CSCTriggerPrimitives/interface/CSCAnodeLCTProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand All @@ -105,6 +110,8 @@ class CSCAnodeLCTProcessor : public CSCBaseboard {
/** LCTs in this chamber, as found by the processor. */
std::vector<std::vector<CSCALCTDigi> > ALCTContainer_;

CSCShowerDigi shower_;

/** Access routines to wire digis. */
bool getDigis(const CSCWireDigiCollection* wiredc);
void getDigis(const CSCWireDigiCollection* wiredc, const CSCDetId& id);
Expand All @@ -123,8 +130,14 @@ class CSCAnodeLCTProcessor : public CSCBaseboard {
std::vector<CSCALCTPreTriggerDigi> thePreTriggerDigis;

/* data members for high multiplicity triggers */
void encodeHighMultiplicityBits();
unsigned int highMultiplicityBits_;
void encodeHighMultiplicityBits(const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]);
unsigned inTimeHMT_;
unsigned outTimeHMT_;
std::vector<unsigned> thresholds_;
unsigned showerMinInTBin_;
unsigned showerMaxInTBin_;
unsigned showerMinOutTBin_;
unsigned showerMaxOutTBin_;

/** Configuration parameters. */
unsigned int fifo_tbins, fifo_pretrig, drift_delay;
Expand Down
3 changes: 3 additions & 0 deletions L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;

Expand Down
15 changes: 15 additions & 0 deletions L1Trigger/CSCTriggerPrimitives/interface/CSCCathodeLCTProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class CSCCathodeLCTProcessor : public CSCBaseboard {
std::vector<CSCCLCTPreTriggerDigi> preTriggerDigisME1a() const;
std::vector<CSCCLCTPreTriggerDigi> 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];
Expand Down Expand Up @@ -202,6 +206,17 @@ class CSCCathodeLCTProcessor : public CSCBaseboard {
std::vector<int> thePreTriggerBXs;
std::vector<CSCCLCTPreTriggerDigi> thePreTriggerDigis;

/* data members for high multiplicity triggers */
void encodeHighMultiplicityBits(
const std::vector<int> halfstrip[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS]);
unsigned inTimeHMT_;
unsigned outTimeHMT_;
std::vector<unsigned> 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;
Expand Down
11 changes: 8 additions & 3 deletions L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -64,6 +65,9 @@ class CSCMotherboard : public CSCBaseboard {
/** Returns vector of all found correlated LCTs, if any. */
std::vector<CSCCorrelatedLCTDigi> getLCTs() const;

/** Returns shower bits */
CSCShowerDigi readoutShower() const;

/** Clears correlated LCT and passes clear signal on to cathode and anode
LCT processors. */
void clear();
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -44,6 +46,7 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS
writeOutAllCLCTs_ = conf.getParameter<bool>("writeOutAllCLCTs");
writeOutAllALCTs_ = conf.getParameter<bool>("writeOutAllALCTs");
savePreTriggers_ = conf.getParameter<bool>("savePreTriggers");
writeOutShowers_ = conf.getParameter<bool>("writeOutShowers");

// check whether you need to run the integrated local triggers
const edm::ParameterSet commonParam(conf.getParameter<edm::ParameterSet>("commonParam"));
Expand Down Expand Up @@ -75,6 +78,10 @@ CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer(const edm::ParameterS
}
produces<CSCCorrelatedLCTDigiCollection>();
produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
if (writeOutShowers_) {
produces<CSCShowerDigiCollection>();
produces<CSCShowerDigiCollection>("Anode");
}
if (runME11ILT_ or runME21ILT_)
produces<GEMCoPadDigiCollection>();

Expand Down Expand Up @@ -139,6 +146,8 @@ void CSCTriggerPrimitivesProducer::produce(edm::Event& ev, const edm::EventSetup
std::unique_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
std::unique_ptr<CSCShowerDigiCollection> oc_shower(new CSCShowerDigiCollection);
std::unique_ptr<CSCShowerDigiCollection> oc_shower_anode(new CSCShowerDigiCollection);
std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);

if (!wireDigis.isValid()) {
Expand Down Expand Up @@ -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;
Expand All @@ -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_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()
)


Expand Down
73 changes: 73 additions & 0 deletions L1Trigger/CSCTriggerPrimitives/python/params/showerParams.py
Original file line number Diff line number Diff line change
@@ -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),
)
)
55 changes: 55 additions & 0 deletions L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ CSCAnodeLCTProcessor::CSCAnodeLCTProcessor(unsigned endcap,

// quality control of stubs
qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf);

const auto& shower = showerParams_.getParameterSet("anodeShower");
thresholds_ = shower.getParameter<std::vector<unsigned>>("showerThresholds");
showerMinInTBin_ = shower.getParameter<unsigned>("showerMinInTBin");
showerMaxInTBin_ = shower.getParameter<unsigned>("showerMaxInTBin");
showerMinOutTBin_ = shower.getParameter<unsigned>("showerMinOutTBin");
showerMaxOutTBin_ = shower.getParameter<unsigned>("showerMaxOutTBin");
}

CSCAnodeLCTProcessor::CSCAnodeLCTProcessor() : CSCBaseboard() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -273,6 +282,9 @@ std::vector<CSCALCTDigi> 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.
Expand Down Expand Up @@ -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///////////////////////////////

Expand Down Expand Up @@ -1383,3 +1398,43 @@ void CSCAnodeLCTProcessor::setWireContainer(CSCALCTDigi& alct, CSCALCTDigi::Wire
// set the hit container
alct.setHits(wireHits);
}

void CSCAnodeLCTProcessor::encodeHighMultiplicityBits(
const std::vector<int> 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<unsigned> 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);
}

0 comments on commit 122a409

Please sign in to comment.