CMS 3D CMS Logo

HDQMDatabaseProducer.py
Go to the documentation of this file.
1 import os
2 import sys
3 
4 if len(sys.argv) != 2:
5  print "Error: please, specify the configuration file"
6  sys.exit()
7 else:
8  configFile = sys.argv[1]
9 
10 if os.path.isfile(configFile):
11  print "Using configuration file:", configFile
12 else:
13  print "Error: configuration file", configFile, "not found"
14  sys.exit()
15 
16 # Read the parameters
17 import HDQMDatabaseProducerConfiguration
19 # print SourceDir
20 
21 import DiscoverDQMFiles
22 discoverDQMFiles = DiscoverDQMFiles.DiscoverDQMFiles()
23 
24 import PopulateDB
25 populateDB = PopulateDB.PopulateDB()
26 
27 import ProducePlots
28 producePlots = ProducePlots.ProducePlots()
29 
30 
31 # If needed, discover all the RecoTypes and use them
32 if len(config.RecoTypes) == 0:
33  fullList = discoverDQMFiles.filesList(config.SourceDir)
34  keys = {}
35  for file in fullList:
36  # print file.split("__")[2]
37  keys[file.split("__")[2]] = 1
38  print "Found the following reco types:", keys.keys()
39  config.RecoTypes = keys.keys()
40 
41 # Save the list of recoTypes to file for the WebInterface
42 recoTypesFile = open('recoTypesFile.txt', 'w')
43 
44 # import sys
45 # sys.exit()
46 
47 for recoType in config.RecoTypes:
48  # Create the list of DQM root files
49  fullList = discoverDQMFiles.filesList(config.SourceDir, recoType)
50  for subDetAndTag in config.SubDetsAndTags:
51  FullTagName = config.TagName+"_"+subDetAndTag.SubDet+"_"+subDetAndTag.Tag
52  # Take the list of already processed runs
53  import DiscoverProcessedRuns
54  discoverProcessedRuns = DiscoverProcessedRuns.DiscoverProcessedRuns()
55 
56  discoverProcessedRuns.Database = config.Database
57  discoverProcessedRuns.AuthenticationPath = config.AuthenticationPath
58  discoverProcessedRuns.CMSSW_Version = config.CMSSW_Version
59  discoverProcessedRuns.TagName = FullTagName
60 
61  processedRuns = discoverProcessedRuns.runsList()
62 
63  # Filter out the files of already processed runs
64  filteredList = list(fullList)
65  for run in processedRuns:
66  for file in fullList:
67  if( file.find(run) != -1 ):
68  # It should not give an exception unless a file is removed twice...
69  try:
70  filteredList.remove(file)
71  except Exception:
72  print "Error, trying to remove file:", file, "twice!"
73  pass
74 
75  # Sort with run number and remove the last RunsToSkip runs
76  filteredList = sorted(filteredList, key=lambda run: run.split("R0")[1].split("__")[0])
77  runsToSkip = int(config.RunsToSkip)
78  if( runsToSkip > 0 ):
79  for lastRun in range(runsToSkip):
80  filteredList.pop()
81 
82  # Store the information in the database
83  tempDir = config.BaseDir+"/"+subDetAndTag.SubDet+"_"+config.RunType+"/"
84  if not os.path.isdir(tempDir):
85  os.mkdir(tempDir)
86 
87  for file in filteredList:
88  runNumber = int(file.split("R0")[1].split("__")[0])
89 
90  populateDB.RunNumber = str(runNumber)
91  populateDB.AuthenticationPath = config.AuthenticationPath
92  populateDB.Database = config.Database
93  populateDB.TagName = FullTagName
94  populateDB.FileName = file
95  populateDB.TemplatesDir = config.TemplatesDir
96  populateDB.DetName = subDetAndTag.SubDet
97  populateDB.Dir = config.BaseDir+"/"+subDetAndTag.SubDet+"_"+config.RunType+"/"
98  populateDB.CMSSW_Version = config.CMSSW_Version
99 
100  populateDB.run()
101 
102  # Produce the plots if needed
103  if len(filteredList) == 0:
104  print "Creating plots"
105 
106  producePlots.Dir = config.BaseDir+"/"
107  producePlots.TagName = FullTagName
108  producePlots.DetName = subDetAndTag.SubDet
109  producePlots.StorageDir = config.StorageDir
110  producePlots.BaseDir = config.BaseDir
111  producePlots.FirstRun = str(config.FirstRun)
112  producePlots.CMSSW_Version = config.CMSSW_Version
113  producePlots.Database = config.Database
114  producePlots.Password = PASSWORD
115  producePlots.RunType = config.RunType
116  producePlots.Group = config.Group
117  producePlots.QualityFlag = subDetAndTag.QualityFlag
118 
119  producePlots.makePlots()
120 
121  # All done, save the recoType to file
122  recoTypesFile.write(recoType+"\n")
123 
124 recoTypesFile.close()
#define str(s)
double split
Definition: MVATrainer.cc:139
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run