Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions PhysicsTools/MVAComputer/interface/BitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <cstring>
#include <cstddef>
#include <cstring>
#include <cassert>

namespace PhysicsTools {

Expand Down Expand Up @@ -130,21 +131,17 @@ namespace PhysicsTools {

BitSet(const BitSet &orig) : bits_(orig.bits_) {
std::size_t words = bitsToWords(bits_);
if (words) {
store = new Word_t[words];
std::memcpy(store, orig.store, words * sizeof(Word_t));
} else
store = nullptr;
assert(words);
store = new Word_t[words];
std::memcpy(store, orig.store, words * sizeof(Word_t));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that bits_ > 0 and in that case bitsToWords(bits_) should always return words>0

}

/// construct BitSet with a fixed size of \a bits bits
BitSet(size_t bits) : bits_(bits) {
std::size_t words = bitsToWords(bits);
if (words) {
store = new Word_t[words];
std::memset(store, 0, sizeof(Word_t) * words);
} else
store = nullptr;
assert(words);
store = new Word_t[words];
std::memset(store, 0, sizeof(Word_t) * words);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that bits_ > 0 and in that case bitsToWords(bits_) should always return words>0

}

inline ~BitSet() { delete[] store; }
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/MVAComputer/interface/VarProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace PhysicsTools {
unsigned int size_;
};

virtual ~VarProcessor();
virtual ~VarProcessor() {}

/// called from the discriminator computer to configure processor
void configure(ConfigCtx &config);
Expand Down
5 changes: 0 additions & 5 deletions PhysicsTools/MVAComputer/src/VarProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ namespace PhysicsTools {
VarProcessor::VarProcessor(const char *name, const Calibration::VarProcessor *calib, const MVAComputer *computer)
: computer(computer), inputVars(Calibration::convert(calib->inputVars)), nInputVars(inputVars.bits()) {}

VarProcessor::~VarProcessor() {
inputVars = BitSet(0);
nInputVars = 0;
}

void VarProcessor::configure(ConfigCtx &config) {
ConfigCtx::size_type pos = config.size();
if (pos != inputVars.size())
Expand Down