CMS 3D CMS Logo

LHCInfoPerLSPopConAnalyzer.py
Go to the documentation of this file.
1 import socket
2 import FWCore.ParameterSet.Config as cms
3 import FWCore.ParameterSet.VarParsing as VarParsing
4 process = cms.Process("LHCInfoPerLSPopulator")
5 from CondCore.CondDB.CondDB_cfi import *
6 #process.load("CondCore.DBCommon.CondDBCommon_cfi")
7 #process.CondDBCommon.connect = 'sqlite_file:lhcinfoperls_pop_test.db'
8 #process.CondDBCommon.DBParameters.authenticationPath = '.'
9 #process.CondDBCommon.DBParameters.messageLevel=cms.untracked.int32(1)
10 
11 sourceConnection = 'oracle://cms_omds_adg/CMS_RUNINFO_R'
12 if socket.getfqdn().find('.cms') != -1:
13  sourceConnection = 'oracle://cms_omds_lb/CMS_RUNINFO_R'
14 
15 options = VarParsing.VarParsing()
16 options.register( 'mode'
17  , None # Required parameter
18  , VarParsing.VarParsing.multiplicity.singleton
19  , VarParsing.VarParsing.varType.string
20  , "The mode the fills are going to be process and the data gathered. Accepted values: duringFill endFill"
21  )
22 options.register( 'destinationConnection'
23  , 'sqlite_file:lhcinfo_pop_test.db' #default value
24  , VarParsing.VarParsing.multiplicity.singleton
25  , VarParsing.VarParsing.varType.string
26  , "Connection string to the DB where payloads will be possibly written."
27  )
28 options.register( 'targetConnection'
29  , '' #default value
30  , VarParsing.VarParsing.multiplicity.singleton
31  , VarParsing.VarParsing.varType.string
32  , """Connection string to the target DB:
33  if not empty (default), this provides the latest IOV and payloads to compare;
34  it is the DB where payloads should be finally uploaded."""
35  )
36 options.register( 'tag'
37  , 'LHCInfoPerLS_PopCon_test'
38  , VarParsing.VarParsing.multiplicity.singleton
39  , VarParsing.VarParsing.varType.string
40  , "Tag written in destinationConnection and finally appended in targetConnection."
41  )
42 options.register( 'messageLevel'
43  , 0 #default value
44  , VarParsing.VarParsing.multiplicity.singleton
45  , VarParsing.VarParsing.varType.int
46  , "Message level; default to 0"
47  )
48 options.register( 'startTime'
49  , '2021-09-10 03:10:18.000'
50  , VarParsing.VarParsing.multiplicity.singleton
51  , VarParsing.VarParsing.varType.string
52  , """Date and time of the start of processing:
53  processes only fills starting at startTime or later"""
54  )
55 options.register( 'endTime'
56  , ''
57  , VarParsing.VarParsing.multiplicity.singleton
58  , VarParsing.VarParsing.varType.string
59  , """Date and time of the start of processing:
60  processes only fills starting before endTime;
61  default to empty string which sets no restriction"""
62  )
63 options.parseArguments()
64 if options.mode is None:
65  raise ValueError("mode argument not provided. Supported modes are: duringFill endFill")
66 if options.mode not in ("duringFill", "endFill"):
67  raise ValueError("Wrong mode argument. Supported modes are: duringFill endFill")
68 
69 CondDBConnection = CondDB.clone( connect = cms.string( options.destinationConnection ) )
70 CondDBConnection.DBParameters.messageLevel = cms.untracked.int32( options.messageLevel )
71 
72 process.MessageLogger = cms.Service("MessageLogger",
73  cout = cms.untracked.PSet(threshold = cms.untracked.string('INFO')),
74  destinations = cms.untracked.vstring('cout')
75  )
76 
77 process.source = cms.Source("EmptyIOVSource",
78  lastValue = cms.uint64(1),
79  timetype = cms.string('runnumber'),
80  firstValue = cms.uint64(1),
81  interval = cms.uint64(1)
82  )
83 
84 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
85  CondDBConnection,
86  timetype = cms.untracked.string('timestamp'),
87  toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerLSRcd'),
88  tag = cms.string( options.tag )
89  )
90  )
91  )
92 
93 process.Test1 = cms.EDAnalyzer("LHCInfoPerLSPopConAnalyzer",
94  SinceAppendMode = cms.bool(True),
95  record = cms.string('LHCInfoPerLSRcd'),
96  name = cms.untracked.string('LHCInfo'),
97  Source = cms.PSet(fill = cms.untracked.uint32(6417),
98  startTime = cms.untracked.string(options.startTime),
99  endTime = cms.untracked.string(options.endTime),
100  samplingInterval = cms.untracked.uint32( 600 ),
101  endFill = cms.untracked.bool(True if options.mode == "endFill" else False),
102  name = cms.untracked.string("LHCInfoPerLSPopConSourceHandler"),
103  connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"),
104  DIPSchema = cms.untracked.string("CMS_BEAM_COND"),
105  omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"),
106  authenticationPath = cms.untracked.string(""),
107  debug=cms.untracked.bool(False)
108  ),
109  loggingOn = cms.untracked.bool(True),
110  IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
111  )
112 
113 process.p = cms.Path(process.Test1)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19