#include <CnrByGroup.h>
Definition at line 28 of file CnrByGroup.h.
Definition at line 20 of file CnrByGroup_tool.cc.
24 const string myname =
"CnrByGroup::ctor: ";
29 else cout << myname <<
"WARNING: Ignoring invalid option: " << sopt <<
endl;
32 string crtName =
"channelGroups";
37 if ( pcrt !=
nullptr ) grp = pcrt->
get(sgrp);
42 cout << myname <<
"WARNING: Unable to find range group " << sgrp <<
endl;
51 cout << myname <<
" Groups: [";
53 for (
Name nam : m_Groups ) {
54 if ( count && count%10 == 0 ) cout <<
"\n ";
55 if ( count++ ) cout <<
", ";
59 cout << myname <<
" Options: [";
61 for (
Name nam : m_Options ) {
62 if ( count++ ) cout <<
", ";
66 cout << myname <<
"Using " << (
m_useMedian ?
"median" :
"mean") <<
" correction." << endl;
67 cout << myname <<
"Using " << (
m_dropSignal ?
"all" :
"non-signal") <<
" samples." << endl;
68 cout << myname << (
m_requireGoodChannel ?
"R" :
"Not r") <<
"equiring good channel status." << endl;
69 cout << myname <<
" Group #chan" <<
endl;
70 for (
const auto& ient :
m_chg ) {
71 cout << myname <<
setw(10) << ient.first <<
setw(8) << ient.second.size() <<
endl;
ChannelGroupService::Name Name
static constexpr double ps
Q_EXPORT QTSManip setw(int w)
bool m_requireGoodChannel
void getIndices(IndexVector &idxs) const
QTextStream & endl(QTextStream &s)
CnrByGroup::~CnrByGroup |
( |
| ) |
|
|
overridedefault |
Definition at line 105 of file CnrByGroup_tool.cc.
106 const string myname =
"CnrByGroup::getCorrection: ";
108 std::vector<FloatVector> samples;
110 auto iacd = acds.find(ich);
111 if ( iacd == acds.end() )
continue;
114 if ( acd.
samples.size() > nsam ) {
116 samples.resize(nsam);
118 for (
size_t isam=0; isam<acd.
samples.size(); ++isam ) {
120 samples[isam].push_back(acd.
samples[isam]);
123 std::vector<float> correction(nsam, 0.0);
125 for (
Index isam=0; isam<nsam; ++isam ) {
126 size_t nval = samples[isam].size();
127 if ( nval < 2 )
continue;
129 std::sort(samples[isam].
begin(), samples[isam].
end());
130 if ( nval%2 == 0 ) correction[isam] = 0.5 * (samples[isam][nval/2-1] + samples[isam][nval/2]);
131 else correction[isam] = samples[isam][nval/2];
134 for (
float val : samples[isam] ) sum +=
val;
135 correction[isam] = sum/
float(samples[isam].
size());
139 if (
m_LogLevel >= 2 ) cout << myname <<
"Correcting " << nsamCor <<
"/" << nsam <<
" samples." <<
endl;
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Index channelStatus() const
bool m_requireGoodChannel
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
QTextStream & endl(QTextStream &s)
Reimplemented from AdcChannelTool.
Definition at line 78 of file CnrByGroup_tool.cc.
79 const string myname =
"CnrByGroup::updateMap: ";
81 if ( acds.size() == 0 ) {
82 std::cout << myname <<
"WARNING: No channels found." <<
std::endl;
87 std::vector<float> correction =
getCorrection(channels, acds);
88 for (
Index ich : channels) {
89 auto iacd = acds.find(ich);
90 if ( iacd == acds.end() )
continue;
92 if ( acd.
samples.size() == 0 )
continue;
93 if ( acd.
samples.size() > correction.size() ) correction.resize(acd.
samples.size(), 0.);
94 for (
size_t isam=0; isam<acd.
samples.size(); ++isam) {
95 acd.
samples[isam] -= correction[isam];
DataMap & setStatus(int stat)
FloatVector getCorrection(const IndexVector &channels, const AdcChannelDataMap &acds) const
QTextStream & endl(QTextStream &s)
bool CnrByGroup::m_dropSignal =true |
|
private |
int CnrByGroup::m_LogLevel |
|
private |
bool CnrByGroup::m_requireGoodChannel =true |
|
private |
bool CnrByGroup::m_useMedian =false |
|
private |
The documentation for this class was generated from the following files: