Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:21

0001 from __future__ import print_function
0002 #
0003 # configuration file fragment containing user choices
0004 # for release to run, sample and data type to use in
0005 # a cfg file
0006 #
0007  
0008 #
0009 
0010 import FWCore.ParameterSet.Config as cms
0011 import sys
0012 
0013     
0014 
0015 ###################### user choices ######################
0016 
0017 # number of events to be run (-1 for all)
0018 maxNumberEvents = 10
0019 maxNumberEvents = -1
0020 
0021 # useRelValSample: choose the type of sample used:
0022 #   True to use MC RelVal
0023 #   False to use data
0024 
0025 # default value
0026 useRelValSample = False
0027 #
0028 # comment/uncomment the next line to choose sample type 
0029 # (un-commented selects MC RelVal)
0030 #useRelValSample=True
0031 
0032 if useRelValSample == False :
0033     
0034     # choose the global tag type 
0035     # WARNING: global mess in global tag management, 
0036     #      must be chosen per sample
0037     #      must be checked in the release
0038     #  
0039     globalTag = '75X_dataRun2_HLT_v2'
0040     
0041     # choose one sample identifier from the list of data samples 
0042     #
0043     sampleIdentifier = '251162'
0044     #sampleIdentifier = '165633-CAFDQM'
0045     #sampleIdentifier = '191833_RAW'
0046     #sampleIdentifier = '205666.A.storageManager'
0047 
0048 else :
0049     # choose the global tag type 
0050     # WARNING: global mess in global tag management, 
0051     #      must be chosen per sample
0052     #      must be checked in the release
0053     #  
0054     globalTag = 'auto:run1_mc'
0055     #globalTag = 'auto:MCRUN2_72_V3A'
0056     #globalTag = 'auto:run1_mc_hi'
0057     
0058     # choose (pre)release used to produce the RelVal samples
0059     sampleFromRelease = 'CMSSW_7_5_0'
0060 
0061     # RelVals samples - add the "short name" of the dataset e.g. /RelValLM1_sfts/...
0062     #
0063     #dataset = 'RelValMinBias'
0064     dataset = 'RelValTTbar'
0065     
0066     # data type
0067     #
0068     dataType = 'RAW'
0069     #dataType = 'RECO'
0070         
0071 # change to True to use local files
0072 #     the type of file must be matched by hand
0073 
0074 useLocalFiles = False 
0075 #useLocalFiles = True 
0076 
0077 # override default global tag - expert choice, do it only if you know what you do
0078 overrideGlobalTag = False
0079 #overrideGlobalTag = True
0080 
0081 if overrideGlobalTag == True :
0082     myGlobalTag = 'GR_P_V28'
0083 
0084 ###################### end user choices ###################
0085 
0086 #
0087 errorUserOptions = False
0088 
0089 # initialize list of files, of secondary files, list of selected events and luminosity segments
0090 readFiles = cms.untracked.vstring()
0091 secFiles = cms.untracked.vstring() 
0092 selectedEvents = cms.untracked.VEventRange()
0093 selectedLumis= cms.untracked.VLuminosityBlockRange()
0094 
0095 # type of sample used (True for RelVal, False for data)
0096 
0097 if (useRelValSample == True) and (useLocalFiles == False) :
0098     
0099     #            
0100 
0101     print("   Release:   ", sampleFromRelease)
0102     print("   Dataset:   ", dataset)
0103     print("   Data type: ", dataType)
0104     print() 
0105 
0106     useDAS = True
0107     
0108     if useDAS :
0109         import das_client
0110         import os
0111         
0112         # query DAS
0113         
0114         myQuery =  'dataset release=' + sampleFromRelease
0115         dasClientCommand = 'das_client.py --limit=0 --format=plain --query='+'"'+myQuery+'"'
0116         datasets = os.popen(dasClientCommand)
0117         
0118         
0119         # adjust strings for dataset and sampleFromRelease to search the dataset exact name 
0120         dataset = '/' + dataset + '/'
0121         sampleFromRelease = sampleFromRelease +'-'
0122         
0123         if 'start' in globalTag :
0124             gTag = 'START'
0125         elif 'mc' in globalTag :
0126             gTag = 'MC'
0127         else :
0128             gTag =''  
0129         
0130         datasetName = ''
0131         for line in datasets.readlines() :
0132             if dataset in line :
0133               if sampleFromRelease in line :
0134                   if gTag in line :
0135                       if dataType in line :
0136                           if 'ALCA' not in line :
0137                               datasetName = line.strip(' \n')
0138                               # print datasetName
0139 
0140         # print datasetName
0141         
0142         if datasetName == '' :
0143             print("\n   No dataset found.")
0144             errorUserOptions = True 
0145 
0146         if not errorUserOptions :
0147             
0148             myQuery = 'file dataset=' + '"' + datasetName + '"'
0149             dasClientCommand = 'das_client.py --limit=0 --format=plain --query=' + '"' + myQuery + '"'
0150             data = os.popen(dasClientCommand)
0151             filePaths = data.readlines()
0152 
0153             
0154             print('\n   das_client using the query')
0155             print('      ', myQuery)
0156             print('   retrieved the following files\n')
0157         
0158             for line in filePaths :
0159                 print('      ', line)
0160            
0161             readFiles.extend(filePaths);
0162         
0163         
0164             # nothing added to secondary files by DAS 
0165             secFiles.extend([
0166                 ])
0167     
0168    
0169     
0170 
0171 elif (useRelValSample == False) and (useLocalFiles == False) :
0172 
0173     # data
0174     
0175     if sampleIdentifier == '191833_RAW' :
0176         runNumber = '191833'
0177         dataset = '/DoubleElectron/Run2012A-v1/RAW'
0178         dataType = 'RAW'
0179         useDAS = True
0180         selectedLumis= cms.untracked.VLuminosityBlockRange(
0181                                                 '191833:1'
0182                                                 )
0183         selectedEvents = cms.untracked.VEventRange(
0184                                     '191833:256674',
0185                                     '191833:588211'
0186                                     )
0187         
0188     elif sampleIdentifier == '251162' :
0189         runNumber = '251162'
0190         dataset = '/Run2015B/DoubleMuon/RAW'
0191         dataType = 'RAW'
0192         useDAS = False
0193         readFiles.extend( [
0194                 '/store/data/Run2015B/DoubleMuon/RAW/v1/000/251/162/00000/9A6A3CB4-AD25-E511-84E5-02163E01264D.root'       
0195                 ] );
0196         
0197 
0198     elif sampleIdentifier == '191833_RECO' :
0199         runNumber = '191833'
0200         dataset = '/DoubleElectron/Run2012A-PromptReco-v1/RECO'
0201         dataType = 'RECO'
0202         useDAS = True
0203         selectedLumis= cms.untracked.VLuminosityBlockRange(
0204                                                 '191833:1'
0205                                                 )
0206         selectedEvents = cms.untracked.VEventRange(
0207                                     '191833:256674',
0208                                     '191833:588211'
0209                                     )
0210 
0211     elif sampleIdentifier == '191833_AOD' :
0212         runNumber = '191833'
0213         dataset = '/DoubleElectron/Run2012A-PromptReco-v1/AOD'
0214         dataType = 'RECO'
0215         useDAS = True
0216         selectedLumis= cms.untracked.VLuminosityBlockRange(
0217                                                 '191833:1'
0218                                                 )
0219         selectedEvents = cms.untracked.VEventRange(
0220                                     '191833:256674',
0221                                     '191833:588211'
0222                                     )
0223 
0224     # splash events 2012    
0225     elif sampleIdentifier == '187858' :
0226         runNumber = '187858'
0227         dataset = '/Commissioning/Commissioning12-v1/RAW'
0228         dataType = 'RAW'
0229         useDAS = True
0230         selectedLumis= cms.untracked.VLuminosityBlockRange(
0231                                                 '187858:394', 
0232                                                 '187858:499'
0233                                                 )
0234         selectedEvents = cms.untracked.VEventRange(
0235                                     '187858:3244833',
0236                                     '187858:4094284'
0237                                     )
0238        
0239     # high PU run 2011   
0240     elif sampleIdentifier == '179828' :
0241         runNumber = '179828'
0242         dataset =  '/ZeroBiasHPF0/Run2011B-v1/RAW'
0243         dataType = 'RAW'
0244         useDAS = True
0245         
0246         
0247     elif sampleIdentifier == '165633-CAFDQM' :
0248         runNumber = '165633'
0249         dataset = '/ZeroBiasHPF0/Run2011B-v1/RAW'
0250         dataType = 'RAW'
0251         useDAS = False
0252         readFiles.extend( [ 
0253                 'file:/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/DQMTest/MinimumBias__RAW__v1__165633__1CC420EE-B686-E011-A788-0030487CD6E8.root'                       
0254                 ]);    
0255                                                                                                            
0256        
0257     elif sampleIdentifier == '137028' :
0258         runNumber = '137028'
0259         dataset = '/Run2010A/ZeroBias/RECO-v2'
0260         dataType = 'RECO'
0261         useDAS = False
0262         readFiles.extend( [
0263                 '/store/data/Run2010A/ZeroBias/RECO/v2/000/137/028/08BF857D-2471-DF11-9CEB-003048D2BBF0.root'       
0264                 ] );
0265                 
0266  
0267     elif sampleIdentifier == 'StreamFile_105760' :
0268         runNumber = '105760'
0269         dataset = 'A_Stream'
0270         dataType = 'StreamFile'
0271         useDAS = False
0272         readFiles.extend( [
0273                 'file:/lookarea_SM/MWGR_29.00105760.0001.A.storageManager.00.0000.dat'       
0274                 ] );
0275                 
0276     # run with L1 GT data - emulator disagreements for the selectedEvents               
0277     elif sampleIdentifier == '205666.A.storageManager' :
0278         runNumber = '205666'
0279         dataset = 'A.storageManager'
0280         dataType = 'StreamFile'
0281         useDAS = False
0282         
0283         selectedEvents = cms.untracked.VEventRange(
0284                                     '205666:101:125069341',
0285                                     '205666:161:238160322',
0286                                     '205666:281:443371795',
0287                                     '205666:341:537654884',
0288                                     '205666:361:567121052'
0289                                     )
0290         
0291         readFiles.extend( [ 
0292 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0001.A.storageManager.00.0000.dat',
0293 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0021.A.storageManager.01.0000.dat',
0294 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0041.A.storageManager.02.0000.dat',
0295 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0061.A.storageManager.03.0000.dat',
0296 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0081.A.storageManager.04.0000.dat',
0297             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0101.A.storageManager.05.0000.dat',
0298 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0121.A.storageManager.06.0000.dat',
0299 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0141.A.storageManager.07.0000.dat',
0300             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0161.A.storageManager.08.0000.dat',
0301 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0181.A.storageManager.09.0000.dat',                   
0302 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0201.A.storageManager.10.0000.dat',                   
0303 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0221.A.storageManager.11.0000.dat',                   
0304 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0241.A.storageManager.12.0000.dat',                   
0305 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0261.A.storageManager.13.0000.dat',
0306             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0281.A.storageManager.14.0000.dat',
0307 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0301.A.storageManager.15.0000.dat',
0308 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0321.A.storageManager.00.0000.dat',
0309             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0341.A.storageManager.01.0000.dat',
0310             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0361.A.storageManager.02.0000.dat',
0311 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0381.A.storageManager.03.0000.dat',
0312 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0401.A.storageManager.04.0000.dat',
0313 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0421.A.storageManager.05.0000.dat',
0314 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0441.A.storageManager.06.0000.dat',
0315 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0461.A.storageManager.07.0000.dat',
0316 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0481.A.storageManager.08.0000.dat',
0317 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0501.A.storageManager.09.0000.dat',
0318 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0521.A.storageManager.10.0000.dat',
0319 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0541.A.storageManager.11.0000.dat',
0320 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0561.A.storageManager.12.0000.dat',
0321 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0581.A.storageManager.13.0000.dat',
0322 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0601.A.storageManager.14.0000.dat',
0323 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0621.A.storageManager.15.0000.dat',
0324 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0641.A.storageManager.00.0000.dat',
0325 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0661.A.storageManager.01.0000.dat',
0326 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0681.A.storageManager.02.0000.dat',
0327 #            'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0701.A.storageManager.03.0000.dat',
0328             'file:/afs/cern.ch/user/g/ghete/work/L1Trigger/data/Data.00205666.0721.A.storageManager.04.0000.dat'                     
0329            ]);    
0330                 
0331                 
0332     else :
0333         print('Error: sample identifier ', sampleIdentifier, ' not defined.\n')
0334         errorUserOptions = True 
0335         runNumber = '0'
0336         dataset = 'None'
0337         dataType = 'None'
0338         useDAS = False
0339        
0340      
0341     #            
0342     # end of data samples 
0343     #            
0344 
0345     print("   Run number: ", runNumber)
0346     print("   Dataset: ", dataset)
0347     print("   Data type: ", dataType)
0348 
0349     if useDAS :
0350         import das_client
0351         import os
0352 
0353         # query DAS
0354         myQuery =  'file dataset=' + dataset + ' run=' + runNumber
0355         dasClientCommand = 'das_client.py --limit=0 --format=plain --query='+'"'+myQuery+'"'
0356         data = os.popen(dasClientCommand)
0357         filePaths = data.readlines()
0358             
0359        
0360         print('\n   das_client using the query')
0361         print('      ', myQuery)
0362         print('   retrieved the following files\n')
0363         
0364         for line in filePaths :
0365             print('      ', line)
0366            
0367         readFiles.extend(filePaths);
0368         
0369         
0370         # nothing added to secondary files by DAS 
0371         secFiles.extend([
0372                 ])
0373 
0374         
0375             
0376 else :
0377     # local file(s)
0378     
0379 
0380     if sampleIdentifier == 'dummy' :
0381         dataType = 'RAW'
0382         readFiles.extend( [                        
0383             'file:/afs/cern.ch/user/g/ghete/scratch0/CmsswTestFiles/LocalFile_source.root'
0384             ]);                                                                                               
0385 
0386         secFiles.extend([
0387             ])
0388 
0389     print('Local file(s)', readFiles)
0390 
0391 if overrideGlobalTag == True :
0392     globalTag = myGlobalTag
0393   
0394 if globalTag.count('auto') :
0395     from Configuration.AlCa.autoCond import autoCond
0396     useGlobalTag = autoCond[globalTag.replace('auto:', '')]
0397 else :
0398     useGlobalTag = globalTag   
0399     
0400 print("\n   Using global tag ", useGlobalTag, "\n")
0401     
0402