CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes
dataset.CMSDataset Class Reference
Inheritance diagram for dataset.CMSDataset:
dataset.BaseDataset

Public Member Functions

def __init__ (self, name, run_range=None)
 
def buildListOfFiles (self, pattern='.*root')
 
def buildListOfFilesDBS (self, pattern, begin=-1, end=-1)
 
def getPrimaryDatasetEntries (self)
 
- Public Member Functions inherited from dataset.BaseDataset
def __init__ (self, name, user, pattern='.*root', run_range=None, dbsInstance=None)
 def init(self, name, user, pattern='. More...
 
def buildListOfBadFiles (self)
 
def buildListOfFiles (self, pattern)
 
def extractFileSizes (self)
 
def getPrimaryDatasetEntries (self)
 
def listOfFiles (self)
 
def listOfGoodFiles (self)
 
def listOfGoodFilesWithPrescale (self, prescale)
 
def printFiles (self, abspath=True, info=True)
 
def printInfo (self)
 

Static Public Member Functions

def findPrimaryDatasetEntries (dataset, runmin, runmax)
 
def findPrimaryDatasetNumFiles (dataset, runmin, runmax)
 

Public Attributes

 files
 
- Public Attributes inherited from dataset.BaseDataset
 bad_files
 
 dbsInstance
 MM. More...
 
 files
 
 filesAndSizes
 
 good_files
 
 name
 
 pattern
 
 primaryDatasetEntries
 MM. More...
 
 report
 
 run_range
 
 user
 

Detailed Description

Definition at line 127 of file dataset.py.

Constructor & Destructor Documentation

def dataset.CMSDataset.__init__ (   self,
  name,
  run_range = None 
)

Definition at line 129 of file dataset.py.

129  def __init__(self, name, run_range = None):
130  super(CMSDataset, self).__init__( name, 'CMS', run_range=run_range)
131 
def __init__(self, name, run_range=None)
Definition: dataset.py:129

Member Function Documentation

def dataset.CMSDataset.buildListOfFiles (   self,
  pattern = '.*root' 
)

Definition at line 161 of file dataset.py.

References dataset.CMSDataset.findPrimaryDatasetNumFiles(), dataset.int, and dataset.BaseDataset.run_range.

161  def buildListOfFiles(self, pattern='.*root'):
162  runs = (-1,-1)
163  if self.run_range is not None:
164  runs = self.run_range
165  num_files=self.findPrimaryDatasetNumFiles(self.name.rstrip('/'),
166  runs[0],runs[1])
167  limit = 10000
168  if num_files > limit:
169  num_steps = int(num_files/limit)+1
170  self.files = []
171  for i in xrange(num_steps):
172  DBSFiles=self.buildListOfFilesDBS(pattern,
173  i*limit,
174  ((i+1)*limit)-1)
175  self.files.extend(DBSFiles)
176  else:
177  self.files = self.buildListOfFilesDBS(pattern)
178 
def findPrimaryDatasetNumFiles(dataset, runmin, runmax)
Definition: dataset.py:203
def buildListOfFilesDBS(self, pattern, begin=-1, end=-1)
Definition: dataset.py:132
def buildListOfFiles(self, pattern='.*root')
Definition: dataset.py:161
def dataset.CMSDataset.buildListOfFilesDBS (   self,
  pattern,
  begin = -1,
  end = -1 
)

Definition at line 132 of file dataset.py.

References dataset.BaseDataset.run_range.

132  def buildListOfFilesDBS(self, pattern, begin=-1, end=-1):
133  print 'buildListOfFilesDBS',begin,end
134  sampleName = self.name.rstrip('/')
135  query, qwhat = sampleName, "dataset"
136  if "#" in sampleName: qwhat = "block"
137  if self.run_range is not None and self.run_range != (-1,-1):
138  if self.run_range[0] == self.run_range[1]:
139  query += " run=%s" % self.run_range[0]
140  else:
141  print "WARNING: queries with run ranges are slow in DAS"
142  query += " run between [%s,%s]" % ( self.run_range[0],self.run_range[1] )
143  dbs='das_client.py --query="file %s=%s"'%(qwhat,query)
144  if begin >= 0:
145  dbs += ' --index %d' % begin
146  if end >= 0:
147  dbs += ' --limit %d' % (end-begin+1)
148  else:
149  dbs += ' --limit 0'
150  print 'dbs\t: %s' % dbs
151  dbsOut = os.popen(dbs)
152  files = []
153  for line in dbsOut:
154  if line.find('/store')==-1:
155  continue
156  line = line.rstrip()
157  # print 'line',line
158  files.append(line)
159  return files
160 
def buildListOfFilesDBS(self, pattern, begin=-1, end=-1)
Definition: dataset.py:132
def dataset.CMSDataset.findPrimaryDatasetEntries (   dataset,
  runmin,
  runmax 
)
static

Definition at line 180 of file dataset.py.

References dataset.int.

Referenced by dataset.CMSDataset.getPrimaryDatasetEntries(), and dataset.PrivateDataset.getPrimaryDatasetEntries().

180  def findPrimaryDatasetEntries(dataset, runmin, runmax):
181 
182  query, qwhat = dataset, "dataset"
183  if "#" in dataset: qwhat = "block"
184  if runmin >0 or runmax > 0:
185  if runmin == runmax:
186  query = "%s run=%d" % (query,runmin)
187  else:
188  print "WARNING: queries with run ranges are slow in DAS"
189  query = "%s run between [%d, %d]" % (query,runmin if runmin > 0 else 1, runmax if runmax > 0 else 999999)
190  dbs='das_client.py --query="summary %s=%s"'%(qwhat,query)
191  dbsOut = os.popen(dbs).readlines()
192 
193  entries = []
194  for line in dbsOut:
195  line = line.replace('\n','')
196  if "nevents" in line:
197  entries.append(int(line.split(":")[1]))
198  if entries:
199  return sum(entries)
200  return -1
201 
def findPrimaryDatasetEntries(dataset, runmin, runmax)
Definition: dataset.py:180
def dataset.CMSDataset.findPrimaryDatasetNumFiles (   dataset,
  runmin,
  runmax 
)
static

Definition at line 203 of file dataset.py.

References dataset.int.

Referenced by dataset.CMSDataset.buildListOfFiles(), and dataset.PrivateDataset.buildListOfFilesDBS().

203  def findPrimaryDatasetNumFiles(dataset, runmin, runmax):
204 
205  query, qwhat = dataset, "dataset"
206  if "#" in dataset: qwhat = "block"
207  if runmin >0 or runmax > 0:
208  if runmin == runmax:
209  query = "%s run=%d" % (query,runmin)
210  else:
211  print "WARNING: queries with run ranges are slow in DAS"
212  query = "%s run between [%d, %d]" % (query,runmin if runmin > 0 else 1, runmax if runmax > 0 else 999999)
213  dbs='das_client.py --query="summary %s=%s"'%(qwhat,query)
214  dbsOut = os.popen(dbs).readlines()
215 
216  entries = []
217  for line in dbsOut:
218  line = line.replace('\n','')
219  if "nfiles" in line:
220  entries.append(int(line.split(":")[1]))
221  if entries:
222  return sum(entries)
223  return -1
224 
def findPrimaryDatasetNumFiles(dataset, runmin, runmax)
Definition: dataset.py:203
def dataset.CMSDataset.getPrimaryDatasetEntries (   self)

Definition at line 225 of file dataset.py.

References dataset.CMSDataset.findPrimaryDatasetEntries(), ElectronMVAID.ElectronMVAID.name, counter.Counter.name, average.Average.name, AlignableObjectId::entry.name, histograms.Histograms.name, cond::persistency::TAG::NAME.name, TmModule.name, cond::persistency::GLOBAL_TAG::NAME.name, core.autovars.NTupleVariable.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::RELEASE.name, MEPSet.name, cond::persistency::TAG::END_OF_VALIDITY.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, cond::persistency::TAG::INSERTION_TIME.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::MODIFICATION_TIME.name, Types._Untracked.name, preexistingValidation.PreexistingValidation.name, dataset.BaseDataset.name, OutputMEPSet.name, personalPlayback.Applet.name, ParameterSet.name, PixelDCSObject< T >::Item.name, analyzer.Analyzer.name, DQMRivetClient::LumiOption.name, MagCylinder.name, ParSet.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, SingleObjectCondition.name, cond::persistency::GTProxyData.name, core.autovars.NTupleObjectType.name, MyWatcher.name, edm::PathTimingSummary.name, cms::DDAlgoArguments.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, alignment.Alignment.name, edm::PathSummary.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, PixelEndcapLinkMaker::Item.name, perftools::EdmEventSize::BranchRecord.name, DQMGenericClient::EfficOption.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, validateAlignments.ParallelMergeJob.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, MEtoEDM< T >::MEtoEDMObject.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, ExpressionHisto< T >.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, cond::persistency::PAYLOAD::VERSION.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, options.ConnectionHLTMenu.name, DQMGenericClient::ProfileOption.name, dqmoffline::l1t::HistDefinition.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, DQMGenericClient::NormOption.name, emtf::Node.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, h4DSegm.name, PhysicsTools::Calibration::Variable.name, FastHFShowerLibrary.name, DQMGenericClient::CDOption.name, CounterChecker.name, cond::TagInfo_t.name, looper.Looper.name, DQMGenericClient::NoFlowOption.name, cond::persistency::IOV::TAG_NAME.name, TrackerSectorStruct.name, EDMtoMEConverter.name, cond::persistency::IOV::SINCE.name, Mapper::definition< ScannerT >.name, classes.MonitorData.name, cond::persistency::IOV::PAYLOAD_HASH.name, cond::persistency::IOV::INSERTION_TIME.name, HistogramManager.name, MuonGeometrySanityCheckPoint.name, classes.OutputData.name, options.HLTProcessOptions.name, h2DSegm.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, nanoaod::FlatTable::Column.name, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, SiStripMonitorDigi.name, core.autovars.NTupleObject.name, config.Service.name, cond::persistency::TAG_LOG::TAG_NAME.name, cond::persistency::TAG_LOG::EVENT_TIME.name, cond::persistency::TAG_LOG::USER_NAME.name, cond::persistency::TAG_LOG::HOST_NAME.name, cond::persistency::TAG_LOG::COMMAND.name, cond::persistency::TAG_LOG::ACTION.name, cond::persistency::TAG_LOG::USER_TEXT.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.name, personalPlayback.FrameworkJob.name, plotscripts.SawTeethFunction.name, crabFunctions.CrabTask.name, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, and dataset.BaseDataset.run_range.

226  runmin = -1
227  runmax = -1
228  if self.run_range is not None:
229  runmin = self.run_range[0]
230  runmax = self.run_range[1]
231  return self.findPrimaryDatasetEntries(self.name, runmin, runmax)
232 
def getPrimaryDatasetEntries(self)
Definition: dataset.py:225
def findPrimaryDatasetEntries(dataset, runmin, runmax)
Definition: dataset.py:180

Member Data Documentation

dataset.CMSDataset.files

Definition at line 170 of file dataset.py.