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 for (
unsigned int i=0;
i<maskedChannels_.size();
i++) {
83 throw cms::Exception(
"HcalTTPDigiProducer") <<
"Invalid HCAL Det ID" ;
86 produces<HcalTTPDigiCollection>();
104 if (
calc_[bit] == 1 )
return ( (nP + nM) >=
nHits_[bit] ) ;
106 if (
pReq_[bit] ==
'>' ) pOK = ( nP >=
nHFp_[bit] ) ;
107 else if (
pReq_[bit] ==
'<' ) pOK = ( nP <=
nHFp_[bit] ) ;
109 if (
mReq_[bit] ==
'>' ) mOK = ( nM >=
nHFm_[bit] ) ;
110 else if (
mReq_[bit] ==
'<' ) mOK = ( nM <=
nHFm_[bit] ) ;
112 if (
pmLogic_[bit] ==
':' )
return ( pOK && mOK ) ;
113 else if (
pmLogic_[bit] ==
'|' )
return ( pOK || mOK ) ;
116 edm::LogWarning(
"HcalTTPDigiProducer") <<
"Trigger logic exhausted. Returning false" ;
132 uint16_t trigInputs[40] ;
133 int nP[8] ;
int nM[8] ;
134 for (
int i=0;
i<8;
i++) {
135 nP[
i] = 0 ; nM[
i] = 0 ;
136 for (
int j=0;
j<5;
j++) trigInputs[
j*8+
i] = 0 ;
139 theDigi!=hfDigiCollection->end(); theDigi++) {
145 inputCoder->adc2Linear(*theDigi,samples) ;
150 int offset = (-1+
id.zside())/2 ;
153 while ( shift >= 16 ) { shift -= 16 ; group++ ; }
154 if ( !(trigInputs[(linSample*8)+group]&(1<<shift)) )
155 (
id.ieta() > 0 ) ? ( nP[linSample]++) : ( nM[linSample]++ ) ;
156 trigInputs[(linSample*8)+group] |= (1<<shift) ;
162 uint8_t trigOutput[8] ;
163 uint32_t algoDepBits[8] ;
165 for (
int linSample=0; linSample<8; linSample++) {
166 trigOutput[linSample] = 0 ; algoDepBits[linSample] = 0 ;
168 for (
int j=0;
j<4;
j++)
169 trigOutput[linSample] |= (
decision(nP[linSample],nM[linSample],
j)<<
j) ;
170 int nT = nP[linSample] + nM[linSample] ;
174 if (
fwAlgo_ == 1 ) algoDepBits[linSample] = (nT&0x7F) | ((nP[linSample]&0x3F)<<7) | ((nM[linSample]&0x3F)<<13) ;
175 ttpDigi.
setSample((linSample-
presamples_),&trigInputs[linSample*8],algoDepBits[linSample],trigOutput[linSample]) ;
178 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)
bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)