CMS 3D CMS Logo

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