CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalLuttoDB Class Reference

#include <CalibCalorimetry/HcalLuttoDB/src/HcalLuttoDB.cc>

Inheritance diagram for HcalLuttoDB:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 HcalLuttoDB (const edm::ParameterSet &)
 
 ~HcalLuttoDB () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

std::vector< unsigned char > extractOutputLut (const CaloTPGTranscoder &coder, HcalTrigTowerDetId chan)
 
std::ostream * openChecksums ()
 
std::ostream * openPerCrate (int crate)
 
std::ostream * openPerLut1 (HcalElectronicsId eid)
 
std::ostream * openPerLut2 (HcalElectronicsId eid)
 
void writeoutlut1 (HcalDetId id, HcalElectronicsId eid, const std::vector< unsigned short > &lut, std::ostream &os)
 
void writeoutlut2 (HcalTrigTowerDetId id, HcalElectronicsId eid, const std::vector< unsigned char > &lut, std::ostream &os)
 

Private Attributes

std::string creationstamp_
 
std::string fileformat_
 
bool filePerCrate_
 
std::ostream * oc_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>=""> R Implementation: <Notes on="" implementation>="">

Definition at line 55 of file HcalLuttoDB.cc.

Constructor & Destructor Documentation

HcalLuttoDB::HcalLuttoDB ( const edm::ParameterSet iConfig)
explicit

Definition at line 88 of file HcalLuttoDB.cc.

References creationtag_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), AlCaHLTBitMon_QueryRunRegistry::string, and targetfirmware_.

88  {
89  creationtag_ = iConfig.getParameter<std::string>("creationtag");
90  targetfirmware_ = iConfig.getParameter<std::string>("targetfirmware");
91  filePerCrate_ = iConfig.getUntrackedParameter<bool>("filePerCrate", true);
92  fileformat_ = iConfig.getParameter<std::string>("filePrefix");
93 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool filePerCrate_
Definition: HcalLuttoDB.cc:71
std::string targetfirmware_
Definition: HcalLuttoDB.cc:83
std::string fileformat_
Definition: HcalLuttoDB.cc:73
std::string creationtag_
Definition: HcalLuttoDB.cc:82
HcalLuttoDB::~HcalLuttoDB ( )
override

Definition at line 95 of file HcalLuttoDB.cc.

95 {}

Member Function Documentation

void HcalLuttoDB::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 265 of file HcalLuttoDB.cc.

References HcalElectronicsMap::allElectronicsId(), HcalGenericDetId::genericSubdet(), edm::EventSetup::get(), HcalDbService::getHcalMapping(), HcalTPGCoder::getLinearizationLUT(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalElectronicsMap::lookup(), HcalElectronicsMap::lookupTrigger(), and DetId::null().

265  {
266  //using namespace edm;
267  //using namespace std;
268 
269  edm::LogInfo("Hcal") << "Beginning dump of Hcal TPG LUTS (this may take a minute or two)";
270 
271  const HcalElectronicsMap* Map_;
273  iSetup.get<HcalDbRecord>().get(pSetup);
274  Map_ = pSetup->getHcalMapping();
275  // get the conditions, for the decoding
276  edm::ESHandle<HcalTPGCoder> inputCoder;
277  iSetup.get<HcalTPGRecord>().get(inputCoder);
278  edm::ESHandle<CaloTPGTranscoder> outTranscoder;
279  iSetup.get<CaloTPGRecord>().get(outTranscoder);
280 
281  std::vector<HcalElectronicsId> allEID = Map_->allElectronicsId();
282  std::vector<HcalElectronicsId>::iterator itreid;
283 
284  std::ostream* pfile = nullptr;
285  oc_ = openChecksums();
286 
287  for (int crate = 0; crate < 20; crate++) {
288  edm::LogInfo("Hcal") << "Beginning crate " << crate;
289  for (itreid = allEID.begin(); itreid != allEID.end(); ++itreid) {
290  if (itreid->readoutVMECrateId() != crate)
291  continue;
292  if (itreid->isTriggerChainId()) { // lut2
293  HcalTrigTowerDetId tid = Map_->lookupTrigger(*itreid);
294  if (tid.null())
295  continue;
296 
297  if (filePerCrate_ && pfile == nullptr)
298  pfile = openPerCrate(crate);
299  else if (pfile == nullptr)
300  pfile = openPerLut2(*itreid);
301 
302  std::vector<unsigned char> lut = extractOutputLut(*outTranscoder, tid);
303  writeoutlut2(tid, *itreid, lut, *pfile);
304  if (!filePerCrate_) {
305  delete pfile;
306  pfile = nullptr;
307  }
308  } else { // lut1
309  HcalGenericDetId gid = Map_->lookup(*itreid);
310  if (gid.null() || !(gid.genericSubdet() == HcalGenericDetId::HcalGenBarrel ||
313  continue;
314 
315  if (filePerCrate_ && pfile == nullptr)
316  pfile = openPerCrate(crate);
317  else if (pfile == nullptr)
318  pfile = openPerLut1(*itreid);
319 
320  std::vector<unsigned short> lut = inputCoder->getLinearizationLUT(HcalDetId(gid));
321  writeoutlut1(HcalDetId(gid), *itreid, lut, *pfile);
322  if (!filePerCrate_) {
323  delete pfile;
324  pfile = nullptr;
325  }
326  }
327  }
328  if (pfile != nullptr) {
329  if (filePerCrate_)
330  *pfile << "</CFGBrickSet>\n";
331  delete pfile;
332  pfile = nullptr;
333  }
334  }
335  *oc_ << "</CFGBrick>\n";
336  delete oc_;
337 }
constexpr bool null() const
is this a null id ?
Definition: DetId.h:59
std::ostream * openPerLut2(HcalElectronicsId eid)
Definition: HcalLuttoDB.cc:133
bool filePerCrate_
Definition: HcalLuttoDB.cc:71
std::ostream * openChecksums()
Definition: HcalLuttoDB.cc:101
void writeoutlut2(HcalTrigTowerDetId id, HcalElectronicsId eid, const std::vector< unsigned char > &lut, std::ostream &os)
Definition: HcalLuttoDB.cc:205
std::ostream * oc_
Definition: HcalLuttoDB.cc:78
virtual std::vector< unsigned short > getLinearizationLUT(HcalDetId id) const
Get the full linearization LUT (128 elements). Default implementation just uses adc2Linear to get all...
Definition: HcalTPGCoder.cc:3
std::ostream * openPerCrate(int crate)
Definition: HcalLuttoDB.cc:109
std::vector< HcalElectronicsId > allElectronicsId() const
std::ostream * openPerLut1(HcalElectronicsId eid)
Definition: HcalLuttoDB.cc:117
T get() const
Definition: EventSetup.h:73
const HcalElectronicsMap * getHcalMapping() const
const DetId lookupTrigger(HcalElectronicsId fId) const
brief lookup the trigger logical detid associated with the given electronics id
void writeoutlut1(HcalDetId id, HcalElectronicsId eid, const std::vector< unsigned short > &lut, std::ostream &os)
Definition: HcalLuttoDB.cc:149
HcalGenericSubdetector genericSubdet() const
std::vector< unsigned char > extractOutputLut(const CaloTPGTranscoder &coder, HcalTrigTowerDetId chan)
Definition: HcalLuttoDB.cc:255
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void HcalLuttoDB::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 340 of file HcalLuttoDB.cc.

References edmScanValgrind::buffer, fileCollector::now, and ntuplemaker::time.

340  {
341  char buffer[120];
342  time_t now = time(nullptr);
343  struct tm* tm = localtime(&now);
344  strftime(buffer, 120, "%F %T", tm);
346 }
std::string creationstamp_
Definition: HcalLuttoDB.cc:72
void HcalLuttoDB::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 349 of file HcalLuttoDB.cc.

References DEFINE_FWK_MODULE.

Referenced by o2olib.O2ORunMgr::executeJob().

349 {}
std::vector< unsigned char > HcalLuttoDB::extractOutputLut ( const CaloTPGTranscoder coder,
HcalTrigTowerDetId  chan 
)
private

Definition at line 255 of file HcalLuttoDB.cc.

References HcalTriggerPrimitiveSample::compressedEt(), CaloTPGTranscoder::hcalCompress(), mps_fire::i, and alignCSCRings::s.

255  {
256  std::vector<unsigned char> lut;
257  for (int i = 0; i < 1024; i++) {
258  HcalTriggerPrimitiveSample s = coder.hcalCompress(chan, i, false);
259  lut.push_back(s.compressedEt());
260  }
261  return lut;
262 }
int compressedEt() const
get the encoded/compressed Et
virtual HcalTriggerPrimitiveSample hcalCompress(const HcalTrigTowerDetId &id, unsigned int sample, int fineGrain) const =0
Compression from linear samples+fine grain in the HTR.
std::ostream * HcalLuttoDB::openChecksums ( )
private

Definition at line 101 of file HcalLuttoDB.cc.

References alignmentValidation::fname.

101  {
102  char fname[1024];
103  snprintf(fname, 1024, "%s_checksums.xml", fileformat_.c_str());
104  std::ostream* os = new std::ofstream(fname);
105  (*os) << "<?xml version=\"1.0\"?>\n<CFGBrick>\n";
106  return os;
107 }
std::string fileformat_
Definition: HcalLuttoDB.cc:73
string fname
main script
std::ostream * HcalLuttoDB::openPerCrate ( int  crate)
private

Definition at line 109 of file HcalLuttoDB.cc.

References alignmentValidation::fname.

109  {
110  char fname[1024];
111  snprintf(fname, 1024, "%s_%d.xml", fileformat_.c_str(), crate);
112  std::ostream* os = new std::ofstream(fname);
113  (*os) << "<?xml version=\"1.0\"?>\n<CFGBrickSet>\n";
114  return os;
115 }
std::string fileformat_
Definition: HcalLuttoDB.cc:73
string fname
main script
std::ostream * HcalLuttoDB::openPerLut1 ( HcalElectronicsId  eid)
private

Definition at line 117 of file HcalLuttoDB.cc.

References HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), alignmentValidation::fname, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), and HcalElectronicsId::readoutVMECrateId().

117  {
118  char fname[1024];
119  snprintf(fname,
120  1024,
121  "%s_%d_%d%c_%d_%d_1.xml",
122  fileformat_.c_str(),
123  eid.readoutVMECrateId(),
124  eid.htrSlot(),
125  ((eid.htrTopBottom()) ? ('t') : ('b')),
126  eid.fiberIndex(),
127  eid.fiberChanId());
128  std::ostream* os = new std::ofstream(fname);
129  (*os) << "<?xml version=\"1.0\"?>\n";
130  return os;
131 }
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
constexpr int htrSlot() const
get the htr slot
constexpr int readoutVMECrateId() const
get the readout VME crate number
std::string fileformat_
Definition: HcalLuttoDB.cc:73
constexpr int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
string fname
main script
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
std::ostream * HcalLuttoDB::openPerLut2 ( HcalElectronicsId  eid)
private

Definition at line 133 of file HcalLuttoDB.cc.

References alignmentValidation::fname, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::slbChannelIndex(), and HcalElectronicsId::slbSiteNumber().

133  {
134  char fname[1024];
135  snprintf(fname,
136  1024,
137  "%s_%d_%d%c_%d_%d_2.xml",
138  fileformat_.c_str(),
139  eid.readoutVMECrateId(),
140  eid.htrSlot(),
141  ((eid.htrTopBottom()) ? ('t') : ('b')),
142  eid.slbSiteNumber(),
143  eid.slbChannelIndex());
144  std::ostream* os = new std::ofstream(fname);
145  (*os) << "<?xml version=\"1.0\"?>\n";
146  return os;
147 }
constexpr int slbChannelIndex() const
get the SLB channel index (valid only for VME trigger-chain ids)
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
constexpr int htrSlot() const
get the htr slot
constexpr int readoutVMECrateId() const
get the readout VME crate number
std::string fileformat_
Definition: HcalLuttoDB.cc:73
string fname
main script
constexpr int slbSiteNumber() const
get the SLB site number (valid only for VME trigger-chain ids)
void HcalLuttoDB::writeoutlut1 ( HcalDetId  id,
HcalElectronicsId  eid,
const std::vector< unsigned short > &  lut,
std::ostream &  os 
)
private

Definition at line 149 of file HcalLuttoDB.cc.

References creationtag_, TauDecayModes::dec, HcalElectronicsId::fiberChanId(), HcalElectronicsId::fiberIndex(), formatRevision_, HcalForward, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), mps_fire::i, HcalElectronicsId::readoutVMECrateId(), and targetfirmware_.

152  {
153  os << "<CFGBrick> " << std::endl;
154  os << " <Parameter name='IETA' type='int'>" << id.ieta() << "</Parameter>" << std::endl;
155  os << " <Parameter name='IPHI' type='int'>" << id.iphi() << "</Parameter>" << std::endl;
156  os << " <Parameter name='DEPTH' type='int'>" << id.depth() << "</Parameter>" << std::endl;
157  os << " <Parameter name='CRATE' type='int'>" << eid.readoutVMECrateId() << "</Parameter>" << std::endl;
158  os << " <Parameter name='SLOT' type='int'>" << eid.htrSlot() << "</Parameter>" << std::endl;
159  os << " <Parameter name='TOPBOTTOM' type='int'>" << eid.htrTopBottom() << "</Parameter>" << std::endl;
160  os << " <Parameter name='FIBER' type='int'>" << eid.fiberIndex() << "</Parameter>" << std::endl;
161  os << " <Parameter name='FIBERCHAN' type='int'>" << eid.fiberChanId() << "</Parameter>" << std::endl;
162  os << " <Parameter name='LUT_TYPE' type='int'>1</Parameter>" << std::endl;
163  os << " <Parameter name='CREATIONTAG' type='string'>" << creationtag_ << "</Parameter>" << std::endl;
164  os << " <Parameter name='CREATIONSTAMP' type='string'>" << creationstamp_ << "</Parameter>" << std::endl;
165  os << " <Parameter name='FORMATREVISION' type='string'>" << formatRevision_ << "</Parameter>" << std::endl;
166  os << " <Parameter name='TARGETFIRMWARE' type='string'>" << targetfirmware_ << "</Parameter>" << std::endl;
167  int generalizedIndex = id.ietaAbs() + 1000 * id.depth() + 10000 * id.iphi() + ((id.ieta() < 0) ? (0) : (100)) +
168  ((id.subdet() == HcalForward && id.ietaAbs() == 29) ? (4 * 10000) : (0));
169 
170  os << " <Parameter name='GENERALIZEDINDEX' type='int'>" << generalizedIndex << "</Parameter>" << std::endl;
171  // do checksum
172  md5_state_t md5er;
173  md5_byte_t digest[16];
174  unsigned char tool[2];
175  md5_init(&md5er);
176  for (int i = 0; i < 128; i++) {
177  tool[0] = lut[i] & 0xFF;
178  tool[1] = (lut[i] >> 8) & 0xFF;
179  md5_append(&md5er, tool, 2);
180  }
181  md5_finish(&md5er, digest);
182  os << " <Parameter name='CHECKSUM' type='string'>";
183  for (int i = 0; i < 16; i++)
184  os << std::hex << (((int)(digest[i])) & 0xFF);
185  os << "</Parameter>\n";
186 
187  *oc_ << " <Data crate='" << eid.readoutVMECrateId() << "' slot='" << eid.htrSlot() << "' fpga='"
188  << eid.htrTopBottom() << "' fiber='" << eid.fiberIndex() << "' fiberchan='" << eid.fiberChanId()
189  << "' luttype='1' elements='1' encoding='hex'>";
190  for (int i = 0; i < 16; i++)
191  *oc_ << std::hex << (((int)(digest[i])) & 0xFF);
192  *oc_ << "</Data>\n";
193 
194  os << " <Data elements='128' encoding='hex'> " << std::endl;
195  os << std::hex;
196  for (int initr2 = 0; initr2 < 128; initr2++) {
197  os << lut[initr2] << " ";
198  }
199  os << std::dec;
200  os << std::endl;
201  os << " </Data> " << std::endl;
202  os << "</CFGBrick> " << std::endl;
203 }
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::string targetfirmware_
Definition: HcalLuttoDB.cc:83
constexpr int htrSlot() const
get the htr slot
constexpr int readoutVMECrateId() const
get the readout VME crate number
std::ostream * oc_
Definition: HcalLuttoDB.cc:78
constexpr int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
std::string creationstamp_
Definition: HcalLuttoDB.cc:72
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
std::string creationtag_
Definition: HcalLuttoDB.cc:82
static const int formatRevision_
Definition: HcalLuttoDB.cc:84
void HcalLuttoDB::writeoutlut2 ( HcalTrigTowerDetId  id,
HcalElectronicsId  eid,
const std::vector< unsigned char > &  lut,
std::ostream &  os 
)
private

Definition at line 205 of file HcalLuttoDB.cc.

References creationtag_, TauDecayModes::dec, formatRevision_, HcalElectronicsId::htrSlot(), HcalElectronicsId::htrTopBottom(), mps_fire::i, createfilelist::int, HcalElectronicsId::readoutVMECrateId(), HcalElectronicsId::slbChannelIndex(), HcalElectronicsId::slbSiteNumber(), and targetfirmware_.

208  {
209  os << "<CFGBrick> " << std::endl;
210  os << " <Parameter name='IETA' type='int'>" << id.ieta() << "</Parameter>" << std::endl;
211  os << " <Parameter name='IPHI' type='int'>" << id.iphi() << "</Parameter>" << std::endl;
212  os << " <Parameter name='CRATE' type='int'>" << eid.readoutVMECrateId() << "</Parameter>" << std::endl;
213  os << " <Parameter name='SLOT' type='int'>" << eid.htrSlot() << "</Parameter>" << std::endl;
214  os << " <Parameter name='TOPBOTTOM' type='int'>" << eid.htrTopBottom() << "</Parameter>" << std::endl;
215  os << " <Parameter name='SLB' type='int'>" << eid.slbSiteNumber() << "</Parameter>" << std::endl;
216  os << " <Parameter name='SLBCHAN' type='int'>" << eid.slbChannelIndex() << "</Parameter>" << std::endl;
217  os << " <Parameter name='LUT_TYPE' type='int'>2</Parameter>" << std::endl;
218  os << " <Parameter name='CREATIONTAG' type='string'>" << creationtag_ << "</Parameter>" << std::endl;
219  os << " <Parameter name='CREATIONSTAMP' type='string'>" << creationstamp_ << "</Parameter>" << std::endl;
220  os << " <Parameter name='FORMATREVISION' type='string'>" << formatRevision_ << "</Parameter>" << std::endl;
221  os << " <Parameter name='TARGETFIRMWARE' type='string'>" << targetfirmware_ << "</Parameter>" << std::endl;
222  int generalizedIndex = id.ietaAbs() + 10000 * id.iphi() + ((id.ieta() < 0) ? (0) : (100));
223 
224  os << " <Parameter name='GENERALIZEDINDEX' type='int'>" << generalizedIndex << "</Parameter>" << std::endl;
225 
226  // do checksum
227  md5_state_t md5er;
228  md5_byte_t digest[16];
229  md5_init(&md5er);
230  md5_append(&md5er, &(lut[0]), 1024);
231  md5_finish(&md5er, digest);
232  os << " <Parameter name='CHECKSUM' type='string'>";
233  for (int i = 0; i < 16; i++)
234  os << std::hex << (((int)(digest[i])) & 0xFF);
235  os << "</Parameter>\n";
236 
237  *oc_ << " <Data crate='" << eid.readoutVMECrateId() << "' slot='" << eid.htrSlot() << "' fpga='"
238  << eid.htrTopBottom() << "' slb='" << eid.slbSiteNumber() << "' slbchan='" << eid.slbChannelIndex()
239  << "' luttype='2' elements='1' encoding='hex'>";
240  for (int i = 0; i < 16; i++)
241  *oc_ << std::hex << (((int)(digest[i])) & 0xFF);
242  *oc_ << "</Data>\n";
243 
244  os << " <Data elements='1024' encoding='hex'> " << std::endl;
245  os << std::hex;
246  for (int initr2 = 0; initr2 < 1024; initr2++) {
247  os << (int(lut[initr2]) & 0xFF) << " ";
248  }
249  os << std::dec;
250  os << std::endl;
251  os << " </Data> " << std::endl;
252  os << "</CFGBrick> " << std::endl;
253 }
constexpr int slbChannelIndex() const
get the SLB channel index (valid only for VME trigger-chain ids)
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::string targetfirmware_
Definition: HcalLuttoDB.cc:83
constexpr int htrSlot() const
get the htr slot
constexpr int readoutVMECrateId() const
get the readout VME crate number
std::ostream * oc_
Definition: HcalLuttoDB.cc:78
std::string creationstamp_
Definition: HcalLuttoDB.cc:72
constexpr int slbSiteNumber() const
get the SLB site number (valid only for VME trigger-chain ids)
std::string creationtag_
Definition: HcalLuttoDB.cc:82
static const int formatRevision_
Definition: HcalLuttoDB.cc:84

Member Data Documentation

std::string HcalLuttoDB::creationstamp_
private

Definition at line 72 of file HcalLuttoDB.cc.

std::string HcalLuttoDB::fileformat_
private

Definition at line 73 of file HcalLuttoDB.cc.

bool HcalLuttoDB::filePerCrate_
private

Definition at line 71 of file HcalLuttoDB.cc.

std::ostream* HcalLuttoDB::oc_
private

Definition at line 78 of file HcalLuttoDB.cc.