2 #include "HGCal/RawToDigi/plugins/HGCalTBRawToDigi.h"
3 #include "HGCal/Geometry/interface/HGCalTBGeometryParameters.h"
9 dataTag_(conf.getParameter<edm::InputTag>(
"InputLabel")),
10 fedId_(conf.getUntrackedParameter<int>(
"fedId")),
11 mapfile_(conf.getUntrackedParameter<std::string>(
"electronicsMap"))
13 produces<SKIROC2DigiCollection>();
14 consumes<FEDRawDataCollection>(dataTag_);
22 edm::FileInPath fip(mapfile_);
23 if (!io.
load(fip.fullPath(), essource_.emap_)) {
24 throw cms::Exception(
"Unable to load electronics map");
31 edm::Handle<FEDRawDataCollection> rawraw;
32 e.getByLabel(dataTag_, rawraw);
34 std::auto_ptr<SKIROC2DigiCollection> digis(0);
36 const FEDRawData& fed = rawraw->FEDData(fedId_);
37 if (fed.size() != 0) {
41 int nsamples = fed.size() / (
sizeof(uint16_t) * SKIROC::NCHANNELS * 2);
43 const uint16_t* pdata = (
const uint16_t*)(fed.data());
46 int ptr = fed.size() /
sizeof(uint16_t) - 1;
117 for (
int ichan = 0; ichan < SKIROC::NCHANNELS; ichan++) {
118 for (
int ski = ski_down; ski <= ski_up; ski++) {
120 if (!essource_.emap_.existsEId(eid.
rawId())) {
124 digis->addDataFrame(did);
126 int ptradc1 = ptr - ichan*2 - (ski - ski_down);
127 int ptradc2 = ptr - ichan*2 - (ski - ski_down) - 128;
155 unsigned int result = gray & (1 << 11);
156 result |= (gray ^ (result >> 1)) & (1 << 10);
157 result |= (gray ^ (result >> 1)) & (1 << 9);
158 result |= (gray ^ (result >> 1)) & (1 << 8);
159 result |= (gray ^ (result >> 1)) & (1 << 7);
160 result |= (gray ^ (result >> 1)) & (1 << 6);
161 result |= (gray ^ (result >> 1)) & (1 << 5);
162 result |= (gray ^ (result >> 1)) & (1 << 4);
163 result |= (gray ^ (result >> 1)) & (1 << 3);
164 result |= (gray ^ (result >> 1)) & (1 << 2);
165 result |= (gray ^ (result >> 1)) & (1 << 1);
166 result |= (gray ^ (result >> 1)) & (1 << 0);
171 #include "FWCore/PluginManager/interface/ModuleDef.h"
172 #include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(Pedestals)
virtual void produce(edm::Event &e, const edm::EventSetup &c)
bool load(const std::string &filename, HGCalCondObjectContainer< float > &)
load conditions from file
unsigned int gray_to_binary(unsigned int gray)
HGCalTBRawToDigi(const edm::ParameterSet &ps)
HGCalDataFrameContainer< SKIROC2DataFrame > SKIROC2DigiCollection