15 0,68,16,48,16,48,6,46,
17 18,50,12,40,12,40,8,52,
18 8,52,20,36,20,36,14,42,
19 14,42,10,54,10,54,22,38,
20 22,38,24,56,24,56,32,60,
21 32,60,28,64,28,64,26,58,
22 26,58,34,62,34,62,30,66 } ;
33 for (
int i=0;
i<4;
i++) {
36 calc_[
i] = sscanf(bit_[
i].c_str(),
"hits>=%d:hfp%c=%d%chfm%c=%d",
39 if (
calc_[i] == 1 ) {
42 <<
"Unable to read logic for technical trigger" ;
43 }
else if (
calc_[i] == 6 ) {
46 <<
"Unable to read logic for technical trigger" ;
51 <<
"Technical Trigger logic must obey the following format:\n"
52 "\"hits>=[A1]:hfp[B1]=[A2][C]hfm[B2]=[A3]\",\n"
53 "or \"hits>=[A1]\",\n"
54 "with A# >= 0, B# = (</>) and C = (:/|)" ;
57 <<
"Unable to read logic for technical trigger" ;
73 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Samples forced to maximum value of 8" ;
75 if ( presamples_ - SoI_ > 0 ) {
77 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Presamples reset to HF SoI value" ;
80 produces<HcalTTPDigiCollection>();
98 if (
calc_[bit] == 1 )
return ( (nP + nM) >=
nHits_[bit] ) ;
100 if (
pReq_[bit] ==
'>' ) pOK = ( nP >=
nHFp_[bit] ) ;
101 else if (
pReq_[bit] ==
'<' ) pOK = ( nP <=
nHFp_[bit] ) ;
103 if (
mReq_[bit] ==
'>' ) mOK = ( nM >=
nHFm_[bit] ) ;
104 else if (
mReq_[bit] ==
'<' ) mOK = ( nM <=
nHFm_[bit] ) ;
106 if (
pmLogic_[bit] ==
':' )
return ( pOK && mOK ) ;
107 else if (
pmLogic_[bit] ==
'|' )
return ( pOK || mOK ) ;
110 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Trigger logic exhausted. Returning false" ;
126 uint16_t trigInputs[40] ;
127 int nP[8] ;
int nM[8] ;
128 for (
int i=0;
i<8;
i++) {
129 nP[
i] = 0 ; nM[
i] = 0 ;
130 for (
int j=0;
j<5;
j++) trigInputs[
j*8+
i] = 0 ;
133 theDigi!=hfDigiCollection->end(); theDigi++) {
139 inputCoder->adc2Linear(*theDigi,samples) ;
144 int offset = (-1+
id.zside())/2 ;
147 while ( shift >= 16 ) { shift -= 16 ; group++ ; }
148 if ( !(trigInputs[(linSample*8)+group]&(1<<shift)) )
149 (
id.ieta() > 0 ) ? ( nP[linSample]++) : ( nM[linSample]++ ) ;
150 trigInputs[(linSample*8)+group] |= (1<<shift) ;
156 uint8_t trigOutput[8] ;
157 uint32_t algoDepBits[8] ;
159 for (
int linSample=0; linSample<8; linSample++) {
160 trigOutput[linSample] = 0 ; algoDepBits[linSample] = 0 ;
162 for (
int j=0;
j<4;
j++)
163 trigOutput[linSample] |= (
decision(nP[linSample],nM[linSample],
j)<<
j) ;
164 int nT = nP[linSample] + nM[linSample] ;
168 if (
fwAlgo_ == 1 ) algoDepBits[linSample] = (nT&0x7F) | ((nP[linSample]&0x3F)<<7) | ((nM[linSample]&0x3F)<<13) ;
169 ttpDigi.
setSample((linSample-
presamples_),&trigInputs[linSample*8],algoDepBits[linSample],trigOutput[linSample]) ;
172 ttpResult->push_back( ttpDigi ) ;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual ~HcalTTPDigiProducer()
virtual void produce(edm::Event &e, const edm::EventSetup &c)
std::vector< T >::const_iterator const_iterator
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)
unsigned int offset(bool)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::SortedCollection< HcalTTPDigi > HcalTTPDigiCollection
static unsigned int const shift
HcalTTPDigiProducer(const edm::ParameterSet &ps)