64 verbosity(pSet.getUntrackedParameter<unsigned
int>(
"verbosity", 1))
74 findingRecord<RPMeasuredAlignmentRecord>();
75 findingRecord<RPRealAlignmentRecord>();
76 findingRecord<RPMisalignedAlignmentRecord>();
90 map< TimeValue_t, vector< pair<bool, const RPAlignmentCorrectionsData*> > > bounds;
92 for (
const auto &
file : files)
94 for (RPAlignmentCorrectionsDataSequence::const_iterator iit =
file.begin(); iit !=
file.end(); ++iit)
99 bounds[tvi.
first].emplace_back( pair<bool, const RPAlignmentCorrectionsData*>(
true, corr) );
102 bounds[tvi.
last +
delta].emplace_back( pair<bool, const RPAlignmentCorrectionsData*>(
false, corr) );
107 set<const RPAlignmentCorrectionsData*> accumulator;
110 for (
map<
TimeValue_t, vector< pair<bool, const RPAlignmentCorrectionsData*> > >::const_iterator tit = bounds.begin(); tit != bounds.end(); ++tit)
112 for (
const auto & cit : tit->second)
114 bool add = cit.first;
118 accumulator.insert(corr);
120 accumulator.erase(corr);
123 map< TimeValue_t, vector< pair<bool, const RPAlignmentCorrectionsData*> > >::const_iterator tit_next = tit;
125 if (tit_next == bounds.end())
133 printf(
"\tfirst=%10s, last=%10s: alignment blocks=%li\n",
140 for (
auto sit : accumulator)
141 result[tvi].addCorrections(*sit);
152 printf(
">> CTPPSIncludeAlignments::PrepareSequence(%s)\n", label.c_str());
154 vector<RPAlignmentCorrectionsDataSequence> sequences;
155 for (
const auto &
file : files)
158 seq =
Merge(sequences);
165 return std::make_unique<RPAlignmentCorrectionsData>(
acMeasured);
172 return std::make_unique<RPAlignmentCorrectionsData>(
acReal);
179 return std::make_unique<RPAlignmentCorrectionsData>(
acMisaligned);
190 <<
">> CTPPSIncludeAlignments::setIntervalFor(" << key.
name() <<
")";
194 strftime(timeStr, 50,
"%F %T", localtime(&unixTime));
197 <<
" run=" << iosv.
eventID().
run() <<
", event=" << iosv.
eventID().
event() <<
", UNIX timestamp=" << unixTime <<
" (" << timeStr <<
")";
204 if (strcmp(key.
name(),
"RPMeasuredAlignmentRecord") == 0)
210 if (strcmp(key.
name(),
"RPRealAlignmentRecord") == 0)
216 if (strcmp(key.
name(),
"RPMisalignedAlignmentRecord") == 0)
223 throw cms::Exception(
"CTPPSIncludeAlignments::setIntervalFor") <<
"Unknown record " << key.
name();
226 bool next_exists =
false;
229 for (
auto & it : *seq)
231 if (it.first.first <= t && it.first.last >= t)
246 if (t <= it.first.first)
249 next_start =
min(next_start, it.first.first);
T getParameter(std::string const &) const
EventNumber_t event() const
RPAlignmentCorrectionsDataSequence Merge(const std::vector< RPAlignmentCorrectionsDataSequence > &) const
merges an array of sequences to one
RPAlignmentCorrectionsDataSequence acsMeasured
Time sequence of alignment corrections.
RPAlignmentCorrectionsDataSequence acsMisaligned
const EventID & eventID() const
Validity interval in timestamps.
RPAlignmentCorrectionsData acMisaligned
static const IOVSyncValue & endOfTime()
RPAlignmentCorrectionsDataSequence acsReal
std::pair< Time_t, Time_t > ValidityInterval
std::unique_ptr< RPAlignmentCorrectionsData > produceReal(const RPRealAlignmentRecord &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
const IOVSyncValue & last() const
~CTPPSIncludeAlignments() override
std::unique_ptr< RPAlignmentCorrectionsData > produceMeasured(const RPMeasuredAlignmentRecord &)
RPAlignmentCorrectionsData acMeasured
const char * name() const
CTPPSIncludeAlignments(const edm::ParameterSet &p)
static std::string ValueToUNIXString(const edm::TimeValue_t &v)
unsigned int unixTime() const
Time in seconds since January 1, 1970.
void PrepareSequence(const std::string &label, RPAlignmentCorrectionsDataSequence &seq, const std::vector< std::string > &files) const
builds a sequence of corrections from provided sources and runs a few checks
unsigned long long TimeValue_t
RPAlignmentCorrectionsData acReal
edm::TimeValue_t first
the boundaries (included) of the interval expressed as UNIX timestamps
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Container for RP alignment corrections. The corrections are stored on two levels - RP and sensor...
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &) override
const Timestamp & time() const
const IOVSyncValue & first() const
static const edm::TimeValue_t EndOfTime()
TimeValue_t value() const
std::unique_ptr< RPAlignmentCorrectionsData > produceMisaligned(const RPMisalignedAlignmentRecord &)