103 map<int,unique_ptr<HCalFED> > fedMap;
110 if( qie10DigiCollection.
isValid() ){
112 for (
unsigned int j=0; j < qie10dc.
size(); j++){
116 int crateId =
eid.crateId();
117 int slotId =
eid.slot();
118 int uhtrIndex = ((slotId&0xF)<<8) | (crateId&0xFF);
126 if( ! uhtrs.
exist( uhtrIndex ) ){
127 uhtrs.
newUHTR( uhtrIndex , presamples );
137 if( qie11DigiCollection.
isValid() ){
139 for (
unsigned int j=0; j < qie11dc.
size(); j++){
143 int crateId =
eid.crateId();
144 int slotId =
eid.slot();
145 int uhtrIndex = ((slotId&0xF)<<8) | (crateId&0xFF);
148 if( ! uhtrs.
exist(uhtrIndex) ){
149 uhtrs.
newUHTR( uhtrIndex , presamples );
158 if(hfDigiCollection.
isValid()){
164 int crateId =
eid.crateId();
165 int slotId =
eid.slot();
166 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8) ;
169 if( ! uhtrs.
exist(uhtrIndex) ){
170 uhtrs.
newUHTR( uhtrIndex , presamples );
179 if(hbheDigiCollection.
isValid()){
185 int crateId =
eid.crateId();
186 int slotId =
eid.slot();
187 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8) ;
190 if( ! uhtrs.
exist(uhtrIndex) ){
191 uhtrs.
newUHTR( uhtrIndex , presamples );
200 if(tpDigiCollection.
isValid()){
206 int crateId =
eid.crateId();
207 int slotId =
eid.slot();
208 int uhtrIndex = (crateId&0xFF) | ((slotId&0xF)<<8);
209 int ilink =
eid.fiberIndex();
210 int itower =
eid.fiberChanId();
211 int channelid = (itower&0xF) | ((ilink&0xF)<<4);
214 if( ! uhtrs.
exist(uhtrIndex) ){
215 uhtrs.
newUHTR( uhtrIndex , presamples );
227 for( UHTRpacker::UHTRMap::iterator uhtr = uhtrs.
uhtrs.begin() ; uhtr != uhtrs.
uhtrs.end() ; ++uhtr){
231 uint64_t crateId = (uhtr->first)&0xFF;
232 uint64_t slotId = (uhtr->first&0xF00)>>8;
236 if( fedMap.find(fedId) == fedMap.end() ){
240 fedMap[
fedId]->addUHTR(uhtr->second,crateId,slotId);
248 for(
map<
int,unique_ptr<HCalFED> >::iterator fed = fedMap.begin() ; fed != fedMap.end() ; ++fed ){
250 int fedId = fed->first;
252 auto & rawData = fed_buffers->FEDData(fedId);
253 fed->second->formatFEDdata(rawData);
257 FEDTrailer hcalFEDTrailer(rawData.data()+(rawData.size()-8));
258 hcalFEDTrailer.set(rawData.data()+(rawData.size()-8), rawData.size()/8,
evf::compute_crc(rawData.data(),rawData.size()), 0, 0);
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.
void finalizeHeadTail(uhtrData *uhtr, bool verbosity)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int presamples() const
for backward compatibility
uhtrData * newUHTR(int uhtrIndex, int ps=0, int orn=0, int bcn=0, uint64_t evt=0)
std::vector< HFDataFrame >::const_iterator const_iterator
int bunchCrossing() const
edm::EDGetTokenT< HcalDataFrameContainer< QIE10DataFrame > > tok_QIE10DigiCollection_
std::string electronicsMapLabel_
unsigned short compute_crc(unsigned char *buffer, unsigned int bufSize)
edm::EDGetTokenT< HFDigiCollection > tok_HFDigiCollection_
edm::DataFrame::id_type id() const
DetId detid() const
Get the detector id.
const_iterator end() const
unsigned long long uint64_t
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)
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_