Skip to content

Commit

Permalink
Apply code-checks fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterdavid committed Aug 25, 2017
1 parent 634cf69 commit 984449b
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 64 deletions.
7 changes: 3 additions & 4 deletions CalibFormats/SiStripObjects/interface/SiStripDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class SiStripDelay
SiStripDelay() {};
virtual ~SiStripDelay() {};

SiStripDelay(const SiStripDelay&) = delete;
const SiStripDelay& operator=(const SiStripDelay&) = delete;

inline SiStripDelay(const SiStripBaseDelay& baseDelay, const int sumSign,
const std::pair<std::string, std::string> & recordLabelPair)
{
Expand Down Expand Up @@ -87,10 +90,6 @@ class SiStripDelay
void printDebug(std::stringstream& ss, const TrackerTopology* tTopo) const;

private:

SiStripDelay(const SiStripDelay&); // stop default
const SiStripDelay& operator=(const SiStripDelay&); // stop default

// ---------- member data --------------------------------

std::vector<const SiStripBaseDelay *> baseDelayVector_;
Expand Down
6 changes: 4 additions & 2 deletions CalibFormats/SiStripObjects/interface/SiStripDetCabling.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class SiStripDetCabling
SiStripDetCabling(const TrackerTopology* const topology);
virtual ~SiStripDetCabling();
SiStripDetCabling(const SiStripFedCabling &,const TrackerTopology* const topology);

SiStripDetCabling(const SiStripDetCabling&) = delete;
const SiStripDetCabling& operator=(const SiStripDetCabling&) = delete;

void addDevices(const FedChannelConnection &, std::map< uint32_t, std::vector<const FedChannelConnection *> >&);
void addDevices(const FedChannelConnection &); // special case of above addDevices
// getters
Expand Down Expand Up @@ -64,8 +68,6 @@ class SiStripDetCabling
std::map< uint32_t, std::vector<int> > const & connected() const { return connected_;}

private:
SiStripDetCabling(const SiStripDetCabling&); // stop default
const SiStripDetCabling& operator=(const SiStripDetCabling&); // stop default
void addFromSpecificConnection( std::map<uint32_t, std::vector<int> > & , const std::map< uint32_t, std::vector<int> > &, std::map< int16_t, uint32_t >* connectionsToFill = nullptr ) const;
bool IsInMap(const uint32_t& det_id, const std::map<uint32_t, std::vector<int> > &) const;
int16_t layerSearch( const uint32_t detId ) const;
Expand Down
10 changes: 5 additions & 5 deletions CalibFormats/SiStripObjects/interface/SiStripGain.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ class SiStripGain
{
public:
SiStripGain() {}
SiStripGain(const SiStripGain&) = delete;
const SiStripGain& operator=(const SiStripGain&) = delete;

/// Kept for compatibility
inline SiStripGain(const SiStripApvGain& apvgain, const double & factor) :
apvgain_(0)
apvgain_(nullptr)
{
multiply(apvgain, factor, std::make_pair("", ""));
}

inline SiStripGain(const SiStripApvGain& apvgain, const double & factor,
const std::pair<std::string, std::string> & recordLabelPair) :
apvgain_(0)
apvgain_(nullptr)
{
multiply(apvgain, factor, recordLabelPair);
}
Expand Down Expand Up @@ -109,9 +111,7 @@ class SiStripGain
private:

void fillNewGain(const SiStripApvGain * apvgain, const double & factor,
const SiStripApvGain * apvgain2 = 0, const double & factor2 = 1.);
SiStripGain(const SiStripGain&); // stop default
const SiStripGain& operator=(const SiStripGain&); // stop default
const SiStripApvGain * apvgain2 = nullptr, const double & factor2 = 1.);

// ---------- member data --------------------------------

Expand Down
16 changes: 8 additions & 8 deletions CalibFormats/SiStripObjects/src/SiStripDetCabling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <iostream>

//---- default constructor / destructor
SiStripDetCabling::SiStripDetCabling(const TrackerTopology* const topology) : fedCabling_(0), tTopo(topology) {}
SiStripDetCabling::SiStripDetCabling(const TrackerTopology* const topology) : fedCabling_(nullptr), tTopo(topology) {}
SiStripDetCabling::~SiStripDetCabling() {}

//---- construct detector view (DetCabling) out of readout view (FedCabling)
Expand Down Expand Up @@ -43,7 +43,7 @@ SiStripDetCabling::SiStripDetCabling(const SiStripFedCabling& fedcabling,const T
if(iconn->i2cAddr(0)) vector_of_connected_apvs.push_back(2*which_apv_pair + 0); // first apv of the pair
if(iconn->i2cAddr(1)) vector_of_connected_apvs.push_back(2*which_apv_pair + 1); // second apv of the pair
}
if(vector_of_connected_apvs.size() != 0){ // add only is smth. there, obviously
if(!vector_of_connected_apvs.empty()){ // add only is smth. there, obviously
std::map<uint32_t, std::vector<int> > map_of_connected_apvs;
map_of_connected_apvs.insert(std::make_pair(iconn->detId(),vector_of_connected_apvs));
addFromSpecificConnection(connected_, map_of_connected_apvs, &(connectionCount[0]));
Expand All @@ -61,7 +61,7 @@ SiStripDetCabling::SiStripDetCabling(const SiStripFedCabling& fedcabling,const T
if(idtct->i2cAddr(0)) vector_of_detected_apvs.push_back(2*which_apv_pair + 0); // first apv of the pair
if(idtct->i2cAddr(1)) vector_of_detected_apvs.push_back(2*which_apv_pair + 1); // second apv of the pair
}
if(vector_of_detected_apvs.size() != 0){ // add only is smth. there, obviously
if(!vector_of_detected_apvs.empty()){ // add only is smth. there, obviously
std::map<uint32_t,std::vector<int> > map_of_detected_apvs;
map_of_detected_apvs.insert(std::make_pair(idtct->detId(),vector_of_detected_apvs));
addFromSpecificConnection(detected_, map_of_detected_apvs, &(connectionCount[1]) );
Expand All @@ -78,7 +78,7 @@ SiStripDetCabling::SiStripDetCabling(const SiStripFedCabling& fedcabling,const T
if(iudtct->i2cAddr(0)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 0); // first apv of the pair
if(iudtct->i2cAddr(1)) vector_of_undetected_apvs.push_back(2*which_apv_pair + 1); // second apv of the pair
}
if(vector_of_undetected_apvs.size() != 0){ // add only is smth. there, obviously
if(!vector_of_undetected_apvs.empty()){ // add only is smth. there, obviously
std::map<uint32_t, std::vector<int> > map_of_undetected_apvs;
map_of_undetected_apvs.insert(std::make_pair(iudtct->detId(),vector_of_undetected_apvs));
addFromSpecificConnection(undetected_, map_of_undetected_apvs, &(connectionCount[2]));
Expand Down Expand Up @@ -147,7 +147,7 @@ const std::vector<const FedChannelConnection *>& SiStripDetCabling::getConnectio
const FedChannelConnection& SiStripDetCabling::getConnection( uint32_t det_id, unsigned short apv_pair ) const{
const std::vector<const FedChannelConnection *>& fcconns = getConnections(det_id);
for(std::vector<const FedChannelConnection *>::const_iterator iconn = fcconns.begin(); iconn!=fcconns.end();++iconn){
if ( ((*iconn) != 0) && (((*iconn)->apvPairNumber()) == apv_pair) ) { // check if apvPairNumber() of present FedChannelConnection is the same as requested one
if ( ((*iconn) != nullptr) && (((*iconn)->apvPairNumber()) == apv_pair) ) { // check if apvPairNumber() of present FedChannelConnection is the same as requested one
return (**iconn); // if yes, return the FedChannelConnection object
}
}
Expand All @@ -159,7 +159,7 @@ const FedChannelConnection& SiStripDetCabling::getConnection( uint32_t det_id, u
//----
const unsigned int SiStripDetCabling::getDcuId( uint32_t det_id ) const{
const std::vector<const FedChannelConnection *>& fcconns = getConnections( det_id );
if(fcconns.size()!=0) {
if(!fcconns.empty()) {
// patch needed to take into account the possibility that the first component of fcconns is invalid
for(size_t i=0;i<fcconns.size();++i)
if (fcconns.at(i) && fcconns.at(i)->detId() != sistrip::invalid32_ && fcconns.at(i)->detId() != 0 )
Expand All @@ -173,10 +173,10 @@ const unsigned int SiStripDetCabling::getDcuId( uint32_t det_id ) const{
//---- one can find the nr of apvs from fullcabling_ -> std::vector<FedChannelConnection> -> size * 2
const uint16_t SiStripDetCabling::nApvPairs(uint32_t det_id) const{
const std::vector<const FedChannelConnection *>& fcconns = getConnections( det_id );
if(fcconns.size()!=0) {
if(!fcconns.empty()) {
// patch needed to take into account the possibility that the first component of fcconns is invalid
for(size_t i=0;i<fcconns.size();++i) {
if ( (fcconns.at(i) != 0) && (fcconns.at(i)->nApvPairs() != sistrip::invalid_) ) {
if ( (fcconns.at(i) != nullptr) && (fcconns.at(i)->nApvPairs() != sistrip::invalid_) ) {
return fcconns.at(i)->nApvPairs(); // nr of apvpairs for associated module
}
}
Expand Down
8 changes: 4 additions & 4 deletions CalibFormats/SiStripObjects/src/SiStripGain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void SiStripGain::multiply(const SiStripApvGain & apvgain, const double & factor
const std::pair<std::string, std::string> & recordLabelPair)
{
// When inserting the first ApvGain
if( apvgain_ == 0 ) {
if( apvgain_ == nullptr ) {
if( (factor != 1) && (factor != 0) ) {
fillNewGain( &apvgain, factor );
}
Expand All @@ -42,7 +42,7 @@ void SiStripGain::fillNewGain(const SiStripApvGain * apvgain, const double & fac
SiStripApvGain * newApvGain = new SiStripApvGain;
edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat");
SiStripDetInfoFileReader reader(fp.fullPath());
const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo> DetInfos = reader.getAllData();
const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo>& DetInfos = reader.getAllData();

// Loop on the apvgain in input and fill the newApvGain with the values/factor.
std::vector<uint32_t> detIds;
Expand All @@ -59,14 +59,14 @@ void SiStripGain::fillNewGain(const SiStripApvGain * apvgain, const double & fac
SiStripApvGain::Range range = apvgain->getRange(*it);

SiStripApvGain::Range range2;
if( apvgain2 != 0 ) {
if( apvgain2 != nullptr ) {
range2 = apvgain2->getRange(*it);
}

for( int apv = 0; apv < detInfoIt->second.nApvs; ++apv ) {
float apvGainValue = apvgain->getApvGain( apv, range )/factor;

if( (apvgain2 != 0) && (factor2 != 0.) ) {
if( (apvgain2 != nullptr) && (factor2 != 0.) ) {
apvGainValue *= apvgain2->getApvGain( apv, range2 )/factor2;
}

Expand Down
6 changes: 3 additions & 3 deletions CalibTracker/SiStripDCS/plugins/SiStripDetVOffHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
class SiStripDetVOffHandler : public edm::EDAnalyzer {
public:
explicit SiStripDetVOffHandler(const edm::ParameterSet& iConfig );
virtual ~SiStripDetVOffHandler();
virtual void analyze( const edm::Event& evt, const edm::EventSetup& evtSetup);
virtual void endJob();
~SiStripDetVOffHandler() override;
void analyze( const edm::Event& evt, const edm::EventSetup& evtSetup) override;
void endJob() override;

private:
cond::persistency::ConnectionPool m_connectionPool;
Expand Down
16 changes: 8 additions & 8 deletions CalibTracker/SiStripDCS/src/SiStripDetVOffBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SiStripDetVOffBuilder::SiStripDetVOffBuilder(const edm::ParameterSet& pset, cons
excludedDetIdListFile_(pset.getParameter< std::string >("ExcludedDetIdListFile")),
highVoltageOnThreshold_(pset.getParameter<double>("HighVoltageOnThreshold"))
{
lastStoredCondObj.first = NULL;
lastStoredCondObj.first = nullptr;
lastStoredCondObj.second = 0;

edm::LogError("SiStripDetVOffBuilder") << "[SiStripDetVOffBuilder::SiStripDetVOffBuilder] constructor" << endl;
Expand Down Expand Up @@ -148,7 +148,7 @@ void SiStripDetVOffBuilder::BuildDetVOffObj(const TrackerTopology* trackerTopo)

// check if there is already an object stored in the DB
// This happens only if you are using STATUSCHANGE
if (lastStoredCondObj.first != NULL && lastStoredCondObj.second > 0) {
if (lastStoredCondObj.first != nullptr && lastStoredCondObj.second > 0) {
modulesOff.push_back( lastStoredCondObj );
saveIovTime = lastStoredCondObj.second;
setPayloadStats(0, 0, 0);
Expand All @@ -170,7 +170,7 @@ void SiStripDetVOffBuilder::BuildDetVOffObj(const TrackerTopology* trackerTopo)
else {iovtime = getCondTime((dStruct.detidV[i]).second);}

// decide how to initialize modV
SiStripDetVOff *modV = 0;
SiStripDetVOff *modV = nullptr;

// When using STATUSCHANGE they are equal only for the first
// When using LASTVALUE they are equal only if the tmin was set to tsetmin
Expand All @@ -185,7 +185,7 @@ void SiStripDetVOffBuilder::BuildDetVOffObj(const TrackerTopology* trackerTopo)
// Use the file
edm::FileInPath fp(detIdListFile_);
SiStripDetInfoFileReader reader(fp.fullPath());
const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo > detInfos = reader.getAllData();
const std::map<uint32_t, SiStripDetInfoFileReader::DetInfo >& detInfos = reader.getAllData();

//FIXME:
//Following code is actually broken (well not until the cfg has "" for excludedDetIDListFile parameter!
Expand Down Expand Up @@ -257,7 +257,7 @@ void SiStripDetVOffBuilder::BuildDetVOffObj(const TrackerTopology* trackerTopo)

// store the object if it's a new object
if (iovtime != saveIovTime) {
SiStripDetVOff * testV = 0;
SiStripDetVOff * testV = nullptr;
if (!modulesOff.empty()) {testV = modulesOff.back().first;}
if (modulesOff.empty() || !(*modV == *testV) ) {
modulesOff.push_back( std::make_pair(modV,iovtime) );
Expand All @@ -278,7 +278,7 @@ void SiStripDetVOffBuilder::BuildDetVOffObj(const TrackerTopology* trackerTopo)


// compare the first element and the last from previous transfer
if (lastStoredCondObj.first != NULL && lastStoredCondObj.second > 0) {
if (lastStoredCondObj.first != nullptr && lastStoredCondObj.second > 0) {
if ( *(lastStoredCondObj.first) == *(modulesOff[0].first) ) {
if ( modulesOff.size() == 1 ){
// if no HV/LV transition was found in this period: update the last IOV to be tmax
Expand Down Expand Up @@ -314,7 +314,7 @@ int SiStripDetVOffBuilder::findSetting(uint32_t id, const coral::TimeStamp& chan
for (unsigned int i = 0; i < settingID.size(); i++) { if (settingID[i] == id) {locations.push_back((int)i);} }

// simple cases
if (locations.size() == 0) {setting = -1;}
if (locations.empty()) {setting = -1;}
else if (locations.size() == 1) {setting = locations[0];}
// more than one entry for this channel
// NB. entries ordered by date!
Expand All @@ -340,7 +340,7 @@ int SiStripDetVOffBuilder::findSetting(std::string dpname, const coral::TimeStam
for (unsigned int i = 0; i < settingDpname.size(); i++) { if (settingDpname[i] == dpname) {locations.push_back((int)i);} }

// simple cases
if (locations.size() == 0) {setting = -1;}
if (locations.empty()) {setting = -1;}
else if (locations.size() == 1) {setting = locations[0];}
// more than one entry for this channel
// NB. entries ordered by date!
Expand Down
2 changes: 1 addition & 1 deletion CondFormats/SiStripObjects/interface/SiStripBaseDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <vector>
#include <algorithm>
#include <stdint.h>
#include <cstdint>
#include <sstream>
#include <boost/bind/bind.hpp>

Expand Down
2 changes: 1 addition & 1 deletion CondFormats/SiStripObjects/interface/SiStripLatency.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <vector>
#include <algorithm>
#include <stdint.h>
#include <cstdint>
#include <sstream>

class TrackerTopology;
Expand Down
2 changes: 1 addition & 1 deletion CondFormats/SiStripObjects/src/SiStripNoises.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "FWCore/Utilities/interface/Exception.h"
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <iomanip>
#include "CondFormats/SiStripObjects/interface/SiStripDetSummary.h"

Expand Down
2 changes: 1 addition & 1 deletion CondFormats/SiStripObjects/src/SiStripThreshold.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "FWCore/Utilities/interface/Exception.h"
#include <cassert>
#include <algorithm>
#include <math.h>
#include <cmath>

bool SiStripThreshold::put(const uint32_t& DetId, const InputVector& _vect) {
InputVector vect = _vect;
Expand Down
8 changes: 4 additions & 4 deletions CondTools/SiStrip/plugins/SiStripFedCablingReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ void SiStripFedCablingReader::beginRun( const edm::Run& run,
edm::eventsetup::EventSetupRecordKey DetRecordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiStripDetCablingRcd"));
edm::eventsetup::EventSetupRecordKey RegRecordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("SiStripRegionCablingRcd"));

bool FedRcdfound=setup.find(FedRecordKey) != 0?true:false;
bool FecRcdfound=setup.find(FecRecordKey) != 0?true:false;
bool DetRcdfound=setup.find(DetRecordKey) != 0?true:false;
bool RegRcdfound=setup.find(RegRecordKey) != 0?true:false;
bool FedRcdfound=setup.find(FedRecordKey) != nullptr?true:false;
bool FecRcdfound=setup.find(FecRecordKey) != nullptr?true:false;
bool DetRcdfound=setup.find(DetRecordKey) != nullptr?true:false;
bool RegRcdfound=setup.find(RegRecordKey) != nullptr?true:false;

edm::ESHandle<SiStripFedCabling> fed;
if(FedRcdfound){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
class APVCyclePhaseProducerFromL1TS : public edm::stream::EDProducer<> {
public:
explicit APVCyclePhaseProducerFromL1TS(const edm::ParameterSet&);
~APVCyclePhaseProducerFromL1TS();
~APVCyclePhaseProducerFromL1TS() override;

private:
virtual void beginRun(const edm::Run&, const edm::EventSetup&) override;
virtual void produce(edm::Event&, const edm::EventSetup&) override;
void beginRun(const edm::Run&, const edm::EventSetup&) override;
void produce(edm::Event&, const edm::EventSetup&) override;

bool isBadRun(const unsigned int) const;
void printConfiguration(std::stringstream& ss) const;
Expand Down Expand Up @@ -208,7 +208,7 @@ APVCyclePhaseProducerFromL1TS::produce(edm::Event& iEvent, const edm::EventSetup

long long orbitoffset = 0;

if(l1ts->size()>0) {
if(!l1ts->empty()) {

if((*l1ts)[0].lastResync()!=0) {
orbitoffset = _useEC0 ? (*l1ts)[0].lastEventCounter0() + _magicOffset : (*l1ts)[0].lastResync() + _magicOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class CommissioningHistosUsingDb : public virtual CommissioningHistograms {
CommissioningHistosUsingDb( SiStripConfigDb* const,
sistrip::RunType = sistrip::UNDEFINED_RUN_TYPE );

virtual ~CommissioningHistosUsingDb();
~CommissioningHistosUsingDb() override;

virtual void configure( const edm::ParameterSet&, const edm::EventSetup& );
void configure( const edm::ParameterSet&, const edm::EventSetup& ) override;

void uploadToConfigDb();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CommissioningHistosUsingDb::CommissioningHistosUsingDb( SiStripConfigDb* const d
: CommissioningHistograms(),
runType_(type),
db_(db),
cabling_(0),
cabling_(nullptr),
detInfo_(),
uploadAnal_(true),
uploadConf_(false)
Expand All @@ -37,8 +37,8 @@ CommissioningHistosUsingDb::CommissioningHistosUsingDb( SiStripConfigDb* const d
CommissioningHistosUsingDb::CommissioningHistosUsingDb()
: CommissioningHistograms(),
runType_(sistrip::UNDEFINED_RUN_TYPE),
db_(0),
cabling_(0),
db_(nullptr),
cabling_(nullptr),
detInfo_(),
uploadAnal_(false),
uploadConf_(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FineDelayHistosUsingDb::FineDelayHistosUsingDb( const edm::ParameterSet & pset,
SamplingHistograms( pset.getParameter<edm::ParameterSet>("FineDelayParameters"),
bei,
sistrip::FINE_DELAY ),
tracker_(0)
tracker_(nullptr)
{
LogTrace(mlDqmClient_)
<< "[FineDelayHistosUsingDb::" << __func__ << "]"
Expand Down Expand Up @@ -125,7 +125,7 @@ void FineDelayHistosUsingDb::uploadConfigurations() {

void FineDelayHistosUsingDb::computeDelays() {
// do nothing if delays_ map is already filled
if(delays_.size()>0) return;
if(!delays_.empty()) return;

// the point from which track should originate
float x = 0.; float y = 0.; float z = 0.;
Expand All @@ -135,7 +135,7 @@ void FineDelayHistosUsingDb::computeDelays() {

// the reference parameters (best delay in ns, initial Latency)
float bestDelay_ = 0.;
if(data().size()) {
if(!data().empty()) {
Analyses::const_iterator iter = data().begin();
bestDelay_ = dynamic_cast<SamplingAnalysis*>(iter->second)->maximum();
}
Expand Down

0 comments on commit 984449b

Please sign in to comment.