CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/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 ############################################################################
00075 ##Produce Primary Vertex Collection needed for later analysis
00076 ############################################################################
00077 #process.load('TrackingTools/TransientTrack/TransientTrackBuilder_cfi')
00078 #process.load("RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi")
00079 #process.offlinePrimaryVertices.TrackLabel = 'ALCARECOTkAlMinBias'
00080 
00081 process.oneGoodVertexFilter = cms.EDFilter("VertexSelector",
00082                                            src = cms.InputTag("offlinePrimaryVertices"),
00083                                            cut = cms.string("!isFake && ndof > 4 && abs(z) <= 15 && position.Rho <= 2"), # tracksSize() > 3 for the older cut
00084                                            filter = cms.bool(True),   # otherwise it won't filter the events, just produce an empty vertex collection.
00085                                            )
00086 
00087 
00088 
00089 process.FilterGoodEvents=cms.Sequence(#process.HighPuritySelector*
00090 process.oneGoodVertexFilter)
00091 
00092 
00093 process.noScraping= cms.EDFilter("FilterOutScraping",
00094                                  src=cms.InputTag("ALCARECOTkAlMinBias"),
00095                                  applyfilter = cms.untracked.bool(True),
00096                                  debugOn = cms.untracked.bool(False), ## Or 'True' to get some per-event info
00097                                  numtrack = cms.untracked.uint32(10),
00098                                  thresh = cms.untracked.double(0.25)
00099                                  )
00100 ####################################
00101 
00102 
00103 
00104 
00105 
00106 #-- Track hit filter
00107 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
00108 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
00109 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
00110 
00111 #-- Alignment Track Selection
00112 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
00113 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
00114 process.AlignmentTrackSelector.filter = True
00115 
00116 .oO[TrackSelectionTemplate]Oo.
00117 
00118 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
00119 import RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff
00120 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterial_cff.ctfWithMaterialTracks.clone(
00121    src = 'TrackerTrackHitFilter',
00122    NavigationSchool = "",
00123 
00124 ###    TrajectoryInEvent = True,
00125     TTRHBuilder = "WithAngleAndTemplate"    
00126 )
00127 
00128  ##
00129  ## Load and Configure TrackRefitter1
00130  ##
00131 
00132 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
00133 
00134 #############
00135 # parameters for TrackRefitter
00136 #process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff")
00137 import RecoTracker.TrackProducer.TrackRefitters_cff
00138 process.TrackRefitter1 = process.TrackRefitter.clone(
00139    src = 'HighPuritySelector',
00140    TrajectoryInEvent = True,
00141    TTRHBuilder = "WithAngleAndTemplate",
00142    NavigationSchool = ""
00143 )
00144 process.TrackRefitter2 = process.TrackRefitter1.clone(
00145 #    src = 'HitFilteredTracks')
00146      src = 'AlignmentTrackSelector'
00147 )
00148 
00149 
00150  ##
00151  ## Get the BeamSpot
00152  ##
00153 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
00154  
00155  ##
00156  ## GlobalTag Conditions (if needed)
00157  ##
00158 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00159 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
00160 
00161 
00162 .oO[LorentzAngleTemplate]Oo.
00163   
00164  ##
00165  ## Geometry
00166  ##
00167 process.load("Configuration.StandardSequences.Geometry_cff")
00168  
00169  ##
00170  ## Magnetic Field
00171  ##
00172 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
00173 
00174 .oO[dbLoad]Oo.
00175 
00176 .oO[APE]Oo.
00177 
00178 ## to apply misalignments
00179 #TrackerDigiGeometryESModule.applyAlignment = True
00180    
00181  ##
00182  ## Load and Configure OfflineValidation and Output File
00183  ##
00184 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
00185 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
00186 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
00187 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = .oO[offlineModuleLevelHistsTransient]Oo.
00188 .oO[offlineValidationFileOutput]Oo.
00189 
00190  ##
00191  ## PATH
00192  ##
00193 process.p = cms.Path(
00194 process.triggerSelection*
00195 process.offlineBeamSpot*process.HighPuritySelector*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
00196 *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
00197 
00198 """
00199 
00200 offlineStandaloneFileOutputTemplate = """
00201 process.TFileService.fileName = '.oO[outputFile]Oo.'
00202 """
00203 
00204 offlineDqmFileOutputTemplate = """
00205 process.TrackerOfflineValidationSummary.oO[offlineValidationMode]Oo..removeModuleLevelHists = .oO[offlineModuleLevelHistsTransient]Oo.
00206 process.DqmSaverTkAl.workflow = '.oO[workflow]Oo.'
00207 process.DqmSaverTkAl.dirName = '.oO[workdir]Oo./.'
00208 process.DqmSaverTkAl.forceRunNumber = .oO[firstRunNumber]Oo.
00209 """
00210 #offlineDqmFileOutputTemplate = """
00211 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..workflow =  .oO[workflow]Oo.
00212 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..dirName = .oO[workdir]Oo./.
00213 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..forceRunNumber = .oO[firstRunNumber]Oo.
00214 #"""
00215 
00216 
00217 LorentzAngleTemplate = "#use lorentz angle from global tag"
00218 
00219 TrackSelectionTemplate = """
00220 #####default for MC tracks with now further corrections etc.
00221 
00222 process.AlignmentTrackSelector.applyBasicCuts = True
00223 # Note that pMin is overridden and set to zero in
00224 # the offlineTemplate0T
00225 process.AlignmentTrackSelector.pMin    = 3
00226 process.AlignmentTrackSelector.pMax    = 9999.
00227 process.AlignmentTrackSelector.ptMin   = 0.65
00228 process.AlignmentTrackSelector.ptMax   = 9999.
00229 process.AlignmentTrackSelector.etaMin  = -999.
00230 process.AlignmentTrackSelector.etaMax  = 999.
00231 process.AlignmentTrackSelector.nHitMin = 8
00232 process.AlignmentTrackSelector.nHitMin2D = 2
00233 process.AlignmentTrackSelector.chi2nMax = 999.
00234 process.AlignmentTrackSelector.applyMultiplicityFilter = False
00235 process.AlignmentTrackSelector.maxMultiplicity = 1
00236 process.AlignmentTrackSelector.applyNHighestPt = False
00237 process.AlignmentTrackSelector.nHighestPt = 1
00238 process.AlignmentTrackSelector.seedOnlyFrom = 0 
00239 process.AlignmentTrackSelector.applyIsolationCut = False
00240 process.AlignmentTrackSelector.minHitIsolation = 0.8
00241 process.AlignmentTrackSelector.applyChargeCheck = False
00242 process.AlignmentTrackSelector.minHitChargeStrip = 50.
00243 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
00244 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
00245 
00246 ##### For Hits:
00247 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
00248 process.TrackerTrackHitFilter.minimumHits = 8
00249 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
00250 process.TrackerTrackHitFilter.detsToIgnore = [
00251      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
00252     # TIB / TID
00253     #369136710, 369136714, 402668822,
00254     # TOB
00255     #436310989, 436310990, 436299301, 436299302,
00256     # TEC
00257     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
00258 ]
00259 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
00260 process.TrackerTrackHitFilter.stripAllInvalidHits = False
00261 process.TrackerTrackHitFilter.rejectBadStoNHits = True
00262 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 12.0")
00263 process.TrackerTrackHitFilter.rejectLowAngleHits= True
00264 process.TrackerTrackHitFilter.TrackAngleCut= 0.17 # in rads, starting from the module surface
00265 process.TrackerTrackHitFilter.usePixelQualityFlag= True
00266 
00267 ##############
00268 ##Trigger sequence
00269 #############
00270 #for MC only trigger bit 40 is simulated
00271 #no triger on bunch crossing bit 0
00272 
00273 
00274 process.triggerSelection=cms.Sequence(process.bit40)
00275 
00276 """
00277 
00278 intoNTuplesTemplate="""
00279 import FWCore.ParameterSet.Config as cms
00280 
00281 process = cms.Process("ValidationIntoNTuples")
00282 
00283 # global tag
00284 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00285 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." 
00286 
00287 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
00288 process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
00289 process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
00290 
00291 #process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
00292 process.load("CondCore.DBCommon.CondDBSetup_cfi")
00293 
00294 process.MessageLogger = cms.Service("MessageLogger",
00295     destinations = cms.untracked.vstring('detailedInfo', 
00296         'cout')
00297 ) 
00298 
00299 #removed: APE
00300 #removed: dbLoad
00301 import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00302 process.GeomToComp = CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone(
00303 connect = cms.string('.oO[dbpath]Oo.'),
00304 
00305     toGet = cms.VPSet(cms.PSet(
00306         record = cms.string('TrackerAlignmentRcd'),
00307         tag = cms.string('.oO[tag]Oo.')
00308     ))
00309    
00310 )
00311 process.es_prefer_geom=cms.ESPrefer("PoolDBESSource","GeomToComp")
00312 
00313 from CondCore.DBCommon.CondDBSetup_cfi import *
00314 
00315 process.ZeroAPE = cms.ESSource("PoolDBESSource",CondDBSetup,
00316                                                                 connect = cms.string('frontier://FrontierProd/CMS_COND_31X_FROM21X'),
00317                                                                 timetype = cms.string("runnumber"),
00318                                                                 toGet = cms.VPSet(
00319                                                                                         cms.PSet(
00320                                                                                                 record = cms.string('TrackerAlignmentErrorRcd'),
00321                                                                                                 tag = cms.string('TrackerIdealGeometryErrors210_mc')
00322                                                                                         ))
00323                                                                 )
00324 process.es_prefer_ZeroAPE = cms.ESPrefer("PoolDBESSource", "ZeroAPE")
00325 
00326 
00327 process.source = cms.Source("EmptySource")
00328 
00329 process.maxEvents = cms.untracked.PSet(
00330     input = cms.untracked.int32(1)
00331 )
00332 process.dump = cms.EDAnalyzer("TrackerGeometryIntoNtuples",
00333     outputFile = cms.untracked.string('.oO[workdir]Oo./.oO[alignmentName]Oo.ROOTGeometry.root'),
00334     outputTreename = cms.untracked.string('alignTree')
00335 )
00336 
00337 process.p = cms.Path(process.dump)  
00338 """
00339 
00340 compareTemplate="""
00341 import FWCore.ParameterSet.Config as cms
00342 
00343 process = cms.Process("validation")
00344 
00345 # global tag
00346 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00347 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo." 
00348 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cff")
00349 
00350 process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
00351 
00352 process.load("Geometry.TrackerGeometryBuilder.trackerGeometry_cfi")
00353 
00354 #process.load("Alignment.CommonAlignmentProducer.GlobalPosition_Frontier_cff")
00355 # the input .GlobalPosition_Frontier_cff is providing the frontier://FrontierProd/CMS_COND_31X_ALIGNMENT in the release which does not provide the ideal geometry
00356 #process.GlobalPosition.connect = 'frontier://FrontierProd/CMS_COND_31X_FROM21X'
00357 
00358 process.load("CondCore.DBCommon.CondDBSetup_cfi")
00359 
00360 process.MessageLogger = cms.Service("MessageLogger",
00361     destinations = cms.untracked.vstring('detailedInfo', 
00362         'cout')
00363 )
00364 
00365 process.source = cms.Source("EmptySource")
00366 
00367 process.maxEvents = cms.untracked.PSet(
00368     input = cms.untracked.int32(1)
00369 )
00370 
00371   # configuration of the Tracker Geometry Comparison Tool
00372   # Tracker Geometry Comparison
00373 process.load("Alignment.OfflineValidation.TrackerGeometryCompare_cfi")
00374   # the input "IDEAL" is special indicating to use the ideal geometry of the release
00375 
00376 process.TrackerGeometryCompare.inputROOTFile1 = '.oO[comparedGeometry]Oo.'
00377 process.TrackerGeometryCompare.inputROOTFile2 = '.oO[referenceGeometry]Oo.'
00378 process.TrackerGeometryCompare.outputFile = ".oO[workdir]Oo./.oO[name]Oo..Comparison_common.oO[common]Oo..root"
00379 process.TrackerGeometryCompare.levels = [ .oO[levels]Oo. ]
00380 
00381   ##FIXME!!!!!!!!!
00382   ##replace TrackerGeometryCompare.writeToDB = .oO[dbOutput]Oo.
00383   ##removed: dbOutputService
00384 
00385 process.p = cms.Path(process.TrackerGeometryCompare)
00386 """
00387   
00388 dbOutputTemplate= """
00389 //_________________________ db Output ____________________________
00390         # setup for writing out to DB
00391         include "CondCore/DBCommon/data/CondDBSetup.cfi"
00392 #       include "CondCore/DBCommon/data/CondDBCommon.cfi"
00393 
00394     service = PoolDBOutputService {
00395         using CondDBSetup
00396         VPSet toPut = {
00397             { string record = "TrackerAlignmentRcd"  string tag = ".oO[tag]Oo." },
00398             { string record = "TrackerAlignmentErrorRcd"  string tag = ".oO[errortag]Oo." }
00399         }
00400                 string connect = "sqlite_file:.oO[workdir]Oo./.oO[name]Oo.Common.oO[common]Oo..db"
00401                 # untracked string catalog = "file:alignments.xml"
00402         untracked string timetype = "runnumber"
00403     }
00404 """
00405 
00406 dbLoadTemplate="""
00407 #from CondCore.DBCommon.CondDBSetup_cfi import *
00408 from CalibTracker.Configuration.Common.PoolDBESSource_cfi import poolDBESSource
00409 ##include private db object
00410 ##
00411 import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00412 process.trackerAlignment =  CalibTracker.Configuration.Common.PoolDBESSource_cfi.poolDBESSource.clone(
00413                                         connect = cms.string('.oO[dbpath]Oo.'),
00414                                         timetype = cms.string("runnumber"),
00415                                         toGet = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentRcd'),
00416                                                                    tag = cms.string('.oO[tag]Oo.')
00417                                                                    ))
00418                                         )
00419 process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource", "trackerAlignment")
00420 
00421 """
00422 
00423 APETemplate="""
00424 from CondCore.DBCommon.CondDBSetup_cfi import *
00425 process.APE = poolDBESSource.clone(
00426                                         connect = cms.string('.oO[errordbpath]Oo.'),
00427                                         timetype = cms.string("runnumber"),
00428                                         toGet = cms.VPSet(cms.PSet(record = cms.string('TrackerAlignmentErrorRcd'),
00429                                                                    tag = cms.string('.oO[errortag]Oo.')
00430                                                                    ))
00431                                         )
00432 process.es_prefer_APE = cms.ESPrefer("PoolDBESSource", "APE")
00433 """
00434 
00435 
00436 
00437 #batch job execution
00438 scriptTemplate="""
00439 #!/bin/bash
00440 #init
00441 #ulimit -v 3072000
00442 #export STAGE_SVCCLASS=cmscafuser
00443 source /afs/cern.ch/cms/caf/setup.sh
00444 source /afs/cern.ch/cms/sw/cmsset_default.sh
00445 cd .oO[CMSSW_BASE]Oo./src
00446 eval `scramv1 ru -sh`
00447 rfmkdir -p .oO[workdir]Oo.
00448 rfmkdir -p .oO[datadir]Oo.
00449 
00450 rm -f .oO[workdir]Oo./*
00451 cd .oO[workdir]Oo.
00452 
00453 #run
00454 pwd
00455 df -h .
00456 .oO[CommandLine]Oo.
00457 echo "----"
00458 echo "List of files in $(pwd):"
00459 ls -ltr
00460 echo "----"
00461 echo ""
00462 
00463 
00464 #retrive
00465 rfmkdir -p .oO[logdir]Oo.
00466 gzip LOGFILE_*_.oO[name]Oo..log
00467 find .oO[workdir]Oo. -maxdepth 1 -name "LOGFILE*.oO[alignmentName]Oo.*" -print | xargs -I {} bash -c "rfcp {} .oO[logdir]Oo."
00468 rfmkdir -p .oO[datadir]Oo.
00469 find .oO[workdir]Oo. -maxdepth 1 -name "*.oO[alignmentName]Oo.*.root" -print | xargs -I {} bash -c "rfcp {} .oO[datadir]Oo."
00470 #cleanup
00471 rm -rf .oO[workdir]Oo.
00472 echo "done."
00473 """
00474 
00475 mergeTemplate="""
00476 #!/bin/bash
00477 #init
00478 export STAGE_SVCCLASS=cmscafuser
00479 source /afs/cern.ch/cms/sw/cmsset_default.sh
00480 cd .oO[CMSSW_BASE]Oo./src
00481 eval `scramv1 ru -sh`
00482 rfmkdir -p .oO[workdir]Oo.
00483 cd .oO[workdir]Oo.
00484 
00485 #run
00486 .oO[DownloadData]Oo.
00487 .oO[CompareAllignments]Oo.
00488 
00489 find ./ -maxdepth 1 -name "*_result.root" -print | xargs -I {} bash -c "rfcp {} .oO[datadir]Oo."
00490 
00491 .oO[RunExtendedOfflineValidation]Oo.
00492 
00493 #zip stdout and stderr from the farm jobs
00494 gzip .oO[logdir]Oo./*.stderr
00495 gzip .oO[logdir]Oo./*.stdout
00496 
00497 """
00498 
00499 compareAlignmentsExecution="""
00500 #merge for .oO[validationId]Oo.
00501 root -q -b '.oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation/scripts/compareAlignments.cc+(\".oO[compareStrings]Oo.\")'
00502 mv result.root .oO[validationId]Oo._result.root
00503 """
00504 
00505 extendedVaidationExecution="""
00506 #run extended offline validation scripts
00507 rfmkdir -p .oO[workdir]Oo./ExtendedOfflineValidation_Images
00508 root -x -b -q .oO[extendeValScriptPath]Oo.
00509 rfmkdir -p .oO[datadir]Oo./ExtendedOfflineValidation_Images
00510 find .oO[workdir]Oo./ExtendedOfflineValidation_Images -maxdepth 1 -name \"*ps\" -print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo./ExtendedOfflineValidation_Images\"
00511 """
00512 
00513 extendedVaidationTemplate="""
00514 void TkAlExtendedOfflineValidation()
00515 {
00516   // load framework lite just to find the CMSSW libs...
00517   gSystem->Load("libFWCoreFWLite");
00518   AutoLibraryLoader::enable();
00519   //compile the makro
00520   gROOT->ProcessLine(".L .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation/macros/PlotAlignmentValidation.C++");
00521 
00522   .oO[extendedInstantiation]Oo.
00523   gROOT->ProcessLine(".mkdir -p .oO[workdir]Oo./ExtendedOfflineValidation_Images/");
00524   p.setOutputDir(".oO[workdir]Oo./ExtendedOfflineValidation_Images");
00525   p.setTreeBaseDir(".oO[OfflineTreeBaseDir]Oo.");
00526   p.plotDMR(".oO[DMRMethod]Oo.",.oO[DMRMinimum]Oo.);
00527 }
00528 """
00529 
00530 mcValidateTemplate="""
00531 import FWCore.ParameterSet.Config as cms
00532 
00533 process = cms.Process("TkVal")
00534 process.load("FWCore.MessageService.MessageLogger_cfi")
00535 process.MessageLogger = cms.Service("MessageLogger",
00536     destinations = cms.untracked.vstring('LOGFILE_McValidate_.oO[name]Oo.', 
00537         'cout')
00538 )
00539 
00540 ### standard includes
00541 process.load('Configuration/StandardSequences/GeometryPilot2_cff')
00542 process.load("Configuration.StandardSequences.RawToDigi_cff")
00543 process.load("Configuration.EventContent.EventContent_cff")
00544 process.load("Configuration.StandardSequences.Reconstruction_cff")
00545 process.load("Configuration.StandardSequences.MagneticField_cff")
00546 process.load("SimGeneral.MixingModule.mixNoPU_cfi")
00547 
00548 ### conditions
00549 process.load("Alignment.OfflineValidation.GlobalTag_cff")
00550 process.GlobalTag.globaltag = '.oO[GlobalTag]Oo.'
00551 
00552 import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00553 
00554 .oO[dbLoad]Oo.
00555 
00556 ### validation-specific includes
00557 process.load("SimTracker.TrackAssociation.TrackAssociatorByHits_cfi")
00558 process.load("Validation.RecoTrack.cuts_cff")
00559 process.load("Validation.RecoTrack.MultiTrackValidator_cff")
00560 process.load("SimGeneral.TrackingAnalysis.trackingParticles_cfi")
00561 
00562 ### configuration MultiTrackValidator ###
00563 process.multiTrackValidator.outputFile = '.oO[outputFile]Oo.'
00564 
00565 process.multiTrackValidator.associators = ['TrackAssociatorByHits']
00566 process.multiTrackValidator.UseAssociators = cms.bool(True)
00567 process.multiTrackValidator.label = ['generalTracks']
00568 
00569 from Alignment.OfflineValidation..oO[RelValSample]Oo._cff import readFiles
00570 from Alignment.OfflineValidation..oO[RelValSample]Oo._cff import secFiles
00571 source = cms.Source ("PoolSource",
00572     fileNames = readFiles,
00573     secondaryFileNames = secFiles,
00574     inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
00575 )
00576 
00577 process.maxEvents = cms.untracked.PSet(
00578     input = cms.untracked.int32(.oO[nEvents]Oo.)
00579 )
00580 
00581 process.options = cms.untracked.PSet(
00582     wantSummary = cms.untracked.bool(False),
00583     Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00584     fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00585 )
00586 
00587 process.source = source
00588 
00589 process.re_tracking_and_TP = cms.Sequence(process.mix*process.trackingParticles*
00590                                    process.siPixelRecHits*process.siStripMatchedRecHits*
00591                                    process.ckftracks*
00592                                    process.cutsRecoTracks*
00593                                    process.multiTrackValidator
00594                                    )
00595 
00596 process.re_tracking = cms.Sequence(process.siPixelRecHits*process.siStripMatchedRecHits*
00597                                    process.ckftracks*
00598                                    process.cutsRecoTracks*
00599                                    process.multiTrackValidator
00600                                    )
00601 
00602 ### final path and endPath
00603 process.p = cms.Path(process.re_tracking)
00604 """
00605 
00606 TrackSplittingTemplate="""
00607 import FWCore.ParameterSet.Config as cms
00608 
00609 process = cms.Process("splitter")
00610 
00611 # CMSSW.2.2.3
00612 
00613 # message logger
00614 process.load("FWCore.MessageLogger.MessageLogger_cfi")
00615 MessageLogger = cms.Service("MessageLogger",
00616     destinations = cms.untracked.vstring('LOGFILE_TrackSplitting_.oO[name]Oo.', 
00617         'cout')
00618 )
00619 ## report only every 100th record
00620 process.MessageLogger.cerr.FwkReport.reportEvery = 100
00621 
00622 process.load('Configuration.StandardSequences.Services_cff')
00623 process.load('Configuration.StandardSequences.Geometry_cff')
00624 
00625 # including global tag
00626 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00627 # setting global tag
00628 #process.GlobalTag.connect = "frontier://FrontierProd/CMS_COND_21X_GLOBALTAG"
00629 process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
00630 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
00631 
00632 
00633 ###########################################
00634 ##necessary fix for the moment to avoid
00635 ##Assymmetric forward layers in TrackerException going through path p
00636 ##---- ScheduleExecutionFailure END
00637 ##an exception occurred during current event processing
00638 ##cms::Exception caught in EventProcessor and rethrown
00639 ##---- EventProcessorFailure END
00640 ############################################
00641 #import CalibTracker.Configuration.Common.PoolDBESSource_cfi
00642 from CondCore.DBCommon.CondDBSetup_cfi import *
00643 #load the Global Position Rcd
00644 process.globalPosition = cms.ESSource("PoolDBESSource", CondDBSetup,
00645                                   toGet = cms.VPSet(cms.PSet(
00646                                           record =cms.string('GlobalPositionRcd'),
00647                                           tag= cms.string('IdealGeometry')
00648                                           )),
00649                                   connect = cms.string('frontier://FrontierProd/CMS_COND_31X_FROM21X')
00650                                   )
00651 process.es_prefer_GPRcd = cms.ESPrefer("PoolDBESSource","globalPosition")
00652 ########################################## 
00653 
00654 
00655 # track selectors and refitting
00656 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
00657 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
00658 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
00659 
00660 # including data...
00661 process.load("Alignment.OfflineValidation..oO[superPointingDataset]Oo._cff")
00662 
00663 ## for craft SP skim v5
00664 process.source.inputCommands = cms.untracked.vstring("keep *","drop *_*_*_FU","drop *_*_*_HLT","drop *_MEtoEDMConverter_*_*","drop *_lumiProducer_*_REPACKER")
00665 process.source.dropDescendantsOfDroppedBranches = cms.untracked.bool( False )
00666 
00667 
00668 process.maxEvents = cms.untracked.PSet(
00669     input = cms.untracked.int32(.oO[nEvents]Oo.)
00670 )
00671 
00672 
00673 # magnetic field
00674 process.load("Configuration.StandardSequences.MagneticField_38T_cff")
00675 
00676 # adding geometries
00677 from CondCore.DBCommon.CondDBSetup_cfi import *
00678 
00679 # for craft
00680 ## tracker alignment for craft...............................................................
00681 .oO[dbLoad]Oo.
00682 
00683 .oO[APE]Oo.
00684 
00685 ## track hit filter.............................................................
00686 
00687 # refit tracks first
00688 import RecoTracker.TrackProducer.TrackRefitters_cff
00689 process.TrackRefitter1 = RecoTracker.TrackProducer.TrackRefitterP5_cfi.TrackRefitterP5.clone(
00690       src = '.oO[TrackCollection]Oo.',
00691       TrajectoryInEvent = True,
00692       TTRHBuilder = "WithTrackAngle",
00693       NavigationSchool = ""
00694       )
00695       
00696 process.FittingSmootherRKP5.EstimateCut = -1
00697 
00698 # module configuration
00699 # alignment track selector
00700 process.AlignmentTrackSelector.src = "TrackRefitter1"
00701 process.AlignmentTrackSelector.filter = True
00702 process.AlignmentTrackSelector.applyBasicCuts = True
00703 process.AlignmentTrackSelector.ptMin   = 0.
00704 process.AlignmentTrackSelector.pMin   = 4.      
00705 process.AlignmentTrackSelector.ptMax   = 9999.  
00706 process.AlignmentTrackSelector.pMax   = 9999.   
00707 process.AlignmentTrackSelector.etaMin  = -9999.
00708 process.AlignmentTrackSelector.etaMax  = 9999.
00709 process.AlignmentTrackSelector.nHitMin = 10
00710 process.AlignmentTrackSelector.nHitMin2D = 2
00711 process.AlignmentTrackSelector.minHitsPerSubDet.inBPIX=4 ##skip tracks not passing the pixel
00712 process.AlignmentTrackSelector.chi2nMax = 9999.
00713 process.AlignmentTrackSelector.applyMultiplicityFilter = True
00714 process.AlignmentTrackSelector.maxMultiplicity = 1
00715 process.AlignmentTrackSelector.applyNHighestPt = False
00716 process.AlignmentTrackSelector.nHighestPt = 1
00717 process.AlignmentTrackSelector.seedOnlyFrom = 0 
00718 process.AlignmentTrackSelector.applyIsolationCut = False
00719 process.AlignmentTrackSelector.minHitIsolation = 0.8
00720 process.AlignmentTrackSelector.applyChargeCheck = False
00721 process.AlignmentTrackSelector.minHitChargeStrip = 50.
00722 process.AlignmentTrackSelector.minHitsPerSubDet.inBPIX = 2
00723 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
00724 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
00725 process.KFFittingSmootherWithOutliersRejectionAndRK.EstimateCut=30.0
00726 process.KFFittingSmootherWithOutliersRejectionAndRK.MinNumberOfHits=4
00727 #process.FittingSmootherRKP5.EstimateCut = 20.0
00728 #process.FittingSmootherRKP5.MinNumberOfHits = 4
00729 
00730 # configuration of the track spitting module
00731 # new cuts allow for cutting on the impact parameter of the original track
00732 process.load("RecoTracker.FinalTrackSelectors.cosmicTrackSplitter_cfi")
00733 process.cosmicTrackSplitter.tracks = 'AlignmentTrackSelector'
00734 process.cosmicTrackSplitter.tjTkAssociationMapTag = 'TrackRefitter1'
00735 #process.cosmicTrackSplitter.excludePixelHits = False
00736 
00737 #---------------------------------------------------------------------
00738 # the output of the track hit filter are track candidates
00739 # give them to the TrackProducer
00740 process.load("RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff")
00741 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
00742      src = 'cosmicTrackSplitter',
00743      TrajectoryInEvent = True,
00744      TTRHBuilder = "WithTrackAngle"
00745 )
00746 # second refit
00747 process.TrackRefitter2 = process.TrackRefitter1.clone(
00748          src = 'HitFilteredTracks'
00749          )
00750 
00751 ### Now adding the construction of global Muons
00752 # what Chang did...
00753 process.load("Configuration.StandardSequences.ReconstructionCosmics_cff")
00754 
00755 process.cosmicValidation = cms.EDAnalyzer("CosmicSplitterValidation",
00756         ifSplitMuons = cms.bool(False),
00757         ifTrackMCTruth = cms.bool(False),       
00758         checkIfGolden = cms.bool(False),        
00759     splitTracks = cms.InputTag("TrackRefitter2","","splitter"),
00760         splitGlobalMuons = cms.InputTag("muons","","splitter"),
00761         originalTracks = cms.InputTag("TrackRefitter1","","splitter"),
00762         originalGlobalMuons = cms.InputTag("muons","","Rec")
00763 )
00764 
00765 process.TFileService = cms.Service("TFileService",
00766     fileName = cms.string('.oO[outputFile]Oo.')
00767 )
00768 
00769 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.AlignmentTrackSelector*process.cosmicTrackSplitter*process.HitFilteredTracks*process.TrackRefitter2*process.cosmicValidation)
00770 """
00771 
00772 ###
00773 #                 Alternate Templates
00774 ###
00775 
00776 def alternateTemplate( templateName, alternateTemplateName ):
00777    
00778     if not templateName in globals().keys():
00779         raise StandardError, "unkown template to replace %s"%templateName
00780     if not alternateTemplateName in globals().keys():
00781         raise StandardError, "unkown template to replace %s"%alternateTemplateName
00782     globals()[ templateName ] = globals()[ alternateTemplateName ]
00783     # = eval("configTemplates.%s"%"alternateTemplate")
00784 
00785 
00786 
00787 ###
00788 otherTemplate = """
00789 schum schum
00790 """
00791 
00792 yResidualsOfflineValidation="""
00793 import FWCore.ParameterSet.Config as cms
00794 
00795 process = cms.Process("OfflineValidator") 
00796    
00797 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
00798 
00799 process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
00800 process.options = cms.untracked.PSet(
00801    wantSummary = cms.untracked.bool(False),
00802    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00803    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00804 )
00805 
00806  ##
00807  ## Maximum number of Events
00808  ## 
00809 process.maxEvents = cms.untracked.PSet(
00810     input = cms.untracked.int32(.oO[nEvents]Oo.)
00811  )
00812 
00813  ##   
00814  ## Messages & Convenience
00815  ##
00816 process.load("FWCore.MessageLogger.MessageLogger_cfi")
00817 process.MessageLogger = cms.Service("MessageLogger",
00818     destinations = cms.untracked.vstring('LOGFILE_Offline_.oO[name]Oo.', 
00819         'cout')
00820 )
00821 
00822  ## report only every 100th record
00823  ##process.MessageLogger.cerr.FwkReport.reportEvery = 100
00824 
00825     
00826  ##
00827  ## Alignment Track Selection
00828  ##
00829 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
00830 process.AlignmentTrackSelector.src = 'TrackRefitter1'
00831 process.AlignmentTrackSelector.filter = True
00832 process.AlignmentTrackSelector.applyBasicCuts = True
00833 process.AlignmentTrackSelector.pMin    = 4.
00834 process.AlignmentTrackSelector.pMax    = 9999.
00835 process.AlignmentTrackSelector.ptMin   = 0.
00836 process.AlignmentTrackSelector.ptMax   = 9999.
00837 process.AlignmentTrackSelector.etaMin  = -999.
00838 process.AlignmentTrackSelector.etaMax  = 999.
00839 process.AlignmentTrackSelector.nHitMin = 8
00840 process.AlignmentTrackSelector.nHitMin2D = 2
00841 process.AlignmentTrackSelector.chi2nMax = 999.
00842 process.AlignmentTrackSelector.applyMultiplicityFilter = False
00843 process.AlignmentTrackSelector.maxMultiplicity = 1
00844 process.AlignmentTrackSelector.applyNHighestPt = False
00845 process.AlignmentTrackSelector.nHighestPt = 1
00846 process.AlignmentTrackSelector.seedOnlyFrom = 0 
00847 process.AlignmentTrackSelector.applyIsolationCut = False
00848 process.AlignmentTrackSelector.minHitIsolation = 0.8
00849 process.AlignmentTrackSelector.applyChargeCheck = False
00850 process.AlignmentTrackSelector.minHitChargeStrip = 50.
00851 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
00852 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
00853 
00854 ####  new FILTER
00855 #-- new track hit filter
00856 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
00857 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
00858 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
00859 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
00860 process.TrackerTrackHitFilter.minimumHits = 8
00861 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
00862 process.TrackerTrackHitFilter.detsToIgnore = [
00863      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
00864     # TIB / TID
00865     369136710, 369136714, 402668822,
00866     # TOB
00867     436310989, 436310990, 436299301, 436299302,
00868     # TEC
00869     470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
00870 ]
00871 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
00872 process.TrackerTrackHitFilter.stripAllInvalidHits = False
00873 process.TrackerTrackHitFilter.rejectBadStoNHits = True
00874 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 14.0")
00875 process.TrackerTrackHitFilter.rejectLowAngleHits= True
00876 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
00877 process.TrackerTrackHitFilter.usePixelQualityFlag= True
00878 
00879 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
00880 import RecoTracker.TrackProducer.CosmicFinalFitWithMaterialP5_cff
00881 process.HitFilteredTracks = RecoTracker.TrackProducer.CosmicFinalFitWithMaterialP5_cff.cosmictrackfinderP5.clone(
00882     src = 'TrackerTrackHitFilter'
00883 )
00884 
00885  ##
00886  ## Load and Configure TrackRefitter1
00887  ##
00888 
00889 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
00890 
00891 process.TrackRefitter1 = RecoTracker.TrackProducer.TrackRefitterP5_cfi.TrackRefitterP5.clone(
00892   src = '.oO[TrackCollection]Oo.',
00893   TrajectoryInEvent = True,
00894   TTRHBuilder = "WithTrackAngle",
00895   NavigationSchool = ""
00896 )
00897 
00898 process.TrackRefitter2 = process.TrackRefitter1.clone(
00899     src = 'HitFilteredTracks')
00900 
00901 
00902  ##
00903  ## Get the BeamSpot
00904  ##
00905 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
00906  
00907  ##
00908  ## GlobalTag Conditions (if needed)
00909  ##
00910 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
00911 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
00912 #process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_21X_GLOBALTAG"
00913 process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
00914 
00915 ## LAYERWISE Lorentz Angle ###################
00916 
00917 process.SiStripLorentzAngle = cms.ESSource("PoolDBESSource",
00918      BlobStreamerName = 
00919 cms.untracked.string('TBufferBlobStreamingService'),
00920      DBParameters = cms.PSet(
00921          messageLevel = cms.untracked.int32(2),
00922          authenticationPath = 
00923 cms.untracked.string('/afs/cern.ch/cms/DB/conddb')
00924      ),
00925      timetype = cms.string('runnumber'),
00926      toGet = cms.VPSet(cms.PSet(
00927          record = cms.string('SiStripLorentzAngleRcd'),
00928         tag = cms.string('SiStripLA_CRAFT_layers')
00929      )),
00930      connect = cms.string('sqlite_file:/afs/cern.ch/user/j/jdraeger/public/LA_object/LA_CRAFT_layers.db')
00931 )
00932 process.es_prefer_SiStripLorentzAngle = cms.ESPrefer("PoolDBESSource","SiStripLorentzAngle")
00933   
00934  ##
00935  ## Geometry
00936  ##
00937 process.load("Configuration.StandardSequences.Geometry_cff")
00938  
00939  ##
00940  ## Magnetic Field
00941  ##
00942 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
00943 
00944 .oO[APE]Oo.
00945 
00946 .oO[dbLoad]Oo.
00947 
00948 ## to apply misalignments
00949 #TrackerDigiGeometryESModule.applyAlignment = True
00950    
00951  ##
00952  ## Load and Configure OfflineValidation
00953  ##
00954 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
00955 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
00956 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
00957 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
00958 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..stripYResiduals = True
00959 .oO[offlineValidationFileOutput]Oo.
00960 
00961  ##
00962  ## PATH
00963  ##
00964 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
00965                      *process.TrackRefitter2*process.AlignmentTrackSelector*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
00966 
00967 """
00968 
00969 zeroAPETemplate="""
00970 from CondCore.DBCommon.CondDBSetup_cfi import *
00971 process.APE = cms.ESSource("PoolDBESSource",CondDBSetup,
00972                                         connect = cms.string('frontier://FrontierProd/CMS_COND_31X_FROM21X'),
00973                                         timetype = cms.string("runnumber"),
00974                                         toGet = cms.VPSet(
00975                                                           cms.PSet(record = cms.string('TrackerAlignmentErrorRcd'),
00976                                                                    tag = cms.string('TrackerIdealGeometryErrors210_mc')
00977                                                                    ))
00978                                         )
00979 process.es_prefer_APE = cms.ESPrefer("PoolDBESSource", "APE")
00980 """
00981 
00982 CosmicsOfflineValidation="""
00983 import FWCore.ParameterSet.Config as cms
00984 
00985 process = cms.Process("OfflineValidator") 
00986    
00987 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
00988 
00989 #process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
00990 process.options = cms.untracked.PSet(
00991    wantSummary = cms.untracked.bool(False),
00992    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
00993    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
00994 )
00995 
00996  ##
00997  ## Maximum number of Events
00998  ## 
00999 process.maxEvents = cms.untracked.PSet(
01000     input = cms.untracked.int32(.oO[nEvents]Oo.)
01001  )
01002 
01003  ##   
01004  ## Messages & Convenience
01005  ##
01006 process.load("FWCore.MessageLogger.MessageLogger_cfi")
01007 process.MessageLogger.cerr = cms.untracked.PSet(placeholder = cms.untracked.bool(True))
01008 process.MessageLogger.cout = cms.untracked.PSet(INFO = cms.untracked.PSet(
01009 reportEvery = cms.untracked.int32(1000) # every 1000th only
01010 #    limit = cms.untracked.int32(10)       # or limit to 10 printouts...
01011 ))
01012 process.MessageLogger.statistics.append('cout')
01013 
01014 #Physics declared
01015 process.load('HLTrigger.special.hltPhysicsDeclared_cfi')
01016 process.hltPhysicsDeclared.L1GtReadoutRecordTag = 'gtDigis'  
01017 
01018 #-- Track hit filter
01019 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
01020 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
01021 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
01022 
01023 
01024 
01025 #-- Alignment Track Selection
01026 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
01027 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
01028 process.AlignmentTrackSelector.filter = True
01029 
01030 .oO[TrackSelectionTemplate]Oo.
01031 
01032 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
01033 import RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff
01034 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
01035     src = 'TrackerTrackHitFilter',
01036 ###    TrajectoryInEvent = True,
01037      NavigationSchool = '',
01038     TTRHBuilder = "WithAngleAndTemplate"    
01039 )
01040 
01041  ##
01042  ## Load and Configure TrackRefitter1
01043  ##
01044 
01045 
01046 #############
01047 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
01048 
01049 process.TrackRefitter1 = process.TrackRefitterP5.clone(
01050     src = 'ALCARECOTkAlCosmicsCTF0T',
01051     TrajectoryInEvent = True,
01052      NavigationSchool = '',
01053     TTRHBuilder = "WithAngleAndTemplate"
01054 )
01055 process.TrackRefitter2 = process.TrackRefitter1.clone(
01056     src = 'AlignmentTrackSelector',
01057    
01058     )
01059 
01060 
01061  ##
01062  ## Get the BeamSpot
01063  ##
01064 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
01065  
01066  ##
01067  ## GlobalTag Conditions (if needed)
01068  ##
01069 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
01070 process.GlobalTag.connect = "frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
01071 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
01072 
01073 
01074 .oO[LorentzAngleTemplate]Oo.
01075   
01076  ##
01077  ## Geometry
01078  ##
01079 process.load("Configuration.StandardSequences.Geometry_cff")
01080  
01081  ##
01082  ## Magnetic Field
01083  ##
01084 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
01085 
01086 .oO[dbLoad]Oo.
01087 
01088 .oO[APE]Oo.
01089 
01090 ## to apply misalignments
01091 #TrackerDigiGeometryESModule.applyAlignment = True
01092    
01093  ##
01094  ## Load and Configure OfflineValidation
01095  ##
01096 
01097 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
01098 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
01099 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
01100 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
01101 process.TFileService.fileName = '.oO[outputFile]Oo.'
01102 
01103  ##
01104  ## PATH
01105  ##
01106 process.p = cms.Path(#process.triggerSelection*
01107 process.offlineBeamSpot*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
01108                      *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
01109 
01110 
01111 """
01112 
01113 
01114 CosmicsAt0TOfflineValidation="""
01115 import FWCore.ParameterSet.Config as cms
01116 
01117 process = cms.Process("OfflineValidator") 
01118    
01119 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
01120 
01121 #process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
01122 process.options = cms.untracked.PSet(
01123    wantSummary = cms.untracked.bool(False),
01124    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
01125    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
01126 )
01127 
01128  ##
01129  ## Maximum number of Events
01130  ## 
01131 process.maxEvents = cms.untracked.PSet(
01132     input = cms.untracked.int32(.oO[nEvents]Oo.)
01133  )
01134 
01135  ##   
01136  ## Messages & Convenience
01137  ##
01138 process.load("FWCore.MessageLogger.MessageLogger_cfi")
01139 process.MessageLogger.cerr = cms.untracked.PSet(placeholder = cms.untracked.bool(True))
01140 process.MessageLogger.cout = cms.untracked.PSet(INFO = cms.untracked.PSet(
01141 reportEvery = cms.untracked.int32(1000) # every 1000th only
01142 #    limit = cms.untracked.int32(10)       # or limit to 10 printouts...
01143 ))
01144 process.MessageLogger.statistics.append('cout')
01145 
01146 
01147 #-- Track hit filter
01148 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
01149 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
01150 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
01151 
01152 #-- Alignment Track Selection
01153 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
01154 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
01155 process.AlignmentTrackSelector.filter = True
01156 
01157 .oO[TrackSelectionTemplate]Oo.
01158 # Override the pmin setting since not meaningful with B=0T
01159 process.AlignmentTrackSelector.pMin    = 4.
01160 
01161 #### momentum constraint for 0T
01162 # First momentum constraint
01163 process.load("RecoTracker.TrackProducer.MomentumConstraintProducer_cff")
01164 import RecoTracker.TrackProducer.MomentumConstraintProducer_cff
01165 process.AliMomConstraint1 = RecoTracker.TrackProducer.MomentumConstraintProducer_cff.MyMomConstraint.clone()
01166 process.AliMomConstraint1.src = '.oO[TrackCollection]Oo.'
01167 process.AliMomConstraint1.fixedMomentum = 5.0
01168 process.AliMomConstraint1.fixedMomentumError = 0.005
01169 
01170 # Second momentum constraint
01171 #process.load("RecoTracker.TrackProducer.MomentumConstraintProducer_cff")
01172 #import RecoTracker.TrackProducer.MomentumConstraintProducer_cff
01173 #process.AliMomConstraint2 = RecoTracker.TrackProducer.MomentumConstraintProducer_cff.MyMomConstraint.clone()
01174 #process.AliMomConstraint2.src = 'AlignmentTrackSelector'
01175 #process.AliMomConstraint2.fixedMomentum = 5.0
01176 #process.AliMomConstraint2.fixedMomentumError = 0.005
01177    
01178 
01179 
01180 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
01181 import RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff
01182 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
01183     src = 'TrackerTrackHitFilter'
01184 ###    ,
01185 ###    TrajectoryInEvent = True,
01186 ###    TTRHBuilder = "WithAngleAndTemplate"    
01187 )
01188 
01189  ##
01190  ## Load and Configure TrackRefitter1
01191  ##
01192 
01193 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
01194 
01195 #############
01196 # parameters for TrackRefitter
01197 #process.load("RecoTracker.TrackProducer.RefitterWithMaterial_cff")
01198 import RecoTracker.TrackProducer.TrackRefitters_cff
01199 process.TrackRefitter1 = process.TrackRefitterP5.clone(
01200    src =  '.oO[TrackCollection]Oo.'#'AliMomConstraint1',
01201    TrajectoryInEvent = True,
01202    TTRHBuilder = "WithAngleAndTemplate",
01203    NavigationSchool = "",
01204    constraint = 'momentum', ### SPECIFIC FOR CRUZET
01205    srcConstr='AliMomConstraint1' ### SPECIFIC FOR CRUZET$works only with tag V02-10-02 TrackingTools/PatternTools / or CMSSW >=31X
01206 )
01207 
01208 process.TrackRefitter2 = process.TrackRefitter1.clone(
01209     src = 'AlignmentTrackSelector',
01210     srcConstr='AliMomConstraint1',
01211     constraint = 'momentum' ### SPECIFIC FOR CRUZET
01212 )
01213 
01214 
01215  ##
01216  ## Get the BeamSpot
01217  ##
01218 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
01219  
01220  ##
01221  ## GlobalTag Conditions (if needed)
01222  ##
01223 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
01224 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
01225 process.GlobalTag.connect="frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
01226 
01227 .oO[LorentzAngleTemplate]Oo.
01228   
01229  ##
01230  ## Geometry
01231  ##
01232 process.load("Configuration.StandardSequences.Geometry_cff")
01233  
01234  ##
01235  ## Magnetic Field
01236  ##
01237 #process.load("Configuration/StandardSequences/MagneticField_38T_cff")
01238 process.load("Configuration.StandardSequences.MagneticField_0T_cff") # 0T runs
01239 
01240 .oO[dbLoad]Oo.
01241 
01242 .oO[APE]Oo.
01243 
01244 ## to apply misalignments
01245 #TrackerDigiGeometryESModule.applyAlignment = True
01246    
01247  ##
01248  ## Load and Configure OfflineValidation
01249  ##
01250 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
01251 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
01252 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
01253 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
01254 process.TFileService.fileName = '.oO[outputFile]Oo.'
01255 
01256  ##
01257  ## PATH
01258  ##
01259 
01260 process.p = cms.Path(process.offlineBeamSpot*process.AliMomConstraint1*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
01261                      *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
01262 
01263 
01264 """
01265 TrackSelectionCosmicsDuringCollisions = """
01266 ##### For Tracks:
01267 process.AlignmentTrackSelector.applyBasicCuts = True
01268 # Note that pMin is overridden and set to zero in
01269 # the offlineTemplate0T
01270 process.AlignmentTrackSelector.pMin    = 4.
01271 process.AlignmentTrackSelector.pMax    = 9999.
01272 process.AlignmentTrackSelector.ptMin   = 0.
01273 process.AlignmentTrackSelector.ptMax   = 9999.
01274 process.AlignmentTrackSelector.etaMin  = -999.
01275 process.AlignmentTrackSelector.etaMax  = 999.
01276 process.AlignmentTrackSelector.nHitMin = 8
01277 process.AlignmentTrackSelector.nHitMin2D = 2
01278 process.AlignmentTrackSelector.chi2nMax = 999.
01279 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01280 process.AlignmentTrackSelector.maxMultiplicity = 1
01281 process.AlignmentTrackSelector.applyNHighestPt = False
01282 process.AlignmentTrackSelector.nHighestPt = 1
01283 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01284 process.AlignmentTrackSelector.applyIsolationCut = False
01285 process.AlignmentTrackSelector.minHitIsolation = 0.8
01286 process.AlignmentTrackSelector.applyChargeCheck = False
01287 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01288 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01289 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01290 
01291 ##### For Hits:
01292 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
01293 process.TrackerTrackHitFilter.minimumHits = 8
01294 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01295 process.TrackerTrackHitFilter.detsToIgnore = [
01296      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01297     # TIB / TID
01298     #369136710, 369136714, 402668822,
01299     # TOB
01300     #436310989, 436310990, 436299301, 436299302,
01301     # TEC
01302     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01303 ]
01304 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01305 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01306 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01307 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
01308 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01309 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
01310 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01311 
01312 #######################################
01313 ##Trigger settings for Cosmics during collisions
01314 #######################################
01315 process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskTechTrigConfig_cff')
01316 process.load('HLTrigger/HLTfilters/hltLevel1GTSeed_cfi')
01317 process.L1T1=process.hltLevel1GTSeed.clone()
01318 process.L1T1.L1TechTriggerSeeding = cms.bool(True)
01319 process.L1T1.L1SeedsLogicalExpression=cms.string('25') 
01320 process.hltHighLevel = cms.EDFilter("HLTHighLevel",
01321     TriggerResultsTag = cms.InputTag("TriggerResults","","HLT"),
01322     HLTPaths = cms.vstring('HLT_TrackerCosmics'),
01323     eventSetupPathsKey = cms.string(''),
01324     andOr = cms.bool(False),
01325     throw = cms.bool(True)
01326 )
01327 
01328 
01329 process.triggerSelection=cms.Sequence(process.L1T1*process.hltHighLevel)
01330 """
01331 TrackSelectionCosmicsData = """
01332 ##### For Tracks:
01333 process.AlignmentTrackSelector.applyBasicCuts = True
01334 # Note that pMin is overridden and set to zero in
01335 # the offlineTemplate0T
01336 process.AlignmentTrackSelector.pMin    = 4.
01337 process.AlignmentTrackSelector.pMax    = 9999.
01338 process.AlignmentTrackSelector.ptMin   = 0.
01339 process.AlignmentTrackSelector.ptMax   = 9999.
01340 process.AlignmentTrackSelector.etaMin  = -999.
01341 process.AlignmentTrackSelector.etaMax  = 999.
01342 process.AlignmentTrackSelector.nHitMin = 8
01343 process.AlignmentTrackSelector.nHitMin2D = 2
01344 process.AlignmentTrackSelector.chi2nMax = 999.
01345 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01346 process.AlignmentTrackSelector.maxMultiplicity = 1
01347 process.AlignmentTrackSelector.applyNHighestPt = False
01348 process.AlignmentTrackSelector.nHighestPt = 1
01349 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01350 process.AlignmentTrackSelector.applyIsolationCut = False
01351 process.AlignmentTrackSelector.minHitIsolation = 0.8
01352 process.AlignmentTrackSelector.applyChargeCheck = False
01353 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01354 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01355 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01356 
01357 ##### For Hits:
01358 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
01359 process.TrackerTrackHitFilter.minimumHits = 8
01360 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01361 process.TrackerTrackHitFilter.detsToIgnore = [
01362      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01363     # TIB / TID
01364     #369136710, 369136714, 402668822,
01365     # TOB
01366     #436310989, 436310990, 436299301, 436299302,
01367     # TEC
01368     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01369 ]
01370 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01371 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01372 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01373 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
01374 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01375 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
01376 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01377 #process.TrackerTrackHitFilter.PxlCorrClusterChargeCut = 10000.0
01378 process.triggerSelection=cms.Sequence(process.hltPhysicsDeclared)
01379 """
01380 TrackSelectionCosmicsDataBPIX = """
01381 ##### For Tracks:
01382 process.AlignmentTrackSelector.applyBasicCuts = True
01383 # Note that pMin is overridden and set to zero in
01384 # the offlineTemplate0T
01385 process.AlignmentTrackSelector.pMin    = 4.
01386 process.AlignmentTrackSelector.pMax    = 9999.
01387 process.AlignmentTrackSelector.ptMin   = 0.
01388 process.AlignmentTrackSelector.ptMax   = 9999.
01389 process.AlignmentTrackSelector.etaMin  = -999.
01390 process.AlignmentTrackSelector.etaMax  = 999.
01391 process.AlignmentTrackSelector.nHitMin = 8
01392 process.AlignmentTrackSelector.nHitMin2D = 2
01393 process.AlignmentTrackSelector.chi2nMax = 999.
01394 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01395 process.AlignmentTrackSelector.maxMultiplicity = 1
01396 process.AlignmentTrackSelector.applyNHighestPt = False
01397 process.AlignmentTrackSelector.nHighestPt = 1
01398 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01399 process.AlignmentTrackSelector.applyIsolationCut = False
01400 process.AlignmentTrackSelector.minHitIsolation = 0.8
01401 process.AlignmentTrackSelector.applyChargeCheck = False
01402 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01403 process.AlignmentTrackSelector.minHitsPerSubDet = cms.PSet(
01404          inTEC = cms.int32(0),
01405          inTOB = cms.int32(0),
01406          inFPIX = cms.int32(0),
01407         inTID = cms.int32(0),
01408          inBPIX = cms.int32(1),
01409          inTIB = cms.int32(0),
01410          inPIXEL = cms.int32(0),
01411          inTIDplus = cms.int32(0),
01412          inTIDminus = cms.int32(0),
01413          inTECplus = cms.int32(0),
01414          inTECminus = cms.int32(0),
01415          inFPIXplus = cms.int32(0),
01416          inFPIXminus = cms.int32(0),
01417          inENDCAP = cms.int32(0),
01418          inENDCAPplus = cms.int32(0),
01419          inENDCAPminus = cms.int32(0),
01420      )
01421 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01422 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01423 
01424 ##### For Hits:
01425 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
01426 process.TrackerTrackHitFilter.minimumHits = 8
01427 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01428 process.TrackerTrackHitFilter.detsToIgnore = [
01429      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01430     # TIB / TID
01431     #369136710, 369136714, 402668822,
01432     # TOB
01433     #436310989, 436310990, 436299301, 436299302,
01434     # TEC
01435     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01436 ]
01437 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01438 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01439 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01440 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
01441 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01442 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
01443 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01444 
01445 process.triggerSelection=cms.Sequence(process.hltPhysicsDeclared)
01446 """
01447 TrackSelectionCosmicsDataFPIXplus = """
01448 ##### For Tracks:
01449 process.AlignmentTrackSelector.applyBasicCuts = True
01450 # Note that pMin is overridden and set to zero in
01451 # the offlineTemplate0T
01452 process.AlignmentTrackSelector.pMin    = 4.
01453 process.AlignmentTrackSelector.pMax    = 9999.
01454 process.AlignmentTrackSelector.ptMin   = 0.
01455 process.AlignmentTrackSelector.ptMax   = 9999.
01456 process.AlignmentTrackSelector.etaMin  = -999.
01457 process.AlignmentTrackSelector.etaMax  = 999.
01458 process.AlignmentTrackSelector.nHitMin = 8
01459 process.AlignmentTrackSelector.nHitMin2D = 2
01460 process.AlignmentTrackSelector.chi2nMax = 999.
01461 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01462 process.AlignmentTrackSelector.maxMultiplicity = 1
01463 process.AlignmentTrackSelector.applyNHighestPt = False
01464 process.AlignmentTrackSelector.nHighestPt = 1
01465 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01466 process.AlignmentTrackSelector.applyIsolationCut = False
01467 process.AlignmentTrackSelector.minHitIsolation = 0.8
01468 process.AlignmentTrackSelector.applyChargeCheck = False
01469 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01470 process.AlignmentTrackSelector.minHitsPerSubDet = cms.PSet(
01471          inTEC = cms.int32(0),
01472          inTOB = cms.int32(0),
01473          inFPIX = cms.int32(0),
01474         inTID = cms.int32(0),
01475          inBPIX = cms.int32(0),
01476          inTIB = cms.int32(0),
01477          inPIXEL = cms.int32(0),
01478          inTIDplus = cms.int32(0),
01479          inTIDminus = cms.int32(0),
01480          inTECplus = cms.int32(0),
01481          inTECminus = cms.int32(0),
01482          inFPIXplus = cms.int32(1),
01483          inFPIXminus = cms.int32(0),
01484          inENDCAP = cms.int32(0),
01485          inENDCAPplus = cms.int32(0),
01486          inENDCAPminus = cms.int32(0),
01487      )
01488 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01489 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01490 
01491 ##### For Hits:
01492 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
01493 process.TrackerTrackHitFilter.minimumHits = 8
01494 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01495 process.TrackerTrackHitFilter.detsToIgnore = [
01496      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01497     # TIB / TID
01498     #369136710, 369136714, 402668822,
01499     # TOB
01500     #436310989, 436310990, 436299301, 436299302,
01501     # TEC
01502     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01503 ]
01504 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01505 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01506 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01507 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
01508 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01509 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
01510 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01511 
01512 process.triggerSelection=cms.Sequence(process.hltPhysicsDeclared)
01513 """
01514 TrackSelectionCosmicsDataFPIXminus = """
01515 ##### For Tracks:
01516 process.AlignmentTrackSelector.applyBasicCuts = True
01517 # Note that pMin is overridden and set to zero in
01518 # the offlineTemplate0T
01519 process.AlignmentTrackSelector.pMin    = 4.
01520 process.AlignmentTrackSelector.pMax    = 9999.
01521 process.AlignmentTrackSelector.ptMin   = 0.
01522 process.AlignmentTrackSelector.ptMax   = 9999.
01523 process.AlignmentTrackSelector.etaMin  = -999.
01524 process.AlignmentTrackSelector.etaMax  = 999.
01525 process.AlignmentTrackSelector.nHitMin = 8
01526 process.AlignmentTrackSelector.nHitMin2D = 2
01527 process.AlignmentTrackSelector.chi2nMax = 999.
01528 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01529 process.AlignmentTrackSelector.maxMultiplicity = 1
01530 process.AlignmentTrackSelector.applyNHighestPt = False
01531 process.AlignmentTrackSelector.nHighestPt = 1
01532 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01533 process.AlignmentTrackSelector.applyIsolationCut = False
01534 process.AlignmentTrackSelector.minHitIsolation = 0.8
01535 process.AlignmentTrackSelector.applyChargeCheck = False
01536 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01537 process.AlignmentTrackSelector.minHitsPerSubDet = cms.PSet(
01538          inTEC = cms.int32(0),
01539          inTOB = cms.int32(0),
01540          inFPIX = cms.int32(0),
01541         inTID = cms.int32(0),
01542          inBPIX = cms.int32(0),
01543          inTIB = cms.int32(0),
01544          inPIXEL = cms.int32(0),
01545          inTIDplus = cms.int32(0),
01546          inTIDminus = cms.int32(0),
01547          inTECplus = cms.int32(0),
01548          inTECminus = cms.int32(0),
01549          inFPIXplus = cms.int32(0),
01550          inFPIXminus = cms.int32(1),
01551          inENDCAP = cms.int32(0),
01552          inENDCAPplus = cms.int32(0),
01553          inENDCAPminus = cms.int32(0),
01554      )
01555 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01556 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01557 
01558 ##### For Hits:
01559 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
01560 process.TrackerTrackHitFilter.minimumHits = 8
01561 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01562 process.TrackerTrackHitFilter.detsToIgnore = [
01563      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01564     # TIB / TID
01565     #369136710, 369136714, 402668822,
01566     # TOB
01567     #436310989, 436310990, 436299301, 436299302,
01568     # TEC
01569     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01570 ]
01571 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01572 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01573 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01574 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 18.0")
01575 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01576 process.TrackerTrackHitFilter.TrackAngleCut= 0.35 # in rads, starting from the module surface
01577 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01578 
01579 process.triggerSelection=cms.Sequence(process.hltPhysicsDeclared)
01580 """
01581 TrackSelectionMinBiasData = """
01582 ##### For Tracks:collisions taken in deco mode
01583 
01584 process.AlignmentTrackSelector.applyBasicCuts = True
01585 # Note that pMin is overridden and set to zero in
01586 # the offlineTemplate0T
01587 process.AlignmentTrackSelector.pMin    = 3
01588 process.AlignmentTrackSelector.pMax    = 9999.
01589 process.AlignmentTrackSelector.ptMin   = 0.65
01590 process.AlignmentTrackSelector.ptMax   = 9999.
01591 process.AlignmentTrackSelector.etaMin  = -999.
01592 process.AlignmentTrackSelector.etaMax  = 999.
01593 process.AlignmentTrackSelector.nHitMin = 8
01594 process.AlignmentTrackSelector.nHitMin2D = 2
01595 process.AlignmentTrackSelector.chi2nMax = 999.
01596 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01597 process.AlignmentTrackSelector.maxMultiplicity = 1
01598 process.AlignmentTrackSelector.applyNHighestPt = False
01599 process.AlignmentTrackSelector.nHighestPt = 1
01600 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01601 process.AlignmentTrackSelector.applyIsolationCut = False
01602 process.AlignmentTrackSelector.minHitIsolation = 0.8
01603 process.AlignmentTrackSelector.applyChargeCheck = False
01604 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01605 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01606 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01607 
01608 ##### For Hits:
01609 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
01610 process.TrackerTrackHitFilter.minimumHits = 8
01611 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01612 process.TrackerTrackHitFilter.detsToIgnore = [
01613      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01614     # TIB / TID
01615     #369136710, 369136714, 402668822,
01616     # TOB
01617     #436310989, 436310990, 436299301, 436299302,
01618 
01619     # TEC
01620     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01621 ]
01622 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01623 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01624 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01625 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 12.0")
01626 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01627 process.TrackerTrackHitFilter.TrackAngleCut= 0.17 # in rads, starting from the module surface
01628 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01629 
01630 ##############
01631 ##Trigger sequence
01632 #############
01633 #bit 0 is selecting bunch crossing
01634 #bit 40 MinBias trigger
01635 
01636 
01637 process.triggerSelection=cms.Sequence(process.oneGoodVertexFilter)
01638 
01639 """
01640 TrackSelectionIsolatedMuons = """
01641 ##### For Tracks:collisions taken in deco mode
01642 
01643 process.AlignmentTrackSelector.applyBasicCuts = True
01644 # Note that pMin is overridden and set to zero in
01645 # the offlineTemplate0T
01646 process.AlignmentTrackSelector.pMin    = 0
01647 process.AlignmentTrackSelector.pMax    = 9999.
01648 process.AlignmentTrackSelector.ptMin   = 3.
01649 process.AlignmentTrackSelector.ptMax   = 9999.
01650 process.AlignmentTrackSelector.etaMin  = -999.
01651 process.AlignmentTrackSelector.etaMax  = 999.
01652 process.AlignmentTrackSelector.nHitMin = 8
01653 process.AlignmentTrackSelector.nHitMin2D = 2
01654 process.AlignmentTrackSelector.chi2nMax = 999.
01655 process.AlignmentTrackSelector.applyMultiplicityFilter = False
01656 process.AlignmentTrackSelector.maxMultiplicity = 1
01657 process.AlignmentTrackSelector.applyNHighestPt = False
01658 process.AlignmentTrackSelector.nHighestPt = 1
01659 process.AlignmentTrackSelector.seedOnlyFrom = 0 
01660 process.AlignmentTrackSelector.applyIsolationCut = False
01661 process.AlignmentTrackSelector.minHitIsolation = 0.8
01662 process.AlignmentTrackSelector.applyChargeCheck = False
01663 process.AlignmentTrackSelector.minHitChargeStrip = 50.
01664 #process.AlignmentTrackSelector.trackQualities = ["highPurity"]
01665 #process.AlignmentTrackSelector.iterativeTrackingSteps = ["iter1","iter2"]
01666 
01667 ##### For Hits:
01668 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
01669 process.TrackerTrackHitFilter.minimumHits = 8
01670 process.TrackerTrackHitFilter.commands = cms.vstring("keep PXB","keep PXE","keep TIB","keep TID","keep TOB","keep TEC")
01671 process.TrackerTrackHitFilter.detsToIgnore = [
01672      # see https://hypernews.cern.ch/HyperNews/CMS/get/tracker-performance/484.html
01673     # TIB / TID
01674     #369136710, 369136714, 402668822,
01675     # TOB
01676     #436310989, 436310990, 436299301, 436299302,
01677     # TEC
01678     #470340521, 470063045, 470063046, 470114669, 470114670, 470161093, 470161094, 470164333, 470164334, 470312005, 470312006, 470312009, 470067405, 470067406, 470128813
01679 ]
01680 process.TrackerTrackHitFilter.replaceWithInactiveHits = True
01681 process.TrackerTrackHitFilter.stripAllInvalidHits = False
01682 process.TrackerTrackHitFilter.rejectBadStoNHits = True
01683 process.TrackerTrackHitFilter.StoNcommands = cms.vstring("ALL 12.0")
01684 process.TrackerTrackHitFilter.rejectLowAngleHits= True
01685 process.TrackerTrackHitFilter.TrackAngleCut= 0.17 # in rads, starting from the module surface
01686 process.TrackerTrackHitFilter.usePixelQualityFlag= True
01687 
01688 ##############
01689 ##Trigger sequence
01690 #############
01691 #bit 0 is selecting bunch crossing
01692 #bit xy for muons trigger
01693 
01694 
01695 process.triggerSelection=cms.Sequence(process.bptxAnd)
01696 
01697 
01698 
01699 """
01700 
01701 CosmicsOfflineValidation_Deformations="""
01702 import FWCore.ParameterSet.Config as cms
01703 
01704 process = cms.Process("OfflineValidator") 
01705    
01706 process.load("Alignment.OfflineValidation..oO[dataset]Oo._cff")
01707 
01708 #process.source.inputCommands = cms.untracked.vstring('keep *', 'drop *_MEtoEDMConverter_*_*') # hack to get rid of the memory consumption problem in 2_2_X and beond
01709 process.options = cms.untracked.PSet(
01710    wantSummary = cms.untracked.bool(False),
01711    Rethrow = cms.untracked.vstring("ProductNotFound"), # make this exception fatal
01712    fileMode  =  cms.untracked.string('NOMERGE') # no ordering needed, but calls endRun/beginRun etc. at file boundaries
01713 )
01714 
01715  ##
01716  ## Maximum number of Events
01717  ## 
01718 process.maxEvents = cms.untracked.PSet(
01719     input = cms.untracked.int32(.oO[nEvents]Oo.)
01720  )
01721 
01722  ##   
01723  ## Messages & Convenience
01724  ##
01725 process.load("FWCore.MessageLogger.MessageLogger_cfi")
01726 process.MessageLogger.cerr = cms.untracked.PSet(placeholder = cms.untracked.bool(True))
01727 process.MessageLogger.cout = cms.untracked.PSet(INFO = cms.untracked.PSet(
01728 reportEvery = cms.untracked.int32(1000) # every 1000th only
01729 #    limit = cms.untracked.int32(10)       # or limit to 10 printouts...
01730 ))
01731 process.MessageLogger.statistics.append('cout')
01732 
01733 
01734 #-- Track hit filter
01735 # TrackerTrackHitFilter takes as input the tracks/trajectories coming out from TrackRefitter1
01736 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
01737 process.TrackerTrackHitFilter.src = 'TrackRefitter1'
01738 
01739 
01740 
01741 #-- Alignment Track Selection
01742 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
01743 process.AlignmentTrackSelector.src = 'HitFilteredTracks'
01744 process.AlignmentTrackSelector.filter = True
01745 
01746 .oO[TrackSelectionTemplate]Oo.
01747 
01748 #now we give the TrackCandidate coming out of the TrackerTrackHitFilter to the track producer
01749 import RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff
01750 process.HitFilteredTracks = RecoTracker.TrackProducer.CTFFinalFitWithMaterialP5_cff.ctfWithMaterialTracksCosmics.clone(
01751     src = 'TrackerTrackHitFilter',
01752 ###    TrajectoryInEvent = True,
01753      NavigationSchool = '',
01754     TTRHBuilder = "WithAngleAndTemplate"    
01755 )
01756 
01757  ##
01758  ## Load and Configure TrackRefitter1
01759  ##
01760 
01761 
01762 #############
01763 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
01764 
01765 process.TrackRefitter1 = process.TrackRefitterP5.clone(
01766     src = 'ALCARECOTkAlCosmicsCTF0T',
01767     TrajectoryInEvent = True,
01768      NavigationSchool = '',
01769     TTRHBuilder = "WithAngleAndTemplate"
01770 )
01771 process.TrackRefitter2 = process.TrackRefitter1.clone(
01772     src = 'AlignmentTrackSelector',
01773    
01774     )
01775 
01776 
01777  ##
01778  ## Get the BeamSpot
01779  ##
01780 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
01781  
01782  ##
01783  ## GlobalTag Conditions (if needed)
01784  ##
01785 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
01786 process.GlobalTag.connect = "frontier://FrontierProd/CMS_COND_31X_GLOBALTAG"
01787 process.GlobalTag.globaltag = ".oO[GlobalTag]Oo."
01788 
01789 
01790 .oO[LorentzAngleTemplate]Oo.
01791   
01792  ##
01793  ## Geometry
01794  ##
01795 process.load("Configuration.StandardSequences.Geometry_cff")
01796  
01797  ##
01798  ## Magnetic Field
01799  ##
01800 process.load("Configuration/StandardSequences/MagneticField_38T_cff")
01801 
01802 .oO[dbLoad]Oo.
01803 
01804 from CondCore.DBCommon.CondDBSetup_cfi import *
01805 process.trackerSurfaces = cms.ESSource(
01806     "PoolDBESSource",
01807     CondDBSetup,
01808     connect = cms.string('.oO[dbpath]Oo.'),
01809     toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerSurfaceDeformationRcd"),
01810                               tag = cms.string("Deformations")
01811                                )
01812                       )
01813     )
01814 process.es_prefer_trackerSurfaces = cms.ESPrefer("PoolDBESSource", "trackerSurfaces")
01815 
01816 
01817 .oO[APE]Oo.
01818 
01819 ## to apply misalignments
01820 #TrackerDigiGeometryESModule.applyAlignment = True
01821    
01822  ##
01823  ## Load and Configure OfflineValidation
01824  ##
01825 
01826 process.load("Alignment.OfflineValidation.TrackerOfflineValidation_.oO[offlineValidationMode]Oo._cff")
01827 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..Tracks = 'TrackRefitter2'
01828 process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..trajectoryInput = 'TrackRefitter2'
01829 #process.TrackerOfflineValidation.oO[offlineValidationMode]Oo..moduleLevelHistsTransient = cms.bool(.oO[offlineModuleLevelHistsTransient]Oo.)
01830 process.TrackerOfflineValidationStandalone.moduleLevelHistsTransient = cms.bool(False)
01831 process.TrackerOfflineValidationStandalone.moduleLevelProfiles    = cms.bool(True)
01832 process.TFileService.fileName = '.oO[outputFile]Oo.'
01833 
01834  ##
01835  ## PATH
01836  ##
01837 process.p = cms.Path(process.offlineBeamSpot*process.TrackRefitter1*process.TrackerTrackHitFilter*process.HitFilteredTracks
01838                      *process.AlignmentTrackSelector*process.TrackRefitter2*process.seqTrackerOfflineValidation.oO[offlineValidationMode]Oo.)
01839 
01840 
01841 """
01842 
01843 
01844