ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/DataDiscovery.py
(Generate patch)

Comparing COMP/CRAB/python/DataDiscovery.py (file contents):
Revision 1.40 by ewv, Thu Feb 4 16:35:25 2010 UTC vs.
Revision 1.41 by spiga, Sun Feb 21 12:47:19 2010 UTC

# Line 8 | Line 8 | import DBSAPI.dbsApi
8   from DBSAPI.dbsApiException import *
9   import common
10   from crab_util import *
11 + from LumiList import LumiList
12   import os
13  
14  
# Line 101 | Line 102 | class DataDiscovery:
102          self.maxLumis = 0         # DBS output: total number of lumis
103          self.parent = {}          # DBS output: parents of each file
104          self.lumis = {}           # DBS output: lumis in each file
105 <
105 >        self.lumiMask = None
106  
107      def fetchDBSInfo(self):
108          """
# Line 132 | Line 133 | class DataDiscovery:
133          if (self.cfg_params.has_key('CMSSW.runselection')):
134              runselection = parseRange2(self.cfg_params['CMSSW.runselection'])
135  
136 +        ## check if lumiMask is set
137 +        self.lumiMask = self.cfg_params.get('CMSSW.lumi_mask',None)
138 +        lumiList = None
139 +        if self.lumiMask:
140 +            lumiList = LumiList(filename=self.lumiMask)
141  
142          self.splitByRun = int(self.cfg_params.get('CMSSW.split_by_run', 0))
143  
# Line 157 | Line 163 | class DataDiscovery:
163          # parse files and fill arrays
164          for file in self.files :
165              parList  = []
166 <            lumiList = [] # List of tuples
166 >            fileLumis = [] # List of tuples
167              # skip already analyzed blocks
168              fileblock = file['Block']['Name']
169              if fileblock not in anFileBlocks :
# Line 165 | Line 171 | class DataDiscovery:
171                  # asked retry the list of parent for the given child
172                  if useparent==1:
173                      parList = [x['LogicalFileName'] for x in file['ParentList']]
174 <                if self.ads:
175 <                    lumiList = [ (x['RunNumber'], x['LumiSectionNumber'])
174 >                if self.ads or self.lumiMask:
175 >                    fileLumis = [ (x['RunNumber'], x['LumiSectionNumber'])
176                                   for x in file['LumiList'] ]
177                  self.parent[filename] = parList
178 <                self.lumis[filename] = lumiList
178 >                # For LumiMask, intersection of two lists.
179 >                if self.lumiMask:
180 >                    self.lumis[filename] = lumiList.filterLumis(fileLumis)
181 >                else:
182 >                    self.lumis[filename] = fileLumis
183                  if filename.find('.dat') < 0 :
184                      events    = file['NumberOfEvents']
185                      # Count number of events and lumis per block
# Line 188 | Line 198 | class DataDiscovery:
198  
199                      # total number of events
200                      self.maxEvents += events
201 <                    self.maxLumis  += len(lumiList)
201 >                    self.maxLumis  += len(self.lumis[filename])
202  
203          if  self.skipBlocks and len(self.eventsPerBlock.keys()) == 0:
204              msg = "No new fileblocks available for dataset: "+str(self.datasetPath)
# Line 209 | Line 219 | class DataDiscovery:
219      def queryDbs(self,api,path=None,runselection=None,useParent=None):
220  
221          allowedRetriveValue = ['retrive_block', 'retrive_run']
222 <        if self.ads: allowedRetriveValue.append('retrive_lumi')
222 >        if self.ads or self.lumiMask:
223 >            allowedRetriveValue.append('retrive_lumi')
224          if useParent == 1: allowedRetriveValue.append('retrive_parent')
225          common.logger.debug("Set of input parameters used for DBS query: %s" % allowedRetriveValue)
226          try:
227              if len(runselection) <=0 :
228 <                if useParent==1 or self.splitByRun==1 or self.ads:
228 >                if useParent==1 or self.splitByRun==1 or self.ads or self.lumiMask:
229                      if self.ads:
230                          files = api.listFiles(analysisDataset=path, retriveList=allowedRetriveValue)
231                      else :

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines