67 verbosity(pSet.getUntrackedParameter<unsigned
int>(
"verbosity", 1))
77 findingRecord<RPMeasuredAlignmentRecord>();
78 findingRecord<RPRealAlignmentRecord>();
79 findingRecord<RPMisalignedAlignmentRecord>();
93 map< TimeValue_t, vector< pair<bool, const RPAlignmentCorrectionsData*> > > bounds;
95 for (vector<RPAlignmentCorrectionsDataSequence>::const_iterator
fit = files.begin();
fit != files.end(); ++
fit)
97 for (RPAlignmentCorrectionsDataSequence::const_iterator iit =
fit->begin(); iit !=
fit->end(); ++iit)
102 bounds[tvi.
first].push_back( pair<bool, const RPAlignmentCorrectionsData*>(
true, corr) );
105 bounds[tvi.
last +
delta].push_back( pair<bool, const RPAlignmentCorrectionsData*>(
false, corr) );
110 set<const RPAlignmentCorrectionsData*> accumulator;
113 for (
map<
TimeValue_t, vector< pair<bool, const RPAlignmentCorrectionsData*> > >::const_iterator tit = bounds.begin(); tit != bounds.end(); ++tit)
115 for (vector< pair<bool, const RPAlignmentCorrectionsData*> >::const_iterator cit = tit->second.begin(); cit != tit->second.end(); ++cit)
117 bool add = cit->first;
121 accumulator.insert(corr);
123 accumulator.erase(corr);
126 map< TimeValue_t, vector< pair<bool, const RPAlignmentCorrectionsData*> > >::const_iterator tit_next = tit;
128 if (tit_next == bounds.end())
136 printf(
"\tfirst=%10s, last=%10s: alignment blocks=%li\n",
143 for (set<const RPAlignmentCorrectionsData*>::iterator sit = accumulator.begin(); sit != accumulator.end(); ++sit)
144 result[tvi].AddCorrections(*(*sit));
155 printf(
">> TotemRPIncludeAlignments::PrepareSequence(%s)\n", label.c_str());
157 vector<RPAlignmentCorrectionsDataSequence> sequences;
158 for (
unsigned int i = 0;
i < files.size();
i++)
161 seq =
Merge(sequences);
168 return std::make_unique<RPAlignmentCorrectionsData>(
acMeasured);
175 return std::make_unique<RPAlignmentCorrectionsData>(
acReal);
182 return std::make_unique<RPAlignmentCorrectionsData>(
acMisaligned);
193 <<
">> TotemRPIncludeAlignments::setIntervalFor(" << key.
name() <<
")";
197 strftime(timeStr, 50,
"%F %T", localtime(&unixTime));
200 <<
" run=" << iosv.
eventID().
run() <<
", event=" << iosv.
eventID().
event() <<
", UNIX timestamp=" << unixTime <<
" (" << timeStr <<
")";
207 if (strcmp(key.
name(),
"RPMeasuredAlignmentRecord") == 0)
213 if (strcmp(key.
name(),
"RPRealAlignmentRecord") == 0)
219 if (strcmp(key.
name(),
"RPMisalignedAlignmentRecord") == 0)
226 throw cms::Exception(
"TotemRPIncludeAlignments::setIntervalFor") <<
"Unknown record " << key.
name();
229 bool next_exists =
false;
232 for (RPAlignmentCorrectionsDataSequence::iterator it = seq->begin(); it != seq->end(); ++it)
234 if (it->first.first <= t && it->first.last >= t)
249 if (t <= it->
first.first)
252 next_start =
min(next_start, it->first.first);
TotemRPIncludeAlignments(const edm::ParameterSet &p)
T getParameter(std::string const &) const
EventNumber_t event() const
virtual ~TotemRPIncludeAlignments()
Time sequence of alignment corrections.
RPAlignmentCorrectionsDataSequence Merge(const std::vector< RPAlignmentCorrectionsDataSequence >) const
merges an array of sequences to one
const EventID & eventID() const
Validity interval in timestamps.
std::unique_ptr< RPAlignmentCorrectionsData > produceMisaligned(const RPMisalignedAlignmentRecord &)
RPAlignmentCorrectionsData acMisaligned
static const IOVSyncValue & endOfTime()
A class adding (mis)alignments to geometry (both real and misaligned).
std::pair< Time_t, Time_t > ValidityInterval
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
RPAlignmentCorrectionsDataSequence acsReal
std::unique_ptr< RPAlignmentCorrectionsData > produceReal(const RPRealAlignmentRecord &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
RPAlignmentCorrectionsDataSequence acsMeasured
const IOVSyncValue & last() const
RPAlignmentCorrectionsData acReal
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
RPAlignmentCorrectionsData acMeasured
const char * name() const
static std::string ValueToUNIXString(const edm::TimeValue_t &v)
unsigned int unixTime() const
Time in seconds since January 1, 1970.
RPAlignmentCorrectionsDataSequence acsMisaligned
unsigned long long TimeValue_t
edm::TimeValue_t first
the boundaries (included) of the interval expressed as UNIX timestamps
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
Container for RP alignment corrections. The corrections are stored on two levels - RP and sensor...
std::unique_ptr< RPAlignmentCorrectionsData > produceMeasured(const RPMeasuredAlignmentRecord &)
const Timestamp & time() const
const IOVSyncValue & first() const
static const edm::TimeValue_t EndOfTime()
virtual void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &, edm::ValidityInterval &)
TimeValue_t value() const