CMS 3D CMS Logo

Classes | Functions | Variables
edmPickEvents Namespace Reference

Classes

class  Event
 Event helper class ##. More...
 

Functions

def fullCPMpath ()
 
def getFileNames (event, client=None)
 Subroutines ##. More...
 
def getFileNames_das_client (event)
 
def getFileNames_dasgoclient (event)
 
def guessEmail ()
 
def setupCrabDict (options)
 

Variables

 action
 
 args
 
 colonRE
 
 command
 
 commentRE
 
 crab
 
 crabDict
 
 crabTemplate
 
 das_cli
 
 dataset
 
 default
 
 description
 
 dest
 
 email
 

Main Program

More...
 
 event
 
 eventFiles
 
 eventList
 
 eventPurgeList
 
 eventsToProcess
 
 files
 Interactive ##. More...
 
 fileSet
 
 help
 
 json
 
 line
 
 lumis
 
 options
 
 parser
 
 runsAndLumis
 CRAB ##. More...
 
 source
 
 target
 
 type
 
 uniqueFiles
 

Function Documentation

◆ fullCPMpath()

def edmPickEvents.fullCPMpath ( )

Definition at line 145 of file edmPickEvents.py.

Referenced by setupCrabDict().

145 def fullCPMpath():
146  base = os.environ.get ('CMSSW_BASE')
147  if not base:
148  raise RuntimeError("CMSSW Environment not set")
149  retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
150  % base
151  if os.path.exists (retval):
152  return retval
153  base = os.environ.get ('CMSSW_RELEASE_BASE')
154  retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
155  % base
156  if os.path.exists (retval):
157  return retval
158  raise RuntimeError("Could not find copyPickMerge_cfg.py")
159 

◆ getFileNames()

def edmPickEvents.getFileNames (   event,
  client = None 
)

Subroutines ##.

Return files for given DAS query

Definition at line 86 of file edmPickEvents.py.

References getFileNames_das_client(), getFileNames_dasgoclient(), and submitPVValidationJobs.split().

86 def getFileNames(event, client=None):
87  """Return files for given DAS query"""
88  if client == 'das_client':
89  return getFileNames_das_client(event)
90  elif client == 'dasgoclient':
91  return getFileNames_dasgoclient(event)
92  # default action
93  for path in os.getenv('PATH').split(':'):
94  if os.path.isfile(os.path.join(path, 'dasgoclient')):
95  return getFileNames_dasgoclient(event)
96  return getFileNames_das_client(event)
97 
def getFileNames_dasgoclient(event)
def getFileNames(event, client=None)
Subroutines ##.
def getFileNames_das_client(event)

◆ getFileNames_das_client()

def edmPickEvents.getFileNames_das_client (   event)
Return files for given DAS query via das_client

Definition at line 98 of file edmPickEvents.py.

References das_client.get_data(), das_client.get_value(), and print().

Referenced by getFileNames().

98 def getFileNames_das_client(event):
99  """Return files for given DAS query via das_client"""
100  files = []
101 
102  query = "file dataset=%(dataset)s run=%(run)i lumi=%(lumi)i | grep file.name" % event
103  jsondict = das_client.get_data(query)
104  status = jsondict['status']
105  if status != 'ok':
106  print("DAS query status: %s"%(status))
107  return files
108 
109  mongo_query = jsondict['mongo_query']
110  filters = mongo_query['filters']
111  data = jsondict['data']
112 
113  files = []
114  for row in data:
115  file = [r for r in das_client.get_value(row, filters['grep'])][0]
116  if len(file) > 0 and not file in files:
117  files.append(file)
118 
119  return files
120 
def get_value(data, filters, base=10)
Definition: das_client.py:248
def get_data(host, query, idx, limit, debug, threshold=300, ckey=None, cert=None, capath=None, qcache=0, das_headers=True)
Definition: das_client.py:276
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def getFileNames_das_client(event)

◆ getFileNames_dasgoclient()

def edmPickEvents.getFileNames_dasgoclient (   event)
Return files for given DAS query via dasgoclient

Definition at line 121 of file edmPickEvents.py.

References print().

Referenced by getFileNames().

121 def getFileNames_dasgoclient(event):
122  """Return files for given DAS query via dasgoclient"""
123  query = "file dataset=%(dataset)s run=%(run)i lumi=%(lumi)i" % event
124  cmd = ['dasgoclient', '-query', query, '-json']
125  proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
126  files = []
127  err = proc.stderr.read()
128  if err:
129  print("DAS error: %s" % err)
130  print(proc.stdout.read())
131  sys.exit(1)
132  else:
133  dasout = proc.stdout.read()
134  try:
135  for row in json.loads(dasout):
136  for rec in row.get('file', []):
137  fname = rec.get('name', '')
138  if fname:
139  files.append(fname)
140  except:
141  print(dasout)
142  sys.exit(1)
143  return files
144 
def getFileNames_dasgoclient(event)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ guessEmail()

def edmPickEvents.guessEmail ( )

Definition at line 160 of file edmPickEvents.py.

References join(), and submitPVValidationJobs.split().

160 def guessEmail():
161  return '%s@%s' % (subprocess.getoutput ('whoami'),
162  '.'.join(subprocess.getoutput('hostname').split('.')[-2:]))
163 
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ setupCrabDict()

def edmPickEvents.setupCrabDict (   options)

Definition at line 164 of file edmPickEvents.py.

References fullCPMpath().

164 def setupCrabDict (options):
165  date = datetime.now().strftime('%Y%m%d_%H%M%S')
166  crab = {}
167  base = options.base
168  crab['runEvent'] = '%s_runEvents.txt' % base
169  crab['copyPickMerge'] = fullCPMpath()
170  crab['output'] = '%s.root' % base
171  crab['crabcfg'] = '%s_crab.py' % base
172  crab['json'] = '%s.json' % base
173  crab['dataset'] = Event.dataset
174  crab['email'] = options.email
175  crab['WorkArea'] = date
176  if options.crabCondor:
177  crab['scheduler'] = 'condor'
178 # crab['useServer'] = ''
179  else:
180  crab['scheduler'] = 'remoteGlidein'
181 # crab['useServer'] = 'use_server = 1'
182  crab['useServer'] = ''
183  return crab
184 
185 # crab template
def setupCrabDict(options)

Variable Documentation

◆ action

edmPickEvents.action

Definition at line 244 of file edmPickEvents.py.

◆ args

edmPickEvents.args

Definition at line 262 of file edmPickEvents.py.

◆ colonRE

edmPickEvents.colonRE

Definition at line 274 of file edmPickEvents.py.

◆ command

edmPickEvents.command

Definition at line 358 of file edmPickEvents.py.

◆ commentRE

edmPickEvents.commentRE

Definition at line 273 of file edmPickEvents.py.

◆ crab

edmPickEvents.crab

Definition at line 302 of file edmPickEvents.py.

◆ crabDict

edmPickEvents.crabDict

Definition at line 315 of file edmPickEvents.py.

◆ crabTemplate

edmPickEvents.crabTemplate

Definition at line 186 of file edmPickEvents.py.

◆ das_cli

edmPickEvents.das_cli

Definition at line 258 of file edmPickEvents.py.

◆ dataset

edmPickEvents.dataset

Definition at line 272 of file edmPickEvents.py.

◆ default

edmPickEvents.default

Definition at line 242 of file edmPickEvents.py.

◆ description

edmPickEvents.description

Definition at line 238 of file edmPickEvents.py.

◆ dest

edmPickEvents.dest

Definition at line 241 of file edmPickEvents.py.

◆ email

edmPickEvents.email

Main Program

Definition at line 237 of file edmPickEvents.py.

◆ event

edmPickEvents.event

Definition at line 280 of file edmPickEvents.py.

Referenced by PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo.analyze(), DTVDriftSegmentCalibration.analyze(), DTTTrigOffsetCalibration.analyze(), DTResidualCalibration.analyze(), DTChamberEfficiency.analyze(), Rivet::CMS_2013_I1224539_DIJET.analyze(), fwlite::AnalyzerWrapper< T >.analyze(), Rivet::RivetAnalysis.analyze(), GsfElectronAlgo.beginEvent(), FWMagField.checkFieldInfo(), Rivet::HiggsTemplateCrossSections.classifyEvent(), HltDiff.compare(), CSCFileDumper.CSCFileDumper(), BiasedTauDecayer.decay(), edm::EDLooperBase.doDuringLoop(), FWFFMetadataManager.doUpdate(), HGCalValidator.dqmAnalyze(), fwlite::EventHistoryGetter.EventHistoryGetter(), CSCValHists.fill2DHistByEvent(), edm::IndexIntoFile.fillEventNumbersOrEntries(), Py8toJetInputHEPEVT.fillJetAlgoInput(), FWHLTTriggerTableView.fillTable(), edm::FilterWrapper< T >.filter(), edm::GeneratorFilter< HAD, DEC >.filter(), edm::HadronizerFilter< HAD, DEC >.filter(), edm::ConcurrentGeneratorFilter< HAD, DEC >.filter(), edm::ConcurrentHadronizerFilter< HAD, DEC >.filter(), PhotonConversionTrajectorySeedProducerFromSingleLegAlgo.find(), edm::IndexIntoFile.findPosition(), cms::cuda::EventCache.get(), cms::alpakatools::EventCache< Event >.get(), sistrip::SpyEventMatcher.getCollections(), sistrip::SpyEventMatcher.getCounters(), sistrip::SpyEventMatcher.getProduct(), PrimaryVertexAnalyzer4PUSlimmed.getSimPVs(), PrescaleEventFilter.globalEndJob(), HLTPrescaler.globalEndJob(), CmsShowNavigator.goTo(), FWGLEventHandler.HandleKey(), HFShowerLibrary.HFShowerLibrary(), HcalSignalGenerator< HBHEDigitizerTraits >.initializeEvent(), TrackingTruthAccumulator.initializeEvent(), EcalSignalGenerator< EEDigitizerTraits >.initializeEvent(), main(), gen::TauolappInterface.make_simple_tau_event(), TSToSCAssociatorByEnergyScoreImpl.makeConnections(), LCToSCAssociatorByEnergyScoreImpl.makeConnections(), cms::cuda::EventCache.makeOrGet(), helper::MasterCollection< edm::View< T > >.MasterCollection(), edm::SetRunHelper.overrideRunNumber(), edm::SetRunForEachLumiHelper.overrideRunNumber(), edm::FirstLuminosityBlockForEachRunHelper.overrideRunNumber(), edm::service::MessageLogger.preEvent(), PrescaleWeightProvider.prescaleWeight(), VariableHelper.printValues(), TFWLiteSelectorBasic.Process(), NtpProducer< C >.produce(), LowPtGsfElectronIDProducer.produce(), edmtest::AssociationMapProducer.produce(), RPCUnpackingModule.produce(), TotemVFATRawToDigi.produce(), CSCDigiFilter.produce(), MuonProducer.produce(), TriggerMatcherToHLTDebug.produce(), edm::ThinningProducer< Collection, Selector >.produce(), CSCChamberMasker.produce(), EgammaHLTPhase2ExtraProducer.produce(), EgammaHLTExtraProducer.produce(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >.produce(), HLTRecHitInAllL1RegionsProducer< RecHitType >.produce(), edm::PoolSource.readIt(), edm::RootEmbeddedFileSequence.readOneSpecified(), removeCPFromPU(), fwlite::Scanner< Collection >.scan(), CosmicTrackingParticleSelector.select(), FWFFNavigator.setCurrentEvent(), CompositeTSG.setEvent(), TrackerSeedGenerator.setEvent(), MuonTrackingRegionByPtBuilder.setEvent(), MuonTrackingRegionBuilder.setEvent(), GlobalTrajectoryBuilderBase.setEvent(), MTDDetLayerMeasurements.setEvent(), MuonDetLayerMeasurements.setEvent(), AliDaqEventHeader.SetRunEvt(), MuonsGrabber.startNewEvent(), TB06TreeH2.store(), TB06Tree.store(), fwlite::MultiChainEvent.to(), fwlite::Event.to(), pat::helper::TriggerMatchHelper.triggerMatchCandidates(), pat::helper::TriggerMatchHelper.triggerMatchObject(), pat::helper::TriggerMatchHelper.triggerMatchObjects(), L1TdeStage2CaloLayer1.updateMismatch(), and MuIsolatorResultProducer< BT >.writeOut().

◆ eventFiles

edmPickEvents.eventFiles

Definition at line 338 of file edmPickEvents.py.

◆ eventList

edmPickEvents.eventList

Definition at line 275 of file edmPickEvents.py.

◆ eventPurgeList

edmPickEvents.eventPurgeList

Definition at line 336 of file edmPickEvents.py.

◆ eventsToProcess

edmPickEvents.eventsToProcess

Definition at line 313 of file edmPickEvents.py.

◆ files

edmPickEvents.files

Interactive ##.

Definition at line 335 of file edmPickEvents.py.

◆ fileSet

edmPickEvents.fileSet

Definition at line 348 of file edmPickEvents.py.

Referenced by TauDQMFileLoader.endRun(), and TauDQMFileLoader.TauDQMFileLoader().

◆ help

edmPickEvents.help

Definition at line 21 of file edmPickEvents.py.

◆ json

edmPickEvents.json

Definition at line 312 of file edmPickEvents.py.

◆ line

edmPickEvents.line

Definition at line 288 of file edmPickEvents.py.

◆ lumis

edmPickEvents.lumis

Definition at line 312 of file edmPickEvents.py.

◆ options

edmPickEvents.options

Definition at line 262 of file edmPickEvents.py.

◆ parser

edmPickEvents.parser

Definition at line 238 of file edmPickEvents.py.

◆ runsAndLumis

edmPickEvents.runsAndLumis

CRAB ##.

Definition at line 311 of file edmPickEvents.py.

◆ source

edmPickEvents.source

Definition at line 286 of file edmPickEvents.py.

◆ target

edmPickEvents.target

Definition at line 317 of file edmPickEvents.py.

◆ type

edmPickEvents.type

Definition at line 241 of file edmPickEvents.py.

◆ uniqueFiles

edmPickEvents.uniqueFiles

Definition at line 349 of file edmPickEvents.py.