CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon Class Reference

#include <CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h>

Public Member Functions

 CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon (const edm::ParameterSet &p)
 
 ~CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ()
 

Static Public Member Functions

static edm::EventID nextLS (const edm::EventID &src)
 
static edm::EventID previousLS (const edm::EventID &src)
 

Public Attributes

CTPPSRPAlignmentCorrectionsData acMeasured
 
CTPPSRPAlignmentCorrectionsData acMisaligned
 
CTPPSRPAlignmentCorrectionsData acReal
 
CTPPSRPAlignmentCorrectionsDataSequence acsMeasured
 
CTPPSRPAlignmentCorrectionsDataSequence acsMisaligned
 
CTPPSRPAlignmentCorrectionsDataSequence acsReal
 
unsigned int verbosity
 

Protected Member Functions

CTPPSRPAlignmentCorrectionsDataSequence Merge (const std::vector< CTPPSRPAlignmentCorrectionsDataSequence > &) const
 
void PrepareSequence (const std::string &label, CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::vector< std::string > &files) const
 

Detailed Description

Definition at line 18 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h.

Constructor & Destructor Documentation

CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ( const edm::ParameterSet p)

Definition at line 21 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References acsMeasured, acsMisaligned, acsReal, validate-o2o-wbm::f, contentValuesFiles::fullPath, edm::ParameterSet::getParameter(), and PrepareSequence().

23  : verbosity(pSet.getUntrackedParameter<unsigned int>("verbosity", 0)) {
24  std::vector<std::string> measuredFiles;
25  for (const auto &f : pSet.getParameter<std::vector<std::string> >("MeasuredFiles"))
26  measuredFiles.push_back(edm::FileInPath(f).fullPath());
27  PrepareSequence("Measured", acsMeasured, measuredFiles);
28 
29  std::vector<std::string> realFiles;
30  for (const auto &f : pSet.getParameter<std::vector<std::string> >("RealFiles"))
31  realFiles.push_back(edm::FileInPath(f).fullPath());
32  PrepareSequence("Real", acsReal, realFiles);
33 
34  std::vector<std::string> misalignedFiles;
35  for (const auto &f : pSet.getParameter<std::vector<std::string> >("MisalignedFiles"))
36  misalignedFiles.push_back(edm::FileInPath(f).fullPath());
37  PrepareSequence("Misaligned", acsMisaligned, misalignedFiles);
38 }
void PrepareSequence(const std::string &label, CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::vector< std::string > &files) const
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::~CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ( )

Definition at line 42 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

42 {}

Member Function Documentation

CTPPSRPAlignmentCorrectionsDataSequence CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::Merge ( const std::vector< CTPPSRPAlignmentCorrectionsDataSequence > &  seqs) const
protected

Definition at line 46 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References PVValHelper::add(), CTPPSRPAlignmentCorrectionsData::addCorrections(), alignCSCRings::corr, edm::IOVSyncValue::eventID(), edm::ValidityInterval::first(), CTPPSRPAlignmentCorrectionsDataSequence::insert(), CTPPSRPAlignmentCorrectionsMethods::iovValueToString(), edm::ValidityInterval::last(), nextLS(), AlCaHLTBitMon_ParallelJobs::p, previousLS(), mps_fire::result, cmsswSequenceInfo::seq, trackerHitRTTI::vector, and verbosity.

Referenced by PrepareSequence().

47  {
48  // find interval boundaries
49  std::map<edm::EventID, std::vector<std::pair<bool, const CTPPSRPAlignmentCorrectionsData *> > > bounds;
50 
51  for (const auto &seq : seqs) {
52  for (const auto &p : seq) {
53  const edm::ValidityInterval &iov = p.first;
54  const CTPPSRPAlignmentCorrectionsData *corr = &p.second;
55 
56  const edm::EventID &event_first = iov.first().eventID();
57  bounds[event_first].emplace_back(std::pair<bool, const CTPPSRPAlignmentCorrectionsData *>(true, corr));
58 
59  const edm::EventID &event_after = nextLS(iov.last().eventID());
60  bounds[event_after].emplace_back(std::pair<bool, const CTPPSRPAlignmentCorrectionsData *>(false, corr));
61  }
62  }
63 
64  // build correction sums per interval
65  std::set<const CTPPSRPAlignmentCorrectionsData *> accumulator;
67  for (std::map<edm::EventID, std::vector<std::pair<bool, const CTPPSRPAlignmentCorrectionsData *> > >::const_iterator
68  tit = bounds.begin();
69  tit != bounds.end();
70  ++tit) {
71  for (const auto &cit : tit->second) {
72  bool add = cit.first;
73  const CTPPSRPAlignmentCorrectionsData *corr = cit.second;
74 
75  if (add)
76  accumulator.insert(corr);
77  else
78  accumulator.erase(corr);
79  }
80 
81  auto tit_next = tit;
82  tit_next++;
83  if (tit_next == bounds.end())
84  break;
85 
86  const edm::EventID &event_first = tit->first;
87  const edm::EventID &event_last = previousLS(tit_next->first);
88 
89  if (verbosity) {
90  edm::LogInfo("PPS") << " first="
92  << ", last="
94  << ": alignment blocks " << accumulator.size();
95  }
96 
98  for (auto sit : accumulator)
99  corr_sum.addCorrections(*sit);
100 
101  result.insert(edm::ValidityInterval(edm::IOVSyncValue(event_first), edm::IOVSyncValue(event_last)), corr_sum);
102  }
103 
104  return result;
105 }
const EventID & eventID() const
Definition: IOVSyncValue.h:40
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...
tuple result
Definition: mps_fire.py:311
const IOVSyncValue & last() const
static std::string iovValueToString(const edm::IOVSyncValue &)
void addCorrections(const CTPPSRPAlignmentCorrectionsData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
adds (merges) corrections on top of the current values
Log< level::Info, false > LogInfo
void insert(const edm::ValidityInterval &iov, const CTPPSRPAlignmentCorrectionsData &data)
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
const IOVSyncValue & first() const
edm::EventID CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::nextLS ( const edm::EventID src)
static

Definition at line 137 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References edm::EventID::event(), edm::EventID::luminosityBlock(), edm::EventID::maxLuminosityBlockNumber(), edm::EventID::maxRunNumber(), and edm::EventID::run().

Referenced by Merge().

137  {
139  if (src.run() == edm::EventID::maxRunNumber())
140  return src;
141 
142  return edm::EventID(src.run() + 1, 0, src.event());
143  }
144 
145  return edm::EventID(src.run(), src.luminosityBlock() + 1, src.event());
146 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
static RunNumber_t maxRunNumber()
Definition: EventID.h:92
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94
void CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::PrepareSequence ( const std::string &  label,
CTPPSRPAlignmentCorrectionsDataSequence seq,
const std::vector< std::string > &  files 
) const
protected

Definition at line 109 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References mergeVDriftHistosByStation::file, CTPPSRPAlignmentCorrectionsMethods::loadFromXML(), Merge(), and verbosity.

Referenced by CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon().

111  {
112  if (verbosity)
113  edm::LogInfo("PPS") << "PrepareSequence(" << label << ")";
114 
115  std::vector<CTPPSRPAlignmentCorrectionsDataSequence> sequences;
116  sequences.reserve(files.size());
117  for (const auto &file : files)
118  sequences.emplace_back(CTPPSRPAlignmentCorrectionsMethods::loadFromXML(file));
119 
120  seq = Merge(sequences);
121 }
CTPPSRPAlignmentCorrectionsDataSequence Merge(const std::vector< CTPPSRPAlignmentCorrectionsDataSequence > &) const
static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML(const std::string &fileName)
loads sequence of alignment corrections from XML file
char const * label
Log< level::Info, false > LogInfo
edm::EventID CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::previousLS ( const edm::EventID src)
static

Definition at line 125 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References edm::EventID::event(), edm::EventID::luminosityBlock(), edm::EventID::maxLuminosityBlockNumber(), edm::EventID::maxRunNumber(), and edm::EventID::run().

Referenced by Merge().

125  {
127  return src;
128 
129  if (src.luminosityBlock() == 0)
130  return edm::EventID(src.run() - 1, edm::EventID::maxLuminosityBlockNumber(), src.event());
131 
132  return edm::EventID(src.run(), src.luminosityBlock() - 1, src.event());
133 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
static RunNumber_t maxRunNumber()
Definition: EventID.h:92
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94

Member Data Documentation

CTPPSRPAlignmentCorrectionsData CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acMeasured
CTPPSRPAlignmentCorrectionsData CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acMisaligned
CTPPSRPAlignmentCorrectionsData CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acReal
CTPPSRPAlignmentCorrectionsDataSequence CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsMeasured
unsigned int CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::verbosity

Definition at line 26 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h.

Referenced by Merge(), and PrepareSequence().