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 17 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h.

Constructor & Destructor Documentation

◆ CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon()

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

Definition at line 20 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

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);

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

◆ ~CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon()

CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::~CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon ( )

Member Function Documentation

◆ Merge()

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

Definition at line 45 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

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;

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().

◆ nextLS()

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

Definition at line 136 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

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());

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

Referenced by Merge().

◆ PrepareSequence()

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

Definition at line 108 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

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);

References FrontierConditions_GlobalTag_cff::file, submitPVResolutionJobs::files, label, CTPPSRPAlignmentCorrectionsMethods::loadFromXML(), Merge(), cmsswSequenceInfo::seq, and verbosity.

Referenced by CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon().

◆ previousLS()

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

Definition at line 124 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc.

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());

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

Referenced by Merge().

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 25 of file CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h.

Referenced by Merge(), and PrepareSequence().

CTPPSRPAlignmentCorrectionsMethods::iovValueToString
static std::string iovValueToString(const edm::IOVSyncValue &)
Definition: CTPPSRPAlignmentCorrectionsMethods.cc:90
cmsswSequenceInfo.seq
seq
Definition: cmsswSequenceInfo.py:539
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm::EventID::maxRunNumber
static RunNumber_t maxRunNumber()
Definition: EventID.h:92
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ValidityInterval::last
const IOVSyncValue & last() const
Definition: ValidityInterval.h:38
edm::ValidityInterval
Definition: ValidityInterval.h:28
edm::ValidityInterval::first
const IOVSyncValue & first() const
Definition: ValidityInterval.h:37
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CTPPSRPAlignmentCorrectionsData::addCorrections
void addCorrections(const CTPPSRPAlignmentCorrectionsData &, bool sumErrors=true, bool addSh=true, bool addRot=true)
adds (merges) corrections on top of the current values
Definition: CTPPSRPAlignmentCorrectionsData.cc:101
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::previousLS
static edm::EventID previousLS(const edm::EventID &src)
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc:124
edm::FileInPath
Definition: FileInPath.h:64
edm::EventID::maxLuminosityBlockNumber
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
Definition: EventID.h:94
submitPVResolutionJobs.files
files
Definition: submitPVResolutionJobs.py:373
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::PrepareSequence
void PrepareSequence(const std::string &label, CTPPSRPAlignmentCorrectionsDataSequence &seq, const std::vector< std::string > &files) const
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc:108
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::IOVSyncValue::eventID
const EventID & eventID() const
Definition: IOVSyncValue.h:40
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
mixOne_premix_on_sim_cfi.accumulator
accumulator
Definition: mixOne_premix_on_sim_cfi.py:167
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsMeasured
CTPPSRPAlignmentCorrectionsDataSequence acsMeasured
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h:22
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsMisaligned
CTPPSRPAlignmentCorrectionsDataSequence acsMisaligned
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h:22
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::Merge
CTPPSRPAlignmentCorrectionsDataSequence Merge(const std::vector< CTPPSRPAlignmentCorrectionsDataSequence > &) const
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc:45
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::nextLS
static edm::EventID nextLS(const edm::EventID &src)
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.cc:136
CTPPSRPAlignmentCorrectionsData
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition: CTPPSRPAlignmentCorrectionsData.h:24
mps_fire.result
result
Definition: mps_fire.py:311
genParticles_cff.map
map
Definition: genParticles_cff.py:11
edm::EventID
Definition: EventID.h:31
CTPPSRPAlignmentCorrectionsMethods::loadFromXML
static CTPPSRPAlignmentCorrectionsDataSequence loadFromXML(const std::string &fileName)
loads sequence of alignment corrections from XML file
Definition: CTPPSRPAlignmentCorrectionsMethods.cc:104
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::verbosity
unsigned int verbosity
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h:25
cmsswSequenceInfo.seqs
seqs
Definition: cmsswSequenceInfo.py:526
label
const char * label
Definition: PFTauDecayModeTools.cc:11
CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon::acsReal
CTPPSRPAlignmentCorrectionsDataSequence acsReal
Definition: CTPPSRPAlignmentCorrectionsDataESSourceXMLCommon.h:22
CTPPSRPAlignmentCorrectionsDataSequence
Time sequence of alignment corrections. I/O methods have been factored out to: CondFormats/PPSObjects...
Definition: CTPPSRPAlignmentCorrectionsDataSequence.h:22