Skip to content

Commit

Permalink
turn getenv into std::getenv for all cmssw residual occurencies
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocos committed Oct 7, 2019
1 parent 70bdca8 commit ea0bc0f
Show file tree
Hide file tree
Showing 52 changed files with 109 additions and 109 deletions.
2 changes: 1 addition & 1 deletion Alignment/OfflineValidation/bin/DMRtrends.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const map<TString, int> numberOfLayers(TString Year) {
*/

TString lumifileperyear(TString Year, string RunOrIOV) {
TString LumiFile = getenv("CMSSW_BASE");
TString LumiFile = std::getenv("CMSSW_BASE");
LumiFile += "/src/Alignment/OfflineValidation/data/lumiper";
if (RunOrIOV != "run" && RunOrIOV != "IOV") {
cout << "ERROR: Please specify \"run\" or \"IOV\" to retrieve the luminosity run by run or for each IOV" << endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void TEcnaParPaths::GetCMSSWParameters() {

//------------ CMSSW_BASE

char *ch_cmssw_base = getenv("CMSSW_BASE");
char *ch_cmssw_base = std::getenv("CMSSW_BASE");
if (ch_cmssw_base == nullptr) {
std::cout << "*TEcnaParPaths::GetCMSSWParameters()> CMSSW_BASE not defined."
<< " Please, set up the environment (command: eval `scramv1 runtime -csh`)" << fTTBELL << std::endl;
Expand All @@ -330,7 +330,7 @@ void TEcnaParPaths::GetCMSSWParameters() {

//------------ SCRAM_ARCH

char *ch_scram_arch = getenv("SCRAM_ARCH");
char *ch_scram_arch = std::getenv("SCRAM_ARCH");
if (ch_scram_arch == nullptr) {
std::cout << "*TEcnaParPaths::GetCMSSWParameters()> SCRAM_ARCH not defined."
<< " Please, set up the environment (command: eval `scramv1 runtime -csh`)" << fTTBELL << std::endl;
Expand Down
6 changes: 3 additions & 3 deletions CalibCalorimetry/EcalLaserAnalyzer/src/ME.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ std::vector<MEChannel*> ME::_trees = std::vector<MEChannel*>(4, (MEChannel*)null
bool ME::useElectronicNumbering = false;

TString ME::lmdataPath(int lmr) {
TString out_(getenv("MELMDAT"));
TString out_(std::getenv("MELMDAT"));
out_ += "/";
out_ += ME::smName(lmr);
out_ += "/";
return out_;
}

TString ME::primPath(int lmr) {
TString out_(getenv("MESTORE"));
TString out_(std::getenv("MESTORE"));
out_ += "/";
out_ += ME::smName(lmr);
out_ += "/";
return out_;
}

TString ME::path() { return TString(getenv("MUSECAL")) + "/"; }
TString ME::path() { return TString(std::getenv("MUSECAL")) + "/"; }

TString ME::rootFileName(ME::Header header, ME::Settings settings) {
// get the laser monitoring region and super-module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ MECanvasHolder::ShowWelcome( bool image )
gPad->Clear();
if( image )
{
TString imgpath = TString( getenv("MECONFIG") );
TString imgpath = TString( std::getenv("MECONFIG") );
TImage *img = TImage::Open(imgpath+"/LVB.jpg");
assert( img!=0 );
// img->SetConstRatio(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ MusEcal::histConfig()
// if there is a config file, modify the specified histogram limits
//

TString fileroot = TString( getenv("MECONFIG") );
TString fileroot = TString( std::getenv("MECONFIG") );
fileroot += "/";
fileroot += TString( getenv("MEPERIOD") );
fileroot += TString( std::getenv("MEPERIOD") );
TString ext_[2] = {"EB","EE"};

for( int ii=0; ii<2; ii++ )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ MusEcalGUI::MusEcalGUI( const TGWindow *p, UInt_t w, UInt_t h,
_fChanPanel = 0;
_fLeafPanel = 0;
_fMultiVarPanel = 0;
_psdir = TString(getenv("MEPSDIR"))+"/";
_psdir = TString(std::getenv("MEPSDIR"))+"/";

// layouts and menus
cout << "Setup main window" << endl;
Expand Down Expand Up @@ -2038,7 +2038,7 @@ MusEcalGUI::drawAPDAnim( int opt )
MEPlotWindow* win_;

// FIXME!!!!
TString fname_(getenv("MESTORE"));
TString fname_(std::getenv("MESTORE"));
fname_ += "/EBGlobalHist.root";
FILE *test;
// cout << fname_ << endl;
Expand Down
2 changes: 1 addition & 1 deletion CalibFormats/SiPixelObjects/interface/PixelAliasList.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace pos{

void writefile(){

std::string directory=getenv("PIXELCONFIGURATIONBASE");
std::string directory=std::getenv("PIXELCONFIGURATIONBASE");

std::string filename=directory+"/aliases.txt";

Expand Down
14 changes: 7 additions & 7 deletions CalibFormats/SiPixelObjects/interface/PixelConfigFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ namespace pos{
static std::string directory;
static int first=1;

directory=getenv("PIXELCONFIGURATIONBASE");
directory=std::getenv("PIXELCONFIGURATIONBASE");
std::string filename=directory+"/configurations.txt";
/* Don't know who put this snippet of code here: this case is already contemplated in the 'else' of the 'if' statement below
if(!first)
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace pos{

static PixelAliasList aliases;

directory=getenv("PIXELCONFIGURATIONBASE");
directory=std::getenv("PIXELCONFIGURATIONBASE");
std::string filename=directory+"/aliases.txt";

if (first) {
Expand Down Expand Up @@ -303,7 +303,7 @@ namespace pos{
std::string strversion=s1.str();

static std::string directory;
directory=getenv("PIXELCONFIGURATIONBASE");
directory=std::getenv("PIXELCONFIGURATIONBASE");

std::string fullpath=directory+"/"+dir+"/"+strversion+"/";

Expand Down Expand Up @@ -359,7 +359,7 @@ namespace pos{
std::string strversion=s1.str();

static std::string directory;
directory=getenv("PIXELCONFIGURATIONBASE");
directory=std::getenv("PIXELCONFIGURATIONBASE");

std::string fullpath=directory+"/"+dir+"/"+strversion+"/";

Expand Down Expand Up @@ -544,7 +544,7 @@ namespace pos{
std::string strversion=s1.str();

static std::string directory;
directory=getenv("PIXELCONFIGURATIONBASE");
directory=std::getenv("PIXELCONFIGURATIONBASE");

std::string fullpath=directory+"/"+dir+"/"+strversion+"/";

Expand Down Expand Up @@ -677,7 +677,7 @@ namespace pos{
std::string strversion=s1.str();

static std::string directory;
directory=getenv("PIXELCONFIGURATIONBASE");
directory=std::getenv("PIXELCONFIGURATIONBASE");

std::string fullpath=directory+"/"+dir+"/"+strversion+"/";

Expand Down Expand Up @@ -827,7 +827,7 @@ namespace pos{
static int makeNewVersion(std::string path, std::string &dir){
//std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tInserting data on path:"<<path<<std::endl;
struct stat stbuf;
std::string directory=getenv("PIXELCONFIGURATIONBASE");
std::string directory=std::getenv("PIXELCONFIGURATIONBASE");
directory+="/";
directory+=path;
if (stat(directory.c_str(),&stbuf)!=0){
Expand Down
2 changes: 1 addition & 1 deletion CalibFormats/SiPixelObjects/interface/PixelConfigList.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace pos{

void writefile(){

std::string directory=getenv("PIXELCONFIGURATIONBASE");
std::string directory=std::getenv("PIXELCONFIGURATIONBASE");
/* directory+="/PixelConfigDataExamples/"; */
directory+="/";

Expand Down
2 changes: 1 addition & 1 deletion CalibFormats/SiPixelObjects/test/testPixelCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main(){

//First lets do some tests of the PixelROCName class

//std::string path(getenv("XDAQ_ROOT"));
//std::string path(std::getenv("XDAQ_ROOT"));
//path+="/pixel/PixelFEDInterface/test/";
//PixelFEDCard card(path+"params_fed.dat");

Expand Down
4 changes: 2 additions & 2 deletions CondCore/CondDB/interface/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace cond {

inline std::string currentCMSSWVersion() {
std::string version("");
const char* envVersion = ::getenv("CMSSW_VERSION");
const char* envVersion = std::getenv("CMSSW_VERSION");
if (envVersion) {
version += envVersion;
}
Expand All @@ -43,7 +43,7 @@ namespace cond {

inline std::string currentArchitecture() {
std::string arch("");
const char* archEnv = ::getenv("SCRAM_ARCH");
const char* archEnv = std::getenv("SCRAM_ARCH");
if (archEnv) {
arch += archEnv;
}
Expand Down
2 changes: 1 addition & 1 deletion CondCore/CondDB/plugins/XMLAuthenticationService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ std::set<std::string> cond::XMLAuthenticationService::XMLAuthenticationService::
}

// Try to find other files in the path variable
const char* thePathVariable = ::getenv("CORAL_AUTH_PATH");
const char* thePathVariable = std::getenv("CORAL_AUTH_PATH");
if (!thePathVariable)
return fileNames;
log << coral::Debug << "File \"" << m_inputFileName
Expand Down
6 changes: 3 additions & 3 deletions CondCore/CondDB/src/ConnectionPool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ namespace cond {
// authentication
if (authPath.empty()) {
// first try to check the env...
const char* authEnv = ::getenv(cond::auth::COND_AUTH_PATH);
const char* authEnv = std::getenv(cond::auth::COND_AUTH_PATH);
if (authEnv) {
authPath += authEnv;
}
}
int authSys = m_authSys;
// first attempt, look at the env...
const char* authSysEnv = ::getenv(cond::auth::COND_AUTH_SYS);
const char* authSysEnv = std::getenv(cond::auth::COND_AUTH_SYS);
if (authSysEnv) {
authSys = ::atoi(authSysEnv);
}
Expand All @@ -97,7 +97,7 @@ namespace cond {
std::string servName("");
if (authSys == CondDbKey) {
if (authPath.empty()) {
const char* authEnv = ::getenv("HOME");
const char* authEnv = std::getenv("HOME");
if (authEnv) {
authPath += authEnv;
}
Expand Down
4 changes: 2 additions & 2 deletions CondFormats/JetMETObjects/bin/JetResolution_t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ int main(int argc, char** argv) {
cout << "nevts: " << nevts << endl;
cout << "gaussian: " << doGaussian << endl << endl;

string cmssw_base(getenv("CMSSW_BASE"));
string cmssw_release_base(getenv("CMSSW_RELEASE_BASE"));
string cmssw_base(std::getenv("CMSSW_BASE"));
string cmssw_release_base(std::getenv("CMSSW_RELEASE_BASE"));
string path = cmssw_base + "/src/CondFormats/JetMETObjects/data";
struct stat st;
if (stat(path.c_str(), &st) != 0)
Expand Down
4 changes: 2 additions & 2 deletions DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ void CalibrationHistograms::save(std::string& path, uint32_t run_number, std::st
// Retrieve SCRATCH directory
std::string scratch = "SCRATCH";
std::string dir = "";
if (getenv(scratch.c_str()) != nullptr) {
dir = getenv(scratch.c_str());
if (std::getenv(scratch.c_str()) != nullptr) {
dir = std::getenv(scratch.c_str());
}

// Add directory path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ void CommissioningHistograms::save(std::string& path, uint32_t run_number, std::
// Retrieve SCRATCH directory
std::string scratch = "SCRATCH";
std::string dir = "";
if (getenv(scratch.c_str()) != nullptr) {
dir = getenv(scratch.c_str());
if (std::getenv(scratch.c_str()) != nullptr) {
dir = std::getenv(scratch.c_str());
}

// Add directory path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ void SiStripCommissioningSource::endJob() {
// Retrieve SCRATCH directory
std::string scratch = "SCRATCH"; //@@ remove trailing slash!!!
std::string dir = "";
if (getenv(scratch.c_str()) != nullptr) {
dir = getenv(scratch.c_str());
if (std::getenv(scratch.c_str()) != nullptr) {
dir = std::getenv(scratch.c_str());
}

// Add directory path
Expand Down
2 changes: 1 addition & 1 deletion DQMServices/StreamerIO/plugins/DQMMonitoringService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace dqmservices {

DQMMonitoringService::DQMMonitoringService(const edm::ParameterSet& pset, edm::ActivityRegistry& ar) {
const char* x = getenv("DQM2_SOCKET");
const char* x = std::getenv("DQM2_SOCKET");
if (x) {
std::cerr << "Monitoring pipe: " << x << std::endl;
mstream_.connect(boost::asio::local::stream_protocol::endpoint(x));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void DDExpandedViewDump(ostream& os, DDExpandedView& ex, size_t skip, size_t sto
bool go(true);
int count(0);
bool dotrans(true);
if (getenv("DDNOTRANS"))
if (std::getenv("DDNOTRANS"))
dotrans = false;
++skip;
while (go) {
Expand Down
4 changes: 2 additions & 2 deletions EventFilter/DTRawToDigi/test/testDTUnpackingModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using namespace std;


string releasetop(getenv("SCRAMRT_LOCALRT"));
string releasetop(std::getenv("SCRAMRT_LOCALRT"));
string testfileLocation= releasetop + "/src/EventFilter/DTRawToDigi/test/";

class testDTUnpackingModule: public CppUnit::TestFixture {
Expand All @@ -36,7 +36,7 @@ class testDTUnpackingModule: public CppUnit::TestFixture {


void setUp(){
char * ret = getenv("SCRAMRT_LOCALRT");
char * ret = std::getenv("SCRAMRT_LOCALRT");
if (!ret) {
cerr<< "env variable SCRAMRT_LOCALRT not set, try eval `scramv1 runt -csh`"<< endl;
exit(1);
Expand Down
12 changes: 6 additions & 6 deletions EventFilter/Utilities/src/EvFDaqDirector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace evf {
gethostname(hostname, 32);
hostname_ = hostname;

char* fuLockPollIntervalPtr = getenv("FFF_LOCKPOLLINTERVAL");
char* fuLockPollIntervalPtr = std::getenv("FFF_LOCKPOLLINTERVAL");
if (fuLockPollIntervalPtr) {
try {
fuLockPollInterval_ = boost::lexical_cast<unsigned int>(std::string(fuLockPollIntervalPtr));
Expand All @@ -93,7 +93,7 @@ namespace evf {
}

//override file service parameter if specified by environment
char* fileBrokerParamPtr = getenv("FFF_USEFILEBROKER");
char* fileBrokerParamPtr = std::getenv("FFF_USEFILEBROKER");
if (fileBrokerParamPtr) {
try {
useFileBroker_ = (boost::lexical_cast<unsigned int>(std::string(fileBrokerParamPtr))) > 0;
Expand Down Expand Up @@ -122,7 +122,7 @@ namespace evf {
}
}

char* startFromLSPtr = getenv("FFF_STARTFROMLS");
char* startFromLSPtr = std::getenv("FFF_STARTFROMLS");
if (startFromLSPtr) {
try {
startFromLS_ = boost::lexical_cast<unsigned int>(std::string(startFromLSPtr));
Expand All @@ -133,7 +133,7 @@ namespace evf {
}

//override file service parameter if specified by environment
char* fileBrokerUseLockParamPtr = getenv("FFF_FILEBROKERUSELOCALLOCK");
char* fileBrokerUseLockParamPtr = std::getenv("FFF_FILEBROKERUSELOCALLOCK");
if (fileBrokerUseLockParamPtr) {
try {
fileBrokerUseLocalLock_ = (boost::lexical_cast<unsigned int>(std::string(fileBrokerUseLockParamPtr))) > 0;
Expand Down Expand Up @@ -276,9 +276,9 @@ namespace evf {
else {
//look in source directory if not present in ramdisk
std::string defPathSuffix = "src/EventFilter/Utilities/plugins/budef.jsd";
defPath = std::string(getenv("CMSSW_BASE")) + "/" + defPathSuffix;
defPath = std::string(std::getenv("CMSSW_BASE")) + "/" + defPathSuffix;
if (stat(defPath.c_str(), &statbuf)) {
defPath = std::string(getenv("CMSSW_RELEASE_BASE")) + "/" + defPathSuffix;
defPath = std::string(std::getenv("CMSSW_RELEASE_BASE")) + "/" + defPathSuffix;
if (stat(defPath.c_str(), &statbuf)) {
defPath = defPathSuffix;
}
Expand Down
4 changes: 2 additions & 2 deletions EventFilter/Utilities/src/FastMonitoringService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ namespace evf {
//find microstate definition path (required by the module)
struct stat statbuf;
std::string microstateBaseSuffix = "src/EventFilter/Utilities/plugins/microstatedef.jsd";
std::string microstatePath = std::string(getenv("CMSSW_BASE")) + "/" + microstateBaseSuffix;
std::string microstatePath = std::string(std::getenv("CMSSW_BASE")) + "/" + microstateBaseSuffix;
if (stat(microstatePath.c_str(), &statbuf)) {
microstatePath = std::string(getenv("CMSSW_RELEASE_BASE")) + "/" + microstateBaseSuffix;
microstatePath = std::string(std::getenv("CMSSW_RELEASE_BASE")) + "/" + microstateBaseSuffix;
if (stat(microstatePath.c_str(), &statbuf)) {
microstatePath = microstateBaseSuffix;
if (stat(microstatePath.c_str(), &statbuf))
Expand Down
4 changes: 2 additions & 2 deletions Fireworks/FWInterface/src/FWFFLooper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ FWFFLooper::FWFFLooper(edm::ParameterSet const& ps)
// in the release area then in the local directory. It is also possible to
// override those locations by using the displayConfigurationFilename and
// geometryFilename in the parameterset.
const char* releaseBase = getenv("CMSSW_RELEASE_BASE");
const char* workarea = getenv("CMSSW_BASE");
const char* releaseBase = std::getenv("CMSSW_RELEASE_BASE");
const char* workarea = std::getenv("CMSSW_BASE");
std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc";
std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root";

Expand Down
4 changes: 2 additions & 2 deletions Fireworks/FWInterface/src/FWFFService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ FWFFService::FWFFService(edm::ParameterSet const& ps, edm::ActivityRegistry& ar)
// in the release area then in the local directory. It is also possible to
// override those locations by using the displayConfigurationFilename and
// geometryFilename in the parameterset.
const char* releaseBase = getenv("CMSSW_RELEASE_BASE");
const char* workarea = getenv("CMSSW_BASE");
const char* releaseBase = std::getenv("CMSSW_RELEASE_BASE");
const char* workarea = std::getenv("CMSSW_BASE");
std::string displayConfigRelFilename = "/src/Fireworks/FWInterface/macros/ffw.fwc";
std::string geometryRelFilename = "/src/Fireworks/FWInterface/data/cmsGeom10.root";

Expand Down
Loading

0 comments on commit ea0bc0f

Please sign in to comment.