CMS 3D CMS Logo

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::CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ( const edm::ParameterSet p)

Definition at line 21 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References acsMeasured, acsMisaligned, acsReal, 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
double f[11][100]

◆ ~CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon()

CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::~CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ( )

Definition at line 42 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

42 {}

Member Function Documentation

◆ Merge()

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

Definition at line 46 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References mixOne_premix_on_sim_cfi::accumulator, PVValHelper::add(), CTPPSRPAlignmentCorrectionsData::addCorrections(), alignCSCRings::corr, edm::IOVSyncValue::eventID(), edm::ValidityInterval::first(), CTPPSRPAlignmentCorrectionsMethods::iovValueToString(), edm::ValidityInterval::last(), genParticles_cff::map, nextLS(), AlCaHLTBitMon_ParallelJobs::p, previousLS(), mps_fire::result, cmsswSequenceInfo::seq, cmsswSequenceInfo::seqs, 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 IOVSyncValue & last() const
const IOVSyncValue & first() const
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...
dictionary corr
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
const EventID & eventID() const
Definition: IOVSyncValue.h:40
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

◆ nextLS()

edm::EventID CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::nextLS ( const edm::EventID src)
static

Definition at line 137 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References edm::EventID::maxLuminosityBlockNumber(), edm::EventID::maxRunNumber(), and TrackRefitter_38T_cff::src.

Referenced by Merge().

137  {
138  if (src.luminosityBlock() == edm::EventID::maxLuminosityBlockNumber()) {
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 }
static RunNumber_t maxRunNumber()
Definition: EventID.h:92
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94

◆ PrepareSequence()

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 geometryDiff::file, submitPVResolutionJobs::files, label, CTPPSRPAlignmentCorrectionsMethods::loadFromXML(), Merge(), cmsswSequenceInfo::seq, 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 }
static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML(const std::string &fileName)
loads sequence of alignment corrections from XML file
char const * label
Log< level::Info, false > LogInfo
CTPPSRPAlignmentCorrectionsDataSequence Merge(const std::vector< CTPPSRPAlignmentCorrectionsDataSequence > &) const

◆ previousLS()

edm::EventID CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::previousLS ( const edm::EventID src)
static

Definition at line 125 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

References edm::EventID::maxLuminosityBlockNumber(), edm::EventID::maxRunNumber(), and TrackRefitter_38T_cff::src.

Referenced by Merge().

125  {
126  if (src.run() == edm::EventID::maxRunNumber() && src.luminosityBlock() == edm::EventID::maxLuminosityBlockNumber())
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 }
static RunNumber_t maxRunNumber()
Definition: EventID.h:92
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94

Member Data Documentation

◆ acMeasured

CTPPSRPAlignmentCorrectionsData CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acMeasured

◆ acMisaligned

CTPPSRPAlignmentCorrectionsData CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acMisaligned

◆ acReal

CTPPSRPAlignmentCorrectionsData CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acReal

◆ acsMeasured

CTPPSRPAlignmentCorrectionsDataSequence CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsMeasured

◆ acsMisaligned

CTPPSRPAlignmentCorrectionsDataSequence CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsMisaligned

◆ acsReal

CTPPSRPAlignmentCorrectionsDataSequence CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsReal

◆ verbosity

unsigned int CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::verbosity

Definition at line 26 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h.

Referenced by Merge(), and PrepareSequence().