14 0,68,16,48,16,48,6,46,
16 18,50,12,40,12,40,8,52,
17 8,52,20,36,20,36,14,42,
18 14,42,10,54,10,54,22,38,
19 22,38,24,56,24,56,32,60,
20 32,60,28,64,28,64,26,58,
21 26,58,34,62,34,62,30,66 } ;
32 for (
int i=0;
i<4;
i++) {
35 calc_[
i] = sscanf(bit_[
i].c_str(),
"hits>=%d:hfp%c=%d%chfm%c=%d",
38 if (
calc_[i] == 1 ) {
41 <<
"Unable to read logic for technical trigger" ;
42 }
else if (
calc_[i] == 6 ) {
45 <<
"Unable to read logic for technical trigger" ;
50 <<
"Technical Trigger logic must obey the following format:\n"
51 "\"hits>=[A1]:hfp[B1]=[A2][C]hfm[B2]=[A3]\",\n"
52 "or \"hits>=[A1]\",\n"
53 "with A# >= 0, B# = (</>) and C = (:/|)" ;
56 <<
"Unable to read logic for technical trigger" ;
72 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Samples forced to maximum value of 8" ;
74 if ( presamples_ - SoI_ > 0 ) {
76 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Presamples reset to HF SoI value" ;
79 produces<HcalTTPDigiCollection>();
93 if (
calc_[bit] == 1 )
return ( (nP + nM) >=
nHits_[bit] ) ;
95 if (
pReq_[bit] ==
'>' ) pOK = ( nP >=
nHFp_[bit] ) ;
96 else if (
pReq_[bit] ==
'<' ) pOK = ( nP <=
nHFp_[bit] ) ;
98 if (
mReq_[bit] ==
'>' ) mOK = ( nM >=
nHFm_[bit] ) ;
99 else if (
mReq_[bit] ==
'<' ) mOK = ( nM <=
nHFm_[bit] ) ;
101 if (
pmLogic_[bit] ==
':' )
return ( pOK && mOK ) ;
102 else if (
pmLogic_[bit] ==
'|' )
return ( pOK || mOK ) ;
105 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Trigger logic exhausted. Returning false" ;
121 uint16_t trigInputs[40] ;
122 int nP[8] ;
int nM[8] ;
123 for (
int i=0;
i<8;
i++) {
124 nP[
i] = 0 ; nM[
i] = 0 ;
125 for (
int j=0;
j<5;
j++) trigInputs[
j*8+
i] = 0 ;
128 theDigi!=hfDigiCollection->end(); theDigi++) {
134 inputCoder->adc2Linear(*theDigi,samples) ;
139 int offset = (-1+
id.zside())/2 ;
142 while ( shift >= 16 ) { shift -= 16 ; group++ ; }
143 if ( !(trigInputs[(linSample*8)+group]&(1<<shift)) )
144 (
id.ieta() > 0 ) ? ( nP[linSample]++) : ( nM[linSample]++ ) ;
145 trigInputs[(linSample*8)+group] |= (1<<shift) ;
151 uint8_t trigOutput[8] ;
152 uint32_t algoDepBits[8] ;
154 for (
int linSample=0; linSample<8; linSample++) {
155 trigOutput[linSample] = 0 ; algoDepBits[linSample] = 0 ;
157 for (
int j=0;
j<4;
j++)
158 trigOutput[linSample] |= (
decision(nP[linSample],nM[linSample],
j)<<
j) ;
159 int nT = nP[linSample] + nM[linSample] ;
163 if (
fwAlgo_ == 1 ) algoDepBits[linSample] = (nT&0x7F) | ((nP[linSample]&0x3F)<<7) | ((nM[linSample]&0x3F)<<13) ;
164 ttpDigi.
setSample((linSample-
presamples_),&trigInputs[linSample*8],algoDepBits[linSample],trigOutput[linSample]) ;
167 ttpResult->push_back( ttpDigi ) ;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< HFDataFrame >::const_iterator const_iterator
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
std::vector< unsigned int > maskedChannels_
bool isMasked(HcalDetId id)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static const int inputs_[]
void setSample(int relativeSample, const uint16_t *triggerInputs, const uint32_t algodep, const uint8_t outputTrigger)
bool decision(int nP, int nM, int bit)
edm::SortedCollection< HcalTTPDigi > HcalTTPDigiCollection
edm::EDGetTokenT< HFDigiCollection > tok_hf_
static unsigned int const shift
volatile std::atomic< bool > shutdown_flag false
HcalTTPDigiProducer(const edm::ParameterSet &ps)