CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/CondTools/RunInfo/src/FillInfoPopConSourceHandler.cc

Go to the documentation of this file.
00001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00002 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00003 #include "CondFormats/Common/interface/TimeConversions.h"
00004 #include "CondTools/RunInfo/interface/FillInfoPopConSourceHandler.h"
00005 #include "CondCore/DBCommon/interface/DbConnection.h"
00006 #include "CondCore/DBCommon/interface/DbConnectionConfiguration.h"
00007 #include "CondCore/DBCommon/interface/DbTransaction.h"
00008 #include "RelationalAccess/ISchema.h"
00009 #include "RelationalAccess/IQuery.h"
00010 #include "RelationalAccess/ICursor.h"
00011 #include "CoralBase/AttributeList.h"
00012 #include "CoralBase/Attribute.h"
00013 #include "CoralBase/AttributeSpecification.h"
00014 #include "CoralBase/TimeStamp.h"
00015 #include <iostream>
00016 #include <memory>
00017 #include <sstream>
00018 #include <utility>
00019 #include <vector>
00020 
00021 FillInfoPopConSourceHandler::FillInfoPopConSourceHandler( edm::ParameterSet const & pset ):
00022   m_debug( pset.getUntrackedParameter<bool>( "debug", false ) )
00023   ,m_firstFill( (unsigned short)pset.getUntrackedParameter<unsigned int>( "firstFill", 1 ) )
00024   ,m_lastFill( (unsigned short)pset.getUntrackedParameter<unsigned int>( "lastFill", m_firstFill ) )
00025   ,m_name( pset.getUntrackedParameter<std::string>( "name", "FillInfoPopConSourceHandler" ) )
00026   ,m_connectionString(pset.getUntrackedParameter<std::string>("connectionString",""))
00027   ,m_dipSchema(pset.getUntrackedParameter<std::string>("DIPSchema",""))
00028   ,m_authpath(pset.getUntrackedParameter<std::string>("authenticationPath","")) {}
00029 
00030 FillInfoPopConSourceHandler::~FillInfoPopConSourceHandler() {}
00031 
00032 void FillInfoPopConSourceHandler::getNewObjects() {  
00033   //reference to the last payload in the tag
00034   Ref previousFill;
00035   
00036   //if a new tag is created, transfer fake fill from 1 to the first fill for the first time
00037   if ( tagInfo().size == 0 ) {
00038     edm::LogInfo( m_name ) << "New tag "<< tagInfo().name << "; from " << m_name << "::getNewObjects";
00039   } else {
00040     //check what is already inside the database
00041     edm::LogInfo( m_name ) << "got info for tag " << tagInfo().name 
00042                            << ", IOVSequence token " << tagInfo().token
00043                            << ": size " << tagInfo().size 
00044                            << ", last object valid since " << tagInfo().lastInterval.first 
00045                            << " ( "<< boost::posix_time::to_iso_extended_string( cond::time::to_boost( tagInfo().lastInterval.first ) )
00046                            << " ); from " << m_name << "::getNewObjects";
00047     //retrieve the last payload...
00048     previousFill = this->lastPayload();
00049     //checking its content
00050     edm::LogInfo( m_name ) << "The last payload in tag " << tagInfo().name 
00051                            << " valid since " << tagInfo().lastInterval.first
00052                            << " has token " << tagInfo().lastPayloadToken 
00053                            << " and values:\n" << *previousFill
00054                            << "from " << m_name << "::getNewObjects";
00055     if( m_firstFill <= previousFill->fillNumber() ) {
00056       //either we are trying to put the same value, or we want to put an older fill:
00057       //the first fill will become the previous one plus one 
00058       std::ostringstream es;
00059       es << "Trying to insert fill number " << m_firstFill 
00060          << ( ( m_firstFill < previousFill->fillNumber() ) ? ", which is an older fill than " : ", which is the same fill as " ) 
00061          << "the last one in the destination tag " << previousFill->fillNumber()
00062          << ": the first fill to be looked for will become " << previousFill->fillNumber() + 1;
00063       edm::LogWarning( m_name ) << es.str() << "; from " << m_name << "::getNewObjects";
00064       m_firstFill = previousFill->fillNumber() + 1;
00065     }
00066   }
00067   
00068   //if the last fill to be looked for is smaller than the first one send error message and return
00069   //this check cannot be done before, as we should find which is the first fill to query
00070   if( m_firstFill > m_lastFill ) {
00071     edm::LogError( m_name ) << "WRONG CONFIGURATION! The first fill " << m_firstFill
00072                             << " cannot be larger than the last one " << m_lastFill
00073                             << " EXITING. from " << m_name << "::getNewObjects";
00074     return;
00075   }
00076   
00077   //retrieve the data from the relational database source
00078   cond::DbConnection dbConnection;
00079   //configure the connection
00080   if( m_debug ) {
00081     dbConnection.configuration().setMessageLevel( coral::Debug );
00082   } else {
00083     dbConnection.configuration().setMessageLevel( coral::Error );
00084   }
00085   dbConnection.configuration().setPoolAutomaticCleanUp( false );
00086   dbConnection.configuration().setConnectionTimeOut( 0 );
00087   dbConnection.configuration().setAuthenticationPath( m_authpath );
00088   dbConnection.configure();
00089   //create a sessiom
00090   cond::DbSession session = dbConnection.createSession();
00091   session.open( m_connectionString, true );
00092   //run the first query against the schema logging fill information
00093   coral::ISchema& runTimeLoggerSchema = session.nominalSchema();
00094   //start the transaction against the fill logging schema
00095   session.transaction().start(true);
00096   //prepare the query:
00097   std::unique_ptr<coral::IQuery> fillDataQuery( runTimeLoggerSchema.newQuery() );
00098   //FROM clause
00099   fillDataQuery->addToTableList( std::string( "RUNTIME_SUMMARY" ) );
00100   //SELECT clause
00101   fillDataQuery->addToOutputList( std::string( "LHCFILL" ) );
00102   fillDataQuery->addToOutputList( std::string( "NBUNCHESBEAM1" ) );
00103   fillDataQuery->addToOutputList( std::string( "NBUNCHESBEAM2" ) );
00104   fillDataQuery->addToOutputList( std::string( "NCOLLIDINGBUNCHES" ) );
00105   fillDataQuery->addToOutputList( std::string( "NTARGETBUNCHES" ) );
00106   fillDataQuery->addToOutputList( std::string( "RUNTIME_TYPE_ID" ) );
00107   fillDataQuery->addToOutputList( std::string( "PARTY1" ) );
00108   fillDataQuery->addToOutputList( std::string( "PARTY2" ) );
00109   fillDataQuery->addToOutputList( std::string( "CROSSINGANGLE" ) );
00110   fillDataQuery->addToOutputList( std::string( "BETASTAR" ) );
00111   fillDataQuery->addToOutputList( std::string( "INTENSITYBEAM1" ) );
00112   fillDataQuery->addToOutputList( std::string( "INTENSITYBEAM2" ) );
00113   fillDataQuery->addToOutputList( std::string( "ENERGY" ) );
00114   fillDataQuery->addToOutputList( std::string( "CREATETIME" ) );
00115   fillDataQuery->addToOutputList( std::string( "BEGINTIME" ) );
00116   fillDataQuery->addToOutputList( std::string( "ENDTIME" ) );
00117   fillDataQuery->addToOutputList( std::string( "INJECTIONSCHEME" ) );
00118   //WHERE clause
00119   coral::AttributeList fillDataBindVariables;
00120   fillDataBindVariables.extend( std::string( "firstFillNumber" ), typeid( unsigned short ) );
00121   fillDataBindVariables[ std::string( "firstFillNumber" ) ].data<unsigned short>() = m_firstFill;
00122   fillDataBindVariables.extend( std::string( "lastFillNumber" ), typeid( unsigned short ) );
00123   fillDataBindVariables[ std::string( "lastFillNumber" ) ].data<unsigned short>() = m_lastFill;
00124   //by imposing BEGINTIME IS NOT NULL, we remove fills which never went into stable beams,
00125   //or the most recent one, just declared but not yet in stable beams
00126   std::string conditionStr( "BEGINTIME IS NOT NULL AND LHCFILL BETWEEN :firstFillNumber AND :lastFillNumber" );
00127   fillDataQuery->setCondition( conditionStr, fillDataBindVariables );
00128   //ORDER BY clause
00129   fillDataQuery->addToOrderList( std::string( "LHCFILL" ) );
00130   //define query output
00131   coral::AttributeList fillDataOutput;
00132   fillDataOutput.extend<unsigned short>( std::string( "LHCFILL" ) );
00133   fillDataOutput.extend<unsigned short>( std::string( "NBUNCHESBEAM1" ) );
00134   fillDataOutput.extend<unsigned short>( std::string( "NBUNCHESBEAM2" ) );
00135   fillDataOutput.extend<unsigned short>( std::string( "NCOLLIDINGBUNCHES" ) );
00136   fillDataOutput.extend<unsigned short>( std::string( "NTARGETBUNCHES" ) );
00137   fillDataOutput.extend<int>( std::string( "RUNTIME_TYPE_ID" ) );
00138   fillDataOutput.extend<int>( std::string( "PARTY1" ) );
00139   fillDataOutput.extend<int>( std::string( "PARTY2" ) );
00140   fillDataOutput.extend<float>( std::string( "CROSSINGANGLE" ) );
00141   fillDataOutput.extend<float>( std::string( "BETASTAR" ) );
00142   fillDataOutput.extend<float>( std::string( "INTENSITYBEAM1" ) );
00143   fillDataOutput.extend<float>( std::string( "INTENSITYBEAM2" ) );
00144   fillDataOutput.extend<float>( std::string( "ENERGY" ) );
00145   fillDataOutput.extend<coral::TimeStamp>( std::string( "CREATETIME" ) );
00146   fillDataOutput.extend<coral::TimeStamp>( std::string( "BEGINTIME" ) );
00147   fillDataOutput.extend<coral::TimeStamp>( std::string( "ENDTIME" ) );
00148   fillDataOutput.extend<std::string>( std::string( "INJECTIONSCHEME" ) );
00149   fillDataQuery->defineOutput( fillDataOutput );
00150   //execute the query
00151   coral::ICursor& fillDataCursor = fillDataQuery->execute();
00152   //initialize loop variables
00153   unsigned short previousFillNumber = 1, currentFill = m_firstFill;
00154   cond::Time_t previousFillEndTime = 0ULL, afterPreviousFillEndTime = 0ULL, beforeStableBeamStartTime = 0ULL;
00155   if( tagInfo().size > 0 ) {
00156     previousFillNumber = previousFill->fillNumber();
00157     previousFillEndTime = previousFill->endTime();
00158   }
00159   unsigned short bunches1 = 0, bunches2 = 0, collidingBunches = 0, targetBunches = 0;
00160   FillInfo::FillTypeId fillType = FillInfo::UNKNOWN;
00161   FillInfo::ParticleTypeId particleType1 = FillInfo::NONE, particleType2 = FillInfo::NONE;
00162   float crossingAngle = 0., betastar = 0., intensityBeam1 = 0., intensityBeam2 = 0., energy = 0.;
00163   coral::TimeStamp stableBeamStartTimeStamp, beamDumpTimeStamp;
00164   cond::Time_t creationTime = 0ULL, stableBeamStartTime = 0ULL, beamDumpTime = 0ULL;
00165   std::string injectionScheme( "None" );
00166   std::ostringstream ss;
00167   //loop over the cursor where the result of the query were fetched
00168   while( fillDataCursor.next() ) {
00169     if( m_debug ) {
00170       std::ostringstream qs;
00171       fillDataCursor.currentRow().toOutputStream( qs );
00172       edm::LogInfo( m_name ) << qs.str() << "\nfrom " << m_name << "::getNewObjects";
00173     }
00174     currentFill = fillDataCursor.currentRow()[ std::string( "LHCFILL" ) ].data<unsigned short>();
00175     coral::Attribute const & bunches1Attribute = fillDataCursor.currentRow()[ std::string( "NBUNCHESBEAM1" ) ];
00176     if( bunches1Attribute.isNull() ) {
00177       bunches1 = 0;
00178     } else {
00179       bunches1 = bunches1Attribute.data<unsigned short>();
00180     }
00181     coral::Attribute const & bunches2Attribute = fillDataCursor.currentRow()[ std::string( "NBUNCHESBEAM2" ) ];
00182     if( bunches2Attribute.isNull() ) {
00183       bunches2 = 0;
00184     } else {
00185       bunches2 = bunches2Attribute.data<unsigned short>();
00186     }
00187     coral::Attribute const & collidingBunchesAttribute = fillDataCursor.currentRow()[ std::string( "NCOLLIDINGBUNCHES" ) ];
00188     if( collidingBunchesAttribute.isNull() ) {
00189       collidingBunches = 0;
00190     } else {
00191       collidingBunches = collidingBunchesAttribute.data<unsigned short>();
00192     }
00193     coral::Attribute const & targetBunchesAttribute = fillDataCursor.currentRow()[ std::string( "NTARGETBUNCHES" ) ];
00194     if( targetBunchesAttribute.isNull() ) {
00195       targetBunches = 0;
00196     } else {
00197       targetBunches = targetBunchesAttribute.data<unsigned short>();
00198     }
00199     //RUNTIME_TYPE_ID IS NOT NULL
00200     fillType = static_cast<FillInfo::FillTypeId>( fillDataCursor.currentRow()[ std::string( "RUNTIME_TYPE_ID" ) ].data<int>() );
00201     coral::Attribute const & particleType1Attribute = fillDataCursor.currentRow()[ std::string( "PARTY1" ) ];
00202     if( particleType1Attribute.isNull() ) {
00203       particleType1 = FillInfo::NONE;
00204     } else {
00205       particleType1 = static_cast<FillInfo::ParticleTypeId>( particleType1Attribute.data<int>() );
00206     }
00207     coral::Attribute const & particleType2Attribute = fillDataCursor.currentRow()[ std::string( "PARTY2" ) ];
00208     if( particleType2Attribute.isNull() ) {
00209       particleType2 = FillInfo::NONE;
00210     } else {
00211       particleType2 = static_cast<FillInfo::ParticleTypeId>( particleType2Attribute.data<int>() );
00212     }
00213     coral::Attribute const & crossingAngleAttribute = fillDataCursor.currentRow()[ std::string( "CROSSINGANGLE" ) ];
00214     if( crossingAngleAttribute.isNull() ) {
00215       crossingAngle = 0.;
00216     } else {
00217       crossingAngle = crossingAngleAttribute.data<float>();
00218     }
00219     coral::Attribute const & betastarAttribute = fillDataCursor.currentRow()[ std::string( "BETASTAR" ) ];
00220     if( betastarAttribute.isNull() ) {
00221       betastar = 0.;
00222     } else {
00223       betastar = betastarAttribute.data<float>();
00224     }
00225     coral::Attribute const & intensityBeam1Attribute = fillDataCursor.currentRow()[ std::string( "INTENSITYBEAM1" ) ];
00226     if( intensityBeam1Attribute.isNull() ) {
00227       intensityBeam1 = 0.;
00228     } else {
00229       intensityBeam1 = intensityBeam1Attribute.data<float>();
00230     }
00231     coral::Attribute const & intensityBeam2Attribute = fillDataCursor.currentRow()[ std::string( "INTENSITYBEAM2" ) ];
00232     if( intensityBeam2Attribute.isNull() ) {
00233       intensityBeam2 = 0.;
00234     } else {
00235       intensityBeam2 = intensityBeam2Attribute.data<float>();
00236     }
00237     coral::Attribute const & energyAttribute = fillDataCursor.currentRow()[ std::string( "ENERGY" ) ];
00238     if( energyAttribute.isNull() ){
00239       energy = 0.;
00240     } else {
00241       energy = energyAttribute.data<float>();
00242     }
00243     //CREATETIME IS NOT NULL
00244     creationTime = cond::time::from_boost( fillDataCursor.currentRow()[ std::string( "CREATETIME" ) ].data<coral::TimeStamp>().time() );
00245     //BEGINTIME is imposed to be NOT NULL in the WHERE clause
00246     stableBeamStartTimeStamp = fillDataCursor.currentRow()[ std::string( "BEGINTIME" ) ].data<coral::TimeStamp>();
00247     stableBeamStartTime = cond::time::from_boost( stableBeamStartTimeStamp.time() );
00248     coral::Attribute const & beamDumpTimeAttribute = fillDataCursor.currentRow()[ std::string( "ENDTIME" ) ];
00249     if( beamDumpTimeAttribute.isNull() ) {
00250       beamDumpTime = 0;
00251     } else {
00252       beamDumpTimeStamp = beamDumpTimeAttribute.data<coral::TimeStamp>();
00253       beamDumpTime = cond::time::from_boost( beamDumpTimeStamp.time() );
00254     }
00255     coral::Attribute const & injectionSchemeAttribute = fillDataCursor.currentRow()[ std::string( "INJECTIONSCHEME" ) ];
00256     if( injectionSchemeAttribute.isNull() ) {
00257       injectionScheme = std::string( "None" );
00258     } else {
00259       injectionScheme = injectionSchemeAttribute.data<std::string>();
00260     }
00261     //fix an inconsistency in RunTimeLogger: if the fill type is defined, the particle type should reflect it!
00262     if( fillType != FillInfo::UNKNOWN && ( particleType1 == FillInfo::NONE || particleType2 == FillInfo::NONE ) ) {
00263       switch( fillType ) {
00264       case FillInfo::PROTONS :
00265         particleType1 = FillInfo::PROTON;
00266         particleType2 = FillInfo::PROTON;
00267         break;
00268       case FillInfo::IONS :
00269         particleType1 = FillInfo::PB82;
00270         particleType2 = FillInfo::PB82;
00271         break;
00272       case FillInfo::UNKNOWN :
00273       case FillInfo::COSMICS :
00274       case FillInfo::GAP :
00275         break;
00276       }
00277     }
00278     //if the end time of the fill is 0 (i.e. timestamp null), it is still ongoing: do not store!
00279     if( beamDumpTime == 0 ) {
00280       edm::LogWarning( m_name ) << "NO TRANSFER NEEDED: the fill number " << currentFill
00281                                 << " is still ongoing"
00282                                 << "; from " << m_name << "::getNewObjects";
00283       continue;
00284     }
00285     //run the second and third query against the schema hosting detailed DIP information
00286     coral::ISchema& beamCondSchema = session.schema( m_dipSchema );
00287     //start the transaction against the DIP "deep" database backend schema
00288     session.transaction().start( true );
00289     //prepare the WHERE clause for both queries
00290     coral::AttributeList bunchConfBindVariables;
00291     bunchConfBindVariables.extend<coral::TimeStamp>( std::string( "stableBeamStartTimeStamp" ) );
00292     bunchConfBindVariables[ std::string( "stableBeamStartTimeStamp" ) ].data<coral::TimeStamp>() = stableBeamStartTimeStamp;
00293     conditionStr = std::string( "DIPTIME <= :stableBeamStartTimeStamp" );
00294     //define the output types for both queries
00295     coral::AttributeList bunchConfOutput;
00296     bunchConfOutput.extend<coral::TimeStamp>( std::string( "DIPTIME" ) );
00297     bunchConfOutput.extend<unsigned short>( std::string( "BUCKET" ) );
00298     //execute query for Beam 1
00299     std::unique_ptr<coral::IQuery> bunchConf1Query(beamCondSchema.newQuery());
00300     bunchConf1Query->addToTableList( std::string( "LHC_CIRCBUNCHCONFIG_BEAM1" ), std::string( "BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS" ) );
00301     bunchConf1Query->addToOutputList( std::string( "BEAMCONF.DIPTIME" ), std::string( "DIPTIME" ) );
00302     bunchConf1Query->addToOutputList( std::string( "BUCKETS.COLUMN_VALUE" ), std::string( "BUCKET" ) );
00303     bunchConf1Query->setCondition( conditionStr, bunchConfBindVariables );
00304     bunchConf1Query->addToOrderList( std::string( "DIPTIME DESC" ) );
00305     bunchConf1Query->limitReturnedRows( FillInfo::availableBunchSlots ); //maximum number of filled bunches
00306     bunchConf1Query->defineOutput( bunchConfOutput );
00307     coral::ICursor& bunchConf1Cursor = bunchConf1Query->execute();
00308     std::bitset<FillInfo::bunchSlots+1> bunchConfiguration1( 0ULL );
00309     while( bunchConf1Cursor.next() ) {
00310       if( m_debug ) {
00311         std::ostringstream b1s;
00312         fillDataCursor.currentRow().toOutputStream( b1s );
00313         edm::LogInfo( m_name ) << b1s.str() << "\nfrom " << m_name << "::getNewObjects";
00314       }
00315       //bunchConf1Cursor.currentRow().toOutputStream( std::cout ) << std::endl;
00316       if( bunchConf1Cursor.currentRow()[ std::string( "BUCKET" ) ].data<unsigned short>() != 0 ) {
00317         unsigned short slot = ( bunchConf1Cursor.currentRow()[ std::string( "BUCKET" ) ].data<unsigned short>() - 1 ) / 10 + 1;
00318         bunchConfiguration1[ slot ] = true;
00319       }
00320     }
00321     //execute query for Beam 2
00322     std::unique_ptr<coral::IQuery> bunchConf2Query(beamCondSchema.newQuery());
00323     bunchConf2Query->addToTableList( std::string( "LHC_CIRCBUNCHCONFIG_BEAM2" ), std::string( "BEAMCONF\", TABLE( BEAMCONF.VALUE ) \"BUCKETS" ) );
00324     bunchConf2Query->addToOutputList( std::string( "BEAMCONF.DIPTIME" ), std::string( "DIPTIME" ) );
00325     bunchConf2Query->addToOutputList( std::string( "BUCKETS.COLUMN_VALUE" ), std::string( "BUCKET" ) );
00326     bunchConf2Query->setCondition( conditionStr, bunchConfBindVariables );
00327     bunchConf2Query->addToOrderList( std::string( "DIPTIME DESC" ) );
00328     bunchConf2Query->limitReturnedRows( FillInfo::availableBunchSlots ); //maximum number of filled bunches
00329     bunchConf2Query->defineOutput( bunchConfOutput );
00330     coral::ICursor& bunchConf2Cursor = bunchConf2Query->execute();
00331     std::bitset<FillInfo::bunchSlots+1> bunchConfiguration2( 0ULL );
00332     while( bunchConf2Cursor.next() ) {
00333       if( m_debug ) {
00334         std::ostringstream b2s;
00335         fillDataCursor.currentRow().toOutputStream( b2s );
00336         edm::LogInfo( m_name ) << b2s.str() << "\nfrom " << m_name << "::getNewObjects";
00337       }
00338       if( bunchConf2Cursor.currentRow()[ std::string( "BUCKET" ) ].data<unsigned short>() != 0 ) {
00339         unsigned short slot = ( bunchConf2Cursor.currentRow()[ std::string( "BUCKET" ) ].data<unsigned short>() - 1 ) / 10 + 1;
00340         bunchConfiguration2[ slot ] = true;
00341       }
00342     }
00343     //commit the transaction against the DIP "deep" database backend schema
00344     session.transaction().commit();
00345     
00346     //store dummy fill information if empty fills are found beetween the two last ones in stable beams
00347     afterPreviousFillEndTime  = cond::time::pack( std::make_pair( cond::time::unpack( previousFillEndTime ).first, cond::time::unpack( previousFillEndTime ).second + 1 ) );
00348     beforeStableBeamStartTime = cond::time::pack( std::make_pair( cond::time::unpack( stableBeamStartTime ).first, cond::time::unpack( stableBeamStartTime ).second - 1 ) );
00349     if( afterPreviousFillEndTime < stableBeamStartTime ) {
00350       edm::LogInfo( m_name ) << "Entering fake fill between fill number " << previousFillNumber
00351                              << " and current fill number " << currentFill
00352                              << ", from " <<  afterPreviousFillEndTime
00353                              << " ( " << boost::posix_time::to_iso_extended_string( cond::time::to_boost( afterPreviousFillEndTime ) )
00354                              << " ) to " << beforeStableBeamStartTime
00355                              << " ( " << boost::posix_time::to_iso_extended_string( cond::time::to_boost( beforeStableBeamStartTime ) )
00356                              << " ); from " << m_name << "::getNewObjects";
00357       m_to_transfer.push_back( std::make_pair( new FillInfo(), afterPreviousFillEndTime ) );
00358     } else {
00359       //the current fill cannot start before the previous one!
00360       edm::LogError( m_name ) << "WRONG DATA! In the previous fill number " << previousFillNumber
00361                               << " beams were dumped at timestamp " << boost::posix_time::to_iso_extended_string( cond::time::to_boost( previousFillEndTime ) )
00362                               << ", which is not before the timestamp " << boost::posix_time::to_iso_extended_string( cond::time::to_boost( stableBeamStartTime ) )
00363                               << " when current fill number " << currentFill
00364                               << " entered stable beams. EXITING. from " << m_name << "::getNewObjects";
00365       return;
00366     }
00367     //construct an instance of FillInfo and set its values
00368     FillInfo* fillInfo = new FillInfo( currentFill ); 
00369     fillInfo->setBeamInfo( const_cast<unsigned short const &>( bunches1 )
00370                          , const_cast<unsigned short const &>( bunches2 )
00371                          , const_cast<unsigned short const &>( collidingBunches )
00372                          , const_cast<unsigned short const &>( targetBunches )
00373                          , const_cast<FillInfo::FillTypeId const &>( fillType )
00374                          , const_cast<FillInfo::ParticleTypeId const &>( particleType1 )
00375                          , const_cast<FillInfo::ParticleTypeId const &>( particleType2 )
00376                          , const_cast<float const &>( crossingAngle )
00377                          , const_cast<float const &>( betastar )
00378                          , const_cast<float const &>( intensityBeam1 )
00379                          , const_cast<float const &>( intensityBeam2 ) 
00380                          , const_cast<float const &>( energy ) 
00381                          , const_cast<cond::Time_t const &>( creationTime )
00382                          , const_cast<cond::Time_t const &>( stableBeamStartTime )
00383                          , const_cast<cond::Time_t const &>( beamDumpTime )
00384                          , const_cast<std::string const &>( injectionScheme )
00385                          , const_cast<std::bitset<FillInfo::bunchSlots+1> const &>( bunchConfiguration1 )
00386                          , const_cast<std::bitset<FillInfo::bunchSlots+1> const &>( bunchConfiguration2 ) 
00387                            );
00388     //store this payload
00389     m_to_transfer.push_back( std::make_pair( (FillInfo*)fillInfo, stableBeamStartTime ) );
00390     edm::LogInfo( m_name ) << "The new payload to be inserted into tag " << tagInfo().name 
00391                            << " with validity " << stableBeamStartTime 
00392                            << " ( " << boost::posix_time::to_iso_extended_string( cond::time::to_boost( stableBeamStartTime ) )
00393                            << " ) has values:\n" << *fillInfo
00394                            << "from " << m_name << "::getNewObjects";
00395     //add log information
00396     ss << " fill = " << currentFill
00397        << ";\tinjection scheme: " << injectionScheme
00398        << ";\tstart time: " 
00399        << boost::posix_time::to_iso_extended_string( stableBeamStartTimeStamp.time() )
00400        << ";\tend time: "
00401        << boost::posix_time::to_iso_extended_string( beamDumpTimeStamp.time() )
00402        << "." << std::endl;
00403     //prepare variables for next iteration
00404     previousFillNumber = currentFill;
00405     previousFillEndTime = beamDumpTime;
00406   }
00407   //commit the transaction against the fill logging schema
00408   session.transaction().commit();
00409   //close the session
00410   session.close();
00411   //close the connection
00412   dbConnection.close();
00413   //store log information
00414   m_userTextLog = ss.str();
00415   edm::LogInfo( m_name ) << "Transferring " << m_to_transfer.size() << " payload(s); from " << m_name << "::getNewObjects";
00416 }
00417 
00418 std::string FillInfoPopConSourceHandler::id() const { 
00419   return m_name;
00420 }