CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalTag.py
Go to the documentation of this file.
1 import sys
2 
3 from Configuration.AlCa.autoCond import aliases
5 
7  def __init__(self, value):
8  self.value = value
9  def __str__(self):
10  return repr(self.value)
11 
12 class GlobalTag:
13  def __init__(self, inputGT = "", inputConnect = "", inputPfnPrefix = "", inputPfnPostfix = "", inputGTParams = []):
14  if inputGTParams == []:
15  self.gtParams = []
16  localConnect = inputConnect
17  if localConnect == "":
18  # print "No connection string specified for the GT. Using the default one:", Configuration.StandardSequences.FrontierConditions_GlobalTag_cff.GlobalTag.connect
19  localConnect = Configuration.StandardSequences.FrontierConditions_GlobalTag_cff.GlobalTag.connect.value()
20  # raise GlobalTagBuilderException("Error: no connection string specified.")
21  localGT = inputGT
22  # Expand the alias name
23  if localGT in aliases:
24  localGT = aliases[localGT]
25  if localGT.find("|") != -1 and localConnect.find("|") == -1:
26  # Fill a connection string for each GT
27  connect = localConnect
28  for i in range(1,len(localGT.split("|"))):
29  localConnect += "|"+connect
30  self.gtParams.append([localGT, localConnect, inputPfnPrefix, inputPfnPostfix])
31  else:
32  self.gtParams = inputGTParams
33  # print self.gtParams
34  def __or__(self, other):
35  if self.checkPrefix(other.gtParams) != -1:
36  raise GlobalTagBuilderException("Error: trying to add the same GT component type \""+other.gtParams[0][0].split("_")[0]+"\" twice. This is not supported.")
37  if len(other.gtParams) > 1:
38  raise GlobalTagBuilderException("Error: the second GT has already a list. This is not supported.")
39  tempGTParams = list(self.gtParams)
40  tempGTParams.append(other.gtParams[0])
41  return GlobalTag(inputGTParams = tempGTParams)
42  def __add__(self, other):
43  index = self.checkPrefix(other.gtParams)
44  if index != -1:
45  tempGTParams = list(self.gtParams)
46  tempGTParams[index] = other.gtParams[0]
47  return GlobalTag(inputGTParams = tempGTParams)
48  else:
49  exceptionString = "Error: replacement of GT "+other.gtParams[0][0]+" not allowed. No matching prefix found in existing GT components. Available components are:\n"
50  for comp in self.gtParams:
51  exceptionString += comp[0] + "\n"
52  raise GlobalTagBuilderException(exceptionString)
53  def checkPrefix(self, inputGTParams):
54  """ Compares two input GTs to see if they have the same prefix. Returns the index in the internal list of GTs of the match
55  or -1 in case of no match. """
56  if inputGTParams[0][0].find("_") == -1:
57  print "Invalid GT name. It does not contain an _, it cannot be used for replacements."
58  sys.exit(1)
59  prefix = inputGTParams[0][0].split("_")[0]
60  for i in range(0, len(self.gtParams)):
61  if self.gtParams[i][0].split("_")[0] == prefix:
62  return i
63  return -1
64  def buildString(self, index):
65  outputString = ""
66  # print "index =", index
67  # print self.gtParams
68  for elem in self.gtParams:
69  outputString += elem[index]
70  if elem != self.gtParams[len(self.gtParams)-1]:
71  outputString += "|"
72  return outputString
73  # return outputString.strip("|")
74  def gt(self):
75  return self.buildString(0)
76  def connect(self):
77  return self.buildString(1)
78  def pfnPrefix(self):
79  return self.buildString(2)
80  def pfnPostfix(self):
81  return self.buildString(3)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
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