Skip to content

Commit

Permalink
Merge branch 'master' into py3_iteriv2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlange6 committed Jun 21, 2018
2 parents feceeb7 + a571295 commit 93d716a
Show file tree
Hide file tree
Showing 302 changed files with 7,647 additions and 6,112 deletions.
Expand Up @@ -38,7 +38,7 @@

process.load("Configuration.Geometry.GeometryRecoDB_cff")

process.load("CondCore.DBCommon.CondDBSetup_cfi")
process.load("CondCore.CondDB.CondDB_cfi")
process.source = cms.Source("EmptySource",
firstRun=cms.untracked.uint32(runnumberalignmentIOV),
)
Expand All @@ -56,7 +56,7 @@
cms.PSet(
record = cms.string('TrackerAlignmentRcd'),
tag = cms.string(alignmenttag),
connect = cms.untracked.string('sqlite_file:'+inputsqlitefile),
connect = cms.string('sqlite_file:'+inputsqlitefile),
),
)

Expand Down
34 changes: 25 additions & 9 deletions CalibFormats/HcalObjects/interface/HcalCalibrations.h
Expand Up @@ -8,22 +8,38 @@
*/
class HcalCalibrations {
public:
HcalCalibrations () {};
HcalCalibrations (const float fGain [4], const float fPedestal [4], const float fEffectivePedestal[4], const float fRespCorr, const float fTimeCorr, const float fLUTCorr);
constexpr HcalCalibrations ()
: mRespCorrGain{0,0,0,0}, mPedestal{0,0,0,0}, mEffectivePedestal{0,0,0,0},
mRespCorr(0), mTimeCorr(0), mLUTCorr(0)
{}
constexpr HcalCalibrations (const float fGain [4], const float fPedestal [4],
const float fEffectivePedestal[4], const float fRespCorr,
const float fTimeCorr, const float fLUTCorr)
: mRespCorrGain{0,0,0,0}, mPedestal{0,0,0,0}, mEffectivePedestal{0,0,0,0},
mRespCorr(0), mTimeCorr(0), mLUTCorr(0) {
for (auto iCap = 0; iCap < 4; ++iCap) {
mRespCorrGain [iCap] = fGain [iCap] * fRespCorr;
mPedestal [iCap] = fPedestal [iCap];
mEffectivePedestal [iCap] = fEffectivePedestal [iCap];
}
mRespCorr = fRespCorr;
mTimeCorr = fTimeCorr;
mLUTCorr = fLUTCorr;
}
/// get LUT corrected and response corrected gain for capid=0..3
double LUTrespcorrgain (int fCapId) const {return (mLUTCorr * mRespCorrGain [fCapId]);}
constexpr double LUTrespcorrgain (int fCapId) const {return (mLUTCorr * mRespCorrGain [fCapId]);}
/// get response corrected gain for capid=0..3
double respcorrgain (int fCapId) const {return mRespCorrGain [fCapId];}
constexpr double respcorrgain (int fCapId) const {return mRespCorrGain [fCapId];}
/// get raw gain for capid=0..3
double rawgain (int fCapId) const {return mRespCorrGain [fCapId] / mRespCorr;}
constexpr double rawgain (int fCapId) const {return mRespCorrGain [fCapId] / mRespCorr;}
/// get pedestal for capid=0..3
double pedestal (int fCapId) const {return mPedestal [fCapId];}
constexpr double pedestal (int fCapId) const {return mPedestal [fCapId];}
/// get effective pedestal for capid=0..3
double effpedestal (int fCapId) const {return mEffectivePedestal [fCapId];}
constexpr double effpedestal (int fCapId) const {return mEffectivePedestal [fCapId];}
/// get response correction factor
double respcorr () const {return mRespCorr;}
constexpr double respcorr () const {return mRespCorr;}
/// get time correction factor
double timecorr () const {return mTimeCorr;}
constexpr double timecorr () const {return mTimeCorr;}
private:
double mRespCorrGain [4];
double mPedestal [4];
Expand Down
21 changes: 0 additions & 21 deletions CalibFormats/HcalObjects/src/HcalCalibrations.cc

This file was deleted.

5 changes: 5 additions & 0 deletions CommonTools/Utils/src/MethodArgumentSetter.h
Expand Up @@ -22,6 +22,11 @@ namespace reco {
}
void operator()(const char *begin, const char *end) const {
assert(begin+1 <= end-1); // the quotes are included in [begin,end[ range.
//in boost 1.67, the parser appends any extra white space to the
// end
if(*(end-1) != *begin) {
--end;
}
stack_.push_back( AnyMethodArgument(std::string(begin+1,end-1)) );
}
private:
Expand Down
3 changes: 3 additions & 0 deletions CommonTools/Utils/test/testCutParser.cc
Expand Up @@ -187,6 +187,9 @@ void testCutParser::checkAll() {
check("quality('goodIterative')", true);
check("quality('looseSetWithPV')", false);
check("quality('highPuritySetWithPV')", false);
check("quality('highPuritySetWithPV' )", false);
check("quality( 'highPuritySetWithPV')", false);
check("quality( 'highPuritySetWithPV' )", false);

// check handling of errors
// first those who are the same in lazy and non lazy parsing
Expand Down
48 changes: 24 additions & 24 deletions CondFormats/HcalObjects/interface/HcalRecoParam.h
Expand Up @@ -16,33 +16,33 @@ mParam1, mParam2 re-define to keep more parameters 28-Oct-2011 sk.

class HcalRecoParam {
public:
HcalRecoParam():mId(0), mParam1(0), mParam2(0) {}
constexpr HcalRecoParam():mId(0), mParam1(0), mParam2(0) {}

HcalRecoParam(unsigned long fId, unsigned int fParam1, unsigned int fParam2):
constexpr HcalRecoParam(unsigned long fId, unsigned int fParam1, unsigned int fParam2):
mId(fId), mParam1(fParam1), mParam2(fParam2) {}

uint32_t rawId () const {return mId;}

unsigned int param1() const {return mParam1;}
unsigned int param2() const {return mParam2;}

bool correctForPhaseContainment() const {return mParam1&0x1;}
bool correctForLeadingEdge() const {return (mParam1>>1)&0x1;}
float correctionPhaseNS() const {return ((mParam1>>2)&0xFF)/4.-32.;}
unsigned int firstSample() const {return (mParam1<10)?(mParam1):((mParam1>>10)&0xF);}
unsigned int samplesToAdd() const {return (mParam1<10)?(mParam2):((mParam1>>14)&0xF);}
unsigned int pulseShapeID() const {return (mParam1>>18)&0x1FF;}

bool useLeakCorrection () const {return mParam2&0x1;}
unsigned int leakCorrectionID () const {return (mParam2>>1)&0xF;}
bool correctForTimeslew () const {return (mParam2>>5)&0x1;}
unsigned int timeslewCorrectionID () const {return (mParam2>>6)&0xF;}
bool correctTiming () const {return (mParam2>>10)&0x1;}
unsigned int firstAuxTS () const { return (mParam2>>11)&0xF;}
unsigned int specialCaseID () const {return (mParam2>>15)&0xF;}
unsigned int noiseFlaggingID () const {return (mParam2>>19)&0xF;}
unsigned int pileupCleaningID () const {return (mParam2>>23)&0xF;}
unsigned int packingScheme () const {return (mParam2>>27)&0xF;}
constexpr uint32_t rawId () const {return mId;}

constexpr unsigned int param1() const {return mParam1;}
constexpr unsigned int param2() const {return mParam2;}

constexpr bool correctForPhaseContainment() const {return mParam1&0x1;}
constexpr bool correctForLeadingEdge() const {return (mParam1>>1)&0x1;}
constexpr float correctionPhaseNS() const {return ((mParam1>>2)&0xFF)/4.-32.;}
constexpr unsigned int firstSample() const {return (mParam1<10)?(mParam1):((mParam1>>10)&0xF);}
constexpr unsigned int samplesToAdd() const {return (mParam1<10)?(mParam2):((mParam1>>14)&0xF);}
constexpr unsigned int pulseShapeID() const {return (mParam1>>18)&0x1FF;}

constexpr bool useLeakCorrection () const {return mParam2&0x1;}
constexpr unsigned int leakCorrectionID () const {return (mParam2>>1)&0xF;}
constexpr bool correctForTimeslew () const {return (mParam2>>5)&0x1;}
constexpr unsigned int timeslewCorrectionID () const {return (mParam2>>6)&0xF;}
constexpr bool correctTiming () const {return (mParam2>>10)&0x1;}
constexpr unsigned int firstAuxTS () const { return (mParam2>>11)&0xF;}
constexpr unsigned int specialCaseID () const {return (mParam2>>15)&0xF;}
constexpr unsigned int noiseFlaggingID () const {return (mParam2>>19)&0xF;}
constexpr unsigned int pileupCleaningID () const {return (mParam2>>23)&0xF;}
constexpr unsigned int packingScheme () const {return (mParam2>>27)&0xF;}

private:
uint32_t mId;
Expand Down
19 changes: 12 additions & 7 deletions CondFormats/RunInfo/interface/LHCInfo.h
Expand Up @@ -16,13 +16,13 @@ class LHCInfo {

enum IntParamIndex { LHC_FILL = 0, BUNCHES_1 = 1, BUNCHES_2 = 2, COLLIDING_BUNCHES = 3, TARGET_BUNCHES = 4, FILL_TYPE = 5, PARTICLES_1 = 6, PARTICLES_2 = 7, LUMI_SECTION = 8, ISIZE = 9 };
enum FloatParamIndex { CROSSING_ANGLE = 0, BETA_STAR = 1, INTENSITY_1 = 2, INTENSITY_2 = 3, ENERGY = 4, DELIV_LUMI = 5, REC_LUMI = 7, LUMI_PER_B = 8, BEAM1_VC = 9, BEAM2_VC = 10, BEAM1_RF = 11, BEAM2_RF = 12, INST_LUMI = 13, INST_LUMI_ERR = 14, FSIZE = 15};
enum TimeParamIndex { CREATE_TIME = 0, BEGIN_TIME = 1, END_TIME = 2, DIP_TIME = 3, TSIZE =4};
enum TimeParamIndex { CREATE_TIME = 0, BEGIN_TIME = 1, END_TIME = 2, TSIZE =3};
enum StringParamIndex { INJECTION_SCHEME = 0, LHC_STATE = 1, LHC_COMMENT = 2, CTPPS_STATUS = 3, SSIZE =4};

typedef FillType FillTypeId;
typedef ParticleType ParticleTypeId;
LHCInfo();
LHCInfo( unsigned short const & lhcFill, bool const & fromData = true );
LHCInfo( const LHCInfo& rhs );
~LHCInfo();

LHCInfo* cloneFill() const;
Expand All @@ -33,14 +33,11 @@ class LHCInfo {
//constant static unsigned integer hosting the available number of LHC bunch slots
static size_t const availableBunchSlots = 2808;

//reset instance
void setFill( unsigned short const & lhcFill, bool const & fromData );
void setFillNumber( unsigned short lhcFill );

//getters
unsigned short const fillNumber() const;

bool const isData() const;

unsigned short const bunchesInBeam1() const;

unsigned short const bunchesInBeam2() const;
Expand Down Expand Up @@ -99,6 +96,14 @@ class LHCInfo {

std::vector<float> const & beam2RF() const;

std::vector<float>& beam1VC();

std::vector<float>& beam2VC();

std::vector<float>& beam1RF();

std::vector<float>& beam2RF();

//returns a boolean, true if the injection scheme has a leading 25ns
//TODO: parse the circulating bunch configuration, instead of the string.
bool is25nsBunchSpacing() const;
Expand Down Expand Up @@ -221,7 +226,7 @@ class LHCInfo {
void setBunchBitsetForBeam2( std::bitset<bunchSlots+1> const & bunchConfiguration );

private:
bool m_isData;
bool m_isData = false;
std::vector<std::vector<unsigned int> > m_intParams;
std::vector<std::vector<float> > m_floatParams;
std::vector<std::vector<unsigned long long> > m_timeParams;
Expand Down
86 changes: 49 additions & 37 deletions CondFormats/RunInfo/src/LHCInfo.cc
Expand Up @@ -70,20 +70,26 @@ static std::string particleTypeToString( LHCInfo::ParticleTypeId const & particl
return s_particleType;
}

LHCInfo::LHCInfo(): m_intParams( ISIZE )
, m_floatParams( FSIZE )
, m_timeParams( TSIZE )
, m_stringParams( SSIZE )
{
setFill(0, false);
LHCInfo::LHCInfo(){
m_intParams.resize( ISIZE, std::vector<unsigned int>(1,0) );
m_floatParams.resize( FSIZE, std::vector<float>(1, 0.) );
m_floatParams[ LUMI_PER_B ] = std::vector<float>();
m_floatParams[ BEAM1_VC ] = std::vector<float>();
m_floatParams[ BEAM2_VC ] = std::vector<float>();
m_floatParams[ BEAM1_RF ] = std::vector<float>();
m_floatParams[ BEAM2_RF ] = std::vector<float>();
m_timeParams.resize( TSIZE, std::vector<unsigned long long>(1,0ULL) );
m_stringParams.resize( SSIZE, std::vector<std::string>(1, "") );
m_stringParams[ INJECTION_SCHEME ].push_back( std::string("None") );
}

LHCInfo::LHCInfo( unsigned short const & lhcFill, bool const & fromData ): m_intParams( ISIZE )
, m_floatParams( FSIZE )
, m_timeParams( TSIZE )
, m_stringParams( SSIZE )
{
setFill(lhcFill, fromData);
LHCInfo::LHCInfo( const LHCInfo& rhs ):
m_intParams( rhs.m_intParams ),
m_floatParams( rhs.m_floatParams ),
m_timeParams( rhs.m_timeParams ),
m_stringParams( rhs.m_stringParams ),
m_bunchConfiguration1( rhs.m_bunchConfiguration1),
m_bunchConfiguration2( rhs.m_bunchConfiguration2){
}

LHCInfo::~LHCInfo() {
Expand All @@ -95,40 +101,30 @@ LHCInfo* LHCInfo::cloneFill() const {
if( !m_intParams[0].empty()){
for(size_t i=0;i<LUMI_SECTION; i++) ret->m_intParams[i]=m_intParams[i];
for(size_t i=0;i<DELIV_LUMI; i++) ret->m_floatParams[i]=m_floatParams[i];
for(size_t i=0;i<DIP_TIME; i++) ret->m_timeParams[i]=m_timeParams[i];
ret->m_floatParams[LUMI_PER_B] = m_floatParams[LUMI_PER_B];
for(size_t i=0;i<TSIZE; i++) ret->m_timeParams[i]=m_timeParams[i];
for(size_t i=0;i<LHC_STATE; i++) ret->m_stringParams[i]=m_stringParams[i];
ret->m_bunchConfiguration1=m_bunchConfiguration1;
ret->m_bunchConfiguration2=m_bunchConfiguration2;
}
return ret;
}

//reset instance
void LHCInfo::setFill( unsigned short const & lhcFill, bool const & fromData ) {
m_isData = fromData;
m_intParams.resize( ISIZE, std::vector<unsigned int>(1,0) );
m_intParams[ LHC_FILL ] = std::vector<unsigned int>(1,lhcFill);
m_floatParams.resize( FSIZE, std::vector<float>(1,0.));
m_floatParams[ LUMI_PER_B ] = std::vector<float>(1, 0.);
m_floatParams[ BEAM1_VC ] = std::vector<float>(1, 0.);
m_floatParams[ BEAM2_VC ] = std::vector<float>(1, 0.);
m_floatParams[ BEAM1_RF ] = std::vector<float>(1, 0.);
m_floatParams[ BEAM2_RF ] = std::vector<float>(1, 0.);
m_timeParams.resize( TSIZE, std::vector<unsigned long long>(1,0ULL) );
m_stringParams.resize( SSIZE, std::vector<std::string>(1, "") );
m_stringParams[ INJECTION_SCHEME ].push_back( std::string("None") );
m_bunchConfiguration1.reset();
m_bunchConfiguration2.reset();
}

namespace LHCInfoImpl {
template <typename T> const T& getParams( const std::vector<T>& params, size_t index ){
if( index >= params.size() ) throw std::out_of_range("Parameter with index "+std::to_string(index)+" is out of range.");
return params[index];
}

template <typename T> T& accessParams( std::vector<T>& params, size_t index ){
if( index >= params.size() ) throw std::out_of_range("Parameter with index "+std::to_string(index)+" is out of range.");
return params[index];
}

template <typename T> const T& getOneParam( const std::vector< std::vector<T> >& params, size_t index ){
if( index >= params.size() ) throw std::out_of_range("Parameter with index "+std::to_string(index)+" is out of range.");
const std::vector<T>& inner = params[index];
if( inner.empty() ) throw std::out_of_range("Parameter with index "+std::to_string(index)+" has no value stored.");
if( inner.empty() ) throw std::out_of_range("Parameter with index "+std::to_string(index)+" type="+typeid(T).name()+" has no value stored.");
return inner[ 0 ];
}

Expand All @@ -149,10 +145,6 @@ unsigned short const LHCInfo::fillNumber() const {
return LHCInfoImpl::getOneParam( m_intParams, LHC_FILL );
}

bool const LHCInfo::isData() const {
return m_isData;
}

unsigned short const LHCInfo::bunchesInBeam1() const {
return LHCInfoImpl::getOneParam( m_intParams, BUNCHES_1 );
}
Expand Down Expand Up @@ -269,6 +261,22 @@ std::vector<float> const & LHCInfo::beam2RF() const {
return LHCInfoImpl::getParams(m_floatParams, BEAM2_RF );
}

std::vector<float>& LHCInfo::beam1VC(){
return LHCInfoImpl::accessParams(m_floatParams, BEAM1_VC );
}

std::vector<float>& LHCInfo::beam2VC(){
return LHCInfoImpl::accessParams(m_floatParams, BEAM2_VC );
}

std::vector<float>& LHCInfo::beam1RF(){
return LHCInfoImpl::accessParams(m_floatParams, BEAM1_RF );
}

std::vector<float>& LHCInfo::beam2RF(){
return LHCInfoImpl::accessParams(m_floatParams, BEAM2_RF );
}

//returns a boolean, true if the injection scheme has a leading 25ns
//TODO: parse the circulating bunch configuration, instead of the string.
bool LHCInfo::is25nsBunchSpacing() const {
Expand Down Expand Up @@ -298,6 +306,10 @@ std::vector<unsigned short> LHCInfo::bunchConfigurationForBeam2() const {
return bitsetToVector( m_bunchConfiguration2 );
}

void LHCInfo::setFillNumber( unsigned short lhcFill ) {
LHCInfoImpl::setOneParam( m_intParams, LHC_FILL, static_cast<unsigned int>(lhcFill) );
}

//setters
void LHCInfo::setBunchesInBeam1( unsigned short const & bunches ) {
LHCInfoImpl::setOneParam( m_intParams, BUNCHES_1, static_cast<unsigned int>(bunches) );
Expand Down Expand Up @@ -505,7 +517,7 @@ void LHCInfo::print( std::stringstream & ss ) const {
<< "LHC State: " << this->lhcState() << std::endl
<< "LHC Comments: " << this->lhcComment() << std::endl
<< "CTPPS Status: " << this->ctppsStatus() << std::endl
<< "Lumi sections: " << this->lumiSection() << std::endl;
<< "Lumi section: " << this->lumiSection() << std::endl;

ss << "Luminosity per bunch (total " << this->lumiPerBX().size() << "): ";
std::copy( this->lumiPerBX().begin(), this->lumiPerBX().end(), std::ostream_iterator<float>( ss, ", " ) );
Expand Down
2 changes: 1 addition & 1 deletion CondTools/Ecal/test/EcalIntercalibConstants_O2O_test.sh
@@ -1,6 +1,6 @@
#!/bin/sh
conddb --yes copy EcalIntercalibConstants_V1_hlt --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db --o2oTest
conddb --yes copy EcalIntercalibConstants_0 --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db
conddb --yes copy EcalIntercalibConstants_0T --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db
conddb --yes copy EcalIntercalibConstants_3.8T_v2 --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db
lastRun=`conddb list EcalIntercalibConstants_V1_hlt | tail -2 | awk '{print $1}'`
conddb --yes copy runinfo_start_31X_hlt --destdb EcalIntercalibConstants_V1_hlt_O2OTEST.db -f $lastRun -t $lastRun
Expand Down

0 comments on commit 93d716a

Please sign in to comment.