CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Alignment/OfflineValidation/scripts/configTemplates.py

Go to the documentation of this file.
00001 ###
00002 #                 Default Templates
00003 ###
00004 
00005 offlineTemplate = """
00006 import FWCore.ParameterSet.Config as cms
00007 
00008 process = cms.Process("OfflineValidator") 
00009    
00010 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
00011 
00012 process.options = cms.untracked.PSet(
00013    wantSummary = cms.untracked.bool(False),
00014    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00015    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00016 )
00017 
00018  ##
00019  ## Maximum number of Events
00020  ## 
00021 process.maxEvents = cms.untracked.PSet(
00022     input = cms.untracked.int32(.oO[nEvents]Oo.)
00023  )
00024 
00025  ##   
00026  ## Messages & Convenience
00027  ##
00028 process.load("FWCore.MessageLogger.MessageLogger_cfi")
00029 process.MessageLogger.cerr = cms.untracked.PSet(placeholder = cms.untracked.bool(True))
00030 process.MessageLogger.cout = cms.untracked.PSet(INFO = cms.untracked.PSet(
00031 reportEvery = cms.untracked.int32(1000) # every 1000th only
00032 #    limit = cms.untracked.int32(10)       # or limit to 10 printouts...
00033 ))
00034 process.MessageLogger.statistics.append('cout')
00035 
00036 #############################################################
00037 ##select trigger bits 40 OR 41
00038 ##AND NOT (36 OR 37 OR 38 OR 39)
00039 ##trigger bit 0 is selecting crossing bunches (not in MC)
00040 ##########################################################
00041 process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskTechTrigConfig_cff')
00042 process.load('HLTrigger/HLTfilters/hltLevel1GTSeed_cfi')
00043 
00044 #Good Bunch Crossings
00045 process.bptxAnd = process.hltLevel1GTSeed.clone(L1TechTriggerSeeding = cms.bool(True), L1SeedsLogicalExpression = cms.string('0'))
00046 #BSCNOBEAMHALO
00047 process.bit40 = process.hltLevel1GTSeed.clone(L1TechTriggerSeeding = cms.bool(True), L1SeedsLogicalExpression = cms.string('(40 OR 41) AND NOT (36 OR 37 OR 38 OR 39) AND NOT ((42 AND NOT 43) OR (43 AND NOT 42))'))
00048 
00049 #Physics declared
00050 process.load('HLTrigger.special.hltPhysicsDeclared_cfi')
00051 process.hltPhysicsDeclared.L1GtReadoutRecordTag = 'gtDigis'
00052 
00053     
00054 #############################################################
00055 ##select only high purity tracks
00056 ##has to run first as necessary information
00057 ##is only available in initial track selection
00058 ##(Quality information is thrown away by the tracker refitters)
00059 ##########################################################
00060 import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi
00061 process.HighPuritySelector = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone(
00062     applyBasicCuts = True,
00063     filter = True,
00064     src = '.oO[TrackCollection]Oo.',
00065     trackQualities = ["highPurity"]
00066     )
00067 
00068 ###############################################################
00069 ## Quality filters on the event (REAL DATA - FIRST COLLISIONS DEC09 ONLY!)
00070 ## see https://twiki.cern.ch/twiki/bin/viewauth/CMS/TRKPromptFeedBack#Event_and_track_selection_recipe
00071 ##NOT in PATH yet, to be commented in, if necessay
00072 ##
00073 #########################################################    
00074 process.oneGoodVertexFilter = cms.EDFilter("VertexSelector",
00075                                            src = cms.InputTag("offlinePrimaryVertices"),
00076                                            cut = cms.string("!isFake && ndof > 4 && abs(z) <= 15 && position.Rho <= 2"), # tracksSize() > 3 for the older cut
00077                                            filter = cms.bool(True),   # otherwise it won't filter the events, just produce an empty vertex collection.
00078                                            )
00079 
00080 
00081 process.noScraping= cms.EDFilter("FilterOutScraping",
00082                                  src=cms.InputTag("ALCARECOTkAlMinBias"),
00083                                  applyfilter = cms.untracked.bool(True),
00084                                  debugOn = cms.untracked.bool(False), ## Or 'True' to get some per-event info
00085                                  numtrack = cms.untracked.uint32(10),
00086                                  thresh = cms.untracked.double(0.25)
00087                                  )
00088 ####################################
00089 
00090 
00091 
00092 
00093 
00094 #-- Track hit filter
00095 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
00096 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
00097 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
00098 
00099 #-- Alignment Track Selection
00100 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
00101 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
00102 process.AlignmentTrackSelector.filter = True
00103 
00104 .oO[TrackSelectionTemplate]Oo.
00105 
00106 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
00107 import RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff
00108 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff.ctfWithMaterialTracks.clone(
00109    src = 'TrackerTrackHitFilter',
00110    NavigationSchool = "",
00111 
00112 ###    TrajectoryInEvent = True,
00113     TTRHBuilder = "WithAngleAndTemplate"    
00114 )
00115 
00116  ##
00117  ## Load and Configure TrackRefitter1
00118  ##
00119 
00120 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
00121 
00122 #############
00123 # parameters for TrackRefitter
00124 #process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff")
00125 import RecoTracker.TrackProducer.TrackRefitters_cff
00126 process.TrackRefitter1 = process.TrackRefitter.clone(
00127    src = 'HighPuritySelector',
00128    TrajectoryInEvent = True,
00129    TTRHBuilder = "WithAngleAndTemplate",
00130    NavigationSchool = ""
00131 )
00132 process.TrackRefitter2 = process.TrackRefitter1.clone(
00133 #    src = 'HitFilteredTracks')
00134      src = 'AlignmentTrackSelector'
00135 )
00136 
00137 
00138  ##
00139  ## Get the BeamSpot
00140  ##
00141 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
00142  
00143  ##
00144  ## GlobalTag Conditions (if needed)
00145  ##
00146 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00147 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
00148 
00149 
00150 .oO[LorentzAngleTemplate]Oo.
00151   
00152  ##
00153  ## Geometry
00154  ##
00155 process.load("Configuration.StandardSequences.Geometry_cff")
00156  
00157  ##
00158  ## Magnetic Field
00159  ##
00160 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
00161 
00162 .oO[dbLoad]Oo.
00163 
00164 .oO[APE]Oo.
00165 
00166 ## to apply misalignments
00167 #TrackerDigiGeometryESModule.applyAlignment = True
00168    
00169  ##
00170  ## Load and Configure OfflineValidation and Output File
00171  ##
00172 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
00173 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
00174 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
00175 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = .oO[offlineModuleLevelHistsTransient]Oo.
00176 .oO[offlineValidationFileOutput]Oo.
00177 
00178  ##
00179  ## PATH
00180  ##
00181 process.p = cms.Path(
00182 process.triggerSelection*
00183 process.offlineBeamSpot*process.HighPuritySelector*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
00184 *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
00185 
00186 """
00187 
00188 offlineStandaloneFileOutputTemplate = """
00189 process.TFileService.fileName = '.oO[outputFile]Oo.'
00190 """
00191 
00192 offlineDqmFileOutputTemplate = """
00193 process.TrackerOfflineValidationSummary.oO[offlineValidationMode]Oo..removeModuleLevelHists = .oO[offlineModuleLevelHistsTransient]Oo.
00194 process.DqmSaverTkAl.workflow = '.oO[workflow]Oo.'
00195 process.DqmSaverTkAl.dirName = '.oO[workdir]Oo./.'
00196 process.DqmSaverTkAl.forceRunNumber = .oO[firstRunNumber]Oo.
00197 """
00198 #offlineDqmFileOutputTemplate = """
00199 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..workflow =  .oO[workflow]Oo.
00200 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..dirName = .oO[workdir]Oo./.
00201 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..forceRunNumber = .oO[firstRunNumber]Oo.
00202 #"""
00203 
00204 
00205 LorentzAngleTemplate = "#use lorentz angle from global tag"
00206 
00207 TrackSelectionTemplate = """
00208 #####default for MC tracks with now further corrections etc.
00209 
00210 process.AlignmentTrackSelector.applyBasicCuts = True
00211 # Note that pMin is overridden and set to zero in
00212 # the offlineTemplate0T
00213 process.AlignmentTrackSelector.pMin    = 3
00214 process.AlignmentTrackSelector.pMax    = 9999.
00215 process.AlignmentTrackSelector.ptMin   = 0.65
00216 process.AlignmentTrackSelector.ptMax   = 9999.
00217 process.AlignmentTrackSelector.etaMin  = -999.
00218 process.AlignmentTrackSelector.etaMax  = 999.
00219 process.AlignmentTrackSelector.nHitMin = 8
00220 process.AlignmentTrackSelector.nHitMin2D = 2
00221 process.AlignmentTrackSelector.chi2nMax = 999.
00222 process.AlignmentTrackSelector.applyMultiplicityFilter = False
00223 process.AlignmentTrackSelector.maxMultiplicity = 1
00224 process.AlignmentTrackSelector.applyNHighestPt = False
00225 process.AlignmentTrackSelector.nHighestPt = 1
00226 process.AlignmentTrackSelector.seedOnlyFrom = 0 
00227 process.AlignmentTrackSelector.applyIsolationCut = False
00228 process.AlignmentTrackSelector.minHitIsolation = 0.8
00229 process.AlignmentTrackSelector.applyChargeCheck = False
00230 process.AlignmentTrackSelector.minHitChargeStrip = 50.
00231 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
00232 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
00233 
00234 ##### For Hits:
00235 process.TrackerTrackHitFilter.useTrajectories= True  # this is needed only if you require some selections; but it will work even if you don't ask for them
00236 process.TrackerTrackHitFilter.minimumHits = 8
00237 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
00238 process.TrackerTrackHitFilter.detsToIgnore = [
00239      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
00240     # TIB / TID
00241     #369136710, 369136714, 402668822,
00242     # TOB
00243     #436310989, 436310990, 436299301, 436299302,
00244     # TEC
00245     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
00246 ]
00247 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
00248 process.TrackerTrackHitFilter.stripAllInvalidHits = False
00249 process.TrackerTrackHitFilter.rejectBadStoNHits = True
00250 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 12.0")
00251 process.TrackerTrackHitFilter.rejectLowAngleHits= True
00252 process.TrackerTrackHitFilter.TrackAngleCut= 0.17 # in rads, starting from the module surface
00253 process.TrackerTrackHitFilter.usePixelQualityFlag= True
00254 
00255 ##############
00256 ##Trigger sequence
00257 #############
00258 #for MC only trigger bit 40 is simulated
00259 #no triger on bunch crossing bit 0
00260 
00261 
00262 process.triggerSelection=cms.Sequence(process.bit40)
00263 
00264 """
00265 
00266 intoNTuplesTemplate="""
00267 import FWCore.ParameterSet.Config as cms
00268 
00269 process = cms.Process("ValidationIntoNTuples")
00270 
00271 # global tag
00272 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00273 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." 
00274 
00275 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
00276 process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
00277 process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
00278 
00279 #process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
00280 process.load("CondCore.DBCommon.CondDBSetup_cfi")
00281 
00282 process.MessageLogger = cms.Service("MessageLogger",
00283     destinations = cms.untracked.vstring('detailedInfo', 
00284         'cout')
00285 ) 
00286 
00287 #removed: APE
00288 #removed: dbLoad
00289 import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00290 process.GeomToComp = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone(
00291 connect = cms.string('.oO[dbpath]Oo.'),
00292 
00293     toGet = cms.VPSet(cms.PSet(
00294         record = cms.string('TrackerAlignmentRcd'),
00295         tag = cms.string('.oO[tag]Oo.')
00296     ))
00297    
00298 )
00299 process.es_prefer_geom=cms.ESPrefer("PoolDBESSource","GeomToComp")
00300 
00301 from CondCore.DBCommon.CondDBSetup_cfi import *
00302 
00303 process.ZeroAPE = cms.ESSource("PoolDBESSource",CondDBSetup,
00304                                                                 connect = cms.string('frontier://FrontierProd/CMS_COND_31X_FROM21X'),
00305                                                                 timetype = cms.string("runnumber"),
00306                                                                 toGet = cms.VPSet(
00307                                                                                         cms.PSet(
00308                                                                                                 record = cms.string('TrackerAlignmentErrorRcd'),
00309                                                                                                 tag = cms.string('TrackerIdealGeometryErrors210_mc')
00310                                                                                         ))
00311                                                                 )
00312 process.es_prefer_ZeroAPE = cms.ESPrefer("PoolDBESSource", "ZeroAPE")
00313 
00314 
00315 process.source = cms.Source("EmptySource")
00316 
00317 process.maxEvents = cms.untracked.PSet(
00318     input = cms.untracked.int32(1)
00319 )
00320 process.dump = cms.EDAnalyzer("TrackerGeometryIntoNtuples",
00321     outputFile = cms.untracked.string('.oO[workdir]Oo./.oO[alignmentName]Oo.ROOTGeometry.root'),
00322     outputTreename = cms.untracked.string('alignTree')
00323 )
00324 
00325 process.p = cms.Path(process.dump)  
00326 """
00327 
00328 compareTemplate="""
00329 import FWCore.ParameterSet.Config as cms
00330 
00331 process = cms.Process("validation")
00332 
00333 # global tag
00334 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00335 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." 
00336 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cff")
00337 
00338 process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
00339 
00340 process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
00341 
00342 #process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
00343 # the input .GlobalPosition_Frontier_cff is providing the frontier://FrontierProd/CMS_COND_31X_ALIGNMENT in the release which does not provide the ideal geometry
00344 #process.GlobalPosition.connect = 'frontier://FrontierProd/CMS_COND_31X_FROM21X'
00345 
00346 process.load("CondCore.DBCommon.CondDBSetup_cfi")
00347 
00348 process.MessageLogger = cms.Service("MessageLogger",
00349     destinations = cms.untracked.vstring('detailedInfo', 
00350         'cout')
00351 )
00352 
00353 process.source = cms.Source("EmptySource")
00354 
00355 process.maxEvents = cms.untracked.PSet(
00356     input = cms.untracked.int32(1)
00357 )
00358 
00359   # configuration of the Tracker Geometry Comparison Tool
00360   # Tracker Geometry Comparison
00361 process.load("Alignment.OfflineValidation.TrackerGeometryCompare_cfi")
00362   # the input "IDEAL" is special indicating to use the ideal geometry of the release
00363 
00364 process.TrackerGeometryCompare.inputROOTFile1 = '.oO[referenceGeometry]Oo.'
00365 process.TrackerGeometryCompare.inputROOTFile2 = '.oO[comparedGeometry]Oo.'
00366 process.TrackerGeometryCompare.outputFile = ".oO[workdir]Oo./.oO[name]Oo..Comparison_common.oO[common]Oo..root"
00367 process.TrackerGeometryCompare.levels = [ .oO[levels]Oo. ]
00368 
00369   ##FIXME!!!!!!!!!
00370   ##replace TrackerGeometryCompare.writeToDB = .oO[dbOutput]Oo.
00371   ##removed: dbOutputService
00372 
00373 process.p = cms.Path(process.TrackerGeometryCompare)
00374 """
00375   
00376 dbOutputTemplate= """
00377 //_________________________ db Output ____________________________
00378         # setup for writing out to DB
00379         include "CondCore/DBCommon/data/CondDBSetup.cfi"
00380 #       include "CondCore/DBCommon/data/CondDBCommon.cfi"
00381 
00382     service = PoolDBOutputService {
00383         using CondDBSetup
00384         VPSet toPut = {
00385             { string record = "TrackerAlignmentRcd"  string tag = ".oO[tag]Oo." },
00386             { string record = "TrackerAlignmentErrorRcd"  string tag = ".oO[errortag]Oo." }
00387         }
00388                 string connect = "sqlite_file:.oO[workdir]Oo./.oO[name]Oo.Common.oO[common]Oo..db"
00389                 # untracked string catalog = "file:alignments.xml"
00390         untracked string timetype = "runnumber"
00391     }
00392 """
00393 
00394 dbLoadTemplate="""
00395 #from CondCore.DBCommon.CondDBSetup_cfi import *
00396 from CalibTracker.Configuration.Common.PoolDBESSource_cfi import poolDBESSource
00397 ##include private db object
00398 ##
00399 import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00400 process.trackerAlignment =  CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone(
00401                                         connect = cms.string('.oO[dbpath]Oo.'),
00402                                         timetype = cms.string("runnumber"),
00403                                         toGet = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentRcd'),
00404                                                                    tag = cms.string('.oO[tag]Oo.')
00405                                                                    ))
00406                                         )
00407 process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource", "trackerAlignment")
00408 
00409 """
00410 
00411 APETemplate="""
00412 from CondCore.DBCommon.CondDBSetup_cfi import *
00413 process.APE = poolDBESSource.clone(
00414                                         connect = cms.string('.oO[errordbpath]Oo.'),
00415                                         timetype = cms.string("runnumber"),
00416                                         toGet = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentErrorRcd'),
00417                                                                    tag = cms.string('.oO[errortag]Oo.')
00418                                                                    ))
00419                                         )
00420 process.es_prefer_APE = cms.ESPrefer("PoolDBESSource", "APE")
00421 """
00422 
00423 
00424 
00425 #batch job execution
00426 scriptTemplate="""
00427 #!/bin/bash
00428 #init
00429 ulimit -v 3072000
00430 export STAGE_SVCCLASS=cmscafuser
00431 source /afs/cern.ch/cms/sw/cmsset_default.sh
00432 cd .oO[CMSSW_BASE]Oo./src
00433 eval `scramv1 ru -sh`
00434 rfmkdir -p .oO[workdir]Oo.
00435 rfmkdir -p .oO[datadir]Oo.
00436 
00437 rm -f .oO[workdir]Oo./*
00438 cd .oO[workdir]Oo.
00439 
00440 #run
00441 pwd
00442 df -h .
00443 .oO[CommandLine]Oo.
00444 echo "----"
00445 echo "List of files in $(pwd):"
00446 ls -ltr
00447 echo "----"
00448 echo ""
00449 
00450 
00451 #retrive
00452 rfmkdir -p .oO[logdir]Oo.
00453 gzip LOGFILE_*_.oO[name]Oo..log
00454 find .oO[workdir]Oo. -maxdepth 1 -name "LOGFILE*.oO[alignmentName]Oo.*" -print | xargs -I {} bash -c "rfcp {} .oO[logdir]Oo."
00455 rfmkdir -p .oO[datadir]Oo.
00456 find .oO[workdir]Oo. -maxdepth 1 -name "*.oO[alignmentName]Oo.*.root" -print | xargs -I {} bash -c "rfcp {} .oO[datadir]Oo."
00457 #cleanup
00458 rm -rf .oO[workdir]Oo.
00459 echo "done."
00460 """
00461 
00462 mergeTemplate="""
00463 #!/bin/bash
00464 #init
00465 export STAGE_SVCCLASS=cmscafuser
00466 source /afs/cern.ch/cms/sw/cmsset_default.sh
00467 cd .oO[CMSSW_BASE]Oo./src
00468 eval `scramv1 ru -sh`
00469 rfmkdir -p .oO[workdir]Oo.
00470 cd .oO[workdir]Oo.
00471 
00472 #run
00473 .oO[DownloadData]Oo.
00474 .oO[CompareAllignments]Oo.
00475 
00476 find ./ -maxdepth 1 -name "*_result.root" -print | xargs -I {} bash -c "rfcp {} .oO[datadir]Oo."
00477 
00478 .oO[RunExtendedOfflineValidation]Oo.
00479 
00480 #zip stdout and stderr from the farm jobs
00481 gzip .oO[logdir]Oo./*.stderr
00482 gzip .oO[logdir]Oo./*.stdout
00483 
00484 """
00485 
00486 compareAlignmentsExecution="""
00487 #merge for .oO[validationId]Oo.
00488 root -q -b '.oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation/scripts/compareAlignments.cc+(\".oO[compareStrings]Oo.\")'
00489 mv result.root .oO[validationId]Oo._result.root
00490 """
00491 
00492 extendedVaidationExecution="""
00493 #run extended offline validation scripts
00494 rfmkdir -p .oO[workdir]Oo./ExtendedOfflineValidation_Images
00495 root -x -b -q .oO[extendeValScriptPath]Oo.
00496 rfmkdir -p .oO[datadir]Oo./ExtendedOfflineValidation_Images
00497 find .oO[workdir]Oo./ExtendedOfflineValidation_Images -maxdepth 1 -name \"*ps\" -print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo./ExtendedOfflineValidation_Images\"
00498 """
00499 
00500 extendedVaidationTemplate="""
00501 void TkAlExtendedOfflineValidation()
00502 {
00503   // load framework lite just to find the CMSSW libs...
00504   gSystem->Load("libFWCoreFWLite");
00505   AutoLibraryLoader::enable();
00506   //compile the makro
00507   gROOT->ProcessLine(".L .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C++");
00508 
00509   .oO[extendedInstantiation]Oo.
00510   gROOT->ProcessLine(".mkdir -p .oO[workdir]Oo./ExtendedOfflineValidation_Images/");
00511   p.setOutputDir(".oO[workdir]Oo./ExtendedOfflineValidation_Images");
00512   p.setTreeBaseDir(".oO[OfflineTreeBaseDir]Oo.");
00513   p.plotDMR(".oO[DMRMethod]Oo.",.oO[DMRMinimum]Oo.);
00514 }
00515 """
00516 
00517 mcValidateTemplate="""
00518 import FWCore.ParameterSet.Config as cms
00519 
00520 process = cms.Process("TkVal")
00521 process.load("FWCore.MessageService.MessageLogger_cfi")
00522 process.MessageLogger = cms.Service("MessageLogger",
00523     destinations = cms.untracked.vstring('LOGFILE_McValidate_.oO[name]Oo.', 
00524         'cout')
00525 )
00526 
00527 ### standard includes
00528 process.load('Configuration/StandardSequences/GeometryPilot2_cff')
00529 process.load("Configuration.StandardSequences.RawToDigi_cff")
00530 process.load("Configuration.EventContent.EventContent_cff")
00531 process.load("Configuration.StandardSequences.Reconstruction_cff")
00532 process.load("Configuration.StandardSequences.MagneticField_cff")
00533 process.load("SimGeneral.MixingModule.mixNoPU_cfi")
00534 
00535 ### conditions
00536 process.load("Alignment.OfflineValidation.GlobalTag_cff")
00537 process.GlobalTag.globaltag = '.oO[GlobalTag]Oo.'
00538 
00539 import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00540 
00541 .oO[dbLoad]Oo.
00542 
00543 ### validation-specific includes
00544 process.load("SimTracker.TrackAssociation.TrackAssociatorByHits_cfi")
00545 process.load("Validation.RecoTrack.cuts_cff")
00546 process.load("Validation.RecoTrack.MultiTrackValidator_cff")
00547 process.load("SimGeneral.TrackingAnalysis.trackingParticles_cfi")
00548 
00549 ### configuration MultiTrackValidator ###
00550 process.multiTrackValidator.outputFile = '.oO[outputFile]Oo.'
00551 
00552 process.multiTrackValidator.associators = ['TrackAssociatorByHits']
00553 process.multiTrackValidator.UseAssociators = cms.bool(True)
00554 process.multiTrackValidator.label = ['generalTracks']
00555 
00556 from Alignment.OfflineValidation..oO[RelValSample]Oo._cff import readFiles
00557 from Alignment.OfflineValidation..oO[RelValSample]Oo._cff import secFiles
00558 source = cms.Source ("PoolSource",
00559     fileNames = readFiles,
00560     secondaryFileNames = secFiles,
00561     inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
00562 )
00563 
00564 process.maxEvents = cms.untracked.PSet(
00565     input = cms.untracked.int32(.oO[nEvents]Oo.)
00566 )
00567 
00568 process.options = cms.untracked.PSet(
00569     wantSummary = cms.untracked.bool(False),
00570     Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00571     fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00572 )
00573 
00574 process.source = source
00575 
00576 process.re_tracking_and_TP = cms.Sequence(process.mix*process.trackingParticles*
00577                                    process.siPixelRecHits*process.siStripMatchedRecHits*
00578                                    process.ckftracks*
00579                                    process.cutsRecoTracks*
00580                                    process.multiTrackValidator
00581                                    )
00582 
00583 process.re_tracking = cms.Sequence(process.siPixelRecHits*process.siStripMatchedRecHits*
00584                                    process.ckftracks*
00585                                    process.cutsRecoTracks*
00586                                    process.multiTrackValidator
00587                                    )
00588 
00589 ### final path and endPath
00590 process.p = cms.Path(process.re_tracking)
00591 """
00592 
00593 TrackSplittingTemplate="""
00594 import FWCore.ParameterSet.Config as cms
00595 
00596 process = cms.Process("splitter")
00597 
00598 # CMSSW.2.2.3
00599 
00600 # message logger
00601 process.load("FWCore.MessageLogger.MessageLogger_cfi")
00602 MessageLogger = cms.Service("MessageLogger",
00603     destinations = cms.untracked.vstring('LOGFILE_TrackSplitting_.oO[name]Oo.', 
00604         'cout')
00605 )
00606 ## report only every 100th record
00607 process.MessageLogger.cerr.FwkReport.reportEvery = 100
00608 
00609 process.load('Configuration.StandardSequences.Services_cff')
00610 process.load('Configuration.StandardSequences.Geometry_cff')
00611 
00612 # including global tag
00613 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cfi")
00614 # setting global tag
00615 #process.GlobalTag.connect = "frontier://FrontierProd/CMS_COND_21X_GLOBALTAG"
00616 process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
00617 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
00618 
00619 
00620 ###########################################
00621 ##necessary fix for the moment to avoid
00622 ##Assymmetric forward layers in TrackerException going through path p
00623 ##---- ScheduleExecutionFailure END
00624 ##an exception occurred during current event processing
00625 ##cms::Exception caught in EventProcessor and rethrown
00626 ##---- EventProcessorFailure END
00627 ############################################
00628 #import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00629 from CondCore.DBCommon.CondDBSetup_cfi import *
00630 #load the Global Position Rcd
00631 process.globalPosition = cms.ESSource("PoolDBESSource", CondDBSetup,
00632                                   toGet = cms.VPSet(cms.PSet(
00633                                           record =cms.string('GlobalPositionRcd'),
00634                                           tag= cms.string('IdealGeometry')
00635                                           )),
00636                                   connect = cms.string('frontier://FrontierProd/CMS_COND_31X_FROM21X')
00637                                   )
00638 process.es_prefer_GPRcd = cms.ESPrefer("PoolDBESSource","globalPosition")
00639 ########################################## 
00640 
00641 
00642 # track selectors and refitting
00643 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
00644 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
00645 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
00646 
00647 # including data...
00648 process.load("Alignment.OfflineValidation..oO[superPointingDataset]Oo._cff")
00649 
00650 ## for craft SP skim v5
00651 process.source.inputCommands = cms.untracked.vstring("keep *","drop *_*_*_FU","drop *_*_*_HLT","drop *_MEtoEDMConverter_*_*","drop *_lumiProducer_*_REPACKER")
00652 process.source.dropDescendantsOfDroppedBranches = cms.untracked.bool( False )
00653 
00654 
00655 process.maxEvents = cms.untracked.PSet(
00656     input = cms.untracked.int32(.oO[nEvents]Oo.)
00657 )
00658 
00659 
00660 # magnetic field
00661 process.load("Configuration.StandardSequences.MagneticField_38T_cff")
00662 
00663 # adding geometries
00664 from CondCore.DBCommon.CondDBSetup_cfi import *
00665 
00666 # for craft
00667 ## tracker alignment for craft...............................................................
00668 .oO[dbLoad]Oo.
00669 
00670 .oO[APE]Oo.
00671 
00672 ## track hit filter.............................................................
00673 
00674 # refit tracks first
00675 import RecoTracker.TrackProducer.TrackRefitters_cff
00676 process.TrackRefitter1 = RecoTracker.TrackProducer.TrackRefitterP5_cfi.TrackRefitterP5.clone(
00677       src = '.oO[TrackCollection]Oo.',
00678       TrajectoryInEvent = True,
00679       TTRHBuilder = "WithTrackAngle",
00680       NavigationSchool = ""
00681       )
00682       
00683 process.FittingSmootherRKP5.EstimateCut = -1
00684 
00685 # module configuration
00686 # alignment track selector
00687 process.AlignmentTrackSelector.src = "TrackRefitter1"
00688 process.AlignmentTrackSelector.filter = True
00689 process.AlignmentTrackSelector.applyBasicCuts = True
00690 process.AlignmentTrackSelector.ptMin   = 0.
00691 process.AlignmentTrackSelector.pMin   = 4.      
00692 process.AlignmentTrackSelector.ptMax   = 9999.  
00693 process.AlignmentTrackSelector.pMax   = 9999.   
00694 process.AlignmentTrackSelector.etaMin  = -9999.
00695 process.AlignmentTrackSelector.etaMax  = 9999.
00696 process.AlignmentTrackSelector.nHitMin = 10
00697 process.AlignmentTrackSelector.nHitMin2D = 2
00698 process.AlignmentTrackSelector.minHitsPerSubDet.inBPIX=4 ##skip tracks not passing the pixel
00699 process.AlignmentTrackSelector.chi2nMax = 9999.
00700 process.AlignmentTrackSelector.applyMultiplicityFilter = True
00701 process.AlignmentTrackSelector.maxMultiplicity = 1
00702 process.AlignmentTrackSelector.applyNHighestPt = False
00703 process.AlignmentTrackSelector.nHighestPt = 1
00704 process.AlignmentTrackSelector.seedOnlyFrom = 0 
00705 process.AlignmentTrackSelector.applyIsolationCut = False
00706 process.AlignmentTrackSelector.minHitIsolation = 0.8
00707 process.AlignmentTrackSelector.applyChargeCheck = False
00708 process.AlignmentTrackSelector.minHitChargeStrip = 50.
00709 process.AlignmentTrackSelector.minHitsPerSubDet.inBPIX = 2
00710 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
00711 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
00712 process.KFFittingSmootherWithOutliersRejectionAndRK.EstimateCut=30.0
00713 process.KFFittingSmootherWithOutliersRejectionAndRK.MinNumberOfHits=4
00714 #process.FittingSmootherRKP5.EstimateCut = 20.0
00715 #process.FittingSmootherRKP5.MinNumberOfHits = 4
00716 
00717 # configuration of the track spitting module
00718 # new cuts allow for cutting on the impact parameter of the original track
00719 process.load("RecoTracker.FinalTrackSelectors.cosmicTrackSplitter_cfi")
00720 process.cosmicTrackSplitter.tracks = 'AlignmentTrackSelector'
00721 process.cosmicTrackSplitter.tjTkAssociationMapTag = 'TrackRefitter1'
00722 #process.cosmicTrackSplitter.excludePixelHits = False
00723 
00724 #---------------------------------------------------------------------
00725 # the output of the track hit filter are track candidates
00726 # give them to the TrackProducer
00727 process.load("RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff")
00728 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
00729      src = 'cosmicTrackSplitter',
00730      TrajectoryInEvent = True,
00731      TTRHBuilder = "WithTrackAngle"
00732 )
00733 # second refit
00734 process.TrackRefitter2 = process.TrackRefitter1.clone(
00735          src = 'HitFilteredTracks'
00736          )
00737 
00738 ### Now adding the construction of global Muons
00739 # what Chang did...
00740 process.load("Configuration.StandardSequences.ReconstructionCosmics_cff")
00741 
00742 process.cosmicValidation = cms.EDFilter("CosmicSplitterValidation",
00743         ifSplitMuons = cms.bool(False),
00744         ifTrackMCTruth = cms.bool(False),       
00745         checkIfGolden = cms.bool(False),        
00746     splitTracks = cms.InputTag("TrackRefitter2","","splitter"),
00747         splitGlobalMuons = cms.InputTag("muons","","splitter"),
00748         originalTracks = cms.InputTag("TrackRefitter1","","splitter"),
00749         originalGlobalMuons = cms.InputTag("muons","","Rec")
00750 )
00751 
00752 process.TFileService = cms.Service("TFileService",
00753     fileName = cms.string('.oO[outputFile]Oo.')
00754 )
00755 
00756 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.AlignmentTrackSelector*process.cosmicTrackSplitter*process.HitFilteredTracks*process.TrackRefitter2*process.cosmicValidation)
00757 """
00758 
00759 ###
00760 #                 Alternate Templates
00761 ###
00762 
00763 def alternateTemplate( templateName, alternateTemplateName ):
00764    
00765     if not templateName in globals().keys():
00766         raise StandardError, "unkown template to replace %s"%templateName
00767     if not alternateTemplateName in globals().keys():
00768         raise StandardError, "unkown template to replace %s"%alternateTemplateName
00769     globals()[ templateName ] = globals()[ alternateTemplateName ]
00770     # = eval("configTemplates.%s"%"alternateTemplate")
00771 
00772 
00773 LorentzAngleForDECO="""
00774 process.stripLorentzAngle = cms.ESSource("PoolDBESSource",
00775 #  CondDBSetup,
00776  DBParameters = cms.PSet(
00777            messageLevel = cms.untracked.int32(2),
00778                      authenticationPath =
00779                      cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
00780                            ),
00781   connect = cms.string('sqlite_file:/afs/cern.ch/user/b/benhoob/public/LorentzAngle/SiStripLorentzAngle_Deco.db'),
00782   toGet = cms.VPSet(cms.PSet(record = cms.string('SiStripLorentzAngleRcd'),
00783   tag = cms.string('SiStripLorentzAngle_Deco') ))
00784   )
00785 
00786 process.es_prefer_stripLorentzAngle = cms.ESPrefer("PoolDBESSource", "stripLorentzAngle")
00787 """
00788 ###
00789 otherTemplate = """
00790 schum schum
00791 """
00792 
00793 yResidualsOfflineValidation="""
00794 import FWCore.ParameterSet.Config as cms
00795 
00796 process = cms.Process("OfflineValidator") 
00797    
00798 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
00799 
00800 process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
00801 process.options = cms.untracked.PSet(
00802    wantSummary = cms.untracked.bool(False),
00803    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00804    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00805 )
00806 
00807  ##
00808  ## Maximum number of Events
00809  ## 
00810 process.maxEvents = cms.untracked.PSet(
00811     input = cms.untracked.int32(.oO[nEvents]Oo.)
00812  )
00813 
00814  ##   
00815  ## Messages & Convenience
00816  ##
00817 process.load("FWCore.MessageLogger.MessageLogger_cfi")
00818 process.MessageLogger = cms.Service("MessageLogger",
00819     destinations = cms.untracked.vstring('LOGFILE_Offline_.oO[name]Oo.', 
00820         'cout')
00821 )
00822 
00823  ## report only every 100th record
00824  ##process.MessageLogger.cerr.FwkReport.reportEvery = 100
00825 
00826     
00827  ##
00828  ## Alignment Track Selection
00829  ##
00830 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
00831 process.AlignmentTrackSelector.src = 'TrackRefitter1'
00832 process.AlignmentTrackSelector.filter = True
00833 process.AlignmentTrackSelector.applyBasicCuts = True
00834 process.AlignmentTrackSelector.pMin    = 4.
00835 process.AlignmentTrackSelector.pMax    = 9999.
00836 process.AlignmentTrackSelector.ptMin   = 0.
00837 process.AlignmentTrackSelector.ptMax   = 9999.
00838 process.AlignmentTrackSelector.etaMin  = -999.
00839 process.AlignmentTrackSelector.etaMax  = 999.
00840 process.AlignmentTrackSelector.nHitMin = 8
00841 process.AlignmentTrackSelector.nHitMin2D = 2
00842 process.AlignmentTrackSelector.chi2nMax = 999.
00843 process.AlignmentTrackSelector.applyMultiplicityFilter = False
00844 process.AlignmentTrackSelector.maxMultiplicity = 1
00845 process.AlignmentTrackSelector.applyNHighestPt = False
00846 process.AlignmentTrackSelector.nHighestPt = 1
00847 process.AlignmentTrackSelector.seedOnlyFrom = 0 
00848 process.AlignmentTrackSelector.applyIsolationCut = False
00849 process.AlignmentTrackSelector.minHitIsolation = 0.8
00850 process.AlignmentTrackSelector.applyChargeCheck = False
00851 process.AlignmentTrackSelector.minHitChargeStrip = 50.
00852 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
00853 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
00854 
00855 ####  new FILTER
00856 #-- new track hit filter
00857 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
00858 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
00859 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
00860 process.TrackerTrackHitFilter.useTrajectories= True  # this is needed only if you require some selections; but it will work even if you don't ask for them
00861 process.TrackerTrackHitFilter.minimumHits = 8
00862 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
00863 process.TrackerTrackHitFilter.detsToIgnore = [
00864      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
00865     # TIB / TID
00866     369136710, 369136714, 402668822,
00867     # TOB
00868     436310989, 436310990, 436299301, 436299302,
00869     # TEC
00870     470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
00871 ]
00872 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
00873 process.TrackerTrackHitFilter.stripAllInvalidHits = False
00874 process.TrackerTrackHitFilter.rejectBadStoNHits = True
00875 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 14.0")
00876 process.TrackerTrackHitFilter.rejectLowAngleHits= True
00877 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
00878 process.TrackerTrackHitFilter.usePixelQualityFlag= True
00879 
00880 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
00881 import RecoTracker.TrackProducer.CosmicFinalFitWithMaterialP5_cff
00882 process.HitFilteredTracks = RecoTracker.TrackProducer.CosmicFinalFitWithMaterialP5_cff.cosmictrackfinderP5.clone(
00883     src = 'TrackerTrackHitFilter'
00884 )
00885 
00886  ##
00887  ## Load and Configure TrackRefitter1
00888  ##
00889 
00890 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
00891 
00892 process.TrackRefitter1 = RecoTracker.TrackProducer.TrackRefitterP5_cfi.TrackRefitterP5.clone(
00893   src = '.oO[TrackCollection]Oo.',
00894   TrajectoryInEvent = True,
00895   TTRHBuilder = "WithTrackAngle",
00896   NavigationSchool = ""
00897 )
00898 
00899 process.TrackRefitter2 = process.TrackRefitter1.clone(
00900     src = 'HitFilteredTracks')
00901 
00902 
00903  ##
00904  ## Get the BeamSpot
00905  ##
00906 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
00907  
00908  ##
00909  ## GlobalTag Conditions (if needed)
00910  ##
00911 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00912 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
00913 #process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_21X_GLOBALTAG"
00914 process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
00915 
00916 ## LAYERWISE Lorentz Angle ###################
00917 
00918 process.SiStripLorentzAngle = cms.ESSource("PoolDBESSource",
00919      BlobStreamerName = 
00920 cms.untracked.string('TBufferBlobStreamingService'),
00921      DBParameters = cms.PSet(
00922          messageLevel = cms.untracked.int32(2),
00923          authenticationPath = 
00924 cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
00925      ),
00926      timetype = cms.string('runnumber'),
00927      toGet = cms.VPSet(cms.PSet(
00928          record = cms.string('SiStripLorentzAngleRcd'),
00929         tag = cms.string('SiStripLA_CRAFT_layers')
00930      )),
00931      connect = cms.string('sqlite_file:/afs/cern.ch/user/j/jdraeger/public/LA_object/LA_CRAFT_layers.db')
00932 )
00933 process.es_prefer_SiStripLorentzAngle = cms.ESPrefer("PoolDBESSource","SiStripLorentzAngle")
00934   
00935  ##
00936  ## Geometry
00937  ##
00938 process.load("Configuration.StandardSequences.Geometry_cff")
00939  
00940  ##
00941  ## Magnetic Field
00942  ##
00943 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
00944 
00945 .oO[APE]Oo.
00946 
00947 .oO[dbLoad]Oo.
00948 
00949 ## to apply misalignments
00950 #TrackerDigiGeometryESModule.applyAlignment = True
00951    
00952  ##
00953  ## Load and Configure OfflineValidation
00954  ##
00955 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
00956 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
00957 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
00958 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
00959 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..stripYResiduals = True
00960 .oO[offlineValidationFileOutput]Oo.
00961 
00962  ##
00963  ## PATH
00964  ##
00965 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
00966                      *process.TrackRefitter2*process.AlignmentTrackSelector*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
00967 
00968 """
00969 
00970 zeroAPETemplate="""
00971 from CondCore.DBCommon.CondDBSetup_cfi import *
00972 process.APE = cms.ESSource("PoolDBESSource",CondDBSetup,
00973                                         connect = cms.string('frontier://FrontierProd/CMS_COND_31X_FROM21X'),
00974                                         timetype = cms.string("runnumber"),
00975                                         toGet = cms.VPSet(
00976                                                           cms.PSet(record = cms.string('TrackerAlignmentErrorRcd'),
00977                                                                    tag = cms.string('TrackerIdealGeometryErrors210_mc')
00978                                                                    ))
00979                                         )
00980 process.es_prefer_APE = cms.ESPrefer("PoolDBESSource", "APE")
00981 """
00982 
00983 CosmicsOfflineValidation="""
00984 import FWCore.ParameterSet.Config as cms
00985 
00986 process = cms.Process("OfflineValidator") 
00987    
00988 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
00989 
00990 #process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
00991 process.options = cms.untracked.PSet(
00992    wantSummary = cms.untracked.bool(False),
00993    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00994    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00995 )
00996 
00997  ##
00998  ## Maximum number of Events
00999  ## 
01000 process.maxEvents = cms.untracked.PSet(
01001     input = cms.untracked.int32(.oO[nEvents]Oo.)
01002  )
01003 
01004  ##   
01005  ## Messages & Convenience
01006  ##
01007 process.load("FWCore.MessageLogger.MessageLogger_cfi")
01008 process.MessageLogger.cerr = cms.untracked.PSet(placeholder = cms.untracked.bool(True))
01009 process.MessageLogger.cout = cms.untracked.PSet(INFO = cms.untracked.PSet(
01010 reportEvery = cms.untracked.int32(1000) # every 1000th only
01011 #    limit = cms.untracked.int32(10)       # or limit to 10 printouts...
01012 ))
01013 process.MessageLogger.statistics.append('cout')
01014 
01015 
01016 #-- Track hit filter
01017 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
01018 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
01019 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
01020 
01021 
01022 
01023 #-- Alignment Track Selection
01024 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
01025 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
01026 process.AlignmentTrackSelector.filter = True
01027 
01028 .oO[TrackSelectionTemplate]Oo.
01029 
01030 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
01031 import RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff
01032 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
01033     src = 'TrackerTrackHitFilter',
01034 ###    TrajectoryInEvent = True,
01035      NavigationSchool = '',
01036     TTRHBuilder = "WithAngleAndTemplate"    
01037 )
01038 
01039  ##
01040  ## Load and Configure TrackRefitter1
01041  ##
01042 
01043 
01044 #############
01045 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
01046 
01047 process.TrackRefitter1 = process.TrackRefitterP5.clone(
01048     src = 'ALCARECOTkAlCosmicsCTF0T',
01049     TrajectoryInEvent = True,
01050      NavigationSchool = '',
01051     TTRHBuilder = "WithAngleAndTemplate"
01052 )
01053 process.TrackRefitter2 = process.TrackRefitter1.clone(
01054     src = 'AlignmentTrackSelector',
01055    
01056     )
01057 
01058 
01059  ##
01060  ## Get the BeamSpot
01061  ##
01062 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
01063  
01064  ##
01065  ## GlobalTag Conditions (if needed)
01066  ##
01067 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
01068 process.GlobalTag.connect = "frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
01069 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
01070 
01071 
01072 .oO[LorentzAngleTemplate]Oo.
01073   
01074  ##
01075  ## Geometry
01076  ##
01077 process.load("Configuration.StandardSequences.Geometry_cff")
01078  
01079  ##
01080  ## Magnetic Field
01081  ##
01082 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
01083 
01084 .oO[dbLoad]Oo.
01085 
01086 .oO[APE]Oo.
01087 
01088 ## to apply misalignments
01089 #TrackerDigiGeometryESModule.applyAlignment = True
01090    
01091  ##
01092  ## Load and Configure OfflineValidation
01093  ##
01094 
01095 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
01096 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
01097 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
01098 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
01099 process.TFileService.fileName = '.oO[outputFile]Oo.'
01100 
01101  ##
01102  ## PATH
01103  ##
01104 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
01105                      *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
01106 
01107 
01108 """
01109 
01110 
01111 CosmicsAt0TOfflineValidation="""
01112 import FWCore.ParameterSet.Config as cms
01113 
01114 process = cms.Process("OfflineValidator") 
01115    
01116 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
01117 
01118 #process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
01119 process.options = cms.untracked.PSet(
01120    wantSummary = cms.untracked.bool(False),
01121    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
01122    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
01123 )
01124 
01125  ##
01126  ## Maximum number of Events
01127  ## 
01128 process.maxEvents = cms.untracked.PSet(
01129     input = cms.untracked.int32(.oO[nEvents]Oo.)
01130  )
01131 
01132  ##   
01133  ## Messages & Convenience
01134  ##
01135 process.load("FWCore.MessageLogger.MessageLogger_cfi")
01136 process.MessageLogger.cerr = cms.untracked.PSet(placeholder = cms.untracked.bool(True))
01137 process.MessageLogger.cout = cms.untracked.PSet(INFO = cms.untracked.PSet(
01138 reportEvery = cms.untracked.int32(1000) # every 1000th only
01139 #    limit = cms.untracked.int32(10)       # or limit to 10 printouts...
01140 ))
01141 process.MessageLogger.statistics.append('cout')
01142 
01143 
01144 #-- Track hit filter
01145 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
01146 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
01147 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
01148 
01149 #-- Alignment Track Selection
01150 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
01151 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
01152 process.AlignmentTrackSelector.filter = True
01153 
01154 .oO[TrackSelectionTemplate]Oo.
01155 # Override the pmin setting since not meaningful with B=0T
01156 process.AlignmentTrackSelector.pMin    = 4.
01157 
01158 #### momentum constraint for 0T
01159 # First momentum constraint
01160 process.load("RecoTracker.TrackProducer.MomentumConstraintProducer_cff")
01161 import RecoTracker.TrackProducer.MomentumConstraintProducer_cff
01162 process.AliMomConstraint1 = RecoTracker.TrackProducer.MomentumConstraintProducer_cff.MyMomConstraint.clone()
01163 process.AliMomConstraint1.src = '.oO[TrackCollection]Oo.'
01164 process.AliMomConstraint1.fixedMomentum = 5.0
01165 process.AliMomConstraint1.fixedMomentumError = 0.005
01166 
01167 # Second momentum constraint
01168 #process.load("RecoTracker.TrackProducer.MomentumConstraintProducer_cff")
01169 #import RecoTracker.TrackProducer.MomentumConstraintProducer_cff
01170 #process.AliMomConstraint2 = RecoTracker.TrackProducer.MomentumConstraintProducer_cff.MyMomConstraint.clone()
01171 #process.AliMomConstraint2.src = 'AlignmentTrackSelector'
01172 #process.AliMomConstraint2.fixedMomentum = 5.0
01173 #process.AliMomConstraint2.fixedMomentumError = 0.005
01174    
01175 
01176 
01177 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
01178 import RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff
01179 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
01180     src = 'TrackerTrackHitFilter'
01181 ###    ,
01182 ###    TrajectoryInEvent = True,
01183 ###    TTRHBuilder = "WithAngleAndTemplate"    
01184 )
01185 
01186  ##
01187  ## Load and Configure TrackRefitter1
01188  ##
01189 
01190 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
01191 
01192 #############
01193 # parameters for TrackRefitter
01194 #process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff")
01195 import RecoTracker.TrackProducer.TrackRefitters_cff
01196 process.TrackRefitter1 = process.TrackRefitterP5.clone(
01197    src =  '.oO[TrackCollection]Oo.'#'AliMomConstraint1',
01198    TrajectoryInEvent = True,
01199    TTRHBuilder = "WithAngleAndTemplate",
01200    NavigationSchool = "",
01201    constraint = 'momentum', ### SPECIFIC FOR CRUZET
01202    srcConstr='AliMomConstraint1' ### SPECIFIC FOR CRUZET$works only with tag V02-10-02 TrackingTools/PatternTools / or CMSSW >=31X
01203 )
01204 
01205 process.TrackRefitter2 = process.TrackRefitter1.clone(
01206     src = 'AlignmentTrackSelector',
01207     srcConstr='AliMomConstraint1',
01208     constraint = 'momentum' ### SPECIFIC FOR CRUZET
01209 )
01210 
01211 
01212  ##
01213  ## Get the BeamSpot
01214  ##
01215 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
01216  
01217  ##
01218  ## GlobalTag Conditions (if needed)
01219  ##
01220 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
01221 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
01222 process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
01223 
01224 .oO[LorentzAngleTemplate]Oo.
01225   
01226  ##
01227  ## Geometry
01228  ##
01229 process.load("Configuration.StandardSequences.Geometry_cff")
01230  
01231  ##
01232  ## Magnetic Field
01233  ##
01234 #process.load("Configuration/StandardSequences/MagneticField_38T_cff")
01235 process.load("Configuration.StandardSequences.MagneticField_0T_cff") # 0T runs
01236 
01237 .oO[dbLoad]Oo.
01238 
01239 .oO[APE]Oo.
01240 
01241 ## to apply misalignments
01242 #TrackerDigiGeometryESModule.applyAlignment = True
01243    
01244  ##
01245  ## Load and Configure OfflineValidation
01246  ##
01247 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
01248 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
01249 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
01250 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
01251 process.TFileService.fileName = '.oO[outputFile]Oo.'
01252 
01253  ##
01254  ## PATH
01255  ##
01256 
01257 process.p = cms.Path(process.offlineBeamSpot*process.AliMomConstraint1*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
01258                      *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
01259 
01260 
01261 """
01262 TrackSelectionCosmicsData = """
01263 ##### For Tracks:
01264 process.AlignmentTrackSelector.applyBasicCuts = True
01265 # Note that pMin is overridden and set to zero in
01266 # the offlineTemplate0T
01267 process.AlignmentTrackSelector.pMin    = 4.
01268 process.AlignmentTrackSelector.pMax    = 9999.
01269 process.AlignmentTrackSelector.ptMin   = 0.
01270 process.AlignmentTrackSelector.ptMax   = 9999.
01271 process.AlignmentTrackSelector.etaMin  = -999.
01272 process.AlignmentTrackSelector.etaMax  = 999.
01273 process.AlignmentTrackSelector.nHitMin = 8
01274 process.AlignmentTrackSelector.nHitMin2D = 2
01275 process.AlignmentTrackSelector.chi2nMax = 999.
01276 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01277 process.AlignmentTrackSelector.maxMultiplicity = 1
01278 process.AlignmentTrackSelector.applyNHighestPt = False
01279 process.AlignmentTrackSelector.nHighestPt = 1
01280 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01281 process.AlignmentTrackSelector.applyIsolationCut = False
01282 process.AlignmentTrackSelector.minHitIsolation = 0.8
01283 process.AlignmentTrackSelector.applyChargeCheck = False
01284 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01285 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01286 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01287 
01288 ##### For Hits:
01289 process.TrackerTrackHitFilter.useTrajectories= True  # this is needed only if you require some selections; but it will work even if you don't ask for them
01290 process.TrackerTrackHitFilter.minimumHits = 8
01291 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01292 process.TrackerTrackHitFilter.detsToIgnore = [
01293      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01294     # TIB / TID
01295     #369136710, 369136714, 402668822,
01296     # TOB
01297     #436310989, 436310990, 436299301, 436299302,
01298     # TEC
01299     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01300 ]
01301 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01302 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01303 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01304 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
01305 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01306 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
01307 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01308 """
01309 
01310 TrackSelectionMinBiasData = """
01311 ##### For Tracks:collisions taken in deco mode
01312 
01313 process.AlignmentTrackSelector.applyBasicCuts = True
01314 # Note that pMin is overridden and set to zero in
01315 # the offlineTemplate0T
01316 process.AlignmentTrackSelector.pMin    = 3
01317 process.AlignmentTrackSelector.pMax    = 9999.
01318 process.AlignmentTrackSelector.ptMin   = 0.65
01319 process.AlignmentTrackSelector.ptMax   = 9999.
01320 process.AlignmentTrackSelector.etaMin  = -999.
01321 process.AlignmentTrackSelector.etaMax  = 999.
01322 process.AlignmentTrackSelector.nHitMin = 8
01323 process.AlignmentTrackSelector.nHitMin2D = 2
01324 process.AlignmentTrackSelector.chi2nMax = 999.
01325 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01326 process.AlignmentTrackSelector.maxMultiplicity = 1
01327 process.AlignmentTrackSelector.applyNHighestPt = False
01328 process.AlignmentTrackSelector.nHighestPt = 1
01329 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01330 process.AlignmentTrackSelector.applyIsolationCut = False
01331 process.AlignmentTrackSelector.minHitIsolation = 0.8
01332 process.AlignmentTrackSelector.applyChargeCheck = False
01333 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01334 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01335 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01336 
01337 ##### For Hits:
01338 process.TrackerTrackHitFilter.useTrajectories= True  # this is needed only if you require some selections; but it will work even if you don't ask for them
01339 process.TrackerTrackHitFilter.minimumHits = 8
01340 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01341 process.TrackerTrackHitFilter.detsToIgnore = [
01342      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01343     # TIB / TID
01344     #369136710, 369136714, 402668822,
01345     # TOB
01346     #436310989, 436310990, 436299301, 436299302,
01347     # TEC
01348     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01349 ]
01350 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01351 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01352 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01353 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 12.0")
01354 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01355 process.TrackerTrackHitFilter.TrackAngleCut= 0.17 # in rads, starting from the module surface
01356 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01357 
01358 ##############
01359 ##Trigger sequence
01360 #############
01361 #bit 0 is selecting bunch crossing
01362 #bit 40 MinBias trigger
01363 
01364 
01365 process.triggerSelection=cms.Sequence(process.bptxAnd*process.bit40)
01366 
01367 """