27 bool decision(
int nP,
int nM,
int bit);
47 const int HcalTTPDigiProducer::inputs_[] = {30, 66, 4, 44, 4, 44, 0, 68, 0, 68, 16, 48, 16, 48, 6, 46, 6, 46,
48 2, 70, 2, 70, 18, 50, 18, 50, 12, 40, 12, 40, 8, 52, 8, 52, 20, 36,
49 20, 36, 14, 42, 14, 42, 10, 54, 10, 54, 22, 38, 22, 38, 24, 56, 24, 56,
50 32, 60, 32, 60, 28, 64, 28, 64, 26, 58, 26, 58, 34, 62, 34, 62, 30, 66};
61 for (
int i = 0;
i < 4;
i++) {
69 "hits>=%d:hfp%c=%d%chfm%c=%d",
78 throw cms::Exception(
"HcalTTPDigiProducer") <<
"Unable to read logic for technical trigger";
79 }
else if (
calc_[
i] == 6) {
81 throw cms::Exception(
"HcalTTPDigiProducer") <<
"Unable to read logic for technical trigger";
84 throw cms::Exception(
"HcalTTPDigiProducer") <<
"Technical Trigger logic must obey the following format:\n" 85 "\"hits>=[A1]:hfp[B1]=[A2][C]hfm[B2]=[A3]\",\n" 86 "or \"hits>=[A1]\",\n" 87 "with A# >= 0, B# = (</>) and C = (:/|)";
89 throw cms::Exception(
"HcalTTPDigiProducer") <<
"Unable to read logic for technical trigger";
105 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Samples forced to maximum value of 8";
109 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Presamples reset to HF SoI value";
112 produces<HcalTTPDigiCollection>();
125 if ((nP + nM) <
nHits_[bit])
128 return ((nP + nM) >=
nHits_[bit]);
130 if (
pReq_[bit] ==
'>')
131 pOK = (nP >=
nHFp_[bit]);
132 else if (
pReq_[bit] ==
'<')
133 pOK = (nP <=
nHFp_[bit]);
135 if (
mReq_[bit] ==
'>')
136 mOK = (nM >=
nHFm_[bit]);
137 else if (
mReq_[bit] ==
'<')
138 mOK = (nM <=
nHFm_[bit]);
146 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Trigger logic exhausted. Returning false";
153 e.getByToken(
tok_hf_, hfDigiCollection);
160 uint16_t trigInputs[40];
163 for (
int i = 0;
i < 8;
i++) {
166 for (
int j = 0;
j < 5;
j++)
167 trigInputs[
j * 8 +
i] = 0;
183 int offset = (-1 +
id.zside()) / 2;
186 while (
shift >= 16) {
190 if (!(trigInputs[(linSample * 8) +
group] & (1 <<
shift)))
191 (
id.ieta() > 0) ? (nP[linSample]++) : (nM[linSample]++);
192 trigInputs[(linSample * 8) +
group] |= (1 <<
shift);
198 uint8_t trigOutput[8];
199 uint32_t algoDepBits[8];
201 for (
int linSample = 0; linSample < 8; linSample++) {
202 trigOutput[linSample] = 0;
203 algoDepBits[linSample] = 0;
205 for (
int j = 0;
j < 4;
j++)
206 trigOutput[linSample] |= (
decision(nP[linSample], nM[linSample],
j) <<
j);
207 int nT = nP[linSample] + nM[linSample];
212 algoDepBits[linSample] = (nT & 0x7F) | ((nP[linSample] & 0x3F) << 7) | ((nM[linSample] & 0x3F) << 13);
214 (linSample -
presamples_), &trigInputs[linSample * 8], algoDepBits[linSample], trigOutput[linSample]);
217 ttpResult->push_back(ttpDigi);
T getParameter(std::string const &) const
edm::ESGetToken< HcalTPGCoder, HcalTPGRecord > tok_tpgCoder_
#define DEFINE_FWK_MODULE(type)
std::vector< T >::const_iterator const_iterator
void produce(edm::Event &e, const edm::EventSetup &c) override
std::vector< unsigned int > maskedChannels_
bool isMasked(HcalDetId id)
T getUntrackedParameter(std::string const &, T const &) const
static const int inputs_[]
~HcalTTPDigiProducer() override=default
void setSample(int relativeSample, const uint16_t *triggerInputs, const uint32_t algodep, const uint8_t outputTrigger)
const_iterator begin() const
bool decision(int nP, int nM, int bit)
const_iterator end() const
virtual void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const =0
edm::SortedCollection< HcalTTPDigi > HcalTTPDigiCollection
edm::EDGetTokenT< HFDigiCollection > tok_hf_
static unsigned int const shift
Log< level::Warning, false > LogWarning
HcalTTPDigiProducer(const edm::ParameterSet &ps)