Skip to content
Snippets Groups Projects
Commit c624e7ea authored by Dave Casper's avatar Dave Casper
Browse files

Adapt to breaking changes in ATLAS conditions code

parent 5915b9c1
No related branches found
No related tags found
No related merge requests found
......@@ -4,17 +4,19 @@
#include "FaserSCT_ReadCalibChipGainCondAlg.h"
#include "FillFromStringUtility.h"
#include "Identifier/IdentifierHash.h"
#include "TrackerIdentifier/FaserSCT_ID.h"
#include "FaserSCT_ConditionsData/FaserSCT_ConditionsParameters.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipUtilities.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipDefs.h"
#include "GaudiKernel/EventIDRange.h"
#include <memory>
using namespace FaserSCT_ConditionsData;
using namespace SCT_ReadCalibChipUtilities;
using namespace SCT_ReadCalibChipDefs;
FaserSCT_ReadCalibChipGainCondAlg::FaserSCT_ReadCalibChipGainCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
......@@ -122,6 +124,6 @@ FaserSCT_ReadCalibChipGainCondAlg::insertNptGainFolderData(FaserSCT_ModuleGainCa
for (int i{0}; i!=N_NPTGAIN; ++i) {
FaserSCT_ModuleCalibParameter& datavec{theseCalibData[i]};
const std::string &dbData{((folderData)[nPtGainDbParameterNames[i]]).data<std::string>()};
fillFromString(dbData, datavec);
fillArrayFromString(dbData, datavec);
}
}
......@@ -4,10 +4,12 @@
#include "FaserSCT_ReadCalibChipNoiseCondAlg.h"
#include "FillFromStringUtility.h"
#include "Identifier/IdentifierHash.h"
#include "TrackerIdentifier/FaserSCT_ID.h"
#include "FaserSCT_ConditionsData/FaserSCT_ConditionsParameters.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipUtilities.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipDefs.h"
#include "GaudiKernel/EventIDRange.h"
......@@ -15,7 +17,7 @@
#include <memory>
using namespace FaserSCT_ConditionsData;
using namespace SCT_ReadCalibChipUtilities;
using namespace SCT_ReadCalibChipDefs;
FaserSCT_ReadCalibChipNoiseCondAlg::FaserSCT_ReadCalibChipNoiseCondAlg(const std::string& name, ISvcLocator* pSvcLocator)
: ::AthReentrantAlgorithm(name, pSvcLocator)
......@@ -123,6 +125,6 @@ FaserSCT_ReadCalibChipNoiseCondAlg::insertNoiseOccFolderData(FaserSCT_ModuleNois
for (int i{0}; i!=N_NOISEOCC; ++i) {
FaserSCT_ModuleCalibParameter& datavec{theseCalibData[i]};
std::string dbData{((folderData)[noiseOccDbParameterNames[i]]).data<std::string>()};
fillFromString(dbData, datavec);
fillArrayFromString(dbData, datavec);
}
}
// -*- C++ -*-
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FillFromStringUtility_h
#define FillFromStringUtility_h
// Include STL stuff
#include <limits>
#include <string>
// Include boost stuff
#include "boost/tokenizer.hpp"
#include "boost/lexical_cast.hpp"
namespace {
template <typename C>
bool fillArrayFromString(const std::string& source, C& userContainer) {
if (source.empty()) return false;
typedef typename C::value_type V_t;
V_t errVal{std::numeric_limits<V_t>::has_quiet_NaN ? (std::numeric_limits<V_t>::quiet_NaN()) : 0};
boost::char_separator<char> sep{" "};
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
Tokenizer tok{source, sep};
bool noNan{true};
const Tokenizer::iterator end{tok.end()};
int j{0};
for (Tokenizer::iterator i{tok.begin()}; i!=end; ++i) {
try {
userContainer[j]=boost::lexical_cast<V_t>(*i);
} catch (const boost::bad_lexical_cast&) {
userContainer[j]=errVal;
noNan=false;
}
++j;
}
return noNan;
}
template <typename C>
bool fillEmptyVectorFromString(const std::string& source, C& userContainer) {
if (source.empty()) return false;
typedef typename C::value_type V_t;
V_t errVal{std::numeric_limits<V_t>::has_quiet_NaN ? (std::numeric_limits<V_t>::quiet_NaN()) : 0};
boost::char_separator<char> sep{" "};
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
Tokenizer tok{source, sep};
bool noNan{true};
const Tokenizer::iterator end{tok.end()};
for (Tokenizer::iterator i{tok.begin()}; i!=end; ++i) {
try {
userContainer.push_back(boost::lexical_cast<V_t>(*i));
} catch (const boost::bad_lexical_cast&) {
userContainer.push_back(errVal);
noNan=false;
}
}
return noNan;
}
} // end of anonymous namespace
#endif // FillFromStringUtility_h
......@@ -14,10 +14,10 @@
#include "FaserSCT_ConditionsData/FaserSCT_ModuleCalibParameter.h"
#include "FaserSCT_ConditionsData/FaserSCT_ModuleGainCalibData.h"
#include "FaserSCT_ConditionsData/FaserSCT_ModuleNoiseCalibData.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipUtilities.h"
#include "SCT_ConditionsTools/SCT_ReadCalibChipDefs.h"
using namespace FaserSCT_ConditionsData;
using namespace SCT_ReadCalibChipUtilities;
using namespace SCT_ReadCalibChipDefs;
//----------------------------------------------------------------------
FaserSCT_ReadCalibChipDataTool::FaserSCT_ReadCalibChipDataTool (const std::string& type, const std::string& name, const IInterface* parent) :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment