71 _verbosity(iConfig.getUntrackedParameter<
int>(
"Verbosity", 0)),
72 electronicsMapLabel_(iConfig.getParameter<
std::
string>(
"ElectronicsMap")),
73 qie10Tag_(iConfig.getParameter<
edm::InputTag>(
"QIE10")),
74 qie11Tag_(iConfig.getParameter<
edm::InputTag>(
"QIE11")),
75 hbheqie8Tag_(iConfig.getParameter<
edm::InputTag>(
"HBHEqie8")),
76 hfqie8Tag_(iConfig.getParameter<
edm::InputTag>(
"HFqie8")),
77 trigTag_(iConfig.getParameter<
edm::InputTag>(
"TP")),
78 premix_(iConfig.getParameter<bool>(
"premix"))
80 produces<FEDRawDataCollection>(
"");
110 map<int,unique_ptr<HCalFED> > fedMap;
119 for (
unsigned int j=0; j < qie10dc.
size(); j++){
123 int crateId =
eid.crateId();
124 int slotId =
eid.slot();
125 int uhtrIndex = ((slotId&0xF)<<8) | (crateId&0xFF);
133 if( ! uhtrs.
exist( uhtrIndex ) ){
134 uhtrs.
newUHTR( uhtrIndex , presamples );
146 for (
unsigned int j=0; j < qie11dc.
size(); j++){
150 int crateId =
eid.crateId();
151 int slotId =
eid.slot();
152 int uhtrIndex = ((slotId&0xF)<<8) | (crateId&0xFF);
155 if( ! uhtrs.
exist(uhtrIndex) ){
156 uhtrs.
newUHTR( uhtrIndex , presamples );
168 DetId detid = qiedf->id();
171 int crateId =
eid.crateId();
172 int slotId =
eid.slot();
173 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8) ;
176 if( ! uhtrs.
exist(uhtrIndex) ){
177 uhtrs.
newUHTR( uhtrIndex , presamples );
189 DetId detid = qiedf->id();
192 int crateId =
eid.crateId();
193 int slotId =
eid.slot();
194 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8) ;
197 if( ! uhtrs.
exist(uhtrIndex) ){
198 uhtrs.
newUHTR( uhtrIndex , presamples );
210 DetId detid = qiedf->id();
213 int crateId =
eid.crateId();
214 int slotId =
eid.slot();
215 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8);
216 int ilink =
eid.fiberIndex();
217 int itower =
eid.fiberChanId();
218 int channelid = (itower&0xF) | ((ilink&0xF)<<4);
221 if( ! uhtrs.
exist(uhtrIndex) ){
222 uhtrs.
newUHTR( uhtrIndex , presamples );
234 for( UHTRpacker::UHTRMap::iterator uhtr = uhtrs.
uhtrs.begin() ; uhtr != uhtrs.
uhtrs.end() ; ++uhtr){
238 uint64_t crateId = (uhtr->first)&0xFF;
239 uint64_t slotId = (uhtr->first&0xF00)>>8;
243 if( fedMap.find(fedId) == fedMap.end() ){
247 fedMap[
fedId]->addUHTR(uhtr->second,crateId,slotId);
255 for(
map<
int,unique_ptr<HCalFED> >::iterator fed = fedMap.begin() ; fed != fedMap.end() ; ++fed ){
257 int fedId = fed->first;
259 auto & rawData = fed_buffers->FEDData(fedId);
260 fed->second->formatFEDdata(rawData);
264 FEDTrailer hcalFEDTrailer(rawData.data()+(rawData.size()-8));
265 hcalFEDTrailer.
set(rawData.data()+(rawData.size()-8), rawData.size()/8,
evf::compute_crc(rawData.data(),rawData.size()), 0, 0);
285 desc.
add<
bool>(
"premix",
false);
286 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)
void finalizeHeadTail(uhtrData *uhtr, bool verbosity)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
int presamples() const
for backward compatibility
uhtrData * newUHTR(int uhtrIndex, int ps=0, int orn=0, int bcn=0, uint64_t evt=0)
virtual void produce(edm::Event &, const edm::EventSetup &) override
std::vector< HFDataFrame >::const_iterator const_iterator
int bunchCrossing() const
def getData(doc, options, dataset, site)
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)
void addChannel(int uhtrIndex, edm::SortedCollection< HFDataFrame >::const_iterator &qiedf, const HcalElectronicsMap *readoutMap, bool premix, int verbosity=0)
int presamples() const
for backward compatibility
bool exist(int uhtrIndex)
edm::Handle< QIE11DigiCollection > qie11DigiCollection
edm::Handle< HBHEDigiCollection > hbheDigiCollection
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
T const * product() const
Readout chain identification for Hcal.
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_TPDigiCollection_
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
const_iterator begin() const
edm::EDGetTokenT< HcalDataFrameContainer< QIE11DataFrame > > tok_QIE11DigiCollection_