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 convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
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 ()
 
void sort ()
 
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::vector< Triplet > Container
 
typedef std::vector< std::pair< FillInfo *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< FillInfoself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef FillInfo value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< FillInfo >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< FillInfo >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 10 of file FillInfoPopConSourceHandler.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file FillInfoPopConSourceHandler.cc.

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

Definition at line 29 of file FillInfoPopConSourceHandler.cc.

29 {}

Member Function Documentation

void FillInfoPopConSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< FillInfo >.

Definition at line 31 of file FillInfoPopConSourceHandler.cc.

References FillInfo::availableBunchSlots, cond::persistency::Session::close(), cond::persistency::Transaction::commit(), cond::persistency::ConnectionPool::configure(), cond::persistency::Session::coralSession(), FillInfo::COSMICS, cond::persistency::ConnectionPool::createSession(), Debug, plotBeamSpotDB::first, cond::time::from_boost(), FillInfo::GAP, FillInfo::IONS, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< FillInfo >::lastPayload(), cond::TagInfo_t::lastPayloadToken, 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, cond::persistency::Session::nominalSchema(), FillInfo::NONE, cond::time::pack(), FillInfo::PB82, FillInfo::PROTON, FillInfo::PROTONS, edm::second(), dataDML::session, cond::persistency::ConnectionPool::setAuthenticationPath(), FillInfo::setBeamInfo(), cond::persistency::ConnectionPool::setMessageVerbosity(), cond::TagInfo_t::size, findQualityFiles::size, cond::persistency::Transaction::start(), AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< FillInfo >::tagInfo(), ntuplemaker::time, cond::time::to_boost(), cond::TagInfo_t::token, cond::persistency::Session::transaction(), FillInfo::UNKNOWN, and cond::time::unpack().

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

Implements popcon::PopConSourceHandler< FillInfo >.

Definition at line 412 of file FillInfoPopConSourceHandler.cc.

References m_name.

412  {
413  return m_name;
414 }

Member Data Documentation

std::string FillInfoPopConSourceHandler::m_authpath
private

Definition at line 22 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

std::string FillInfoPopConSourceHandler::m_connectionString
private

Definition at line 22 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

bool FillInfoPopConSourceHandler::m_debug
private

Definition at line 18 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

std::string FillInfoPopConSourceHandler::m_dipSchema
private

Definition at line 22 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

unsigned short FillInfoPopConSourceHandler::m_firstFill
private

Definition at line 19 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

unsigned short FillInfoPopConSourceHandler::m_lastFill
private

Definition at line 19 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects().

std::string FillInfoPopConSourceHandler::m_name
private

Definition at line 20 of file FillInfoPopConSourceHandler.h.

Referenced by getNewObjects(), and id().