38 #define COUT std::cout << "VI "
40 #define COUT LogDebug("")
55 <<
"[ClustersFromRawProducer::"
58 <<
" NULL pointer to FEDRawData for FED id "
68 <<
"[ClustersFromRawProducer::"
70 <<
" FEDRawData has zero size for FED id "
84 <<
"Exception caught when creating FEDBuffer object for FED " << fedId <<
": " << e.
what();
86 delete buffer; buffer=
nullptr;
109 bool idoAPVEmulatorCheck):
111 clusterizer(iclusterizer),
113 doAPVEmulatorCheck(idoAPVEmulatorCheck){
114 incTot(clusterizer.allDetIds().size());
118 ~ClusterFiller() { printStat();}
125 std::unique_ptr<sistrip::FEDBuffer> buffers[1024];
126 bool done[1024] = {};
136 bool doAPVEmulatorCheck;
149 void zeroStat()
const { stat = Stat(); }
150 void incTot(
int n)
const { stat.totDet=
n;}
151 void incReady()
const { stat.detReady++;}
152 void incSet()
const { stat.detSet++;}
153 void incAct()
const { stat.detAct++;}
154 void incNoZ()
const { stat.detNoZ++;}
155 void printStat()
const {
156 COUT <<
"VI clusters " << stat.totDet <<
','<< stat.detReady <<
','<< stat.detSet <<
','<< stat.detAct<<
','<< stat.detNoZ << std::endl;
160 static void zeroStat(){}
161 static void incTot(
int){}
162 static void incReady() {}
163 static void incSet() {}
164 static void incAct() {}
165 static void incNoZ() {}
166 static void printStat(){}
181 onDemand(conf.getParameter<bool>(
"onDemand")),
185 doAPVEmulatorCheck_(conf.existsAs<bool>(
"DoAPVEmulatorCheck") ? conf.getParameter<bool>(
"DoAPVEmulatorCheck") :
true)
188 produces< edmNew::DetSetVector<SiStripCluster> > ();
208 std::auto_ptr< edmNew::DetSetVector<SiStripCluster> >
218 output->reserve(15000,6*10000);
225 COUT <<
output->dataSize() <<
" clusters from "
226 <<
output->size() <<
" modules"
250 std::auto_ptr<SiStripRawProcessingAlgorithms>
rawAlgos_;
266 (*clusterizer_).initialize(es);
267 cabling_ = (*clusterizer_).cabling();
268 (*rawAlgos_).initialize(es);
284 if(record.empty()) record.abort();
293 auto idet= record.id();
297 if (!clusterizer.stripByStripBegin(idet)) {
return; }
302 for (
auto const conn : clusterizer.currentConnection()) {
312 if (!
done[fedId]) { buffers[fedId].reset(fillBuffer(fedId, rawColl));
done[fedId]=
true;}
313 auto buffer = buffers[fedId].get();
319 if unlikely(!buffer->channelGood(fedCh,doAPVEmulatorCheck)) {
321 std::ostringstream
ss;
322 ss <<
"Problem unpacking channel " << fedCh <<
" on FED " << fedId;
329 uint16_t ipair =
conn->apvPairNumber();
342 clusterizer.addFed(unpacker,ipair,record);
351 std::ostringstream
ss;
352 ss <<
"Unordered clusters for channel " << fedCh <<
" on FED " << fedId <<
": " << e.
what();
365 clusterizer.addFed(unpacker,ipair,record);
374 std::ostringstream
ss;
375 ss <<
"Unordered clusters for channel " << fedCh <<
" on FED " << fedId <<
": " << e.
what();
386 std::vector<int16_t> digis;
388 digis.push_back(unpacker.
adc());
393 uint32_t
id =
conn->detId();
398 uint16_t firstAPV = ipair*2;
399 rawAlgos.SuppressVirginRawData(
id, firstAPV,digis, zsdigis);
401 clusterizer.stripByStripAdd( it->strip(), it->adc(),
record);
411 std::vector<int16_t> digis;
413 digis.push_back(unpacker.
adc());
418 uint32_t
id =
conn->detId();
422 uint16_t firstAPV = ipair*2;
423 rawAlgos.SuppressProcessedRawData(
id, firstAPV,digis, zsdigis);
425 clusterizer.stripByStripAdd( it->strip(), it->adc(),
record);
429 <<
"[ClustersFromRawProducer::"
431 <<
" FEDRawData readout mode "
435 <<
" not supported.";
442 clusterizer.stripByStripEnd(record);
444 if(!record.empty()) incNoZ();
static FEDRawChannelUnpacker procRawModeUnpacker(const FEDChannel &channel)
virtual char const * what() const
T getParameter(std::string const &) const
static FEDZSChannelUnpacker zeroSuppressedModeUnpacker(const FEDChannel &channel)
void run(const FEDRawDataCollection &rawColl, edmNew::DetSetVector< SiStripCluster > &output)
static const char mlRawToCluster_[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::auto_ptr< SiStripRawProcessingAlgorithms > rawAlgos_
static FEDRawChannelUnpacker virginRawModeUnpacker(const FEDChannel &channel)
std::auto_ptr< StripClusterizerAlgorithm > clusterizer_
void initialize(const edm::EventSetup &es)
size_t size() const
Lenght of the data buffer in bytes.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual bool doChecks(bool doCRC=true) const
void beginRun(const edm::Run &, const edm::EventSetup &es)
void produce(edm::Event &ev, const edm::EventSetup &es)
static FEDZSChannelUnpacker zeroSuppressedLiteModeUnpacker(const FEDChannel &channel)
SiStripDetCabling const * cabling_
SiStripClusterizerFromRaw(const edm::ParameterSet &conf)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
collection_type::const_iterator const_iterator
edm::EDGetTokenT< FEDRawDataCollection > productToken_