Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:22

0001 #include "CondFormats/Luminosity/interface/LumiSectionData.h"
0002 #include <iostream>
0003 lumi::LumiSectionData::LumiSectionData() : m_sectionid(0), m_versionid("-1") {
0004   m_bx.reserve(lumi::BXMAX * LUMIALGOMAX);
0005 }
0006 std::string lumi::LumiSectionData::lumiVersion() const { return m_versionid; }
0007 int lumi::LumiSectionData::lumisectionID() const { return m_sectionid; }
0008 size_t lumi::LumiSectionData::nBunchCrossing() const { return m_bx.size() / lumi::LUMIALGOMAX; }
0009 float lumi::LumiSectionData::lumiAverage() const { return m_lumiavg; }
0010 float lumi::LumiSectionData::lumiError() const { return m_lumierror; }
0011 float lumi::LumiSectionData::deadFraction() const { return m_deadfrac; }
0012 unsigned long long lumi::LumiSectionData::startorbit() const { return m_startorbit; }
0013 int lumi::LumiSectionData::lumiquality() const { return m_quality; }
0014 void lumi::LumiSectionData::bunchCrossingInfo(const lumi::LumiAlgoType lumialgotype,
0015                                               std::vector<lumi::BunchCrossingInfo>& result) const {
0016   result.clear();
0017   size_t offset = lumialgotype * lumi::BXMAX;
0018   std::copy(m_bx.begin() + offset, m_bx.begin() + offset + lumi::BXMAX, std::back_inserter(result));
0019 }
0020 
0021 const lumi::BunchCrossingInfo lumi::LumiSectionData::bunchCrossingInfo(const int BXIndex,
0022                                                                        const LumiAlgoType lumialgotype) const {
0023   int realIdx = BXIndex - lumi::BXMIN + lumialgotype * lumi::BXMAX;
0024   return m_bx.at(realIdx);
0025 }
0026 lumi::BunchCrossingIterator lumi::LumiSectionData::bunchCrossingBegin(const LumiAlgoType lumialgotype) const {
0027   return m_bx.begin() + lumialgotype * BXMAX;
0028 }
0029 lumi::BunchCrossingIterator lumi::LumiSectionData::bunchCrossingEnd(const LumiAlgoType lumialgotype) const {
0030   return m_bx.end() - (lumi::BXMAX)*lumialgotype;
0031 }
0032 size_t lumi::LumiSectionData::nHLTPath() const { return m_hlt.size(); }
0033 bool lumi::LumiSectionData::HLThasData() const { return !m_hlt.empty(); }
0034 lumi::HLTIterator lumi::LumiSectionData::hltBegin() const { return m_hlt.begin(); }
0035 lumi::HLTIterator lumi::LumiSectionData::hltEnd() const { return m_hlt.end(); }
0036 bool lumi::LumiSectionData::TriggerhasData() const { return !m_trigger.empty(); }
0037 lumi::TriggerIterator lumi::LumiSectionData::trgBegin() const { return m_trigger.begin(); }
0038 lumi::TriggerIterator lumi::LumiSectionData::trgEnd() const { return m_trigger.end(); }
0039 short lumi::LumiSectionData::qualityFlag() const { return m_quality; }
0040 void lumi::LumiSectionData::setLumiNull() { m_versionid = -99; }
0041 void lumi::LumiSectionData::setLumiVersion(const std::string& versionid) { m_versionid = versionid; }
0042 void lumi::LumiSectionData::setLumiSectionId(int sectionid) { m_sectionid = sectionid; }
0043 void lumi::LumiSectionData::setLumiAverage(float avg) { m_lumiavg = avg; }
0044 void lumi::LumiSectionData::setLumiQuality(int lumiquality) { m_quality = lumiquality; }
0045 void lumi::LumiSectionData::setDeadFraction(float deadfrac) { m_deadfrac = deadfrac; }
0046 void lumi::LumiSectionData::setLumiError(float lumierr) { m_lumierror = lumierr; }
0047 void lumi::LumiSectionData::setStartOrbit(unsigned long long orbtnumber) { m_startorbit = orbtnumber; }
0048 void lumi::LumiSectionData::setBunchCrossingData(const std::vector<BunchCrossingInfo>& BXs,
0049                                                  const LumiAlgoType algotype) {
0050   std::copy(BXs.begin(), BXs.begin() + lumi::BXMAX, std::back_inserter(m_bx));
0051 }
0052 void lumi::LumiSectionData::setHLTData(const std::vector<HLTInfo>& hltdetail) {
0053   std::copy(hltdetail.begin(), hltdetail.end(), std::back_inserter(m_hlt));
0054 }
0055 void lumi::LumiSectionData::setTriggerData(const std::vector<TriggerInfo>& triggerinfo) {
0056   std::copy(triggerinfo.begin(), triggerinfo.end(), std::back_inserter(m_trigger));
0057 }
0058 void lumi::LumiSectionData::setQualityFlag(short qualityflag) { m_quality = qualityflag; }
0059 void lumi::LumiSectionData::print(std::ostream& s) const {
0060   s << "lumi section id :" << m_sectionid << ", ";
0061   s << "lumi data version : " << m_versionid << ", ";
0062   s << "lumi average : " << m_lumiavg << ", ";
0063   s << "lumi error : " << m_lumierror << ", ";
0064   s << "lumi quality : " << m_quality << ", ";
0065   s << "lumi deadfrac : " << m_deadfrac << std::endl;
0066   std::vector<lumi::TriggerInfo>::const_iterator trgit;
0067   std::vector<lumi::TriggerInfo>::const_iterator trgitBeg = m_trigger.begin();
0068   std::vector<lumi::TriggerInfo>::const_iterator trgitEnd = m_trigger.end();
0069   unsigned int i = 0;
0070   for (trgit = trgitBeg; trgit != trgitEnd; ++trgit) {
0071     std::cout << "  trg " << i << " : name : " << trgit->name << " : count : " << trgit->triggercount
0072               << " : deadtime : " << trgit->deadtimecount << " : prescale : " << trgit->prescale << std::endl;
0073     ++i;
0074   }
0075 }