Skip to content

Commit

Permalink
Merge pull request #20753 from davidlange6/clangTidyCleanT1_Alignment
Browse files Browse the repository at this point in the history
clang-tidy checks for Alignment subsystem
  • Loading branch information
cmsbuild authored Oct 5, 2017
2 parents 5a475cf + 576a70d commit 4390117
Show file tree
Hide file tree
Showing 345 changed files with 2,212 additions and 2,212 deletions.
40 changes: 20 additions & 20 deletions Alignment/APEEstimation/interface/TrackerDetectorStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@

struct TrackerDetectorStruct{

TrackerDetectorStruct(): TrkSize(0), TrkSizeGood(0),
HitsSize(0), HitsValid(0), HitsInvalid(0), Hits2D(0),
HitsGood(0), LayersMissed(0),
HitsPixel(0), HitsStrip(0),
Charge(0),
Chi2(0), Ndof(0), NorChi2(0), Prob(0),
Eta(0), EtaErr(0), EtaSig(0), Theta(0),
Phi(0), PhiErr(0), PhiSig(0),
D0Beamspot(0), D0BeamspotErr(0), D0BeamspotSig(0),
Dz(0), DzErr(0), DzSig(0),
P(0), Pt(0), PtErr(0), PtSig(0),
MeanAngle(0),
HitsGoodVsHitsValid(0), MeanAngleVsHits(0),
HitsPixelVsEta(0), HitsPixelVsTheta(0),
HitsStripVsEta(0), HitsStripVsTheta(0),
PtVsEta(0), PtVsTheta(0),
PHitsGoodVsHitsValid(0), PMeanAngleVsHits(0),
PHitsPixelVsEta(0), PHitsPixelVsTheta(0),
PHitsStripVsEta(0), PHitsStripVsTheta(0),
PPtVsEta(0), PPtVsTheta(0){}
TrackerDetectorStruct(): TrkSize(nullptr), TrkSizeGood(nullptr),
HitsSize(nullptr), HitsValid(nullptr), HitsInvalid(nullptr), Hits2D(nullptr),
HitsGood(nullptr), LayersMissed(nullptr),
HitsPixel(nullptr), HitsStrip(nullptr),
Charge(nullptr),
Chi2(nullptr), Ndof(nullptr), NorChi2(nullptr), Prob(nullptr),
Eta(nullptr), EtaErr(nullptr), EtaSig(nullptr), Theta(nullptr),
Phi(nullptr), PhiErr(nullptr), PhiSig(nullptr),
D0Beamspot(nullptr), D0BeamspotErr(nullptr), D0BeamspotSig(nullptr),
Dz(nullptr), DzErr(nullptr), DzSig(nullptr),
P(nullptr), Pt(nullptr), PtErr(nullptr), PtSig(nullptr),
MeanAngle(nullptr),
HitsGoodVsHitsValid(nullptr), MeanAngleVsHits(nullptr),
HitsPixelVsEta(nullptr), HitsPixelVsTheta(nullptr),
HitsStripVsEta(nullptr), HitsStripVsTheta(nullptr),
PtVsEta(nullptr), PtVsTheta(nullptr),
PHitsGoodVsHitsValid(nullptr), PMeanAngleVsHits(nullptr),
PHitsPixelVsEta(nullptr), PHitsPixelVsTheta(nullptr),
PHitsStripVsEta(nullptr), PHitsStripVsTheta(nullptr),
PPtVsEta(nullptr), PPtVsTheta(nullptr){}

TH1 *TrkSize, *TrkSizeGood,
*HitsSize, *HitsValid, *HitsInvalid, *Hits2D,
Expand Down
52 changes: 26 additions & 26 deletions Alignment/APEEstimation/interface/TrackerSectorStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class TrackerSectorStruct{


struct CorrelationHists{
CorrelationHists():Variable(0),
NorResXVsVar(0), ProbXVsVar(0),
SigmaXHitVsVar(0), SigmaXTrkVsVar(0), SigmaXVsVar(0),
PNorResXVsVar(0), PProbXVsVar(0),
PSigmaXHitVsVar(0), PSigmaXTrkVsVar(0), PSigmaXVsVar(0){};
CorrelationHists():Variable(nullptr),
NorResXVsVar(nullptr), ProbXVsVar(nullptr),
SigmaXHitVsVar(nullptr), SigmaXTrkVsVar(nullptr), SigmaXVsVar(nullptr),
PNorResXVsVar(nullptr), PProbXVsVar(nullptr),
PSigmaXHitVsVar(nullptr), PSigmaXTrkVsVar(nullptr), PSigmaXVsVar(nullptr){};

inline void fillCorrHists(const TString, const TrackStruct::HitParameterStruct& hitParameterStruct, double variable);
inline void fillCorrHistsX(const TrackStruct::HitParameterStruct& hitParameterStruct, double variable);
Expand Down Expand Up @@ -126,26 +126,26 @@ class TrackerSectorStruct{



TrackerSectorStruct::TrackerSectorStruct(): directory_(0),
TrackerSectorStruct::TrackerSectorStruct(): directory_(nullptr),
norResXMax_(999.), sigmaXHitMax_(999.), sigmaXMax_(999.),
name("default"), Name(0),
ResX(0), NorResX(0), XHit(0), XTrk(0),
SigmaX2(0), ProbX(0),
WidthVsPhiSensX(0), WidthVsWidthProjected(0), WidthDiffVsMaxStrip(0), WidthDiffVsSigmaXHit(0),
PhiSensXVsBarycentreX(0),
PWidthVsPhiSensX(0), PWidthVsWidthProjected(0), PWidthDiffVsMaxStrip(0), PWidthDiffVsSigmaXHit(0),
PPhiSensXVsBarycentreX(0),
ResY(0), NorResY(0), YHit(0), YTrk(0),
SigmaY2(0), ProbY(0),
PhiSensYVsBarycentreY(0),
PPhiSensYVsBarycentreY(0),
RawId(0),
EntriesX(0),
MeanX(0), RmsX(0), FitMeanX1(0), ResidualWidthX1(0), CorrectionX1(0),
FitMeanX2(0), ResidualWidthX2(0), CorrectionX2(0),
EntriesY(0),
MeanY(0), RmsY(0), FitMeanY1(0), ResidualWidthY1(0), CorrectionY1(0),
FitMeanY2(0), ResidualWidthY2(0), CorrectionY2(0),
name("default"), Name(nullptr),
ResX(nullptr), NorResX(nullptr), XHit(nullptr), XTrk(nullptr),
SigmaX2(nullptr), ProbX(nullptr),
WidthVsPhiSensX(nullptr), WidthVsWidthProjected(nullptr), WidthDiffVsMaxStrip(nullptr), WidthDiffVsSigmaXHit(nullptr),
PhiSensXVsBarycentreX(nullptr),
PWidthVsPhiSensX(nullptr), PWidthVsWidthProjected(nullptr), PWidthDiffVsMaxStrip(nullptr), PWidthDiffVsSigmaXHit(nullptr),
PPhiSensXVsBarycentreX(nullptr),
ResY(nullptr), NorResY(nullptr), YHit(nullptr), YTrk(nullptr),
SigmaY2(nullptr), ProbY(nullptr),
PhiSensYVsBarycentreY(nullptr),
PPhiSensYVsBarycentreY(nullptr),
RawId(nullptr),
EntriesX(nullptr),
MeanX(nullptr), RmsX(nullptr), FitMeanX1(nullptr), ResidualWidthX1(nullptr), CorrectionX1(nullptr),
FitMeanX2(nullptr), ResidualWidthX2(nullptr), CorrectionX2(nullptr),
EntriesY(nullptr),
MeanY(nullptr), RmsY(nullptr), FitMeanY1(nullptr), ResidualWidthY1(nullptr), CorrectionY1(nullptr),
FitMeanY2(nullptr), ResidualWidthY2(nullptr), CorrectionY2(nullptr),
isPixel(false){}


Expand Down Expand Up @@ -185,7 +185,7 @@ TrackerSectorStruct::bookCorrHists(TString xY,TString varName,TString varTitle,T
suffix = "_y";
}

std::string o(options);
const std::string& o(options);
CorrelationHists correlationHists;

if(!(o.find("n") != std::string::npos || o.find("p") != std::string::npos || o.find("h") != std::string::npos ||
Expand Down Expand Up @@ -244,7 +244,7 @@ TrackerSectorStruct::bookCorrHists(TString xY,TString varName,TString labelX,TSt
xy = "y";
}

std::string o(options);
const std::string& o(options);
CorrelationHists correlationHists;

if(!(o.find("n") != std::string::npos || o.find("p") != std::string::npos || o.find("h") != std::string::npos ||
Expand Down
50 changes: 25 additions & 25 deletions Alignment/APEEstimation/plugins/ApeEstimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
class ApeEstimator : public edm::EDAnalyzer {
public:
explicit ApeEstimator(const edm::ParameterSet&);
~ApeEstimator();
~ApeEstimator() override;


private:
Expand All @@ -143,9 +143,9 @@ class ApeEstimator : public edm::EDAnalyzer {
};
typedef std::pair<TrackStruct::HitState,PositionAndError2> StatePositionAndError2;

virtual void beginJob() ;
virtual void analyze(const edm::Event&, const edm::EventSetup&);
virtual void endJob();
void beginJob() override ;
void analyze(const edm::Event&, const edm::EventSetup&) override;
void endJob() override;

bool isHit2D(const TrackingRecHit&)const;

Expand Down Expand Up @@ -257,7 +257,7 @@ ApeEstimator::sectorBuilder(){
edm::LogError("SectorBuilder")<<"TrackerTreeFile not found";
return;
}
TTree* tkTree(0);
TTree* tkTree(nullptr);
tkTreeFile->GetObject("TrackerTreeGenerator/TrackerTree/TrackerTree",tkTree);
if(tkTree){
edm::LogInfo("SectorBuilder")<<"TrackerTree OK";
Expand Down Expand Up @@ -425,7 +425,7 @@ ApeEstimator::sectorBuilder(){

bool
ApeEstimator::checkIntervalsForSectors(const unsigned int sectorCounter, const std::vector<double>& v_id)const{
if(v_id.size()==0)return true;
if(v_id.empty())return true;
if(v_id.size()%2==1){
edm::LogError("SectorBuilder")<<"Incorrect Sector Definition: Position Vectors need even number of arguments (Intervals)"
<<"\n... sector selection is not applied, sector "<<sectorCounter<<" is not built";
Expand All @@ -446,7 +446,7 @@ ApeEstimator::checkIntervalsForSectors(const unsigned int sectorCounter, const s

bool
ApeEstimator::checkModuleIds(const unsigned int id, const std::vector<unsigned int>& v_id)const{
if(v_id.size()==0)return true;
if(v_id.empty())return true;
for(std::vector<unsigned int>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id){
if(id==*i_id)return true;
}
Expand All @@ -455,7 +455,7 @@ ApeEstimator::checkModuleIds(const unsigned int id, const std::vector<unsigned i

bool
ApeEstimator::checkModuleBools(const bool id, const std::vector<unsigned int>& v_id)const{
if(v_id.size()==0)return true;
if(v_id.empty())return true;
for(std::vector<unsigned int>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id){
if(1==*i_id && id)return true;
if(2==*i_id && !id)return true;
Expand All @@ -465,7 +465,7 @@ ApeEstimator::checkModuleBools(const bool id, const std::vector<unsigned int>& v

bool
ApeEstimator::checkModuleDirections(const int id, const std::vector<int>& v_id)const{
if(v_id.size()==0)return true;
if(v_id.empty())return true;
for(std::vector<int>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id){
if(id==*i_id)return true;
}
Expand All @@ -474,7 +474,7 @@ ApeEstimator::checkModuleDirections(const int id, const std::vector<int>& v_id)c

bool
ApeEstimator::checkModulePositions(const float id, const std::vector<double>& v_id)const{
if(v_id.size()==0)return true;
if(v_id.empty())return true;
int entry(1); double intervalBegin(999.);
for(std::vector<double>::const_iterator i_id = v_id.begin(); i_id != v_id.end(); ++i_id, ++entry){
if(entry%2==1)intervalBegin = *i_id;
Expand Down Expand Up @@ -600,13 +600,13 @@ ApeEstimator::bookSectorHistsForAnalyzerMode(){
}

std::stringstream sector; sector << "Sector_" << (*i_sector).first;
TFileDirectory secDir = fileService->mkdir(sector.str().c_str());
TFileDirectory secDir = fileService->mkdir(sector.str());

// Dummy histo containing the sector name as title
(*i_sector).second.Name = secDir.make<TH1F>("z_name",(*i_sector).second.name.c_str(),1,0,1);

// Do not book histos for empty sectors
if((*i_sector).second.v_rawId.size()==0){
if((*i_sector).second.v_rawId.empty()){
continue;
}
// Set parameters for correlationHists
Expand Down Expand Up @@ -799,23 +799,23 @@ ApeEstimator::bookSectorHistsForApeCalculation(){
}

std::stringstream sector; sector << "Sector_" << (*i_sector).first;
TFileDirectory secDir = fileService->mkdir(sector.str().c_str());
TFileDirectory secDir = fileService->mkdir(sector.str());

// Dummy histo containing the sector name as title
(*i_sector).second.Name = secDir.make<TH1F>("z_name",(*i_sector).second.name.c_str(),1,0,1);

// Do not book histos for empty sectors
if((*i_sector).second.v_rawId.size()==0){
if((*i_sector).second.v_rawId.empty()){
continue;
}


// Distributions in each interval (stay in [cm], to have all calculations in [cm])
if(m_resErrBins_.size()==0){m_resErrBins_[1].first = 0.;m_resErrBins_[1].second = 0.01;} // default if no selection taken into account: calculate APE with one bin with residual error 0-100um
if(m_resErrBins_.empty()){m_resErrBins_[1].first = 0.;m_resErrBins_[1].second = 0.01;} // default if no selection taken into account: calculate APE with one bin with residual error 0-100um
for(std::map<unsigned int,std::pair<double,double> >::const_iterator i_errBins = m_resErrBins_.begin();
i_errBins != m_resErrBins_.end(); ++i_errBins){
std::stringstream interval; interval << "Interval_" << (*i_errBins).first;
TFileDirectory intDir = secDir.mkdir(interval.str().c_str());
TFileDirectory intDir = secDir.mkdir(interval.str());
(*i_sector).second.m_binnedHists[(*i_errBins).first]["sigmaX"] = intDir.make<TH1F>("h_sigmaX","residual resolution #sigma_{x};#sigma_{x} [cm];# hits",100,0.,0.01);
(*i_sector).second.m_binnedHists[(*i_errBins).first]["norResX"] = intDir.make<TH1F>("h_norResX","normalized residual r_{x}/#sigma_{r,x};(x_{trk}-x_{hit})/#sigma_{r,x};# hits",100,-10,10);
if((*i_sector).second.isPixel){
Expand Down Expand Up @@ -1240,7 +1240,7 @@ ApeEstimator::fillHitVariables(const TrajectoryMeasurement& i_meas, const edm::E
edm::LogError("FillHitVariables")<<"RecHit in Strip is 'Matched' or 'Projected', but here all should be monohits per module";
hitParams.hitState = TrackStruct::invalid; return hitParams;
}
const SiStripCluster* clusterPtr(0);
const SiStripCluster* clusterPtr(nullptr);
if(m_tkTreeVar_[rawId].subdetId==StripSubdetector::TIB || m_tkTreeVar_[rawId].subdetId==StripSubdetector::TOB){
if(dynamic_cast<const SiStripRecHit1D*>(&recHit)){
const SiStripRecHit1D& stripHit = dynamic_cast<const SiStripRecHit1D&>(recHit);
Expand Down Expand Up @@ -1344,7 +1344,7 @@ ApeEstimator::fillHitVariables(const TrajectoryMeasurement& i_meas, const edm::E

if(!hitParams.isModuleUsable){hitParams.hitState = TrackStruct::invalid; return hitParams;}

if(0==hitParams.v_sector.size()){hitParams.hitState = TrackStruct::notAssignedToSectors; return hitParams;}
if(hitParams.v_sector.empty()){hitParams.hitState = TrackStruct::notAssignedToSectors; return hitParams;}

return hitParams;
//}
Expand Down Expand Up @@ -1515,7 +1515,7 @@ ApeEstimator::hitSelection(){
edm::LogInfo("HitSelector")<<"applying hit cuts ...";
bool emptyMap(true);
for(std::map<std::string, std::vector<double> >::iterator i_hitSelection = m_hitSelection_.begin(); i_hitSelection != m_hitSelection_.end(); ++i_hitSelection){
if(0 < (*i_hitSelection).second.size()){
if(!(*i_hitSelection).second.empty()){
int entry(1); double intervalBegin(999.);
for(std::vector<double>::iterator i_hitInterval = (*i_hitSelection).second.begin(); i_hitInterval != (*i_hitSelection).second.end(); ++entry){
if(entry%2==1){intervalBegin = *i_hitInterval; ++i_hitInterval;}
Expand All @@ -1530,14 +1530,14 @@ ApeEstimator::hitSelection(){
}
}
}
if(0 < (*i_hitSelection).second.size())emptyMap = false;
if(!(*i_hitSelection).second.empty())emptyMap = false;
}
}


bool emptyMapUInt(true);
for(std::map<std::string, std::vector<unsigned int> >::iterator i_hitSelection = m_hitSelectionUInt_.begin(); i_hitSelection != m_hitSelectionUInt_.end(); ++i_hitSelection){
if(0 < (*i_hitSelection).second.size()){
if(!(*i_hitSelection).second.empty()){
int entry(1); unsigned int intervalBegin(999);
for(std::vector<unsigned int>::iterator i_hitInterval = (*i_hitSelection).second.begin(); i_hitInterval != (*i_hitSelection).second.end(); ++entry){
if(entry%2==1){intervalBegin = *i_hitInterval; ++i_hitInterval;}
Expand All @@ -1552,7 +1552,7 @@ ApeEstimator::hitSelection(){
}
}
}
if(0 < (*i_hitSelection).second.size())emptyMapUInt = false;
if(!(*i_hitSelection).second.empty())emptyMapUInt = false;
}
}

Expand Down Expand Up @@ -1613,7 +1613,7 @@ ApeEstimator::hitSelected(TrackStruct::HitParameterStruct& hitParams)const{
for(std::map<std::string, std::vector<double> >::const_iterator i_hitSelection = m_hitSelection_.begin(); i_hitSelection != m_hitSelection_.end(); ++i_hitSelection){
const std::string& hitSelection((*i_hitSelection).first);
const std::vector<double>& v_hitSelection((*i_hitSelection).second);
if(v_hitSelection.size()==0)continue;
if(v_hitSelection.empty())continue;

// For pixel and strip sectors in common
if (hitSelection == "phiSens") {if(!this->inDoubleInterval(v_hitSelection, hitParams.phiSens))isGoodHit = false;}
Expand Down Expand Up @@ -1667,7 +1667,7 @@ ApeEstimator::hitSelected(TrackStruct::HitParameterStruct& hitParams)const{
for(std::map<std::string, std::vector<unsigned int> >::const_iterator i_hitSelection = m_hitSelectionUInt_.begin(); i_hitSelection != m_hitSelectionUInt_.end(); ++i_hitSelection){
const std::string& hitSelection((*i_hitSelection).first);
const std::vector<unsigned int>& v_hitSelection((*i_hitSelection).second);
if(v_hitSelection.size()==0)continue;
if(v_hitSelection.empty())continue;

// For pixel and strip sectors in common

Expand Down Expand Up @@ -2197,7 +2197,7 @@ ApeEstimator::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
if(analyzerMode_)this->fillHistsForAnalyzerMode(trackStruct);
if(calculateApe_)this->fillHistsForApeCalculation(trackStruct);

if(trackStruct.v_hitParams.size()>0)++trackSizeGood;
if(!trackStruct.v_hitParams.empty())++trackSizeGood;
}
if(analyzerMode_ && trackSizeGood>0)tkDetector_.TrkSizeGood->Fill(trackSizeGood);
}
Expand Down
Loading

0 comments on commit 4390117

Please sign in to comment.