This is my private documentation page on CT-PPS Database development.

For the moment, the focus will be on the conditions related to the accelerator and beam as well to the pot insertion into the beam pipe.

Beam and Roman Pot position related conditions

  • Crossing angle
  • beta-star
  • magnets currents
  • Raw Roman Pot insertion

Contact People

Subsystem/Activity Name E-mail
CT-PPS (offline conditions) Clemencia Mora Herrera clemencia.mora.herrera@cernNOSPAMPLEASE.ch
Helena Malbouisson helena.malbouisson@cernNOSPAMPLEASE.ch
CT-PPS Diego Figueiredo dmf@cernNOSPAMPLEASE.ch
OMDS Umeshwar Joshi joshi@fnalNOSPAMPLEASE.gov
DB Loader setup Aivaras Silale aivaras.silale@cernNOSPAMPLEASE.ch
OMS (replacement for WBM) Valdas Rapsevicius (main contact) valdas.rapsevicius@cernNOSPAMPLEASE.ch
Aivaras Silale aivaras.silale@cernNOSPAMPLEASE.ch

Related links

At work

Set up working area and environment

$ cmsrel CMSSW_9_4_0_pre2
$ cd CMSSW_9_4_0_pre2/src
$ cmsenv
$ git cms-init
$ git cms-addpkg CondCore/CTPPSPlugins
$ git cms-addpkg CondFormats/DataRecord
$ git cms-addpkg CondFormats/CTPPSReadoutObjects
$ scramv1 b -j20

Step by step

How to create a Conditions Object

  1. Move to CondFormats/CTPPSReadoutObjects package
  2. Define new class LHCInfoForCTPPS to hold LHC related info: interface/LHCInfoForCTPPS.h
  3. Add the following line to src/headers.h: #include "CondFormats/CTPPSReadoutObjects/interface/LHCInfoForCTPPS.h"
  4. For the class be available as EventSetup data, an LCG dictionary must be created for it. This is achieved by changing classes_def.xml and classes.h files in the project /src area:
    • src/classes.h holds the class definitions.
    • src/classes_def.xml contains the names of all classes to be stored and their constituents, as well as class template instantiations.
  5. Add test serialization code test/testSerializationLHCInfo.cc and edit test/BuildFile.xml accordingly:
    •       <bin file="testSerializationLHCInfo.cc">
                <use   name="CondFormats/CTPPSReadoutObjects"/>
  6. For the class to be useable as EventSetup data, it needs to be registered into the CMSSW framework as such. Add T_EventSetup_LHCInfoForCTPPS.cc to src and change BuildFile.xml accordingly by adding:
    •       <use name="FWCore/Utilities"/>
  7. Next define a Record where the objects are actually stored and from which it can be retrieved. The record class must be defined in CondFormats/DataRecord.
    •       $ cd $CMSSW_BASE/src/CondFormats/DataRecord/interface
            $ mkrecord LHCInfoForCTPPSRcd
            $ mv LHCInfoForCTPPSRcd.cc ../src
      followed by
            $ cd ..
            $ scramv1 b -j20
  8. Tell the DB interface which data do associate to which record. Go to $CMSSW_BASE/src/CondCore/CTPPSPlugins/src/ and add the following lines to plugin.cc:
    •       #include "CondFormats/CTPPSReadoutObjects/interface/LHCInfoForCTPPS.h"
            #include "CondFormats/DataRecord/interface/LHCInfoForCTPPSRcd.h"
  9. Build the plugin system and check that the proxy for the EventSetup has been correctly built:
    •       $ scramv1 b -j20
            $ edmPluginDump | grep LHCInfoForCTPPSRcd

How to fill the DB with data

  1. Create a new (dummy) subsystem
    •       $ cd $CMSSW_BASE/src
            $ mkdir MyCondCTPPS      
  2. Create an analyzer
    •       $ mkedanlzr LHCInfoMaker      
  3. Go to LHCInfoMaker/plugins/ and change LHCInfoMaker.cc for the analyze method to look like
    • void LHCInfoMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
         using namespace edm;
         LHCInfoForCTPPS* pInfo = new LHCInfoForCTPPS();
         // Form the data here
         edm::Service<cond::service::PoolDBOutputService> poolDbService;
         if( poolDbService.isAvailable() )
            poolDbService->writeOne( pInfo, poolDbService->currentTime(),
                                                      "LHCInfoForCTPPSRcd"  );
            throw std::runtime_error("PoolDBService required.");
  4. Change also BuildFile.xml to look like
    • <use name="FWCore/Framework"/>
      <use name="FWCore/PluginManager"/>
      <use name="FWCore/ParameterSet"/>
      <use name="FWCore/ServiceRegistry"/>
      <use name="CondCore/DBOutputService"/>
      <use name="CondFormats/CTPPSReadoutObjects"/>
      <flags EDM_PLUGIN="1"/>      
  5. Compile
    •       $ cd $CMSSW_BASE/src/MyCondCTPPS
            $ scram b       
  6. Add the LHCInfoMaker/test/test-maker_cfg.py configuration file to run the analyzer and create an output file. DB service is configured to write to a SQLite file.
    • import FWCore.ParameterSet.Config as cms
      process = cms.Process("lhcInfoTest")
      # Load CondDB service
      # output database (in this case local sqlite file)
      process.CondDB.connect = 'sqlite_file:LHCInfoForCTPPS.db'
      # A data source must always be defined. We don't need it, so here's a dummy one.
      process.source = cms.Source("EmptyIOVSource",
          timetype = cms.string('runnumber'),
          firstValue = cms.uint64(1),
          lastValue = cms.uint64(1),
          interval = cms.uint64(1)
      # We define the output service.
      process.PoolDBOutputService = cms.Service("PoolDBOutputService",
          timetype = cms.untracked.string('runnumber'),
          toPut = cms.VPSet(cms.PSet(
              record = cms.string('LHCInfoForCTPPSRcd'),
              tag = cms.string('LHCInfoForCTPPS_test')
      process.pedestals_maker = cms.EDAnalyzer("LHCInfoMaker",
          record = cms.string('LHCInfoForCTPPSRcd'),
          loggingOn= cms.untracked.bool(True),
      process.path = cms.Path(process.pedestals_maker)      
  7. Run the configuration file
    •       $ cmsRun test/test-maker_cfg.py      
      creating the file LHCInfoForCTPPS.db.

How to retrieve thedata

  1. Requires the configuration of the DB interface, this time using the ESSource. The LHCInfoMaker/test/test-retrieve_cfg.py configuration file is used.
    •       $ cmsRun test/test-retrieve_cfg.py      

To Do:

  • Test "lumisection" as IOV timetype
  • Try to store/retrieve the object through ORACLE on cmsprep. Using the following parameters in the _cfg.py
    •  process.CondDB.connect = "oracle://cmsprep/CMS_COND_TASKNAME"  
      Note: replace "CMS_COND_TASKNAME" with the account name allocated to your task.
       process.CondDB.DBParameters.authenticationPath = 'where_it_is'  


-- WagnerDePaulaCarvalho - 2017-09-15

Edit | Attach | Watch | Print version | History: r27 | r20 < r19 < r18 < r17 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r18 - 2018-05-14 - WagnerDePaulaCarvalho
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback