CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
FillInfoPopConSourceHandler Class Reference

#include <FillInfoPopConSourceHandler.h>

Inheritance diagram for FillInfoPopConSourceHandler:
popcon::PopConSourceHandler< FillInfo >

Public Member Functions

 FillInfoPopConSourceHandler (const edm::ParameterSet &pset)
 
void getNewObjects () override
 
std::string id () const override
 
 ~FillInfoPopConSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< FillInfo >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Attributes

std::string m_authpath
 
std::string m_connectionString
 
bool m_debug
 
std::string m_dipSchema
 
unsigned short m_firstFill
 
unsigned short m_lastFill
 
std::string m_name
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< FillInfo >
typedef std::map< Time_t, std::shared_ptr< FillInfo > > Container
 
typedef std::unique_ptr< FillInfoRef
 
typedef PopConSourceHandler< FillInfoself
 
typedef cond::Time_t Time_t
 
typedef FillInfo value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< FillInfo >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< FillInfo >
Container m_iovs
 
std::vector< std::pair< FillInfo *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 10 of file FillInfoPopConSourceHandler.h.

Constructor & Destructor Documentation

◆ FillInfoPopConSourceHandler()

FillInfoPopConSourceHandler::FillInfoPopConSourceHandler ( const edm::ParameterSet pset)

Definition at line 19 of file FillInfoPopConSourceHandler.cc.

20  : m_debug(pset.getUntrackedParameter<bool>("debug", false)),
21  m_firstFill((unsigned short)pset.getUntrackedParameter<unsigned int>("firstFill", 1)),
22  m_lastFill((unsigned short)pset.getUntrackedParameter<unsigned int>("lastFill", m_firstFill)),
23  m_name(pset.getUntrackedParameter<std::string>("name", "FillInfoPopConSourceHandler")),
24  m_connectionString(pset.getUntrackedParameter<std::string>("connectionString", "")),
25  m_dipSchema(pset.getUntrackedParameter<std::string>("DIPSchema", "")),
26  m_authpath(pset.getUntrackedParameter<std::string>("authenticationPath", "")) {}

◆ ~FillInfoPopConSourceHandler()

FillInfoPopConSourceHandler::~FillInfoPopConSourceHandler ( )
override

Definition at line 28 of file FillInfoPopConSourceHandler.cc.

28 {}

Member Function Documentation

◆ getNewObjects()

void FillInfoPopConSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< FillInfo >.

Definition at line 30 of file FillInfoPopConSourceHandler.cc.

References FillInfo::availableBunchSlots, cond::persistency::ConnectionPool::configure(), FillInfo::COSMICS, cond::persistency::ConnectionPool::createSession(), beamSpotPI::creationTime, simBeamSpotHLLHCPI::crossingAngle, Debug, HBHEDarkening_cff::energy, dqmdumpme::first, cond::time::from_boost(), FillInfo::GAP, FillInfo::IONS, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< FillInfo >::lastPayload(), m_authpath, m_connectionString, m_debug, m_dipSchema, m_firstFill, m_lastFill, m_name, popcon::PopConSourceHandler< FillInfo >::m_to_transfer, popcon::PopConSourceHandler< FillInfo >::m_userTextLog, cond::TagInfo_t::name, FillInfo::NONE, cond::time::pack(), cond::Iov_t::payloadId, FillInfo::PB82, FillInfo::PROTON, FillInfo::PROTONS, edm::second(), run_AlCaRecoTriggerBitsUpdateWorkflow::session, cond::persistency::ConnectionPool::setAuthenticationPath(), FillInfo::setBeamInfo(), cond::persistency::ConnectionPool::setMessageVerbosity(), cond::Iov_t::since, cond::TagInfo_t::size, findQualityFiles::size, FCDTask_cfi::slot, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< FillInfo >::tagInfo(), hcalRecHitTable_cff::time, cond::time::to_boost(), FillInfo::UNKNOWN, and cond::time::unpack().

30  {
31  //reference to the last payload in the tag
32  Ref previousFill;
33 
34  //if a new tag is created, transfer fake fill from 1 to the first fill for the first time
35  if (tagInfo().size == 0) {
36  edm::LogInfo(m_name) << "New tag " << tagInfo().name << "; from " << m_name << "::getNewObjects";
37  } else {
38  //check what is already inside the database
39  edm::LogInfo(m_name) << "got info for tag " << tagInfo().name << ": size " << tagInfo().size
40  << ", last object valid since " << tagInfo().lastInterval.since << " ( "
41  << boost::posix_time::to_iso_extended_string(
42  cond::time::to_boost(tagInfo().lastInterval.since))
43  << " ); from " << m_name << "::getNewObjects";
44  //retrieve the last payload...
45  previousFill = this->lastPayload();
46  //checking its content
47  edm::LogInfo(m_name) << "The last payload in tag " << tagInfo().name << " valid since "
48  << tagInfo().lastInterval.since << " has token " << tagInfo().lastInterval.payloadId
49  << " and values:\n"
50  << *previousFill << "from " << m_name << "::getNewObjects";
51  if (m_firstFill <= previousFill->fillNumber()) {
52  //either we are trying to put the same value, or we want to put an older fill:
53  //the first fill will become the previous one plus one
54  std::ostringstream es;
55  es << "Trying to insert fill number " << m_firstFill
56  << ((m_firstFill < previousFill->fillNumber()) ? ", which is an older fill than "
57  : ", which is the same fill as ")
58  << "the last one in the destination tag " << previousFill->fillNumber()
59  << ": the first fill to be looked for will become " << previousFill->fillNumber() + 1;
60  edm::LogWarning(m_name) << es.str() << "; from " << m_name << "::getNewObjects";
61  m_firstFill = previousFill->fillNumber() + 1;
62  }
63  }
64 
65  //if the last fill to be looked for is smaller than the first one send error message and return
66  //this check cannot be done before, as we should find which is the first fill to query
67  if (m_firstFill > m_lastFill) {
68  edm::LogError(m_name) << "WRONG CONFIGURATION! The first fill " << m_firstFill
69  << " cannot be larger than the last one " << m_lastFill << " EXITING. from " << m_name
70  << "::getNewObjects";
71  return;
72  }
73 
74  //retrieve the data from the relational database source
76  //configure the connection
77  if (m_debug) {
79  } else {
81  }
83  connection.configure();
84  //create a sessiom
86  //run the first query against the schema logging fill information
87  coral::ISchema &runTimeLoggerSchema = session.nominalSchema();
88  //start the transaction against the fill logging schema
89  session.transaction().start(true);
90  //prepare the query:
91  std::unique_ptr<coral::IQuery> fillDataQuery(runTimeLoggerSchema.newQuery());
92  //FROM clause
93  fillDataQuery->addToTableList(std::string("RUNTIME_SUMMARY"));
94  //SELECT clause
95  fillDataQuery->addToOutputList(std::string("LHCFILL"));
96  fillDataQuery->addToOutputList(std::string("NBUNCHESBEAM1"));
97  fillDataQuery->addToOutputList(std::string("NBUNCHESBEAM2"));
98  fillDataQuery->addToOutputList(std::string("NCOLLIDINGBUNCHES"));
99  fillDataQuery->addToOutputList(std::string("NTARGETBUNCHES"));
100  fillDataQuery->addToOutputList(std::string("RUNTIME_TYPE_ID"));
101  fillDataQuery->addToOutputList(std::string("PARTY1"));
102  fillDataQuery->addToOutputList(std::string("PARTY2"));
103  fillDataQuery->addToOutputList(std::string("CROSSINGANGLE"));
104  fillDataQuery->addToOutputList(std::string("BETASTAR"));
105  fillDataQuery->addToOutputList(std::string("INTENSITYBEAM1"));
106  fillDataQuery->addToOutputList(std::string("INTENSITYBEAM2"));
107  fillDataQuery->addToOutputList(std::string("ENERGY"));
108  fillDataQuery->addToOutputList(std::string("CREATETIME"));
109  fillDataQuery->addToOutputList(std::string("BEGINTIME"));
110  fillDataQuery->addToOutputList(std::string("ENDTIME"));
111  fillDataQuery->addToOutputList(std::string("INJECTIONSCHEME"));
112  //WHERE clause
113  coral::AttributeList fillDataBindVariables;
114  fillDataBindVariables.extend(std::string("firstFillNumber"), typeid(unsigned short));
115  fillDataBindVariables[std::string("firstFillNumber")].data<unsigned short>() = m_firstFill;
116  fillDataBindVariables.extend(std::string("lastFillNumber"), typeid(unsigned short));
117  fillDataBindVariables[std::string("lastFillNumber")].data<unsigned short>() = m_lastFill;
118  //by imposing BEGINTIME IS NOT NULL, we remove fills which never went into stable beams,
119  //or the most recent one, just declared but not yet in stable beams
120  std::string conditionStr("BEGINTIME IS NOT NULL AND LHCFILL BETWEEN :firstFillNumber AND :lastFillNumber");
121  fillDataQuery->setCondition(conditionStr, fillDataBindVariables);
122  //ORDER BY clause
123  fillDataQuery->addToOrderList(std::string("LHCFILL"));
124  //define query output
125  coral::AttributeList fillDataOutput;
126  fillDataOutput.extend<unsigned short>(std::string("LHCFILL"));
127  fillDataOutput.extend<unsigned short>(std::string("NBUNCHESBEAM1"));
128  fillDataOutput.extend<unsigned short>(std::string("NBUNCHESBEAM2"));
129  fillDataOutput.extend<unsigned short>(std::string("NCOLLIDINGBUNCHES"));
130  fillDataOutput.extend<unsigned short>(std::string("NTARGETBUNCHES"));
131  fillDataOutput.extend<int>(std::string("RUNTIME_TYPE_ID"));
132  fillDataOutput.extend<int>(std::string("PARTY1"));
133  fillDataOutput.extend<int>(std::string("PARTY2"));
134  fillDataOutput.extend<float>(std::string("CROSSINGANGLE"));
135  fillDataOutput.extend<float>(std::string("BETASTAR"));
136  fillDataOutput.extend<float>(std::string("INTENSITYBEAM1"));
137  fillDataOutput.extend<float>(std::string("INTENSITYBEAM2"));
138  fillDataOutput.extend<float>(std::string("ENERGY"));
139  fillDataOutput.extend<coral::TimeStamp>(std::string("CREATETIME"));
140  fillDataOutput.extend<coral::TimeStamp>(std::string("BEGINTIME"));
141  fillDataOutput.extend<coral::TimeStamp>(std::string("ENDTIME"));
142  fillDataOutput.extend<std::string>(std::string("INJECTIONSCHEME"));
143  fillDataQuery->defineOutput(fillDataOutput);
144  //execute the query
145  coral::ICursor &fillDataCursor = fillDataQuery->execute();
146  //initialize loop variables
147  unsigned short previousFillNumber = 1;
148  cond::Time_t previousFillEndTime = 0ULL, afterPreviousFillEndTime = 0ULL, beforeStableBeamStartTime = 0ULL;
149  if (tagInfo().size > 0) {
150  previousFillNumber = previousFill->fillNumber();
151  previousFillEndTime = previousFill->endTime();
152  }
153  unsigned short bunches1 = 0, bunches2 = 0, collidingBunches = 0, targetBunches = 0;
155  FillInfo::ParticleTypeId particleType1 = FillInfo::NONE, particleType2 = FillInfo::NONE;
156  float crossingAngle = 0., betastar = 0., intensityBeam1 = 0., intensityBeam2 = 0., energy = 0.;
157  coral::TimeStamp stableBeamStartTimeStamp, beamDumpTimeStamp;
158  cond::Time_t creationTime = 0ULL, stableBeamStartTime = 0ULL, beamDumpTime = 0ULL;
159  std::string injectionScheme("None");
160  std::ostringstream ss;
161  //loop over the cursor where the result of the query were fetched
162  while (fillDataCursor.next()) {
163  if (m_debug) {
164  std::ostringstream qs;
165  fillDataCursor.currentRow().toOutputStream(qs);
166  edm::LogInfo(m_name) << qs.str() << "\nfrom " << m_name << "::getNewObjects";
167  }
168  unsigned short currentFill = fillDataCursor.currentRow()[std::string("LHCFILL")].data<unsigned short>();
169  coral::Attribute const &bunches1Attribute = fillDataCursor.currentRow()[std::string("NBUNCHESBEAM1")];
170  if (bunches1Attribute.isNull()) {
171  bunches1 = 0;
172  } else {
173  bunches1 = bunches1Attribute.data<unsigned short>();
174  }
175  coral::Attribute const &bunches2Attribute = fillDataCursor.currentRow()[std::string("NBUNCHESBEAM2")];
176  if (bunches2Attribute.isNull()) {
177  bunches2 = 0;
178  } else {
179  bunches2 = bunches2Attribute.data<unsigned short>();
180  }
181  coral::Attribute const &collidingBunchesAttribute = fillDataCursor.currentRow()[std::string("NCOLLIDINGBUNCHES")];
182  if (collidingBunchesAttribute.isNull()) {
183  collidingBunches = 0;
184  } else {
185  collidingBunches = collidingBunchesAttribute.data<unsigned short>();
186  }
187  coral::Attribute const &targetBunchesAttribute = fillDataCursor.currentRow()[std::string("NTARGETBUNCHES")];
188  if (targetBunchesAttribute.isNull()) {
189  targetBunches = 0;
190  } else {
191  targetBunches = targetBunchesAttribute.data<unsigned short>();
192  }
193  //RUNTIME_TYPE_ID IS NOT NULL
194  fillType =
195  static_cast<FillInfo::FillTypeId>(fillDataCursor.currentRow()[std::string("RUNTIME_TYPE_ID")].data<int>());
196  coral::Attribute const &particleType1Attribute = fillDataCursor.currentRow()[std::string("PARTY1")];
197  if (particleType1Attribute.isNull()) {
198  particleType1 = FillInfo::NONE;
199  } else {
200  particleType1 = static_cast<FillInfo::ParticleTypeId>(particleType1Attribute.data<int>());
201  }
202  coral::Attribute const &particleType2Attribute = fillDataCursor.currentRow()[std::string("PARTY2")];
203  if (particleType2Attribute.isNull()) {
204  particleType2 = FillInfo::NONE;
205  } else {
206  particleType2 = static_cast<FillInfo::ParticleTypeId>(particleType2Attribute.data<int>());
207  }
208  coral::Attribute const &crossingAngleAttribute = fillDataCursor.currentRow()[std::string("CROSSINGANGLE")];
209  if (crossingAngleAttribute.isNull()) {
210  crossingAngle = 0.;
211  } else {
212  crossingAngle = crossingAngleAttribute.data<float>();
213  }
214  coral::Attribute const &betastarAttribute = fillDataCursor.currentRow()[std::string("BETASTAR")];
215  if (betastarAttribute.isNull()) {
216  betastar = 0.;
217  } else {
218  betastar = betastarAttribute.data<float>();
219  }
220  coral::Attribute const &intensityBeam1Attribute = fillDataCursor.currentRow()[std::string("INTENSITYBEAM1")];
221  if (intensityBeam1Attribute.isNull()) {
222  intensityBeam1 = 0.;
223  } else {
224  intensityBeam1 = intensityBeam1Attribute.data<float>();
225  }
226  coral::Attribute const &intensityBeam2Attribute = fillDataCursor.currentRow()[std::string("INTENSITYBEAM2")];
227  if (intensityBeam2Attribute.isNull()) {
228  intensityBeam2 = 0.;
229  } else {
230  intensityBeam2 = intensityBeam2Attribute.data<float>();
231  }
232  coral::Attribute const &energyAttribute = fillDataCursor.currentRow()[std::string("ENERGY")];
233  if (energyAttribute.isNull()) {
234  energy = 0.;
235  } else {
236  energy = energyAttribute.data<float>();
237  }
238  //CREATETIME IS NOT NULL
239  creationTime =
240  cond::time::from_boost(fillDataCursor.currentRow()[std::string("CREATETIME")].data<coral::TimeStamp>().time());
241  //BEGINTIME is imposed to be NOT NULL in the WHERE clause
242  stableBeamStartTimeStamp = fillDataCursor.currentRow()[std::string("BEGINTIME")].data<coral::TimeStamp>();
243  stableBeamStartTime = cond::time::from_boost(stableBeamStartTimeStamp.time());
244  coral::Attribute const &beamDumpTimeAttribute = fillDataCursor.currentRow()[std::string("ENDTIME")];
245  if (beamDumpTimeAttribute.isNull()) {
246  beamDumpTime = 0;
247  } else {
248  beamDumpTimeStamp = beamDumpTimeAttribute.data<coral::TimeStamp>();
249  beamDumpTime = cond::time::from_boost(beamDumpTimeStamp.time());
250  }
251  coral::Attribute const &injectionSchemeAttribute = fillDataCursor.currentRow()[std::string("INJECTIONSCHEME")];
252  if (injectionSchemeAttribute.isNull()) {
253  injectionScheme = std::string("None");
254  } else {
255  injectionScheme = injectionSchemeAttribute.data<std::string>();
256  }
257  //fix an inconsistency in RunTimeLogger: if the fill type is defined, the particle type should reflect it!
258  if (fillType != FillInfo::UNKNOWN && (particleType1 == FillInfo::NONE || particleType2 == FillInfo::NONE)) {
259  switch (fillType) {
260  case FillInfo::PROTONS:
261  particleType1 = FillInfo::PROTON;
262  particleType2 = FillInfo::PROTON;
263  break;
264  case FillInfo::IONS:
265  particleType1 = FillInfo::PB82;
266  particleType2 = FillInfo::PB82;
267  break;
268  case FillInfo::UNKNOWN:
269  case FillInfo::COSMICS:
270  case FillInfo::GAP:
271  break;
272  }
273  }
274  //if the end time of the fill is 0 (i.e. timestamp null), it is still ongoing: do not store!
275  if (beamDumpTime == 0) {
276  edm::LogWarning(m_name) << "NO TRANSFER NEEDED: the fill number " << currentFill << " is still ongoing"
277  << "; from " << m_name << "::getNewObjects";
278  continue;
279  }
280  //run the second and third query against the schema hosting detailed DIP information
281  coral::ISchema &beamCondSchema = session.coralSession().schema(m_dipSchema);
282  //start the transaction against the DIP "deep" database backend schema
283  session.transaction().start(true);
284  //prepare the WHERE clause for both queries
285  coral::AttributeList bunchConfBindVariables;
286  bunchConfBindVariables.extend<coral::TimeStamp>(std::string("stableBeamStartTimeStamp"));
287  bunchConfBindVariables[std::string("stableBeamStartTimeStamp")].data<coral::TimeStamp>() = stableBeamStartTimeStamp;
288  conditionStr = std::string("DIPTIME <= :stableBeamStartTimeStamp");
289  //define the output types for both queries
290  coral::AttributeList bunchConfOutput;
291  bunchConfOutput.extend<coral::TimeStamp>(std::string("DIPTIME"));
292  bunchConfOutput.extend<unsigned short>(std::string("BUCKET"));
293  //execute query for Beam 1
294  std::unique_ptr<coral::IQuery> bunchConf1Query(beamCondSchema.newQuery());
295  bunchConf1Query->addToTableList(std::string("LHC_CIRCBUNCHCONFIG_BEAM1"),
296  std::string("BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS"));
297  bunchConf1Query->addToOutputList(std::string("BEAMCONF.DIPTIME"), std::string("DIPTIME"));
298  bunchConf1Query->addToOutputList(std::string("BUCKETS.COLUMN_VALUE"), std::string("BUCKET"));
299  bunchConf1Query->setCondition(conditionStr, bunchConfBindVariables);
300  bunchConf1Query->addToOrderList(std::string("DIPTIME DESC"));
301  bunchConf1Query->limitReturnedRows(FillInfo::availableBunchSlots); //maximum number of filled bunches
302  bunchConf1Query->defineOutput(bunchConfOutput);
303  coral::ICursor &bunchConf1Cursor = bunchConf1Query->execute();
304  std::bitset<FillInfo::bunchSlots + 1> bunchConfiguration1(0ULL);
305  while (bunchConf1Cursor.next()) {
306  if (m_debug) {
307  std::ostringstream b1s;
308  fillDataCursor.currentRow().toOutputStream(b1s);
309  edm::LogInfo(m_name) << b1s.str() << "\nfrom " << m_name << "::getNewObjects";
310  }
311  //bunchConf1Cursor.currentRow().toOutputStream( std::cout ) << std::endl;
312  if (bunchConf1Cursor.currentRow()[std::string("BUCKET")].data<unsigned short>() != 0) {
313  unsigned short slot =
314  (bunchConf1Cursor.currentRow()[std::string("BUCKET")].data<unsigned short>() - 1) / 10 + 1;
315  bunchConfiguration1[slot] = true;
316  }
317  }
318  //execute query for Beam 2
319  std::unique_ptr<coral::IQuery> bunchConf2Query(beamCondSchema.newQuery());
320  bunchConf2Query->addToTableList(std::string("LHC_CIRCBUNCHCONFIG_BEAM2"),
321  std::string("BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS"));
322  bunchConf2Query->addToOutputList(std::string("BEAMCONF.DIPTIME"), std::string("DIPTIME"));
323  bunchConf2Query->addToOutputList(std::string("BUCKETS.COLUMN_VALUE"), std::string("BUCKET"));
324  bunchConf2Query->setCondition(conditionStr, bunchConfBindVariables);
325  bunchConf2Query->addToOrderList(std::string("DIPTIME DESC"));
326  bunchConf2Query->limitReturnedRows(FillInfo::availableBunchSlots); //maximum number of filled bunches
327  bunchConf2Query->defineOutput(bunchConfOutput);
328  coral::ICursor &bunchConf2Cursor = bunchConf2Query->execute();
329  std::bitset<FillInfo::bunchSlots + 1> bunchConfiguration2(0ULL);
330  while (bunchConf2Cursor.next()) {
331  if (m_debug) {
332  std::ostringstream b2s;
333  fillDataCursor.currentRow().toOutputStream(b2s);
334  edm::LogInfo(m_name) << b2s.str() << "\nfrom " << m_name << "::getNewObjects";
335  }
336  if (bunchConf2Cursor.currentRow()[std::string("BUCKET")].data<unsigned short>() != 0) {
337  unsigned short slot =
338  (bunchConf2Cursor.currentRow()[std::string("BUCKET")].data<unsigned short>() - 1) / 10 + 1;
339  bunchConfiguration2[slot] = true;
340  }
341  }
342  //commit the transaction against the DIP "deep" database backend schema
343  session.transaction().commit();
344 
345  //store dummy fill information if empty fills are found beetween the two last ones in stable beams
346  afterPreviousFillEndTime = cond::time::pack(std::make_pair(cond::time::unpack(previousFillEndTime).first,
347  cond::time::unpack(previousFillEndTime).second + 1));
348  beforeStableBeamStartTime = cond::time::pack(std::make_pair(cond::time::unpack(stableBeamStartTime).first,
349  cond::time::unpack(stableBeamStartTime).second - 1));
350  if (afterPreviousFillEndTime < stableBeamStartTime) {
351  edm::LogInfo(m_name) << "Entering fake fill between fill number " << previousFillNumber
352  << " and current fill number " << currentFill << ", from " << afterPreviousFillEndTime
353  << " ( "
354  << boost::posix_time::to_iso_extended_string(cond::time::to_boost(afterPreviousFillEndTime))
355  << " ) to " << beforeStableBeamStartTime << " ( "
356  << boost::posix_time::to_iso_extended_string(cond::time::to_boost(beforeStableBeamStartTime))
357  << " ); from " << m_name << "::getNewObjects";
358  m_to_transfer.push_back(std::make_pair(new FillInfo(), afterPreviousFillEndTime));
359  } else {
360  //the current fill cannot start before the previous one!
361  edm::LogError(m_name) << "WRONG DATA! In the previous fill number " << previousFillNumber
362  << " beams were dumped at timestamp "
363  << boost::posix_time::to_iso_extended_string(cond::time::to_boost(previousFillEndTime))
364  << ", which is not before the timestamp "
365  << boost::posix_time::to_iso_extended_string(cond::time::to_boost(stableBeamStartTime))
366  << " when current fill number " << currentFill << " entered stable beams. EXITING. from "
367  << m_name << "::getNewObjects";
368  return;
369  }
370  //construct an instance of FillInfo and set its values
371  FillInfo *fillInfo = new FillInfo(currentFill);
372  fillInfo->setBeamInfo(const_cast<unsigned short const &>(bunches1),
373  const_cast<unsigned short const &>(bunches2),
374  const_cast<unsigned short const &>(collidingBunches),
375  const_cast<unsigned short const &>(targetBunches),
376  const_cast<FillInfo::FillTypeId const &>(fillType),
377  const_cast<FillInfo::ParticleTypeId const &>(particleType1),
378  const_cast<FillInfo::ParticleTypeId const &>(particleType2),
379  const_cast<float const &>(crossingAngle),
380  const_cast<float const &>(betastar),
381  const_cast<float const &>(intensityBeam1),
382  const_cast<float const &>(intensityBeam2),
383  const_cast<float const &>(energy),
384  const_cast<cond::Time_t const &>(creationTime),
385  const_cast<cond::Time_t const &>(stableBeamStartTime),
386  const_cast<cond::Time_t const &>(beamDumpTime),
387  const_cast<std::string const &>(injectionScheme),
388  const_cast<std::bitset<FillInfo::bunchSlots + 1> const &>(bunchConfiguration1),
389  const_cast<std::bitset<FillInfo::bunchSlots + 1> const &>(bunchConfiguration2));
390  //store this payload
391  m_to_transfer.push_back(std::make_pair((FillInfo *)fillInfo, stableBeamStartTime));
392  edm::LogInfo(m_name) << "The new payload to be inserted into tag " << tagInfo().name << " with validity "
393  << stableBeamStartTime << " ( "
394  << boost::posix_time::to_iso_extended_string(cond::time::to_boost(stableBeamStartTime))
395  << " ) has values:\n"
396  << *fillInfo << "from " << m_name << "::getNewObjects";
397  //add log information
398  ss << " fill = " << currentFill << ";\tinjection scheme: " << injectionScheme
399  << ";\tstart time: " << boost::posix_time::to_iso_extended_string(stableBeamStartTimeStamp.time())
400  << ";\tend time: " << boost::posix_time::to_iso_extended_string(beamDumpTimeStamp.time()) << "." << std::endl;
401  //prepare variables for next iteration
402  previousFillNumber = currentFill;
403  previousFillEndTime = beamDumpTime;
404  }
405  //commit the transaction against the fill logging schema
406  session.transaction().commit();
407  //close the session
408  session.close();
409  //store log information
410  m_userTextLog = ss.str();
411  edm::LogInfo(m_name) << "Transferring " << m_to_transfer.size() << " payload(s); from " << m_name
412  << "::getNewObjects";
413 }
size
Write out results.
edm::ErrorSummaryEntry Error
ParticleType
Definition: FillInfo.h:16
void setBeamInfo(unsigned short const &bunches1, unsigned short const &bunches2, unsigned short const &collidingBunches, unsigned short const &targetBunches, FillTypeId const &fillType, ParticleTypeId const &particleType1, ParticleTypeId const &particleType2, float const &angle, float const &beta, float const &intensity1, float const &intensity2, float const &energy, cond::Time_t const &createTime, cond::Time_t const &beginTime, cond::Time_t const &endTime, std::string const &scheme, std::bitset< bunchSlots+1 > const &bunchConf1, std::bitset< bunchSlots+1 > const &bunchConf2)
Definition: FillInfo.cc:238
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
size_t size
Definition: Types.h:74
cond::Time_t pack(cond::UnpackedTime iValue)
Log< level::Error, false > LogError
static size_t const availableBunchSlots
Definition: FillInfo.h:27
std::string name
Definition: Types.h:72
cond::TagInfo_t const & tagInfo() const
U second(std::pair< T, U > const &p)
unsigned long long Time_t
Definition: Time.h:14
std::vector< std::pair< FillInfo *, Time_t > > m_to_transfer
Hash payloadId
Definition: Types.h:55
Session createSession(const std::string &connectionString, bool writeCapable=false)
void setMessageVerbosity(coral::MsgLevel level)
Time_t from_boost(boost::posix_time::ptime bt)
Log< level::Info, false > LogInfo
Log< level::Warning, false > LogWarning
void setAuthenticationPath(const std::string &p)
const bool Debug
boost::posix_time::ptime to_boost(Time_t iValue)
cond::UnpackedTime unpack(cond::Time_t iValue)

◆ id()

std::string FillInfoPopConSourceHandler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< FillInfo >.

Definition at line 415 of file FillInfoPopConSourceHandler.cc.

References m_name.

415 { return m_name; }

Member Data Documentation

◆ m_authpath

std::string FillInfoPopConSourceHandler::m_authpath
private

Definition at line 22 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_connectionString

std::string FillInfoPopConSourceHandler::m_connectionString
private

Definition at line 22 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_debug

bool FillInfoPopConSourceHandler::m_debug
private

Definition at line 18 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_dipSchema

std::string FillInfoPopConSourceHandler::m_dipSchema
private

Definition at line 22 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_firstFill

unsigned short FillInfoPopConSourceHandler::m_firstFill
private

Definition at line 19 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_lastFill

unsigned short FillInfoPopConSourceHandler::m_lastFill
private

Definition at line 19 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

◆ m_name

std::string FillInfoPopConSourceHandler::m_name
private

Definition at line 20 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects(), and id().