70 _verbosity(iConfig.getUntrackedParameter<int>(
"Verbosity", 0)),
71 electronicsMapLabel_(iConfig.getParameter<std::
string>(
"ElectronicsMap")),
72 qie10Tag_(iConfig.getParameter<edm::
InputTag>(
"QIE10")),
73 qie11Tag_(iConfig.getParameter<edm::
InputTag>(
"QIE11")),
74 hbheqie8Tag_(iConfig.getParameter<edm::
InputTag>(
"HBHEqie8")),
75 hfqie8Tag_(iConfig.getParameter<edm::
InputTag>(
"HFqie8")),
76 trigTag_(iConfig.getParameter<edm::
InputTag>(
"TP"))
78 produces<FEDRawDataCollection>(
"");
108 map<int,unique_ptr<HCalFED> > fedMap;
117 for (
unsigned int j=0;
j < qie10dc.
size();
j++){
121 int crateId =
eid.crateId();
122 int slotId =
eid.slot();
123 int uhtrIndex = ((slotId&0xF)<<8) | (crateId&0xFF);
131 if( ! uhtrs.exist( uhtrIndex ) ){
132 uhtrs.newUHTR( uhtrIndex , presamples );
134 uhtrs.addChannel(uhtrIndex,qiedf,readoutMap,
_verbosity);
144 for (
unsigned int j=0;
j < qie11dc.
size();
j++){
148 int crateId =
eid.crateId();
149 int slotId =
eid.slot();
150 int uhtrIndex = ((slotId&0xF)<<8) | (crateId&0xFF);
153 if( ! uhtrs.exist(uhtrIndex) ){
155 uhtrs.newUHTR( uhtrIndex , presamples ,
true );
157 uhtrs.addChannel(uhtrIndex,qiedf,readoutMap,
_verbosity);
167 DetId detid = qiedf->id();
170 int crateId =
eid.crateId();
171 int slotId =
eid.slot();
172 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8) ;
173 int presamples = qiedf->presamples();
175 if( ! uhtrs.exist(uhtrIndex) ){
176 uhtrs.newUHTR( uhtrIndex , presamples );
178 uhtrs.addChannel(uhtrIndex,qiedf,readoutMap,
_verbosity);
188 DetId detid = qiedf->id();
191 int crateId =
eid.crateId();
192 int slotId =
eid.slot();
193 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8) ;
194 int presamples = qiedf->presamples();
196 if( ! uhtrs.exist(uhtrIndex) ){
197 uhtrs.newUHTR( uhtrIndex , presamples );
199 uhtrs.addChannel(uhtrIndex,qiedf,readoutMap,
_verbosity);
209 DetId detid = qiedf->id();
212 int crateId =
eid.crateId();
213 int slotId =
eid.slot();
214 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8);
215 int ilink =
eid.fiberIndex();
216 int itower =
eid.fiberChanId();
217 int channelid = (itower&0xF) | ((ilink&0xF)<<4);
218 int presamples = qiedf->presamples();
220 if( ! uhtrs.exist(uhtrIndex) ){
221 uhtrs.newUHTR( uhtrIndex , presamples );
223 uhtrs.addChannel(uhtrIndex,qiedf,channelid,
_verbosity);
233 for( UHTRpacker::UHTRMap::iterator uhtr = uhtrs.uhtrs.begin() ; uhtr != uhtrs.uhtrs.end() ; ++uhtr){
237 uint64_t crateId = (uhtr->first)&0xFF;
238 uint64_t slotId = (uhtr->first&0xF00)>>8;
240 uhtrs.finalizeHeadTail(&(uhtr->second),
_verbosity);
242 if( fedMap.find(fedId) == fedMap.end() ){
246 fedMap[
fedId]->addUHTR(uhtr->second,crateId,slotId);
254 for( map<
int,unique_ptr<HCalFED> >::iterator fed = fedMap.begin() ; fed != fedMap.end() ; ++fed ){
256 int fedId = fed->first;
258 auto & rawData = fed_buffers->FEDData(fedId);
259 fed->second->formatFEDdata(rawData);
263 FEDTrailer hcalFEDTrailer(rawData.data()+(rawData.size()-8));
264 hcalFEDTrailer.
set(rawData.data()+(rawData.size()-8), rawData.size()/8,
evf::compute_crc(rawData.data(),rawData.size()), 0, 0);
284 descriptions.
add(
"hcalDigiToRawuHTR",desc);
DetId detid() const
Get the detector id.
EventNumber_t event() const
edm::EDGetTokenT< HBHEDigiCollection > tok_HBHEDigiCollection_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
int presamples() const
for backward compatibility
virtual void produce(edm::Event &, const edm::EventSetup &) override
std::vector< HFDataFrame >::const_iterator const_iterator
int bunchCrossing() const
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
edm::Handle< HcalTrigPrimDigiCollection > tpDigiCollection
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< HcalDataFrameContainer< QIE10DataFrame > > tok_QIE10DigiCollection_
std::string electronicsMapLabel_
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
edm::EDGetTokenT< HFDigiCollection > tok_HFDigiCollection_
DetId detid() const
Get the detector id.
edm::Handle< HFDigiCollection > hfDigiCollection
HcalDigiToRawuHTR(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::Handle< QIE10DigiCollection > qie10DigiCollection
const_iterator end() const
unsigned long long uint64_t
edm::InputTag hbheqie8Tag_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int presamples() const
for backward compatibility
edm::Handle< QIE11DigiCollection > qie11DigiCollection
edm::Handle< HBHEDigiCollection > hbheDigiCollection
Readout chain identification for Hcal.
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_TPDigiCollection_
const_iterator begin() const
edm::EDGetTokenT< HcalDataFrameContainer< QIE11DataFrame > > tok_QIE11DigiCollection_