CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
pf_01_customizeSimulation Namespace Reference

Classes

class  SeqVisitor
 

Functions

def customise
 

Function Documentation

def pf_01_customizeSimulation.customise (   process)

Definition at line 49 of file pf_01_customizeSimulation.py.

49 
50 def customise(process):
51 
52 
53  process._Process__name="SELECTandSIM"
54 
55 
56  process.TFileService = cms.Service("TFileService", fileName = cms.string("histo_reconstruction.root") )
57 
58  process.tmfTracks = cms.EDProducer("RecoTracksMixer",
59  trackCol1 = cms.InputTag("removedInputMuons","tracks"),
60  trackCol2 = cms.InputTag("generalTracks","","SELECTandSIM")
61  )
62 
63  process.offlinePrimaryVerticesWithBS.TrackLabel = cms.InputTag("tmfTracks")
64  process.offlinePrimaryVertices.TrackLabel = cms.InputTag("tmfTracks")
65  process.muons.TrackExtractorPSet.inputTrackCollection = cms.InputTag("tmfTracks")
66 
67  try:
68  process.metreco.remove(process.BeamHaloId)
69  except:
70  pass
71 
72  try:
73  outputModule = process.output
74  except:
75  pass
76  try:
77  outputModule = getattr(process,str(getattr(process,list(process.endpaths)[-1])))
78  except:
79  pass
80 
81  print "Changing eventcontent to AODSIM + misc "
82  outputModule.outputCommands = process.AODSIMEventContent.outputCommands
83  keepMC = cms.untracked.vstring("keep *_*_zMusExtracted_*",
84  "keep *_removedInputMuons_*_*",
85  "keep *_generator_*_*",
86  "keep *_tmfTracks_*_SELECTandSIM",
87  "keep *_offlinePrimaryVertices_*_SELECTandSIM",
88  "keep *_offlinePrimaryVerticesWithBS_*_SELECTandSIM",
89  "keep *_PhotonIDProd_*_*",
90  "keep *_photons_*_*",
91  "keep *_photonCore_*_*",
92  "keep *_genParticles_*_*",
93  "keep *_particleFlow_*_*",
94  )
95  outputModule.outputCommands.extend(keepMC)
96 
97  if hasattr(process,"iterativeTracking" ) :
98  process.iterativeTracking.__iadd__(process.tmfTracks)
99  elif hasattr(process,"trackCollectionMerging" ) :
100  process.trackCollectionMerging.__iadd__(process.tmfTracks)
101  else :
102  raise "Cannot find tracking sequence"
103 
104  process.particleFlowORG = process.particleFlow.clone()
105  if hasattr(process,"famosParticleFlowSequence"):
106  process.famosParticleFlowSequence.remove(process.pfElectronTranslatorSequence)
107  process.famosParticleFlowSequence.remove(process.particleFlow)
108  process.famosParticleFlowSequence.__iadd__(process.particleFlowORG)
109  process.famosParticleFlowSequence.__iadd__(process.particleFlow)
110  process.famosParticleFlowSequence.__iadd__(process.pfElectronTranslatorSequence)
111  elif hasattr(process,"particleFlowReco"):
112  process.particleFlowReco.remove(process.pfElectronTranslatorSequence)
113  process.particleFlowReco.remove(process.particleFlow)
114  process.particleFlowReco.__iadd__(process.particleFlowORG)
115  process.particleFlowReco.__iadd__(process.particleFlow)
116  process.particleFlowReco.__iadd__(process.pfElectronTranslatorSequence)
117  else :
118  raise "Cannot find tracking sequence"
119 
120  process.particleFlow = cms.EDProducer('PFCandidateMixer',
121  col1 = cms.untracked.InputTag("removedInputMuons","pfCands"),
122  col2 = cms.untracked.InputTag("particleFlowORG", "")
123  )
124 
125 
126 
127  from FWCore.ParameterSet.Types import InputTag
128  for p in process.paths:
129  i = getattr(process,p)
130  target = process.particleFlow
131 
132  seqVis = SeqVisitor(target)
133  seqVis.prepareSearch()
134  seqVis.setLookFor(target)
135  i.visit(seqVis)
136  while ( seqVis.catch != 1 and seqVis.found == 1 ):
137 
138  target = seqVis.giveNext()
139 
140  targetAttributes = dir(target)
141  for targetAttribute in targetAttributes:
142  attr=getattr(target,targetAttribute) # get actual attribute, not just the name
143  if isinstance(attr, InputTag) and attr.getModuleLabel()=="particleFlow":
144  if ( attr.getProductInstanceLabel()!="" ):
145  print "Changing: ", target, " ", targetAttribute, " ", attr, " to particleFlowORG",
146  attr.setModuleLabel("particleFlowORG")
147 
148 
149  #i.replace(target, source)
150  seqVis.prepareSearch()
151  seqVis.setLookFor(target)
152  i.visit(seqVis)
153 
154  #if (seqVis.catch==1):
155  #seqVis.catch=0
156  #i.__iadd__(source)
157 
158  process.source.duplicateCheckMode = cms.untracked.string('noDuplicateCheck')
159 
160  import FWCore.ParameterSet.VarParsing as VarParsing
161  options = VarParsing.VarParsing ('analysis')
162 
163  options.register ('overrideBeamSpot',
164  0, # default value, false
165  VarParsing.VarParsing.multiplicity.singleton,
166  VarParsing.VarParsing.varType.int,
167  "should I override beamspot in globaltag?")
168 
169  # Set this to REDIGI311X for Spring11 MC:
170  options.register ('primaryProcess',
171  'RECO', # default value
172  VarParsing.VarParsing.multiplicity.singleton,
173  VarParsing.VarParsing.varType.string,
174  "original processName")
175 
176  # Workaround so that edmConfigHash does not fail with this config file.
177  # cf. https://hypernews.cern.ch/HyperNews/CMS/get/crabFeedback/3852/1/1/1/1/1.html
178  import sys
179  if hasattr(sys, "argv") == True:
180  options.parseArguments()
181 
182  # it should be the best solution to take the original beam spot for the
183  # reconstruction of the new primary vertex
184  process.offlinePrimaryVertices.beamSpotLabel = cms.InputTag("offlineBeamSpot","",options.primaryProcess)
185  process.offlinePrimaryVerticesWithBS.beamSpotLabel = cms.InputTag("offlineBeamSpot","",options.primaryProcess)
186 
187  if options.overrideBeamSpot != 0:
188  bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v18_offline") # 41x data PR gt
189  #bs = cms.string("BeamSpotObjects_2009_LumiBased_v16_offline") # 38x data gt
190  #bs = cms.string("BeamSpotObjects_2009_v14_offline") # 36x data gt
191  # tag = cms.string("Early10TeVCollision_3p8cm_31X_v1_mc_START"), # 35 default
192  # tag = cms.string("Realistic900GeVCollisions_10cm_STARTUP_v1_mc"), # 36 default
193  process.GlobalTag.toGet = cms.VPSet(
194  cms.PSet(record = cms.string("BeamSpotObjectsRcd"),
195  tag = bs,
196  connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_31X_BEAMSPOT")
197  )
198  )
199  print "BeamSpot in globaltag set to ", bs
200  else:
201  print "BeamSpot in globaltag not changed"
202 
203  print "#############################################################"
204  print " Warning! PFCandidates 'electron' collection is not mixed, "
205  print " and probably shouldnt be used. "
206  print "#############################################################"
207  return(process)
return((rh^lh)&mask)
dbl *** dir
Definition: mlp_gen.cc:35
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