Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
# last update on $Date: 2009/07/17 14:17:33 $ by $Author: kaschube $

import FWCore.ParameterSet.Config as cms

process = cms.Process("Alignment")

process.options = cms.untracked.PSet(
    Rethrow = cms.untracked.vstring("ProductNotFound") # do not accept this exception
    )

# initialize  MessageLogger
# process.load("FWCore.MessageLogger.MessageLogger_cfi")
# This whole mess does not really work - I do not get rid of FwkReport and TrackProducer info...
process.MessageLogger = cms.Service("MessageLogger",
    cerr = cms.untracked.PSet(
        enable = cms.untracked.bool(False)
    ),
    files = cms.untracked.PSet(
        alignment = cms.untracked.PSet(
            Alignment = cms.untracked.PSet(
                limit = cms.untracked.int32(-1)
            ),
            DEBUG = cms.untracked.PSet(
                limit = cms.untracked.int32(-1)
            ),
            ERROR = cms.untracked.PSet(
                limit = cms.untracked.int32(-1)
            ),
            INFO = cms.untracked.PSet(
                limit = cms.untracked.int32(10)
            ),
            LogicError = cms.untracked.PSet(
                limit = cms.untracked.int32(-1)
            ),
            WARNING = cms.untracked.PSet(
                limit = cms.untracked.int32(10)
            ),
            enableStatistics = cms.untracked.bool(True),
            threshold = cms.untracked.string('DEBUG')
        )
    )
)

# initialize magnetic field
process.load("Configuration.StandardSequences.MagneticField_cff")
#process.load("Configuration.StandardSequences.MagneticField_0T_cff")

# ideal geometry and interface
process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
# for Muon: process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")

process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.GlobalTag.globaltag = 'MC_31X_V3::All' #'IDEAL_V12::All' # 'CRAFT_ALL_V11::All' # 'IDEAL_30X::All'  # take your favourite

# using database file
from CondCore.DBCommon.CondDBSetup_cfi import *
process.trackerAlignment = cms.ESSource("PoolDBESSource",
                                        CondDBSetup,
#                                        connect = cms.string("sqlite_file:/afs/cern.ch/user/k/kaschube/cms/CMSSW_2_2_10/src/LasReader/TestProducer/alignments_MP.db"),
#                                        connect = cms.string("frontier://FrontierProd/CMS_COND_21X_ALIGNMENT"),
                                        connect = cms.string("frontier://FrontierProd/CMS_COND_31X_FROM21X"),
                                        toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"),
                                                                   tag = cms.string("TrackerGeometry_v5_offline")), #"Alignments"
                                                          cms.PSet(record = cms.string("TrackerAlignmentErrorExtendedRcd"),
                                                                   tag = cms.string("TrackerGeometryErrors_v5_offline")) #"AlignmentErrorsExtended"
                                                          )
                                        )
process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource","trackerAlignment")
#del process.es_prefer_GlobalTag

process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")

# track selection for alignment
process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
process.AlignmentTrackSelector.src = 'ALCARECOTkAlMinBias' #'generalTracks' ## ALCARECOTkAlMuonIsolated # adjust to input file
process.AlignmentTrackSelector.ptMin = 2.
process.AlignmentTrackSelector.etaMin = -5.
process.AlignmentTrackSelector.etaMax = 5.
process.AlignmentTrackSelector.nHitMin = 9
process.AlignmentTrackSelector.chi2nMax = 100.
# some further possibilities
#process.AlignmentTrackSelector.applyNHighestPt = True
#process.AlignmentTrackSelector.nHighestPt = 2
#process.AlignmentTrackSelector.applyChargeCheck = True
#process.AlignmentTrackSelector.minHitChargeStrip = 50.
# needs RECO files:
#process.AlignmentTrackSelector.applyIsolationCut = True 
#process.AlignmentTrackSelector.minHitIsolation = 0.8


# refitting
process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
# In the following use
# TrackRefitter (normal tracks), TrackRefitterP5 (cosmics) or TrackRefitterBHM (beam halo)
process.TrackRefitter.src = 'AlignmentTrackSelector'
process.TrackRefitter.TrajectoryInEvent = True
# beam halo propagation needs larger phi changes going from one TEC to another
#process.MaterialPropagator.MaxDPhi = 1000.
# the following for refitting with analytical propagator (maybe for CRUZET?)
#process.load("TrackingTools.KalmanUpdators.KFUpdatorESProducer_cfi")
#process.load("TrackingTools.KalmanUpdators.Chi2MeasurementEstimatorESProducer_cfi")
#process.load("TrackingTools.TrackFitters.KFTrajectoryFitter_cfi")
#process.load("TrackingTools.TrackFitters.KFTrajectorySmoother_cfi")
#process.load("TrackingTools.TrackFitters.KFFittingSmoother_cfi")
#process.load("TrackingTools.GeomPropagators.AnalyticalPropagator_cfi")
#process.load("TrackingTools.KalmanUpdators.Chi2MeasurementEstimatorESProducer_cfi")
#process.TrackRefitter.Propagator = "AnalyticalPropagator"
#process.KFTrajectoryFitter.Propagator = "AnalyticalPropagator"
#process.KFTrajectorySmoother.Propagator = "AnalyticalPropagator"
## Not to loose hits/tracks, we might want to open the allowed chi^2 contribution for single hits:
##process.Chi2MeasurementEstimator.MaxChi2 = 50. # untested, default 30
#process.load("RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi")
#process.load("RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi")
#process.load("RecoTracker.TransientTrackingRecHit.TransientTrackingRecHitBuilder_cfi")
## end refitting with analytical propagator


# Alignment producer
process.load("Alignment.CommonAlignmentProducer.AlignmentProducer_cff")

process.AlignmentProducer.ParameterBuilder.Selector = cms.PSet(
    alignParams = cms.vstring(
#        'PixelHalfBarrels,rrrrrr', 
#        'PXEndCaps,111111',
#        'TrackerTOBHalfBarrel,111111', 
#        'TrackerTIBHalfBarrel,111111', 
#        'TrackerTECEndcap,111111', 
#        'TrackerTIDEndcap,111111', 
#        'PixelDets,111001', 
#        'BarrelDetsDS,111001', 
#        'TECDets,111001,endCapDS', 
#        'TIDDets,111001,endCapDS', 
#        'BarrelDetsSS,101001', 
#        'TECDets,101001,endCapSS', 
#        'TIDDets,101001,endCapSS'
#
# very simple scenario for testing
# # 6 parameters for larger structures
#         'PixelHalfBarrels,ffffff',
#         'PXEndCaps,111111',
#         'TrackerTOBHalfBarrel,111111',
#         'TrackerTIBHalfBarrel,111111',
#         'TrackerTECEndcap,ffffff',
#         'TrackerTIDEndcap,ffffff'
#
    #'TrackerTPBHalfBarrel,rrrrrr',
    #'TrackerTPEEndcap,rrrrrr',
    #'TrackerTIBHalfBarrel,110111',
    'TrackerTIBHalfBarrel,ff0fff,zIsNeg', # not yet enough fixed d.o.f. ...
    'TrackerTIBHalfBarrel,110111,zIsPos',
    'TrackerTOBHalfBarrel,110111',
    #'TrackerTECEndcap,111111',
    #'TIBSSLayers,110111',
    #'TIBDSLayers,111111',
    #'TOBSSLayers,110111',
    #'TOBDSLayers,111111',
    #'TECLayers,111111'

    'TrackerTECDisk,110001'#,
    #        'TrackerTECEndcap,ff0fff'
    #        'TrackerTECDiskLayers11,ff0fff',
    #        'TrackerTECDiskLayers28,110111',
    #        'TrackerTECDiskLayers99,ff0fff'    
    
    ),
    endCapSS = cms.PSet(
        phiRanges = cms.vdouble(),
        rRanges = cms.vdouble(40.0, 60.0, 75.0, 999.0),
        etaRanges = cms.vdouble(),
        yRanges = cms.vdouble(),
        xRanges = cms.vdouble(),
        zRanges = cms.vdouble()
    ),
    endCapDS = cms.PSet(
        phiRanges = cms.vdouble(),
        rRanges = cms.vdouble(0.0, 40.0, 60.0, 75.0),
        etaRanges = cms.vdouble(),
        yRanges = cms.vdouble(),
        xRanges = cms.vdouble(),
        zRanges = cms.vdouble()
    ),
    zIsPos = cms.PSet(phiRanges = cms.vdouble(),
                      rRanges = cms.vdouble(),
                      etaRanges = cms.vdouble(),
                      yRanges = cms.vdouble(),
                      xRanges = cms.vdouble(),
                      zRanges = cms.vdouble(-99999., 0.)
                      ),
    zIsNeg = cms.PSet(phiRanges = cms.vdouble(),
                      rRanges = cms.vdouble(),
                      etaRanges = cms.vdouble(),
                      yRanges = cms.vdouble(),
                      xRanges = cms.vdouble(),
                      zRanges = cms.vdouble(0, 99999.)
                      )
)

# LAS first test misalignment
#process.AlignmentProducer.MisalignmentScenario = cms.PSet(
    #saveToDbase = cms.untracked.bool(False),
    #setRotations = cms.bool(True),
    #setTranslations = cms.bool(True),
    #seed = cms.int32(121212),
    #distribution = cms.string('gaussian'),
    #setError = cms.bool(True),

#    TECs = cms.PSet(
#        TECsDisks = cms.PSet(
#            dZlocal = cms.double(0.0),
#            phiXlocal = cms.double(0.0),
#            dYlocal = cms.double(0.05),
#            phiZlocal = cms.double(0.001),
#            dXlocal = cms.double(0.05)#,
#            phiYlocal = cms.double(0.0)
#        )#,
#        TECDisk5 = cms.PSet( # from TrackerNoKnowledgeScenario
#            dZlocal = cms.double(0.0112),
#            phiXlocal = cms.double(0.0002),
#            dYlocal = cms.double(0.01),
#            phiZlocal = cms.double(0.0001),
#            dXlocal = cms.double(0.01)#,
#            phiYlocal = cms.double(0.0001)
#        )   
#        TECDisk2_3_4_5_6_7_8 = cms.PSet(
#            dZlocal = cms.double(0.0112),
#            phiZlocal = cms.double(0.0001),
#            dXlocal = cms.double(0.0112),
#            phiXlocal = cms.double(0.0002),
#            dYlocal = cms.double(0.0206),
#            phiYlocal = cms.double(0.0001)
#        )
#    )
#)

#process.AlignmentProducer.doMuon = True # to align muon system
process.AlignmentProducer.doMisalignmentScenario = True # False
# If the above is true, you might want to choose the scenario:
#from Alignment.TrackerAlignment.Scenarios_cff import *
#process.AlignmentProducer.MisalignmentScenario = TrackerSurveyLASOnlyScenario
process.AlignmentProducer.applyDbAlignment = True # neither globalTag nor trackerAlignment
# monitor not strictly needed:
#process.TFileService = cms.Service("TFileService", fileName = cms.string("histograms.root"))
#process.AlignmentProducer.monitorConfig = cms.PSet(monitors = cms.untracked.vstring ("AlignmentMonitorGeneric"),
#                                                   AlignmentMonitorGeneric = cms.untracked.PSet()
#                                                   )

process.AlignmentProducer.algoConfig = cms.PSet(
    process.MillePedeAlignmentAlgorithm
)

#from Alignment.MillePedeAlignmentAlgorithm.PresigmaScenarios_cff import *
#process.AlignmentProducer.algoConfig.pedeSteerer.Presigmas.extend(TrackerShortTermPresigmas.Presigmas)
process.AlignmentProducer.algoConfig.mode = 'full' # 'full' # 'mille' # 'pede' # 'pedeSteer'
process.AlignmentProducer.algoConfig.mergeBinaryFiles = cms.vstring()
process.AlignmentProducer.algoConfig.monitorFile = cms.untracked.string("millePedeMonitor.root")
process.AlignmentProducer.algoConfig.binaryFile = cms.string("milleBinaryISN.dat")
#process.AlignmentProducer.algoConfig.TrajectoryFactory = process.BzeroReferenceTrajectoryFactory
# ...OR TwoBodyDecayTrajectoryFactory OR ...
#process.AlignmentProducer.algoConfig.max2Dcorrelation = 2. # to switch off
#process.AlignmentProducer.algoConfig.fileDir = '/tmp/flucke'
#process.AlignmentProducer.algoConfig.pedeReader.fileDir = './'
#process.AlignmentProducer.algoConfig.treeFile = 'treeFile_lasFirst.root'
##default is sparsGMRES                                    <method>  n(iter)  Delta(F)
process.AlignmentProducer.algoConfig.pedeSteerer.method = 'diagonalisation  6  0.8'
process.AlignmentProducer.algoConfig.pedeSteerer.options = cms.vstring(
    'hugecut 500.0',
   'entries 1' #, 'pedeSteerHierarchy_tecdisks.txt'
   #'chisqcut  20.0  4.5' # ,'outlierdownweighting 3' #,'dwfractioncut 0.1'
   #'bandwidth 6'
)
#process.AlignmentProducer.algoConfig.pedeSteerer.steerFileDebug = True
#process.AlignmentProducer.algoConfig.pedeSteerer.minHieraConstrCoeff = 0.
#process.AlignmentProducer.algoConfig.pedeSteerer.minHieraParPerConstr = 1


process.source = cms.Source("PoolSource",
    skipEvents = cms.untracked.uint32(0),
    fileNames = cms.untracked.vstring(
    #"file:aFile.root" #"rfio:/castor/cern.ch/cms/store/..."
    #"file:/afs/cern.ch/user/k/kaschube/cms/CMSSW_2_2_10/src/Alignment/LaserAlignment/tkLasBeams_dataCRAFT.root"
    "file:/afs/cern.ch/user/f/flucke/cms/CMSSW/CMSSW_3_1_0_pre10/src/tkLasBeams_3_1_X.root"
    # old: tkLasBeams_dataCRAFT.root; new, bad: tkLasBeams_CRAFT_2_2_9.root
    )
)

#process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )

process.load("Alignment.LaserAlignment.TkLasBeamFitter_cfi")
process.AlignmentProducer.tkLasBeamTag = "TkLasBeamFitter"


process.p = cms.Path(process.offlineBeamSpot
                     *process.TkLasBeamFitter
                     #*process.AlignmentTrackSelector
                     #*process.TrackRefitter
                     )

#--- SAVE ALIGNMENT CONSTANTS TO DB --------------------------------
# Default in MPS is saving as alignment_MP.db. Uncomment next line not to save them.
# For a standalone (non-MPS) run, uncomment also the PoolDBOutputService part.
#process.AlignmentProducer.saveToDB = True
##process.AlignmentProducer.saveApeToDB = True # no sense: Millepede does not set it!
#from CondCore.DBCommon.CondDBSetup_cfi import *
#process.PoolDBOutputService = cms.Service(
#    "PoolDBOutputService",
#    CondDBSetup,
#    timetype = cms.untracked.string('runnumber'),
#    connect = cms.string('sqlite_file:TkAlignment.db'),
#    toPut = cms.VPSet(cms.PSet(
#      record = cms.string('TrackerAlignmentRcd'),
#      tag = cms.string('testTag')
#    )#,
#    #                  cms.PSet(
#    #  record = cms.string('TrackerAlignmentErrorExtendedRcd'),
#    #  tag = cms.string('testTagAPE') # needed is saveApeToDB = True
#    #)
#                      )
#    )
# MPS needs next line as placeholder for pede _cfg.py:
#MILLEPEDEBLOCK