CMS 3D CMS Logo

LHCInfoPerFillPopConAnalyzer.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("LHCInfoPerFillPopulator")
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  , 'LHCInfoPerFill_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 # Write different time-types tags depending on the O2O mode
85 if options.mode == 'endFill':
86  timetype = 'timestamp'
87 else:
88  timetype = 'lumiid'
89 
90 process.PoolDBOutputService = cms.Service("PoolDBOutputService",
91  CondDBConnection,
92  timetype = cms.untracked.string(timetype),
93  toPut = cms.VPSet(cms.PSet(record = cms.string('LHCInfoPerFillRcd'),
94  tag = cms.string( options.tag )
95  )
96  )
97  )
98 
99 process.Test1 = cms.EDAnalyzer("LHCInfoPerFillPopConAnalyzer",
100  SinceAppendMode = cms.bool(True),
101  record = cms.string('LHCInfoPerFillRcd'),
102  name = cms.untracked.string('LHCInfo'),
103  Source = cms.PSet(fill = cms.untracked.uint32(6417),
104  startTime = cms.untracked.string(options.startTime),
105  endTime = cms.untracked.string(options.endTime),
106  endFill = cms.untracked.bool(True if options.mode == "endFill" else False),
107  name = cms.untracked.string("LHCInfoPerFillPopConSourceHandler"),
108  connectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_RUNTIME_LOGGER"),
109  ecalConnectionString = cms.untracked.string("oracle://cms_orcon_adg/CMS_DCS_ENV_PVSS_COND"),
110  omsBaseUrl = cms.untracked.string("http://vocms0184.cern.ch/agg/api/v1"),
111  authenticationPath = cms.untracked.string(""),
112  debug=cms.untracked.bool(False)
113  ),
114  loggingOn = cms.untracked.bool(True),
115  IsDestDbCheckedInQueryLog = cms.untracked.bool(False)
116  )
117 
118 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