Skip to content

Commit

Permalink
Merge pull request #29853 from igv4321/dumping-HBHEChannelInfo
Browse files Browse the repository at this point in the history
Dumping HBHEChannelInfo contents
  • Loading branch information
cmsbuild committed May 18, 2020
2 parents af9f648 + f1e8061 commit be85975
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DataFormats/HcalRecHit/interface/HBHEChannelInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define DataFormats_HcalRecHit_HBHEChannelInfo_h_

#include <cfloat>
#include <iostream>

#include "DataFormats/HcalDetId/interface/HcalDetId.h"
#include "DataFormats/HcalRecHit/interface/HcalSpecialTimes.h"
Expand Down Expand Up @@ -291,4 +292,6 @@ class HBHEChannelInfo {
bool hasCapidError_;
};

std::ostream& operator<<(std::ostream& s, const HBHEChannelInfo& inf);

#endif // DataFormats_HcalRecHit_HBHEChannelInfo_h_
41 changes: 41 additions & 0 deletions DataFormats/HcalRecHit/src/HBHEChannelInfo.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "DataFormats/HcalRecHit/interface/HBHEChannelInfo.h"

namespace {
template <typename T>
void dumpArray(std::ostream& s, const char* p, const T* arr, const unsigned len) {
s << ' ' << p;
for (unsigned i = 0; i < len; ++i) {
s << ' ' << *arr++;
}
}

template <typename T>
void dumpArrayAsUnsigned(std::ostream& s, const char* p, const T* arr, const unsigned len) {
s << ' ' << p;
for (unsigned i = 0; i < len; ++i) {
s << ' ' << static_cast<unsigned>(*arr++);
}
}
} // namespace

std::ostream& operator<<(std::ostream& s, const HBHEChannelInfo& inf) {
const unsigned nSamples = inf.nSamples();

s << inf.id() << " :"
<< " recoShape " << inf.recoShape() << " nSamples " << nSamples << " soi " << inf.soi() << " capid " << inf.capid()
<< " hasTDC " << inf.hasTimeInfo() << " hasEffPeds " << inf.hasEffectivePedestals() << " dropped "
<< inf.isDropped() << " linkErr " << inf.hasLinkError() << " capidErr " << inf.hasCapidError() << " darkI "
<< inf.darkCurrent() << " fcByPE " << inf.fcByPE() << " lambda " << inf.lambda();
dumpArray(s, "rawCharge", inf.rawCharge(), nSamples);
dumpArray(s, "peds", inf.pedestal(), nSamples);
dumpArray(s, "noise", inf.pedestalWidth(), nSamples);
dumpArray(s, "gain", inf.gain(), nSamples);
dumpArray(s, "gainWidth", inf.gainWidth(), nSamples);
dumpArray(s, "dFcPerADC", inf.dFcPerADC(), nSamples);
dumpArrayAsUnsigned(s, "adc", inf.adc(), nSamples);
if (inf.hasTimeInfo()) {
dumpArray(s, "tdc", inf.riseTime(), nSamples);
}

return s;
}

0 comments on commit be85975

Please sign in to comment.